Data sorting apparatus and method based on fixed structure sorting network

By introducing a cache unit, a multiplexing logic unit, and a data exchange network into a fixed-structure sorting network, and combining it with a shear sorting algorithm, efficient sorting of data of different sizes is achieved. This solves the problem of network structure reusability in existing technologies and improves the system's flexibility and resource utilization.

CN122152265APending Publication Date: 2026-06-05BEIJING TSINGMICRO INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING TSINGMICRO INTELLIGENT TECH CO LTD
Filing Date
2026-05-09
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing parallel sorting networks are typically designed for fixed input sizes, which makes it difficult to reuse the structure when the data size changes. This results in additional software control overhead and hardware resource consumption, reducing system efficiency and resource utilization.

Method used

A fixed-structure sorting network is adopted, including a cache unit, a multiplexing logic unit, a data exchange network, and multiple sorting networks. The data matrix is ​​sorted by row and column using a shear sorting algorithm, realizing the transformation and parallel processing of data in different dimensions, and supporting the sorting of data of different sizes.

Benefits of technology

It improves the versatility, scalability, and hardware resource utilization efficiency of the sorting network, enabling it to handle data sorting tasks of different scales without changing the network structure, thereby enhancing the system's data processing capabilities and structural adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122152265A_ABST
    Figure CN122152265A_ABST
Patent Text Reader

Abstract

The application discloses a data sorting device and method based on a fixed structure sorting network, wherein the method comprises a cache unit, a multiple selection logic unit, a data exchange network and multiple sorting networks; the multiple selection logic unit is used for receiving multiple selection control information, selecting a data matrix output by the sorting network or a data matrix stored in the cache unit based on the multiple selection control information, and transmitting the selected data matrix to the data exchange network; the data exchange network is used for performing data exchange and data rearrangement on the data matrix based on exchange network control information; and the sorting network is used for calling a cut sorting function to alternately perform row sorting or column sorting on the data matrix to obtain a sorted data vector. The application can realize efficient sorting processing on different sizes of input data, and improves the universality, scalability and hardware resource utilization efficiency of the sorting network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer data processing technology, and in particular to a data sorting apparatus and method based on a fixed-structure sorting network. Background Technology

[0002] In applications such as big data processing, artificial intelligence training, and high-performance computing, efficient sorting of large-scale data is one of the fundamental operations in the data processing process, and its execution efficiency directly affects the overall system's processing performance. As data scale continues to grow, how to achieve flexible sorting of data of different sizes while ensuring high sorting throughput has become an important technical problem in the design of data processing systems.

[0003] Currently, to improve sorting efficiency, parallel sorting networks are commonly used to accelerate sorting in hardware. Parallel sorting networks typically consist of multiple comparison and exchange units arranged in a predetermined topology. By performing parallel comparisons and exchanges on the input data, they achieve the sorting of the data sequence. Among them, the Odd-Even Merge Sort Network and the Bitonic Sort Network are typical parallel sorting network structures. These sorting networks can complete multiple sets of data comparison and exchange operations simultaneously within a single clock cycle under the parallel operation of multiple comparators, thereby improving sorting throughput and are therefore widely used in hardware sorting acceleration systems.

[0004] However, existing parallel sorting networks are typically designed for fixed input sizes, and their network topology, number of comparators, and connection methods are closely related to the input data size. When the input data size changes, it is often necessary to redesign the sorting network structure for the corresponding size, making it difficult to reuse the structure between sorting networks of different sizes. For example, the odd-even merge sort networks used for sorting 8-input and 16-input data differ significantly in their merge structure and comparator layout, making it impossible to directly reuse the 8-input sorting network to achieve larger-scale data sorting. Therefore, when facing data sorting tasks with large variations in size, existing technologies typically split the data in software and perform multiple sorting and merging operations, or design dedicated sorting networks for different sizes. Both of these methods introduce additional software control overhead or increase hardware resource consumption, thereby reducing the overall efficiency and resource utilization of the system.

[0005] This section is intended to provide background or context for the embodiments of the invention set forth in the claims. The description herein is not an admission that it is prior art simply because it is included in this section. Summary of the Invention

[0006] This invention also provides a data sorting device based on a fixed-structure sorting network to achieve efficient sorting processing of input data of different sizes, thereby improving the versatility, scalability, and hardware resource utilization efficiency of the sorting network.

[0007] A data sorting device based on a fixed-structure sorting network includes: a cache unit, a multiplexing logic unit, a data exchange network, and multiple sorting networks; The multiplexing logic unit is used to receive multiplexing control information, select the data matrix output by the sorting network or the data matrix stored in the cache unit based on the multiplexing control information, and transmit the selected data matrix to the data exchange network. The data exchange network is used to perform transpose and splice operations on the data matrix based on the control information of the exchange network. The sorting network is used to call the shear sorting function to alternately sort the data matrix by rows or columns to obtain a sorted data vector. The cache unit is used to receive memory access control information and, based on the memory access control information, obtain the data matrix in the external device or receive the data matrix output by the sorting network.

[0008] In some embodiments, the apparatus further includes a control unit, configured to send memory access control information, multiplexing logic control information, switching network control information, and sorting network control information to the cache unit, the multiplexing logic unit, the data exchange network, and the plurality of sorting networks, respectively.

[0009] In some embodiments, the external device is used to determine whether the number of vectors in the acquired data sequence is an integer power of 2; if not, the data sequence is sorted in ascending or descending order to obtain a padded data sequence; the padded data sequence is then split according to a preset splitting format to obtain a data matrix to be sorted.

[0010] In some embodiments, the sorting network includes b output stages; in, , where n is the number of input data to the sorting network; each output level corresponds to a sorting result with a different sorting granularity.

[0011] This invention provides a data sorting method based on a fixed-structure sorting network to achieve efficient sorting of input data of different sizes, thereby improving the versatility, scalability, and hardware resource utilization efficiency of the sorting network.

[0012] The data sorting method based on fixed-structure sorting networks, applied to the aforementioned external devices, includes: Obtain the data sequence; If the number of vectors in the data sequence is not an integer power of 2, the data sequence is sorted in ascending or descending order to obtain the padded data sequence. The padded data sequence is split according to a preset splitting format to obtain a data matrix to be sorted; The cut sort function is called to alternately sort the rows or columns of the data matrix to be sorted, resulting in a sorted data vector.

