Data processing method, device and chip

By determining the target block parameters according to the storage capacity of the private memory unit in the chip system, and performing block processing on the matrix, the problem of low efficiency in matrix operations of the chip system is solved, and high-performance matrix operations are achieved.

CN112948758BActive Publication Date: 2024-10-29SHANGHAI SENSETIME INTELLIGENT TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202110209961.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-24
Publication Date
2024-10-29
Estimated Expiration
2041-02-24

AI Technical Summary

Technical Problem

Existing chip systems do not fully utilize the chip storage hierarchy when performing matrix operations, resulting in low computational efficiency and slow speed of matrix operations.

Method used

By determining the target block parameters based on the storage capacity of the private storage unit, the result matrix is ​​divided into blocks, and the data operation blocks are assigned to the corresponding computing units for execution, making full use of the chip's storage hierarchy.

Benefits of technology

It improves the storage utilization of private storage units, improves the computing performance of matrix operations, and realizes high-performance matrix operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112948758B_ABST
    Figure CN112948758B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of computer technology, and provides a data processing method, device and chip. The data processing method is characterized in that it includes: determining the third parameter of the result matrix based on the first parameter of the first matrix and the second parameter of the second matrix; based on the third parameter and the target block parameter, the result matrix is ​​processed in blocks to obtain multiple matrix blocks; each of the matrix blocks includes at least one data operation block, and each of the data operation blocks includes at least one element; the target block parameter is determined based on the storage capacity of the private storage unit corresponding to each of the data operation blocks; and the operation data corresponding to each of the data operation blocks is allocated to the corresponding computing unit for execution. The data processing method disclosed in the present disclosure makes full use of the storage hierarchy of the chip system to improve the parallel computing performance of the chip to implement matrix operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, device and chip. Background Art

[0002] With the continuous improvement of computer hardware, computer performance is becoming more and more powerful. High-performance computing is widely used in tasks such as deep learning, image processing and data signal processing. The optimization of parallel tasks such as matrix operations is one of the most important research directions in the field of high-performance computing. In related technologies, the chip system does not fully utilize the chip storage level when implementing matrix operations, resulting in low efficiency and slow speed of parallel tasks such as matrix operations. Summary of the invention

[0003] In order to solve the technical problem of low efficiency of matrix operations in chip systems of related technologies, the embodiments of the present disclosure provide a data processing method, device and chip.

[0004] In a first aspect, an embodiment of the present disclosure provides a data processing method, comprising:

[0005] Determining a third parameter of the result matrix based on the first parameter of the first matrix and the second parameter of the second matrix;

[0006] Based on the third parameter and the target block parameter, the result matrix is ​​processed in blocks to obtain a plurality of matrix blocks; each of the matrix blocks includes at least one data operation block, and each of the data operation blocks includes at least one element; the target block parameter is determined based on the storage capacity of the private storage unit corresponding to each of the data operation blocks;

[0007] The operation data corresponding to each of the data operation blocks are distributed to the corresponding computing units for execution.

[0008] In some embodiments, the data processing method further includes:

[0009] Acquire operation data corresponding to each of the data operation blocks in each of the matrix blocks;

[0010] All operation data are stored in the shared storage unit corresponding to the matrix block, and the operation data corresponding to each data operation block is stored in the corresponding private storage unit.

[0011] In some implementations, the data processing method further includes predetermining the target block parameters, wherein the predetermining the target block parameters includes:

[0012] Determine the maximum storage quantity of the private storage unit based on the amount of operation data corresponding to each element in the result matrix and the storage capacity of the private storage unit corresponding to the data operation block;

[0013] Determine a block parameter set based on the maximum storage quantity and the third parameter;

[0014] The target block parameter is determined from the block parameter set.

[0015] In some implementations, determining the target block parameter from the block parameter set includes:

[0016] The block parameter including the largest number of elements in the block parameter set is determined as the target block parameter.

