A data processing method, apparatus, device, and readable storage medium

By adding a numbering and sorting preprocessing component to the chip, the resource consumption problem of rearrangement and compression instructions in the vector processing unit is solved, and a more efficient sorting process is achieved.

CN117008868BActive Publication Date: 2026-11-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211026162.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-25
Publication Date
2026-11-17
Estimated Expiration
2042-08-25

AI Technical Summary

Technical Problem

In existing technologies, the rearrangement and compression instructions of vector processing units require separate circuit layout, resulting in high chip resource consumption, low efficiency, and high algorithm complexity.

Method used

A number sorting preprocessing component is added to the chip. By processing the data source number of the data sequence to be sorted, a sorting number sequence is generated and input into the original sorting circuit for sorting, reducing the dependence on additional circuits.

Benefits of technology

It effectively reduces chip resource consumption, improves sorting efficiency, and reduces sorting time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117008868B_ABST
    Figure CN117008868B_ABST
Patent Text Reader

Abstract

This application discloses a data processing method, apparatus, device, and readable storage medium. The method includes: obtaining a data sorting request for a data sequence to be sorted; the data sorting request carrying an initial number sequence corresponding to the data sequence to be sorted; the initial number sequence being a sequence composed of the data source numbers of each piece of data to be sorted in the data sequence; invoking a number sorting preprocessing component according to the data sorting request, reordering the initial number sequence in the number sorting preprocessing component to obtain a sorted number sequence; inputting the sorted number sequence and the data sequence to be sorted into a sorting circuit, and reordering the data in the data sequence to be sorted according to the sorted number sequence in the sorting circuit to obtain a sorted data sequence. Using this application can reduce chip resource consumption in sorting operations while improving sorting efficiency. This application can be applied to scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data processing method, apparatus, device, and readable storage medium. Background Technology

[0002] In AI processors used in the field of Artificial Intelligence (AI), vector processing units are a crucial component, as high-performance vector processing units can significantly enhance the performance of AI processors. Among the various sorting instructions within vector processing units, those for data rearrangement and compression are frequently used, accelerating the efficiency of inference and training.

[0003] In related technologies, rearrangement and compression instructions require a separate circuit layout for execution. For example, rearrangement instructions typically rely on neural networks (such as Benes networks) to achieve rearrangement. Neural networks require significant software time to initialize the network's routing parameters, and their high algorithm complexity results in low efficiency and performance. Furthermore, due to the high algorithm complexity, they require a large number of nodes, occupying a significant amount of chip area and consuming excessive chip resources in hardware implementation. Summary of the Invention

[0004] This application provides a data processing method, apparatus, device, and readable storage medium, which can reduce chip resource consumption in sorting operations and improve sorting efficiency.

[0005] One embodiment of this application provides a data processing method, including:

[0006] Obtain a data sorting request for the data sequence to be sorted; the data sorting request carries the initial number sequence corresponding to the data sequence to be sorted; the initial number sequence is a sequence composed of the data source numbers of each data to be sorted in the data sequence to be sorted; a data to be sorted in the data sequence to be sorted has a sequence position mapping relationship with a data source number in the initial number sequence;

[0007] The number sorting preprocessing component is invoked according to the data sorting request. In the number sorting preprocessing component, the initial number sequence is reordered to obtain the sorted number sequence. The number sorting preprocessing component and the sorting circuit are integrated into the chip.

[0008] The sorting number sequence and the data sequence to be sorted are input into the sorting circuit. The sorting circuit reorders the data in the data sequence to be sorted according to the sorting number sequence to obtain the sorted data sequence.

[0009] One embodiment of this application provides a data processing apparatus, including:

[0010] The request acquisition module is used to acquire data sorting requests for the data sequence to be sorted; the data sorting request carries the initial number sequence corresponding to the data sequence to be sorted; the initial number sequence is a sequence composed of the data source numbers of each data to be sorted in the data sequence to be sorted; a data to be sorted in the data sequence to be sorted has a sequence position mapping relationship with a data source number in the initial number sequence;

[0011] The component invocation module is used to invoke the number sorting preprocessing component based on the data sorting request; the number sorting preprocessing component and the sorting circuit are integrated into the chip.

[0012] The number sorting module is used to reorder the initial number sequence in the number sorting preprocessing component to obtain a sorted number sequence.

[0013] The sequence input module is used to input the sorting number sequence and the data sequence to be sorted into the sorting circuit;

[0014] The data sorting module is used to reorder the unsorted data in the data sequence to be sorted according to the sorting number sequence in the sorting circuit, so as to obtain the sorted data sequence.

[0015] In one embodiment, the numbering preprocessing component includes a rearrangement preprocessing component; the encoding form of each data source number in the initial numbering sequence is the initial encoding form; the initial numbering sequence contains the data source number K. i where i is a positive integer;

[0016] The numbering and sorting module may include:

[0017] The format conversion unit is used to input the initial number sequence into the rearrangement preprocessing component, which then converts the data source number K into a format that is processed by the rearrangement preprocessing component. i The encoding format is converted from the initial encoding format to the standard encoding format to obtain the data source number K. i Corresponding standard source number;

[0018] The reordering unit is used to reorder the initial numbering sequence according to the numbering order of the initial numbering sequence and the standard source number corresponding to each data source number when the standard source number corresponding to each data source number in the initial numbering sequence is obtained, so as to obtain the sorted numbering sequence.

[0019] In one embodiment, each data source number corresponds to a standard source number consisting of N characters; N is the same as the number of data source numbers contained in the initial numbering sequence, and N is a positive integer;

[0020] The reordering unit may include:

[0021] A character sequence determines the sub-unit used to number the data source K. i The position of the number in the initial numbering sequence is determined as the target numbering position;

[0022] The character sequence identifies the sub-unit and is also used to number the data source K. i In the corresponding standard source number, the character located at the target number position is determined as the first position character;

[0023] The character sequence determines the sub-unit and is also used to determine the character at the target number position in the standard source number corresponding to the remaining data source number as the second position character; the remaining data source number is the character in the initial number sequence excluding data source number K. i Other data source numbers;

[0024] The character sequence determines the subunit and is also used to sort the first position character and the second position character according to the numbering order of the initial numbering sequence to obtain the position character sequence corresponding to the target number position; the position character sequence corresponding to the target number position is the same as one of the N standard source numbers;

[0025] The numbering sequence determination subunit is used to determine the sorting numbering sequence based on the position character sequences corresponding to the N numbering positions in the initial numbering sequence and the numbering order of the initial numbering sequence when the position character sequences corresponding to the N numbering positions are determined respectively. The N position character sequences are the same as the N standard source numbers, and the position character sequence corresponding to one numbering position is the same as one of the standard source numbers in the N standard source numbers.

[0026] In one embodiment, the number sequence determining subunit is also specifically used to convert the encoding form of the position character sequence corresponding to the target number position from the standard encoding form to the initial encoding form through the rearrangement preprocessing component, so as to obtain the rearrangement transformation number corresponding to the target number position;

[0027] The numbering sequence determines the sub-unit, and is also specifically used to assign the data source number K at the target number position in the initial numbering sequence. i Replace with the reordering transformation number corresponding to the target number position;

[0028] The numbering sequence determines the sub-unit and is also specifically used to replace the data source number at the first remaining number position in the initial numbering sequence with the reordering transformation number corresponding to the remaining number position; the first remaining number position refers to the number position other than the target number position among the N number positions corresponding to the initial numbering sequence.

[0029] The numbering sequence determines the sub-units and is also specifically used to arrange the N reordered and transformed numbers according to the positional order between the N numbering positions to obtain the sorted numbering sequence.

[0030] In one embodiment, the number sorting preprocessing component includes a compression preprocessing component; the initial number sequence contains N data source numbers, and the N data source numbers contain data source number K. i where i is a positive integer;

[0031] The numbering and sorting module may include:

[0032] The inverting processing unit is used to invert the data source number K. i The position of the number in the initial numbering sequence is determined as the target numbering position;

[0033] The inversion processing unit is also used to compare the data sequence to be sorted with the data source number K. i Data to be sorted that has a sequence position mapping relationship is identified as target data to be sorted;

[0034] The inversion processing unit is also used to obtain the Boolean value corresponding to the target data to be sorted, and to invert the Boolean value corresponding to the target data to be sorted to obtain the inverted Boolean value corresponding to the target number position in the initial numbering sequence.

[0035] The sequence determination unit is used to reorder the initial number sequence according to the reverse Boolean values ​​corresponding to the N number positions when the initial number sequence is determined, so as to obtain the sorted number sequence.

[0036] In one embodiment, the sequence determination unit may include:

[0037] The valid value determination subunit is used to determine the M reversed Boolean values ​​out of N reversed Boolean values ​​whose value attribute is a valid attribute as valid Boolean values; M is a positive integer.

[0038] The invalid value determination subunit is used to determine Q inverted Boolean values ​​out of N inverted Boolean values ​​whose value attribute is invalid as invalid Boolean values;

[0039] The sequence determination subunit is used to reorder the initial number sequence based on N number positions, M valid Boolean values, and Q invalid Boolean values ​​to obtain a sorted number sequence.

[0040] In one embodiment, the sequence determining subunit is further specifically used to determine the numbering positions corresponding to M valid Boolean values ​​from N numbering positions as valid numbering positions, and to determine the numbering positions corresponding to Q invalid Boolean values ​​from N numbering positions as invalid numbering positions.

[0041] The sequence determines the sub-unit and is also specifically used to sort the M valid Boolean values ​​according to the positional order between the M valid number positions to obtain the first Boolean value sequence;

[0042] The sequence determines the sub-unit and is also specifically used to sort the Q invalid Boolean values ​​according to the positional order between the Q invalid number positions to obtain the second Boolean value sequence;

[0043] The sequence determines the sub-unit and is also specifically used to obtain the attribute arrangement order between valid and invalid attributes. The first Boolean value sequence and the second Boolean value sequence are sorted according to the attribute arrangement order to obtain the target Boolean value sequence.

[0044] The sequence determination sub-unit is also specifically used to reorder the initial numbering sequence based on the target Boolean value sequence to obtain a sorted numbering sequence.

[0045] In one embodiment, the target Boolean sequence includes the inverted Boolean value H. j j is a positive integer;

[0046] The sequence determines the subunit, and is also specifically used to reverse the Boolean value H. j The position of the value in the target Boolean value sequence is determined as the position to be filled.

[0047] The sequence determines the sub-unit, and is also specifically used to reverse the Boolean value H at N numbering positions in the initial numbering sequence. j The corresponding number position is determined as the position to be extracted;

[0048] The sequence determination sub-unit is also specifically used to determine the data source number at the position to be extracted in the initial number sequence as the sorting number at the position to be filled;

[0049] The sequence determination subunit is also specifically used to arrange the sorting numbers at each of the N value positions in the target Boolean value sequence according to the positional order among the N value positions, so as to obtain a sorting number sequence.

[0050] In one embodiment, the number sorting preprocessing component includes a conventional sorting preprocessing component;

[0051] The numbering and sorting module may include:

[0052] The size sorting unit is used in the regular sorting preprocessing component to reorder the initial number sequence according to the size order of each data source number in the initial number sequence, so as to obtain the sorted number sequence.

[0053] In one embodiment, the number sorting preprocessing component is a rearrangement preprocessing component; the sorting rule indicated by the rearrangement preprocessing component is a first sorting rule.

[0054] The data sorting module may include:

