Accelerator, ordering method, and heterogeneous computing system

By performing initial and local sorting in a sorting container, the problem of low computational efficiency in traditional accelerators is solved, and the overall performance of heterogeneous computing systems is improved.

CN117370018BActive Publication Date: 2026-11-24YUSUR TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311348784.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-18
Publication Date
2026-11-24
Estimated Expiration
2043-10-18

AI Technical Summary

Technical Problem

Traditional accelerators are inefficient when computing sorting operators, resulting in low computational efficiency in heterogeneous computing systems. This is mainly due to the need to transfer intermediate computation results between different computing units and to perform global sorting.

Method used

A sorting container is used for initial sorting and local sorting updates to avoid global sorting. Data is read from storage space through the read unit, local sorting is performed in the sorting container through the sorting unit, and the write unit writes the results to storage space, reducing the amount of computation and avoiding data movement.

Benefits of technology

This improved the accelerator's computational efficiency, thereby enhancing the overall computational efficiency of the heterogeneous computing system and reducing computational load and data transfer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117370018B_ABST
    Figure CN117370018B_ABST
Patent Text Reader

Abstract

This invention provides an accelerator, a sorting method, and a heterogeneous computing system. The accelerator includes: a reading unit for reading data to be sorted from a first storage space according to a processor's sorting instruction; a sorting unit for reading a portion of the data to be sorted into a sorting container for initial sorting to obtain a sorted sequence filling a preset capacity of the sorting container, and sorting the remaining data in the data to be sorted with the data in the sorted sequence to update the sorted sequence, wherein the preset capacity of the sorting container corresponds to a preset sorting truncation length; and a writing unit for writing the updated sorted sequence as the sorting result of the sorting instruction into a second storage space. This invention improves the computational efficiency of the accelerator, thereby improving the computational efficiency of the heterogeneous computing system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an accelerator, a sorting method, and a heterogeneous computing system. Background Technology

[0002] A Data Processing Unit (DPU) acts as an accelerator and can be implemented as a dedicated data processing chip. It offers significantly higher performance compared to processors such as CPUs when handling complex data calculations.

[0003] When performing data computation tasks, a heterogeneous computing system that includes CPUs and accelerators such as DPUs can be used to offload the computation of corresponding subtasks from the CPU to the accelerators, thereby improving computing performance. This is especially true when accelerating the computational power of distributed computing tasks (e.g., Apache Spark) required for big data scenarios. Such a heterogeneous computing architecture allows the CPU to focus on scheduling distributed computing tasks, while the accelerator focuses on executing data computation within subtasks (e.g., Spark SQL).

[0004] During the computation of query subtasks such as Spark SQL, sorting operators such as TopN operators need to be executed. Traditional accelerators typically employ the collaboration of multiple internal computing units when computing sorting operators. During the computation process, intermediate computation results need to be transferred between different computing units, resulting in relatively low computational efficiency for accelerators, which in turn leads to low computational efficiency for heterogeneous computing systems. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide an accelerator, a sorting method, and a heterogeneous computing system to at least partially solve the above-mentioned problems.

[0006] According to a first aspect of the present invention, an accelerator is provided, comprising: a reading unit, configured to read data to be sorted from a first storage space according to a sorting instruction from a processor; a sorting unit, configured to read a portion of the data to be sorted into a sorting container for initial sorting to obtain a sorting sequence filling a preset capacity of the sorting container, and to sort the remaining data in the data to be sorted together with the data in the sorting sequence to update the sorting sequence, wherein the preset capacity of the sorting container corresponds to a preset sorting truncation length; and a writing unit, configured to write the updated sorting sequence as the sorting result of the sorting instruction into a second storage space.

[0007] In another implementation of the present invention, the sorting unit is specifically used to: if the sorting priority of the current data in the remaining data of the data to be sorted is higher than the sorting priority of the first data in the sorting sequence, then the current data is placed before the first data, and the last data in the sorting sequence is deleted to update the sorting sequence.

[0008] In another implementation of the present invention, the reading unit is specifically used to: if there is still remaining data in the data to be sorted, then read the next data of the current data as the current data. The writing unit is specifically used to: if there is no remaining data in the data to be sorted, then write the updated sorting sequence as the sorting result of the sorting instruction into the second storage space.

[0009] In another implementation of the present invention, the sorting unit is further configured to: discard the current data if the sorting priority of the current data is later than the last data in the sorting sequence.