[0017] In some embodiments, the data processing method further includes:

[0018] All operation data corresponding to the result matrix are obtained, and all operation data are stored in a global storage unit.

[0019] In some implementations, allocating the operation data corresponding to each of the data operation blocks to a corresponding computing unit for execution includes:

[0020] The calculation unit performs matrix multiplication operation using computer primitives based on the operation data corresponding to each of the data operation blocks.

[0021] In a second aspect, an embodiment of the present disclosure provides a data processing device, including:

[0022] A determination module configured to determine a third parameter of the result matrix based on a first parameter of the first matrix and a second parameter of the second matrix;

[0023] A block module is configured to perform block processing on the result matrix based on the third parameter and the target block parameter to obtain a plurality of matrix blocks; each of the matrix blocks includes at least one data operation block, and each of the data operation blocks includes at least one element; the target block parameter is determined based on the storage capacity of the private storage unit corresponding to each of the data operation blocks;

[0024] The computing module is configured to distribute the operation data corresponding to each of the data operation blocks to the corresponding computing units for execution.

[0025] In some embodiments, the data processing device further includes:

[0026] An acquisition module, configured to acquire operation data corresponding to each of the data operation blocks in each of the matrix blocks;

[0027] The storage module is configured to store all operation data into the shared storage unit corresponding to the matrix block, and store the operation data corresponding to each data operation block into the corresponding private storage unit.

[0028] In some embodiments, the data processing device further includes a parameter determination module, and the parameter determination module is configured to:

[0029] Determine the maximum storage quantity of the private storage unit based on the amount of operation data corresponding to each element in the result matrix and the storage capacity of the private storage unit corresponding to the data operation block;

[0030] Determine a block parameter set based on the maximum storage quantity and the third parameter;

[0031] The target block parameter is determined from the block parameter set.

[0032] In some implementations, the parameter determination module is specifically configured to: determine the block parameter including the largest number of elements in the block parameter set as the target block parameter.

[0033] In a third aspect, an embodiment of the present disclosure provides a chip, including:

[0034] Processing unit;

[0035] A storage unit stores computer instructions, and when the computer instructions are read, the processing unit executes the data processing method according to any implementation of the first aspect.

[0036] In some embodiments, the chip further comprises:

[0037] At least one computing cluster, the computing cluster comprising at least one computing core and a shared memory unit shared by the at least one computing core, the computing core comprising the computing unit and the private memory unit.

[0038] The data processing method of the disclosed embodiment includes determining the third parameter of the result matrix based on the first parameter of the first matrix and the second parameter of the second matrix, performing block processing on the result matrix based on the third parameter and the target block parameter to obtain multiple matrix blocks, each matrix block includes at least one data operation block, each data operation block includes at least one element, and the target block parameter is determined based on the storage capacity of the private storage unit corresponding to each data operation block, and the operation data corresponding to each data operation block is allocated to the corresponding computing unit for execution. The disclosed method determines the target block parameter according to the storage capacity of the private storage unit, thereby improving the storage utilization rate of the private storage unit, improving the computing performance of the chip when implementing matrix operations, and realizing high-performance matrix operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0040] Figure 1 This is a schematic diagram of the principle of matrix multiplication.

[0041] Figure 2 It is a schematic diagram of the structure of the chip system in some embodiments of the present disclosure.

[0042] Figure 3 It is a schematic diagram of the structure of a computing cluster according to some implementations of the present disclosure.

[0043] Figure 4 is a flowchart of a data processing method according to some embodiments of the present disclosure.

[0044] Figure 5 It is a schematic diagram of the principles of the data processing method in some embodiments of the present disclosure.

[0045] Figure 6 is a flowchart of a data processing method according to some embodiments of the present disclosure.

[0046] Figure 7 It is a structural block diagram of a data processing device in some implementation modes of the present disclosure.