[0055] The sorting data determination unit is used to obtain the first data source number in the sorting number sequence according to the first sorting rule in the sorting circuit, and determine the number position of the first data source number in the sorting number sequence as the first number position.

[0056] The sorting data determination unit is also used to determine the data to be sorted in the data sequence to be sorted, with the data source number being the first data source number, as the sorting data at the first number position;

[0057] The sorting data determination unit is also used to determine the unsorted data in the unsorted data sequence whose data source number is the remaining data source number as the sorted data at the second remaining number position in the sorting number sequence; the remaining data source number refers to the data source number other than the first data source number in the sorting number sequence; the second remaining number position refers to the number position of the remaining data source number in the sorting number sequence.

[0058] The sorting data arrangement unit is used to arrange the sorted data at the first number position and the sorted data at the second remaining number position according to the positional order between the first number position and the second remaining number position, so as to obtain a sorted data sequence.

[0059] In one embodiment, the number sorting preprocessing component is either a compression preprocessing component or a regular sorting preprocessing component; the sorting rules indicated by both the compression preprocessing component and the regular sorting preprocessing component are second sorting rules; the sorted number sequence includes the data source number K. i where i is a positive integer;

[0060] The data sorting module may include:

[0061] The mapping data determination unit is used in the sorting circuit to obtain the mapping data corresponding to the data source number K in the data sequence to be sorted, according to the second sorting rule. i Unsorted data with sequence position mapping relationships;

[0062] The mapping data determination unit is also used to determine the data with the data source number K. i The data to be sorted, which has a sequence position mapping relationship, is identified as data source number K. i The corresponding mapping and sorting data;

[0063] The mapping data sorting unit is used to sort the mapping sorting data corresponding to each data source number according to the sorting number sequence when the mapping sorting data corresponding to each data source number is determined in the sorting number sequence, so as to obtain the sorting data sequence.

[0064] One embodiment of this application provides a computer device, including: a processor and a memory;

[0065] The memory stores a computer program, which, when executed by a processor, causes the processor to perform the methods described in the embodiments of this application.

[0066] One aspect of this application provides a computer-readable storage medium storing a computer program, which includes program instructions. When executed by a processor, the program instructions perform the methods described in this application.

[0067] One aspect of this application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the method provided in one aspect of the embodiments of this application.

[0068] In this embodiment, for sorting operations, the existing sorting circuit in the chip can be reused. This application adds a numbered sorting preprocessing component before the sorting circuit in the chip. When a data sorting request for a data sequence to be sorted is received, this numbered sorting preprocessing component can be pre-called. This component only processes the data source number of the data sequence to be sorted. After obtaining the sorting number sequence corresponding to the data sequence to be sorted, the sorting number sequence and the data sequence to be sorted are input into the sorting circuit. The sorting circuit then sorts the data sequence according to the order of the sorting number sequence to obtain the sorted data sequence. It should be understood that adding a numbered sorting preprocessing component to the chip only processes the original data number of the data sequence to be sorted to obtain the sorting number sequence. It does not require a separate additional circuit and can reuse the existing sorting circuit, greatly reducing chip area consumption and resource consumption. Simultaneously, since the entire numbering and sorting process is handled by hardware, there is no need to spend a long time configuring software parameters, which can reduce sorting time and improve sorting efficiency. In summary, this application can reduce chip resource consumption in sorting operations while improving sorting efficiency. Attached Figure Description

[0069] 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.

[0070] Figure 1 This is a network architecture diagram provided in an embodiment of this application;

[0071] Figure 2 This is a flowchart illustrating a data processing method provided in an embodiment of this application;

[0072] Figure 3 This is a schematic diagram of the structure of an output sorted data sequence provided in an embodiment of this application;

[0073] Figure 4 This is a flowchart illustrating a numbering and sorting process provided in an embodiment of this application;

[0074] Figure 5 This is a schematic diagram illustrating how to determine a sorting sequence based on a one-hot code, as provided in an embodiment of this application.

[0075] Figure 6 This is a flowchart illustrating a numbering and sorting process provided in an embodiment of this application;

[0076] Figure 7a This is a schematic diagram illustrating a conventional sorting method provided in an embodiment of this application;

[0077] Figure 7b This is a schematic diagram of data rearrangement provided in an embodiment of this application;

[0078] Figure 7c This is a schematic diagram of data compression provided in an embodiment of this application;

[0079] Figure 8 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application;

[0080] Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0081] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0082] This application involves artificial intelligence and related technologies. For ease of understanding, the following will provide a brief explanation of the artificial intelligence and related concepts involved:

[0083] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0084] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0085] With the research and advancement of artificial intelligence (AI) technology, AI is being studied and applied in various fields, such as smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, autonomous driving, drones, robots, smart healthcare, and smart customer service. It is believed that with the development of technology, AI will be applied in more fields and play an increasingly important role.

[0086] For easier understanding, please refer to Figure 1 , Figure 1 This is a network architecture diagram provided in an embodiment of this application. For example... Figure 1 As shown, the network architecture may include a business server 1000 and a terminal device cluster. The terminal device cluster may include one or more terminal devices, and there is no limit to the number of terminal devices.

[0087] like Figure 1 As shown, multiple terminal devices may include terminal device 100a, terminal device 100b, terminal device 100c, ..., terminal device 100n; as Figure 1As shown, terminal devices 100a, 100b, 100c, ..., 100n can each connect to the business server 1000 via a network, so that each terminal device can interact with the business server 1000 through the network connection.

[0088] It is understandable that, such as Figure 1 Each terminal device in the terminal cluster shown can have the target application installed. When the target application runs on each terminal device, it can interact with... Figure 1 The business servers 1000 shown interact with each other, enabling each business server 1000 to receive business data from each terminal device. The target application can include applications capable of displaying text, images, audio, and video data. These applications can include multimedia applications (e.g., video applications), entertainment applications (e.g., games), educational applications, social applications (e.g., instant messaging applications), shopping applications, novel applications, browsers, etc. All these applications can have multimedia data (e.g., video and music) loading and playback capabilities, as well as data sorting capabilities. For example, the application can be a live streaming application, a music application, an instant messaging application, etc. The application can be a standalone application, installed on the terminal device and running on the terminal device's current operating system; it can also be an embedded sub-application integrated into another application (e.g., a social application, an educational application, etc.). The form of the application is not limited here.

[0089] For ease of subsequent understanding and explanation, the embodiments of this application may be... Figure 1 In the terminal cluster shown, one terminal device is selected as the target terminal device. This terminal device may include, but is not limited to, smartphones, tablets, laptops, desktop computers, smart TVs, smart speakers, desktop computers, smartwatches, smart in-vehicle devices, smart voice interaction devices, smart home appliances, and other smart terminals with multimedia data processing functions (e.g., video playback, music playback, text playback) and data sorting functions. For example, embodiments of this application may use… Figure 1The terminal device 100a shown serves as the target terminal device. This target terminal device can integrate the aforementioned target application. In this case, the target terminal device can interact with the business server 1000 through the target application. The business server 1000 in this application can obtain business data based on these applications. For example, the business server 1000 can obtain business data through a user's bound account. Here, the bound account can refer to the account bound by the user in the application; the user can log in to the application, upload data, retrieve data, etc., through their corresponding bound account, and the business server can also obtain the user's login status, uploaded data, send data to the user, etc., through its bound account.

[0090] It should be understood that when a target terminal device (such as terminal device 100a) acquires a data sequence to be sorted and receives a data sorting instruction for the data sequence, terminal device 100a can send a data sorting request for the data sequence to be sorted to business server 1000. After receiving the data sorting request sent by terminal device 100a, business server 1000 can call a number sorting preprocessing component for sorting the numbers. The data sorting request sent by terminal device 100a may carry a number sequence corresponding to the data sequence to be sorted (referred to as the initial number sequence here because this number sequence needs to be rearranged later). This initial number sequence may be a sequence composed of the data source numbers of each data item to be sorted in the data sequence, and each data item to be sorted in the data sequence has a sequence position mapping relationship with a data source number in the initial number sequence. The data source numbers of the data sequence to be sorted may be composed of consecutive values ​​(e.g., consecutive integers starting from 0), and the maximum value of the data source numbers of the data sequence to be sorted may be determined by the total number of data items to be sorted. For example, suppose there are 5 pieces of data to be sorted, including data a, data b, data c, data d, and data e. Let's assume the data source numbers for the data to be sorted are consecutive integers starting from 0. Then, the maximum value for the data source number can be 4. Each piece of data to be sorted can be assigned a numerical value as its data source number. For example, the data source number for data a can be set to 0, for data c to 1, for data b to 2, for data d to 3, and for data e to 4. Then, data a can be referred to as data 0, data 1, data 2, data 3, and data 4. The data sorting instruction received by terminal device 100a is an instruction to sort these unsorted data. These unsorted data have an initial sequence (called the unsorted data sequence), and their corresponding data source numbers also have an initial sequence (called the initial number sequence). The sequence position mapping relationship refers to the mapping relationship between the unsorted data in the unsorted data sequence and the data source number in the initial number sequence that are at the same sequence position. For example, if the unsorted data sequence is {unsorted data 0, unsorted data 1, unsorted data 2, unsorted data 3, unsorted data 4}, and the initial number sequence is {1, 0, 3, 2, 4}, since unsorted data 0 is located at the first position in the unsorted data sequence and data source number 1 is located at the first position in the initial number sequence, then there is a sequence position mapping relationship between unsorted data 0 and data source number 1.

[0091] In the numbering and sorting preprocessing component, the service server 1000 reorders the initial numbering sequence to obtain a sorted numbering sequence. This unsorted data sequence can then be sorted using this sorted numbering sequence. For example, the service server 1000 can input the sorting component and the unsorted data sequence into a sorting circuit, where the sorting circuit can reorder the unsorted data according to the sorted numbering sequence to obtain a sorted data sequence. Subsequently, the service server 1000 can return the sorted data sequence to the terminal device 100a.

[0092] Optionally, it is understood that the network architecture may include multiple service servers, and a terminal device may be connected to a service server. Each service server may obtain the data sorting request sent by the terminal device connected to it, thereby sorting the data sequence to be sorted for the data sorting request and returning the data sorting result to the terminal device connected to it.

[0093] The method provided in this application embodiment can be applied to circuits such as Application Specific Integrated Circuit (ASIC), Field Programmable Gate Array (FPGA), and sorting circuits. This circuit can be applied to a chip, which can be integrated into a central processing unit (CPU), an AI chip, or other types of chips. The AI ​​chip is integrated into the business server in the form of a Peripheral Component Interconnect Express (PCIE) board.

[0094] The method provided in this application embodiment can add a number sorting preprocessing component (such as a rearrangement preprocessing component, a compression preprocessing component, etc.) before the sorting circuit in the chip. This number sorting preprocessing component only processes the data source number of the data sequence to be sorted. When performing rearrangement or compression operations, there is no need to implement a separate rearrangement circuit or compression circuit. The original sorting circuit can be reused to achieve rearrangement or compression, which can effectively reduce chip resource consumption and improve sorting efficiency.

[0095] It is understood that the methods provided in this application embodiment can be executed by computer devices, including but not limited to user terminals or business servers. The business server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0096] The user terminal and the business server can be connected directly or indirectly through wired or wireless communication, and this application does not impose any restrictions on this.

[0097] It is understandable that the above network architecture can be applied to the field of AI processing, such as data sorting scenarios like databases, object recognition, and text analysis. Specific business scenarios will not be listed here.

