A data processing method, apparatus, device, medium and system

By using parallel transmission methods and data processing technology, the problems of high data bandwidth consumption and interruption of the operation process in large matrix multiplication operations are solved, and efficient matrix operation and transmission are combined.

CN119669627BActive Publication Date: 2025-12-05HUNAN GOKE MICROELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411789238.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-12-05
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

Existing technologies suffer from high data bandwidth consumption and low computational efficiency when performing large matrix multiplication operations due to limitations in device computing power and data transmission capabilities. Furthermore, time-sharing serial transmission can lead to interruptions in the computation process.

Method used

Parallel transmission is adopted, and multiplication and addition operations are performed by reading submatrices of the matrix in the row or column direction. When reading submatrices of other rows or columns, the submatrices read in the previous round are reused to save transmission bandwidth and transmit the results of the previous round of operations, thus ensuring that the operation is carried out continuously.

Benefits of technology

It effectively improves the efficiency of matrix operations, avoids interruptions in the operation process, saves transmission bandwidth, and achieves an efficient combination of data transmission and operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669627B_ABST
    Figure CN119669627B_ABST
Patent Text Reader

Abstract

The application relates to a data processing method, device, equipment, medium and system. Data includes a first matrix and a second matrix, and the first matrix and the second matrix can be multiplied. In the application, while reading all new first sub-matrices of other rows in the first matrix in a row direction, a second sub-matrix read in a previous round is reused, or while reading all new second sub-matrices of other columns in the second matrix in a column direction, a first sub-matrix read in the previous round is reused. The bandwidth for transmitting one sub-matrix can be saved, the saved bandwidth can be used to transmit a third sub-matrix obtained through a previous round of operation, and thus the data transmission bandwidth can be set to the width of simultaneous transmission of two sub-matrices in the operation process, data can be transmitted in a parallel transmission mode, the flow of matrix operation is not interrupted, and thus the operation efficiency can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the field of image processing, images are generally represented as matrix data for processing. However, due to limitations in the computing power and data transmission capabilities of devices, it is not possible to perform multiplication of two large matrices at once. Typically, the two large matrices are split into multiple sub-matrices before multiplication. During the operation, it is necessary to continuously transfer the two input sub-matrices from the buffer device to the processing device, and to transfer the output sub-matrices obtained after the operation from the processing device to the buffer device. In existing technologies, the data bandwidth is set to the size of three sub-matrices transmitted simultaneously. However, this consumes a lot of data bandwidth resources. To reduce the consumption of data bandwidth, time-division serial transmission can also be used to transmit data. However, this method will cause the matrix operation process to be interrupted, resulting in low computational efficiency. Summary of the Invention

[0003] The purpose of this application is to provide a data processing method, apparatus, device, medium, and system. The data processing method, apparatus, device, medium, and system provided by this application, under the premise of setting the data transmission bandwidth to the width of two sub-matrices transmitting simultaneously, can transmit data in a parallel transmission manner without causing the matrix operation process to be interrupted, thereby effectively improving the computational efficiency.

[0004] The technical solution provided in this application is as follows:

[0005] A data processing method, wherein the data includes a first matrix and a second matrix, the first matrix and the second matrix being capable of multiplication, the method comprising:

[0006] Read all first submatrices in any row of the first matrix in the row direction, and read all second submatrices in any column of the second matrix in the column direction;

[0007] Perform multiplication and addition operations on all the first submatrices and all the corresponding second submatrices to obtain a third submatrix;

[0008] Output the third submatrix, and simultaneously read all new first submatrixes in other rows of the first matrix in the row direction, or read all new second submatrixes in other columns of the second matrix in the column direction;

[0009] Perform multiplication and addition operations on all the new first submatrices and the corresponding all the second submatrices, or perform multiplication and addition operations on all the new second submatrices and the corresponding all the first submatrices, to obtain a new third submatrix;

[0010] Repeat the steps to obtain a new third submatrix until all submatrices in the first matrix and all corresponding submatrices in the second matrix have been calculated.

[0011] Optionally, the step of reading all first submatrices in any row of the first matrix in the row direction and reading all second submatrices in any column of the second matrix in the column direction; performing multiplication and addition operations on all the first submatrices and the corresponding second submatrices to obtain a third submatrice includes:

[0012] Read a first submatrix from any row of the first matrix in the row direction, and read the second submatrix in the second matrix that corresponds to the first submatrix in the column direction. Perform a multiplication operation on the first submatrix and the corresponding second submatrix to obtain an intermediate submatrix.

[0013] Read the other first submatrix in the row of the first matrix in the row direction, read the second submatrix in the column direction that corresponds to the other first submatrix, and perform a multiplication operation on the other first submatrix and the corresponding second submatrix to obtain another intermediate submatrix;

[0014] Repeat the steps to obtain another intermediate submatrix until the multiplication operations of all first submatrices in any row of the first matrix and all corresponding second submatrices in any column of the second matrix are completed;

[0015] Adding all the intermediate submatrices together yields the third submatrix.

[0016] Optionally, the step of outputting the third submatrix and simultaneously reading all new first submatrices from other rows of the first matrix in the row direction, and performing multiplication and addition operations on all new first submatrices with the corresponding second submatrices to obtain a new third submatrix includes:

[0017] Read the other rows in the first matrix in the row direction to form a new first submatrix corresponding to the last second submatrix read in the previous round, and output the third submatrix at the same time;

[0018] The second reused submatrix obtained last read in the previous round is reused to obtain the second reused submatrix. The corresponding new first submatrix is ​​multiplied with the second reused submatrix to obtain the intermediate submatrix.

[0019] Read another new first submatrix in the row direction of the first matrix, read the second submatrix in the column direction that corresponds to the other new first submatrix, and perform a multiplication operation on the other new first submatrix and the corresponding second submatrix to obtain another intermediate submatrix;

[0020] Repeat the steps to obtain another intermediate submatrix until the multiplication operations of all the new first submatrixes in the other rows of the first matrix and the corresponding second submatrixes in the corresponding columns of the second matrix are completed;

[0021] Adding all the intermediate submatrices together yields the new third submatrix.

[0022] Optionally, the step of outputting the third submatrix and simultaneously reading all new second submatrices from other columns of the second matrix in the column direction, and performing multiplication and addition operations on all new second submatrices with the corresponding first submatrices to obtain a new third submatrix includes:

[0023] Read the other columns of the second matrix in the column direction to find the new second submatrix corresponding to the first submatrix read last in the previous round, and output the third submatrix at the same time;

[0024] The first reused submatrix obtained last read in the previous round is reused to obtain the first reused submatrix. The corresponding new second submatrix is ​​multiplied with the first reused submatrix to obtain the intermediate submatrix.

[0025] Read another new second submatrix in the column direction of the second matrix, read the first submatrix corresponding to the other second submatrix in the row direction, and perform a multiplication operation on the other new second submatrix and the corresponding first submatrix to obtain another intermediate submatrix;

