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

By designing a high-performance Top-k screening system that supports arbitrary sequence length and using hardware circuits to implement parallel comparison and counting, the scalability limitations caused by memory dependence in existing technologies are resolved, and efficient Top-k screening is achieved.

CN119357233BActive Publication Date: 2025-09-09SUN YAT SEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing Top-k algorithms and hardware implementations rely heavily on limited on-chip memory, which restricts scalability and the upper limit of k and cannot efficiently handle Top-k problems of different scales.

Method used

A high-performance Top-k screening system that supports arbitrary sequence length is designed. It uses hardware circuits such as a mutually exclusive register array, a hub selection register array, a priority encoder, a comparison unit, and an accumulator. Through parallel comparison and counting, it achieves O(log(n)) time complexity and O(n) space complexity, supporting the screening of data sequences of arbitrary length.

Benefits of technology

It achieves efficient screening of data sequences of arbitrary length, reduces memory requirements, improves system scalability and screening efficiency, and is suitable for Top-k problems of various data sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357233B_ABST
    Figure CN119357233B_ABST
Patent Text Reader

Abstract

The present invention discloses a high-performance Top‑k screening system and method that supports arbitrary sequence lengths. The system includes: a mutually exclusive register array for storing data sequence segments that need to be compared for data size; a hub selection register array for indicating whether the data in the corresponding mutually exclusive register array can be used as a hub in the current data size comparison round; a hub unit for providing a hub selection set, or updating the hub selection set based on the statistical results of the previous data size comparison round provided by the accumulator; an accumulator for counting the number of data in the data input sequence that is greater than the hub in the current data size comparison round based on the number of segments provided by the comparison unit; a judgment module for determining the screening result; or updating the hub selection set. The screening system provided by the embodiment of the present application has strong scalability, which is conducive to improving data screening efficiency; and can be widely used in the field of hardware implementation algorithm technology.
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 implementation 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 volume of data and the computing power required to analyze it have exploded. Efficiently handling the Top-k problem has become increasingly important in numerous application areas. The Top-k problem frequently arises in processes such as model output sampling, training, and dynamic pruning in deep learning, search and recommendation algorithms in information retrieval, and clustering and classification in data mining. The widespread application of Top-k algorithms places higher demands on their scalability and efficiency. With the growing demand for high-speed data stream processing, implementing Top-k algorithms in software can be prohibitively time-consuming and power-intensive. To achieve higher throughput, energy efficiency, and lower latency, numerous studies have proposed hardware implementations of Top-k algorithms. However, existing Top-k algorithms and hardware implementations rely heavily on limited on-chip memory, limiting 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 arbitrary sequence lengths.