[0098] It should be noted that, in the specific embodiments of this application, user information, user data, and other related data require user authorization to be obtained. In other words, when the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions.

[0099] Further, please see Figure 2 , Figure 2 This is a flowchart illustrating a data processing method provided in an embodiment of this application. The data processing method provided in this application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving. The method can be implemented by a terminal device (e.g., the one described above). Figure 1 This can be executed by any terminal device in the terminal device cluster shown, or by a service server (e.g., the one mentioned above). Figure 1 The method can be executed by the business server 1000 shown, or jointly by the terminal device and the business server. For ease of understanding, this embodiment uses the execution of the method by the aforementioned business server as an example to illustrate the specific process of data sorting in the business server. The method may include at least the following steps S101-S103:

[0100] Step S101: Obtain a data sorting request for the data sequence to be sorted; the data sorting request carries the initial number sequence corresponding to the data sequence to be sorted; the initial number sequence is a sequence composed of the data source number of each data to be sorted in the data sequence to be sorted; a data to be sorted in the data sequence to be sorted has a sequence position mapping relationship with a data source number in the initial number sequence.

[0101] In this application, the data sequence to be sorted can be an unordered data sequence, which can consist of multiple (usually at least three) data. Since these data are not arranged in any order and await sorting, they can be called unordered data. The unordered data sequence composed of these unordered data can be called the unsorted data sequence. For example, the unsorted data sequence can be {3, 4, 6, 2, 5, 1, 0}. Of course, the unsorted data sequence can also be an ordered data sequence, which can be reordered. For example, the unsorted data sequence can be {0, 1, 2, 3, 4, 5, 6}. That is to say, the unsorted data sequence can refer to a data sequence waiting to be sorted, and it can also be other sequence types. The sequence type of the unsorted data sequence is not limited here.

[0102] In this embodiment of the application, the data sorting request may be sent by the terminal device to the business server (as described above). Figure 1 The data sorting request (as described above) can also be generated locally by the business server; this application embodiment does not limit the source of the data sorting request. The data sorting request can carry the data to be sorted in the data sequence to be sorted, and it can also carry the initial number sequence corresponding to the data sequence to be sorted. As described above... Figure 1 The initial numbering sequence described in this application embodiment can be a sequence composed of the data source numbers of each piece of data to be sorted in the data sequence to be sorted. The data source numbers of the data sequence to be sorted can be composed of consecutive numerical values ​​(e.g., consecutive integers starting from 0), and the maximum value of the data source numbers can be determined by the total number of data to be sorted. That is, the number of data source numbers included in the initial numbering sequence is the same as the number of data pieces to be sorted in the data sequence to be sorted. Similar to the data sequence to be sorted, the initial numbering sequence can also be an unordered numbering sequence, for example, {3, 4, 5, 6, 2, 1, 0}; or an ordered numbering sequence, for example, {6, 5, 4, 3, 2, 1, 0}.

[0103] It should be noted that, in this application, the order of the data source numbers in the initial numbering sequence does not correspond one-to-one with the order of the data to be sorted in the data sequence to be sorted. In other words, the data source number at a certain position in the initial numbering sequence may not be the data source number of the data to be sorted at that position in the data sequence to be sorted. To facilitate understanding, the following example will illustrate the concept. Suppose the sequence of data to be sorted is {data a, data c, data d, data b}, where the data source number for data a is 0, for data c is 2, for data d is 3, and for data b is 1. The initial numbering sequence could be {0, 3, 2, 1}. It can be seen that the data to be sorted at the first position in the sequence is data a, and the data source number at the first position in the initial numbering sequence is 0. Since data source number 0 is the data source number for data a, the two values ​​at the first position correspond. However, the data to be sorted at the second position in the sequence is data c, and the data source number at the second position in the initial numbering sequence is 3. Since data source number 3 is not the data source number for data c, the two values ​​at the second position do not correspond.

[0104] The sequence position mapping relationship in this application refers to the mapping relationship between two values ​​in the same position in the unsorted data sequence and the initial numbering sequence. For example, as illustrated above, suppose the unsorted data sequence is {unsorted data a, unsorted data c, unsorted data d, unsorted data b}, and the initial numbering sequence is {0, 3, 2, 1}. For the first position of the two sequences, unsorted data a corresponds to the data source number 0, and a sequence position mapping relationship exists. For the second position of the two sequences, unsorted data c does not correspond to the data source number 3, but a sequence position mapping relationship exists. Similarly, for the two values ​​in the two sequences at the third and fourth positions, a sequence position mapping relationship also exists, which will not be explained in detail here.

[0105] Step S102: The number sorting preprocessing component is invoked according to the data sorting request. In the number sorting preprocessing component, the initial number sequence is reordered to obtain the sorted number sequence. The number sorting preprocessing component and the sorting circuit are integrated into the chip.

[0106] In this application, the number sorting preprocessing component can refer to a component used to sort and preprocess the data source numbers. In this component, the initial number sequence can be reordered, and the resulting sorted number sequence can be used to reorder the data sequence to be sorted. It should be understood that the number sorting preprocessing component in this application can include a rearrangement preprocessing component, a compression preprocessing component, and a conventional sorting preprocessing component. In the field of AI processing, the application scenarios for data rearrangement and compression are very extensive. The rearrangement preprocessing component and the compression preprocessing component in this embodiment can reorder the initial number sequence. By adding a rearrangement preprocessing component and a compression preprocessing component before the sorting circuit in the chip, the original sorting circuit can be reused to achieve sorting operations such as rearranging and compressing the data to be sorted. There is no need to design a separate rearrangement circuit or compression circuit, which can effectively save chip area and reduce chip resource consumption. At the same time, the rearrangement preprocessing component and the compression preprocessing component only sort the data source numbers, which has low complexity and can effectively reduce sorting time.

[0107] Specifically, in the numbering and sorting preprocessing component, the initial number sequence is reordered to obtain a sorted number sequence. This can be achieved through: reordering the initial number sequence in the rearrangement preprocessing component; reordering the initial number sequence in the compression preprocessing component; and reordering the initial number sequence in the regular sorting preprocessing component. The regular sorting preprocessing component can refer to a component that performs regular sorting according to the size of the data source numbers in the initial number sequence. Therefore, when the numbering and sorting preprocessing component is a regular sorting preprocessing component, the specific implementation of reordering the initial number sequence to obtain a sorted number sequence can be as follows: In the regular sorting preprocessing component, the initial number sequence is reordered according to the order of size among the data source numbers in the initial number sequence. For example, if the initial number sequence is {0, 2, 3, 1}, sorting it in descending order will result in the sorted number sequence {0, 1, 2, 3}. For details on how the initial number sequence is reordered in the rearrangement preprocessing component to obtain a sorted number sequence, please refer to the following sections. Figure 4 The description in the corresponding embodiments; for the specific implementation of reordering the initial number sequence to obtain a sorted number sequence in the compression preprocessing component, please refer to the following. Figure 6 The description in the corresponding embodiments.

[0108] Step S103: Input the sorting number sequence and the data sequence to be sorted into the sorting circuit. In the sorting circuit, the data to be sorted in the data sequence to be sorted is reordered according to the sorting number sequence to obtain the sorted data sequence.

[0109] In this application, different numbering and sorting methods indicate different sorting rules for the data sequence to be sorted. The compression command in this application and the sorting command in the regular sorting command can indicate the same sorting rule. Therefore, the sorting rule indicated by the rearranged numbering and sorting method can be called the first sorting rule, and the sorting rule indicated by the compressed numbering and sorting method can be called the second sorting rule.

[0110] When the numbering and sorting preprocessing component is a rearrangement preprocessing component, and the sorting rule indicated by the rearrangement preprocessing component is the first sorting rule, the specific implementation of re-sorting the unsorted data in the unsorted data sequence according to the sorting number sequence in the sorting circuit to obtain the sorted data sequence can be as follows: In the sorting circuit, the first data source number can be obtained in the sorting number sequence according to the first sorting rule. Subsequently, the number position of the first data source number in the sorting number sequence can be determined as the first number position. Subsequently, the unsorted data in the unsorted data sequence whose data source number is the first data source number can be determined as the sorted data at the first number position. The unsorted data in the unsorted data sequence whose data source number is the remaining data source number can be determined as the sorted data at the second remaining number position in the sorting number sequence. Here, the remaining data source number refers to the data source number other than the first data source number in the sorting number sequence; the second remaining number position refers to the number position of the remaining data source number in the sorting number sequence. According to the positional arrangement order between the first number position and the second remaining number position, the sorted data at the first number position and the sorted data at the second remaining number position can be arranged to obtain the sorted data sequence.

[0111] To facilitate understanding, the following example illustrates this. Assume the sorting sequence is {2, 4, 3, 1, 0}, and the data sequence to be sorted is {value3, value2, value1, value0, value4}. In the sorting sequence, the first data source is numbered 2, and its position in the sequence is called the 0th position. In the data sequence to be sorted, the data to be sorted with data source number 2 is value2. Therefore, value2 can be used as the sorting data at the 0th position. Similarly, for the remaining data source numbers in the sorting sequence and their corresponding remaining positions (here, for clarity, we will call them the second remaining positions), the sorting data at each position can be determined. For example, with remaining data source number 4, its position in the sequence is called the 1st position. In the data sequence to be sorted, the data to be sorted with data source number 4 is value4. Therefore, value4 can be used as the sorting data at the 1st position. After determining the sorted data at each position in the sorted number sequence, the sorted data at each position can be sorted according to the positional order between these positions (that is, the positional order between the first and second remaining positions, i.e., the sequence positional order corresponding to the sorted number order). This yields the sorted data sequence. For example, using the above method, the sorted data at position 0 is determined to be value2, position 1 to be value4, position 2 to be value3, position 3 to be value1, and position 4 to be value0. The positional order of these positions is {position 0, position 1, position 2, position 3, position 4}. Therefore, sorting the data at each position according to this order results in the sorted data sequence {value2, value4, value3, value1, value0}. Assume the sorting sequence is {2, 4, 3, 1, 0}, and the data sequence to be sorted is {value3, value2, value1, value0, value4}.