[0026] Repeat the steps to obtain another intermediate submatrix until the multiplication operations of all the new second submatrixes in the other columns of the first matrix and the corresponding first submatrixes in the corresponding rows of the first matrix are completed;

[0027] Adding all the intermediate submatrices together yields the new third submatrix.

[0028] Optionally, the step of outputting the third submatrix and simultaneously reading all new first submatrices from other rows of the first matrix in the row direction, and performing multiplication and addition operations on all new first submatrices with the corresponding second submatrices to obtain a new third submatrix includes:

[0029] Read the other rows in the first matrix in the row direction and the new first submatrix corresponding to any one of the second submatrixes read in the previous round, and output the third submatrix at the same time;

[0030] The second reused submatrix is ​​obtained by reusing any one of the second submatrix read in the previous round. The corresponding new first submatrix is ​​multiplied with the second reused submatrix to obtain the intermediate submatrix.

[0031] Repeat the steps to obtain intermediate submatrices until the multiplication operations of all new first submatrices in the other rows of the first matrix and all corresponding second submatrices in the corresponding columns of the second matrix are completed;

[0032] Adding all the intermediate submatrices together yields the new third submatrix.

[0033] Optionally, the step of outputting the third submatrix and simultaneously reading all new second submatrices from other columns of the second matrix in the column direction, and performing multiplication and addition operations on all new second submatrices with the corresponding first submatrices to obtain a new third submatrix includes:

[0034] Read the other columns of the second matrix in the column direction to find the new second submatrix corresponding to any one of the first submatrixes read in the previous round, and output the third submatrix at the same time;

[0035] The first reused submatrix is ​​obtained by reusing any one of the first submatrixes read in the previous round. The corresponding new second submatrix is ​​multiplied with the first reused submatrix to obtain the intermediate submatrix.

[0036] Repeat the steps to obtain the intermediate submatrix until the multiplication operations of all the new second submatrixes in the other columns of the second matrix and the corresponding first submatrixes in the corresponding rows of the first matrix are completed;

[0037] Adding all the intermediate submatrices together yields the new third submatrix.

[0038] This application also provides a data processing apparatus, wherein the data includes a first matrix and a second matrix, the first matrix and the second matrix being capable of multiplication operations, and the apparatus includes:

[0039] The first reading module is used to read all first sub-matrices in any row of the first matrix in the row direction and all second sub-matrices in any column of the second matrix in the column direction; it is also used to output the third sub-matrices and simultaneously read all new first sub-matrices in other rows of the first matrix in the row direction, or read all new second sub-matrices in other columns of the second matrix in the column direction.

[0040] The first operation module is used to perform multiplication and addition operations on all the first submatrices and the corresponding second submatrices to obtain a third submatric; it is also used to perform multiplication and addition operations on all the new first submatrices and the corresponding second submatrices, or to perform multiplication and addition operations on all the new second submatrices and the corresponding first submatrices to obtain a new third submatric; the step of obtaining a new third submatric is repeated until all the submatrices in the first matrix and the corresponding submatrices in the second matrix have been operated on.

[0041] This application also provides a data processing device, including: a processor, a memory, and a communication bus;

[0042] The communication bus is used to realize the connection and communication between the processor and the memory;

[0043] The processor is used to execute the data processing program stored in the memory to implement the steps of any of the above-described data processing methods.

[0044] This application also provides a readable storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the steps of any of the above-described data processing methods.

[0045] This application also provides a computer system, the system including computer-executable instructions, which, when loaded and executed by a processor, implement the steps of any of the above-described data processing methods.

[0046] Compared with the prior art, this application provides a data processing method, apparatus, device, medium, and system. The data includes a first matrix and a second matrix, which are multiplicative. The method involves reading all first sub-matrices in any row of the first matrix and all second sub-matrices in any column of the second matrix, performing multiplication and addition operations on all first sub-matrices and their corresponding second sub-matrices to obtain a third sub-matrix, outputting the third sub-matrix, and simultaneously reading all new first sub-matrices in other rows of the first matrix, or reading all new second sub-matrices in other columns of the second matrix, performing multiplication and addition operations on all new first sub-matrices and their corresponding second sub-matrices, or performing multiplication and addition operations on all new second sub-matrices and their corresponding first sub-matrices to obtain a new third sub-matrix. The process of obtaining a new third submatrix is ​​repeated until all submatrices in the first matrix and the corresponding submatrices in the second matrix have been processed. In this application, while reading all new first submatrices in other rows of the first matrix in the row direction, the second submatrices read in the previous round are reused, or while reading all new second submatrices in other columns of the second matrix in the column direction, the bandwidth for transmitting one submatrix can be saved. This allows the saved bandwidth to be used to transmit the third submatrix obtained in the previous round of processing. As a result, in the process of processing data such as images, the data transmission bandwidth can be set to the width of transmitting two submatrices at the same time. At the same time, data can be transmitted in parallel without interrupting the matrix operation process, thereby effectively improving the computational efficiency. Attached Figure Description

[0047] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

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

[0049] Figure 2 This is a schematic diagram illustrating the process of multiplying a first matrix and a second matrix according to an embodiment of this application;

[0050] Figure 3 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present invention;

[0051] Figure 4This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present invention. Detailed Implementation

[0052] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0053] It should be noted that when a component is referred to as being "fixed to" or "set on" another component, it can be directly on or indirectly set on the other component; when a component is referred to as being "connected to" another component, it can be directly connected to or indirectly connected to the other component.

[0054] It should be understood that the terms "length", "width", "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 application 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 application.

[0055] Furthermore, 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 technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "a plurality of" or "several" means two or more, unless otherwise explicitly specified.

[0056] It should be noted that the structures, proportions, sizes, etc., shown in the accompanying drawings of this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed in the specification, and are not intended to limit the conditions under which this application can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size should still fall within the scope of the technical content disclosed in this application, provided that they do not affect the effects and purposes that this application can produce.

[0057] like Figure 1 As shown, this application provides a data processing method applicable to the field of image data processing. The data includes a first matrix and a second matrix, which can be multiplied. The method includes:

[0058] In this embodiment, the data can be images, video data, etc.; the first matrix and the second matrix can be matrices of the same size or matrices of different sizes, but it must be ensured that the first matrix and the second matrix meet the requirements of multiplication operation. For example, the number of columns in the first matrix must be equal to the number of rows in the second matrix. Specifically, the number of columns in the first matrix can be equal to the number of rows in the second matrix.

[0059] S11. Read all first submatrices in any row of the first matrix in the row direction, and read all second submatrices in any column of the second matrix in the column direction;

[0060] In this embodiment, the row direction can be from left to right or from right to left; the column direction can be from top to bottom or from bottom to top.