[0047] Figure 8 It is a structural block diagram of a data processing device in some implementation modes of the present disclosure. DETAILED DESCRIPTION

[0048] The technical solution of the present disclosure will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described implementation is a part of the implementation of the present disclosure, rather than all the implementations. Based on the implementation in the present disclosure, all other implementations obtained by ordinary technicians in the field without creative work are within the scope of protection of the present disclosure. In addition, the technical features involved in the different implementations of the present disclosure described below can be combined with each other as long as they do not conflict with each other.

[0049] Matrix operations are one of the most important operators in the field of deep learning and high-performance computing. Taking matrix multiplication as an example, more and more tasks involve various matrix multiplication operations, especially multiplication operations of large matrices. Nowadays, more and more hardware chips are being proposed. How to implement high-performance matrix operations on chips is an important research direction to improve the speed and effect of algorithms.

[0050] The following uses matrix multiplication as an example to illustrate the data method, device and chip involved in the present disclosure. It is understandable that the "matrix operation" described in the present disclosure is not limited to matrix multiplication, but can also be operations such as matrix addition, matrix subtraction, convolution, etc., and the present disclosure does not limit this.

[0051] Figure 1 The basic mathematical principle of matrix multiplication is shown in Figure 1 As shown, matrix A is a matrix of size M*K, matrix B is a matrix of size K*N, and the result matrix C obtained by (A*B) is a matrix of size M*N. Each element in the result matrix C is the result of the inner product of the corresponding row vector in matrix A and the corresponding column vector in matrix B. For example Figure 1 As shown in , the element 103 in the result matrix C is the result of the inner product of the row vector 101 in the matrix A and the column vector 102 in the matrix B. The operation principle of vector multiplication and vector multiplication is the same, and those skilled in the art can understand that the present disclosure will not elaborate on this.

[0052] Figure 2 The system structure block diagram of the data processing method, device and chip of the present disclosure is shown below. Figure 2 The disclosed scheme is described.

[0053] like Figure 2 As shown, in some embodiments, the chip system of the present disclosure includes a processing unit 100, a storage unit 200, a global storage unit 300, and a computing cluster 400. The processing unit 100, the storage unit 200, the global storage unit 300, and the computing cluster 400 can establish a communicative connection between any two of them through a bus.

[0054] The processing unit 100 may be any type of processor having one or more processing cores, which may perform single-thread or multi-thread operations and is used to parse instructions to perform operations such as acquiring data, performing logical operations, and issuing operation processing results.

[0055] The storage unit 200 may have a program storage area for storing non-volatile software programs, non-volatile computer executable programs and modules for the processing unit 100 to call so that the processing unit 100 performs one or more method steps. In the embodiment of the present disclosure, the storage unit 200 stores computer-readable instructions that can be executed by the processing unit 100. When the computer-readable instructions are executed, the processing unit 100 can perform the data processing method in any of the following embodiments.

[0056] The global storage unit 300 also has a program storage area, which is used to store all the operation data of the parallel tasks. Figure 1 Taking the matrix multiplication operation shown as an example, matrix multiplication (A*B) is a parallel task, which includes multiple subtasks of performing inner products of each row vector of matrix A and each column vector of matrix B. The row vector data of matrix A and the column vector data of matrix B included in these subtasks are operation data, which can be stored in the global storage unit 300.

[0057] It is worth noting that, in some embodiments, the storage unit 200 and the global storage unit 300 can be configured as the same storage unit, that is, the storage unit stores both computer instructions for the processing unit 100 to read and all operation data of the parallel tasks. In other embodiments, the storage unit 200 and the global storage unit 300 can be configured as two storage units, that is, Figure 2 The present disclosure is not limited thereto.

[0058] In one example, the memory unit 200 and / or the global memory unit 300 is configured as a DRAM.