[0013] In some embodiments, the step of calling the cut sort function to alternately sort the rows or columns of the data matrix to be sorted to obtain a sorted data vector includes: If the current loop iteration is even, call the row sorting function to sort the data matrix to be sorted by row, and obtain the row data matrix; If the current loop iteration is odd, call the column sorting function to sort the data matrix to be sorted by column, and obtain the column data matrix; If the current cycle number is less than the total number of sorting iterations, increment the current cycle number by one and iterate through the above sorting steps until the current cycle number is greater than or equal to the total number of sorting iterations. Then, concatenate the row data matrix or the column data matrix in an S-shape to obtain the sorted data vector.

[0014] In some embodiments, the step of calling the row sorting function to sort the data matrix to be sorted by row to obtain a row data matrix includes: If the number of columns in the data matrix to be sorted is less than or equal to the number of input data in the sorting network, each row of the data matrix to be sorted is assigned to multiple sorting networks for parallel sorting to obtain the row data matrix. If the number of columns in the data matrix to be sorted is greater than the number of input data in the sorting network, each row of data in the data matrix to be sorted is selected sequentially, each row of data is split into a sub-data matrix, and the cut sort function is recursively called to sort the sub-data matrix to obtain the row data matrix.

[0015] In some embodiments, the step of calling the column sorting function to sort the data matrix to be sorted into column data matrices includes: If the number of rows in the data matrix to be sorted is greater than or equal to the number of input data in the sorting network, the number of the first outer loop is determined based on the number of columns in the data matrix to be sorted and the number of sorting networks. The number of columns in the first sub-data matrix is ​​determined based on the number of columns in the data matrix to be sorted and the number of outer loop iterations; The data matrix to be sorted is divided by column according to the number of columns of the first sub-data matrix to obtain multiple first sub-data matrices; The row sorting function is called to sort each of the first sub-data matrices to obtain the column data matrix.

[0016] In some embodiments, the splitting format includes a first splitting format; the first splitting format is... ;in, The number of rows in the data matrix to be sorted. To sort the number of networks; Power; The number of elements in the data sequence.

[0017] In some embodiments, the splitting format includes a second splitting format; the second splitting format is... ;in, The number of rows in the data matrix to be sorted. To sort the number of networks; Power; The number of elements in the data sequence.

[0018] In some embodiments, the step of calling the column sorting function to sort the data matrix to be sorted into column data matrices includes: If the number of rows in the data matrix to be sorted is greater than or equal to the number of input data in the sorting network, the number of the first outer loop is determined based on the number of columns in the data matrix to be sorted and the number of sorting networks. The number of columns in the first sub-data matrix is ​​determined based on the number of columns in the data matrix to be sorted and the number of outer loop iterations; The data matrix to be sorted is divided by column according to the number of columns of the first sub-data matrix to obtain multiple first sub-data matrices; The row sorting function is called to sort each of the first sub-data matrices, and the sorted second sub-data matrices are output at the output stage; The sorted second sub-data matrix is ​​reorganized to obtain a column data matrix.

[0019] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described data sorting method based on a fixed-structure sorting network.

[0020] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned data sorting method based on a fixed-structure sorting network.

[0021] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described data sorting method based on a fixed-structure sorting network.

[0022] The data sorting method and apparatus based on a fixed-structure sorting network provided in this invention, by setting up a cache unit, a selection logic unit, a data exchange network, and multiple sorting networks, enables the orderly scheduling and efficient processing of data among various functional modules. The cache unit stores and retrieves input data and intermediate data generated during the sorting process, thereby supporting data reuse during sorting. The selection logic unit selects between the data matrix output by the sorting network and the data matrix stored in the cache unit according to selection control information, allowing data to switch between different sorting stages. The data exchange network performs transpose or concatenation operations on the data matrix according to exchange network control information, thereby realizing structural transformation of data between row and column directions to facilitate subsequent sorting processing. Multiple sorting networks are used to perform parallel sorting processing of the data matrix to improve overall sorting efficiency. Through the above structure, a collaborative working mechanism is formed among the functional modules, enabling the sorting process to be repeatedly executed on the fixed-structure sorting network, thereby achieving sorting processing of data of different scales, improving the system's data processing capability and structural adaptability while ensuring sorting efficiency. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings: Figure 1 This is a schematic diagram of the structure of the input odd-even merge sorting network in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of the 16-input odd-even merge sort network in an embodiment of the present invention; Figure 3 This is a schematic diagram of the hardware architecture of a data sorting device based on a fixed-structure sorting network in an embodiment of the present invention; Figure 4 This is a schematic diagram of the data matrix sorting process in an embodiment of the present invention; Figure 5 This is a functional block diagram of the n-input sorting network in an embodiment of the present invention; Figure 6 This is a flowchart illustrating a data sorting method based on a fixed-structure sorting network in one embodiment of the present invention. Figure 7 This is a schematic diagram of the main process of the m-group n-input sorting network in an embodiment of the present invention; Figure 8 This is a flowchart illustrating a data sorting method based on a fixed-structure sorting network in another embodiment of the present invention. Figure 9 This is a flowchart illustrating the cut sorting function in an embodiment of the present invention; Figure 10 This is a flowchart illustrating a data sorting method based on a fixed-structure sorting network in another embodiment of the present invention. Figure 11 This is a flowchart illustrating the row sorting function in an embodiment of the present invention; Figure 12 This is a flowchart illustrating a data sorting method based on a fixed-structure sorting network in another embodiment of the present invention. Figure 13 This is a flowchart illustrating the column sorting function in an embodiment of the present invention; Figure 14 This is a flowchart illustrating a data sorting method based on a fixed-structure sorting network in another embodiment of the present invention. Figure 15 This is a schematic diagram of the physical structure of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments and their descriptions are used to explain the present invention, but are not intended to limit the present invention. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. The acquisition, storage, use, and processing of data in the technical solutions of this application all comply with relevant laws and regulations. The user information in the embodiments of this application is obtained through legal and compliant means, and the acquisition, storage, use, and processing of user information have been authorized and agreed upon by the customer.

[0025] To facilitate understanding of the technical solution provided in this application, the relevant content of the technical solution in this application will be explained below.