[0061] For example, such as Figure 2 As shown, if the first matrix is ​​a 4x4 matrix containing 16 first submatrices A11-A44, and the second matrix is ​​a 4x4 matrix containing 16 second submatrices B11-B44, then all the first submatrices A11, A12, A13, and A14 in the first row of the first matrix can be read from left to right, or from right to left, or even in any order along the rows. Take all the first submatrices in the first row, such as A12, A13, A11, A14; you can read all the second submatrices B11, B21, B31, B41 in the first column of the second matrix from top to bottom, or read all the second submatrices B41, B31, B21, B11 in the first column of the second matrix from top to bottom, or even read all the second submatrices in the first column in any order along the column, such as B21, B31, B11, B41.

[0062] S12. Perform multiplication and addition operations on all first submatrices and all corresponding second submatrices to obtain a third submatrix;

[0063] In this embodiment, "corresponding" means that all first submatrices in any row of the first matrix and all second submatrices in any column of the second matrix can be multiplied to obtain the correct third submatric.

[0064] For example, such as Figure 2As shown, all the first submatrices A11, A12, A13, A14 in the first row of the first matrix and all the second submatrices B11, B21, B31, B41 in the first column of the second matrix can be multiplied and added to obtain a third submatrice C11; or all the first submatrices A14, A13, A12, A11 in the first row of the first matrix and all the corresponding second submatrices B41, B31, B21, B11 in the first column of the second matrix can be multiplied and added to obtain a third submatrice C11.

[0065] S13. Output the third submatrix, and at the same time read all new first submatrixes in other rows of the first matrix in the row direction, or read all new second submatrixes in other columns of the second matrix in the column direction.

[0066] In this embodiment, the other rows can be any row in the first matrix other than the row read in the previous round, and the other columns can be any column in the second matrix other than the column read in the previous round.

[0067] For example, if the previous round read the first row of the first matrix, the other rows can be any of the second, third, or fourth rows of the first matrix. If the previous round read the first column of the second matrix, the other columns can be any of the second, third, or fourth columns of the second matrix.

[0068] In this embodiment, the third submatrix is ​​output, and all new first submatrixes in other rows of the first matrix are read in the row direction. This can be done by reading all new first submatrixes in other rows of the first matrix in the row direction, outputting the third submatrix, and reusing the second submatrix last read in the previous round to obtain a second reused submatrix. Alternatively, the remaining second submatrixes in the corresponding column of the second matrix in the previous round, excluding the last read second submatrix, can be read in the column direction. Or, it can be done by reading all new first submatrixes in other rows of the first matrix in the row direction, outputting the third submatrix, and reusing all second submatrixes read in the previous round to obtain multiple second reused submatrixes.

[0069] Output the third submatrix and simultaneously read all new second submatrixes from other columns of the second matrix in the column direction. Alternatively, read all new second submatrixes from other columns of the second matrix in the column direction, output the third submatrix, and reuse the first submatrix read last in the previous round to obtain the first reused submatrix. Or, read the remaining first submatrixes from the corresponding row of the first matrix in the previous round except for the last read first submatrix in the row direction. Alternatively, read all new second submatrixes from other columns of the second matrix in the column direction, output the third submatrix, and reuse all first submatrixes read in the previous round to obtain multiple first reused submatrixes.

[0070] For example, output the third submatrix, and simultaneously read all new first submatrices from the other rows of the first matrix in a row-wise direction, such as... Figure 2 As shown, it can be done by reading all the new first submatrices A24, A23, A22, and A21 in the second row of the first matrix from right to left, outputting the third submatrice C11, and reusing the second submatrice read last in the previous round to obtain the second reused submatrice B41. Then, it can be done by reading the remaining second submatrices B31, B21, and B11 in the corresponding columns of the second matrix from the previous round, excluding the last read second submatrice B41, from bottom to top. Alternatively, it can be done by reading all the new first submatrices A24 in the second row of the first matrix from right to left. A23, A22, and A21 are used to output the third submatrix and reuse all the second submatrixes read in the previous round to obtain four second reused submatrixes B41, B31, B21, and B11. For example, a cache module can be set in the operation module to cache the second or first submatrix read in the previous rounds as needed. Alternatively, a module that can perform multiple matrix operations at the same time can be used so that the corresponding submatrix can be reused directly from the cache module when multiplying and adding submatrixes in the next round, ensuring that matrix multiplication can be achieved with only the bandwidth of two submatrix data.

[0071] Output the third submatrix, and simultaneously read all new second submatrices from the other columns of the second matrix in the column direction, such as... Figure 2 As shown, one approach is to read all new second submatrices B42, B32, B22, and B12 in the second column of the second matrix from bottom to top, while simultaneously outputting the third submatric C11 and reusing the first submatric read last in the previous round to obtain the first reused submatric A14. Alternatively, one approach is to read all new second submatrices B42, B32, B22, and B12 in the second column of the second matrix from column to column, while simultaneously outputting the third submatric and reusing all first submatrices read last in the previous round to obtain four first reused submatrices A14, A13, A12, and A11.

[0072] S14. Perform multiplication and addition operations on all the new first submatrices and all the corresponding second submatrices, or perform multiplication and addition operations on all the new second submatrices and all the corresponding first submatrices to obtain a new third submatric.

[0073] In this embodiment, a new third submatrix is ​​obtained by multiplying and adding all the new first submatrixes with all the corresponding second submatrixes. This can be achieved by multiplying and adding all the new first submatrixes with the second reused submatrix obtained by reusing the last second submatrix read in the previous round, and the remaining second submatrixes in the corresponding columns of the second matrix read in the column direction in the previous round, excluding the last second submatrix read. Alternatively, a new third submatrix can be obtained by multiplying and adding all the new first submatrixes with multiple second reused submatrixes obtained by reusing all the second submatrixes read in the previous round.

[0074] To obtain a new third submatrix, perform multiplication and addition operations on all the new second submatrices and their corresponding first submatrices. This can be done by multiplying and adding all the new second submatrices with the first reused submatrix obtained by reusing the last first submatrix read in the previous round, and the remaining first submatrices in the corresponding rows of the first matrix read in the row direction in the previous round, excluding the last first submatrix read. Alternatively, it can be done by multiplying and adding all the new second submatrices with multiple first reused submatrices obtained by reusing all the first submatrices read in the previous round.

[0075] For example, multiplying and adding all the new first submatrices with all the corresponding second submatrices yields a new third submatrix, such as... Figure 2 As shown, a new third submatrix C21 can be obtained by multiplying and adding all the new first submatrices A24, A23, A22, and A21 with the second reused submatrix B41 obtained by reusing the last second submatrix read in the previous round, and the remaining second submatrices B31, B21, and B11 in the corresponding columns of the second matrix read from bottom to top in the previous round, excluding the last second submatrix B41. Alternatively, a new third submatrix C21 can be obtained by multiplying and adding all the new first submatrices A24, A23, A22, and A21 with the four second reused submatrices B41, B31, B21, and B11 obtained by reusing all the second submatrices read in the previous round.