[0010] In another implementation of the present invention, the sorting unit is specifically used to: if the sorting priority of the current data is later than that of the first data and earlier than that of the second data, then the current data is sorted between the first data and the second data.

[0011] In another implementation of the invention, the sorting unit places the current data before the first data and the second data, and the sorting unit determines that the first data and the second data are adjacent in the sorting sequence.

[0012] In another implementation of the present invention, the sorting unit is specifically configured to: if the sorting priority of the current data in the data to be sorted is higher than the sorting priority of the third data in the sorting container, then the current data is placed before the third data in the sorting container. If the sorting priority of the current data is lower than the third data but higher than the fourth data, then the current data is placed between the third data and the fourth data in the sorting container, wherein the third data and the fourth data are adjacent data. If the sorting priority of the current data is lower than the fourth data, then the current data is placed after the fourth data in the sorting container.

[0013] In another implementation of the present invention, the sorting unit is specifically used to: determine the sorting sequence if the sorting container is full after the current data is placed.

[0014] In another implementation of the present invention, the sorting unit is further configured to: create a sorting container of the preset capacity according to the sorting instruction, and delete the sorting container after the writing unit writes the updated sorting arrangement, wherein the sorting instruction includes the preset capacity.

[0015] In another implementation of the invention, the accelerator further includes a communication unit for: acquiring the sorting instruction, and sending a response to the sorting instruction to the processor after the writing unit writes the updated sorting arrangement.

[0016] According to a second aspect of the present invention, a sorting method is provided. The sorting method includes: reading data to be sorted from a first storage space according to a sorting instruction from a processor; reading a portion of the data to be sorted into a sorting container for initial sorting to obtain a sorting sequence that fills a preset capacity of the sorting container, wherein the preset capacity of the sorting container corresponds to a preset sorting truncation length; sorting the remaining data in the data to be sorted with the data in the sorting sequence to update the sorting sequence; and writing the updated sorting sequence as the sorting result of the sorting instruction into a second storage space.

[0017] According to a third aspect of the present invention, a heterogeneous computing system is provided. The heterogeneous computing system includes a processor and an accelerator as described in the first aspect.

[0018] In embodiments of the present invention, an initial sorting is performed in a sorting container to obtain a sorted sequence that fills the sorting container. The sorted sequence is then updated through local sorting within the sorting container, avoiding global sorting of the data to be sorted and reducing computational load. Furthermore, both the initial sorting and further sorting are performed within the sorting container of the sorting unit, avoiding data transfer between different computing units, improving the computational efficiency of the accelerator, and consequently improving the computational efficiency of the heterogeneous computing system. Attached Figure Description

[0019] 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 recorded in the embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0020] Figure 1 This is a schematic diagram of a distributed computing system based on some examples.

[0021] Figure 2A and Figure 2B This is a schematic diagram of the sorting process of the TopN operator based on some examples.

[0022] Figure 3 This is a schematic structural diagram of an accelerator according to some embodiments of the present invention.

[0023] Figure 4A and Figure 4B for Figure 3 A schematic diagram of an example sorting process of one embodiment.

[0024] Figure 5 This is a flowchart of the sorting process according to other embodiments of the present invention.

[0025] Figure 6 This is a schematic diagram of the structure of a heterogeneous computing system according to other embodiments of the present invention. Detailed Implementation

[0026] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art should fall within the protection scope of the present invention.

[0027] The specific implementation of the embodiments of the present invention will be further described below with reference to the accompanying drawings.

[0028] Figure 1 This is a schematic diagram of a distributed computing system based on some examples. Figure 1 The distributed computing system comprises multiple servers (also referred to as hosts) 10, each of which can be configured with virtualized containers. The distributed computing framework 120 can be deployed within the virtualized containers of each server. Each server can perform data transmission through an interconnection network 20, which can be a network of smart network interface cards connected to the servers, a network of switches with pooled hardware resources, or a combination of both.

[0029] Furthermore, server 10 is also configured with a computing layer 110, which includes at least a processor 200 such as a CPU and an accelerator 300 such as a DPU. The computing layer 110 may also include a general-purpose accelerator (not shown) such as a GPU. The computing layer 110 in each server 10 constitutes an important part of the hardware resources of the distributed computing system.

[0030] Furthermore, the structured processing interface 130 can be configured based on the distributed computing architecture 120 to obtain the ability to process structured data.