[0112] Optionally, when the numbering and sorting preprocessing component is a rearrangement preprocessing component, and the sorting rule indicated by the rearrangement preprocessing component is the first sorting rule, the specific implementation of re-sorting the unsorted data in the unsorted data sequence according to the sorting number sequence in the sorting circuit to obtain the sorted data sequence can also be as follows: the first data source number can be obtained in the sorting number sequence according to the first sorting rule; then, the number position of the first data source number in the sorting number sequence can be determined as the first number position; subsequently, the unsorted data in the unsorted data sequence whose data position is the target data position can be determined as the sorted data at the first number position (its... In the process, the target data position value is the same as the first data source number; the data to be sorted in the unsorted data sequence whose data position is the remaining data position is determined as the sorted data at the second remaining number position in the sorting number sequence; where the remaining data source number refers to the data source number other than the first data source number in the sorting number sequence; the second remaining number position refers to the number position of the remaining data source number in the sorting number sequence; according to the positional order between the first number position and the second remaining number position, the sorted data at the first number position and the sorted data at the second remaining number position can be arranged to obtain the sorted data sequence.

[0113] For example, suppose the sorting sequence is {2, 4, 3, 1, 0}, and the data sequence to be sorted is {value3, value2, value1, value0, value4}. In the sorting sequence, the first data source is numbered 2, and its position in the sequence (called the number position) is position 0. The data to be sorted in the data sequence is value1, which is located at position 2. Therefore, value1 can be considered the sorted data at position 0 in the sorting sequence. Similarly, for the remaining data source numbers in the sorting sequence and their corresponding remaining number positions (here, for clarity, we will call them the second remaining number positions), the sorted data at those positions can also be determined. Thus, the sorted data at each number position in the sorted data sequence can also be obtained.

[0114] When the number sorting preprocessing component is either a compression preprocessing component or a regular sorting preprocessing component, and both the compression preprocessing component and the regular sorting preprocessing component indicate the second sorting rule, the sorted number sequence contains the data source number K. i Taking (i is a positive integer) as an example, the specific implementation of reordering the unsorted data in the unsorted data sequence according to the sorting number sequence in the sorting circuit to obtain the sorted data sequence can be as follows: In the sorting circuit, according to the second sorting rule, the data sequence unsorted can be obtained from the data sequence, which is related to the data source number K.i The data to be sorted has a sequence position mapping relationship; subsequently, it can be correlated with the data source number K. i The data to be sorted, which has a sequence position mapping relationship, is identified as data source number K. i The corresponding mapping sort data; when the mapping sort data corresponding to each data source number in the sorting number sequence is determined, the mapping sort data corresponding to each data source number can be sorted according to the arrangement order of the sorting number sequence (i.e., the arrangement order of each data source number in the sorting number sequence) to obtain the sorting data sequence.

[0115] To facilitate understanding, the following example illustrates this. When the numbering and sorting preprocessing component is a compression preprocessing component, taking the initial numbering sequence as {3, 1, 2, 4, 0} and the data sequence to be sorted as {value3, value2, value1, value0, value4} as an example, it can be seen that there is a sequence position mapping relationship between data source number 3 and the data to be sorted, value3; between data source number 1 and the data to be sorted, value2; between data source number 2 and the data to be sorted, value1; between data source number 4 and the data to be sorted, value0; and between data source number 0 and the data to be sorted, value4. Assuming the reordered sequence of numbers is {2, 4, 3, 1, 0}, then for data source number 2, according to the second sorting rule, the data to be sorted that has a sequence position mapping relationship with data source number 2 can be obtained as value1 in the unsorted data sequence. Therefore, the unsorted data value1 can be determined as the mapped sorted data corresponding to data source number 2. Similarly, for other data source numbers, the unsorted data that has a sequence position mapping relationship with them can also be determined, thus obtaining the mapped sorted data corresponding to that data source number. For example, for data source number 4, the unsorted data that has a sequence position mapping relationship with it in the unsorted data sequence is value0, so the unsorted data value0 can be determined as the mapped sorted data corresponding to data source number 4. Using the above method, we can determine that the mapped sorted data for data source number 3 is value3, the mapped sorted data for data source number 1 is value2, and the mapped sorted data for data source number 0 is value4. Then, we can sort these mapped sorted data according to the sorted number sequence {2, 4, 3, 1, 0} to obtain the sorted data sequence {value1, value0, value2, value3, value4}.

[0116] When the numbering and sorting preprocessing component is a regular sorting preprocessing component, taking the initial numbering sequence as {3, 1, 2, 4, 0} and the data sequence to be sorted as {value3, value2, value1, value0, value4} as an example, it can be seen that there is a sequence position mapping relationship between data source number 3 and the data to be sorted, value3; between data source number 1 and the data to be sorted, value2; between data source number 2 and the data to be sorted, value1; between data source number 4 and the data to be sorted, value0; and between data source number 0 and the data to be sorted, value4. Assuming that the sorted numbering sequence obtained after re-sorting the initial numbering sequence is {4, 3, 2, 1, 0}, the data sequence to be sorted can also be re-sorted based on the sequence position mapping relationship between the initial numbering sequence and the data sequence to be sorted, resulting in a sorted data sequence of {value0, value3, value1, value2, value4}. The specific sorting process will not be elaborated here.

[0117] Optionally, and understandably, the numbering and sorting preprocessing component can simultaneously include a rearrangement preprocessing component, a compression preprocessing component, and a regular sorting preprocessing component (the sorting number sequence can include a first sorting number sequence, a second sorting number sequence, and a third sorting number sequence). When a data sorting request for the data sequence to be sorted is received, these three components can be invoked simultaneously. The rearrangement preprocessing component can rearrange the initial number sequence to obtain the first sorting number sequence; the compression preprocessing component can compress and rearrange the initial number sequence to obtain the second sorting number sequence; and the regular sorting preprocessing component can perform regular sorting (such as sorting by size) on the initial number sequence to obtain the third sorting number sequence. Subsequently, the scenario business requirements can be obtained, and based on these requirements, a selection can be made from the first, second, and third sorting number sequences to choose a specific sequence as the target sorting number sequence. This target sorting number sequence can be input into the sorting circuit along with the data sequence to be sorted, and the sorting circuit will re-sort the data sequence to be sorted according to the target sorting number sequence to obtain the sorted data sequence. The business requirements in this application can be sorting requirements for specific business scenarios, including rearrangement requirements, compression requirements, and regular sorting requirements. These can vary depending on the specific business scenario. For clarity, please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a schematic diagram of the structure of an output sorted data sequence provided in an embodiment of this application.

[0118] like Figure 3As shown, before the original sorting circuit, there can be a rearrangement preprocessing component, a compression preprocessing component, and a regular sorting preprocessing component. After receiving a data sorting request for the data sequence to be sorted, the rearrangement preprocessing component can rearrange the initial number sequence to obtain a first sorted number sequence; the compression preprocessing component can compress and sort the initial number sequence to obtain a second sorted number sequence; and the regular sorting preprocessing component can perform regular sorting on the initial number sequence to obtain a third sorted number sequence. Subsequently, the first, second, and third sorted number sequences can be input together to a sequence selection module. In this module, one of the three sorted number sequences can be selected to determine the target sorted number sequence. Finally, the target sorted number sequence can be input together with the data sequence to be sorted into the sorting circuit. The sorting circuit can sort the data sequence to be sorted according to the target sorted number sequence and output the sorted data sequence. It should be noted that each sequence in this application can be regarded as a vector, and each value contained in each sequence can be regarded as a vector within a vector.

[0119] In this application embodiment, for sorting services such as rearrangement and compression, the original sorting circuit in the chip can be reused. This application can add a number sorting preprocessing component (such as a rearrangement preprocessing component and a compression preprocessing component) before the sorting circuit in the chip. Then, when a data sorting request for a data sequence to be sorted is received, the number sorting preprocessing component can be called in advance. The number sorting preprocessing component only processes the data source number of the data sequence to be sorted. After obtaining the sorting number sequence corresponding to the data sequence to be sorted, the sorting number sequence and the data sequence to be sorted are input into the sorting circuit. The sorting circuit sorts the data sequence to be sorted according to the arrangement order of the sorting number sequence to obtain the sorted data sequence. It should be understood that adding a number sorting preprocessing component (such as a rearrangement preprocessing component and a compression preprocessing component) to the chip only processes the data source number of the data sequence to be sorted to obtain the sorted number sequence. This eliminates the need for separate deployment of additional rearrangement or compression circuits, allowing reuse of existing sorting circuits, significantly reducing chip area consumption and resource consumption. Furthermore, since the entire number sorting process is handled by hardware, there is no need for lengthy software parameter configuration, reducing sorting time and improving sorting efficiency. In summary, this application can reduce chip resource consumption in sorting operations while improving sorting efficiency.

[0120] Further, please see Figure 4 , Figure 4 This is a flowchart illustrating a numbering and sorting process provided in an embodiment of this application. This process can correspond to the above. Figure 2In the corresponding embodiment, when the number sorting preprocessing component is a rearrangement preprocessing component, the specific process for reordering the initial number sequence to obtain the sorted number sequence is as follows: Figure 4 The process shown assumes that each data source number in the initial numbering sequence is encoded in the initial encoding format (such as binary format), and that the initial numbering sequence contains the data source number K. i Let's take (i is a positive integer) as an example for illustration. Figure 4 As shown, the process may include at least the following steps S401-S402:

[0121] Step S401: Input the initial number sequence into the rearrangement preprocessing component, and use the rearrangement preprocessing component to process the data source number K. i The encoding format is converted from the initial encoding format to the standard encoding format to obtain the data source number K. i The corresponding standard source number.

[0122] Specifically, the initial encoding format in this application can refer to the encoding format of each data source number in the initial numbering sequence when a sorting data request is obtained. Typically, the initial encoding format of each data source number is binary when a sorting data request is obtained. The standard encoding format can be a one-hot code. Conversion between binary and one-hot code is possible. For example, binary and one-hot code can be converted using decimal form (an intermediate conversion method). For instance, to convert from binary to one-hot code, the binary form can first be converted to decimal, and then from decimal to one-hot code. For ease of understanding, an example will be given below. For instance, suppose a data source number is 110 (binary form), and the corresponding decimal value is 6. The one-hot code corresponding to this value 6 can be determined based on the total number of data source numbers included in the initial numbering sequence. Assuming the initial numbering sequence contains a total of 8 data source numbers, the one-hot code corresponding to the value 6 can have a total of 8 bits. The 6th position can be a value of 1, and the remaining positions can be 0. That is, the one-hot code corresponding to the value 6 can be 0100000 (the 0th to 5th positions and the 7th position are all 0). If the one-hot code is the standard encoding form for each data source number, then this application can refer to the one-hot code corresponding to each data source number as the standard source number.

[0123] It should be noted that the initial encoding form and standard encoding form in this application are not limited to binary form and one-hot code form.

[0124] Step S402: When the standard source number corresponding to each data source number in the initial number sequence is obtained, the initial number sequence is reordered according to the number arrangement order of the initial number sequence and the standard source number corresponding to each data source number to obtain the sorted number sequence.

[0125] Specifically, as described above, when the standard encoding form is a one-hot code, the total number of bits in the one-hot code of each data source number can be determined by the number of data source numbers included in the initial numbering sequence. That is, the standard source number of each data source number can be composed of N characters (N being the same as the number of data source numbers included in the initial numbering sequence) (characters can specifically refer to the values ​​0 and 1). In this case, the specific implementation method for reordering the initial numbering sequence according to the numbering order of the initial numbering sequence and the standard source number corresponding to each data source number to obtain the sorted numbering sequence can be as follows: the data source number K... i The position of the number in the initial numbering sequence is determined as the target numbering position; subsequently, the data source number K can be... i In the corresponding standard source number, the character at the target number position is determined as the first position character; the character at the target number position in the standard source number corresponding to the remaining data source numbers is determined as the second position character; wherein, the remaining data source numbers are those in the initial number sequence excluding data source number K. i Other than the data source number; according to the numbering order of the initial numbering sequence, the first position character and the second position character can be sorted to obtain the position character sequence corresponding to the target number position; wherein, the position character sequence corresponding to the target number position is the same as one of the N standard source numbers; when the position character sequences corresponding to the N number positions in the initial numbering sequence are determined, the sorted number sequence can be determined according to the position character sequences corresponding to the N number positions and the numbering order of the initial numbering sequence; wherein, the N position character sequences are the same as the N standard source numbers, and the position character sequence corresponding to one number position is the same as one of the N standard source numbers.

[0126] Specifically, the implementation method for determining the sorted number sequence based on the position character sequences corresponding to N number positions and the number arrangement order of the initial number sequence can be as follows: A reordering preprocessing component can convert the encoding form of the position character sequence corresponding to the target number position from the standard encoding form to the initial encoding form, obtaining the reordering transformation number corresponding to the target number position; subsequently, the data source number K at the target number position in the initial number sequence can be... iReplace the target number position with the reordering transformation number corresponding to the target number position; replace the data source number at the first remaining number position in the initial number sequence with the reordering transformation number corresponding to the remaining number position; where the first remaining number position refers to the number position other than the target number position among the N number positions corresponding to the initial number sequence; subsequently, the N reordering transformation numbers can be arranged according to the positional order among the N number positions to obtain the sorted number sequence.

[0127] To facilitate understanding, examples will be provided below. Taking the initial numbering sequence {2, 1, 3, 4, 5} as an example (the encoding of each data source number in this initial numbering sequence is in decimal form), and taking the standard source number as a one-hot code as an example, the standard source number of data source number 2 can be 00010, the standard source number of data source number 1 can be 00001, the standard source number of data source number 3 can be 00100, the standard source number of data source number 4 can be 01000, and the standard source number of data source number 5 can be 10000. For data source number 2, its position in the initial numbering sequence is the first numbering position, which can be called the target numbering position. The character (value 0) in the first numbering position of the standard source number 00010 for data source number 2 can be identified as the first position character. Similarly, for the remaining data source numbers in the initial numbering sequence (including data source number 1, data source number 3, data source number 4, and data source number 5), the characters in the first numbering position can be obtained from their respective standard source numbers; these characters can be called the second position characters. For example, in the standard source number 00001 of data source number 1, the character in the first numbering position is 1; in the standard source number 00003 of data source number 3, the character in the first numbering position is 0; in the standard source number 00001 of data source number 4, the character in the first numbering position is 0; and in the standard source number 00001 of data source number 5, the character in the first numbering position is 0. Following the initial numbering sequence, sorting the characters at the first and second positions yields a sequence of 01000. Converting this sequence to decimal gives the value 4, which can be used as the reordering conversion number for the first position. This process is repeated for the second through fifth positions in the initial numbering sequence. For example, the reordering conversion number for the second position could be 5; for the third position, 3; for the fourth position, 2; and for the fifth position, 1. Therefore, the final sorted numbering sequence can be {4, 5, 3, 2, 1}.It should be noted that due to the special nature of one-hot codes (each one-hot code has a value of 1 only at the corresponding position, and all other positions are 0), after taking the values ​​at the same positions in each one-hot code to form a new one-hot code, the new one-hot code is actually one of the original one-hot codes (that is, the position character sequence corresponding to a certain number position is the same as one of the N standard source numbers). Therefore, after determining the position character sequence corresponding to each number position, the N position character sequences are actually the same as the aforementioned N standard source numbers. The process of determining the position character sequence at each number position is actually a process of reordering the initial number sequence.

[0128] To better understand the specific method of sorting numbers using one-hot codes, please also refer to... Figure 5 , Figure 5 This is a schematic diagram illustrating a method for determining a sorted number sequence based on a one-hot code, as provided in an embodiment of this application. For example... Figure 5 As shown, the initial numbering sequence is {6, 4, 0, 7, 5, 3, 1, 2} (encoded in decimal form). Taking position 0 as an example, the numbering positions of data source number 6 to data source number 2 are respectively position 0 (position 0) to position 7 (position 7). Figure 5As shown, after converting the data source numbers stored at each position into one-hot codes, we can obtain the following one-hot codes: Data source number 6 (i.e., the standard source number at position 0) is 01000000, data source number 4 (i.e., the standard source number at position 1) is 00010000, data source number 0 (i.e., the standard source number at position 2) is 00000001, data source number 7 (i.e., the standard source number at position 3) is 10000000, data source number 5 (i.e., the standard source number at position 4) is 00100000, data source number 3 (i.e., the standard source number at position 5) is 00001000, data source number 1 (i.e., the standard source number at position 6) is 00000010, and data source number 2 (i.e., the standard source number at position 7) is 10000000. Subsequently, for a given position, we can sequentially retrieve the characters at the corresponding positions from each standard source number to form the position character sequence (the new one-hot code). For example, for position 0, the character at position 0 can be obtained sequentially from the various standard source numbers. This character is 00100000, and its one-hot code is 5 in decimal. Therefore, the reordering conversion number at position 0 is 5. Similarly, the reordering conversion number at position 1 is 1, at position 2 is 0, at position 3 is 2, at position 4 is 6, at position 5 is 3, at position 6 is 7, and at position 7 is 4. So, after arranging the characters in order from position 0 to position 7, the resulting sorted number sequence is {5, 1, 0, 2, 6, 3, 7, 4}.

[0129] Optionally, and understandably, for the minimum position in the initial numbering sequence, when determining its corresponding positional character sequence, it can be determined based on the character at the maximum position in each standard source number; and for the remaining position in the initial numbering sequence excluding the minimum position (here referred to as the third remaining position), the minimum position can be obtained from the third remaining position, and when determining the positional character sequence corresponding to this position, it can be determined based on the character at the maximum position in the fourth remaining position (the position in the standard source number excluding the aforementioned maximum position). In other words, for the above... Figure 5 For position 0 in the corresponding embodiment, the characters in the 7th position of the standard source number can be obtained sequentially as 0, 0, 0, 1, 0, 0, 0, 0. Therefore, the new one-hot code corresponding to position 0 can be 00010000, and the reordering conversion number can be 4. For the above... Figure 5For position 1 in the corresponding embodiment, the characters in the 6th position of the standard source number can be obtained sequentially as 1, 0, 0, 0, 0, 0, 0, 0. Then, the new one-hot code corresponding to position 0 can be 10000000, and the reordering conversion number can be 7. According to the position arrangement order of positions 0 to 7, the reordering conversion numbers at each position can be reordered to obtain the sorted number sequence.

[0130] In this embodiment, for tasks such as rearrangement, the existing sorting circuit in the chip can be reused. This application adds a rearrangement preprocessing component before the sorting circuit in the chip. When a data sorting request for a data sequence to be sorted is received, the rearrangement preprocessing component can be called in advance. This numbered sorting preprocessing component only processes the data source number of the data sequence to be sorted. After obtaining the sorting number sequence corresponding to the data sequence to be sorted, the sorting number sequence and the data sequence to be sorted are input into the sorting circuit. The sorting circuit then sorts the data sequence according to the order of the sorting number sequence to obtain the sorted data sequence. It should be understood that adding a numbered rearrangement preprocessing component to the chip, which only processes the data source number of the data sequence to be sorted to obtain the sorting number sequence, eliminates the need for a separate additional rearrangement circuit, allowing reuse of the existing sorting circuit. This significantly reduces chip area consumption and resource consumption. Furthermore, since the entire numbering and sorting process is handled by hardware, there is no need to spend a long time configuring software parameters, reducing sorting time and improving sorting efficiency. In summary, this application can reduce chip resource consumption in sorting tasks while improving sorting efficiency.

[0131] Further, please see Figure 6 , Figure 6 This is a flowchart illustrating a numbering and sorting process provided in an embodiment of this application. This process can correspond to the above. Figure 2 In the corresponding embodiment, when the number sorting preprocessing component is a compression preprocessing component, the specific process for reordering the initial number sequence to obtain the sorted number sequence is as follows: Figure 6 The process shown is based on the initial numbering sequence containing N data source numbers, where the N data source numbers include data source number K. i Let's take (i is a positive integer) as an example for illustration. Figure 6 As shown, the process may include at least the following steps S601-S604:

[0132] Step S601, assign data source number K i The position of the number in the initial numbering sequence is determined as the target numbering position.

[0133] Specifically, you can obtain the data source ID K. i The position of a number in the initial numbering sequence can be determined as the target numbering position.

[0134] Step S602: In the data sequence to be sorted, select the data with the data source number K. i Data that has a sequence position mapping relationship is identified as target data to be sorted.

[0135] Specifically, the sequence of data to be sorted can be used to obtain the data source number K. i The unsorted data has a sequence position mapping relationship, that is, in the unsorted data sequence, the data that corresponds to the data source number K. i Data to be sorted that are in the same position. This data to be sorted can be called the target data to be sorted.

[0136] Step S603: Obtain the Boolean value corresponding to the target data to be sorted, and invert the Boolean value corresponding to the target data to be sorted to obtain the inverted Boolean value corresponding to the target number position in the initial numbering sequence.

[0137] Specifically, the data sorting request mentioned above can also carry a Boolean value corresponding to each piece of data to be sorted. This Boolean value can contain the values ​​1 and 0, and these values ​​have a value attribute. If the Boolean value is 1, then the data to be sorted is valid data; if the Boolean value is 0, then the data to be sorted is invalid data. In this application, since the valid data needs to be compressed sequentially to the beginning of the output vector and the invalid data needs to be placed at the end of the output vector (i.e., valid data is placed before invalid data) when executing the compression instruction, this application can invert the Boolean value of each piece of data to be sorted. The Boolean value of the valid data to be sorted will change from the value 1 to the value 0. During data compression, the valid data to be sorted with a Boolean value of 0 will be placed at the beginning; similarly, the Boolean value of the invalid data to be sorted will change from the value 0 to the value 1. During data compression, the invalid data to be sorted with a Boolean value of 1 will be placed at the beginning. This achieves the data compression instruction. For the target data to be sorted, the Boolean value corresponding to the target data to be sorted will also be inverted to obtain the inverted Boolean value corresponding to the target number position in the initial numbering sequence.

[0138] Step S604: When the reverse Boolean values ​​corresponding to the N number positions of the initial number sequence are determined, the initial number sequence is reordered according to the reverse Boolean values ​​corresponding to the N number positions to obtain the sorted number sequence.

[0139] Specifically, the method for reordering the initial number sequence based on the reversed Boolean values ​​corresponding to the N number positions to obtain the sorted number sequence can be as follows: M reversed Boolean values ​​with valid value attributes are identified as valid Boolean values ​​(M is a positive integer); Q reversed Boolean values ​​with invalid value attributes are identified as invalid Boolean values; the initial number sequence is reordered based on the N number positions, the M valid Boolean values, and the Q invalid Boolean values ​​to obtain the sorted number sequence.

[0140] The specific implementation of reordering the initial number sequence based on N number positions, M valid Boolean values, and Q invalid Boolean values ​​to obtain a sorted number sequence can be as follows: The number positions corresponding to the M valid Boolean values ​​among the N number positions can be determined as valid number positions, and the number positions corresponding to the Q invalid Boolean values ​​among the N number positions can be determined as invalid number positions. The M valid Boolean values ​​can be sorted according to their positional order to obtain the first Boolean value sequence. The Q invalid Boolean values ​​can be sorted according to their positional order to obtain the second Boolean value sequence. Subsequently, the attribute order between valid and invalid attributes can be obtained, and the first and second Boolean value sequences can be sorted according to this attribute order to obtain the target Boolean value sequence. Based on the target Boolean value sequence, the initial number sequence can be reordered to obtain the sorted number sequence.

[0141] Among them, the target Boolean value sequence includes the inverted Boolean value H. j Taking (j is a positive integer) as an example, the specific implementation of reordering the initial numbering sequence based on the target Boolean value sequence to obtain the sorted numbering sequence can be as follows: the reverse Boolean value H can be used as an example. j The position of the value in the target Boolean value sequence is determined as the position to be filled; the reversed Boolean value H can be selected from the N numbered positions in the initial numbering sequence. j The corresponding number position is determined as the position to be extracted; then, the data source number at the position to be extracted in the initial number sequence can be determined as the sort number at the position to be filled; when the sort number at each of the N value positions in the target Boolean value sequence is determined, the sort numbers at each value position are arranged according to the positional order among the N value positions to obtain the sort number sequence.

[0142] To facilitate understanding, the following example will be used. Taking the initial number sequence as {3, 1, 2, 4, 0} and the data sequence to be sorted as {value3, value2, value1, value0, value4} as an example, it can be seen that there is a sequence position mapping relationship between data source number 3 and the data to be sorted, value3; between data source number 1 and the data to be sorted, value2; between data source number 2 and the data to be sorted, value1; between data source number 4 and the data to be sorted, value0; and between data source number 0 and the data to be sorted, value4. Assuming the boolean value of the data to be sorted, value3, is 1, then after inverting, the reverse boolean value at the first index position is 0. Similarly, if the boolean value of the data to be sorted, value2, is 0, then after inverting, the reverse boolean value at the second index position is 1. If the boolean value of the data to be sorted, value1, is 1, then after inverting, the reverse boolean value at the third index position is 0. If the boolean value of the data to be sorted, value0, is 0, then after inverting, the reverse boolean value at the fourth index position is 1. If the boolean value of the data to be sorted, value4, is 1, then after inverting, the reverse boolean value at the fifth index position is 0.

[0143] Furthermore, in the reversed Boolean values, those with valid attributes are identified as valid Boolean values, specifically the reversed Boolean values ​​at the 2nd and 4th positions; the reversed Boolean values ​​at the remaining three positions are invalid. After sorting the valid Boolean values ​​according to the positional sequence between the 2nd and 4th positions in the initial numbering sequence, the resulting first Boolean value sequence is {reversed Boolean value 1 at the 2nd position, reversed Boolean value 1 at the 4th position}. Similarly, after sorting the invalid Boolean values ​​according to the positional sequence between the 1st, 3rd, and 5th positions in the initial numbering sequence, the resulting first Boolean value sequence is {reversed Boolean value 0 at the 1st position, reversed Boolean value 0 at the 3rd position, ..., reversed Boolean value 0 at the 5th position}. Assuming the attribute order between valid and invalid attributes is that invalid attributes precede valid attributes, then after sorting the first Boolean value sequence and the second Boolean value sequence according to the attribute order, the target Boolean value sequence can be obtained as {reverse Boolean value 0 at the 1st position, reverse Boolean value 0 at the 3rd position, reverse Boolean value 0 at the 5th position, reverse Boolean value 1 at the 2nd position, and reverse Boolean value 1 at the 4th position}. Furthermore, the data source number at each number position can be obtained. According to the target Boolean value sequence, the initial number sequence can be reordered. For example, if the reversed Boolean value 0 at the first number position is located at the first value position in the target Boolean value sequence, then the data source number 3 at the first number position in the initial number sequence can be placed at the first position. If the reversed Boolean value 0 at the third number position is located at the second value position in the target Boolean value sequence, then the data source number 2 at the third number position in the initial number sequence can be placed at the second value position. Thus, the sorted number at each value position can be obtained, resulting in a sorted number sequence of {32014}.

[0144] It should be noted that the purpose of data compression instructions is to compress valid data and eliminate invalid data. As this application shows, invalid data has a reversed Boolean value sequence as its first Boolean value sequence. Therefore, when determining the first Boolean value sequence and sorting the initial numbering sequence based on it and the second Boolean value sequence, the portion of the numbering sequence corresponding to the first Boolean value sequence (such as the portion of the numbering sequence {1, 4} in the sorting numbering sequence {32014}) can be deleted, leaving the final sorting numbering sequence. When sorting using this sorting numbering sequence, the data to be sorted that has a sequence position mapping relationship corresponding to the aforementioned portion of the numbering sequence {1, 4} can be deleted beforehand, and then the remaining data to be sorted can be sorted according to the final sorting numbering sequence, thus sorting the valid data to be sorted and eliminating the invalid data to be sorted.

[0145] In this embodiment, for compression services, the existing sorting circuit in the chip can be reused. This application adds a compression preprocessing component before the sorting circuit in the chip. When a data sorting request for a data sequence to be sorted is received, the compression preprocessing component can be pre-called. This component only processes the data source number of the data sequence to be sorted. After obtaining the sorting number sequence corresponding to the data sequence to be sorted, the sorting number sequence and the data sequence to be sorted are input into the sorting circuit. The sorting circuit sorts the data sequence according to the order of the sorting number sequence to obtain the sorted data sequence. It should be understood that adding a compression preprocessing component to the chip, which only processes the data source number of the data sequence to be sorted to obtain the sorting number sequence, eliminates the need for a separate additional rearrangement circuit, allowing reuse of the existing sorting circuit. This significantly reduces chip area consumption and resource consumption. Furthermore, since the entire numbering and sorting process is handled by hardware, there is no need to spend a long time configuring software parameters, reducing sorting time and improving sorting efficiency. In summary, this application can reduce chip resource consumption in sorting services while improving sorting efficiency.

[0146] To better understand the specific processes of regular sorting, rearranging, and compression, as well as the differences between these operations, please refer to [link to relevant documentation]. Figures 7a-7c , Figure 7a This is a schematic diagram illustrating a conventional sorting method provided in an embodiment of this application; Figure 7b This is a schematic diagram of data rearrangement provided in an embodiment of this application; Figure 7c This is a schematic diagram of data compression provided in an embodiment of this application.

[0147] like Figure 7aAs shown, the initial number sequence can be {2, 1, 0, 3}, and the data sequence to be sorted can be {value3, value2, value1, value0}. During regular sorting, the initial number sequence can be rearranged in descending order to obtain the sorted number sequence {3, 2, 1, 0}. Then, when sorting the data to be sorted according to the sorted number sequence, the data to be sorted will follow the data source number with the sequence position mapping relationship and undergo position transformation, resulting in the sorted data sequence {value0, value3, value2, value1}.

[0148] like Figure 7b As shown, the initial numbering sequence can be {2, 1, 0, 3}, and the data sequence to be sorted can be {value3, value2, value1, value0}. After rearranging, the resulting sorted numbering sequence is {1, 2, 0, 3}. Based on this sorted numbering sequence, the positions of the data to be sorted can be transformed to obtain a sorted data sequence of {value2, value1, value3, value0}. Where the 0th element of the sorted numbering sequence is 1, then the sorted data at the 0th position in the sorted data sequence can be the 1st element of the data sequence to be sorted, i.e., value2; where the 1st element of the sorted numbering sequence is 2, then the sorted data at the 1st position in the sorted data sequence can be the 2nd element of the data sequence to be sorted, i.e., value1.

[0149] like Figure 7c As shown, the purpose of data compression instructions is to compress valid data from the input sequence to the beginning and discard invalid data. Taking the unsorted data sequence {D2, invalid data 1, D1, D0, invalid data 2} as an example, the boolean value of unsorted data D2 can be 1, the boolean value of invalid data 1 can be 0, the boolean value of D1 can be 1, the boolean value of D0 can be 1, and the boolean value of invalid data 2 can be 0. Here, 1 indicates valid data, and 0 indicates invalid data. During compression, invalid data needs to be discarded. Therefore, through compression, the sorted data sequence can be obtained as {D2, D1, D0}. The two invalid data items are discarded after compression.

[0150] Further, please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a data processing apparatus provided in an embodiment of this application. The data processing apparatus can be a computer program (including program code) running on a computer device; for example, the data processing apparatus is an application software. The data processing apparatus can be used to execute... Figure 3 The method shown. (As illustrated) Figure 8As shown, the data processing device 1 may include: a request acquisition module 11, a component invocation module 12, a number sorting module 13, a sequence input module 14, and a data sorting module 15.

[0151] The request acquisition module 11 is used to acquire a data sorting request for the data sequence to be sorted; the data sorting request carries the initial number sequence corresponding to the data sequence to be sorted; the initial number sequence is a sequence composed of the data source numbers of each data to be sorted in the data sequence to be sorted; a data to be sorted in the data sequence to be sorted has a sequence position mapping relationship with a data source number in the initial number sequence;

[0152] Component calling module 12 is used to call the number sorting preprocessing component according to the data sorting request; the number sorting preprocessing component and the sorting circuit are integrated into the chip.

[0153] The number sorting module 13 is used to reorder the initial number sequence in the number sorting preprocessing component to obtain a sorted number sequence;

[0154] The sequence input module 14 is used to input the sorting number sequence and the data sequence to be sorted into the sorting circuit;

[0155] The data sorting module 15 is used to reorder the unsorted data in the data sequence to be sorted according to the sorting number sequence in the sorting circuit to obtain the sorted data sequence.

[0156] The specific implementation methods of the request acquisition module 11, component invocation module 12, number sorting module 13, sequence input module 14, and data sorting module 15 can be found in the above description. Figure 2 The descriptions of steps S101-S103 in the corresponding embodiments will not be repeated here.

[0157] In one embodiment, the numbering preprocessing component includes a rearrangement preprocessing component; the encoding form of each data source number in the initial numbering sequence is the initial encoding form; the initial numbering sequence contains the data source number K. i where i is a positive integer;

[0158] The numbering and sorting module 13 may include a format conversion unit 131 and a reordering unit 132.

[0159] Formal conversion unit 131 is used to input the initial number sequence into the rearrangement preprocessing component, and the rearrangement preprocessing component converts the data source number K into a format that is then processed. i The encoding format is converted from the initial encoding format to the standard encoding format to obtain the data source number K. i Corresponding standard source number;

[0160] The reordering unit 132 is used to reorder the initial number sequence according to the numbering order of the initial number sequence and the standard source number corresponding to each data source number when the standard source number corresponding to each data source number in the initial number sequence is obtained, so as to obtain the sorted number sequence.

[0161] The specific implementation of the form conversion unit 131 and the reordering unit 132 can be found in the above description. Figure 4 The descriptions of steps S401-S402 in the corresponding embodiments will not be repeated here.

[0162] In one embodiment, each data source number corresponds to a standard source number consisting of N characters; N is the same as the number of data source numbers contained in the initial numbering sequence, and N is a positive integer;

[0163] The reordering unit 132 may include a character sequence determination subunit 1321 and a number sequence determination subunit 1322.

[0164] Character sequence determines subunit 1321, used to assign data source number K i The position of the number in the initial numbering sequence is determined as the target numbering position;

[0165] The character sequence determines subunit 1321 and is also used to assign data source number K. i In the corresponding standard source number, the character located at the target number position is determined as the first position character;

[0166] The character sequence determination subunit 1321 is also used to determine the character at the target number position in the standard source number corresponding to the remaining data source number as the second position character; the remaining data source number is the character in the initial number sequence excluding data source number K. i Other data source numbers;

[0167] The character sequence determination subunit 1321 is also used to sort the first position character and the second position character according to the numbering order of the initial numbering sequence to obtain the position character sequence corresponding to the target number position; the position character sequence corresponding to the target number position is the same as one of the N standard source numbers;

[0168] The numbering sequence determination subunit 1322 is used to determine the sorted numbering sequence based on the position character sequences corresponding to the N numbering positions in the initial numbering sequence and the numbering order of the initial numbering sequence when the position character sequences corresponding to the N numbering positions are determined respectively. The N position character sequences are the same as the N standard source numbers, and the position character sequence corresponding to one numbering position is the same as one of the standard source numbers in the N standard source numbers.

[0169] The specific implementation methods of the character sequence determination subunit 1321 and the number sequence determination subunit 1322 can be found in the above description. Figure 4 The description of step S402 in the corresponding embodiment will not be repeated here.

[0170] In one embodiment, the number sequence determining subunit 1322 is also specifically used to convert the encoding form of the position character sequence corresponding to the target number position from the standard encoding form to the initial encoding form through the rearrangement preprocessing component, so as to obtain the rearrangement conversion number corresponding to the target number position.

[0171] The numbering sequence determines subunit 1322, and is also specifically used to determine the data source number K at the target number position in the initial numbering sequence. i Replace with the reordering transformation number corresponding to the target number position;

[0172] The number sequence determination subunit 1322 is also specifically used to replace the data source number at the first remaining number position in the initial number sequence with the reordering transformation number corresponding to the remaining number position; the first remaining number position refers to the number position other than the target number position among the N number positions corresponding to the initial number sequence;

[0173] The numbering sequence determines subunit 1322, and is also specifically used to arrange the N reordered and transformed numbers according to the positional order between the N numbering positions to obtain the sorted numbering sequence.

[0174] In one embodiment, the number sorting preprocessing component includes a compression preprocessing component; the initial number sequence contains N data source numbers, and the N data source numbers contain data source number K. i where i is a positive integer;

[0175] The numbering and sorting module 13 may include: an inversion processing unit 133 and a sequence determination unit 134.

[0176] Inverting processing unit 133 is used to invert data source number K i The position of the number in the initial numbering sequence is determined as the target numbering position;

[0177] The inversion processing unit 133 is also used to compare the data sequence to be sorted with the data source number K. i Data to be sorted that has a sequence position mapping relationship is identified as target data to be sorted;

[0178] The inversion processing unit 133 is also used to obtain the Boolean value corresponding to the target data to be sorted, and to perform an inversion operation on the Boolean value corresponding to the target data to be sorted to obtain the inverted Boolean value corresponding to the target number position in the initial numbering sequence.

[0179] The sequence determination unit 134 is used to reorder the initial number sequence according to the reverse Boolean values ​​corresponding to the N number positions when the initial number sequence is determined, so as to obtain the sorted number sequence.

[0180] The specific implementation methods of the inversion processing unit 133 and the sequence determination unit 134 can be found in the above description. Figure 6 The descriptions of steps S601-S604 in the corresponding embodiments will not be repeated here.

[0181] In one embodiment, the sequence determination unit 134 may include: a valid value determination subunit 1341, an invalid value determination subunit 1342, and a sequence determination subunit 1343.

[0182] The valid value determination subunit 1341 is used to determine the M reversed Boolean values ​​with valid value attributes from among N reversed Boolean values ​​as valid Boolean values; M is a positive integer;

[0183] Invalid value determination subunit 1342 is used to determine Q inverted Boolean values ​​among N inverted Boolean values ​​whose value attribute is invalid as invalid Boolean values;

[0184] The sequence determination subunit 1343 is used to reorder the initial number sequence according to N number positions, M valid Boolean values ​​and Q invalid Boolean values ​​to obtain a sorted number sequence.

[0185] The specific implementation methods of the valid value determination subunit 1341, invalid value determination subunit 1342, and sequence determination subunit 1343 can be found in the above description. Figure 6 The description of step S604 in the corresponding embodiment will not be repeated here.

[0186] In one embodiment, the sequence determination subunit 1343 is further specifically used to determine the number positions corresponding to M valid Boolean values ​​from N number positions as valid number positions, and to determine the number positions corresponding to Q invalid Boolean values ​​from N number positions as invalid number positions.

[0187] The sequence determination subunit 1343 is also specifically used to sort the M valid Boolean values ​​according to the positional arrangement order between the M valid number positions to obtain the first Boolean value sequence;

[0188] The sequence determination subunit 1343 is also specifically used to sort the Q invalid Boolean values ​​according to the positional order between the Q invalid number positions to obtain the second Boolean value sequence;

[0189] The sequence determination subunit 1343 is also specifically used to obtain the attribute arrangement order between valid and invalid attributes, and sort the first Boolean value sequence and the second Boolean value sequence according to the attribute arrangement order to obtain the target Boolean value sequence;

[0190] The sequence determination subunit 1343 is also specifically used to reorder the initial numbering sequence according to the target Boolean value sequence to obtain the sorted numbering sequence.

[0191] In one embodiment, the target Boolean sequence includes the inverted Boolean value H. j j is a positive integer;

[0192] The sequence determines subunit 1343, and is also specifically used to reverse the Boolean value H. j The position of the value in the target Boolean value sequence is determined as the position to be filled.

[0193] The sequence determination subunit 1343 is also specifically used to reverse the Boolean value H in the N numbering positions of the initial numbering sequence. j The corresponding number position is determined as the position to be extracted;

[0194] The sequence determination subunit 1343 is also specifically used to determine the data source number at the position to be extracted in the initial number sequence as the sorting number at the position to be filled;

[0195] The sequence determination subunit 1343 is also specifically used to arrange the sorting numbers at each value position according to the positional order among the N value positions when the sorting number at each value position in the target Boolean value sequence is determined, so as to obtain the sorting number sequence.

[0196] In one embodiment, the number sorting preprocessing component includes a conventional sorting preprocessing component;

[0197] The numbering sorting module 13 may include: size sorting unit 135.

[0198] The size sorting unit 135 is used in the regular sorting preprocessing component to reorder the initial number sequence according to the size order between each data source number in the initial number sequence to obtain a sorted number sequence.

[0199] For the specific implementation of the size sorting unit 135, please refer to the above. Figure 3 The description of step S103 in the corresponding embodiment will not be repeated here.

[0200] In one embodiment, the number sorting preprocessing component is a rearrangement preprocessing component; the sorting rule indicated by the rearrangement preprocessing component is a first sorting rule.

[0201] The data sorting module 15 may include: a sorting data determination unit 151 and a sorting data arrangement unit 152.

[0202] The sorting data determination unit 151 is used to obtain the first data source number in the sorting number sequence according to the first sorting rule in the sorting circuit, and determine the number position of the first data source number in the sorting number sequence as the first number position.

[0203] The sorting data determination unit 151 is also used to determine the data to be sorted in the data sequence to be sorted, with the data source number being the first data source number, as the first number position, and obtain the sorted data at the first number position.

[0204] The sorting data determination unit 151 is further configured to determine the data to be sorted in the data sequence to be sorted, whose data source number is the remaining data source number, as the sorting data at the second remaining number position in the sorting number sequence; the remaining data source number refers to the data source number other than the first data source number in the sorting number sequence; the second remaining number position refers to the number position of the remaining data source number in the sorting number sequence.

[0205] The sorting data arrangement unit 152 is used to arrange the sorted data at the first number position and the sorted data at the second remaining number position according to the positional order between the first number position and the second remaining number position to obtain a sorted data sequence.

[0206] The specific implementation methods of the sorting data determination unit 151 and the sorting data arrangement unit 152 can be found in the above description. Figure 2 The description of step S103 in the corresponding embodiment will not be repeated here.

[0207] In one embodiment, the number sorting preprocessing component is either a compression preprocessing component or a regular sorting preprocessing component; the sorting rules indicated by both the compression preprocessing component and the regular sorting preprocessing component are second sorting rules; the sorted number sequence includes the data source number K. i where i is a positive integer;

[0208] The data sorting module 15 may include a mapping data determination unit 153 and a mapping data arrangement unit 154.

[0209] Mapping data determination unit 153 is used in the sorting circuit to obtain the mapping data corresponding to the data source number K in the data sequence to be sorted according to the second sorting rule. i Unsorted data with sequence position mapping relationships;

[0210] The mapping data determination unit 153 is also used to determine the mapping data with the data source number K. iThe data to be sorted, which has a sequence position mapping relationship, is identified as data source number K. i The corresponding mapping and sorting data;

[0211] The mapping data arrangement unit 154 is used to sort the mapping sort data corresponding to each data source number according to the arrangement order of the sorting number sequence when the mapping sort data corresponding to each data source number in the sorting number sequence is determined, so as to obtain the sorting data sequence.

[0212] The specific implementation methods of the mapping data determination unit 153 and the mapping data arrangement unit 154 can be found in the above description. Figure 2 The description of step S103 in the corresponding embodiment will not be repeated here.

[0213] It should be understood that adding a number sorting preprocessing component (such as a rearrangement preprocessing component and a compression preprocessing component) to the chip only processes the data source number of the data sequence to be sorted to obtain the sorted number sequence. This eliminates the need for separate deployment of additional rearrangement or compression circuits, allowing reuse of existing sorting circuits, significantly reducing chip area consumption and resource consumption. Furthermore, since the entire number sorting process is handled by hardware, there is no need for lengthy software parameter configuration, reducing sorting time and improving sorting efficiency. In summary, this application can reduce chip resource consumption in sorting operations while improving sorting efficiency.

[0214] Further, please see Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 9 As shown above, Figure 8 The data processing device 1 in the corresponding embodiment can be applied to the aforementioned computer device 8000. The computer device 8000 may include a processor 8001, a network interface 8004, and a memory 8005. Furthermore, the computer device 8000 also includes a user interface 8003 and at least one communication bus 8002. The communication bus 8002 is used to enable communication between these components. The user interface 8003 may include a display screen and a keyboard; optionally, the user interface 8003 may also include a standard wired interface or a wireless interface. The network interface 8004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 8005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 8005 may also be at least one storage device located remotely from the aforementioned processor 8001. Figure 9As shown, the memory 8005, which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.

[0215] exist Figure 9 In the computer device 8000 shown, the network interface 8004 provides network communication functionality; the user interface 8003 is mainly used to provide an input interface for the user; and the processor 8001 can be used to call the device control application program stored in the memory 8005 to achieve:

[0216] Obtain a data sorting request for the data sequence to be sorted; the data sorting request carries the initial number sequence corresponding to the data sequence to be sorted; the initial number sequence is a sequence composed of the data source numbers of each data to be sorted in the data sequence to be sorted; a data to be sorted in the data sequence to be sorted has a sequence position mapping relationship with a data source number in the initial number sequence;

[0217] The number sorting preprocessing component is invoked according to the data sorting request. In the number sorting preprocessing component, the initial number sequence is reordered to obtain the sorted number sequence. The number sorting preprocessing component and the sorting circuit are integrated into the chip.

[0218] The sorting number sequence and the data sequence to be sorted are input into the sorting circuit. The sorting circuit reorders the data in the data sequence to be sorted according to the sorting number sequence to obtain the sorted data sequence.

[0219] It should be understood that the computer device 8000 described in the embodiments of this application can execute the foregoing text. Figures 2 to 6 The description of the data processing method in the corresponding embodiment can also be performed as described above. Figure 8 The description of the data processing apparatus 1 in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated here.

[0220] Furthermore, it should be noted that this application embodiment also provides a computer-readable storage medium, which stores a computer program executed by the aforementioned data processing computer device 8000. The computer program includes program instructions, and when the processor executes the program instructions, it can execute the aforementioned... Figures 3 to 6 The description of the data processing method in the corresponding embodiments is already provided and will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer-readable storage medium embodiments related to this application, please refer to the description of the method embodiments of this application.

[0221] The aforementioned computer-readable storage medium can be an internal storage unit of the data processing apparatus or computer device provided in any of the foregoing embodiments, such as a hard disk or memory of the computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device. Furthermore, the computer-readable storage medium can include both internal and external storage units of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.

[0222] One aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in one aspect of the embodiments of this application.

[0223] The terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.

[0224] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0225] The methods and related apparatuses provided in this application are described with reference to the method flowcharts and / or structural diagrams provided in this application. Specifically, each block of the method flowchart and / or structural diagram, as well as combinations of blocks in the flowchart and / or block diagram, 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 device to create a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the process. Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The 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 operate 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 A schematic diagram of one or more processes and / or structures. Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 A process or multiple processes and / or structures illustrate the steps of the functions specified in one or more boxes.