[0076] Multiply and add all the new second submatrices with their corresponding first submatrices to obtain a new third submatrix, such as... Figure 2As shown, a new third submatrix C12 can be obtained by multiplying and adding all the new second submatrices B42, B32, B22, B12 with the first reused submatrix A14 obtained by reusing the last read first submatrix from the previous round, and the remaining first submatrices A13, A12, A11 in the corresponding rows of the first matrix read from right to left in the previous round, excluding the last read first submatrix A14. Alternatively, a new third submatrix C12 can be obtained by multiplying and adding all the new second submatrices B42, B32, B22, B12 with the four first reused submatrices A14, A13, A12, A11 obtained by reusing all the first submatrices read from the previous round.

[0077] S15. Repeat the steps to obtain a new third submatrix until all submatrices in the first matrix and all corresponding submatrices in the second matrix have been calculated.

[0078] In this embodiment, steps S13 and S14 are repeated to obtain a new third submatrix until all submatrices in the first matrix and all corresponding submatrices in the second matrix have been calculated. During the repetition of steps S13 and S14, in step S13, the third submatrix is ​​output, and all new first submatrices in other rows of the first matrix are read in the row direction. Alternatively, all new first submatrices in other rows of the first matrix can be read in the row direction, and the third submatrix is ​​output while reusing all second submatrices read in any previous round. In step S13, the third submatrix is ​​output, and all new second submatrices in other columns of the second matrix are read in the column direction. Alternatively, all new second submatrices in other columns of the second matrix can be read in the column direction, and the third submatrix is ​​output while reusing all first submatrices read in any previous round. For example, a cache module can be set up to cache all first submatrices or all second submatrices read in previous rounds as needed. In the next round of submatrix calculation, the corresponding submatrices can be reused directly from the cache module. Submatrices that no longer need to be calculated in the cache module can be deleted to flexibly manage the submatrices in the cache module.

[0079] In this application, when performing multiplication on the first and second matrices, while reading all new first sub-matrices from other rows of the first matrix in the row direction, the bandwidth for transmitting one sub-matrix can be saved by reusing the last second sub-matrix read in the previous round, or reusing all second sub-matrices read in the previous round, or reusing all second sub-matrices read in any previous round. This saved bandwidth can then be used to transmit the third sub-matrix obtained in the previous round of calculation. Similarly, when reading all new second sub-matrices from other columns of the second matrix in the column direction, the bandwidth for transmitting one sub-matrix can be saved by reusing the last first sub-matrix read in the previous round, or reusing all first sub-matrices read in the previous round, or reusing all first sub-matrices read in any previous round. This saved bandwidth can then be used to transmit the third sub-matrix obtained in the previous round of calculation. Thus, by setting the data transmission bandwidth to the width of simultaneous transmission of two sub-matrices, data can be transmitted using a parallel transmission method.

[0080] Compared with existing technologies, this application provides a data processing method, apparatus, device, medium, and system. The data includes a first matrix and a second matrix, which are multiplicative. The method involves reading all first submatrices in any row of the first matrix and all second submatrices in any column of the second matrix, performing multiplication and addition operations on all first submatrices and their corresponding second submatrices to obtain a third submatric. This third submatric is then output. Simultaneously, all new first submatrices are read in other rows of the first matrix, or all new second submatrices are read in other columns of the second matrix, and all new first submatrices are multiplied and added with their corresponding second submatrices, or all new second submatrices are multiplied and added with their corresponding first submatrices, to obtain a new third submatric. The process of obtaining a new third submatrix is ​​repeated until all submatrices in the first matrix and the corresponding submatrices in the second matrix have been calculated. In this application, while reading all new first submatrices in other rows of the first matrix in the row direction, the second submatrices read in the previous round are reused, or while reading all new second submatrices in other columns of the second matrix in the column direction, the first submatrices read in the previous round are reused. This saves bandwidth for transmitting one submatrix, allowing the saved bandwidth to be used to transmit the third submatrix obtained in the previous round. As a result, even if the data transmission bandwidth of the computing device is set to the width of two submatrices being transmitted simultaneously, data can be transmitted in parallel without interrupting the matrix operation process, thereby effectively improving computing efficiency.

[0081] In one implementation, in this embodiment, all first submatrices in any row of the first matrix are read in the row direction, and all second submatrices in any column of the second matrix are read in the column direction; multiplication and addition operations are performed on all first submatrices and their corresponding second submatrices to obtain a third submatric, including:

[0082] S21. Read a first submatrix from any row of the first matrix in the row direction, and read the second submatrix in the second matrix that corresponds to the first submatrix in the column direction. Perform a multiplication operation on the first submatrix and the corresponding second submatrix to obtain the intermediate submatrix.

[0083] In this embodiment, "corresponding" means that the first submatrix in any row of the first matrix and the second submatrix in the second matrix can be multiplied.

[0084] For example, such as Figure 2 As shown, read the first submatrix A11 in the first row of the first matrix from left to right, and read the second submatrix B11 in the second matrix corresponding to the first submatrix from top to bottom. Perform a multiplication operation on the first submatrix A11 and the corresponding second submatrix B11 to obtain the intermediate submatrix A11*B11.

[0085] S22. Read the other first submatrix in the row of the first matrix in the row direction, and read the second submatrix in the column direction that corresponds to the other first submatrix. Perform a multiplication operation on the other first submatrix and the corresponding second submatrix to obtain another intermediate submatrix.

[0086] In this embodiment, the row in step S22 refers to the row in the first matrix where a first submatrix read in step S21 is located.

[0087] For example, such as Figure 2 As shown, read the other first submatrix A12 in the first row of the first matrix from left to right, and read the second submatrix B21 in the second matrix corresponding to the other first submatrix A12 from top to bottom. Multiply the other first submatrix A12 and the corresponding second submatrix B21 to obtain another intermediate submatrix A12*B21. Alternatively, read the other first submatrix A13 in the first row of the first matrix from left to right, and read the second submatrix B31 in the second matrix corresponding to the other first submatrix A12 from top to bottom. Multiply the other first submatrix A13 and the corresponding second submatrix B31 to obtain another intermediate submatrix A13*B31.

[0088] S23. Repeat the steps to obtain another intermediate submatrix until the multiplication of all first submatrices in any row of the first matrix and all corresponding second submatrices in any column of the second matrix is ​​completed;

[0089] In this embodiment, step S22, which yields another intermediate submatrix, is repeated until the multiplication operations of all first submatrices in any row of the first matrix and all corresponding second submatrices in any column of the second matrix are completed.

[0090] For example, such as Figure 2 As shown, continue reading the other first submatrix A13 in the first row of the first matrix from left to right. Then, read the second submatrix B31 in the second matrix corresponding to the other first submatrix A13 from top to bottom. Multiply the other first submatrix A13 and the corresponding second submatrix B31 to obtain another intermediate submatrix A13*B31. Continue reading the other first submatrix A14 in the first row of the first matrix from left to right. Then, read the second submatrix B41 in the second matrix corresponding to the other first submatrix A14 from top to bottom. Multiply the other first submatrix A14 and the corresponding second submatrix B41 to obtain another intermediate submatrix A14*B41. It should be noted that all first submatrixes in the first row can be read in any order in the row direction, and all second submatrixes in the first column can be read in any order in the column direction, as long as the read first submatrix and the corresponding second submatrix can be calculated normally to obtain the correct third submatrix. The specific reading order is not limited in this embodiment.