[0031] In some examples, the distributed computing architecture 120 can be a fast, general-purpose computing engine designed for large-scale data computation, such as Apache Spark, which, in addition to providing interactive queries, can optimize iterative workloads. The structured processing interface 130 can be a computing module specifically designed for processing structured data, such as Spark SQL. Spark SQL is a computing module configured based on Apache Spark. Spark SQL allows users to perform CRUD operations using standard SQL statements.

[0032] In Adoption Figure 1 In one example of the distributed computing system shown, processor 200 is used to schedule computing tasks based on a distributed computing architecture 120 such as Apache Spark, generating query subtasks. The processor then assigns the query subtasks to accelerator 300 for computation. Accelerator 300 reads data to be computed from memory while performing computation on the query subtasks, and then writes the computation results of the query subtasks back into memory.

[0033] For structured processing interfaces such as Spark SQL, a crucial query subtask is the sorting subtask of the TopN operator. The TopN operator sorts data according to a given sorting rule in the SQL query (e.g., based on sorting priority), and then extracts the top N (largest or smallest) rows. (See reference...) Figure 2A The specific implementation process of the TopN operator is mainly decomposed into the processing of the sortOrder calculation unit, the gather calculation unit, and the slice calculation unit in the accelerator 300.

[0034] Specifically, the sortOrder calculation unit is used to obtain the row index for global sorting, and the exemplary pseudocode for its function is as follows:

[0035] definition:

[0036] *sortKeys: The column indexes to be sorted

[0037] *isDescending: Whether to sort in descending order

[0038] *areNullsSmallest: Whether to consider NULL as the smallest

[0039] *gatherMap: The column index corresponding to the sorted result

[0040] *return code

[0041] Functionality:

[0042] public static native int sortOrder(long[]sortKeys,

[0043] boolean[]isDescending,

[0044] boolean[]areNullsSmallest,

[0045] long gatherMap) throws RaceException;

[0046] In addition, the gather calculation unit is used to retrieve the globally sorted data table based on the index. An example of its pseudocode is as follows:

[0047] definition:

[0048] *columnIds: Indexes of multiple columns that are not joined

[0049] *joinedKeyId: Index of the key column in this table after the join operation.

[0050] *joinedColumnIds: Indexes of the joined columns

[0051] *return code

[0052] Functionality:

[0053] public static native int gather(long[]columnIds,

[0054] long joinedKeyId,

[0055] long[]joinedColumnIds);

[0056] In addition, the slice calculation unit is used to extract the first N data points from the data table. An example of its pseudocode is as follows:

[0057] definition:

[0058] *columnIds: The column index to be truncated

[0059] *start: Starting position

[0060] *end: End position

[0061] *results: The column indexes corresponding to the truncated results

[0062] *return: Return code

[0063] Functionality:

[0064] public static native int slice(long columnIds,

[0065] long start,

[0066] long end,

[0067] long results) throws RaceException;

[0068] The following is an exemplary description Figure 2A The sorting process involves the `sortOrder` calculation unit sorting the data to be sorted (i.e., the original sequence) to obtain a globally sorted sequence. Figure 2A For example, (c) has the highest sort priority, (b) has the second highest, (a) has the third highest, and null is considered the lowest. Therefore, in the resulting global sorted sequence, the first data is (c) at index 2 in the original sequence. The second data is (b) at index 3 in the original sequence. The third data is (a) at index 1 in the original sequence. The fourth data is null at index 4 in the original sequence. That is, the global sorted sequence is: 2, 3, 1, 4. It should be understood that a, b, and c are objects whose sorting priority is obtained by comparing non-null attribute values, and null is an object with an empty attribute value. In this example, the sorting priority of objects with non-null attribute values ​​is defined to be higher than that of objects with empty attribute values. Alternatively, objects with empty attribute values ​​can be defined to have other sorting priorities.

[0069] Furthermore, the gather calculation unit retrieves data according to the index following the global sort sequence, since the global sort sequence is 2, 3, 1, 4. Therefore, the resulting sort sequence is: c, b, a, null.

[0070] Furthermore, the Slice computation unit extracts the first N data points from the sorted sequence, in order to... Figure 2A For example, the first two data points of the sorted sequence are c and b, which are taken as the final sorting result. Figure 2B It visually illustrates the correspondence between the data to be sorted and the sorting results.

