High-performance Top-k screening system and method supporting any sequence length

By designing high-performance TOP-K screening systems with any sequence length, data flow processing is used with hardware, which solves the restrictions on the memory on the film on the existing technology, and achieves high-efficiency and scalable TOP-K screening effects.

CN119357233AActive Publication Date: 2025-01-24SUN YAT SEN UNIV

Patent Information

Application Number
CN202411239907.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2025-01-24
Estimated Expiration
2044-09-05

AI Technical Summary

Technical Problem

The existing Top-k algorithm and hardware implementations rely heavily on limited on-chip memory, limiting scalability and upper limit of k, and cannot efficiently handle Top-k problems of arbitrary sequence lengths.

Method used

Design a high-performance TOP-K screening system that supports any sequence length, including mutual register array, hub selection register array, priority encoder, comparative unit, accumulator, and judgment module, realize data flow processing through hardware, reduce memory, reduce memory Demand, improve screening efficiency.

Benefits of technology

The efficient screening and sorting of arbitrary length data sequences improve the scalability and performance of the system, and reduce delay and power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357233A_ABST
    Figure CN119357233A_ABST
Patent Text Reader

Abstract

The invention discloses a high-performance Top-k screening system and method supporting any sequence length. The system comprises a mutually different register array used for storing data sequence segments needing to be subjected to data size comparison; the hub selection register array is used for indicating whether the data in the corresponding mutually different register array can be used as a hub or not in the current data size comparison round; the hub unit is used for providing a hub selection set or updating the hub selection set according to a statistical result of a previous data size comparison round provided by the accumulator; the accumulator is used for counting the number of data greater than the hub in the data input sequence in the current data size comparison round according to the number of segments provided by the comparison unit; the judgment module is used for determining a screening result; or updating the hub selection set. The screening system provided by the embodiment of the invention has relatively high expandability and is beneficial to improving the data screening efficiency; the method can be widely applied to the technical field of hardware implementation algorithms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hardware-implemented algorithms, and in particular to a high-performance Top-k screening system and method supporting arbitrary sequence lengths. Background Art

[0002] In recent years, both the amount of data and the computing power required to analyze data have exploded. In particular, efficient processing of the Top-k problem has become increasingly important in many application areas. The Top-k problem is frequently encountered in the process of model output sampling, training, and dynamic pruning in deep learning, in the search recommendation algorithm of information retrieval, and in the clustering and classification steps of data mining. The Top-k algorithm is widely used, which also puts higher requirements on the scalability and efficiency of the Top-k algorithm. With the growing demand for high-speed data stream processing, implementing the Top-k algorithm through software will take too long and consume more power. In order to achieve higher throughput, energy efficiency, and lower latency, many studies have proposed Top-k algorithms in hardware implementation. However, existing Top-k algorithms and hardware implementations rely heavily on limited on-chip memory, which limits scalability and the upper limit of k. Summary of the invention

[0003] The purpose of the present invention is to solve one of the technical problems existing in the prior art to at least a certain extent.

[0004] To this end, the object of the present invention is to provide an efficient and high-performance Top-k screening system and method that supports any sequence length.

[0005] In order to achieve the above technical objectives, the technical solutions adopted by the embodiments of the present invention include the following aspects:

[0006] On the one hand, an embodiment of the present invention provides a high-performance Top-k screening system that supports arbitrary sequence lengths, including: a mutually exclusive register array, used to store data sequence segments that need to be compared in data size; the data in the mutually exclusive register array includes the value and index of the data sequence, and the mutually exclusive register array is obtained by segmenting the data input sequence based on the bit width of the mutually exclusive register array; a hub selection register array, used to indicate whether the data in the corresponding mutually exclusive register array can be used as a hub in the current data size comparison round; the hub unit is used to provide a hub selection set, or update the hub selection set according to the statistical results of the previous data size comparison round provided by the accumulator; the hub selection register array is obtained by segmenting the data input sequence based on the bit width of the hub selection register array. The hub selection set is obtained by segmentation; the priority encoder is used to determine the hub index corresponding to the hub of the current data size comparison round according to the hub selection register array; the comparison unit is used to compare the data size of each bit in the different register array with the hub, and determine the number of segments of data greater than the hub, or determine the number of segments of data less than the hub; the accumulator is used to count the number of data greater than the hub in the data input sequence in the current data size comparison round according to the number of segments provided by the comparison unit, or the number of data less than the hub in the data input sequence; the judgment module is used to determine the screening result according to whether the data number meets the preset threshold; or update the hub selection set. The bit width / number of each component or device in the embodiment of the present application can be adjusted, and data of any length can be screened and sorted; the system has strong scalability. At the same time, the embodiment of the present application implements the processing of data streams through hardware, which has less memory requirements and is conducive to improving screening efficiency. The screening system provided by the embodiment of the present application has strong scalability, which is conducive to improving data screening efficiency.

[0007] In addition, the high-performance Top-k screening system supporting any sequence length according to the above embodiment of the present invention may also have the following additional technical features:

[0008] Furthermore, in the embodiment of the present invention, the high-performance Top-k screening system supporting arbitrary sequence length, the hub unit includes:

[0009] A hub selection space reduction module, used for performing bitwise operations on the hub selection set and the comparison vector set, and using the operation result as a new hub selection set to reduce the hub search space;

[0010] The comparison vector set is used to store the data size comparison result of the current data size comparison round generated by the comparison unit.

[0011] Furthermore, in one embodiment of the present invention, the comparison unit includes:

[0012] A comparator array, used to compare the data size of each bit in the mutually exclusive register array with the hub; the number of the comparator array has the same value as the bit width of the mutually exclusive register array;

[0013] A comparison register array, used for storing the segmentation result of the data size comparison of the current segment, and putting the segmentation result of the data size comparison into the comparison vector set;