[0026] To achieve efficient sorting of data of varying sizes and address the issues of existing parallel sorting networks being strongly tied to input data size, difficult to reuse, and having poor scalability, this application provides a data sorting device based on a fixed-structure sorting network. This data sorting device, by setting up a cache unit, a multiplexing logic unit, a data exchange network, and multiple sorting networks, and coordinating the scheduling of each functional module under the control of the control unit, enables the data to be sorted to be selected, exchanged, and sorted among different modules. The acquired data sequence is preprocessed; when the number of vectors in the data sequence is not a power of 2, a padded data sequence is obtained, and a data matrix to be sorted is constructed according to a preset splitting format. A shear sorting function is called to alternately perform row and column sorting operations on the data matrix to be sorted. Through this method, large-scale data sorting is achieved without redesigning the sorting network structure for different input sizes. After sorting, the sorting results are recombined and output using an S-shaped method, thereby improving the versatility, scalability, and hardware resource utilization efficiency of the sorting network.

[0027] like Figure 1 and Figure 2 As shown, for odd-even merge sort networks with input sizes of n=8 and n=16, the topological structures of their sorting networks are significantly different. The corresponding sorting network substructures are not compatible, so they cannot be directly reused. This limits the application scope and hardware resource utilization efficiency of this type of sorting network to a certain extent.

[0028] like Figure 1 As shown, the 8-input odd-even merge sorting network consists of 6 parallel comparison stages. The sorting network has a total of 19 comparators and performs sorting processing on the 8 input data through multi-level comparison and exchange operations.

[0029] like Figure 2 As shown, the 16-input parity merge sort network is a recursive extension of the 8-input parity merge sort network in terms of topology. Its overall structure includes two sets of 8-input parity merge sort networks and one set of 16-input merge sort networks.

[0030] Specifically, the 16-element input data is divided into two data sequences of 8 elements each, and these sequences are pre-sorted by two independent 8-input merge sort networks, resulting in two ordered data sequences. Then, a 16-input merge sort network merges these two ordered data sequences to obtain the final sorted result. The 16-input merge sort network uses a total of 63 comparators.

[0031] Because a merge sort network with a larger input size is needed in the merge phase to compare and exchange data between two ordered data sequences, this 16-input merge sort network differs fundamentally from the 8-input parity merge sort network in terms of topology, connectivity, and comparator layout. Therefore, in existing technologies, it is impossible to achieve data sorting processing with a larger input size by directly reusing the 8-input parity merge sort network.

[0032] To solve the above problems, such as Figure 3 As shown, the present invention provides a data sorting device based on a fixed structure sorting network, comprising: a cache unit, a multiplexing logic unit, a data exchange network, and multiple sorting networks.

[0033] The multiplexing logic unit is used to receive multiplexing control information, select the data matrix output by the sorting network or the data matrix stored in the buffer unit based on the multiplexing control information, and transmit the selected data matrix to the data exchange network.

[0034] Data exchange networks are used to perform transpose and splice operations on data matrices based on control information from the exchange network.

[0035] The sorting network is used to call the cut sort function to alternately sort the data matrix by row or column to obtain a sorted data vector.

[0036] The cache unit is used to receive memory access control information and, based on the memory access control information, obtain the data matrix from the external device or receive the data matrix output by the sorting network.

[0037] According to the above embodiments, by setting up a caching unit, a selection logic unit, a data exchange network, and multiple sorting networks, the data sorting device of this application can achieve orderly scheduling and efficient processing of data among various functional modules. The caching unit is used to store and retrieve input data and intermediate data generated during the sorting process, thereby supporting data reuse during sorting. The selection logic unit is used to select between the data matrix output by the sorting network and the data matrix stored in the caching unit according to selection control information, enabling data to switch between different sorting stages. The data exchange network is used to perform transpose or concatenation operations on the data matrix according to exchange network control information, thereby realizing structural transformation of data between row and column directions to facilitate subsequent sorting processing. Multiple sorting networks are used to perform parallel sorting processing of the data matrix to improve overall sorting efficiency. Through the above structure, a collaborative working mechanism is formed among the functional modules, enabling the sorting process to be repeatedly executed on a sorting network with a fixed structure, thereby realizing sorting processing of data of different scales, improving the system's data processing capability and structural adaptability while ensuring sorting efficiency.

[0038] In this embodiment of the invention, a Shear Sort algorithm is used to sort a data matrix input to an m-group n-input sorting network. The Shear Sort algorithm performs sorting operations alternately on the rows and columns of the data matrix, gradually achieving overall order through multiple iterations. Each iteration includes two stages: a row sorting stage and a column sorting stage. In the row sorting stage, the data in each row of the data matrix is ​​sorted; in the column sorting stage, the data in each column of the data matrix is ​​sorted. Through multiple rounds of alternating row and column sorting, the data gradually moves towards its target position in the two-dimensional array. After a predetermined number of iterations, the data matrix reaches an overall ordered state, thus completing the sorting process. This method enables data to be sheared and progressively migrated to the correct position in a two-dimensional array, achieving global sorting.

[0039] For example, such as Figure 4 As shown, Figure 4 For an 8 The diagram illustrates the process of sorting a data matrix of 8 using the Shear Sort algorithm. In this example, a total of 4 row sorts and 3 column sorts are performed.

[0040] Specifically, in the first phase of the first round (Phase-1), row sorting is performed; in the second phase of the first round (Phase-2), column sorting is performed; in the first phase of the second round (Phase-3), row sorting is performed; in the second phase of the second round (Phase-4), column sorting is performed; in the first phase of the third round (Phase-5), row sorting is performed; in the second phase of the third round (Phase-6), column sorting is performed; and in the first phase of the fourth round (Phase-7), row sorting is performed, thus obtaining an ordered data matrix.

[0041] For input size The number of times row sorting is performed on the data matrix is... The number of sorting operations for each column is Round up. By alternating between row and column sorting as described above, the data gradually moves towards its target position within the two-dimensional matrix, thus achieving overall order.

[0042] This invention achieves sorting of data of arbitrary input size (including non-powers of 2) by repeatedly calling a small-scale sorting network with a fixed input size and combining multi-round parallel sorting and data rearrangement strategies. This technical solution eliminates the need to redesign hardware sorting networks for different input sizes; by controlling and scheduling the same physical sorting network to perform sorting operations multiple times, large-scale data sorting tasks can be completed. This improves the versatility of the sorting network and the efficiency of hardware resource utilization with minimal additional hardware overhead.