[0091] S24. Add all the intermediate submatrices to obtain a third submatrix.

[0092] In this embodiment, all intermediate sub-matrices obtained from steps S21 to S23 are added together to obtain a third sub-matrix.

[0093] For example, add all the intermediate submatrices A11*B11, A12*B21, A13*B31, and A14*B41 obtained from steps S21 to S23 to obtain a third submatrix C11, where C11 = A11*B11 + A12*B21 + A13*B31 + A14*B41.

[0094] As one implementation method, in this embodiment of the application, the third submatrix is ​​output, and simultaneously all new first submatrices in other rows of the first matrix are read row by row. All new first submatrices are then multiplied and added with their corresponding second submatrices to obtain a new third submatrix, including:

[0095] S31. Read the other rows in the first matrix in the row direction and the new first submatrix corresponding to the second submatrix read last in the previous round, and output the third submatrix at the same time.

[0096] In this embodiment, the new first submatrix corresponding to the last second submatrix read in the previous round is read in any row of the first matrix except for the row read in the previous round, and the third submatrix obtained in the previous round is output at the same time.

[0097] For example, such as Figure 2 As shown, if the second submatrix read last in the previous round is B41, the new first submatrix A24 corresponding to the second row of the first matrix and the second submatrix B41 read last in the previous round can be read from right to left, and the third submatrix C11 obtained in the previous round can be output at the same time.

[0098] S32. Reuse the second submatrix read last in the previous round to obtain the second reused submatrix. Multiply the corresponding new first submatrix with the second reused submatrix to obtain the intermediate submatrix.

[0099] In this embodiment, the second reused submatrix obtained last read in the previous round is reused to obtain the second reused submatrix. The new first submatrix obtained corresponding to the second reused submatrix obtained last read in the previous round is multiplied with the second reused submatrix to obtain the intermediate submatrix.

[0100] For example, such as Figure 2 As shown, if the second submatrix read last in the previous round is B41, the second submatrix read last in the previous round is reused to obtain the second reused submatrix B41. The new first submatrix A24 corresponding to the second reused submatrix B41 is multiplied with the second reused submatrix B41 to obtain the intermediate submatrix A24*B41.

[0101] S33. Read another new first submatrix in the row direction of the first matrix, and read the second submatrix in the column direction that corresponds to the other new first submatrix. Perform a multiplication operation on the other new first submatrix and the corresponding second submatrix to obtain another intermediate submatrix.

[0102] In this embodiment, the row in step S33 refers to the row in the first matrix where the new first submatrix corresponding to the second submatrix read in the last round is located.

[0103] For example, such as Figure 2As shown, read another new first submatrix A23 in the second row of the first matrix from right to left, and read the second submatrix B31 in the second matrix corresponding to the other new first submatrix A23 from bottom to top. Perform a multiplication operation on the other new first submatrix A23 and the corresponding second submatrix B31 to obtain another intermediate submatrix A23*B31.

[0104] S34. Repeat the steps to obtain another intermediate submatrix until the multiplication operations of all new first submatrices in other rows of the first matrix and all corresponding second submatrices in corresponding columns of the second matrix are completed.

[0105] In this embodiment, step S33, which yields another intermediate submatrix, is repeated until the multiplication operations of all new first submatrices in other rows of the first matrix and all corresponding second submatrices in corresponding columns of the second matrix are completed.

[0106] For example, such as Figure 2 As shown, continue reading another new first submatrix A22 in the second row of the first matrix from right to left, and read the second submatrix B21 in the second matrix corresponding to the other new first submatrix A22 from bottom to top. Perform a multiplication operation on the other new first submatrix A22 and the corresponding second submatrix B21 to obtain another intermediate submatrix A22*B21. Continue reading another new first submatrix A21 in the second row of the first matrix from right to left, and read the second submatrix B11 in the second matrix corresponding to the other new first submatrix A21 from bottom to top. Perform a multiplication operation on the other new first submatrix A21 and the corresponding second submatrix B11 to obtain another intermediate submatrix A21*B11.

[0107] S35. Add all the intermediate submatrices to obtain a new third submatrix.

[0108] In this embodiment, all intermediate submatrices obtained from steps S31 to S34 are added together to obtain a new third submatrix.

[0109] For example, by adding all the intermediate submatrices A24*B41, A23*B31, A22*B21, and A21*B11 obtained from steps S31 to S34, a third submatrix C21 is obtained, where C21 = A24*B41 + A23*B31 + A22*B21 + A21*B11.

[0110] As one implementation method, in this embodiment, the third submatrix is ​​output, and simultaneously all new second submatrices in other columns of the second matrix are read column-wise. All new second submatrices are then multiplied and added with their corresponding first submatrices to obtain a new third submatrix, including:

[0111] S41. Read the other columns of the second matrix in the column direction to find the new second submatrix corresponding to the first submatrix read last in the previous round, and output the third submatrix at the same time.

[0112] In this embodiment, the new second submatrix corresponding to the first submatrix last read in the previous round is read in any column of the second matrix except for the column read in the previous round, and the third submatrix obtained in the previous round is output at the same time.

[0113] For example, such as Figure 2 As shown, if the first submatrix read last in the previous round is A14, the second column of the second matrix can be read from bottom to top to find the new second submatrix B42 corresponding to the first submatrix A14 read last in the previous round, and the third submatrix C11 obtained in the previous round can be output at the same time.

[0114] S42. Reuse the first submatrix read last in the previous round to obtain the first reused submatrix. Multiply the corresponding new second submatrix with the first reused submatrix to obtain the intermediate submatrix.

[0115] In this embodiment, the first reused submatrix obtained last read in the previous round is used to obtain the first reused submatrix. The first reused submatrix and the new second submatrix corresponding to the first submatrix obtained last read in the previous round are multiplied to obtain the intermediate submatrix.

[0116] For example, such as Figure 2 As shown, if the first submatrix read last in the previous round is A14, the first reused submatrix read last in the previous round is reused to obtain the first reused submatrix A14. The first reused submatrix A14 and the new second submatrix B42 corresponding to the first submatrix read last in the previous round are multiplied to obtain the intermediate submatrix A14*B42.

[0117] S43. Read another new second submatrix in the column direction of the second matrix, read the first submatrix corresponding to the other second submatrix in the row direction, and perform a multiplication operation on the other new second submatrix and the corresponding first submatrix to obtain another intermediate submatrix.

[0118] In this embodiment, the column in step S43 refers to the column in the second matrix where the new second sub-matrix, which is the last sub-matrix read in the previous round, is located.

