Non-continuous data reading and writing processing method, system, electronic device and storage medium
By transposing the calculation dimensions of non-continuous data in the AI chip, the data read and write operations are converted into continuous data read and write operations, the problem of slow read and write rates during non-continuous data calculation in the AI chip is solved, and the computing efficiency is improved.
Patent Information
- Application Number
- CN202411755870.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-12-03
AI Technical Summary
During the calculation process of AI chip, when performing calculation operations on discontinuous data, the data read and write rate is slow, resulting in a decrease in computing efficiency.
By judging whether the calculation operation of discontinuous data is a calculation of a single dimension, if not, the dimension to be calculated is transposed into the first dimension, and the data read and write operations are performed based on the first dimension, and the result is finally transposed back to the original dimension.
The data read and write operations of non-continuous data are converted into data read and write operations of continuous data, which avoids idle waiting for data when calculated internally by the chip, improves the read and write rate, thereby improving the computing efficiency and utilization of the chip.
Smart Images

Figure CN119225683B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of chip-based data reading and writing, and in particular to a method, system, electronic device and storage medium for reading and writing non-continuous data. Background Art
[0002] With the development of artificial intelligence technology, the application scope of artificial intelligence chips (AI chips) is becoming wider and wider. AI chips are specifically used to accelerate the reasoning process of AI models. The accelerated AI models are generally based on deep learning models. Deep learning models usually include a large number of computing operations, and each computing operation requires frequent data reading and writing to the AI chip. Frequent data reading and writing is an important factor affecting the computing efficiency of AI chips.
[0003] Continuous data is data stored at consecutive physical addresses inside a computer, while non-continuous data is data that does not have storage continuity inside a computer. The read and write speed of continuous data is usually much greater than the read and write speed of non-continuous data.
[0004] The inventors discovered that during the calculation process of the AI chip, since the data reading and writing operations are performed almost simultaneously with the data calculation operations, when the target read data is non-continuous data inside the computer, the calculation operation will be interrupted and will be in a state of waiting for data reading. This will significantly increase the time consumption of the calculation operation and slow down the data reading and writing rate, thereby affecting the calculation efficiency of the AI chip. Summary of the invention
[0005] The present invention provides a method, system, electronic device and storage medium for reading and writing non-continuous data, which are used to solve the problem of slow data reading and writing rate when performing calculation operations on non-continuous data during the calculation process of a chip (such as an AI chip).
[0006] One aspect of the present invention provides a method for reading and writing non-continuous data, including: determining non-continuous data in a target chip; judging whether a calculation operation of the non-continuous data is a calculation on a single dimension; if the calculation operation of the non-continuous data is a calculation on a single dimension, judging whether the dimension to be calculated of the calculation operation is a calculation on a first dimension; if the dimension to be calculated of the calculation operation is not a calculation on the first dimension, transposing the dimension to be calculated of the non-continuous data to the first dimension; performing data reading and writing operations on the non-continuous data based on the first dimension to obtain a first output result; transposing the first dimension data of the first output result back to the dimension to be calculated to obtain a target output result.
[0007] According to some embodiments of the present invention, the read / write processing method further includes: when the calculation operation of the non-continuous data is not a calculation on a single dimension, traversing and executing all dimensions of the non-continuous data.
[0008] According to some embodiments of the present invention, when the dimension to be calculated in the calculation operation is the first dimension to be calculated, data read and write operations are directly performed on non-continuous data based on the first dimension to generate a target output result.
[0009] According to some embodiments of the present invention, the computing operation includes at least one of a data concatenation operation, a dimensionality reduction sum operation, and a normalized index operation.
[0010] Another aspect of the present invention provides a non-continuous data read and write processing system, including a dimension processing module and a read and write processing module. The dimension processing module determines the non-continuous data in the target chip, determines whether the calculation operation of the non-continuous data is a calculation of a single dimension, and if the calculation operation of the non-continuous data is a calculation of a single dimension, determines whether the dimension to be calculated of the calculation operation is a calculation of the first dimension, and if the dimension to be calculated of the calculation operation is not a calculation of the first dimension, transposes the dimension to be calculated of the non-continuous data to the first dimension; the read and write processing module performs data read and write operations on the non-continuous data based on the first dimension to obtain a first output result, and transposes the first dimension data of the first output result back to the dimension to be calculated to obtain a target output result.
[0011] According to some embodiments of the present invention, when the calculation operation of the non-continuous data is not a calculation on a single dimension, the dimension processing module traverses and executes all dimensions of the non-continuous data.
[0012] According to some embodiments of the present invention, when the dimension to be calculated in the calculation operation is the first dimension, the read / write processing module directly performs data read / write operations on non-continuous data based on the first dimension to generate a target output result.
[0013] According to some embodiments of the present invention, the computing operation includes at least one of a data concatenation operation, a dimensionality reduction sum operation, and a normalized index operation.
[0014] According to another aspect of the present invention, an electronic device is provided, which includes: one or more processors; and a storage device for storing one or more programs, so that when the one or more programs are executed by the one or more processors, the one or more processors can implement the read and write processing method described above.
[0015] According to another aspect of the present invention, a non-volatile computer-readable storage medium is provided, wherein a computer program is stored on the storage medium, and when the computer program is executed by a processor, the read-write processing method described above can be implemented.
[0016] In the present invention, when the dimension to be calculated of the calculation operation is not the first dimension, the dimension to be calculated of the non-continuous data is transposed to the first dimension, and then data read and write operations are performed on the non-continuous data based on the first dimension to obtain a first output result, and the first dimension data of the first output result is transposed back to the dimension to be calculated to obtain the target output result.
[0017] The present invention converts the data reading and writing operations of non-continuous data into data reading and writing operations of continuous data by transposing the calculation dimension of non-continuous data, thereby avoiding the problem of slow reading and writing rate caused by idle waiting when data is calculated inside the chip, thereby improving the calculation efficiency and utilization of the chip. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0019] Figure 1 A flow chart showing a read-write processing method according to an embodiment of the present invention;
[0020] Figure 2 Another flow chart showing the read-write processing method according to an embodiment of the present invention;
[0021] Figure 3 Another flow chart showing the read-write processing method according to an embodiment of the present invention;
[0022] Figure 4 A schematic diagram showing a comparison of data read and write rates according to an embodiment of the present invention;
[0023] Figure 5 A schematic diagram showing the structure of a read-write processing system according to an embodiment of the present invention is shown.
[0024] Description of reference numerals:
[0025] Read-write processing system 1; dimension processing module 10; read-write processing module 20. DETAILED DESCRIPTION
[0026] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the present invention will be comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0027] The described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of these specific details, or other modes, components, materials, devices, etc. may be adopted. In these cases, known structures, methods, devices, implementations, materials or operations will not be shown or described in detail.
[0028] In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0029] The terms "first", "second" and the like in the specification, claims and the above drawings of the present invention are used to distinguish different objects rather than to describe a specific order.
[0030] The following is a clear and complete description of the technical solution of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0031] The full names of the English abbreviations involved in the present invention and their Chinese meanings are:
[0032] AI chip: Artificial Intelligence, artificial intelligence chip.
[0033] ViT: Visual Transformer Model;
[0034] CSwin: Cross-window based self-attention model;
[0035] DETR: Transformer Model for Detection Tasks;
[0036] SwinV2: Sliding window based transformer model - 2nd version.
[0037] According to one aspect of the present invention, the present invention provides a method for reading and writing non-continuous data, which is used to solve the problem of slow data reading and writing rates when performing calculation operations on non-continuous data during the calculation process of AI chips.
[0038] Figure 1 A flow chart of the read-write processing method according to an embodiment of the present invention is shown. Figure 1 As shown, the read / write processing method includes steps S100, S200, S300A, S400A, S500 and S600. Exemplarily, the read / write processing method can be executed by a read / write processing system for non-continuous data with computing capability.
[0039] According to an example embodiment, in step S100 , the read / write processing system determines non-contiguous data in a target chip.
[0040] For example, the target chip may be an AI chip, and the non-continuous data may be data that does not have storage continuity inside a computer.
[0041] The read / write processing system determines non-continuous data in the input data of the AI chip. The input data can be intermediate data required for any AI model to perform calculations or reasoning. The input data includes, but is not limited to, image data used in application scenarios such as image recognition tasks, image generation tasks, image restoration tasks, image segmentation tasks, image classification tasks, object detection tasks, video tracking tasks, speech recognition tasks, and machine translation tasks.
[0042] Exemplarily, the input data may be image data of a size of [1, 224, 224, 3], that is, the input data may be image data of a height of 224, a width of 224, and a number of channels of 3.
[0043] It can be understood here that the input data can also be three-dimensional text data or five-dimensional video data and other types of data, and the present invention is not limited to this.
[0044] Exemplarily, the input data may be three-dimensional text data of a size of [1, 5, 10], that is, the input data may be a sentence containing 5 words, and the feature dimension of each word is 10.
[0045] Exemplarily, the input data may be five-dimensional video data of a size of [1, 8, 224, 224, 3], that is, the input data may be a video sequence of 8 frames in length, and each frame image may be five-dimensional video data of a height of 224 and a length of 224.
[0046] In step S200, the read-write processing system determines whether the calculation operation of non-continuous data is a calculation of a single dimension.
[0047] Optionally, the calculation operation includes at least one of a data concatenation operation, a dimensionality reduction summation operation, and a normalized index operation.
[0048] For example, the computing operations (OP) of non-continuous data include but are not limited to data concatenation operations (Concatenate), dimensionality reduction sum operations (Reduce Sum), normalized exponential operations (Softmax), and other operations.
[0049] The data transposition operation refers to converting multi-dimensional data between different dimensions; the data concatenation operation refers to merging multiple data in a specified dimension; the dimensionality reduction and summation operation refers to summing the data in a specified dimension; the normalized exponent operation refers to normalizing the data of a specified dimension into a probability distribution, etc.
[0050] For example, a single dimension refers to a dimension in multidimensional data. Exemplarily, a single dimension of two-dimensional data may be a row dimension or a column dimension.
[0051] It can be understood here that the data transposition operation can only transpose one dimension to the first position each time, so the present invention needs to determine whether to calculate a single dimension.
[0052] Exemplarily, the read-write processing system determines whether the current calculation operation OP of non-continuous data is a calculation on a single dimension. If it is a calculation on a single dimension, it enters step S300A; if it is not a calculation on a single dimension, it enters step S300B.
[0053] In step S300A, when the calculation operation of non-continuous data is a calculation of a single dimension, the read-write processing system determines whether the dimension to be calculated of the calculation operation is a calculation of the first dimension.
[0054] For example, the first dimension refers to the first dimension of multidimensional data. For example, the first dimension of two-dimensional data of size [4, 8] is a dimension of size 4.
[0055] Exemplarily, the read-write processing system determines whether the dimension to be calculated of the current non-continuous data calculation operation OP is the calculation of the first dimension. If it is not the calculation of the first dimension, it enters step S400A; if it is the calculation of the first dimension, it enters step S400B.
[0056] In step S400A, when the dimension to be calculated of the calculation operation is not the first dimension, the read-write processing system transposes the dimension to be calculated of the non-continuous data to the first dimension.
[0057] For example, the dimension to be calculated for the calculation operation of the non-continuous data is the nth dimension, and the read / write processing system transposes the nth dimension to the first dimension through a data transposition operation to perform corresponding data read / write operations on the first dimension.
[0058] In step S500, the read / write processing system performs data read / write operations on non-continuous data based on the first dimension to obtain a first output result.
[0059] In step S600, the read-write processing system transposes the first dimension data of the first output result back to the dimension to be calculated to obtain the target output result.
[0060] For example, the read-write processing system performs corresponding data read-write operations on the first dimension to obtain a first output result, and then the read-write processing system transposes the first dimension data of the first output result back to the original dimension to be calculated (i.e., the nth dimension) again. In this way, the present invention can transpose the data read-write operations of non-continuous data into data read-write operations of continuous data through conversion between data dimensions.
[0061] For example, taking the size of the non-continuous data as [32, 32, 3], the calculation operation of the non-continuous data is a dimensionality reduction summation operation on the last dimension of the non-continuous data. The read-write processing system transposes the non-continuous data to a size of [3, 32, 32], and then performs a dimensionality reduction summation operation on the first dimension to obtain an output result of size [1, 32, 32] (i.e., the first output result). The read-write processing system then transposes the first dimension data of the output result of size [1, 32, 32] to the last dimension mentioned above, and obtains a final result of size [32, 32, 1] (i.e., the target output result).
[0062] Figure 2 Another flow chart of the read / write processing method according to the embodiment of the present invention is shown.
[0063] Alternatively, if Figure 2 As shown, in step S300B, when the calculation operation of the non-continuous data is not a calculation of a single dimension, the read-write processing system traverses and executes all dimensions of the calculation operation of the non-continuous data.
[0064] For example, when the calculation operation of non-continuous data is a calculation on multiple dimensions, the read / write processing system loops and executes each dimension in sequence.
[0065] For example, if the size of the non-continuous data is [32, 32, 3], and the calculation operation of the non-continuous data is to perform a dimensionality reduction sum operation on the first dimension and the second dimension of the non-continuous data, then the read-write processing system first uses the calculation operation as a subsequent read-write processing method for the calculation of the first dimension (such as the read-write processing method for non-continuous data described above) until the output result is obtained. Then, the second dimension is traversed, and the read-write processing system uses the calculation operation as a subsequent read-write processing method for the calculation of the second dimension until the output result is obtained. Until the read-write processing system traverses and executes all dimensions of the non-continuous data.
[0066] Figure 3 Another flow chart of the read / write processing method according to the embodiment of the present invention is shown.
[0067] Alternatively, if Figure 3 As shown, in step S400B, when the dimension to be calculated in the calculation operation is the first dimension, the read-write processing system directly performs data read-write operations on non-continuous data based on the first dimension to generate a target output result.
[0068] For example, the read / write processing system directly performs corresponding data read / write operations based on the first dimension and directly generates the target output result.
[0069] What can be understood here is that the reading and writing rate of continuous data in AI chips is much greater than that of non-continuous data.
[0070] For example, taking data of size 2x5 as an example, the data distribution (logical distribution) of the data can be:
[0071]
[0072] Logical distribution refers to the data distribution understood by humans, and physical distribution refers to the data distribution when the computer stores it. Obviously, the data is stored linearly inside the computer. When reading the data of the second dimension, it will be read column by column based on the data in the logical distribution, that is, the reading order is [0, 5, 1, 6, 2, 7, 3, 8, 4, 9]. This reading order is a discontinuous reading order in the physical distribution. Therefore, the data reading speed will be significantly reduced during the data reading process.
[0073] The present invention transposes the data into 5x2 data, that is, transposes the first dimension and the second dimension of the data. The logical distribution of the transposed data can be:
[0074]
[0075] And the corresponding physical distribution of the data after transposition is:
[0076]
[0077] It can be seen that when the data is read in the order of [0, 5, 1, 6, 2, 7, 3, 8, 4, 9], the reading order is a continuous reading order in the physical distribution, and the reading speed will be significantly higher than the reading of the above non-continuous data.
[0078] In the calculation operation of the AI chip, data is calculated while being read. Therefore, the present invention can avoid the cyclic waiting time during calculation through a one-time data transfer operation, and can significantly reduce the calculation time during data reading.
[0079] Figure 4 A schematic diagram showing a comparison of data read and write rates according to an embodiment of the present invention.
[0080] like Figure 4 As shown, taking multiple AI computing models (such as ViT, CSwin, DETR, SwinV2 and other models) as an example, based on the same input data, the data reading and writing rate tests are compared between the existing original computing model and the optimized computing model optimized by the reading and writing processing method provided by the present invention.
[0081] For example, the input data can be an image data of size 224x224x3, and a single-thread test is performed. The time consumption of the optimized calculation model refers to the time consumption after all the calculation operations of non-continuous data in the original calculation model are optimized for reading and writing according to the read-write processing method provided by the present invention; the number of calculation optimizations refers to the total number of calculation operations applicable to the read-write processing method of the present invention.
[0082] like Figure 4 As shown in the figure, the reasoning time of all AI computing models is reduced after read-write optimization, and the more computing optimizations are performed, the better the effect of read-write optimization.
[0083] Through the above embodiments, when the dimension to be calculated of the calculation operation is not the first dimension, the present invention transposes the dimension to be calculated of the non-continuous data to the first dimension, and then performs data read and write operations on the non-continuous data based on the first dimension to obtain a first output result, and transposes the first dimension data of the first output result back to the dimension to be calculated to obtain the target output result.
[0084] The present invention converts the data reading and writing operations of non-continuous data into data reading and writing operations of continuous data by transposing the calculation dimensions of the target non-continuous data, thereby avoiding the problem of slow reading and writing rates caused by idle waiting when the data is calculated inside the chip, thereby improving the calculation efficiency and utilization of the chip.
[0085] According to another aspect of the present invention, the present invention provides a non-continuous data reading and writing processing system for solving the problem of slow data reading and writing rate when performing calculation operations on non-continuous data during the calculation process of the AI chip.
[0086] Figure 5 FIG. 2 is a schematic diagram showing the structure of a read / write processing system according to an embodiment of the present invention. Figure 5 As shown, the read-write processing system 1 may include a dimension processing module 10 and a read-write processing module 20 .
[0087] According to an example embodiment, the dimension processing module 10 determines non-contiguous data in a target chip.
[0088] For example, the target chip may be an AI chip, and the non-continuous data may be data that does not have storage continuity inside a computer.
[0089] The dimension processing module 10 determines non-continuous data in the input data of the AI chip. The input data can be intermediate data required for any AI model to perform calculation or reasoning. The input data includes, but is not limited to, image data for application scenarios such as image recognition tasks, image generation tasks, image restoration tasks, image segmentation tasks, image classification tasks, object detection tasks, video tracking tasks, speech recognition tasks, and machine translation tasks.
[0090] Exemplarily, the input data may be image data of a size of [1, 224, 224, 3], that is, the input data may be image data of a height of 224, a width of 224, and a number of channels of 3.
[0091] It can be understood here that the input data can also be three-dimensional text data or five-dimensional video data and other types of data, and the present invention is not limited to this.
[0092] Exemplarily, the input data may be three-dimensional text data of a size of [1, 5, 10], that is, the input data may be a sentence containing 5 words, and the feature dimension of each word is 10.
[0093] Exemplarily, the input data may be five-dimensional video data of a size of [1, 8, 224, 224, 3], that is, the input data may be a video sequence of 8 frames in length, and each frame image may be five-dimensional video data of a height of 224 and a length of 224.
[0094] According to an example embodiment, the dimension processing module 10 determines whether the calculation operation of non-continuous data is a calculation on a single dimension.
[0095] Optionally, the calculation operation includes at least one of a data concatenation operation, a dimensionality reduction summation operation, and a normalized index operation.
[0096] For example, the computing operations (OP) of non-continuous data include but are not limited to data transposition operations (Transpose), data concatenation operations (Concatenate), dimensionality reduction and summation operations (Reduce Sum), normalized exponential operations (Softmax), and other operations.
[0097] The data transposition operation refers to converting multi-dimensional data between different dimensions; the data concatenation operation refers to merging multiple data in a specified dimension; the dimensionality reduction and summation operation refers to summing the data in a specified dimension; the normalized exponent operation refers to normalizing the data of a specified dimension into a probability distribution, etc.
[0098] For example, a single dimension refers to a dimension in multidimensional data. Exemplarily, a single dimension of two-dimensional data may be a row dimension or a column dimension.
[0099] It can be understood here that the data transposition operation can only transpose one dimension to the first position each time, so the present invention needs to determine whether to calculate a single dimension.
[0100] According to an example embodiment, when the calculation operation of non-continuous data is a calculation of a single dimension, the dimension processing module 10 determines whether the dimension to be calculated of the calculation operation is a calculation of the first dimension.
[0101] For example, the first dimension refers to the first dimension of multidimensional data. For example, the first dimension of two-dimensional data of size [4, 8] is a dimension of size 4.
[0102] According to an example embodiment, when the dimension to be calculated of the calculation operation is not the first dimension, the dimension processing module 10 transposes the dimension to be calculated of the non-continuous data to the first dimension.
[0103] For example, the dimension to be calculated for the calculation operation of the non-continuous data is the nth dimension, and the dimension processing module 10 transposes the nth dimension to the first dimension through a data transposition operation to perform corresponding data reading and writing operations on the first dimension.
[0104] According to an example embodiment, the read / write processing module 20 performs data read / write operations on non-continuous data based on the first dimension to obtain a first output result.
[0105] The read-write processing module 20 transposes the first dimension data of the first output result back to the dimension to be calculated to obtain the target output result.
[0106] For example, the read / write processing module 20 performs corresponding data read / write operations on the first dimension to obtain a first output result, and then the read / write processing module 20 transposes the first dimension data of the first output result back to the original dimension to be calculated (i.e., the nth dimension) again. In this way, the present invention can transpose the data read / write operations of non-continuous data into the data read / write operations of continuous data through conversion between data dimensions.
[0107] Exemplarily, taking the size of the non-continuous data as [32, 32, 3] as an example, the calculation operation of the non-continuous data is a dimensionality reduction summation operation on the last dimension of the non-continuous data. Then the read-write processing module 20 transposes the non-continuous data to a size of [3, 32, 32], and then performs a dimensionality reduction summation operation on the first dimension to obtain an output result of size [1, 32, 32] (i.e., the first output result). Then the read-write processing module 20 transposes the first dimension data of the output result of size [1, 32, 32] to the above-mentioned last dimension to obtain a final result of size [32, 32, 1] (i.e., the target output result).
[0108] Optionally, when the calculation operation of the non-continuous data is not a calculation on a single dimension, the dimension processing module 10 traverses and executes all dimensions of the calculation operation of the non-continuous data.
[0109] For example, when the calculation operation of non-continuous data is a calculation on multiple dimensions, the dimension processing module 10 loops and executes each dimension in turn.
[0110] Exemplarily, taking the size of the non-continuous data as [32, 32, 3] as an example, the calculation operation of the non-continuous data is to perform a dimensionality reduction sum operation on the first dimension and the second dimension of the non-continuous data, then the dimension processing module 10 first uses the calculation operation as a subsequent read-write processing method for the calculation of the first dimension (such as the read-write processing method for non-continuous data described above) until the output result is obtained. Then, the second dimension is traversed, and the dimension processing module 10 uses the calculation operation as a subsequent read-write processing method for the calculation of the second dimension until the output result is obtained. Until the dimension processing module 10 traverses and executes all dimensions of the non-continuous data.
[0111] Optionally, when the dimension to be calculated in the calculation operation is the first dimension, the read / write processing module 20 directly performs data read / write operations on non-continuous data based on the first dimension to generate a target output result.
[0112] For example, the read / write processing module 20 directly performs corresponding data read / write operations based on the first dimension and directly generates a target output result.
[0113] Through the above embodiments, when the dimension to be calculated of the calculation operation is not the first dimension, the present invention transposes the dimension to be calculated of the non-continuous data to the first dimension, and then performs data read and write operations on the non-continuous data based on the first dimension to obtain a first output result, and transposes the first dimension data of the first output result back to the dimension to be calculated to obtain the target output result.
[0114] The present invention can convert data read and write operations of non-continuous data into data read and write operations of continuous data by transposing the calculation dimension of the target non-continuous data, thereby avoiding the problem of slow read and write rate caused by idle waiting when the data is calculated inside the chip, thereby improving the calculation efficiency and utilization of the chip.
[0115] According to another aspect of the present invention, an electronic device is provided, which includes: one or more processors; and a storage device for storing one or more programs, so that when the one or more programs are executed by the one or more processors, the one or more processors can implement the read and write processing method described above.
[0116] According to another aspect of the present invention, a non-volatile computer-readable storage medium is provided, wherein a computer program is stored on the storage medium, and when the computer program is executed by a processor, the read-write processing method described above can be implemented.
[0117] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions of the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for reading and writing non-continuous data, characterized in that: include: Determine non-contiguous data in the target chip; Determining whether the calculation operation of the non-continuous data is a calculation of a single dimension; In the case where the calculation operation of the non-continuous data is a calculation of the single dimension, determining whether the dimension to be calculated of the calculation operation is a calculation of the first dimension; In a case where the dimension to be calculated of the calculation operation is not the first dimension, transposing the dimension to be calculated of the non-continuous data to the first dimension; Performing a data read and write operation on the non-continuous data based on the first dimension to obtain a first output result; Transpose the first dimension data of the first output result back to the dimension to be calculated to obtain the target output result; The read-write processing method also includes: In a case where the calculation operation of the non-continuous data is not a calculation on the single dimension, all dimensions of the non-continuous data are traversed and executed.
2. The read-write processing method according to claim 1, characterized in that: The read-write processing method also includes: In the case where the dimension to be calculated of the calculation operation is the first dimension to be calculated, the data reading and writing operation is directly performed on the non-continuous data based on the first dimension to generate the target output result.
3. The read-write processing method according to claim 1, characterized in that: The calculation operation includes at least one of a data concatenation operation, a dimensionality reduction summation operation and a normalized index operation.
4. A non-continuous data reading and writing processing system, characterized in that: include: a dimension processing module, determining non-continuous data in a target chip, determining whether a calculation operation of the non-continuous data is a calculation on a single dimension, and if the calculation operation of the non-continuous data is a calculation on the single dimension, determining whether the dimension to be calculated of the calculation operation is a calculation on the first dimension, and if the dimension to be calculated of the calculation operation is not a calculation on the first dimension, transposing the dimension to be calculated of the non-continuous data to the first dimension; A read / write processing module performs a data read / write operation on the non-continuous data based on the first dimension to obtain a first output result, and transposes the first dimension data of the first output result back to the dimension to be calculated to obtain a target output result; When the calculation operation of the non-continuous data is not a calculation on the single dimension, the dimension processing module traverses and executes all dimensions of the non-continuous data.
5. The read-write processing system according to claim 4, characterized in that: When the dimension to be calculated in the calculation operation is the first dimension, the read / write processing module directly performs data read / write operations on the non-continuous data based on the first dimension to generate the target output result.
6. The read-write processing system according to claim 4, characterized in that: The calculation operation includes at least one of a data concatenation operation, a dimensionality reduction summation operation and a normalized index operation.
7. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the read-write processing method as described in any one of claims 1-3.
8. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the read-write processing method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Three-dimensional convolution operation device and three-dimensional convolution operation method
CN114969640A