[0059] The chip system includes a plurality of computing clusters 400 , and the computing clusters 400 are used to implement corresponding matrix operations according to the operation data of the global storage unit 300 . Figure 3 The structure diagram of the computing cluster 400 is shown below. Figure 3 Provide explanation.

[0060] like Figure 3 As shown, a computing cluster 400 includes multiple computing cores 410, such as Figure 3 In the example, a computing cluster 400 includes four computing cores 410. In the embodiment of the present disclosure, the multiple computing cores 410 share a shared storage unit 420, and the shared storage unit is used to store operation data corresponding to the multiple computing cores 410 in the computing cluster 400.

[0061] In one example, the shared memory unit 420 is configured as an SRAM.

[0062] Continue to refer to Figure 3 Each computing core 410 includes a computing unit 411 and a private storage unit 412. In one example, the computing unit 411 can be configured as a Task, which is an executable entity and the smallest unit of task scheduling. The private storage unit 412 is used to store the operation data corresponding to the computing unit 411, so that the computing unit 411 can call primitives according to the operation data stored in the private storage unit 412 to implement related calculations.

[0063] In one example, the private storage unit 412 is configured as NRAM.

[0064] As can be seen from the above, the chip system includes three storage levels, namely, the global storage unit 300 visible to all computing units 411, the shared storage unit 420 shared by multiple computing units, and the private storage unit 412 private to each computing unit 411. The three levels of storage, from the global storage unit 300, the shared storage unit 420 to the private storage unit 412, have increasingly faster access speeds and increasingly smaller storage space sizes.

[0065] The calculations involved in implementing the primitives for matrix operations and the operation data must be stored in the private storage unit 412. Therefore, how to efficiently utilize the storage hierarchy, especially the storage space of the private storage unit 412, has a very important impact on the performance of parallel tasks.

[0066] On this basis, the embodiments of the present disclosure provide a data processing method, which improves the computing performance of the chip system when implementing matrix operations through a block strategy and efficient use of three storage levels. Figure 4 Some embodiments of the data processing method disclosed in the present invention are shown below. Figure 4 Provide explanation.

[0067] like Figure 4 As shown, in some embodiments, the data processing method of the present disclosure includes:

[0068] S401. Determine a third parameter of a result matrix based on a first parameter of the first matrix and a second parameter of the second matrix.

[0069] Specifically, in one example, taking a deep learning network scenario as an example, the deep learning network includes an MLP (multi-layer perceptron) layer. During the calculation process of the MLP layer, the input matrix is ​​multiplied by the weight matrix of the MLP to obtain the output result, that is, the MLP implements matrix multiplication during calculation. Among them, the input matrix can be used as the first matrix, the weight matrix can be used as the second matrix, and the matrix corresponding to the output result can be used as the result matrix.

[0070] The following takes matrix multiplication as an example. Figure 1As shown, the first parameter of the first matrix A is M*K, that is, the first matrix A is a matrix of M*K size. The second parameter of the second matrix B is K*N, that is, the second matrix B is a matrix of K*N size. Based on the principle of matrix multiplication, it can be known that the third parameter of the result matrix C obtained by A*B is M*N, that is, the result matrix C is a matrix of M*N size.

[0071] S402: Based on the third parameter and the target block parameter, the result matrix is ​​processed into blocks to obtain a plurality of matrix blocks.

[0072] Specifically, combined Figure 1 As shown, each element in the result matrix C represents the inner product of the row vector of matrix A and the column vector of matrix B, that is, each element of the result matrix C is the multiplication operation of a row vector and a column vector.

[0073] In the embodiment of the present disclosure, the operation data corresponding to each element is not directly assigned to a computing core 410 for calculation. Figure 1 As shown, element 103 represents the result of the multiplication of row vector 101 and column vector 102. If the operation data corresponding to each element is assigned to a computing core 410, the operation data corresponding to element 103, that is, the data of row vector 101 and column vector 102, is stored in a private storage unit 412 of a computing core 410, so that the computing unit 411 of the computing core 410 can call the corresponding primitive to implement the operation.