[0043] In this embodiment of the invention, multiple sorting networks employ m groups of n-input sorting networks, but the invention is not limited thereto. External memory can be located within an external device or can be independently configured and connected to the external device. External memory can be SRAM or DRAM, etc., used to store a large-scale unsorted data matrix and the sorted data results.

[0044] The selection logic unit is used to receive selection control information sent by the control unit, and select between the data matrix output by the m-group n-input sorting network and the data matrix stored in the buffer unit according to the selection control information, thereby transmitting the selected data matrix to the data exchange network.

[0045] Data exchange networks can be implemented using structures such as crossbar switches, transpose networks, or permutation interconnection networks. These networks are used to perform transpose and concatenation operations on the data matrix to be sorted, thereby enabling the rearrangement of data across different dimensions.

[0046] In m sets of n-input sorting networks, each sorting network is an independent n-input sorting network. The sorting networks can employ parallel sorting network structures such as Odd-Even Merge Sort Networks and Bitonic Sort Networks. Each sorting network receives n input data and outputs n sorted data results. The m sets of sorting networks can run in parallel, forming a pipelined or batch processing data processing structure. Here, m and n are both integers. To improve sorting efficiency and ensure the regularity of the hardware structure, m and n are usually set to integer powers of 2, for example, m=8 and n=8.

[0047] The cache unit, as an intermediate buffer module, is used to receive and temporarily store the sorting results output by each sorting network according to the memory access control information sent by the control unit, or to interact with external memory to support data reading and writing and intermediate result storage during the sorting process.

[0048] In some embodiments, the data sorting apparatus based on a fixed-structure sorting network further includes a control unit, configured to send memory access control information, multiplexing logic control information, switching network control information, and sorting network control information to a cache unit, a multiplexing logic unit, a data exchange network, and multiple sorting networks, respectively.

[0049] In this embodiment of the invention, the control unit is used to uniformly control the workflow of each functional module and send corresponding control information to the cache unit, the multiplexing logic unit, the data exchange network, and the sorting network to coordinate the working sequence, data transmission path, and sorting operation rules between the modules. This achieves synchronous scheduling among the modules within the system, ensuring the correct execution of each functional module and improving overall processing performance. The control information includes memory access control information, multiplexing control information, exchange network control information, and sorting network control information, used to control data read / write operations, data matrix selection, transpose or concatenation operations of the data exchange network, and sorting execution process of the sorting network, respectively.

[0050] In some embodiments, the external device determines whether the number of vectors in the acquired data sequence is a power of 2. If not, the data sequence is sorted in ascending or descending order to obtain a padded data sequence. The padded data sequence is then split according to a preset splitting format to obtain a data matrix to be sorted.

[0051] In some embodiments, the sorting network includes b output stages. , where n is the number of input data to the sorting network. Each output level corresponds to a sorting result with a different sorting granularity.

[0052] In embodiments of the present invention, such as Figure 5 As shown, Figure 5 A functional structure diagram of an n-input sorting network is shown. Based on this n-input sorting network, parallel sorting operations with different sorting granularities can be implemented. The n-input sorting network includes b output stages, where... , where n is the number of input data for the sorting network.

[0053] Specifically, different output levels correspond to sorting results of different granularities. For example, the first output level corresponds to n / 2 groups of 2-input sorting results, the second output level corresponds to n / 4 groups of 4-input sorting results, and so on, with the b-th output level (i.e., the final output level) corresponding to 1 group of n-input merge sorting results. By selecting different output levels as the output of the sorting network, sorting of input data at different granularities can be achieved.

[0054] Taking an 8-input sorting network as an example, where n = 8, this network can select different output levels as the final output based on control information, thus achieving sorting processing at different granularities. For instance, when the sorting granularity is 2, the output of the first output level is selected as the final output. When the granularity is 4, the output of the second output level is selected. When the granularity is 8, the output of the third output level is selected. This method enables parallel sorting processing at multiple granularities within the same network structure.

[0055] According to the above embodiments, by setting multiple output levels in the sorting network and assigning each output level to sorting results with different granularities, multi-granularity parallel sorting processing can be achieved under the same sorting network structure. By selecting different output levels as sorting results, data sorting of different scales or granularities can be completed without changing the overall structure of the sorting network, thereby improving the reusability and flexibility of the sorting network structure. The above structure reduces the need to design separate hardware sorting networks for different input scales, which helps to reduce hardware implementation complexity and improve hardware resource utilization efficiency, thereby enhancing the overall data processing capability of the system.

[0056] Organize the input data to be sorted into a data vector, such as... Figure 3 With the hardware structure shown, the above-described m-group n-input sorting network can perform parallel sorting processing on m groups of vector data. Each vector group contains no more than n data points. When the number of data points in each vector group exceeds n, the m-group n-input sorting network can be repeatedly called to sort larger-scale input data. Using this method, large-scale data sorting tasks can be completed without increasing the input size of the sorting network.

[0057] This application provides a data sorting method based on a fixed-structure sorting network, applied to the aforementioned data sorting apparatus based on a fixed-structure sorting network. This data sorting method based on a fixed-structure sorting network is based on the same inventive concept as the data sorting apparatus based on a fixed-structure sorting network in one embodiment of this application, and the principle of solving the problem is similar. Therefore, the implementation of the data sorting method based on a fixed-structure sorting network is the same as the implementation of the data sorting apparatus based on a fixed-structure sorting network in one embodiment of this application, and repeated details will not be described again. As used below, the terms "unit" or "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the system described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0058] like Figure 6 As shown, a data sorting method based on a fixed-structure sorting network is applied to the aforementioned external device. The method includes steps 601 to 604.

[0059] Step 601: Obtain the data sequence.

[0060] Step 602: If the number of vectors in the data sequence is not an integer power of 2, sort the data sequence in ascending or descending order to obtain the padded data sequence.

[0061] Step 603: Split the completed data sequence according to the preset splitting format to obtain the data matrix to be sorted.

[0062] Step 604: Call the cut sort function to alternately sort the rows or columns of the data matrix to be sorted, obtaining a sorted data vector. This data sequence is a data vector containing arbitrary data elements.