[0014] A single-bit counting network is used to count the number of 1s in the comparison register array; the 1 in the comparison register array is used to represent that the data at the corresponding position of the mutually exclusive register array is greater than the hub, or the data at the corresponding position of the mutually exclusive register array is less than the hub.

[0015] Furthermore, in one embodiment of the present invention, the priority encoder is used to set the data corresponding to the hub index in the hub selection set to 0.

[0016] Furthermore, in one embodiment of the present invention, the judging module is used to:

[0017] If the data quantity is equal to the preset threshold, determining the result index corresponding to the screening result according to the comparison vector set;

[0018] Alternatively, if the amount of data obtained in the current data size comparison round is less than the preset threshold, the comparison vector set is inverted and bitwise ANDed with the pivot selection set, and the result is used as the new pivot selection set;

[0019] Alternatively, if the amount of data obtained in the current data size comparison round is greater than the preset threshold, the comparison vector set and the hub selection set are bitwise ANDed, and the result is used as the new hub selection set.

[0020] On the other hand, an embodiment of the present invention proposes a high-performance Top-k screening method supporting any sequence length, which is applied to the above-mentioned high-performance Top-k screening system supporting any sequence length. The method includes:

[0021] Compare the data in the mutually exclusive register array with the hub, and determine the number of segments of the data that is larger than the hub, or determine the number of segments of the data that is smaller than the hub; the hub is to determine the hub index according to the hub selection register array, and then determine the data corresponding to the hub index in the mutually exclusive register array; the hub selection register array is used to indicate whether the data in the corresponding mutually exclusive register array can be used as the hub in the current data size comparison round;

[0022] Count the current data size and compare the sum of the number of segments in each segment in the round to determine the amount of data;

[0023] According to the data quantity, the hub selection set of the hub selection unit is updated, and then the hub is updated, and the data in the mutually different register array is compared with the hub, and the number of segments of the data greater than the hub is determined; or, the number of segments of the data less than the hub is determined; until the obtained data quantity meets the preset threshold, the screening result is determined; the hub selection set includes several segments of the hub selection register array.

[0024] Furthermore, the high-performance Top-k screening method supporting any sequence length according to the embodiment of the present invention further includes:

[0025] Providing an initial pivot selection set, the length of the pivot selection set being the same as the length of the data input sequence;

[0026] Alternatively, according to the hub index provided by the priority encoder, the data corresponding to the hub index in the hub selection set is set to 0;

[0027] Alternatively, if the data quantity does not meet a preset threshold, the hub selection set is updated.

[0028] Furthermore, the high-performance Top-k screening method supporting any sequence length in the embodiment of the present invention, until the amount of data obtained meets a preset threshold, determines the screening result, including:

[0029] If the data quantity is equal to the preset threshold, determining the result index corresponding to the screening result according to the comparison vector set;

[0030] The updating of the hub selection set of the hub selection unit according to the amount of data includes:

[0031] If the amount of data obtained in the current data size comparison round is less than the preset threshold, the comparison vector set is inverted, and then bitwise ANDed with the pivot selection set, and the result is used as the new pivot selection set;

[0032] Alternatively, if the amount of data obtained in the current data size comparison round is greater than the preset threshold, the comparison vector set and the hub selection set are bitwise ANDed, and the result is used as the new hub selection set.

[0033] Furthermore, the high-performance Top-k screening method supporting arbitrary sequence length according to an embodiment of the present invention further includes: splicing a position index after each value of the data input sequence to form a different sequence; and segmenting the different sequence and placing it into the different register array.

[0034] On the other hand, an embodiment of the present invention provides a high-performance Top-k screening device supporting any sequence length, including the above-mentioned high-performance Top-k screening system supporting any sequence length.

[0035] On the other hand, an embodiment of the present invention provides a high-performance Top-k screening device supporting any sequence length, comprising:

[0036] at least one processor;

[0037] at least one memory for storing at least one program;

[0038] When the at least one program is executed by the at least one processor, the at least one processor implements the above-mentioned high-performance Top-k screening method supporting any sequence length.

[0039] On the other hand, an embodiment of the present invention provides a storage medium storing a program executable by a processor, wherein the program executable by the processor is used to implement the above-mentioned high-performance Top-k screening method supporting arbitrary sequence length when executed by the processor.

[0040] The screening system provided by the embodiment of the present invention includes: a mutually exclusive register array, which is used to store data sequence segments that need to be compared in data size; the data in the mutually exclusive register array includes the value and index of the data sequence, and the mutually exclusive register array is obtained by segmenting the data input sequence based on the bit width of the mutually exclusive register array; a hub selection register array, which is used to indicate whether the data in the corresponding mutually exclusive register array can be used as a hub in the current data size comparison round; the hub unit is used to provide a hub selection set, or update the hub selection set according to the statistical results of the previous data size comparison round provided by the accumulator; the hub selection register array is obtained by segmenting the hub selection set based on the bit width of the hub selection register array Obtain; a priority encoder, used to determine the hub index corresponding to the hub of the current data size comparison round according to the hub selection register array; a comparison unit, used to compare the data size of each bit in the mutually exclusive register array with the hub, and determine the number of segments of data greater than the hub, or determine the number of segments of data less than the hub; the accumulator, used to count the number of data greater than the hub in the data input sequence, or the number of data less than the hub in the data input sequence in the current data size comparison round according to the number of segments provided by the comparison unit; a judgment module, used to determine the screening result according to whether the number of data meets a preset threshold; or, update the hub selection set. The bit width / number of each component or device in the embodiment of the present application can be adjusted, and data of any length can be screened and sorted; the system has strong scalability. At the same time, the embodiment of the present application implements data stream processing through hardware, which has less memory requirements and is conducive to improving screening efficiency. The screening system provided by the embodiment of the present application has strong scalability, which is conducive to improving data screening efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the embodiments of the present invention or the drawings of related technical solutions in the prior art are introduced below. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0042] Figure 1 A schematic diagram of the structure of an embodiment of a high-performance Top-k screening system supporting any sequence length provided by the present invention;