[0074] It can be seen that if the operation data corresponding to each element of the result matrix C is assigned to a computing core 410, the effective utilization of the storage space of the private storage unit 412 of the computing core 410 is not fully considered, especially for operations with a small amount of operation data, resulting in idle storage space of the private storage unit 412, and low parallel computing efficiency and slow computing speed of matrix operations.

[0075] In the embodiment of the present disclosure, after determining the third parameter of the result matrix C, the result matrix C is firstly subjected to block processing. In some embodiments, the result matrix C is subjected to block processing based on a predetermined target block parameter. The determination process of the target block parameter is described below. Figure 6 The implementation method will not be expanded here.

[0076] The block processing of the result matrix needs to take into account the three storage levels of the chip system, namely the global storage unit 300, the shared storage unit 420 and the private storage unit 412. In the embodiment of the present disclosure, the amount of operation data allocated to each computing core 410 is determined based on the storage capacity of the private storage unit 412, that is, a data operation block, which corresponds to the number of elements represented by the result matrix. Then, according to the number of computing cores 410 included in each computing cluster 400, the matrix block size corresponding to each computing cluster 400 can be determined, that is, the result matrix C is processed into multiple matrix blocks.

[0077] In one example, the result matrix C is processed in blocks as follows: Figure 5 As shown in (a), in this example, the resultant matrix C after block division includes multiple matrix blocks 501, each matrix block 501 includes four data operation blocks 502, and each data operation block 502 includes one element.

[0078] In another example, the result matrix C is processed in blocks as follows Figure 5 As shown in (b), in this example, the resultant matrix C after block division includes multiple matrix blocks 501, each matrix block 501 includes 4 data operation blocks 502, and each data operation block 502 includes 2 elements.

[0079] Figure 5 As only two examples of the implementation methods of the present disclosure, the method of the present disclosure determines the target block parameters based on the storage capacity of the private storage unit, and fully utilizes the chip storage hierarchy through block processing. On this basis, those skilled in the art can undoubtedly implement other block processing methods according to specific scenarios, which are not limited to the examples of the present disclosure and will not be described in detail.

[0080] S403: distribute the operation data corresponding to each data operation block to the corresponding computing unit for execution.

[0081] Specifically, after the result matrix C is processed in blocks, the corresponding operation data can be stored in layers according to the block results to achieve matrix parallel operation.

[0082] In some embodiments, Figure 5 As shown, all operation data corresponding to the result matrix C (that is, all data of matrix A and matrix B) are stored in the global storage unit 300, and the operation data corresponding to each matrix block 501 are allocated and stored in a shared storage unit 420 of a computing cluster 400. The operation data corresponding to the four data operation blocks 502 included in each matrix block 501 are respectively allocated and stored in a private storage unit 412 of a computing core 410. The computing unit 411 can call related primitives according to the operation data stored in the private storage unit 412 to implement multiplication calculations.

[0083] The primitive consists of several instructions for the computing unit to call to complete related functions, such as two important hardware primitives __bang_mul and __bang_mlp for implementing matrix operations. __bang_mul is a primitive for implementing vector multiplication, and __bang_mlp is a primitive for implementing matrix multiplication. When the computing unit 411 performs matrix operations, it reads the operation data stored in the private storage unit 412 and calls related primitives to implement the calculation.

[0084] It can be understood that the above __bang_mul and __bang_mlp are only used as examples, and the method disclosed in the present invention can also be applied to primitives for implementing other matrix operations, such as matrix addition, matrix subtraction and other primitives, and the present invention does not limit this.

[0085] It can be seen that in the processing method of the embodiment of the present disclosure, a computing core 410 does not necessarily calculate only one element at a time, but through block processing, the storage hierarchy of the chip system is fully utilized. A computing core 410 can calculate one or more elements in a single read, thereby realizing parallel optimization of matrix operations.