[0226] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A data processing method, characterized in that, include: Obtain a data sorting request for the data sequence to be sorted; the data sorting request carries the initial number sequence corresponding to the data sequence to be sorted. The initial number sequence is a sequence composed of the data source numbers of each data to be sorted in the data to be sorted sequence; a data to be sorted in the data to be sorted sequence has a sequence position mapping relationship with a data source number in the initial number sequence; The number sorting preprocessing component is invoked according to the data sorting request. In this component, the initial number sequence is reordered to obtain a sorted number sequence. The number sorting preprocessing component and the sorting circuit are integrated into the chip. The number sorting preprocessing component includes a compression preprocessing component. The initial number sequence contains N data source numbers, and the N data source numbers include data source number K. i Where i is a positive integer; the step of reordering the initial number sequence in the number sorting preprocessing component to obtain a sorted number sequence includes: reordering the data source number K i The position of the data in the initial numbering sequence is determined as the target numbering position; the data in the unsorted data sequence is compared with the data source number K. i Data to be sorted that has a sequence position mapping relationship is identified as target data to be sorted; the Boolean value corresponding to the target data to be sorted is obtained, and the Boolean value corresponding to the target data to be sorted is inverted to obtain the reversed Boolean value corresponding to the target number position in the initial numbering sequence; when the reversed Boolean values ​​corresponding to the N number positions of the initial numbering sequence are determined, the initial numbering sequence is reordered according to the reversed Boolean values ​​corresponding to the N number positions to obtain the sorted numbering sequence; The sorting number sequence and the data sequence to be sorted are input into the sorting circuit. In the sorting circuit, the data to be sorted in the data sequence to be sorted is reordered according to the sorting number sequence to obtain the sorted data sequence.