[0043] Figure 2 A schematic diagram of the structure of an embodiment of an 8-bit single-bit counting network provided by the present invention;

[0044] Figure 3 A schematic diagram of the structure of an embodiment of a 7-bit single-bit counting network provided by the present invention;

[0045] Figure 4 A schematic diagram of the structure of an embodiment of a 16-bit single-bit counting network provided by the present invention;

[0046] Figure 5 A schematic flow chart of an embodiment of a high-performance Top-k screening method supporting any sequence length provided by the present invention;

[0047] Figure 6 A schematic structural diagram of an embodiment of a high-performance Top-k screening device supporting arbitrary sequence length provided by the present invention. DETAILED DESCRIPTION

[0048] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.

[0049] In recent years, both the amount of data and the computing power required to analyze data have exploded. In particular, efficient processing of Top-k problems has become increasingly important in many application areas. Top-k problems are frequently encountered in the process of model output sampling, training, and dynamic pruning in deep learning, in search recommendation algorithms in information retrieval, and in steps such as clustering and classification in data mining. However, the scale of Top-k problems varies greatly in different application areas. For large-scale training of deep learning models, Top-k is used for gradient compression in deep learning model training, selecting the top 0.1% of values ​​from millions or billions of gradient values ​​to reduce data transmission costs; in the process of large language model inference, its output is often sampled from the k most probable tokens in the entire vocabulary, and the vocabulary length of large models such as GPT-4 can reach hundreds of thousands; the possible k in the k nearest neighbor (KNN) operation involved in database search is as high as several thousand. Such a wide range of problem scales poses a challenge to the efficiency of Top-k algorithms. Therefore, the scalability and efficiency of Top-k algorithms are crucial for practical applications. With the growing demand for high-speed data stream processing, implementing the Top-k algorithm through software will take too long and consume more power. Therefore, it becomes increasingly important to speed up the operation process and improve energy efficiency. In order to achieve higher throughput, energy efficiency and lower latency, many studies have proposed Top-k algorithms on hardware implementations. However, existing Top-k algorithms and hardware implementations rely heavily on limited on-chip memory, which limits scalability and the upper limit of k.

[0050] In order to find the first k largest or smallest elements from a set of data, a common approach is to sort the entire set of data and take the first k elements, such as the quick sort algorithm, with a time complexity of O(nlog(n)), where n is the number of data. However, the complexity of implementing the sorting algorithm using hardware circuits is high, and it consumes a lot of valuable hardware resources, especially for edge application scenarios with limited resources. If the amount of data is very large, a large amount of memory is required to load the data, and if k is much smaller than n, a lot of useless calculations will be generated, so the full sorting method is not desirable in most scenarios. Another method is to use partial sorting. There is practical work combining priority queues and bitonic merge sorting. However, due to the characteristics of the algorithm, the input sequence is required to be a fixed length of a power of 2, and the scalability is also limited by the upper bound of k, because the sorting and merging must reside entirely in the on-chip memory of limited size. The partition-based method recursively assigns values ​​to buckets and records the number of elements in each bucket until all k values ​​are found. Typical algorithms include QuickSelect, BucketSelect, SampleSelect, and RadixSelect, but they also have the disadvantage that performance varies with different data distributions. The Top-k problem can also be solved using a heap. A heap is a special tree data structure that satisfies the heap property: the value of each node is greater than or equal to (or less than or equal to) the value of its child node. In a max-heap, the value of a parent node is always greater than or equal to any child node; in a min-heap, the value of a parent node is always less than or equal to any child node. In software algorithms, using a heap as the data structure for the Top-k problem enables efficient querying, because the time complexity of the insertion and deletion operations of the heap is O(log(n)). Therefore, using a min-heap or max-heap to maintain the first k elements can solve the Top-k problem, with a time complexity of O(nlog(k)). However, it is difficult to construct this heap tree data structure using parallel hardware circuits, and it is also impossible to implement data insertion and deletion.

[0051] A high-performance Top-k screening system and method supporting arbitrary sequence length according to an embodiment of the present invention will be described in detail below with reference to the accompanying drawings. First, a high-performance Top-k screening system supporting arbitrary sequence length according to an embodiment of the present invention will be described with reference to the accompanying drawings.

[0052] Figure 1 : is a schematic diagram of a high-performance Top-k screening system supporting arbitrary sequence length according to an embodiment of the present invention, wherein the system specifically comprises:

[0053] A mutually exclusive register array, used to store data sequence segments that need to be compared in data size; the data in the mutually exclusive register array includes the value and index of the data sequence, and the mutually exclusive register array is obtained by segmenting the data input sequence based on the bit width of the mutually exclusive register array;

[0054] The pivot selection register array is used to indicate whether the data in the corresponding mutually exclusive register array can be used as a pivot in the current data size comparison round;

[0055] The hub unit is used to provide a hub selection set, or update the hub selection set according to the statistical result of the previous data size comparison round provided by the accumulator; the hub selection register array is obtained by segmenting the hub selection set based on the bit width of the hub selection register array;

[0056] A priority encoder, for determining a hub index corresponding to a hub of a current data size comparison round according to the hub selection register array;

[0057] A comparison unit, used to compare the data size of each bit of the data in the mutually exclusive register array with the hub, and determine the number of segments of the data that is larger than the hub, or determine the number of segments of the data that is smaller than the hub;

[0058] The accumulator is used to count the number of data in the data input sequence that is larger than the hub, or the number of data in the data input sequence that is smaller than the hub, in the current data size comparison round according to the number of segments provided by the comparison unit;

[0059] The judgment module is used to determine the screening result according to whether the amount of data meets a preset threshold; or to update the hub selection set.