[0071] As can be seen from the above example, the computation process of accelerator 300 requires the transfer of intermediate computation results between different computing units and involves a global sorting process, resulting in low overall computational efficiency of accelerator 300.

[0072] Furthermore, Figure 3 An accelerator according to some embodiments of the present invention is shown. The accelerator includes:

[0073] The read unit 310 is used to read data to be sorted from the first storage space according to the sorting instructions of the processor.

[0074] It should be understood that the first storage space can be main memory (or RAM) or the accelerator's local cache. When the first storage space is main memory, the accelerator reads the data to be sorted from main memory. When the first storage space is a local cache, the accelerator reads the data to be sorted from main memory into the local cache, and then further reads the data to be sorted from the local cache.

[0075] It should also be understood that the accelerator may also include a communication unit that can acquire and parse the sorting instructions sent by the processor, and then send the parsed sorting instructions to the read unit.

[0076] The sorting unit 320 is used to read a portion of the data to be sorted into a sorting container for initial sorting, to obtain a sorting sequence that fills the preset capacity of the sorting container, and to sort the remaining data in the data to be sorted with the data in the sorting sequence to update the sorting sequence, wherein the preset capacity of the sorting container corresponds to a preset sorting truncation length.

[0077] It should be understood that a sorting unit can create a sorting container of a pre-defined size according to a sorting instruction. The sorting instruction may include information indicating the pre-defined size.

[0078] It should also be understood that after the sorted sequence fills the sort container, the length of the sorted sequence does not increase with each sort. Before the sorted sequence fills the sort container, the length of the sorted sequence increases with each sort.

[0079] The write unit 330 is used to write the updated sorted sequence as the sorting result of the sorting instruction into the second storage space.

[0080] It should be understood that the second storage space can be memory or a non-volatile storage medium such as an SSD.

[0081] It should also be understood that after the write unit writes the updated sorted arrangement, the sorting unit can delete the sorted container. After the write unit writes the updated sorted arrangement, the communication unit can send a response to the sorting instruction to the processor, so that the processor can further schedule query subtasks based on the sorting results.

[0082] In the embodiment of this invention, an initial sorting is performed in a sorting container to obtain a sorted sequence that fills the sorting container. Then, the sorted sequence is updated through local sorting within the sorting container, avoiding global sorting of the data to be sorted and reducing computational load. Furthermore, both the initial sorting and further sorting are performed within the sorting container of the sorting unit, avoiding data movement between different computing units, improving the accelerator's computational efficiency, and consequently improving the computational efficiency of the heterogeneous computing system.

[0083] The initial sorting process of the sort container and the update process of the sort sequence will be described below. It should be understood that, in both the initial sorting and update processes, the read / write unit reads the current data from the first storage space. After sorting the current data, the next data is read as an update to the current data, until no more data is available. Furthermore, local sorting is performed within the sort container in both the initial and update processes.

[0084] Furthermore, during the update process of the sorting sequence, since the sorting sequence has a preset sequence length and the sorting container is in a full state, the current data may be added to the sorting sequence or discarded. Data already added to the sorting sequence may be retained or discarded. For example, in a certain sorting, if the sorting priority of the current data is higher than that of the current last data in the sorting sequence, then the current data will be added to the sorting sequence, while the current last data will be removed or discarded from the sorting sequence.

[0085] During the initial sorting process, the sorting container is not full. The current data will not be discarded, but will be sorted into the sorting container. In other words, the amount of data in the sorting container is less than the preset capacity of the sorting container.

[0086] Furthermore, in this embodiment, the reading unit obtains the current data index from the data to be sorted in the first storage space and reads the current data corresponding to the current data index. In this embodiment, the sorting priority of objects with non-empty attribute values ​​is defined as higher than the sorting priority of objects with empty attribute values. Alternatively, objects with empty attribute values ​​may be defined to have other sorting priorities.