[0063] In embodiments of the present invention, such as Figure 7 As shown, an external device receives a data vector containing k data elements. Here, k can be any positive integer. Determine if k is a power of 2. If k is a power of 2, then the total number of data elements in the data vector is denoted as t, i.e. If k is not a power of 2, then the data vector is padded so that the total number of data points in the padded data vector is a power of 2.

[0064] Specifically, if ascending sort is performed, then a positive infinity values ​​are added to the data vector. If descending order is performed, then a negative infinity values ​​are added to the data vector. ), so that the total number of elements in the padded data vector is .

[0065] After obtaining a data vector with a total of t data points, the data vector is structurally split and converted into a two-dimensional data matrix for subsequent sorting processing.

[0066] In some embodiments, the splitting format includes a first splitting format. The first splitting format is... .in, The number of rows in the data matrix to be sorted. To sort the number of networks. It is a power. The number of elements in the data sequence.

[0067] Specifically, the data vector can be split into components that satisfy... The data matrix, where It is a positive integer.

[0068] In some embodiments, the splitting format includes a second splitting format. The second splitting format is... .in, The number of rows in the data matrix to be sorted. To sort the number of networks. It is a power. The number of elements in the data sequence.

[0069] Specifically, the data vector can be split into components that satisfy... The data matrix, where, It is a positive integer. Then the cut sort function is called. This means splitting a data vector with a total amount of data t into x rows. Data matrix, and based on this The data matrix is ​​subjected to cut sorting.

[0070] According to the above embodiments, by acquiring the data sequence and padding it, the number of elements in the data sequence is made to satisfy an integer power of 2, thus enabling it to adapt to a fixed-structure sorting network for subsequent sorting processing. Simultaneously, by converting the data sequence into a data matrix to be sorted according to a preset splitting format, and calling a shear sorting function to alternately perform row and column sorting operations on the data matrix, the data can gradually migrate towards the target position in the two-dimensional structure, achieving overall order. Through the above processing method, sorting of data of different sizes can be completed without changing the sorting network structure, improving the adaptability of the sorting method to the input data size, while ensuring that the sorting process can be executed efficiently on a parallel sorting network, thereby improving the overall data sorting efficiency.

[0071] In some embodiments, such as Figure 8 As shown, step 604 includes steps 801 to 803.

[0072] Step 801: If the current loop iteration is even, call the row sorting function to sort the data matrix to be sorted by row, and obtain the row data matrix.

[0073] Step 802: If the current loop iteration is odd, call the column sorting function to sort the data matrix to be sorted by column, and obtain the column data matrix.

[0074] Step 803: If the current iteration number is less than the total number of sorting iterations, increment the current iteration number by one and iteratively execute the above sorting steps. Continue until the current iteration number is greater than or equal to the total number of sorting iterations, then concatenate the row data matrix or column data matrix in an S-shape to obtain the sorted data vector.

[0075] In embodiments of the present invention, such as Figure 9 As shown, the cut sort function is called. Sort the c×d data matrix. Here, c represents the number of rows in the data matrix. ; d represents the number of columns in the data matrix, i.e. .

[0076] Set the total number of sorting iterations to And set the loop variable to And initialize its value to 0. Check the loop variable. Is it even? If the loop variable... If the number is even, then the row sorting function Row is called. Perform a row-wise sorting operation on a c×d data matrix to obtain a row-ordered c×d data matrix. If the loop variable... If the number is odd, then the column sorting function Col is called. Perform a column-wise sorting operation on a c×d data matrix to obtain a c×d data matrix ordered by columns.

[0077] Further, check the loop variable. Is it less than If the loop variable Then the loop variable Updated to And repeat the above sorting steps in a loop. If the loop variable Then, the currently obtained c×d data matrix, ordered by row or column, is concatenated in a row-major order combined with an S-shaped (snake-like) pattern to obtain the final sorted data vector.

[0078] According to the above embodiments, by alternately performing row sorting and column sorting operations according to the current loop iteration during the sorting process, the data matrix to be sorted is gradually locally ordered in different dimensions, allowing the data to gradually migrate towards its target position in the two-dimensional structure, thus achieving overall sorting. By setting a comparison mechanism between the loop iteration and the total number of sorting iterations, the sorting process can be automatically executed according to a predetermined number of iterations and terminated after reaching the termination condition, which helps to ensure the stability and determinism of the sorting process. In addition, by concatenating the data matrix in an S-shaped manner after sorting, the two-dimensional ordered data matrix can be converted into a one-dimensional ordered data vector, which facilitates subsequent data processing and output, thereby improving the overall efficiency and processing flexibility of the data sorting process.

[0079] In some embodiments, such as Figure 10 As shown, step 801 includes steps 1001 to 1002.

[0080] Step 1001: If the number of columns in the data matrix to be sorted is less than or equal to the number of input data in the sorting network, each row of the data matrix to be sorted is assigned to multiple sorting networks for parallel sorting to obtain a row data matrix.

[0081] Step 1002: If the number of columns in the data matrix to be sorted is greater than the number of input data in the sorting network, select each row of data in the data matrix to be sorted in turn, split each row of data into a sub-data matrix, and recursively call the cut sort function to sort the sub-data matrix to obtain the row data matrix.

[0082] In embodiments of the present invention, such as Figure 11 As shown, by calling the row sorting function Row Row-wise sorting is performed on the c×d data matrix. It is determined whether the number of columns *d* of the c×d data matrix is ​​less than or equal to the number of input data *n* to the sorting network. If the number of columns *d* is less than or equal to the number of input data *n*, the c×d data matrix is ​​stored in external memory. The cache unit reads the c×d data matrix from the external memory and transmits it to the data exchange network through the multiplexing logic unit. The data exchange network inputs each row of the c×d data matrix into m groups of n-input sorting networks for parallel sorting processing, thus obtaining a row-ordered c×d data matrix, which is then stored in the cache unit.

[0083] When the number of columns d in the c×d data matrix is ​​greater than the number of input data n in the sorting network, set a loop variable. And set its initial value to 0. Then, sequentially select the first element from the c×d data matrix. Row data, and for the first The row data is divided into blocks to obtain Sub-data matrix. Call the cut and sort function. right The sub-data matrix is ​​recursively sorted to obtain a row-ordered result. Sub-data matrix.