[0060] The hub in the embodiment of the present application is a threshold for data size comparison; the number of bits of the mutually exclusive register array is the same as that of the hub selection register array. The data corresponding to the data input sequence is placed at each position in the mutually exclusive register array; the data placed at each position in the hub selection register array is used to characterize that in the current round of data size comparison, the data in the corresponding data sequence segment can be used as a hub. In some embodiments, 1 can be used to indicate that the data at the position corresponding to the data sequence segment can be used as a hub, and 0 can be used to indicate that the data at the position corresponding to the data sequence segment cannot be used as a hub. The hub selection register array comes from a hub selection set, and the length of the hub selection set is the same as the length of the data input sequence. In some embodiments, the initial value of the hub selection set is set to all 1s.

[0061] It is understandable that after the data input sequence is segmented, multiple data size comparisons can be performed. That is, after each data input sequence is stored in the different register array, it is compared with the hub, and the number of segments in each data input sequence that are larger than the hub or smaller than the hub is determined by the comparison unit. After all segments are compared, the number of data in the data input sequence that is larger than the hub or smaller than the hub in the current data size comparison round is determined by the accumulator.

[0062] Understandably, in the era of big data and artificial intelligence, filtering data is a frequently faced task requirement, that is, it is usually necessary to quickly find the top k largest or smallest elements from a large amount of data, which is called the Top-k problem. It is a basic task in many fields such as information retrieval, recommendation systems, data services, and scientific computing. With the rapid growth of data volume, high-performance parallel Top-k algorithms have become essential. Filtering data by designing dedicated Top-k hardware circuits can increase speed, save computing resources, and play an important role in scenarios that require real-time decision-making or rapid response.

[0063] The present invention proposes a high-performance parallel Top-k engine and screening algorithm that supports arbitrary sequence lengths, solving the problem that efficient screening cannot be performed in existing Top-k circuits. The solution relates to the field of integrated circuits and computer technology, and is based on the screening algorithm and hardware circuit implementation. It not only has O(log(n)) time complexity and O(n) space complexity, but also has the characteristics of scalability and high parallelism in terms of circuit structure and data flow, and supports screening of data sequences of arbitrary lengths.

[0064] Optionally, in the embodiment of the present invention, the high-performance Top-k screening system supporting any sequence length, the hub unit includes:

[0065] A hub selection space reduction module, used for performing bitwise operations on the hub selection set and the comparison vector set, and using the operation result as a new hub selection set to reduce the hub search space;

[0066] The comparison vector set is used to store the data size comparison result of the current data size comparison round generated by the comparison unit.

[0067] Optionally, in the high-performance Top-k screening system supporting any sequence length in the embodiment of the present invention, the comparison unit includes:

[0068] A comparator array, used to compare the data size of each bit in the mutually exclusive register array with the hub; the number of the comparator array has the same value as the bit width of the mutually exclusive register array;

[0069] A comparison register array, used for storing the segmentation result of the data size comparison of the current segment, and putting the segmentation result of the data size comparison into the comparison vector set;

[0070] A single-bit counting network is used to count the number of 1s in the comparison register array; the 1 in the comparison register array is used to represent that the data at the corresponding position of the mutually exclusive register array is greater than the hub, or the data at the corresponding position of the mutually exclusive register array is less than the hub.

[0071] In some possible implementations, the bit widths of the comparison register array and the different register array and the number of comparator arrays are consistent. In some embodiments, the comparison register can be represented by 1 to indicate that a positive result is obtained through the comparator. Exemplarily, if the comparator array is greater than, the comparison register uses 1 to indicate that the data at that position of the different register array is greater than the pivot; the comparison register uses 0 to indicate that the data at that position of the different register array is less than or equal to the pivot.

[0072] Optionally, in the high-performance Top-k screening system supporting arbitrary sequence length in an embodiment of the present invention, the priority encoder is used to set the data corresponding to the hub index in the hub selection set to 0.

[0073] In some possible implementations, 0 indicates that the data in the distinct register array corresponding to the pivot index will not be selected as a pivot in subsequent data size comparison rounds.

[0074] Optionally, in the high-performance Top-k screening system supporting any sequence length in the embodiment of the present invention, the judgment module is used to:

[0075] If the data quantity is equal to the preset threshold, determining the result index corresponding to the screening result according to the comparison vector set;

[0076] Alternatively, if the amount of data obtained in the current data size comparison round is less than the preset threshold, the comparison vector set is inverted and bitwise ANDed with the pivot selection set, and the result is used as the new pivot selection set;

[0077] Alternatively, if the amount of data obtained in the current data size comparison round is greater than the preset threshold, the comparison vector set and the hub selection set are bitwise ANDed, and the result is used as the new hub selection set.

[0078] In some possible implementations, if the number of data is equal to the preset threshold, the position corresponding to 1 in the comparison vector set is the result index, and then the screening result is determined according to the result index, that is, the data corresponding to the top-k in the data input sequence.

[0079] The following is a detailed description of the screening system provided by the present application using a specific embodiment:

[0080] If it is determined that five of ten different numbers are greater than a specific number A, and four are less than A, then A can be identified as the sixth largest value among the ten numbers. However, in practice, there may be equal values ​​in the sequence, but each number has a unique index. Therefore, this solution concatenates the values ​​and their indexes, with the values ​​occupying a higher position and the indexes occupying a lower position, ensuring that all numbers are different. In many applications of Top-k problems, the ultimate goal is not to obtain the first k values ​​of the input sequence, but to obtain associated information data based on their indexes in the input sequence. For example, a search engine needs an index to obtain the first k items with high scores, and an index is needed to sample k tokens with a high probability from the vocabulary during the large language model reasoning process. Therefore, the output of the Top-k engine proposed in the present invention is the position information of the first k values. Based on this position information, the first k values ​​and the corresponding data in the associated information can be further obtained from the input sequence.