[0086] From the above, it can be seen that the data processing method of the embodiment of the present disclosure determines the target block parameters according to the storage capacity of the private storage unit, fully utilizes the storage hierarchy of the chip system, improves the storage utilization rate of the private storage unit, improves the parallel computing performance of matrix operations, and realizes high-performance matrix operations.

[0087] Figure 6 Some embodiments of the data processing method disclosed in the present invention are shown. Figure 6 In an implementation, the target block parameters for the result matrix C may be determined according to the storage capacity of the private storage unit 412 .

[0088] like Figure 6 As shown, in some embodiments, the data processing method of the present disclosure includes:

[0089] S610: Determine the maximum storage quantity of the private storage unit based on the amount of operation data corresponding to each element in the result matrix and the storage capacity of the private storage unit corresponding to the data operation block.

[0090] Specifically, combined Figure 1It can be seen that each element 103 in the result matrix C represents the multiplication result of the row vector 101 of the matrix A and the column vector 102 of the matrix B. Therefore, the amount of operation data corresponding to each element 103 is the sum k of the amount of data of the row vector 101 and the column vector 102. The maximum storage capacity of the private storage unit 412 is obtained as m. The maximum storage quantity n that each private storage unit 412 can store can be determined, that is, m / k is an integer result. The maximum storage quantity represents the number of operations corresponding to the maximum number of elements that a single private storage unit 412 can store.

[0091] S620: Determine a block parameter set based on the maximum storage quantity and the third parameter.

[0092] Specifically, after determining the maximum storage quantity n, the block parameter can be determined according to the third parameter of the result matrix C. It should be understood that the operation data executed by a computing unit 411 only needs to be smaller than the capacity of the private storage unit 412, so when determining the block parameter, multiple block parameters, that is, a block parameter set, are often included.

[0093] In one example, the maximum storage number n=2, which means that the private storage unit 412 can store at most 2 elements of operation data at a time. In this case, a variety of block parameters can be determined.

[0094] like Figure 5 As shown in (a), the block parameter is expressed as 1*4, that is, the size of the matrix block 501 is 1*4, and the matrix block 501 includes 4 data operation blocks 502, each of which includes one element.

[0095] like Figure 5 As shown in (b), the block parameter is expressed as 2*4, that is, the size of the matrix block 501 is 2*4, the matrix block 501 includes 4 data operation blocks 502, and each data operation block 502 includes 2 elements.

[0096] It can be understood that in this example, the block parameter can also be expressed as 2*2. Therefore, in this example, it can be determined that the block parameter set is expressed as [1*4, 2*2, 2*4].

[0097] S630: Determine a target block parameter from a block parameter set.

[0098] Specifically, after obtaining the block parameter set, the target block parameter can be determined from the block parameter set.

[0099] In some embodiments, considering that theoretically, the more operation data a single computing core 410 can store, the higher the efficiency of parallel computing. Therefore, in some embodiments, the block parameter with the largest number of elements in the block parameter set can be determined as the target block parameter. Figure 5 For example, in the block parameter set [1*4, 2*2, 2*4], the block parameter 2*4 can be determined as the target block parameter.

[0100] In other embodiments, considering the hardware influence of the chip system, the test results of each block parameter in the block parameter set can be obtained in advance according to a limited number of tests, so as to select the block parameter corresponding to the optimal test result as the target block parameter. Those skilled in the art can understand this, and the present disclosure will not elaborate on it.

[0101] From the above, it can be seen that the data processing method of the embodiment of the present disclosure determines the target block parameters based on the storage capacity of the private storage unit and the amount of operation data corresponding to a single element, thereby making full use of the storage hierarchy of the chip system, improving the storage utilization rate of the private storage unit, improving the parallel computing performance of matrix operations, and realizing high-performance matrix operations.