2. The method according to claim 1, characterized in that, The numbering sorting preprocessing component includes a rearrangement preprocessing component; the encoding format of each data source number in the initial numbering sequence is the initial encoding format; the initial numbering sequence contains the data source number K. i where i is a positive integer; The step of reordering the initial number sequence in the number sorting preprocessing component to obtain a sorted number sequence includes: The initial number sequence is input into the rearrangement preprocessing component, which then processes the data source number K. i The encoding format is converted from the initial encoding format to the standard encoding format to obtain the data source number K. i Corresponding standard source number; When the standard source number corresponding to each data source number in the initial number sequence is obtained, the initial number sequence is reordered according to the number arrangement order of the initial number sequence and the standard source number corresponding to each data source number to obtain the sorted number sequence.

3. The method according to claim 2, characterized in that, Each data source number corresponds to a standard source number consisting of N characters; N is the same as the number of data source numbers contained in the initial number sequence, and N is a positive integer; The step of reordering the initial number sequence according to the numbering order of the initial number sequence and the standard source number corresponding to each data source number to obtain a sorted number sequence includes: Number the data source K i The position of the number in the initial numbering sequence is determined as the target numbering position; Number the data source K i In the corresponding standard source number, the character located at the target number position is determined as the first position character; The character in the standard source number corresponding to the remaining data source number, located at the target number position, is determined as the second position character; the remaining data source number is the character in the initial number sequence excluding the data source number K. i Other data source numbers; According to the numbering order of the initial numbering sequence, the first position character and the second position character are sorted to obtain the position character sequence corresponding to the target number position; the position character sequence corresponding to the target number position is the same as one of the N standard source numbers; When the position character sequences corresponding to the N number positions in the initial number sequence are determined, the sorted number sequence is determined according to the position character sequences corresponding to the N number positions and the number arrangement order of the initial number sequence; the N position character sequences are the same as the N standard source numbers, and the position character sequence corresponding to one number position is the same as one of the standard source numbers in the N standard source numbers.