[0087] Furthermore, Figure 4AThis diagram illustrates an example of the initial sorting process for the TopN operator. The data to be sorted is stored in memory (or the accelerator's local cache), numbered a(14), b(16), c(10), d(6), e(1), f(3), g(4), and h(8) from left to right. The default capacity of the created sorting container is 5. It should be understood that the values ​​following a, b, c, d, e, f, g, and h represent their sorting priorities, which can indicate sorting rules, such as sorting values ​​from largest to smallest, or from smallest to largest (value priority), or other sorting rules. It should also be understood that the above data are merely illustrative and should not be construed as specific characters.

[0088] Data (current data) is read sequentially into the sort container from left to right (an example of the read order in the first storage space) according to the reading order. When 'a' is read as the current data, the sort container is empty and in an incomplete state (<5), so 'a' is directly read into the sort container.

[0089] When reading 'b' as the current data, the sorting container is not full (<5). 'b' is directly read into the sorting container. Since 'b's sort priority (16) is higher than 'a's sort priority (14), 'b' is sorted before 'a'. Without loss of generality, if the sort priority of the current data is higher than the sort priority of the third data in the sorting container, the sorting unit will place the current data before the third data in the sorting container.

[0090] When reading 'c' as the current data, the sorting container is not full (<5), so 'c' is directly read into the sorting container. Since the sorting priority of 'c' (10) is after the sorting priority of 'a' (14), 'c' is sorted after 'a'.

[0091] When reading d as the current data, the sorting container is not full (<5), so d is directly read into the sorting container. Since the sorting priority of d (6) is after the sorting priority of c (10), d is sorted after c. Without loss of generality, if the sorting priority of the current data is after the fourth data, the sorting unit will place the current data after the fourth data in the sorting container.

[0092] When reading 'e' as the current data, the sorting container is not full (<5), so 'e' is directly read into the sorting container. Since the sorting priority of 'e' is 1, which is after the sorting priority of 'd' (6), 'e' is sorted after 'd'. Without loss of generality, if the sorting priority of the current data is after the third data but before the fourth data, the sorting unit places the current data between the third and fourth data in the sorting container, making the third and fourth data adjacent.

[0093] Through the sorting priority comparison process described above, the previous data in the sorting container has already been sorted before the current data is placed into the sorting container. Therefore, it is not necessary to traverse all the data in the sorting container, thus efficiently realizing the initial sorting in the sorting container.

[0094] Furthermore, the sorting unit is specifically used to: determine the sorting sequence if the data in the sorting container reaches a preset capacity after the current data is sorted. For example, after 'e' is sorted into the sorting container, the data in the sorting container reaches the preset capacity of 5.

[0095] Furthermore, Figure 4B This illustrates an example of the sorting process for the TopN operator, showing the update process of the sorted sequence. After... Figure 4A After the initial sorting process, the remaining data in the unsorted data in memory also includes f(3), g(4), and h(8).

[0096] When f is read as the current data, the sort container is full (=5). Since the sort priority of f (3) is greater than the sort priority of the last data e (1), data e is removed from the sort sequence, and f is read into the sort container. Since the sort priority of f (3) is less than the sort priority of data d (6), f is placed at the end of the sort sequence.

[0097] When g is read as the current data, the sort container is full (=5). Since g's sort priority (4) is greater than the sort priority (3) of the last data f, data f is removed from the sort sequence, and g is read into the sort container. Since g's sort priority (4) is less than the sort priority (6) of data d, g is placed at the end of the sort sequence.

[0098] When reading h as the current data, the sort container is full (=5). Since the sort priority of h (8) is greater than the sort priority of the last data g (4), data g is removed from the sort sequence, and h is read into the sort container. Since the sort priority of h (8) is less than the sort priority of data c (10) and greater than the sort priority of d (6), h is placed between data c and data d.

[0099] Without loss of generality, if the sorting priority of the current data is higher than that of the first data in the sorted sequence, the sorting unit will place the current data before the first data and simultaneously delete the last data in the sorted sequence to update the sorted sequence. By comparing the sorting priority of the first data and deleting the last data in the sorted sequence, the efficiency of updating the sorted sequence is improved.

[0100] Alternatively, the sorting unit is also used to discard the current data if its sorting priority is lower than that of the last data in the sorted sequence. This comparison with the last data further improves the efficiency of updating the sorted sequence.

[0101] Alternatively: If the current data has a sorting priority that is later than the first data but earlier than the second data, then the current data is placed between the first and second data. By comparing the sorting priorities of the first and second data, the efficiency of updating the sorted sequence is improved.

[0102] Alternatively, the current data is placed before the first and second data in the sorting unit, where the first and second data are adjacent in the sorting sequence. By comparing the sorting priority of adjacent data, the previous data in the sorting sequence has already been sorted before the current data is added to the sorting sequence, thus eliminating the need to traverse all data in the sorting sequence and efficiently updating the sorting sequence.

[0103] Furthermore, when reading the current data from the unsorted data, if there is still remaining data in the unsorted data, the reading unit reads the next data as the current data. If there is no remaining data in the unsorted data, the writing unit writes the updated sorted sequence.

[0104] In addition, the sorting container is configured to obtain a state that conforms to the sorting rules (which define the sorting priority) after each sort.

[0105] The processing procedure of the accelerator in some embodiments of the present invention has been described above. An example of pseudocode for the development of the sorting unit is shown below:

[0106] definition:

[0107] *src_handles: The data columns that need to be sorted.

[0108] *src_order_index_handles: The data columns used for sorting.

[0109] *res_handles: Sorted data columns

[0110] *isDescending: Whether to sort in descending order

[0111] *areNullsSmallest: Whether to consider NULL as the smallest

[0112] *use_limit: Sort rule: true only returns the first N results.

[0113] *limit_line_n: Returns only the first N results.

[0114] *return code

[0115] Functionality:

[0116] public static native int slice(long[]src_handles,

[0117] Long[]src_order_index_handles,

[0118] Long[]res_handles,

[0119] boolean[]isDescending,

[0120] boolean[]areNullsSmallest,

[0121] Boolean use_limit,

[0122] long limit_line_n)throws RaceException;

[0123] The following will combine Figure 5 The sorting process according to other embodiments of the present invention is described. Figure 5 The sorting methods include:

[0124] S510: Reads the data to be sorted from the first memory space according to the processor's sorting instructions.

[0125] S520: Read a portion of the data to be sorted into a sorting container for initial sorting, and obtain a sorted sequence that fills the preset capacity of the sorting container, wherein the preset capacity of the sorting container corresponds to the preset sorting truncation length.

[0126] S530: Sort the remaining data in the unsorted data with the data in the sorting sequence to update the sorting sequence.

[0127] S540: Write the updated sorted sequence as the sorting result of the sorting instruction to the second storage space.

[0128] It should be understood that the first storage space can be main memory (or RAM) or the accelerator's local cache. When the first storage space is main memory, the accelerator reads the data to be sorted from main memory. When the first storage space is a local cache, the accelerator reads the data to be sorted from main memory into the local cache, and further reads the data to be sorted from the local cache. The accelerator may also include a communication unit that can acquire and parse the sorting instructions sent by the processor, and then send the parsed sorting instructions to the read unit.

[0129] It should be understood that a sorting unit can create a sorting container of a pre-defined size according to a sorting instruction. The sorting instruction may include information indicating the pre-defined capacity. After the sorting sequence fills the sorting container, the length of the sorting sequence does not increase with each subsequent sort. Before the sorting sequence fills the sorting container, the length of the sorting sequence increases with each subsequent sort.

[0130] It should be understood that the second storage space can be memory or a non-volatile storage medium such as an SSD. After the write unit writes the updated sorted arrangement, the sorting unit can delete the sorted container. After the write unit writes the updated sorted arrangement, the communication unit can send a response to the sorting instruction to the processor, so that the processor can further schedule query subtasks based on the sorting results.

[0131] In the embodiment of this invention, an initial sorting is performed in a sorting container to obtain a sorted sequence that fills the sorting container. Then, the sorted sequence is updated through local sorting within the sorting container, avoiding global sorting of the data to be sorted and reducing computational load. Furthermore, both the initial sorting and further sorting are performed within the sorting container of the sorting unit, avoiding data movement between different computing units, improving the accelerator's computational efficiency, and consequently improving the computational efficiency of the heterogeneous computing system.

[0132] In other examples, the step of sorting the remaining data in the unsorted data with the data in the sorting sequence to update the sorting sequence includes: if the sorting priority of the current data in the remaining data in the unsorted data is higher than the sorting priority of the first data in the sorting sequence, then the current data is placed before the first data, and the last data in the sorting sequence is deleted to update the sorting sequence.

[0133] In other examples, reading the data to be sorted from the first storage space includes: if there is still remaining data in the data to be sorted, then reading the next data of the current data as the current data. Writing the updated sorted sequence as the sorting result of the sorting instruction to the second storage space includes: if there is no remaining data in the data to be sorted, then writing the updated sorted sequence as the sorting result of the sorting instruction to the second storage space.

[0134] In other examples, the step of sorting the remaining data in the unsorted data with the data in the sorting sequence to update the sorting sequence further includes: if the sorting priority of the current data is lower than that of the last data in the sorting sequence, then the current data is discarded.

[0135] In other examples, the step of sorting the remaining data in the unsorted data with the data in the sorting sequence to update the sorting sequence further includes: if the sorting priority of the current data is later than the first data and earlier than the second data, then the current data is placed between the first data and the second data.

[0136] In other examples, the method further includes determining that the first data and the second data are adjacent in the sorting sequence before placing the current data before the first data and the second data.

[0137] In other examples, a portion of the data to be sorted is read into a sorting container for initial sorting to obtain a sorted sequence that fills a preset capacity of the sorting container. This includes: if the sorting priority of the current data in the data to be sorted is higher than the sorting priority of the third data in the sorting container, then the current data is placed before the third data in the sorting container.

[0138] In other examples, a portion of the data to be sorted is read into a sorting container for initial sorting to obtain a sorted sequence that fills a preset capacity of the sorting container. This also includes: if the sorting priority of the current data is later than that of the third data and earlier than that of the fourth data, then the current data is placed in the sorting container between the third data and the fourth data.

[0139] In other examples, a portion of the data to be sorted is read into a sorting container for initial sorting to obtain a sorted sequence that fills a preset capacity of the sorting container. This further includes: if the sorting priority of the current data is lower than that of the fourth data, then the current data is placed after the fourth data in the sorting container. In one example, the third data and the fourth data are adjacent data.

[0140] In other examples, a portion of the data to be sorted is read into a sorting container for initial sorting to obtain a sorting sequence that fills a preset capacity of the sorting container. The method further includes: if the sorting container is filled after the current data is placed in the sorting container, then the sorting sequence is determined.

[0141] In other examples, the sorting method further includes: creating a sorting container of the preset capacity according to the sorting instruction, and deleting the sorting container after the updated sorting arrangement is written in the writing unit, wherein the sorting instruction includes the preset capacity.

[0142] In other examples, the sorting method further includes: obtaining the sorting instruction, and after the writing unit writes the updated sorting arrangement, sending a response to the sorting instruction to the processor.

[0143] The specific implementation of each step in the sorting method of this invention can be found in the corresponding steps and units described in the embodiments of the accelerator, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the units described above can be referred to the corresponding process description in the foregoing accelerator embodiments, and will not be repeated here.

[0144] Figure 6 This is a schematic diagram of a heterogeneous computing system according to other embodiments of the present invention. The heterogeneous computing system 110 includes a processor 200 and an accelerator 300. The heterogeneous computing system 110 can be implemented as a system-on-a-chip. Instructions or data can be transferred between the processor 200 and the accelerator 300 via a bus such as PCIe. The accelerator 300 can transfer instructions or data with an SSD via a bus such as NVMe. The accelerator 300 can be one of the accelerators described in the various examples of the present invention, and its corresponding operations will not be elaborated here.

[0145] This invention also provides a computer storage medium storing a computer program that, when executed by a processor, implements the sorting method described in any of the foregoing embodiments. The computer storage medium includes, but is not limited to, compact disc read-only memory (CD-ROM), random access memory (RAM), floppy disk, hard disk, or magneto-optical disk.

[0146] This invention also provides a computer program product, including computer instructions that instruct a computing device to perform an operation corresponding to any of the sorting methods described above.

[0147] Furthermore, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used for training the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with relevant regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0148] It should be noted that, depending on the implementation needs, the various components / steps described in the embodiments of the present invention can be broken down into more components / steps, or two or more components / steps or parts of the operation of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present invention.