[0102] It can be understood that in the embodiment of the present disclosure, when the result matrix is ​​processed in blocks, the number of data operation blocks included in each matrix block can be determined according to the number of computing cores 410 included in a computing cluster 400, that is, the number of data operation blocks in each matrix block is the same as the number of computing cores in each computing cluster. Figure 3 In the illustrated embodiment, a computing cluster 400 includes four computing cores 410, so during block processing, each matrix block includes four data operation blocks, and each data operation block corresponds to one computing core 410. However, in other embodiments, when the computing cluster 400 includes other numbers of computing cores 410, the block parameters may also be adjusted accordingly, and the present disclosure does not limit this. Those skilled in the art may understand this, and the present disclosure will not repeat it in detail.

[0103] From the above, it can be seen that the data processing method of the embodiment of the present disclosure determines the target block parameters based on the storage capacity of the private storage unit and the amount of operation data corresponding to a single element, thereby making full use of the storage hierarchy of the chip system, improving the storage utilization rate of the private storage unit, improving the parallel computing performance of matrix operations, and realizing high-performance matrix operations.

[0104] In a second aspect, the present disclosure provides a data processing device. Figure 7 As shown, in some embodiments, the data processing device of the present disclosure includes:

[0105] A determination module 701 is configured to determine a third parameter of the result matrix based on a first parameter of the first matrix and a second parameter of the second matrix;

[0106] The block module 702 is configured to perform block processing on the result matrix based on the third parameter and the target block parameter to obtain a plurality of matrix blocks; each of the matrix blocks includes at least one data operation block, and each of the data operation blocks includes at least one element; the target block parameter is determined based on the storage capacity of the private storage unit corresponding to each of the data operation blocks;

[0107] The calculation module 703 is configured to distribute the operation data corresponding to each of the data operation blocks to the corresponding calculation unit for execution.

[0108] like Figure 8 As shown, in some embodiments, the data processing device of the present disclosure further includes:

[0109] An acquisition module 801 is configured to acquire operation data corresponding to each of the data operation blocks in each of the matrix blocks;

[0110] The storage module 802 is configured to store all operation data into the shared storage unit corresponding to the matrix block, and store the operation data corresponding to each data operation block into the corresponding private storage unit.

[0111] In some implementations, the data processing device further includes a parameter determination module 803, and the parameter determination module 803 is configured to:

[0112] Determine the maximum storage quantity of the private storage unit based on the amount of operation data corresponding to each element in the result matrix and the storage capacity of the private storage unit corresponding to the data operation block;

[0113] Determine a block parameter set based on the maximum storage quantity and the third parameter;

[0114] The target block parameter is determined from the block parameter set.

[0115] In some implementations, the parameter determination module 803 is specifically configured to: determine the block parameter including the largest number of elements in the block parameter set as the target block parameter.

[0116] From the above, it can be seen that the data processing device of the embodiment of the present disclosure determines the target block parameters based on the storage capacity of the private storage unit and the amount of operation data corresponding to a single element, thereby making full use of the storage hierarchy of the chip system, improving the storage utilization rate of the private storage unit, improving the parallel computing performance of matrix operations, and realizing high-performance matrix operations.

[0117] In a third aspect, an embodiment of the present disclosure provides a chip, including:

[0118] Processing unit;

[0119] A storage unit stores computer instructions, and when the computer instructions are read, the processing unit executes the data processing method according to any implementation of the first aspect.

[0120] In some embodiments, the chip of the present disclosure further includes:

[0121] At least one computing cluster, the computing cluster comprising at least one computing core and a shared memory unit shared by the at least one computing core, the computing core comprising the computing unit and the private memory unit.

[0122] It can be understood that the chip structure and principle of the embodiment of the present disclosure refer to the aforementioned Figure 2 , Figure 3 This is just an example and the disclosure will not elaborate on it.