[0084] Further, check the loop variable. Is it less than If the loop variable Then the loop variable Updated to And repeat the above sorting steps in a loop. If the loop variable , then it means all All sub-data matrices have been sorted and are being processed via a data exchange network. The sub-data matrices are concatenated to obtain a row-ordered c×d data matrix, which is then stored in the cache unit.

[0085] According to the above embodiments, by determining the relationship between the number of columns in the data matrix to be sorted and the input size of the sorting network, an appropriate sorting method can be selected based on different data sizes. When the number of columns in the data matrix to be sorted is less than or equal to the input size of the sorting network, each row of data is distributed to multiple sorting networks for parallel sorting processing, thereby fully utilizing the parallel processing capabilities of the parallel sorting networks and improving sorting efficiency. When the number of columns in the data matrix to be sorted is greater than the input size of the sorting network, each row of data is split and the sub-data matrix is ​​sorted by recursively calling the shear sort function, enabling the sorting process to adapt to larger-scale data inputs. Through the above methods, sorting processing of data of different sizes is achieved while maintaining the sorting network structure, improving the system's scalability and data processing flexibility.

[0086] In some embodiments, such as Figure 12 As shown, step 802 includes steps 1201 to 1204.

[0087] Step 1201: If the number of rows in the data matrix to be sorted is greater than or equal to the number of input data in the sorting network, determine the number of outer loop iterations based on the number of columns in the data matrix to be sorted and the number of sorting networks.

[0088] Step 1202: Determine the number of columns in the first sub-data matrix based on the number of columns in the data matrix to be sorted and the number of outer loop iterations.

[0089] Step 1203: Divide the data matrix to be sorted into multiple first sub-data matrices according to the number of columns of the first sub-data matrix.

[0090] Step 1204: Call the row sorting function to sort each first sub-data matrix to obtain the column data matrix.

[0091] In embodiments of the present invention, such as Figure 13 As shown, by calling the column sorting function Col Perform column-wise sorting on the c×d data matrix.

[0092] If the number of rows c in the c×d data matrix is ​​greater than or equal to the number of input data n in the sorting network, substitute the number of columns d in the c×d data matrix and the number of sorting networks m into the following formula (1) to calculate the number of outer loops p.

[0093]

[0094] Where d is the number of columns in the c×d data matrix, This represents the number of sorting networks.

[0095] The c×d data matrix is ​​divided into blocks along the column direction to obtain the c×d data to be processed in each round of the loop. Sub-data matrix.

[0096] Substitute the number of columns d of the c×d data matrix and the number of outer loops p into the following formula (2) to calculate the number of rows of the sub-data matrix. .

[0097]

[0098] in, Let be the number of columns in the c×d data matrix. This represents the number of times the outer loop is run.

[0099] c× through data exchange network Perform a transpose operation on the sub-data matrix to obtain Sub-data matrix. Set loop variable. And set its initial value to 0. Call the Row sorting function. right The sub-data matrix is ​​recursively sorted to obtain a row-ordered result. Sub-data matrix.

[0100] Further, check the loop variable. Is it less than If the loop variable Then the loop variable Updated to And repeat the above sorting steps in a loop. If the loop variable , indicating all All sub-data matrices have been sorted, and multiple row-ordered sub-matrices are processed through a data exchange network. The sub-data matrices are concatenated to obtain a row-ordered d×c data matrix.

[0101] Specifically, the data exchange network will connect various The sub-data matrices are combined according to column block order to obtain a row-ordered d×c data matrix. The data exchange network performs a transpose operation on the d×c data matrix to obtain a column-ordered c×d data matrix.

[0102] According to the above embodiments, by determining the number of outer loop iterations based on the number of columns in the data matrix to be sorted and the number of sorting networks, and by determining the size of the sub-data matrices, the data to be sorted can be processed in blocks according to the processing capacity of the sorting network, thus ensuring that each sorting operation can be completed within the input size range of the sorting network. Simultaneously, by splitting the data matrix to be sorted by column and calling row sorting functions on each sub-data matrix, sorting operations on column-wise data can be achieved while maintaining the sorting network structure, thereby effectively utilizing the existing sorting network to complete the column sorting task. This approach not only adapts to the sorting needs of large-scale data but also improves the reusability of the sorting network and the overall data processing efficiency.

[0103] In some embodiments, such as Figure 14 As shown, step 802 also includes steps 1401 to 1405.

[0104] Step 1401: If the number of rows in the data matrix to be sorted is less than the number of input data in the sorting network, determine the output level based on the number of rows in the data matrix to be sorted, and determine the number of columns in the second sub-data matrix based on the number of input data, the number of rows in the data matrix to be sorted, and the number of columns in the data matrix to be sorted.

[0105] Step 1402: Determine the number of the second outer loop based on the number of input data, the number of sorting networks, and the number of columns and rows of the data matrix to be sorted.

[0106] Step 1403: Divide the data matrix to be sorted into multiple second sub-data matrices according to the number of columns of the second sub-data matrix.

[0107] Step 1404: Call the row sorting function to sort each second sub-data matrix, resulting in multiple sorted second sub-data matrices.

[0108] Step 1405: Reorganize the sorted second sub-data matrices to obtain column data matrices.

[0109] In embodiments of the present invention, such as Figure 13 As shown, by calling the column sorting function Col Perform column-wise sorting on the c×d data matrix.

[0110] If the number of rows c in the c×d data matrix is ​​less than the number of input data n in the sorting network, substitute the number of rows c in the c×d data matrix into the following formula (3) to calculate the output level. .

[0111]

[0112] Where c is the number of rows in the c×d data matrix.

[0113] Substitute the number of columns d of the c×d data matrix, the number of rows c of the c×d data matrix, the number of input data n of the sorting network, and the number of sorting networks m into the following formula (4) to calculate the number of outer loops p.

[0114]

[0115] Where d is the number of columns in the c×d data matrix, and c is the number of rows in the c×d data matrix. denoted by , where n is the number of sorting networks and n is the number of input data for each sorting network.

[0116] Substituting the number of columns d, the number of rows c, and the number of input data n of the sorting network into the following formula (5), the number of rows of the sub-data matrix is ​​calculated. .

[0117]

[0118] Where d is the number of columns in the c×d data matrix, c is the number of rows in the c×d data matrix, and n is the number of input data for the sorting network.

[0119] The c×d data matrix is ​​divided into blocks along the column direction to obtain n×d data to be processed in each round of the loop. Sub-data matrix.