[0081] like Figure 1 As shown, the Top-k engine consists of a pivot selection register array, a priority encoder, a dissimilar register array, a comparator array, a comparison register array, a single-bit counting network, an accumulator, and a pivot selection space reduction module. The dissimilar sequence segments are formed by splicing the values ​​of the input sequence and its index together and are sequentially input into the dissimilar register array; the pivot selection register array stores the segmented input of the pivot selection set, which is a Boolean vector (containing only 0 and 1) of the same length as the input sequence, and is used to indicate whether the value in the dissimilar sequence can be selected as the pivot; the pivot selection space reduction module reduces the search space of the pivot by performing simple bit operations on the pivot selection set and the comparison vector set; the comparison vector set is a Boolean vector of the same length as the pivot selection set; the priority encoder is used to obtain the index of the pivot in the dissimilar sequence; in the comparator array, the pivot is compared with all values ​​in the dissimilar register array; the result of the parallel comparison is saved to the comparison register array and becomes part of the comparison vector set; the single-bit counting network consisting only of half adders and XOR gates is responsible for counting the number of 1s in each segment of the Boolean vector output by the comparator array, and then the accumulator accumulates them. Finally, the accumulated value is compared with the target value k to determine whether to end the operation or narrow the hub selection space and continue iterating.

[0082] A priority encoder is a circuit that can compress multiple binary inputs into a smaller number of outputs. It encodes only the highest priority of the simultaneous input signals according to the priority order of the input signals, and its output is a binary representation of the position from 0 to the most significant bit of the input. In the Top-k engine, the hub selection set is sequentially input into the hub selection register array in segments, and the priority encoder outputs the position of the first 1 in the hub selection register array, thereby obtaining the index of the first 1 in the hub selection set, and then obtains the hub from the mutually exclusive sequence based on the index. Taking the 8-3 priority encoder as an example, it inputs an 8-bit data and outputs the position of the first 1 in the input data starting from the 0th bit. Its truth table is shown in Table 1.

[0083]

[0084]

[0085] Table 1

[0086] The single-bit counting network is composed of only AND gates and XOR gates, which include two operations: half adder (AND gate + XOR gate) and XOR. The single-bit counting network is composed of these two operations stacked in multiple levels of recursion. Its characteristic is that the data flow is in single-bit form, its input is a Boolean vector, and its output is the number of 1s in the Boolean vector. Figure 2 An 8-bit single-bit counting network is shown. It should be noted that the input data width of the single-bit counting network is not forced to be an even number, but can also be an odd number. For example, Figure 3 As shown in the figure, by removing all branches related to the highest bit that participate in the formation of the result, a 7-bit single-bit counting network without redundancy can be obtained. Compared with the ordinary addition tree network, the single-bit counting network has smaller delay and area. The circuit structure of the single-bit counting network has good regularity, and its input bit width can be expanded and contracted according to its regularity, which can meet the scalability of the Top-k engine, such as Figure 4 16-bit single-bit counting network shown.

[0087] The Top-k engine proposed in this scheme is based on a parallel comparison counting method instead of a sorting algorithm. Compared with existing schemes, this scheme not only has O(log(n)) time complexity and O(n) space complexity, but also exhibits low complexity, high parallelism and scalability in terms of circuit structure and data flow. In terms of circuit structure, it is easy to trade off between speed and resources by scaling the number of comparators, the bit width of the priority encoder and the single-bit counting network, and supports the screening of data sequences of arbitrary length without being restricted by the sequence length, and can flexibly select any k value without the power of 2 restriction. In terms of data flow, it has cheap data movement and requires little memory requirements because the data flow and storage are in the form of single bits rather than the original data format of the input data. Therefore, the Top-k engine can meet the configurable selection requirements and achieve satisfactory speed performance.

[0088] The system provided by the embodiment of the present application includes: a mutually exclusive register array, which is used to store data sequence segments that need to be compared in data size; the data in the mutually exclusive register array includes the value and index of the data sequence, and the mutually exclusive register array is obtained by segmenting the data input sequence based on the bit width of the mutually exclusive register array; a hub selection register array, which is used to indicate whether the data in the corresponding mutually exclusive register array can be used as a hub in the current data size comparison round; the hub unit is used to provide a hub selection set, or update the hub selection set according to the statistical results of the previous data size comparison round provided by the accumulator; the hub selection register array is obtained by segmenting the hub selection set based on the bit width of the hub selection register array to; a priority encoder, used to determine the hub index corresponding to the hub of the current data size comparison round according to the hub selection register array; a comparison unit, used to compare the data size of each bit in the mutually exclusive register array with the hub, and determine the number of segments of data greater than the hub, or determine the number of segments of data less than the hub; the accumulator, used to count the number of data greater than the hub in the data input sequence, or the number of data less than the hub in the data input sequence in the current data size comparison round according to the number of segments provided by the comparison unit; a judgment module, used to determine the screening result according to whether the number of data meets a preset threshold; or, update the hub selection set. The bit width / number of each component or device in the embodiment of the present application can be adjusted, and data of any length can be screened and sorted; the system has strong scalability. At the same time, the embodiment of the present application implements data stream processing through hardware, which has less memory requirements and is conducive to improving screening efficiency. The screening system provided by the embodiment of the present application has strong scalability, which is conducive to improving data screening efficiency.

[0089] Next, a high-performance Top-k screening method supporting any sequence length proposed according to an embodiment of the present invention will be described with reference to the accompanying drawings.

[0090] Reference Figure 5 In an embodiment of the present invention, a high-performance Top-k screening method that supports arbitrary sequence length is provided. The high-performance Top-k screening method that supports arbitrary sequence length in the embodiment of the present invention can be applied to a terminal, or to a server, or can be software running in a terminal or a server, etc. The terminal can be a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The high-performance Top-k screening method that supports arbitrary sequence length in the embodiment of the present invention is applied to the high-performance Top-k screening system that supports arbitrary sequence length described above, and mainly includes the following steps:

[0091] Step S100, comparing the data in the mutually exclusive register array with the hub, and determining the number of segments of the data that is larger than the hub, or determining the number of segments of the data that is smaller than the hub; the hub is to determine the hub index according to the hub selection register array, and then determine the data corresponding to the hub index in the mutually exclusive register array; the hub selection register array is used to indicate whether the data in the corresponding mutually exclusive register array can be used as the hub in the current data size comparison round;

[0092] Step S200, counting the sum of the number of segments of each segment in the current data size comparison round to determine the amount of data;

[0093] Step S300, based on the data quantity, update the hub selection set of the hub selection unit, and then update the hub, return to compare the data in the mutually different register array with the hub, and determine the number of segments of the data greater than the hub; or, determine the number of segments of the data less than the hub; until the obtained data quantity meets the preset threshold, determine the screening result; the hub selection set includes several segments of the hub selection register array.

[0094] In some possible implementations, the number of segments is the number of data greater than the pivot, or the number of data less than the pivot, in the segments of the data input sequence stored in the different registers.

[0095] Optionally, the high-performance Top-k screening method supporting any sequence length in the embodiment of the present invention further includes:

[0096] Providing an initial pivot selection set, the length of the pivot selection set being the same as the length of the data input sequence;

[0097] Alternatively, according to the hub index provided by the priority encoder, the data corresponding to the hub index in the hub selection set is set to 0;

[0098] Alternatively, if the data quantity does not meet a preset threshold, the hub selection set is updated.

[0099] Optionally, the high-performance Top-k screening method supporting any sequence length in the embodiment of the present invention, until the amount of data obtained meets a preset threshold, determines the screening result, including:

[0100] If the data quantity is equal to the preset threshold, determining the result index corresponding to the screening result according to the comparison vector set;

[0101] The updating of the hub selection set of the hub selection unit according to the amount of data includes:

[0102] If the amount of data obtained in the current data size comparison round is less than the preset threshold, the comparison vector set is inverted, and then bitwise ANDed with the pivot selection set, and the result is used as the new pivot selection set;

[0103] Alternatively, if the amount of data obtained in the current data size comparison round is greater than the preset threshold, the comparison vector set and the hub selection set are bitwise ANDed, and the result is used as the new hub selection set.

[0104] In some possible implementations, the update strategy of the hub selection set is related to the type of comparator in the comparator array, whether the selected one is the top k large or the top k small, and the meaning of the data stored in the comparison register. Those skilled in the art can adjust the update strategy as needed.

[0105] Optionally, the high-performance Top-k screening method supporting any sequence length in the embodiment of the present invention further includes:

[0106] A position index is concatenated after each value of the data input sequence to form a different sequence; and the different sequence is segmented and placed into the different register array.

[0107] Optionally, the high-performance Top-k screening method supporting any sequence length in the embodiment of the present invention further includes:

[0108] If the exclusive sequence cannot be divided by the bit width of the exclusive register array, the last segment of the segment is padded with the minimum value that can be stored in the exclusive register;

[0109] If the pivot select set is not divisible by the bit width of the pivot select register array, the last segment of the segment is padded with 0s.

[0110] The screening method provided by the present application is described in detail below with a specific embodiment. Specifically, the algorithm operation process of the Top-k engine has the following steps:

[0111] Step 1: Add the index of each value in the input sequence to form a different sequence.

[0112] Step 2: Define a Boolean vector with the same length as the input sequence as the pivot selection set, and initialize it to all 1s, where the position with 1 indicates that the value at that position in the mutually exclusive sequence can be used as a pivot. Becoming a pivot means that the value will be compared with all values ​​in the input comparator array to determine whether it is the k+1th largest value;

[0113] Step 3: Divide the dissimilarity sequence and pivot selection set into segments, and input each segment into the dissimilarity register array and pivot selection register array. If the length of the input sequence cannot be divided by the length of the register array, the last segment is padded with the minimum value that can be represented by the data bit width to fill the dissimilarity register array, and the pivot selection register array is padded with 0;

[0114] Step 4: Input the hub selection register array selection from the first segment of the hub selection set, use the priority encoder to find the position of the first 1 in the hub selection register array, and then use the value of this position in the corresponding segment of the mutually exclusive sequence as the hub, and set the value of this position in the hub selection set to 0, indicating that this value has been selected as the hub and will not be selected in the next iteration;

[0115] Step 5: If there is 1 in the first segment of the hub selection set, then no hub is selected from the subsequent segments, that is, the segments subsequent to the hub selection set are no longer input into the hub selection register array. Otherwise, hubs are selected from the segments subsequent to the hub selection set in sequence until there is 1 in a certain segment.

[0116] Step 6: Input each segment of the dissimilarity sequence into the dissimilarity register array and the hub in the comparator array for comparison at the same time. If the value in the dissimilarity register array is greater than the hub, the comparison value is 1, otherwise it is 0. Then use a single-bit counting network to count the number of 1s in this segment of the comparison result, and save this segment of the comparison result to the comparison vector set.

[0117] Step 7: Compare all segments, and the accumulator accumulates the number of 1s counted in the comparison results of each segment. The accumulated value is the number of values ​​greater than the hub in the mutually distinct sequences;

[0118] Step 8: Compare the accumulated value with the target value k. If the accumulated value is greater than k, it means that the hub is too small; if the accumulated value is less than k, the hub is too large; if the accumulated value is equal to k, the hub is the k+1th largest value, and the operation ends at this time. The value of the input sequence corresponding to the position 1 in the comparison vector set is the position of all the first k largest values.

[0119] Step 9: If the hub is too small, then you need to select a new hub from a value larger than the hub, that is, perform a bitwise AND operation on the comparison vector set and the hub selection set to obtain a new hub selection set; conversely, if the hub is too large, then you need to select a new hub from a value smaller than the hub, that is, invert the comparison vector set bitwise, and then perform a bitwise AND operation with the hub selection set to obtain a new hub selection set. Through simple operations, you can gradually narrow the selection range of the hub, reduce the number of 1s in the hub selection set, and reduce the number of iterations to find the k+1th largest value. Finally, return to step 4 to continue iterating.

