Data extraction remapping method and device for enhancing DMA (Direct Memory Access) performance

By converting the source data into one-dimensional data and independently calculating the mapping information of each element, the problems of complex DMA calculation logic and low efficiency are solved, achieving a high-efficiency DMA performance improvement and meeting the performance requirements of GPUs.

CN121858488APending Publication Date: 2026-04-14BEIJING FENGHUA CHUANGZHI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-15
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In existing technologies, DMA suffers from complex computational logic and low efficiency due to algorithm limitations when extracting and mapping parameters, which cannot meet the performance requirements of GPUs, especially when processing data with excessively long bit widths, resulting in serious timing problems.

Method used

The source data is converted into one-dimensional data, generating data to be read and data to be mapped. The mapping information is obtained by traversing the position and target length of each element. The positional relationship of each element is calculated independently, avoiding dependence on the mapping result of the previous element, thus achieving parallel computing.

Benefits of technology

It improves the performance and efficiency of DMA acquisition and mapping data, meets the performance requirements of GPU, reduces computing power consumption, and improves computing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121858488A_ABST
    Figure CN121858488A_ABST
Patent Text Reader

Abstract

The invention provides a data extraction remapping method and device for enhancing DMA performance, and the method comprises the steps: converting source data from multi-dimensional data into one-dimensional data, and obtaining to-be-read data; generating corresponding data to be mapped according to valid data in the data to be read; traversing each element in the to-be-mapped data, and obtaining mapping information of each element in the to-be-mapped data according to the position of each element and the target length L2; obtaining a position corresponding relationship between each element in the to-be-mapped data and each element in the to-be-read data; writing each element of the effective data into a corresponding position in the to-be-mapped data according to the position corresponding relation to obtain mapped data; the elements in the to-be-read data and the to-be-mapped data are independently calculated to complete extraction mapping, so that the calculation of each element can be performed at the same time, and the performance and efficiency of the DMA for collecting the mapped data are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital circuit design technology, and in particular to a data extraction and remapping method and apparatus for enhancing DMA performance. Background Technology

[0002] When the Graphics Processing Unit (GPU) performs general-purpose computations, the corresponding parameters are prepared in the external dynamic memory. Direct Memory Access (DMA) needs to extract these parameters before handing them over to the GPU to execute the specified computation. The current problem is that the format of the extracted parameters may not match the computational instructions of the GPU. This typically manifests as the need to supplement or replace the end-of-line data with other data. To achieve higher data transfer efficiency, DMA needs to extract valid data from the corresponding parameters and map it to the target format.

[0003] The problem with existing technologies is that DMA requires determining the position of each byte of data for the extraction and mapping of valid data in the parameters. During this process, due to the limitations of the algorithm itself, there are interdependent relationships between elements. Each element in the data needs to be mapped and extracted in sequence. The calculation of the extraction and mapping of each element depends on the mapping position information of the previous element. When the data bit width is too long, the element position calculation in the mapping process will cause timing problems, making the DMA mapping and extraction calculation logic complex and inefficient. The GPU needs to be downclocked, which makes it difficult to meet the performance requirements of the GPU.

[0004] Therefore, overcoming the shortcomings of the existing technology is an urgent problem to be solved in this technical field. Summary of the Invention

[0005] The technical problem this invention aims to solve is how to improve the performance and efficiency of DMA acquisition and mapping data to better meet the performance requirements of GPUs.

[0006] The present invention adopts the following technical solution: Firstly, a data extraction and remapping method to enhance DMA performance is provided, including: The source data is retrieved from the memory and converted into one-dimensional data to obtain the data to be read; wherein, the data to be read includes valid data; Based on the valid data, generate the data to be mapped, and obtain the target length L1 of the data to be read and the target length L2 of the data to be mapped; Iterate through each element in the data to be mapped, and obtain the mapping information of each element in the data to be mapped based on the position of each element and the target length L2; Based on the difference between the target length L1 and the target length L2, the mapping information of each element in the data to be mapped, and the position of each element in the data to be mapped, obtain the positional correspondence between each element in the data to be mapped and each element in the data to be read. According to the position correspondence, each element of the valid data is written into the corresponding position in the data to be mapped to obtain the mapped data.