[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 for storing data sequence segments that need to be compared for 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 for indicating 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; a 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; a comparison unit is used to compare the data size of each bit of data in the different register array with the hub, and determine the number of segments of data larger than the hub, or determine the number of segments of data smaller than the hub; the accumulator is used to count the number of data larger than the hub in the data input sequence or the number of data smaller 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 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 data stream processing through hardware, which has low 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 arbitrary sequence length according to the above embodiment of the present invention may also have the following additional technical features:

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

[0009] a hub selection space reduction module, configured to perform a bitwise operation on the hub selection set and the comparison vector set, and use 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, configured to compare the data size of each bit in the distinct register array with the hub; the number of the comparator arrays is the same as the bit width of the distinct register array;

[0013] A comparison register array, configured to store a segmentation result of a data size comparison of a current segment, and to place 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 is used to represent that 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 judgment module is configured 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 pivot selection set are bitwise ANDed together, and the result is used as the new pivot selection set.

[0020] On the other hand, an embodiment of the present invention provides a high-performance Top-k screening method that supports arbitrary sequence lengths, which is applied to the above-mentioned high-performance Top-k screening system that supports arbitrary sequence lengths. The method includes:

[0021] Comparing the data in the distinct register array with the hub and determining the number of segments of the data larger than the hub, or determining the number of segments of the data smaller than the hub; the hub is a hub index determined according to the hub selection register array, and then determining the data corresponding to the hub index in the distinct register array; the hub selection register array is used to indicate whether the data in the corresponding distinct register array can be used as a 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 amount of data, 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 number of data 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 embodiment of the present invention supports a high-performance Top-k screening method of any sequence length, the method further comprising:

[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 arbitrary sequence lengths in an embodiment of the present invention determines the screening result until the number of obtained data meets a preset threshold, 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 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 pivot selection set are bitwise ANDed together, and the result is used as the new pivot selection set.

[0033] Furthermore, the high-performance Top-k screening method supporting arbitrary sequence length in 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 that supports arbitrary sequence length, including the above-mentioned high-performance Top-k screening system that supports arbitrary sequence length.

[0035] On the other hand, an embodiment of the present invention provides a high-performance Top-k screening device that supports arbitrary sequence lengths, 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 that supports arbitrary sequence length.

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

[0040] The screening system provided by the embodiment of the present invention includes: a mutually exclusive register array for storing data sequence segments that need to be compared for 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 for indicating 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 for determining the hub index corresponding to the hub of the current data size comparison round according to the hub selection register array; a comparison unit for comparing the data size of each bit in the mutually exclusive register array with the hub, and determining the number of segments of data greater than the hub, or determining the number of segments of data less than the hub; the accumulator for counting the number of segments provided by the comparison unit, in the current data size comparison round, 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; a judgment module for determining the screening result according to whether the number of data meets a preset threshold; or, updating 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 following introduction is made to the drawings of the embodiments of the present invention or the related technical solutions in the prior art. 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 any creative work.

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

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

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

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

[0046] Figure 5 A schematic diagram of a process flow of an embodiment of a high-performance Top-k screening method supporting arbitrary 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, examples of which 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 limiting the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation and are not intended to limit the order of the steps. The order of execution of the steps in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

[0049] In recent years, both the volume of data and the computing power required to analyze it have exploded. Efficiently handling the Top-k problem, in particular, has become increasingly important in numerous application domains. The Top-k problem frequently arises in deep learning model output sampling, training, and dynamic pruning; in information retrieval search and recommendation algorithms; and in data mining clustering and classification. However, the scale of the Top-k problem varies significantly across different application domains. For large-scale training of deep learning models, Top-k is used for gradient compression, selecting the top 0.1% of gradients from millions or billions of values ​​to reduce data transmission costs. During inference on large language models, the output is often sampled from the k most probable tokens in the entire vocabulary. The vocabulary length of large models like GPT-4 can reach hundreds of thousands. In database searches, the number k in k-nearest neighbor (KNN) operations can reach thousands. This wide range of problem sizes poses challenges 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 Top-k algorithms in software can be prohibitively time-consuming and power-intensive. Therefore, accelerating operations and improving energy efficiency are becoming increasingly important. To achieve higher throughput, energy efficiency, and lower latency, numerous studies have proposed hardware implementations of Top-k algorithms. However, existing Top-k algorithms and hardware implementations rely heavily on limited on-chip memory, limiting scalability and the upper limit of k.

[0050] To find the top k largest or smallest elements in a set of data, a common approach is to sort the entire set and select the top k elements. For example, the quick sort algorithm has a time complexity of O(nlog(n)), where n is the number of data items. However, implementing sorting algorithms in hardware is complex and consumes valuable hardware resources, especially for resource-constrained edge applications. If the data volume is very large, a large amount of memory is required to load the data, and if k is much smaller than n, a large amount of useless computation will be generated. Therefore, full sorting is not advisable in most scenarios. Another approach is to use partial sorting. Some work has combined priority queues with bitonic merge sort. However, due to the algorithm's characteristics, it requires a fixed length of the input sequence that is a power of two. Its scalability is also limited by the upper bound on k, as the sorting and merging operations must reside entirely in the limited on-chip memory. Partitioning-based methods recursively assign values ​​to buckets and record the number of elements in each bucket until all k values ​​are found. Typical algorithms include QuickSelect, BucketSelect, SampleSelect, and RadixSelect, but they also suffer from performance variations with varying data distributions. The Top-k problem can also be solved using a heap. A heap is a special tree-like 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 nodes. 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 queries, because the time complexity of insertion and deletion operations in a heap is O(log(n)). Therefore, using a min-heap or max-heap heap to maintain the top 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] The following describes in detail a high-performance Top-k screening system and method supporting arbitrary sequence lengths proposed in an embodiment of the present invention with reference to the accompanying drawings. First, a high-performance Top-k screening system supporting arbitrary sequence lengths proposed in an embodiment of the present invention is described with reference to the accompanying drawings.

[0052] Figure 1 FIG. 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. The system specifically includes:

[0053] a mutually exclusive register array for storing data sequence segments that require data size comparison; the data in the mutually exclusive register array includes values ​​and indexes 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 different register array can be used as a pivot in the current data size comparison round;

[0055] The hub unit is configured to provide a hub selection set, or update the hub selection set based on 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, based on the hub selection register array, a hub index corresponding to a hub of a current data size comparison round;

[0057] a comparing unit, configured to compare the data size of each bit of 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 configured 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 a current data size comparison round, based on 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 value 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 the 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 understood that after the data input sequence is segmented, multiple data size comparisons can be performed. Specifically, after each segment of the data input sequence is stored in the distinct register array, it is compared with the pivot. The comparison unit determines the number of segments in each data input sequence that are larger or smaller than the pivot. After all segments are compared, the accumulator determines the number of data in the data input sequence that are larger or smaller than the pivot in the current data size comparison round.

[0062] Understandably, in the era of big data and artificial intelligence, data filtering is a frequent task. This often requires quickly finding the top k largest or smallest elements in a large amount of data, known as the Top-K problem. It is a fundamental task in many fields, including information retrieval, recommendation systems, data services, and scientific computing. With the rapid growth of data volumes, high-performance parallel Top-K algorithms have become crucial. Designing dedicated Top-K hardware circuits for data filtering can improve speed, conserve computing resources, and play a vital role in scenarios requiring real-time decision-making or rapid response.

[0063] This paper proposes a high-performance parallel Top-k engine and screening algorithm that supports arbitrary sequence lengths, addressing the inefficiency of existing Top-k circuits. This solution, which relates to the fields of integrated circuits and computer technology, is based on a hardware implementation of the screening algorithm. It not only boasts O(log(n)) time complexity and O(n) space complexity, but also offers 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 arbitrary sequence length, the hub unit includes:

[0065] a hub selection space reduction module, configured to perform a bitwise operation on the hub selection set and the comparison vector set, and use 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 embodiment of the present invention, the high-performance Top-k screening system supporting arbitrary sequence length, the comparison unit includes:

[0068] A comparator array, configured to compare the data size of each bit in the distinct register array with the hub; the number of the comparator arrays is the same as the bit width of the distinct register array;

[0069] A comparison register array, configured to store a segmentation result of a data size comparison of a current segment, and to place 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 is used to represent that 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 number of comparator arrays are consistent. In some embodiments, the comparison register can be set to 1 to indicate that a positive result is obtained by the comparator. For example, if the comparator array is greater than, the comparison register is set to 1 to indicate that the data at that position in the exclusive register array is greater than the pivot; the comparison register is set to 0 to indicate that the data at that position in the exclusive 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 arbitrary sequence length in an 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 pivot selection set are bitwise ANDed together, and the result is used as the new pivot 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 the screening result is determined based on 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 this 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 splices the values ​​and their indexes together, with the values ​​occupying higher positions and the indexes occupying lower positions, ensuring that all numbers are different. In many applications of Top-k problems, the ultimate goal is not to obtain the top 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 top k items with high scores, and in the process of reasoning with a large language model, it is necessary to index k tokens with a high probability of sampling from the vocabulary. Therefore, the output of the Top-k engine proposed in the present invention is the position information of the top k values. Based on this position information, the top 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 dissimilarity register array, a comparator array, a comparison register array, a single-bit counting network, an accumulator, and a pivot selection space reduction module. The dissimilarity sequence is formed by concatenating the input sequence values ​​and their indices, and is sequentially input into the dissimilarity register array. The pivot selection register array stores the segmented inputs of the pivot selection set, which is a Boolean vector (containing only 0s and 1s) of the same length as the input sequence and is used to indicate whether a value in the dissimilarity sequence can be selected as a pivot. The pivot selection space reduction module reduces the search space of the pivot by performing simple bitwise 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 dissimilarity sequence. In the comparator array, the pivot is compared with all values ​​in the dissimilarity register array. The results of the parallel comparisons are stored in the comparison register array and become part of the comparison vector set. A 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 iteration.

[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 to obtain 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 bit 0. 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 up 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. Figure 4 16-bit single-bit counting network shown.

[0087] The proposed Top-k engine is based on a parallel comparison and counting method, rather than a sorting algorithm. Compared to existing solutions, 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, the number of comparators, the bit width of the priority encoder, and the single-bit counting network can be scaled, making it easy to balance speed and resources. It supports filtering data sequences of arbitrary length without being restricted by the sequence length, and allows for flexible selection of any k value without the power-of-two restriction. Regarding data flow, it features inexpensive data movement and minimal memory requirements, as data flow and storage are performed in single-bit form rather than in the original input data format. Therefore, this Top-k engine meets the requirements for configurable selection and achieves satisfactory speed performance.

[0088] The system provided by the embodiment of the present application includes: a mutually exclusive register array for storing data sequence segments that need to be compared for 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 for indicating 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 for determining the hub index corresponding to the hub of the current data size comparison round according to the hub selection register array; a comparison unit for comparing the data size of each bit in the mutually exclusive register array with the hub, and determining the number of segments of data greater than the hub, or determining the number of segments of data less than the hub; the accumulator for counting the number of segments provided by the comparison unit, in the current data size comparison round, 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; a judgment module for determining the screening result according to whether the number of data meets a preset threshold; or updating 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 low 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 arbitrary 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, a server, or software running in a terminal or a server. 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: Compare the data in the distinct register array with the hub, and determine the number of segments of the data larger than the hub, or determine the number of segments of the data smaller than the hub; the hub is a hub index determined according to the hub selection register array, and then determine the data corresponding to the hub index in the distinct register array; the hub selection register array is used to indicate whether the data in the corresponding distinct register array can be used as a 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 amount of data, updates the hub selection set of the hub selection unit, and then updates the hub, returns to the step of comparing the data in the mutually different register array with the hub, and determines the number of segments of data greater than the hub; or, determines the number of segments of data less than the hub; until the obtained amount of data meets the preset threshold, determines 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 a number of data greater than the pivot, or a 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 arbitrary 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 arbitrary sequence length in the embodiment of the present invention, until the number of obtained data 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 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 pivot selection set are bitwise ANDed together, and the result is used as the new pivot 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 top k largest or top k smallest is selected, and the meaning of the data stored in the comparison register. Those skilled in the art can adjust the update strategy according to needs.

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

[0106] A position index is spliced ​​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 arbitrary sequence length in the embodiment of the present invention further includes:

[0108] If the distinct sequence cannot be divided evenly by the bit width of the distinct register array, the last segment of the segment is padded with the minimum value that can be stored in the distinct 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 zeros.

[0110] The following describes the screening method provided by this application in detail using a specific embodiment. Specifically, the algorithm operation process of the Top-k engine includes the following steps:

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

[0112] Step 2: Define a Boolean vector of the same length as the input sequence as the pivot selection set and initialize it to all 1s. A position with a 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 distinct sequence and pivot selection set into segments, and input each segment into the distinct register array and pivot selection register array respectively. If the length of the input sequence is not divisible by the length of the register array, the last segment is padded with the minimum value representable by the data bit width to padded the distinct register array, and the pivot selection register array is padded with 0;

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

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

[0116] Step 6: Each segment of the dissimilarity sequence is input into the dissimilarity register array and the hub in the comparator array for comparison. If the value in the dissimilarity register array is greater than the hub, the comparison value is 1, otherwise it is 0. A single-bit counting network is then used to count the number of 1s in the comparison result of this segment, and the comparison result of this segment is saved in 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 pivot in the mutually distinct sequences;

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

[0119] Step 9: If the selected hub is too small, a new hub is selected from values ​​larger than the selected hub. This is done by performing a bitwise AND operation on the comparison vector set and the hub selection set to obtain a new hub selection set. Conversely, if the selected hub is too large, a new hub is selected from values ​​smaller than the selected hub. This is done by bitwise inverting the comparison vector set and performing a bitwise AND operation on the hub selection set to obtain a new hub selection set. This simple operation gradually narrows the range of hub selection, reducing the number of 1s in the hub selection set and the number of iterations required to find the k+1th largest value. Finally, return to step 4 and 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 the formula indicates that the k+1th largest value / k+1th smallest value is selected.

[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, deep learning, etc., with 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: Using a parallel comparison counting approach rather than a sorting algorithm, the input sequence can be segmented and compared in parallel, allowing the Top-k engine to support filtering of arbitrary lengths. Circuit resource consumption is dependent on the segment length, not the sequence length.

[0124] a) Based on key point 1, the number of comparators can be adjusted arbitrarily 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 to form a distinct sequence, so that the ranking position of the hub can be calculated after parallel comparison with the distinct sequence.

[0129] a) Based on key point 2, if the input sequence is a fixed-point number, the value is in the high bit and its index is in the low bit, so that all values ​​are unequal; if it is a floating-point number, the index can be spliced ​​into 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 order sorting position of the hub.

[0131] 3) Key Point 3: Using a single-bit counting network and accumulator, we count the number of values ​​greater than the hub in each distinct sequence segment to determine the hub's ranking position. The data stream is all in single-bit form, resulting in low circuit complexity and minimal resource consumption.

[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 range of hub selection can be gradually narrowed, the number of 1s in the hub selection set can be reduced, and the number of iterations to find the k-th 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 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 mutually exclusive sequences, or, instead of constructing mutually exclusive sequences, input the value and index or other information into the comparator together, compare the values ​​first, and then compare the index or other information if the values ​​are the same, to form a multi-condition comparison, which can be regarded as an alternative to this solution.

[0139] It is understood that using other counters to implement counting functions, such as adding trees instead of single-bit counting networks, can be considered an alternative to this solution. A Top-k engine that improves the priority encoder can be considered an alternative to this solution. Preprocessing the different sequences without using a comparator array to obtain the number of values ​​greater than the hub in the different sequences, or replacing the comparators with other methods, can also be considered an alternative to this solution. Removing the segmentation operation to make the Top-k circuit and algorithm suitable for tasks with limited sequence lengths can be considered an alternative to this solution. Adjusting and optimizing the data flow and circuit structure of this solution can be considered an alternative to this solution. Based on the algorithm of this solution, Top-k engines implemented on other platforms such as CPUs, GPUs, or FPGAs can also be considered an alternative to this solution. Circuits and algorithms for finding the maximum, minimum, or kth largest value based on a parallel comparison counting method using a design concept that reduces the hub selection space through bitwise operations can also be considered an alternative to this solution. Gate-level and transistor-level circuit optimization can also be considered an alternative to 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 that supports arbitrary sequence lengths, including:

[0142] at least one processor 610;

[0143] at least one memory 620, for storing 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 that supports arbitrary sequence length.

[0145] Similarly, the contents of the above method embodiments are 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 storing a program executable by a processor. When the program 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 applicable to the present storage medium embodiment. The functions specifically implemented by the present storage medium embodiment 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 optional 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 in an exemplary manner for the purpose of providing a more comprehensive understanding of the technology. The disclosed method is not limited to the operation and logic flow presented herein. Optional embodiments are contemplated in which the order of the various operations is changed and the sub-operations described as a part of a larger operation are performed independently.

[0149] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is not necessary for understanding the present invention. More specifically, given the properties, functions, and internal relationships of the various functional modules in the devices disclosed herein, the actual implementation of the module will be understood within the ordinary skill of an engineer. Therefore, a person skilled in the art will be able to implement the present invention set forth in the claims using ordinary skill without undue experimentation. 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 and includes several programs for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0151] The logic and / or steps represented in a 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, or in conjunction with, a program execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can retrieve and execute a program from a program execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" may be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, a program execution system, apparatus, or device.

[0152] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be 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 processing in another suitable manner as necessary, and then stored in a computer memory.

[0153] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable program execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific 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, reference to the terms "one embodiment / example," "another embodiment / example," or "certain embodiments / examples" 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 suitable manner in any one or more embodiments or examples.

[0155] While 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 invention, and that the scope of the 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 can 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 by: The screening system comprises: a mutually exclusive register array for storing data sequence segments that require data size comparison; the data in the mutually exclusive register array includes values ​​and indexes 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 different register array can be used as a pivot in the current data size comparison round; a hub unit, configured to provide a hub selection set, or update the hub selection set according to statistical results of a previous data size comparison round provided by an 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, based on the hub selection register array, a hub index corresponding to a hub of a current data size comparison round; a comparing unit, configured to compare the data size of each bit of 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 configured 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 a current data size comparison round, based on 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 includes: a hub selection space reduction module, configured to perform a bitwise operation on the hub selection set and the comparison vector set, and use 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 includes: A comparator array, configured to compare the data size of each bit in the distinct register array with the hub; the number of the comparator arrays is the same as the bit width of the distinct register array; A comparison register array, configured to store a segmentation result of a data size comparison of a current segment, and to place 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 is used to represent that 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 judgment module is used to: 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 pivot selection set are bitwise ANDed together, and the result is used as the new pivot selection set.

6. A high-performance Top-k screening method that supports arbitrary sequence lengths, characterized in that: Applied to the high-performance Top-k screening system supporting arbitrary sequence length as claimed in claim 1, the method comprises: Comparing the data in the distinct register array with the hub and determining the number of segments of the data larger than the hub, or determining the number of segments of the data smaller than the hub; the hub is a hub index determined according to the hub selection register array, and then determining the data corresponding to the hub index in the distinct register array; the hub selection register array is used to indicate whether the data in the corresponding distinct register array can be used as a 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 amount of data, 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 number of data 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 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 pivot selection set are bitwise ANDed together, and the result is used as the new pivot 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: A position index is spliced ​​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.

10. A high-performance Top-k screening device supporting arbitrary sequence length, characterized in that: The invention comprises a high-performance Top-k screening system supporting arbitrary 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