[0149] The methods described above according to embodiments of the present invention can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium and subsequently stored in a local recording medium, downloaded via a network. Thus, the methods described herein can be stored on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an Application Specific Integrated Circuit (ASIC) or a Field Programmable Gate Array (FPGA)). It is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., random access memory (RAM), read-only memory (ROM), flash memory, etc.) capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods described herein. Furthermore, when a general-purpose computer accesses code used to implement the methods shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for executing the methods shown herein.

[0150] Those skilled in the art will recognize that the units and method steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. 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 the embodiments of the present invention.

[0151] The above embodiments are only used to illustrate the embodiments of the present invention, and are not intended to limit the embodiments of the present invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of the present invention, and the patent protection scope of the embodiments of the present invention should be defined by the claims.

Claims

1. An accelerator, comprising: The read unit is used to read data to be sorted from the first storage space according to the processor's sorting instructions; A sorting unit is configured to read a portion of the data to be sorted into a sorting container for initial sorting, obtaining a sorted sequence that fills a preset capacity of the sorting container, and to sort the remaining data in the data to be sorted with the data in the sorted sequence to update the sorted sequence. The preset capacity of the sorting container corresponds to a preset sorting truncation length. Specifically, if the sorting priority of the current data in the remaining data to be sorted is higher than the sorting priority of the first data in the sorted sequence, the current data is placed before the first data, and the last data in the sorted sequence is deleted to update the sorted sequence. If the sorting priority of the current data is lower than the last data in the sorted sequence, the current data is discarded. If the sorting priority of the current data is lower than the first data but higher than the second data, the current data is placed between the first data and the second data. When the sorting unit places the current data before the first data and the second data, the sorting unit determines that the first data and the second data are adjacent in the sorted sequence. The writing unit is used to write the updated sorted sequence as the sorting result of the sorting instruction into the second storage space; Wherein, the first storage space is memory or the accelerator's local cache; when the first storage space is memory, the accelerator reads the data to be sorted from the memory; when the first storage space is a local cache, the accelerator reads the data to be sorted from memory into the local cache, and further reads the data to be sorted from the local cache. The second storage space is memory or a non-volatile storage medium such as an SSD.