[0120] The above embodiment is to find the k+1th largest value. Similarly, the same principle can be used to find the k+1th smallest value. It should be noted that: Figure 1 The k in here means filtering the k+1th largest value / k+1th smallest value.

[0121] The embodiments of the present application propose a high-performance parallel Top-k engine and screening algorithm that supports arbitrary sequence length to solve the Top-k problem faced in the fields of information retrieval and deep learning. The engine has the characteristics of low complexity, high parallelism and scalability, and can achieve high throughput, high energy efficiency and low latency Top-k screening operations.

[0122] The main key points are:

[0123] 1) Key point 1: By using a parallel comparison counting method instead of a sorting algorithm, the input sequence can be compared in parallel in segments, so the Top-k engine can support screening of arbitrary lengths. The resource consumption of the circuit is related to the length of the segment, not limited to the sequence length.

[0124] a) Based on key point 1, the number of comparators can be adjusted as needed.

[0125] b) Based on key point 1, the bit width of the priority encoder can be adjusted arbitrarily as needed.

[0126] c) Based on key point 1, the bit width of the single-bit counting network can be adjusted arbitrarily as needed.

[0127] d) Based on key point 1, the number of registers in the hub selection register array, the mutual difference register array and the comparison register array can be adjusted arbitrarily as needed.

[0128] 2) Key point 2: The values ​​of the input sequence and its index are concatenated together to form a distinct sequence, so that the ranking position of the hub can be counted after the hub and the distinct sequence are compared in parallel.

[0129] a) Based on key point 2, if the value of the input sequence is a fixed-point number, the value is located in the high position and its index is located in the low position, so that all values ​​are not equal; if it is a floating-point number, the index can be spliced ​​to the mantissa of the floating-point number.

[0130] b) Based on key point 2, the comparators in the comparator array can use a greater than comparator or a less than comparator to obtain the positive or reverse sorting position of the hub.

[0131] 3) Key point 3: The number of values ​​larger than the hub in each segment of the mutually different sequence is counted through a single-bit counting network and an accumulator to obtain the sorting position of the hub. The data stream is in single-bit form, the circuit complexity is low, and the resource consumption is small.

[0132] a) Based on key point 3, if the segment length is large, the single-bit counting network can achieve system frequency improvement through conventional methods such as inserting pipelines.

[0133] b) Based on key point 3, the single-bit counting network can be used in other similar counting task scenarios.

[0134] 4) Key point 4: By performing simple bitwise operations on the hub selection set and the comparison vector set, the hub selection range can be gradually narrowed, the number of 1s in the hub selection set can be reduced, and the number of iterations for finding the kth largest value can be reduced.

[0135] a) Based on key point 4, the hub selection space reduction module can perform bit operations on the hub selection set and the comparison vector set in segments, and the number of bit operation gates can be adjusted arbitrarily as needed.

[0136] b) Based on key point 4, the hub selection set and the comparison vector set can use off-chip or off-chip memory as needed.

[0137] Based on the above key points, the problems of inefficient screening and limited scalability in existing Top-k circuits can be solved.

[0138] It is understandable that the embodiments of the present application may use other mapping methods to construct different sequences, or, instead of constructing different sequences, input the value and index or other information into the comparator together, first compare the value, and if the values ​​are the same, then compare the index or other information, and constitute a multi-condition comparison, which can be regarded as an alternative to the present solution.

[0139] It is understandable that the use of other counters that can implement the counting function module such as the addition tree instead of the single-bit counting network can be regarded as a substitute for this solution. The Top-k engine after the improvement of the priority encoder can be regarded as a substitute for this solution. Preprocessing the different sequences without using the comparator array to obtain the number of values ​​larger than the hub in the different sequences, or replacing the comparator in other ways can be regarded as a substitute for this solution. By removing the segmentation operation, the Top-k circuit and algorithm suitable for the task of limited sequence length can be regarded as a substitute for this solution. The Top-k engine that adjusts and optimizes the data flow and circuit structure of this solution can be regarded as a substitute for this solution. According to the algorithm of this solution, the Top-k engine implemented on other platforms such as CPU, GPU or FPGA can be regarded as a substitute for this solution. Based on the parallel comparison counting method, the circuit and algorithm for finding the maximum value, minimum value or kth largest value are realized by using the design idea of ​​reducing the hub selection space through bit operations. Gate-level and transistor-level optimization of the circuit can be regarded as a substitute for this solution.

[0140] It can be seen that the contents of the above system embodiments are all applicable to the present method embodiments, the functions specifically implemented by the present method embodiments are the same as those of the above system embodiments, and the beneficial effects achieved are also the same as those achieved by the above system embodiments.

[0141] Reference Figure 6 The embodiment of the present invention provides a high-performance Top-k screening device supporting any sequence length, comprising:

[0142] at least one processor 610;

[0143] At least one memory 620, used to store at least one program;

[0144] When the at least one program is executed by the at least one processor 610, the at least one processor 610 implements the high-performance Top-k screening method supporting any sequence length.

[0145] Similarly, the contents of the above method embodiments are all applicable to the present device embodiments. The functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0146] An embodiment of the present invention further provides a computer-readable storage medium, in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to execute the above-mentioned high-performance Top-k screening method supporting arbitrary sequence length.

[0147] Similarly, the contents of the above method embodiments are all applicable to the present storage medium embodiments. The functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0148] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.

[0149] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.

[0150] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several programs to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0151] The logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable programs for implementing the logical functions, and may be embodied in any computer-readable medium for use by a program execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch and execute a program from a program execution system, device or apparatus), or in conjunction with such program execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by a program execution system, device or apparatus, or in conjunction with such program execution systems, devices or apparatuses.

[0152] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0153] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable program execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0154] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0155] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