[0007] Preferably, the step of generating the data to be mapped based on the valid data, and obtaining the target length L1 of the data to be read and the target length L2 of the data to be mapped, specifically includes: Obtain all valid data and the format data corresponding to each valid data in the data to be read; obtain the length a of a single valid data in the data to be read and the length b of the format data corresponding to the valid data; and use the sum of the lengths a and b as the target length L1. Data to be written is generated based on each of the valid data, wherein the length of the data to be written is equal to the length of the data to be written. Generate corresponding formatted data between adjacent data to be written to obtain the data to be mapped; Obtain the length c of a single piece of data to be written in the data to be mapped and the length d of the format data corresponding to the data to be written. Use the sum of the lengths c and d as the target length L2.

[0008] Preferably, the step of traversing each element in the data to be mapped and obtaining the mapping information of each element in the data to be mapped based on the position of each element and the target length L2 specifically includes: The initial mapping information for each element in the data to be mapped is obtained based on the position of each element in the data to be mapped and the target length L2. Obtain the relative position of the first element in each data group of the data to be mapped. Based on the initial mapping information of each element, the relative position of the first element in the data group to which the corresponding element belongs, and the target length L2, obtain the mapping information of each element in the data to be mapped.

[0009] Preferably, obtaining the initial mapping information for each element in the data to be mapped based on the position of each element and the target length L2 specifically includes: The binary search method is used to divide the position of each element in the data to be mapped by the target length L2 to obtain the remainder X0 and the quotient Y0. The calculated remainder X0 and quotient Y0 are used as the initial mapping information (Y0, X0) for the corresponding elements.

[0010] Preferably, the step of obtaining the mapping information of each element in the data to be mapped based on the initial mapping information of each element, the relative position of the first element in the data group to which the corresponding element belongs, and the target length L2 specifically includes: Add the relative position offset of the first element in the data group where the corresponding element is located to the initial mapping information of each element X0, and then divide by the target length L2 to obtain the remainder X1 and the quotient Y1. The calculated remainder X1 and quotient Y1 are used as the mapping information (Y1, X1) of the corresponding elements.

[0011] Preferably, obtaining the relative position of the first element in each data group of the data to be mapped specifically includes: The offset of the first element in the first data group of the data to be mapped is 0; For the data groups after the first data group in the data to be mapped, the sum of X1 plus 1 in the mapping information of the last element in the preceding data group of the corresponding data group is divided by the target length L2, and the remainder is the relative position offset of the first element in the corresponding data group.

[0012] Preferably, the step of obtaining the positional correspondence between each element in the data to be mapped and each element in the data to be read, based on the difference between the target length L1 and the target length L2, the mapping information of each element in the data to be mapped, and the position of each element in the data to be mapped, specifically includes: Get the index number of each element in the data to be mapped within its own data group; Multiply the difference between the target length L1 and the target length L2 by Y1 in the mapping information of the corresponding element in the data to be mapped, and add the index number of the corresponding element to obtain the position pos in the data to be read corresponding to each element in the data to be mapped.

[0013] Preferably, the step of writing each element of the valid data into the corresponding position in the data to be mapped according to the positional correspondence to obtain the mapped data specifically includes: Get the position of each element of the valid data in the data to be read; Write each element of the valid data in the data to be read into the corresponding position pos in the data to be mapped to obtain the mapped data.

[0014] In a second aspect, a data extraction and remapping apparatus for enhancing DMA performance is provided, comprising at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the processor for performing the data extraction and remapping method for enhancing DMA performance.

[0015] Thirdly, the present invention also provides a non-volatile computer storage medium storing computer-executable instructions that are executed by one or more processors to perform the method described in the first aspect.

[0016] Fourthly, a chip is provided, comprising: a processor and an interface for calling and running a computer program stored in memory, performing the method as described in the first aspect.

[0017] Fifthly, a computer program product containing instructions is provided that, when executed on a computer or processor, causes the computer or processor to perform the method as described in the first aspect.