[0120] Through the data exchange network, n× Perform a transpose operation on the sub-data matrix to obtain Sub-data matrix. Set loop variable. And set its initial value to 0. Call the Row sorting function. right The sub-data matrix is ​​recursively sorted, starting from the first... The output stage outputs are ordered line by line. Sub-data matrix.

[0121] Further, check the loop variable. Is it less than If the loop variable Then the loop variable Updated to And repeat the above sorting steps in a loop. If the loop variable , indicating all All sub-data matrices have been sorted, and multiple row-ordered sub-matrices are processed through a data exchange network. The sub-data matrix is ​​reverse-reorganized to obtain a row-ordered d×c data matrix.

[0122] Specifically, the data exchange network will connect various The sub-data matrices are combined according to column block order to obtain a row-ordered d×c data matrix. The data exchange network performs a transpose operation on the d×c data matrix to obtain a column-ordered c×d data matrix.

[0123] According to the above embodiments, when the number of rows in the data matrix to be sorted is less than the input size of the sorting network, the output level is determined based on the number of rows in the matrix. The number of outer loop iterations and the size of the sub-data matrices are dynamically calculated in conjunction with the input data size, the number of sorting networks, and the matrix size. This allows the data to be structurally reorganized and processed within the input capacity of the sorting network. Column-wise sorting is achieved by splitting the sub-data matrices by columns and calling the row sorting function on the sub-data matrices, thus completing the column sorting operation without changing the structure of the sorting network. This approach not only improves the adaptability of the sorting network to data of different sizes but also enhances the flexibility and resource reuse capabilities of the sorting process, thereby improving overall data processing efficiency.

[0124] In some embodiments, such as Figure 13 As shown, the external device obtains the length of the input data vector. Sorting network data volume Number of input data for each sorting network For example, let's sort the input data in ascending order. The sorting process is as follows: External devices preprocess the input data vector. Due to the length of the input data vector... The value is not a power of 2, so the data vector is padded with a positive infinity (+∞) to expand the total length of the data. ,Right now The padded data vector contains 128 data elements.

[0125] The padded data vector is reassembled into a two-dimensional data matrix. In this embodiment of the invention, 128 data elements are reassembled into... The data matrix, where the number of rows in the data matrix is... The number of columns in the data matrix is .

[0126] In obtaining After the data matrix is ​​generated, the cut and sort function is called. right The data matrix is ​​sorted. According to the iterative rules of the cut sort algorithm, the total number of sorting rounds is... wheel.

[0127] In the first round of sorting, due to the loop variable If the number is even, call the row sorting function Row. right The data matrix is ​​sorted row-wise. Because... The number of columns in the data matrix is ​​greater than the number of input data for the sorting network. Therefore, for The data matrix is ​​divided into blocks for each row, splitting each row into multiple... Sub-data matrix.

[0128] right Sub-data matrix calls cut sort function Perform sorting. During the sorting process, because... The number of columns in the sub-data matrix is ​​less than or equal to the number of input data to the sorting network. Therefore, The sub-data matrix is ​​stored in external memory. It is then read from external memory by the cache unit. The sub-data matrix is ​​then transmitted to the data exchange network via multiplexing logic units.

[0129] Data exchange network will Each row of the sub-data matrix is ​​input into eight groups of eight-input sorting networks for parallel sorting, thus obtaining row-ordered data. Sub-data matrix, and sorted by row The sub-data matrix is ​​stored in the cache unit.

[0130] In all After all sub-data matrices have been sorted, they are processed through a data exchange network. The sub-data matrices are concatenated to obtain a row-ordered result. Data matrix, and sorted by row. The data matrix is ​​stored in the cache unit.

[0131] In the second round of sorting, the column sorting function Col is called via the data exchange network. right The data matrix is ​​sorted column-wise. Because... The data matrix has 64 columns, and the sorting network has 8 columns, therefore the number of outer loops is calculated. .

[0132] When the number of columns in a 2×64 data matrix exceeds the number of columns in the sorting network (8), the 2×64 data matrix is ​​divided into blocks along the column direction, resulting in 2×8 sub-data matrices to be processed in each round of the loop. The 2×8 sub-data matrices are then transposed using a data exchange network to obtain 8×2 sub-data matrices. The row sorting function `Row` is then called. Perform row-wise sorting on the 8×2 sub-data matrix to obtain an 8×2 sub-data matrix ordered by row.

[0133] After all 8×2 sub-data matrices have been sorted, the data exchange network concatenates these row-ordered 8×2 sub-data matrices to obtain a row-ordered 64×2 data matrix. The data exchange network then transposes the 64×2 data matrix to obtain a column-ordered 2×64 data matrix.

[0134] The third round of sorting is the same as the first round, and will not be described again here. After the third round of sorting, a final sorted 2×64 data matrix is ​​obtained. Finally, the 2×64 data matrix is ​​concatenated in row-major order combined with an S-shaped order to obtain a sorted data vector. The trailing positive infinity values ​​of this data vector are removed to obtain the final data vector.

[0135] In one possible implementation, such as Figure 13 As shown, in the second round of sorting, the 2×64 data matrix can be split into two 2×32 sub-data matrices along the column direction, and each 2×32 sub-data matrix can be reorganized to transform it into multiple 8×8 sub-data matrices. The column sorting function Col is then called. right The data matrix is ​​sorted by column direction.

[0136] In the 0th iteration, columns 0 to 31 of the original 2×64 data matrix are sorted to obtain an ordered 2×32 data matrix with the first 32 columns. In the 1st iteration, columns 32 to 63 of the original 2×64 data matrix are sorted to obtain an ordered 2×32 data matrix with the last 32 columns.

[0137] The third round of sorting is the same as the first round, and will not be described again here. After the third round of sorting, a final sorted 2×64 data matrix is ​​obtained. Finally, the 2×64 data matrix is ​​concatenated in row-major order combined with an S-shaped order to obtain a sorted data vector. The trailing positive infinity values ​​of this data vector are removed to obtain the final data vector.