[0156] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A high-performance Top-k screening system that supports arbitrary sequence lengths, characterized in that: The screening system comprises: A mutually exclusive register array, used to store data sequence segments that need to be compared in data size; the data in the mutually exclusive register array includes the value and index of the data sequence, and the mutually exclusive register array is obtained by segmenting the data input sequence based on the bit width of the mutually exclusive register array; The pivot selection register array is used to indicate whether the data in the corresponding mutually exclusive register array can be used as a pivot in the current data size comparison round; A hub unit, used to provide a hub selection set, or update the hub selection set according to the statistical result of the previous data size comparison round provided by the accumulator; the hub selection register array is obtained by segmenting the hub selection set based on the bit width of the hub selection register array; A priority encoder, for determining a hub index corresponding to a hub of a current data size comparison round according to the hub selection register array; A comparison unit, used to compare the data size of each bit of the data in the mutually exclusive register array with the hub, and determine the number of segments of the data that is larger than the hub, or determine the number of segments of the data that is smaller than the hub; The accumulator is used to count the number of data in the data input sequence that is larger than the hub, or the number of data in the data input sequence that is smaller than the hub, in the current data size comparison round according to the number of segments provided by the comparison unit; The judgment module is used to determine the screening result according to whether the amount of data meets a preset threshold; or to update the hub selection set.

2. The high-performance Top-k screening system supporting arbitrary sequence length according to claim 1, characterized in that: The hub unit comprises: A hub selection space reduction module, used for performing bitwise operations on the hub selection set and the comparison vector set, and using the operation result as a new hub selection set to reduce the hub search space; The comparison vector set is used to store the data size comparison result of the current data size comparison round generated by the comparison unit.

3. The high-performance Top-k screening system supporting arbitrary sequence length according to claim 2, characterized in that: The comparison unit comprises: A comparator array, used to compare the data size of each bit in the mutually exclusive register array with the hub; the number of the comparator array has the same value as the bit width of the mutually exclusive register array; A comparison register array, used for storing the segmentation result of the data size comparison of the current segment, and putting the segmentation result of the data size comparison into the comparison vector set; A single-bit counting network is used to count the number of 1s in the comparison register array; the 1 in the comparison register array is used to represent that the data at the corresponding position of the mutually exclusive register array is greater than the hub, or the data at the corresponding position of the mutually exclusive register array is less than the hub.

4. The high-performance Top-k screening system supporting arbitrary sequence length according to claim 1, characterized in that: The priority encoder is used to set the data corresponding to the hub index in the hub selection set to 0.

5. The high-performance Top-k screening system supporting arbitrary sequence length according to claim 2, characterized in that: The judging module is used for: If the data quantity is equal to the preset threshold, determining the result index corresponding to the screening result according to the comparison vector set; Alternatively, if the amount of data obtained in the current data size comparison round is less than the preset threshold, the comparison vector set is inverted and bitwise ANDed with the pivot selection set, and the result is used as the new pivot selection set; Alternatively, if the amount of data obtained in the current data size comparison round is greater than the preset threshold, the comparison vector set and the hub selection set are bitwise ANDed, and the result is used as the new hub selection set.

6. A high-performance Top-k screening method supporting arbitrary sequence length, characterized in that: Applied to the high-performance Top-k screening system supporting arbitrary sequence length as claimed in claim 1, the method comprising: Compare the data in the mutually exclusive register array with the hub, and determine the number of segments of the data that is larger than the hub, or determine the number of segments of the data that is smaller than the hub; the hub is to determine the hub index according to the hub selection register array, and then determine the data corresponding to the hub index in the mutually exclusive register array; the hub selection register array is used to indicate whether the data in the corresponding mutually exclusive register array can be used as the hub in the current data size comparison round; Count the current data size and compare the sum of the number of segments in each segment in the round to determine the amount of data; According to the data quantity, the hub selection set of the hub selection unit is updated, and then the hub is updated, and the data in the mutually different register array is compared with the hub, and the number of segments of the data greater than the hub is determined; or, the number of segments of the data less than the hub is determined; until the obtained data quantity meets the preset threshold, the screening result is determined; the hub selection set includes several segments of the hub selection register array.

7. The high-performance Top-k screening method supporting arbitrary sequence length according to claim 6, characterized in that: The method further comprises: Providing an initial pivot selection set, the length of the pivot selection set being the same as the length of the data input sequence; Alternatively, according to the hub index provided by the priority encoder, the data corresponding to the hub index in the hub selection set is set to 0; Alternatively, if the data quantity does not meet a preset threshold, the hub selection set is updated.

8. The high-performance Top-k screening method supporting arbitrary sequence length according to claim 6, characterized in that: Until the amount of data obtained meets the preset threshold, the screening results are determined, including: If the data quantity is equal to the preset threshold, determining the result index corresponding to the screening result according to the comparison vector set; The updating of the hub selection set of the hub selection unit according to the amount of data includes: If the amount of data obtained in the current data size comparison round is less than the preset threshold, the comparison vector set is inverted, and then bitwise ANDed with the pivot selection set, and the result is used as the new pivot selection set; Alternatively, if the amount of data obtained in the current data size comparison round is greater than the preset threshold, the comparison vector set and the hub selection set are bitwise ANDed, and the result is used as the new hub selection set.

9. The high-performance Top-k screening method supporting arbitrary sequence length according to claim 6, characterized in that: The method further comprises: The position index is spliced ​​after each value of the data input sequence to form a mutually exclusive sequence; and the mutually exclusive sequence is segmented and placed into the mutually exclusive register array.

10. A high-performance Top-k screening device supporting arbitrary sequence length, characterized in that: A high-performance Top-k screening system supporting any sequence length as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Sorting system and data processing method

    CN109460210A

  • Mass data-oriented TopK query method and system and electronic equipment

    CN114817354A

  • System and method for performing a top-k function

    US20210382871A1

Cited By

  • Universal TopK computing device and method based on insertion merging

    CN122450504A