[0119] For example, read another new second submatrix B32 in the second column of the second matrix from bottom to top, and read the first submatrix A13 in the first matrix that corresponds to the other new second submatrix B32 from right to left. Perform a multiplication operation on the other new second submatrix B32 and the corresponding first submatrix A13 to obtain another intermediate submatrix B32*A13.

[0120] S44. Repeat the steps to obtain another intermediate submatrix until the multiplication operations of all new second submatrixes in other columns of the first matrix and all corresponding first submatrixes in the corresponding rows of the first matrix are completed.

[0121] In this embodiment, step S43, which yields another intermediate submatrix, is repeated until the multiplication operations of all new second submatrices in other columns of the first matrix and all corresponding first submatrices in the corresponding rows of the first matrix are completed.

[0122] For example, continue reading another new second submatrix B22 in the second column of the second matrix from bottom to top, and read the first submatrix A12 in the first matrix that corresponds to the new second submatrix B22 from right to left. Multiply the new second submatrix B22 and the corresponding first submatrix A12 to obtain another intermediate submatrix B22*A12. Continue reading another new second submatrix B12 in the second column of the second matrix from bottom to top, and read the first submatrix A11 in the first matrix that corresponds to the new second submatrix B12 from right to left. Multiply the new second submatrix B12 and the corresponding first submatrix A11 to obtain another intermediate submatrix B12*A11.

[0123] S45. Perform addition operations on all the obtained intermediate submatrices to obtain a new third submatrix.

[0124] In this embodiment, all intermediate sub-matrices obtained from steps S41 to S44 are added together to obtain a new third sub-matrix.

[0125] For example, add all the intermediate submatrices A14*B42, B32*A13, B22*A12, and B12*A11 obtained from steps S41 to S44 to obtain a third submatrix C12, where C12 = A14*B42 + B32*A13 + B22*A12 + B12*A11.

[0126] As one implementation method, in this embodiment of the application, the third submatrix is ​​output, and simultaneously all new first submatrices in other rows of the first matrix are read row by row. All new first submatrices are then multiplied and added with their corresponding second submatrices to obtain a new third submatrix, including:

[0127] S51. Read the other rows in the first matrix in the row direction and the new first submatrix corresponding to any second submatrix among all the second submatrix read in the previous round, and output the third submatrix at the same time.

[0128] In this embodiment, the new first submatrix corresponding to any second submatrix among all the second submatrixes read in the previous round is read in any row direction of the first matrix, and the third submatrix obtained in the previous round is output at the same time.

[0129] For example, such as Figure 2 As shown, if any second submatrix among all the second submatrixes read in the previous round is B41, the second row of the first matrix can be read from right to left to find the new first submatrix A24 corresponding to any second submatrix B41 among all the second submatrixes read in the previous round, and the third submatrix C11 obtained in the previous round can be output at the same time.

[0130] S52. Reuse any one of the second sub-matrices read in the previous round to obtain the second reused sub-matrix. Multiply the corresponding new first sub-matrix with the second reused sub-matrix to obtain the intermediate sub-matrix.

[0131] In this embodiment, "in sequence" simply means that the second submatrix used each time is not repeated, and there is no restriction on its order. For example, the order can be from top to bottom, from bottom to top, or interleaved, etc.

[0132] For example, such as Figure 2 As shown, any B41 from all the second sub-matrices read in the previous round is reused to obtain the second reused sub-matrix B41. The corresponding new first sub-matrix A24 is multiplied with the second reused sub-matrix B41 to obtain the intermediate sub-matrix A24*B41. Alternatively, any one of the second sub-matrices read in one round, such as B21, can be reused to obtain the second reused sub-matrix B21. The corresponding new first sub-matrix A22 is multiplied with the second reused sub-matrix B21 to obtain the intermediate sub-matrix A22*B21.

[0133] S53. Repeat the steps to obtain intermediate submatrices until the multiplication operations of all new first submatrices in other rows of the first matrix and all corresponding second submatrices in corresponding columns of the second matrix are completed.

[0134] In this embodiment, the steps S51-S52 for obtaining the intermediate submatrix are repeated until the multiplication operations of all new first submatrices in other rows of the first matrix and all corresponding second submatrices in the corresponding columns of the second matrix are completed.

[0135] For example, such as Figure 2 As shown, if the other second submatrix among all the second submatrixes read in the previous round is B31, we can continue reading from right to left the second row of the first matrix to find the new first submatrix A23 corresponding to the other second submatrix B31 among all the second submatrixes read in the previous round. We reuse the other second submatrix from the previous round to obtain the second reused submatrix B31. We then multiply the corresponding new first submatrix A23 with the second reused submatrix B31 to obtain the intermediate submatrix A23*B31. We continue reading from right to left the second row of the first matrix to find the new first submatrix A23 corresponding to the other second submatrix B21 among all the second submatrixes read in the previous round. The first submatrix A22 is reused, and another of the second submatrixes read in the previous round is used to obtain the second reused submatrix B21. The corresponding new first submatrix A22 and the second reused submatrix B21 are multiplied to obtain the intermediate submatrix A22*B21. Continuing from right to left, the second row of the first matrix is ​​read, and the new first submatrix A21 corresponding to the other second submatrix B11 read in the previous round is reused to obtain the second reused submatrix B11. The corresponding new first submatrix A21 and the second reused submatrix B11 are multiplied to obtain the intermediate submatrix A21*B11.

[0136] S54. Perform addition operations on all the obtained intermediate submatrices to obtain a new third submatrix.

[0137] In this embodiment, all intermediate submatrices obtained from steps S51 to S53 are added together to obtain a new third submatrix.

[0138] For example, add all the intermediate submatrices A24*B41, A23*B31, A22*B21, and A21*B11 obtained from steps S51 to S53 to obtain a third submatrix C21, where C21 = A24*B41 + A23*B31 + A22*B21 + A21*B11.

[0139] As one implementation method, in this embodiment, the third submatrix is ​​output, and simultaneously all new second submatrices in other columns of the second matrix are read column-wise. All new second submatrices are then multiplied and added with their corresponding first submatrices to obtain a new third submatrix, including:

[0140] S61. Read the other columns of the second matrix in the column direction and find the new second submatrix corresponding to any one of the first submatrixes read in the previous round, and output the third submatrix at the same time.

[0141] In this embodiment, the new second submatrix corresponding to any one of the first submatrixes read in the previous round is read in any column of the second matrix except for the column read in the previous round, and the third submatrix obtained in the previous round is output at the same time.

[0142] For example, such as Figure 2 As shown, if any of the first submatrices read in the previous round is A14, the second column of the second matrix can be read from bottom to top to find the new second submatric B42 corresponding to any of the first submatrices A14 read in the previous round, and the third submatric C11 obtained in the previous round can be output at the same time.

[0143] S62. Reuse any one of the first submatrices read in the previous round to obtain the first reused submatrix. Multiply the corresponding new second submatrix with the first reused submatrix to obtain the intermediate submatrix.