[0123] From the foregoing, it can be seen that the chip of the embodiment of the present disclosure determines the target block parameters based on the storage capacity of the private storage unit and the amount of operation data corresponding to a single element, thereby making full use of the storage hierarchy of the chip system, improving the storage utilization rate of the private storage unit, improving the parallel computing performance of matrix operations, and realizing high-performance matrix operations.

[0124] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the embodiments. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.

Claims

1. A data processing method, characterized in that: include: Determine third row and column parameters of the result matrix based on first row and column parameters of the first matrix and second row and column parameters of the second matrix; Based on the third row and column parameters and the predetermined target block parameters, the result matrix is ​​subjected to block processing to obtain a plurality of matrix blocks; each of the matrix blocks includes at least one data operation block, and each of the data operation blocks includes at least one element; Acquire the operation data corresponding to each of the data operation blocks in each of the matrix blocks, store the operation data corresponding to each of the matrix blocks in a shared storage unit corresponding to the matrix block, and store the operation data corresponding to each of the data operation blocks in a corresponding private storage unit; Allocating the operation data corresponding to each of the data operation blocks to the corresponding computing unit for execution; The process of predetermining the target block parameters includes: Determine the maximum storage quantity of the private storage unit based on the amount of operation data corresponding to each element in the result matrix and the storage capacity of the private storage unit corresponding to the data operation block; Determine a block parameter set based on the maximum storage quantity and the third row and column parameter; The target block parameter is determined from the block parameter set.

2. The data processing method according to claim 1, characterized in that: Determining the target block parameter from the block parameter set includes: The block parameter including the largest number of elements in the block parameter set is determined as the target block parameter.

3. The data processing method according to claim 1, characterized in that: Also includes: All operation data corresponding to the result matrix are obtained, and all operation data are stored in a global storage unit.

4. The data processing method according to claim 1, characterized in that: The step of allocating the operation data corresponding to each of the data operation blocks to the corresponding computing unit for execution includes: The calculation unit performs matrix multiplication operation using computer primitives based on the operation data corresponding to each of the data operation blocks.

5. A data processing device, characterized in that: include: A determination module, configured to determine third row and column parameters of the result matrix based on first row and column parameters of the first matrix and second row and column parameters of the second matrix; A block module is configured to perform block processing on the result matrix based on the third row and column parameter and a predetermined target block parameter to obtain a plurality of matrix blocks; each of the matrix blocks includes at least one data operation block, and each of the data operation blocks includes at least one element; An acquisition module, configured to acquire operation data corresponding to each of the data operation blocks in each of the matrix blocks; A storage module is configured to store the operation data corresponding to each matrix block into a shared storage unit corresponding to the matrix block, and store the operation data corresponding to each data operation block into a corresponding private storage unit; A calculation module is configured to distribute the operation data corresponding to each of the data operation blocks to the corresponding calculation unit for execution; The process of predetermining the target block parameters includes: Determine the maximum storage quantity of the private storage unit based on the amount of operation data corresponding to each element in the result matrix and the storage capacity of the private storage unit corresponding to the data operation block; Determine a block parameter set based on the maximum storage quantity and the third row and column parameter; The target block parameter is determined from the block parameter set.

6. A chip, characterized in that: include: Processing unit; A storage unit stores computer instructions, and when the computer instructions are read, the processing unit executes the data processing method according to any one of claims 1 to 4.

7. The chip according to claim 6, characterized in that: Also includes: At least one computing cluster, the computing cluster comprising at least one computing core and a shared memory unit shared by the at least one computing core, the computing core comprising the computing unit and the private memory unit.

Citation Information

Patent Citations

  • Block matrix multiplication vectorization method supporting vector processor with multiple MAC (multiply accumulate) operational units

    CN103294648A

  • An upper triangular part storage device of a self-conjugate matrix and a parallel reading method

    CN109558567A

  • Method, device and equipment for realizing matrix multiplication

    CN109740115A

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

    CN111158874A

  • Fast convolution method and device suitable for microprocessor

    CN112199636A