4. The method according to claim 3, characterized in that, The step of determining the sorted number sequence based on the position character sequences corresponding to the N number positions and the number arrangement order of the initial number sequence includes: The rearrangement preprocessing component converts the encoding form of the position character sequence corresponding to the target number position from the standard encoding form to the initial encoding form to obtain the rearrangement conversion number corresponding to the target number position. The data source number K at the target number position in the initial numbering sequence. i Replace it with the reordering transformation number corresponding to the target number position; Replace the data source number at the first remaining number position in the initial number sequence with the reordering transformation number corresponding to the remaining number position; the first remaining number position refers to the number position other than the target number position among the N number positions corresponding to the initial number sequence. Arrange the N reordered transformation numbers according to the positional order of the N number positions to obtain the sorted number sequence.

5. The method according to claim 1, characterized in that, The step of reordering the initial number sequence according to the reverse Boolean values ​​corresponding to the N number positions to obtain the sorted number sequence includes: Among N reversed Boolean values, the M reversed Boolean values ​​whose value attribute is a valid attribute are determined as valid Boolean values; M is a positive integer. Among N inverted Boolean values, Q inverted Boolean values ​​whose value attribute is invalid are determined to be invalid Boolean values; Q is a positive integer. The initial number sequence is reordered based on the N number positions, M valid Boolean values, and Q invalid Boolean values ​​to obtain a sorted number sequence.