2. The accelerator according to claim 1, characterized in that, The reading unit is specifically used to: if there is still remaining data in the data to be sorted, then read the next data of the current data as the current data; The writing unit is specifically used to: if there is no remaining data in the data to be sorted, write the updated sorting sequence as the sorting result of the sorting instruction into the second storage space.

3. The accelerator according to claim 1, characterized in that, The sorting unit is specifically used for: If the sorting priority of the current data in the data to be sorted is higher than the sorting priority of the third data in the sorting container, then the current data will be placed before the third data in the sorting container. If the sorting priority of the current data is after the third data and before the fourth data, then the current data is placed in the sorting container between the third data and the fourth data, where the third data and the fourth data are adjacent data. If the current data has a lower sorting priority than the fourth data, then the current data will be placed after the fourth data in the sorting container.

4. The accelerator according to claim 3, characterized in that, The sorting unit is specifically used to: determine the sorting sequence if the sorting container is full after the current data is placed.

5. The accelerator according to claim 1, characterized in that, The sorting unit is further configured to: create a sorting container of the preset capacity according to the sorting instruction, and delete the sorting container after the writing unit writes the updated sorting arrangement, wherein the sorting instruction includes the preset capacity.

6. The accelerator according to claim 1, characterized in that, The accelerator further includes a communication unit for: acquiring the sorting instruction, and sending a response to the sorting instruction to the processor after the writing unit writes the updated sorting arrangement.