[0018] In a sixth aspect, a system for enhancing DMA performance through data extraction and remapping is provided, comprising a data extraction and remapping apparatus for enhancing DMA performance as described in the second aspect, and using a data extraction and remapping method for enhancing DMA performance as described in the first aspect.

[0019] This invention provides a data extraction and remapping method and apparatus to enhance DMA performance, comprising: converting source data from multidimensional data to one-dimensional data to obtain data to be read; generating corresponding data to be mapped based on the valid data in the data to be read; traversing each element in the data to be mapped, and obtaining the mapping information of each element in the data to be mapped based on the position of each element and the target length L2; obtaining the positional correspondence between each element in the data to be mapped and each element in the data to be read based on the difference between the target length L1 and the target length L2, the mapping information of each element in the data to be mapped, and the position of each element in the data to be mapped; and extracting and writing each element of the valid data in the data to be read into the data to be mapped. Based on the corresponding positions in the data, the mapping data is obtained. Since the relative positions of each element in the data to be read and the data to be mapped are obtained and calculated independently, this calculation process is not performed during the actual mapping process, but is completed in advance during the preparation stage. During the actual mapping, it is not necessary to calculate the position of each element. Therefore, during the mapping, the calculation of the mapping relationship between the elements in the data to be read and the data to be mapped does not depend on the mapping results of other elements. Thus, the elements in the data to be read and the data to be mapped can be calculated independently to extract the mapping, so that the calculation of each element can be performed in parallel, which improves the performance and efficiency of DMA acquisition of mapping data and can better meet the performance requirements of the GPU. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0021] Figure 1 This is a flowchart of a data extraction and remapping method to enhance DMA performance provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the mapping of one-dimensional and multi-dimensional data in a data extraction and remapping method for enhancing DMA performance provided in an embodiment of the present invention; Figure 3 This is a flowchart of a data extraction and remapping method for enhancing DMA performance provided in an embodiment of the present invention, which generates data to be mapped. Figure 4 This is a schematic diagram of the data to be read in a data extraction and remapping method for enhancing DMA performance provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of an embodiment of the present invention, in which the data to be mapped includes initial mapping information. Figure 6 This is a schematic diagram of a data extraction and remapping method for enhancing DMA performance provided in an embodiment of the present invention, in which the data to be mapped contains mapping information. Figure 7 This is a schematic diagram of a data extraction and remapping method for enhancing DMA performance provided in an embodiment of the present invention, in which the data to be mapped includes a position pos. Figure 8 This is a schematic diagram illustrating the acquisition of mapped data in a data extraction and remapping method for enhancing DMA performance provided in an embodiment of the present invention; Figure 9 This is a schematic diagram illustrating the mapping and extraction of valid data from the data to be mapped in a data extraction and remapping method for enhancing DMA performance provided in an embodiment of the present invention; Figure 10 This is a schematic diagram of a data extraction and remapping device for enhancing DMA performance provided in an embodiment of the present invention. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0023] In the description of this invention, it should be understood that the terms "center", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this disclosure.

[0024] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of embodiments of this disclosure, unless otherwise stated, "a plurality of" means two or more. Furthermore, for example, the description may use the prefix "A" or "B" to describe the same type of nouns as two independent entities. In this case, the corresponding features defined with "A" and "B" are used only to distinguish between similar entities and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features.

[0025] As used in this invention, “about,” “approximately,” or “approximately” includes the stated value and the average value within an acceptable range of deviation from a particular value, wherein the acceptable range of deviation is determined by a person skilled in the art taking into account the measurement under discussion and the error associated with the measurement of the particular quantity, i.e., the limitations of the measurement system.

[0026] Unless the context otherwise requires, throughout the specification and claims, the term "comprising" is interpreted as openly inclusive, meaning "including, but not limited to." In the description of the specification, terms such as "one embodiment," "some embodiments," "exemplary embodiment," "example," "specific example," or "some examples" are intended to indicate that a particular feature, structure, material, or characteristic associated with that embodiment or example is included in at least one embodiment or example of this disclosure. The illustrative representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics mentioned may be included in any suitable manner in any one or more embodiments or examples; that is, although they may be incorporated into embodiments or examples using the above terms for reasons such as order and position, it does not limit them to be incorporated in combination by a single embodiment or example.