[0144] In this embodiment, "in sequence" simply means that the first sub-matrix used each time is not repeated, and there is no restriction on its order. For example, the order can be from left to right, from right to left, or alternating, etc.

[0145] For example, such as Figure 2 As shown, any A14 from all the first submatrices read in the previous round is reused to obtain the first reused submatrix A14. The first reused submatrix A14 is multiplied with the corresponding new second submatrix B42 to obtain the intermediate submatrix A14*B42. Alternatively, any A12 from all the first submatrices read in the previous round can be reused to obtain the first reused submatrix A12. The first reused submatrix A12 is multiplied with the corresponding new second submatrix B22 to obtain the intermediate submatrix A12*B22.

[0146] S63. Repeat the steps to obtain the intermediate submatrix until the multiplication operations of all new second submatrixes in other columns of the first matrix and all corresponding first submatrixes in the corresponding rows of the first matrix are completed.

[0147] In this embodiment, the steps S61-S62 for obtaining the intermediate submatrix are repeated until the multiplication operations of all new second submatrices in other columns of the first matrix and all corresponding first submatrices in the corresponding rows of the first matrix are completed.

[0148] For example, such as Figure 2 As shown, if the other first submatrix among all the first submatrixes read in the previous round is A13, we can continue reading the second column of the second matrix from bottom to top, and find the new second submatrix B32 corresponding to the other first submatrix A13 among all the first submatrixes read in the previous round. We reuse the other first submatrix from the previous round to obtain the first reused submatrix A13. We then multiply the first reused submatrix A13 with the corresponding new second submatrix B32 to obtain the intermediate submatrix A13*B32. We continue reading the second column of the second matrix from bottom to top, and find the new submatrix B32 corresponding to the other first submatrix A12 among all the first submatrixes read in the previous round. The second submatrix B22 is reused, and another of the first submatrixes read in the previous round is used to obtain the first reused submatrix A12. The first reused submatrix A12 is multiplied with the corresponding new second submatrix B22 to obtain the intermediate submatrix A12*B22. The second column of the second matrix is ​​read from bottom to top, and the new second submatrix B12 is corresponding to another first submatrix A11 read in the previous round. The other of the first submatrixes read in the previous round is reused to obtain the first reused submatrix A11. The first reused submatrix A11 is multiplied with the corresponding new second submatrix B12 to obtain the intermediate submatrix A11*B12.

[0149] S64. Add all the intermediate submatrices to obtain a new third submatrix.

[0150] In this embodiment, all intermediate submatrices obtained from steps S61 to S63 are added together to obtain a new third submatrix.

[0151] For example, add all the intermediate submatrices A14*B42, B32*A13, B22*A12, and B12*A11 obtained from steps S61 to S63 to obtain a third submatrix C12, where C12 = A14*B42 + A13*B32 + A12*B22 + A11*B12.

[0152] like Figure 3 As shown in the illustration, this application also provides a data processing apparatus. The data includes a first matrix and a second matrix, and the first matrix and the second matrix are capable of multiplication operations. The apparatus includes:

[0153] The first reading module 31 is used to read all first submatrices in any row of the first matrix in the row direction and all second submatrices in any column of the second matrix in the column direction; it is also used to output the third submatrices and simultaneously read all new first submatrices in other rows of the first matrix in the row direction, or read all new second submatrices in other columns of the second matrix in the column direction.

[0154] The first operation module 32 is used to perform multiplication and addition operations on all first submatrices and all corresponding second submatrices to obtain a third submatric; it is also used to perform multiplication and addition operations on all new first submatrices and all corresponding second submatrices, or to perform multiplication and addition operations on all new second submatrices and all corresponding first submatrices to obtain a new third submatric; the step of obtaining a new third submatric is repeated until all submatrices in the first matrix and all corresponding submatrices in the second matrix have been operated on.

[0155] like Figure 4 As shown, this application embodiment also provides a data processing device, including: a processor 41, a memory 42, and a communication bus 43;

[0156] Communication bus 43 is used to realize the connection and communication between processor 41 and memory 42;

[0157] The processor 41 is used to execute the data processing program stored in the memory 42 to implement the steps of any of the above data processing methods.

[0158] This application also provides a readable storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the steps of any of the above data processing methods.

[0159] This application also provides a computer system, which includes computer-executable instructions that, when loaded and executed by a processor, implement the steps of any of the above-described data processing methods.

[0160] It should be understood that the use of terms such as "system," "device," "unit," and / or "module" in this application is merely one method of distinguishing multiple components, elements, parts, sections, or assemblies at multiple levels. However, if other terms can achieve the same purpose, they may be replaced by other expressions.

[0161] The embodiments in this specification are described in a progressive manner, with each embodiment focusing on the related aspects.

[0162] In other embodiments, the same or similar parts of each embodiment can be referred to each other.

[0163] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data processing method, characterized by, The data includes a first matrix and a second matrix, which can be multiplied, and the method includes: reading all first sub-matrices of any row in the first matrix in a row direction and reading all second sub-matrices of any column in the second matrix in a column direction; performing multiplication and addition operation on the all first sub-matrices and the corresponding all second sub-matrices to obtain a third sub-matrix; outputting the third sub-matrix and simultaneously reading new all first sub-matrices of other rows in the first matrix in a row direction, reusing the second sub-matrices read in the previous round, or reading new all second sub-matrices of other columns in the second matrix in a column direction, reusing the first sub-matrices read in the previous round, so as to set the data transmission bandwidth to two sub-matrices, and use parallel transmission to transmit the third sub-matrix obtained in the previous round and the new first sub-matrices or the new second sub-matrices; performing multiplication and addition operation on the new all first sub-matrices and the corresponding all second sub-matrices or on the new all second sub-matrices and the corresponding all first sub-matrices to obtain a new third sub-matrix; repeating the step of obtaining the new third sub-matrix until all sub-matrices in the first matrix and the corresponding all sub-matrices in the second matrix are all operated.

2. The method of claim 1, wherein, reading all first sub-matrices of any row in the first matrix in a row direction and reading all second sub-matrices of any column in the second matrix in a column direction; performing multiplication and addition operation on the all first sub-matrices and the corresponding all second sub-matrices to obtain a third sub-matrix, including: reading a first sub-matrix of any row in the first matrix in a row direction and reading a second sub-matrix corresponding to the first sub-matrix in the second matrix in a column direction, performing multiplication operation on the first sub-matrix and the corresponding second sub-matrix to obtain an intermediate sub-matrix; reading another first sub-matrix of the row in the first matrix in a row direction and reading a second sub-matrix corresponding to the another first sub-matrix in the second matrix in a column direction, performing multiplication operation on the another first sub-matrix and the corresponding second sub-matrix to obtain another intermediate sub-matrix; repeating the step of obtaining the another intermediate sub-matrix until multiplication operation on all first sub-matrices of the any row in the first matrix and the corresponding all second sub-matrices of the any column in the second matrix is completed; performing addition operation on all obtained intermediate sub-matrices to obtain the third sub-matrix.