7. A sorting method, characterized in that, include: According to the processor's sorting instructions, read the data to be sorted from the first memory space; A portion of the data to be sorted is read into a sorting container for initial sorting, resulting in a sorted sequence that fills a preset capacity of the sorting container. The preset capacity of the sorting container corresponds to a preset sorting truncation length. If the sorting priority of the current data among the remaining data to be sorted is higher than the sorting priority of the first data in the sorted sequence, then the current data is placed before the first data, and the last data in the sorted sequence is deleted to update the sorted sequence. If the sorting priority of the current data is lower than the last data in the sorted sequence, then the current data is discarded. If the sorting priority of the current data is lower than the first data but higher than the second data, then the current data is placed between the first data and the second data. When the sorting unit places the current data before the first data and the second data, the sorting unit determines that the first data and the second data are adjacent in the sorted sequence. The remaining data in the unsorted data are sorted together with the data in the sorting sequence to update the sorting sequence; The updated sorted sequence is written into the second storage space as the sorting result of the sorting instruction; Wherein, the first storage space is memory or the accelerator's local cache; when the first storage space is memory, the accelerator reads the data to be sorted from the memory; when the first storage space is a local cache, the accelerator reads the data to be sorted from memory into the local cache, and further reads the data to be sorted from the local cache. The second storage space is memory or a non-volatile storage medium such as an SSD.

8. A heterogeneous computing system, characterized in that, include: processor; The accelerator according to any one of claims 1-6.

Citation Information

Patent Citations

  • Data storage method and device

    CN111045598A

  • Data processing method, device and equipment and readable storage medium

    CN116260711A