[0027] Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0028] This invention provides a data extraction and remapping method to enhance DMA performance. The application scenario of this method is that when a GPU performs general-purpose computing, some parameters are prepared in the memory and accessed by the GPU to perform specified calculations. The source data is the parameter data in the aforementioned memory. However, because the format of the source data does not conform to the GPU's instruction requirements, it cannot be directly extracted for processing. Therefore, the method provided in this embodiment is used to extract valid data from the source data and map it to the target format. Figure 1 As shown, the method flow includes: In step 101, source data is retrieved from the memory and converted into one-dimensional data to obtain data to be read; wherein, the data to be read includes valid data.

[0029] In step 102, data to be mapped is generated based on the valid data, and the target length L1 of the data to be read and the target length L2 of the data to be mapped are obtained.

[0030] In this embodiment, the source data can be one-dimensional, two-dimensional, or three-dimensional data. To facilitate data processing and transformation, both two-dimensional and three-dimensional data need to be expanded into one-dimensional data. It should be noted that, as... Figure 2As shown, when the source data is one-dimensional, the source data includes one valid data point in the X direction (i.e., Figure 2 (sourceobject data) and a corresponding formatted data (i.e. Figure 2 (Source padding data); When the source data is two-dimensional, it includes multiple rows of data in the Y direction, each row containing one valid data and one corresponding formatted data. Converting two-dimensional data to one-dimensional data involves placing the multiple rows of data in the Y direction into the same row in the X direction according to their Y-direction order. When the source data is three-dimensional, it includes multiple rows of data in the Y direction and also multiple sets of two-dimensional data in the Z direction, each row containing one valid data and one corresponding formatted data. Converting three-dimensional data to one-dimensional data involves first converting each set of two-dimensional data in the Z direction using the method for converting two-dimensional data to one-dimensional data, then converting each set of one-dimensional data obtained after conversion in the Z direction again using the method for converting two-dimensional data to one-dimensional data, and placing all the data into the same row in the X direction. By using the above method, the source data is converted from multi-dimensional data to one-dimensional data, resulting in the data to be read.

[0031] In this embodiment, the valid data is the data that needs to be provided to the GPU for computation. Both the source data and the data to be read include valid data and the format data corresponding to the valid data. The format data does not need to be extracted to the GPU. In the data to be read, all valid data have the same length, and all format data have the same length. Each valid data and its corresponding format data form a group. The length of the valid data and its corresponding format data is the target length L1.

[0032] Correspondingly, the data to be mapped is used to write valid information into the data to be read, and the format of the data to be mapped ensures that the GPU can perform calculations smoothly; the data to be mapped includes the data to be written (i.e. Figure 2 The destination object data and its corresponding format data (i.e., Figure 2 The destination padding data in the data to be written is used to write valid data in the data to be read. Therefore, when generating the data to be mapped, it is necessary to ensure that the position of the data to be written corresponds to the valid information in the data to be read, and the length between the corresponding data to be written and the valid data also needs to be consistent to ensure that the subsequent data to be written has enough length to write the corresponding valid data. Therefore, the length of each data to be written in the data to be written is consistent, and the length of the format data corresponding to each data to be written in the data to be written is also consistent.

[0033] In this embodiment, the target length L1 is the sum of the length of a single valid data (i.e., a single source object data) and the length of the corresponding format data (i.e., a single source padding data appended to the single source object data); the target length L2 is the sum of the length of a single data to be written (i.e., a single destination object data) and the length of the corresponding format data (i.e., a single destination padding data). The unit of measurement for length can be bytes.

[0034] In step 103, each element in the data to be mapped is traversed, and the mapping information of each element in the data to be mapped is obtained according to the position of each element and the target length L2.

[0035] In this embodiment, the element is an information unit in the data to be mapped or read. Each element has the same length, which can be 2 bytes or 3 bytes, etc. It is important to note that the length of the element in the data to be mapped is the same as the length of the element in the data to be read. The elements are used to facilitate the mapping between the data to be read and the data to be mapped. By mapping each element of the valid data in the data to be read to each element of the data to be written in the data to be mapped, the corresponding information extraction and writing can be achieved.

[0036] It should be noted that the length of each element in the data to be mapped and the data to be read is the same (i.e., the same in bytes). Therefore, in this embodiment, the length of the data to be mapped and the length of the data to be read are both represented by the number of elements. Similarly, the length of the data to be written and the length of the formatted data in the data to be mapped are also represented by the number of elements, and the length of the valid data and the length of the formatted data in the data to be read are also represented by the number of elements.

[0037] In this embodiment, a single piece of data to be written and its corresponding format data in the data to be mapped are taken as a target group of target length L2. The mapping information of each element in the data to be mapped is: which target group each element in the data to be mapped is located in, and specifically which element in that target group, which represents the position information of each element in the data to be mapped.

[0038] In step 104, based on the difference between the target length L1 and the target length L2, the mapping information of each element in the data to be mapped, and the position of each element in the data to be mapped, the positional correspondence between each element in the data to be mapped and each element in the data to be read is obtained.

[0039] In step 105, each element of the valid data is written into the corresponding position in the data to be mapped according to the position correspondence, so as to obtain the mapped data.

[0040] In this embodiment, a single valid data and its corresponding format data in the data to be read are taken as a target group of target length L1. Since the length of the format data in the data to be read is different from the length of the format data in the data to be mapped, the length of the target group in the data to be read is different from the length of the target group in the data to be mapped. Therefore, the elements of the valid data in the data to be read cannot be directly mapped to the elements of the data to be written in the data to be mapped. It is necessary to adjust the position information of the elements in the data to be written in step 103 according to the difference in the length of the target group of the data to be read and the data to be mapped, so that each element in the data to be written can correspond to the corresponding element in the valid data, thereby achieving the corresponding extraction and correspondence.

[0041] In this embodiment, since each element in the data to be mapped is calculated to obtain its own position information, and the elements in the data to be mapped are mapped to the elements in the data to be read according to its own position information and the difference between the target length L1 and the target length L2, the calculation process of each element can be performed independently without relying on the previous element. Therefore, the calculation of all elements can be performed simultaneously, which greatly improves the calculation efficiency and reduces the computational performance.

[0042] Furthermore, in this embodiment, since the data to be mapped is used to extract valid data from the data to be read, the length of the generated data to be mapped must refer to the data to be read. Therefore, this embodiment involves the following design: The process involves generating data to be mapped based on the valid data, and obtaining the target length L1 of the data to be read and the target length L2 of the data to be mapped, as follows: Figure 3 As shown, the method flow includes: In step 201, all valid data and the format data corresponding to each valid data are obtained from the data to be read. The length a of a single valid data and the length b of the format data corresponding to the valid data are obtained. The sum of the lengths a and b is taken as the target length L1.

[0043] In step 202, data to be written is generated based on each of the valid data, wherein the length of the data to be written is equal to the length of the data to be written.

[0044] In step 203, corresponding format data is generated between adjacent data to be written to obtain the data to be mapped.

[0045] It should be noted in this embodiment that the format data generated between adjacent data to be written and the format data corresponding to the valid data are not the same data content. They are format-related data contents under two different data forms.

[0046] In step 204, the length c of a single piece of data to be written in the data to be mapped and the length d of the format data corresponding to the data to be written are obtained, and the sum of the lengths c and d is taken as the target length L2.

[0047] by Figure 4 For example, consider a set of data to be read, where each valid data has 3 elements and the corresponding format data for each valid data has 4 elements. Therefore, the target length L1 is 7 elements.

[0048] by Figure 5 For example, there are 32 elements in a set of data to be mapped. Each data to be written is also set to 3 elements. Corresponding format data is generated between adjacent data to be written. The length of each format data in the data to be mapped is 5 elements. Therefore, the target length L2 of the target group of the data to be mapped is 8 elements.

[0049] Furthermore, it is necessary to obtain the position information of each element in the data to be mapped within the data to be mapped, so as to facilitate subsequent mapping and correspondence with the valid data in the data to be read. Therefore, this embodiment also involves the following design: The process of traversing each element in the data to be mapped and obtaining the mapping information for each element based on its position and the target length L2 specifically includes: In this embodiment, the initial mapping information of each element in the data to be mapped is obtained based on the position of each element in the data to be mapped and the target length L2.

[0050] Specifically, the binary search method is used to divide the position of each element in the data to be mapped by the target length L2 to obtain the remainder X0 and the quotient Y0; the calculated values ​​of the remainder X0 and the quotient Y0 are used as the initial mapping information (Y0, X0) of the corresponding element.

[0051] Wherein, the remainder X0 is the nth target group in a set of data to be mapped in which the corresponding element is located, and the quotient Y0 is the nth element in the target group in which the corresponding element is located.

[0052] It's worth noting that while a divider could be used for the corresponding calculations, considering the larger performance resources and space required, a binary search method can be employed. This ensures computational efficiency while avoiding the performance overhead of using a divider. It should be noted that the above method can be tailored to performance requirements and manufacturing processes, breaking the process down into multiple clock cycles.

[0053] by Figure 5 For example, Figure 5 The data to be mapped contains three elements of data to be written, five elements of format data, and a target length L2 of eight elements. Figure 5 The fifth element from the left is at position 4. Therefore, dividing 4 by 8 gives a quotient of 0 and a remainder of 4. Thus, the initial mapping information for this element is (0,4).

[0054] Furthermore, the relative position of the first element in each data group in the data to be mapped is obtained. Based on the initial mapping information of each element, the relative position of the first element in the data group to which the corresponding element is located, and the target length L2, the mapping information of each element in the data to be mapped is obtained.

[0055] In this embodiment, obtaining the mapping information of each element in the data to be mapped based on the initial mapping information of each element, the relative position of the first element in the data group containing the corresponding element, and the target length L2 specifically includes: Add the relative position offset of the first element in the data group to the initial mapping information of each element (X0), and then divide by the target length L2 to obtain the remainder X1 and the quotient Y1; use the calculated remainder X1 and quotient Y1 as the mapping information (Y1, X1) of the corresponding element.

[0056] The step of obtaining the relative position of the first element in each data group in the data to be mapped specifically includes: The relative position offset of the first element in the first data group of the data to be mapped is 0; for other data groups after the first data group of the data to be mapped, the sum of X1 plus 1 in the mapping information of the last element in the previous data group of the corresponding data group is divided by the target length L2, and the remainder is the relative position offset of the first element in the corresponding data group.

[0057] It should be noted that in this embodiment, since the length of the generated data to be mapped is limited, the length of a set of data to be mapped is set by those skilled in the art. Figure 5 For example, the length of a set of data to be mapped can be 64 bytes, where the length of a single element is 2 bytes, so there are 32 elements in a set of data to be mapped.

[0058] The mapping information for each element in the data to be mapped is the position information of each element relative to itself in the group of data to be mapped. Therefore, the position information needs to be adjusted according to the relative position of the first element in the group of data to be mapped.

[0059] It is worth mentioning that the above method has low computational complexity, and each element can be calculated independently without having to be calculated sequentially according to the element order. This results in higher computational efficiency and lower performance requirements, making it applicable to high-frequency circuits.

[0060] like Figure 6 As shown, it is based on Figure 4 The data to be read is a set of data to be mapped, which contains mapping information.

[0061] Furthermore, after obtaining the mapping information of each element in the data to be mapped, it is necessary to match the mapping information of each element with the valid data in the data to be read, so as to facilitate the subsequent mapping and extraction of valid data. Therefore, this embodiment also involves the following design: The step of obtaining the positional correspondence between each element in the data to be mapped and each element in the data to be read, based on the difference between the target length L1 and the target length L2, the mapping information of each element in the data to be mapped, and the position of each element in the data to be mapped, specifically includes: obtaining the index number of each element in the data to be mapped in its own data group; multiplying the difference between the target length L1 and the target length L2 by Y1 in the mapping information of the corresponding element in the data to be mapped, and adding the index number of the corresponding element to obtain the position pos of each element in the data to be mapped corresponding to the position in the data to be read.

[0062] like Figure 7 As shown, Figure 7 The position pos of each element is obtained by calculating the corresponding formula for each element.

[0063] In this embodiment, the index number is the position of the corresponding element in the data to be mapped. The calculated position pos of each element in the data to be mapped is the position number of the element in the data to be read that needs to be mapped. However, it should be noted that although... Figure 7 Each element is labeled with a position pos. However, during subsequent mapping, only the elements in the data to be written need to be mapped to the elements of the valid data to be read based on their own position pos. Elements of the formatted data in the data to be mapped do not need to be mapped.

[0064] It should be noted that since the division operation has already been completed in the previous steps, the logic level corresponding to this step can be optimized, and the timing can be improved accordingly.

[0065] Furthermore, in this embodiment, after obtaining the position pos in the data to be read corresponding to each element in the data to be mapped, each element of the valid data can be extracted and mapped to the corresponding element in the data to be mapped based on the position pos. Therefore, this embodiment also involves the following design: The process involves writing each element of the valid data into the corresponding position in the data to be mapped according to the positional correspondence, thereby obtaining the mapped data, such as... Figure 8 As shown, the specific method flow includes: In step 301, the position of each element of the valid data in the data to be read is obtained.

[0066] In step 302, each element of the valid data in the data to be read is written into the element at the corresponding position pos in the data to be mapped, thereby obtaining the mapped data.

[0067] like Figure 9 As shown, Figure 9 The upstream data is the data to be read, and the downstream data is the data to be mapped. Figure 9 The arrows in the text indicate that valid data has been collected and mapped to the corresponding elements in the data to be written.

[0068] like Figure 10 The diagram shown is a schematic representation of a data extraction and remapping apparatus for enhancing DMA performance according to an embodiment of the present invention. This data extraction and remapping apparatus for enhancing DMA performance includes one or more processors 41 and a memory 42.

[0069] Processor 41 and memory 42 can be connected via a bus or other means. Figure 10 Taking the example of a connection between China and Israel via a bus.

[0070] The memory 42, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs and non-volatile computer-executable programs, such as the data extraction and remapping method for enhancing DMA performance in the above embodiments. The processor 41 executes the data extraction and remapping method for enhancing DMA performance by running the non-volatile software program and instructions stored in the memory 42.

[0071] Memory 42 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 42 may optionally include memory remotely located relative to processor 41, which can be connected to processor 41 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0072] The program instructions / modules are stored in the memory 42. When executed by one or more processors 41, they perform the data extraction and remapping method for enhancing DMA performance in the above embodiments, for example, by performing the steps shown in the flowcharts described above.

[0073] This invention also provides a computer storage medium storing computer program instructions; when executed by a processor, the computer program instructions implement the data extraction and remapping method for enhanced DMA performance provided in this invention.

[0074] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A data extraction and remapping method to enhance DMA performance, characterized in that, include: The source data is retrieved from the memory and converted into one-dimensional data to obtain the data to be read; wherein, the data to be read includes valid data; Based on the valid data, generate the data to be mapped, and obtain the target length L1 of the data to be read and the target length L2 of the data to be mapped; Iterate through each element in the data to be mapped, and obtain the mapping information of each element in the data to be mapped based on the position of each element and the target length L2; Based on the difference between the target length L1 and the target length L2, the mapping information of each element in the data to be mapped, and the position of each element in the data to be mapped, obtain the positional correspondence between each element in the data to be mapped and each element in the data to be read. According to the position correspondence, each element of the valid data is written into the corresponding position in the data to be mapped to obtain the mapped data.

2. The data extraction and remapping method for enhancing DMA performance according to claim 1, characterized in that, The step of generating the data to be mapped based on the valid data, and obtaining the target length L1 of the data to be read and the target length L2 of the data to be mapped, specifically includes: Obtain all valid data and the format data corresponding to each valid data in the data to be read; obtain the length a of a single valid data in the data to be read and the length b of the format data corresponding to the valid data; and use the sum of the lengths a and b as the target length L1. Data to be written is generated based on each of the valid data, wherein the length of the data to be written is equal to the length of the data to be written. Generate corresponding formatted data between adjacent data to be written to obtain the data to be mapped; Obtain the length c of a single piece of data to be written in the data to be mapped and the length d of the format data corresponding to the data to be written. Use the sum of the lengths c and d as the target length L2.

3. The data extraction and remapping method for enhancing DMA performance according to claim 1, characterized in that, The process of traversing each element in the data to be mapped and obtaining the mapping information for each element based on its position and the target length L2 specifically includes: The initial mapping information for each element in the data to be mapped is obtained based on the position of each element in the data to be mapped and the target length L2. Obtain the relative position of the first element in each data group of the data to be mapped. Based on the initial mapping information of each element, the relative position of the first element in the data group to which the corresponding element belongs, and the target length L2, obtain the mapping information of each element in the data to be mapped.

4. The data extraction and remapping method for enhancing DMA performance according to claim 3, characterized in that, The step of obtaining the initial mapping information for each element in the data to be mapped based on the position of each element and the target length L2 specifically includes: The binary search method is used to divide the position of each element in the data to be mapped by the target length L2 to obtain the remainder X0 and the quotient Y0. The calculated remainder X0 and quotient Y0 are used as the initial mapping information (Y0, X0) for the corresponding elements.

5. The data extraction and remapping method for enhancing DMA performance according to claim 4, characterized in that, The step of obtaining the mapping information of each element in the data to be mapped based on the initial mapping information of each element, the relative position of the first element in the data group to which the corresponding element belongs, and the target length L2 specifically includes: Add the relative position offset of the first element in the data group where the corresponding element is located to the initial mapping information of each element X0, and then divide by the target length L2 to obtain the remainder X1 and the quotient Y1. The calculated remainder X1 and quotient Y1 are used as the mapping information (Y1, X1) of the corresponding elements.

6. The data extraction and remapping method for enhancing DMA performance according to claim 4, characterized in that, The step of obtaining the relative position of the first element in each data group in the data to be mapped specifically includes: The offset of the first element in the first data group of the data to be mapped is 0; For the data groups after the first data group in the data to be mapped, the sum of X1 plus 1 in the mapping information of the last element in the preceding data group of the corresponding data group is divided by the target length L2, and the remainder is the relative position offset of the first element in the corresponding data group.

7. The data extraction and remapping method for enhancing DMA performance according to claim 6, characterized in that, The step of obtaining the positional correspondence between each element in the data to be mapped and each element in the data to be read, based on the difference between the target length L1 and the target length L2, the mapping information of each element in the data to be mapped, and the position of each element in the data to be mapped, specifically includes: Get the index number of each element in the data to be mapped within its own data group; Multiply the difference between the target length L1 and the target length L2 by Y1 in the mapping information of the corresponding element in the data to be mapped, and add the index number of the corresponding element to obtain the position pos in the data to be read corresponding to each element in the data to be mapped.

8. The data extraction and remapping method for enhancing DMA performance according to claim 7, characterized in that, The step of writing each element of the valid data into the corresponding position in the data to be mapped according to the position correspondence to obtain the mapped data specifically includes: Get the position of each element of the valid data in the data to be read; Write each element of the valid data in the data to be read into the corresponding position pos in the data to be mapped to obtain the mapped data.

9. A data extraction and remapping apparatus for enhancing DMA performance, characterized in that, The method includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor for performing the data extraction and remapping method for enhancing DMA performance as described in any one of claims 1-8.

10. A non-volatile computer storage medium, characterized in that, The computer storage medium stores computer program instructions that, when executed by one or more processors, implement the data extraction and remapping method for enhancing DMA performance as described in any one of claims 1-8.