3. The method of claim 2, wherein, outputting the third sub-matrix and simultaneously reading new all first sub-matrices of other rows in the first matrix in a row direction, reusing the second sub-matrices read in the previous round, performing multiplication and addition operation on the new all first sub-matrices and the corresponding all second sub-matrices to obtain a new third sub-matrix, including: reading new first sub-matrices of other rows in the first matrix corresponding to the second sub-matrix read last in the previous round in a row direction and simultaneously outputting the third sub-matrix; multiplexing the second sub-matrix read in the last round to obtain a second multiplexed sub-matrix, and performing multiplication operation on the corresponding new first sub-matrix and the second multiplexed sub-matrix to obtain an intermediate sub-matrix; reading another new first sub-matrix of the row in the first matrix in the row direction, reading a second sub-matrix corresponding to the another new first sub-matrix in the second matrix in the column direction, and performing multiplication operation on the another new first sub-matrix and the corresponding second sub-matrix to obtain another intermediate sub-matrix; repeating the step of obtaining another intermediate sub-matrix until multiplication operation on all new first sub-matrices of the other rows in the first matrix and all second sub-matrices of the corresponding columns in the second matrix is completed; performing addition operation on all obtained intermediate sub-matrices to obtain the new third sub-matrix.

4. The method of claim 2, wherein, outputting the third sub-matrix, simultaneously reading all new second sub-matrices of the other columns in the second matrix in the column direction, multiplexing the first sub-matrix read in the last round to obtain a first multiplexed sub-matrix, and performing multiplication operation on the corresponding new second sub-matrices and the first multiplexed sub-matrix to obtain a new third sub-matrix, comprising: reading new second sub-matrices of the other columns in the second matrix corresponding to the first sub-matrix read in the last round in the column direction, and simultaneously outputting the third sub-matrix; multiplexing the first sub-matrix read in the last round to obtain a first multiplexed sub-matrix, and performing multiplication operation on the corresponding new second sub-matrix and the first multiplexed sub-matrix to obtain an intermediate sub-matrix; reading another new second sub-matrix of the column in the second matrix in the column direction, reading a first sub-matrix corresponding to the another new second sub-matrix in the row direction, and performing multiplication operation on the another new second sub-matrix and the corresponding first sub-matrix to obtain another intermediate sub-matrix; repeating the step of obtaining another intermediate sub-matrix until multiplication operation on all new second sub-matrices of the other columns in the second matrix and all first sub-matrices of the corresponding rows in the first matrix is completed; performing addition operation on all obtained intermediate sub-matrices to obtain the new third sub-matrix.

5. The method of claim 2, wherein, outputting the third sub-matrix, simultaneously reading all new first sub-matrices of the other rows in the first matrix in the row direction, multiplexing the second sub-matrix read in the last round to obtain a second multiplexed sub-matrix, and performing multiplication operation on the corresponding new first sub-matrices and the second multiplexed sub-matrix to obtain a new third sub-matrix, comprising: reading new first sub-matrices of the other rows in the first matrix corresponding to any one of the second sub-matrices read in the last round in the row direction, and simultaneously outputting the third sub-matrix; sequentially multiplexing any one of the second sub-matrices read in the last round to obtain a second multiplexed sub-matrix, and performing multiplication operation on the corresponding new first sub-matrix and the second multiplexed sub-matrix to obtain an intermediate sub-matrix; repeating the multiplication operation of the new all first sub-matrices of the other rows in the first matrix and the all second sub-matrices of the corresponding columns in the second matrix until the multiplication operation of all the sub-matrices in the first matrix and the corresponding sub-matrices in the second matrix is completed; performing addition operation on all the obtained intermediate sub-matrices to obtain the new third sub-matrix.

6. The method of claim 2, wherein, outputting the third sub-matrix, and simultaneously reading the new all second sub-matrices of the other columns in the second matrix in the column direction, multiplexing the first sub-matrices read in the previous round, and performing multiplication and addition operation on the new all second sub-matrices and the corresponding all first sub-matrices to obtain a new third sub-matrix, comprising: reading the new second sub-matrix corresponding to any one of the first sub-matrices in the all first sub-matrices read in the previous round and the other columns in the second matrix in the column direction, and simultaneously outputting the third sub-matrix; multiplexing any one of the all first sub-matrices read in the previous round to obtain a first multiplexed sub-matrix, and performing multiplication operation on the corresponding new second sub-matrix and the first multiplexed sub-matrix to obtain an intermediate sub-matrix; repeating the multiplication operation of the new all second sub-matrices of the other columns in the second matrix and the all first sub-matrices of the corresponding rows in the first matrix until the multiplication operation of all the sub-matrices in the second matrix and the corresponding sub-matrices in the first matrix is completed; performing addition operation on all the obtained intermediate sub-matrices to obtain the new third sub-matrix.

7. A data processing apparatus, characterized by, The data includes a first matrix and a second matrix, and the first matrix and the second matrix can perform multiplication operation, and the device comprises: a first reading module, configured to read all first sub-matrices of any row in the first matrix in the row direction and all second sub-matrices of any column in the second matrix in the column direction, and further configured to output a third sub-matrix, and simultaneously read new all first sub-matrices of the other rows in the first matrix in the row direction, multiplex the second sub-matrices read in the previous round, or read new all second sub-matrices of the other columns in the second matrix in the column direction, multiplex the first sub-matrices read in the previous round, so as to set the data transmission bandwidth to two sub-matrices, and use the parallel transmission mode to transmit the third sub-matrix obtained in the previous round and the new first sub-matrix or the new second sub-matrix; a first operation module, configured to perform multiplication and addition operation on the all first sub-matrices and the corresponding all second sub-matrices to obtain a third sub-matrix, and further configured to perform multiplication and addition operation on the new all first sub-matrices and the corresponding all second sub-matrices, or perform multiplication and addition operation on the new all second sub-matrices and the corresponding all first sub-matrices to obtain a new third sub-matrix, and repeat the step of obtaining the new third sub-matrix until the operation of all the sub-matrices in the first matrix and the corresponding sub-matrices in the second matrix is completed.

8. A data processing device, characterized by comprising: a processor, a memory and a communication bus; the communication bus is configured to realize the connection communication between the processor and the memory; the processor is configured to execute the data processing program stored in the memory to realize the steps of the data processing method in any one of claims 1-6.

9. A readable storage medium, characterized by, The readable storage medium stores computer executable instructions, and the computer executable instructions are loaded and executed by the processor to implement the steps of the data processing method in any one of claims 1 to 6.

10. A computer system, characterized by The system includes computer executable instructions, and the computer executable instructions are loaded and executed by the processor to implement the steps of the data processing method in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for matrix calculation

    CN113268708A

  • Matrix operation result determination method and device, storage medium and electronic device

    CN114647818A