6. The method according to claim 5, characterized in that, The step of reordering the initial number sequence according to the N number positions, M valid Boolean values, and Q invalid Boolean values ​​to obtain a sorted number sequence includes: Among the N numbering positions, the numbering positions corresponding to the M valid Boolean values ​​are determined as valid numbering positions, and the numbering positions corresponding to the Q invalid Boolean values ​​among the N numbering positions are determined as invalid numbering positions; The M valid Boolean values ​​are sorted according to their positional order to obtain the first Boolean value sequence. The Q invalid Boolean values ​​are sorted according to their positional order to obtain a second Boolean value sequence. Obtain the attribute arrangement order between valid and invalid attributes, and sort the first Boolean value sequence and the second Boolean value sequence according to the attribute arrangement order to obtain the target Boolean value sequence; Based on the target Boolean value sequence, the initial number sequence is reordered to obtain a sorted number sequence.

7. The method according to claim 6, characterized in that, The target Boolean value sequence includes the inverted Boolean value H. j j is a positive integer; The step of reordering the initial number sequence according to the target Boolean value sequence to obtain a sorted number sequence includes: The inverted Boolean value H j The position of the value in the target Boolean value sequence is determined as the position to be filled; In the N numbering positions of the initial numbering sequence, the reverse Boolean value H is... j The corresponding number position is determined as the position to be extracted; The data source number at the position to be extracted in the initial number sequence is determined as the sorting number at the position to be filled; When the sorting number of each of the N value positions in the target Boolean value sequence is determined, the sorting numbers of each value position are arranged according to the positional order among the N value positions to obtain the sorting number sequence.

8. The method according to claim 1, characterized in that, The number sorting preprocessing component includes a conventional sorting preprocessing component; The step of reordering the initial number sequence in the number sorting preprocessing component to obtain a sorted number sequence includes: In the conventional sorting preprocessing component, the initial numbering sequence is reordered according to the size order of each data source number in the initial numbering sequence to obtain the sorted numbering sequence.

9. The method according to claim 1, characterized in that, The number sorting preprocessing component is a rearrangement preprocessing component; the sorting rule indicated by the rearrangement preprocessing component is the first sorting rule; The step of reordering the unsorted data in the unsorted data sequence according to the sorting number sequence in the sorting circuit to obtain a sorted data sequence includes: In the sorting circuit, the first data source number is obtained in the sorting number sequence according to the first sorting rule, and the number position of the first data source number in the sorting number sequence is determined as the first number position; In the sequence of data to be sorted, the data whose data source number is the first data source number is determined as the sorted data at the first number position. In the unsorted data sequence, the data whose data source number is the remaining data source number is determined as the sorted data at the second remaining number position in the sorting number sequence; the remaining data source number refers to the data source number other than the first data source number in the sorting number sequence; the second remaining number position refers to the number position of the remaining data source number in the sorting number sequence. Arrange the sorted data at the first number position and the sorted data at the second remaining number position according to the positional order between the first number position and the second remaining number position to obtain the sorted data sequence.

10. The method according to claim 1, characterized in that, The numbering and sorting preprocessing component is either a compression preprocessing component or a regular sorting preprocessing component; the sorting rules indicated by both the compression preprocessing component and the regular sorting preprocessing component are the second sorting rule; the sorting number sequence includes the data source number K. i where i is a positive integer; The step of reordering the unsorted data in the unsorted data sequence according to the sorting number sequence in the sorting circuit to obtain a sorted data sequence includes: In the sorting circuit, according to the second sorting rule, the data sequence to be sorted is obtained by matching the data source number K. i Unsorted data with sequence position mapping relationships; Will be related to the data source number K i The data to be sorted, which has a sequence position mapping relationship, is determined as the data source number K. i The corresponding mapping and sorting data; Once the mapped sorted data corresponding to each data source number in the sorted number sequence is determined, the mapped sorted data corresponding to each data source number is sorted according to the arrangement order of the sorted number sequence to obtain the sorted data sequence.

11. A data processing apparatus, characterized in that, include: The request acquisition module is used to acquire a data sorting request for a data sequence to be sorted; the data sorting request carries an initial number sequence corresponding to the data sequence to be sorted; the initial number sequence is a sequence composed of the data source numbers of each data to be sorted in the data sequence to be sorted; a data to be sorted in the data sequence to be sorted has a sequence position mapping relationship with a data source number in the initial number sequence; The component invocation module is used to invoke the number sorting preprocessing component according to the data sorting request; the number sorting preprocessing component is integrated with the sorting circuit in the chip; the number sorting preprocessing component includes a compression preprocessing component; the initial number sequence contains N data source numbers, and the N data source numbers include data source number K. i where i is a positive integer; The numbering and sorting module is used to reorder the initial number sequence in the numbering and sorting preprocessing component to obtain a sorted number sequence; the reordering of the initial number sequence in the numbering and sorting preprocessing component to obtain a sorted number sequence includes: reordering the data source number K... i The position of the data in the initial numbering sequence is determined as the target numbering position; the data in the unsorted data sequence is compared with the data source number K. i Data to be sorted that has a sequence position mapping relationship is identified as target data to be sorted; the Boolean value corresponding to the target data to be sorted is obtained, and the Boolean value corresponding to the target data to be sorted is inverted to obtain the reversed Boolean value corresponding to the target number position in the initial numbering sequence; when the reversed Boolean values ​​corresponding to the N number positions of the initial numbering sequence are determined, the initial numbering sequence is reordered according to the reversed Boolean values ​​corresponding to the N number positions to obtain the sorted numbering sequence; A sequence input module is used to input the sorting number sequence and the data sequence to be sorted into the sorting circuit; The data sorting module is used to reorder the unsorted data in the unsorted data sequence according to the sorting number sequence in the sorting circuit to obtain a sorted data sequence.

12. A computer device, characterized in that, include: Processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide network communication functions, the memory is used to store computer programs, and the processor is used to call the computer programs to cause the computer device to execute the method according to any one of claims 1-10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and to execute the method according to any one of claims 1-10.

14. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, the computer program being adapted to be read and executed by a processor to cause a computer device having the processor to perform the method of any one of claims 1-10.

Citation Information

Patent Citations

  • Reordering device and method for ethernet transmission

    US20140010237A1