[0138] According to the above embodiments, this invention introduces the shear sorting algorithm into the hardware structure design of the sorting network. Through multi-round parallel sorting and data rearrangement strategies, it achieves sorting processing of input data vectors of different sizes. This technical solution eliminates the need to design new sorting network structures for different sizes of data input; by simply scheduling and reusing the same physical sorting network multiple times, large-scale data sorting tasks can be completed. Without significantly increasing additional hardware resource overhead, it improves the adaptability of the sorting network to data of different sizes, while also enhancing the versatility of the sorting network structure and the efficiency of hardware resource utilization.

[0139] Figure 15This is a schematic diagram of the physical structure of a computer device provided in an embodiment of the present invention, such as... Figure 15 As shown, the computer device includes a processor 1501, a memory 1502, and a bus 1503.

[0140] The processor 1501 and the memory 1502 communicate with each other via the bus 1503.

[0141] The processor 1501 is used to call program instructions in the memory 1502 to execute the methods provided in the above-described method embodiments.

[0142] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned data sorting method based on a fixed-structure sorting network.

[0143] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described data sorting method based on a fixed-structure sorting network.

[0144] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0145] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0146] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0147] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0148] In the description of this specification, the references to terms such as "an embodiment," "a specific embodiment," "some embodiments," "for example," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0149] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A data sorting device based on a fixed-structure sorting network, characterized in that, include: Cache unit, multiplexing logic unit, data exchange network and multiple sorting networks; The multiplexing logic unit is used to receive multiplexing control information, select the data matrix output by the sorting network or the data matrix stored in the cache unit based on the multiplexing control information, and transmit the selected data matrix to the data exchange network. The data exchange network is used to perform data exchange and data rearrangement on the data matrix based on the exchange network control information. The sorting network is used to call the shear sorting function to alternately sort the data matrix by rows or columns to obtain a sorted data vector. The cache unit is used to receive memory access control information and, based on the memory access control information, obtain a data matrix from an external device or receive a data matrix output by the sorting network.

2. The apparatus according to claim 1, characterized in that, Also includes: The control unit is configured to send memory access control information, multiple selection logic control information, switching network control information, and sorting network control information to the cache unit, the multiple selection logic unit, the data exchange network, and the multiple sorting networks, respectively.

3. The apparatus according to claim 1, characterized in that, The external device is used to determine whether the number of vectors in the acquired data sequence is an integer power of 2; if not, the data sequence is sorted in ascending or descending order to obtain a padded data sequence; the padded data sequence is then split according to a preset splitting format to obtain a data matrix to be sorted.

4. The apparatus according to claim 1, characterized in that, The sorting network includes b output stages; in, , where n is the number of input data to the sorting network; each output level corresponds to a sorting result with a different sorting granularity.

5. A data sorting method based on a fixed-structure sorting network, applied to the data sorting apparatus according to any one of claims 1-3, characterized in that, include: Obtain the data sequence; If the number of vectors in the data sequence is not an integer power of 2, the data sequence is sorted in ascending or descending order to obtain the padded data sequence. The padded data sequence is split according to a preset splitting format to obtain a data matrix to be sorted; The cut sort function is called to alternately sort the rows or columns of the data matrix to be sorted, resulting in a sorted data vector.

6. The method according to claim 5, characterized in that, The step of calling the cut sort function to alternately sort the rows or columns of the data matrix to be sorted, resulting in a sorted data vector, includes: If the current loop iteration is even, call the row sorting function to sort the data matrix to be sorted by row, and obtain the row data matrix; If the current loop iteration is odd, call the column sorting function to sort the data matrix to be sorted by column, and obtain the column data matrix; If the current cycle number is less than the total number of sorting iterations, increment the current cycle number by one and iterate through the above sorting steps until the current cycle number is greater than or equal to the total number of sorting iterations. Then, concatenate the row data matrix or the column data matrix in an S-shape to obtain the sorted data vector.

7. The method according to claim 6, characterized in that, The process of calling the row sorting function to sort the data matrix to be sorted by row, resulting in a row data matrix, includes: If the number of columns in the data matrix to be sorted is less than or equal to the number of input data in the sorting network, each row of the data matrix to be sorted is assigned to multiple sorting networks for parallel sorting to obtain the row data matrix. If the number of columns in the data matrix to be sorted is greater than the number of input data in the sorting network, each row of data in the data matrix to be sorted is selected sequentially, each row of data is split into a sub-data matrix, and the cut sort function is recursively called to sort the sub-data matrix to obtain the row data matrix.

8. The method according to claim 6, characterized in that, The step of calling the column sorting function to sort the data matrix to be sorted by column, resulting in a column data matrix, includes: If the number of rows in the data matrix to be sorted is greater than or equal to the number of input data in the sorting network, the number of the first outer loop is determined based on the number of columns in the data matrix to be sorted and the number of sorting networks. The number of columns in the first sub-data matrix is ​​determined based on the number of columns in the data matrix to be sorted and the number of outer loop iterations; The data matrix to be sorted is divided by column according to the number of columns of the first sub-data matrix to obtain multiple first sub-data matrices; The row sorting function is called to sort each of the first sub-data matrices to obtain the column data matrix.

9. The method according to claim 5, characterized in that, The splitting format includes a first splitting format; the first splitting format is... ;in, The number of rows in the data matrix to be sorted. To sort the number of networks; Power; The number of elements in the data sequence.

10. The method according to claim 5, characterized in that, The splitting format includes a second splitting format; the second splitting format is... ;in, The number of rows in the data matrix to be sorted. To sort the number of networks; Power; The number of elements in the data sequence.

11. The method according to claim 8, characterized in that, The step of calling the column sorting function to sort the data matrix to be sorted by column, resulting in a column data matrix, further includes: If the number of rows in the data matrix to be sorted is less than the number of input data in the sorting network, the output level is determined based on the number of rows in the data matrix to be sorted, and the number of columns in the second sub-data matrix is ​​determined based on the number of input data, the number of rows in the data matrix to be sorted, and the number of columns in the second sub-data matrix. The number of times the second outer loop is determined based on the number of input data, the number of sorting networks, and the number of columns and rows of the data matrix to be sorted; The data matrix to be sorted is divided column-wise according to the number of columns in the second sub-data matrix to obtain multiple second sub-data matrices; The row sorting function is called to sort each of the second sub-data matrices, and the sorted second sub-data matrices are output at the output stage; The sorted second sub-data matrix is ​​reorganized to obtain a column data matrix.

12. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 5 to 11.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 5 to 11.

14. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 5 to 11.