WO2025200693A1 - 矩阵乘法累加运算单元及运算方法、硬件加速器、电子设备 - Google Patents
矩阵乘法累加运算单元及运算方法、硬件加速器、电子设备Info
- Publication number
- WO2025200693A1 WO2025200693A1 PCT/CN2024/144639 CN2024144639W WO2025200693A1 WO 2025200693 A1 WO2025200693 A1 WO 2025200693A1 CN 2024144639 W CN2024144639 W CN 2024144639W WO 2025200693 A1 WO2025200693 A1 WO 2025200693A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- matrix multiplication
- tensor register
- tensor
- accumulation
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/16—Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/38—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
- G06F7/48—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
- G06F7/544—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/38—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
- G06F7/48—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
- G06F7/544—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
- G06F7/5443—Sum of products
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/30007—Arrangements for executing specific machine instructions to perform operations on data operands
- G06F9/3001—Arithmetic instructions
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30098—Register arrangements
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30145—Instruction analysis, e.g. decoding, instruction word fields
Definitions
- the embodiments of the present disclosure relate to the field of chip technology, and in particular to a matrix multiplication and accumulation operation unit, a matrix multiplication and accumulation operation method, a hardware accelerator, and an electronic device.
- MMA Mestrix Multiply Accumulation
- LLMs Large Language Models
- A is the input matrix, m*k dimensions
- B is the weight matrix, k*n dimensions
- C is the accumulation matrix, m*n dimensions.
- MMA is implemented as AB+C.
- the result of AB+C is used to update C.
- an embodiment of the present disclosure provides an MMA implementation solution to at least partially solve the above problems.
- a matrix multiplication and accumulation operation unit comprising: a data loading and storage engine, a tensor register file, and a matrix multiplication engine; wherein: the data loading and storage engine is used to load data of multiple matrices to be subjected to matrix multiplication and accumulation calculations; the tensor register file is used to store the data of the multiple matrices obtained from the data loading and storage engine; wherein the tensor register file comprises at least three tensor register groups, each tensor register group comprises multiple tensor registers, and different tensor register groups are used to store data of different matrices among the multiple matrices; the matrix multiplication engine is used to perform matrix multiplication and accumulation calculations based on the data of the multiple matrices stored in the tensor register file.
- a matrix multiplication and accumulation method including: obtaining a machine instruction for a matrix multiplication and accumulation process, the machine instruction containing information about registers where operands are located, the registers being registers in at least three tensor register groups in a tensor register file, different tensor register groups being used to store data of different matrices in a plurality of matrices to be subjected to matrix multiplication and accumulation calculations; and executing the operation indicated by the machine instruction.
- a hardware accelerator which includes at least an instruction decoder and a matrix multiplication and accumulation operation unit as described in the first aspect; wherein the instruction decoder is used to decode a machine instruction indicating a matrix multiplication and accumulation calculation, and control the matrix multiplication and accumulation operation unit to perform a matrix multiplication and accumulation calculation based on the decoding result.
- an electronic device comprising at least: a processor and a hardware accelerator as described in the fourth aspect; wherein the processor is configured to send an instruction to the hardware accelerator to perform matrix multiplication and accumulation calculations; and the hardware accelerator performs matrix multiplication and accumulation calculations according to the instruction.
- a computer-readable storage medium stores computer execution instructions, and the computer execution is used to implement the method described in the second aspect and/or the third aspect when specified by a processor.
- a computer program product comprising computer instructions, wherein the computer instructions instruct an electronic device to execute the method described in the second aspect and/or the third aspect through the hardware accelerator described in the fourth aspect, especially a matrix multiplication and accumulation operation unit in the hardware accelerator.
- FIG4A is a schematic structural diagram of an MMA operation unit according to an embodiment of the present disclosure.
- FIG4C is a schematic diagram illustrating storage of tensor registers in the tensor register file shown in FIG4B ;
- FIG4D is a schematic diagram of the structure of an exemplary matrix multiplication engine in the MMA operation unit shown in FIG4A ;
- FIG5 is a flowchart of the steps of an MMA operation method according to an embodiment of the present disclosure.
- FIG6 is a flowchart of another MMA operation method according to an embodiment of the present disclosure.
- Figure 2 illustrates an exemplary system applicable to embodiments of the present disclosure.
- the system 100 may include one or more electronic devices 102 and a communication network 104.
- Figure 2 illustrates multiple electronic devices.
- the electronic devices may be implemented as server-side devices, cloud-based devices, or terminal devices, such as desktop computers, tablet computers, servers, and the like.
- the embodiments of the present disclosure do not limit the specific form of the electronic devices.
- the communication network 104 can be any suitable combination of one or more wired and/or wireless networks.
- the communication network 104 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN), and/or any other suitable communication network.
- the electronic device 102 can be connected to the communication network 104 via one or more communication links (e.g., communication link 112).
- the communication link can be any communication link suitable for transmitting data between the electronic devices 102, such as a network link, a dial-up link, a wireless link, a hardwired link, any other suitable communication link, or any suitable combination of such links.
- the electronic device 102 may execute a machine learning algorithm, and the execution process of the machine learning algorithm may include MMA calculation.
- the electronic device 102 includes at least one or more processors 1022, a memory 1024, a communication interface 1026, a communication bus 1028, and a hardware accelerator 1020.
- the processor 1022 , the memory 1024 , the communication interface 1026 , and the hardware accelerator 1020 communicate with each other via a communication bus 1028 .
- the memory 1024 can store instructions executable by the processor 1022, as well as other data and information, such as matrix data and information for performing MMA calculations.
- the memory 1024 may include high-speed RAM memory and may also include non-volatile memory.
- the processor 1022 may be a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present disclosure.
- the multiple processors may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.
- the hardware accelerator 1020 is used to accelerate data calculations, such as accelerating various data calculations involved in machine learning models (including but not limited to MMA calculations).
- data calculations such as accelerating various data calculations involved in machine learning models (including but not limited to MMA calculations).
- FIG3 a structure of the hardware accelerator 1020 is shown in FIG3 .
- the hardware accelerator 1020 includes at least: an instruction queue, an instruction decoder, and an arithmetic component for performing computational acceleration.
- the arithmetic component is implemented as an MMA arithmetic unit to achieve MMA computational acceleration.
- the instruction queue can receive machine instructions that need to be executed by the hardware accelerator 1020 from outside the hardware accelerator 1020 (such as from a CPU or GPU or external memory, etc.).
- the instruction decoder can decode the machine instructions and send control signals to other components in the hardware accelerator 1020 to execute the machine instructions.
- the machine instructions may include instructions for instructing to perform MMA calculations, which can be executed by the MMA arithmetic unit.
- the hardware accelerator 1020 may further include a memory, which may be located outside or inside the MMA operation unit and is used to receive data used by the hardware accelerator 1020 when executing machine instructions, such as matrix data, etc.; and may also store data generated during the execution of machine instructions.
- a memory which may be located outside or inside the MMA operation unit and is used to receive data used by the hardware accelerator 1020 when executing machine instructions, such as matrix data, etc.; and may also store data generated during the execution of machine instructions.
- an embodiment of the present disclosure provides an MMA operation unit, as shown in FIG4A , which includes: a data loading and storage engine, a tensor register file, and a matrix multiplication engine.
- the data loading and storage engine is used to load the data of multiple matrices to be calculated by MMA;
- the tensor register file is used to store the data of multiple matrices read from the data loading and storage engine, and the tensor register file includes at least three tensor register groups, each tensor register group includes multiple tensor registers, and different tensor register groups are used to store data of different matrices in the multiple matrices;
- the matrix multiplication engine is used to perform MMA calculation based on the data of multiple matrices stored in the tensor register file.
- a register file also known as a register stack, includes an array of multiple registers.
- the register file can be implemented using fast SRAM (Static Random-Access Memory) or flip-flops.
- a register file is used to access tensors, and is therefore also referred to as a tensor register file.
- Tensors come in various forms; in the disclosed embodiments, a matrix form is used. Therefore, a tensor register file can store data for multiple matrices used in MMA calculations.
- FIG4B An exemplary implementation of a tensor register file for storing data of multiple matrices used for MMA calculations is shown in FIG4B .
- the number of bits of the multiple tensor registers included in each tensor register group is the same.
- the number of bits of all tensor registers included in the entire tensor register file is the same.
- tensor register groups A1, A2, B1, B2, C1, and C2 Assuming there are six tensor register groups, namely tensor register groups A1, A2, B1, B2, C1, and C2, then tensor register groups A1 and A2 are used in conjunction, B1 and B2 are used in conjunction, and C1 and C2 are used in conjunction.
- the number of tensor registers in each tensor register group can also be appropriately set by those skilled in the art based on actual needs, and the embodiments of the present disclosure do not impose any restrictions on this.
- the MMA operation unit of the embodiment of the present disclosure may also include a memory, which can be used to store at least the data of multiple matrices to be subjected to MMA calculations obtained from outside the MMA operation unit (such as a hardware accelerator or an element outside the hardware accelerator), so as to be subsequently provided to the data loading and storage engine.
- MMA operation results and/or process data may also be stored.
- the memory may also be provided outside the MMA operation unit.
- the memory may store the obtained matrix data in row-major order, or it may store the obtained matrix data in column-major order.
- the data load storage engine can read the data of multiple matrices to be calculated by MMA, namely matrices A, B, and C from the memory; then, the tensor register file reads the data of matrices A, B, and C from the data load storage engine.
- the data of matrices A, B, and C will be stored in the corresponding tensor register groups A, B, and C respectively; the tensor register file has three read ports and one write port.
- the matrix multiplication engine can read the data of matrices A, B, and C used in the current calculation from the tensor register groups A, B, and C respectively through the three read ports and perform the MMA calculation. After the calculation is completed, the matrix multiplication engine will return the MMA calculation result to the tensor register file for storage, such as storing it in tensor register group C. Then, when the set time is reached or the instruction is received, the data load storage engine reads the data from the tensor register file and stores it in the memory.
- the data loading and storage engine can be implemented as any suitable component, including but not limited to a loader or hardware logic for loading and/or storing data.
- the matrix multiplication engine can be implemented based on components including adders and multipliers.
- the tensor registers store the data of the matrix to be calculated, that is, the matrix elements, so a tensor register can store all the elements of a matrix at a time. For larger matrices, they can be divided into sub-matrices suitable for storage in tensor registers, and then all the elements of the sub-matrix are stored in a tensor register of its corresponding tensor register group. It can be seen that a tensor register group can store the data of multiple matrices or multiple sub-matrices at the same time to facilitate subsequent parallel calculations.
- the data type and size, i.e., the numerical precision, of its matrix elements are the same.
- Data types typically include: 4-bit precision (FP4/NF4, 4bit), 8-bit precision (FP8, 8bit), half-precision (FP16/BF16, 16bit), single-precision (FP32/TF32, 32bit), double-precision (FP64, 64bit), etc.
- the tensor register file stores the matrix data in the tensor registers of the corresponding tensor register group, starting from the low bits of the tensor registers according to the numerical precision corresponding to the data type. Unused high bits can be set to 0 to make the storage method more convenient for storing matrices of different element sizes.
- the tensor register is a 64-bit register and the matrix A is a
- the matrix element data type is 8 bits. Assuming that matrix A is stored in register 01 of tensor register bank A, a11 will be stored in bits 0-7 of register 01, a12 will be stored in bits 8-15 of register 01, a21 will be stored in bits 16-23 of register 01, and a22 will be stored in bits 24-31 of register 01. Bits 32-63 of register 01 will be set to 0. Storage in halfword or fullword units is similar.
- a corresponding storage rule is set for it according to the data type of the matrix element.
- data is stored from the least significant bit LSB of the tensor register to the most significant bit MSB.
- LSB the least significant bit of the tensor register
- MSB the most significant bit
- a low-order storage method with 8-bit precision as the unit of storage will be used. In this method, the elements of the matrix read into a tensor register at one time will occupy 64 bytes of register bit width.
- the numerical precision of the matrix elements of the matrix is 16 bits (such as FB16/BF16 (Brain Floating Point 16)), a low-order storage method with half precision as the unit of storage will be used. In this method, the elements of the matrix read into a tensor register at one time will occupy 128 bytes of register bit width. If the numerical precision of the matrix elements of the matrix is 32 bits (such as FP32), a low-bit storage method with full precision will be used. In this method, the elements of the matrix read into a tensor register at one time will occupy a register bit width of 256 bytes.
- a tensor register group may read matrix elements of different matrices in one read operation.
- different tensor registers in the same tensor register group may have different storage methods. For example, some tensor registers use 8-bit precision as the low-order storage method, some tensor registers use half-precision as the low-order storage method, and so on.
- the matrix multiplication engine performs matrix multiplication and accumulation calculations based on the data of multiple matrices stored in the tensor register file through the column selector array, the row selector array, the multiplier array, and the adder array.
- the tensor register file receives a read data signal (such as "MMA Read signals” as shown in Figure 4D)
- a read data signal such as "MMA Read signals” as shown in Figure 4D
- the data therein will be sent to the corresponding arrays in the matrix multiplication engine.
- the data of matrix A (m*k) stored in tensor register group A is sent to the column selector array
- the data of matrix B (k*n) stored in tensor register group B is sent to the row selector array
- the data of matrix C (m*n) stored in tensor register group C is sent to the adder array.
- the column selector array and the row selector array then send the corresponding data to the 3D multiplier array respectively to perform matrix multiplication calculations on multiple matrix elements at the same time.
- the calculation results are then sent to the adder array and added with the data of matrix C. After obtaining the MMA calculation accumulation result, it can be written back to the tensor register file, such as tensor register group
- the column selector array includes k column multiplexers.
- the row selector array includes k row multiplexers.
- the 3D multiplier array includes k arrays.
- the adder array includes mxn adder units.
- the ⁇ i,j>th adder ADD ij adds the sum result MUL_Result ij corresponding to the same multiplier position from the k arrays of the 3D multiplier array to the data C ij in the matrix C input to the adder array (for example, in Figure 4D, MUL 1n of the kth array is added with the MUL 1n of the corresponding position in the k-1th array, the k-2th array, ..., the 1st array to obtain the sum result MUL_Result 1n , which is added to the data at the corresponding position in the matrix C in the adder array through ADD 1n ); the tensor accumulator register Tensor ACC reduces all values in the adder array to form tensor data ACC m*n in row-major order, and writes it back to the tensor register file. It can be seen that since the column selector array, row selector array, 3D multiplier array, etc. are all 3D structures, they are easier to implement through
- a preset instruction set compatible with the hardware implementation is provided in the embodiment of the present disclosure, so that the MMA operation unit can control at least one of the data loading and storage engine, the tensor register file and the matrix multiplication engine (optionally, it can also include a memory) based on the machine instructions in the preset instruction set to perform the operation indicated by the machine instruction.
- the machine instruction carries information about the tensor register group to be used and information about the tensor registers of the tensor register group.
- the preset instruction set is divided into: a data loading instruction subset, a matrix multiplication and accumulation instruction subset, and a data storage instruction subset. They are explained below.
- the instruction subset may include: an instruction for instructing to load matrix data from a memory into a tensor register of a corresponding tensor register group.
- machine instructions in the instruction subset may be shown in Table 1 below:
- the instruction subset may include: instructions for instructing to perform matrix multiplication and accumulation calculations based on matrix data stored in a tensor register.
- machine instructions in the instruction subset may be shown in Table 2 below:
- the instruction subset includes: an instruction for instructing to store data of a tensor register storing a result of an MMA calculation into a memory.
- this method reads data from tensor registers instead of directly from memory, which not only improves data access efficiency but also avoids the power consumption caused by memory access data; on the other hand, since there is no need to use multiple memories to store data, the space occupied by them is also reduced; on the other hand, using a tensor register file also reduces the implementation cost of the solution compared to using multiple memories. Therefore, the solution of the embodiment of the present disclosure achieves more efficient MMA calculation under the conditions of low cost, low power consumption and less space occupation.
- this step can be implemented as follows: loading the data of multiple matrices to be subjected to MMA calculation into the tensor register file through the data loading storage engine in the MMA unit.
- the data of multiple matrices to be subjected to matrix multiplication and accumulation calculations can be loaded into a tensor register file based on a first machine instruction.
- the first machine instruction carries information about the tensor register group to be used and information about the tensor registers in the tensor register group. For example, the machine instructions are shown in Table 1.
- the data load storage engine in the MMA operation unit receives an instruction for instructing to read data, it will read the machine instructions for the data of multiple matrices to be calculated by MMA from the memory. Then, after the tensor register file receives the instruction for instructing to read data, i.e., the first machine instruction, it will read the relevant data from the data load storage engine and read it into each tensor register group of the tensor register file.
- the tensor register file includes at least three tensor register groups, each of which includes multiple tensor registers, and different tensor register groups are used to store data of different matrices in the multiple matrices.
- the tensor register file includes three tensor register groups, each of which includes 8 tensor registers.
- Figure 4B is only an example.
- the tensor register file may include a larger number of tensor register groups to meet the needs of calculation.
- the number of tensor registers included in each tensor register group can also be more, or less, and can be set by those skilled in the art according to actual needs.
- the data of each matrix is stored in the tensor registers of the corresponding different tensor register groups according to the size of the bytes occupied by the data of each matrix and the rule of storing from the low bit.
- the data load storage engine reads multiple data in matrices A, B, and C from memory. Then, based on the triggering of the first machine instruction to read the data, the tensor register file reads the matrices A, B, C and data obtained by the data load storage engine into the corresponding tensor register groups A, B, and C.
- Tensor register groups A, B, and C each store the data of matrices A, B, and C through their respective tensor registers, according to the byte size of the data of each matrix, and according to the rule of storing from the lowest bit.
- a machine instruction includes an opcode and an operand.
- the opcode typically indicates the operation to be performed, such as data loading, data storage, or data calculation.
- the operand is the object of the opcode's operation.
- the machine instruction includes information about the registers where the operands are located.
- the registers are registers in at least three tensor register groups in a tensor register file. Different tensor register groups are used to store data for different matrices in the multiple matrices to be calculated by matrix multiplication and accumulation.
- the operands in the computation instruction include: the identifier of the tensor register group where the data of the multiple matrices to be subjected to the matrix multiplication and accumulation calculation is located, and the identifiers of the tensor registers in the tensor register group.
- IMMA is the opcode indicating an integer MMA calculation
- reg_a_id represents A[a_id]
- A is the identifier of the tensor register group, i.e., TensorA
- a_id represents the identifier of the tensor register in the tensor register group, i.e., the register with the identifier id in TensorA.
- reg_b_id and “reg_c_id” are similar to "reg_a_id” and are not described in detail here.
- the operands in the store instruction include: the identifier of the tensor register group where the data to be stored is located and the identifier of the tensor register in the tensor register group.
- ST is the opcode indicating that data is to be stored
- TeensorC is the identifier of the tensor register group where the data to be stored is located
- reg_id is the identifier of the specific register in the tensor register group where the data to be stored is located, that is, the register identified by "reg_id” in TensorC.
- Step S604 Execute the operation indicated by the machine instruction.
- the calculation instruction is sent to the matrix multiplication engine to instruct the matrix multiplication engine to perform a matrix multiplication and accumulation calculation based on the matrix data loaded in the tensor register;
- a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component (e.g., random access memory (RAM), read-only memory (ROM), flash memory, etc.) that can store or receive software or computer code.
- RAM random access memory
- ROM read-only memory
- flash memory etc.
- the methods described herein are implemented.
- a general purpose computer accesses code for implementing the methods shown herein, the execution of the code transforms the general purpose computer into a special purpose computer for executing the methods shown herein.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Optimization (AREA)
- Mathematical Analysis (AREA)
- Computational Mathematics (AREA)
- Pure & Applied Mathematics (AREA)
- Mathematical Physics (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Algebra (AREA)
- Databases & Information Systems (AREA)
- Executing Machine-Instructions (AREA)
Abstract
本公开实施例提供了一种矩阵乘法累加运算单元及运算方法、硬件加速器、电子设备,其中,矩阵乘法累加运算单元包括:数据加载存储引擎、张量寄存器文件、矩阵乘法引擎;数据加载存储引擎,用于加载待进行矩阵乘法累加计算的多个矩阵的数据;张量寄存器文件,用于存储从数据加载存储引擎获取的多个矩阵的数据;张量寄存器文件包括至少三个张量寄存器组,每个张量寄存器组包括多个张量寄存器,不同张量寄存器组用于存储所述多个矩阵中不同矩阵的数据;矩阵乘法引擎,用于基于张量寄存器文件中存储的多个矩阵的数据,进行矩阵乘法累加计算。通过本公开实施例,在低成本和低功耗、且具有较少占用空间的条件下,实现了更为高效的MMA计算。
Description
本公开要求于2024年03月28日提交中国专利局、申请号为202410371734.4、申请名称为“矩阵乘法累加运算单元及运算方法、硬件加速器、电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。
本公开实施例涉及芯片技术领域,尤其涉及一种矩阵乘法累加运算单元、一种矩阵乘法累加运算方法、一种硬件加速器及一种电子设备。
MMA(Matrix Multiply Accumulation,矩阵乘法累加)广泛存在于机器学习模型如LLM(Large Language Model,大语言模型)等的运算过程中,一种MMA计算示例如图1所示。在图1中,A为输入矩阵,m*k维;B为权重矩阵,k*n维;C为累加矩阵,m*n维,MMA实现为AB+C。在实际应用中,会使用AB+C的结果更新C,但在图1中,为便于表示,将AB+C的结果表示为D,形成D=AB+C的MMA形式。
因为机器学习模型中涉及大量的类似上述MMA计算,因此,需要较高的带宽和算力支撑。为此,一种相关技术中,设置了多个存储器Memory,以分别存储MMA计算中的上述A、B、C矩阵,在计算时分别从该多个存储器读取相应数据,实现MMA计算。
但是这种方式中,一方面多个存储器会占用较多的空间,对其访问也会消耗大量的带宽和算力,为其所在元件的实现造成了挑战;另一方面,多个存储器也增加了方案实现成本。因此,如何在提供足够算力支撑的基础上,还能以较低成本、较小占用空间实现对MMA计算的硬件支持,成为亟待解决的问题。
有鉴于此,本公开实施例提供一种MMA实现方案,以至少部分解决上述问题。
根据本公开实施例的第一方面,提供了一种矩阵乘法累加运算单元,包括:数据加载存储引擎、张量寄存器文件、矩阵乘法引擎;其中:所述数据加载存储引擎,用于加载待进行矩阵乘法累加计算的多个矩阵的数据;所述张量寄存器文件,用于存储从所述数据加载存储引擎获取的所述多个矩阵的数据;其中,所述张量寄存器文件包括至少三个张量寄存器组,每个张量寄存器组包括多个张量寄存器,不同张量寄存器组用于存储所述多个矩阵中不同矩阵的数据;所述矩阵乘法引擎,用于基于所述张量寄存器文件中存储的多个矩阵的数据,进行矩阵乘法累加计算。
根据本公开实施例的第二方面,提供了一种矩阵乘法累加运算方法,包括:获取用于矩阵乘法累加运算过程的机器指令,所述机器指令中包含有操作数所在的寄存器的信息,所述寄存器为张量寄存器文件中的至少三个张量寄存器组中的寄存器,不同张量寄存器组用于存储待进行矩阵乘法累加计算的多个矩阵中不同矩阵的数据;执行所述机器指令所指示的操作。
根据本公开实施例的第三方面,提供了一种矩阵乘法累加运算方法,包括:将待进行矩阵乘法累加计算的多个矩阵的数据加载至张量寄存器文件,其中,所述张量寄存器文件包括至少三个张量寄存器组,每个张量寄存器组中包括多个张量寄存器,不同张量寄存器组用于存储所述多个矩阵中不同矩阵的数据;基于所述张量寄存器文件中存储的多个矩阵的数据,进行矩阵乘法累加计算。
根据本公开实施例的第四方面,提供了一种硬件加速器,其至少包括指令解码器,和如第一方面所述的矩阵乘法累加运算单元;其中,所述指令解码器用于对指示进行矩阵乘法累加计算的机器指令进行解码,并根据解码结果控制所述矩阵乘法累加运算单元进行矩阵乘法累加计算。
根据本公开实施例的第五方面,提供了一种电子设备,其至少包括:处理器和如第四方面所述的硬件加速器;其中,所述处理器用于向所述硬件加速器发送指示进行矩阵乘法累加计算的指令;所述硬件加速器根据所述指令进行矩阵乘法累加计算。
根据本公开实施例的第六方面,提供了一种计算机可读存储介质,其中,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行被处理器指定时用于实现如第二方面和/或第三方面所述的方法。
根据本公开实施例的第七方面,提供了一种计算机程序产品,包括计算机指令,所述计算机指令指示电子设备通过如第四方面所述的硬件加速器,尤其是硬件加速器中的矩阵乘法累加运算单元,执行如第二方面和/或第三方面所述的方法。
根据本公开实施例提供的方案,在MMA运算单元中设置张量寄存器文件,并且,该张量寄存器文件被划分为至少三个张量寄存器组,用来存储待进行MMA计算的不同矩阵的数据。由此,在需要进行MMA计算时,MMA运算单元中的数据加载存储引擎可以将待计算的多个矩阵的数据分别加载发送至不同的张量寄存器组;在此基础上,矩阵乘法引擎可以同时从这些张量寄存器组中读取不同矩阵的数据,进而进行MMA计算。相较于多个存储器存储矩阵数据的方案,一方面,这种方式从张量寄存器中读取数据,而非直接从存储器Memory中读取数据,不仅提高了数据访问效率,也避免了由存储器访问数据带来的功耗;另一方面,因无需使用多个存储器存储数据,也减小了由其占用的空间;再一方面,使用一个张量寄存器文件相较于使用多个存储器,也降低了方案实现成本。由此,本公开实施例的方案在低成本和低功耗、且具有较少占用空间的条件下,实现了更为高效的MMA计算。
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开实施例中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。
图1为一种MMA计算的示意图;
图2为一种适用本公开实施例方案的示例性系统的结构示意图;
图3为根据本公开实施例的一种硬件加速器的结构示意图;
图4A为根据本公开实施例的一种MMA运算单元的结构示意图;
图4B为图4A所示MMA运算单元中的张量寄存器文件的结构示意图;
图4C为图4B所示张量寄存器文件中的张量寄存器的存储示意图;
图4D为图4A所示MMA运算单元中的一种示例性的矩阵乘法引擎的结构示意图;
图5为根据本公开实施例的一种MMA运算方法的步骤流程图;
图6为根据本公开实施例的另一种MMA运算方法的步骤流程图。
为了使本领域的人员更好地理解本公开实施例中的技术方案,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本公开实施例一部分实施例,而不是全部的实施例。基于本公开实施例中的实施例,本领域普通技术人员所获得的所有其他实施例,都应当属于本公开实施例保护的范围。
下面结合本公开实施例附图进一步说明本公开实施例具体实现。
图2示出了一种适用本公开实施例方案的示例性系统。如图2所示,该系统100可以包括一个或多个电子设备102、和通信网络104,图2中示例为多个电子设备。该电子设备可实现为服务端设备、或云端设备、或终端设备,例如,台式计算机、平板计算机、服务器,等等,本公开实施例不对电子设备的具体形式进行限制。
通信网络104可以是一个或多个有线和/或无线网络的任何适当的组合。例如,通信网络104能够包括以下各项中的任何一种或多种:互联网、内联网、广域网(Wide Area Network,WAN)、局域网(Local Area Network,LAN)、无线网络、数字订户线路(Digital Subscriber Line,DSL)网络、帧中继网络、异步转移模式(Asynchronous Transfer Mode,ATM)网络、虚拟专用网(Virtual Private Network,VPN)和/或任何其它合适的通信网络。电子设备102能够通过一个或多个通信链路(例如,通信链路112)连接到通信网络104。通信链路可以是适合于在电子设备102之间传送数据的任何通信链路,诸如网络链路、拨号链路、无线链路、硬连线链路、任何其它合适的通信链路或此类链路的任何合适的组合。
本公开实施例中,电子设备102可以执行机器学习算法,该机器学习算法的执行过程可以包括MMA计算。在一个示例中,电子设备102至少包括一个或多个处理器1022、存储器1024、通信接口1026、通信总线1028以及硬件加速器1020。
其中:
处理器1022、存储器1024、通信接口1026、以及硬件加速器1020通过通信总线1028完成相互间的通信。
通信接口1026,用于与其它电子设备进行通信。
存储器1024可以存储由处理器1022可执行的指令,及其它数据和信息,如进行MMA计算的矩阵的数据和信息等。存储器1024可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory)。
处理器1022可能是CPU(Central Processing Unit,中央处理器),或者是GPU(Graphic Processing Unit,图形处理器)或者是特定集成电路ASIC(Application Specific Integrated Circuit),或者是被配置成实施本公开实施例方案的一个或多个集成电路。当电子设备102包括或多个处理器时,该多个处理器可以是同一类型的处理器,如一个或多个CPU;也可以是不同类型的处理器,如一个或多个CPU以及一个或多个ASIC。
本示例中,硬件加速器1020用于对数据计算进行加速,如对机器学习模型中涉及的各种数据计算(包括但不限于MMA计算)进行加速。示例性地,一种硬件加速器1020的结构如图3所示。
由图3可见,该硬件加速器1020中至少包括:指令队列、指令解码器和用于进行计算加速的运算组件,本公开实施例中,该运算组件实现为MMA运算单元,以实现MMA的计算加速。其中,指令队列可从硬件加速器1020外部(如从CPU或GPU或外部存储器等)接收需要由硬件加速器1020执行的机器指令。进而,指令解码器可以对机器指令进行解码,并向硬件加速器1020中的其它元件发送控制信号,以便执行机器指令。本公开实施例中,该机器指令可以包括用于指示进行MMA计算的指令,该指令可由MMA运算单元执行。
可选地,硬件加速器1020中还可以包括存储器,该存储器可以设置于MMA运算单元的外部或内部,用于接收硬件加速器1020在执行机器指令时使用的数据,如矩阵的数据等;还可以存储机器指令执行过程中产生的数据。
在此示例性框架下,为有效支撑MMA计算,本公开实施例提供了一种MMA运算单元,如图4A所示,其包括:数据加载存储引擎、张量寄存器文件、矩阵乘法引擎。
其中,数据加载存储引擎,用于加载待进行MMA计算的多个矩阵的数据;张量寄存器文件,用于存储从数据加载存储引擎读取多个矩阵的数据,该张量寄存器文件包括至少三个张量寄存器组,每个张量寄存器组中包括多个张量寄存器,不同张量寄存器组用于存储多个矩阵中不同矩阵的数据;矩阵乘法引擎,用于基于张量寄存器文件中存储的多个矩阵的数据,进行MMA计算。
寄存器文件(register file)又称寄存器堆,其包括由多个寄存器组成的阵列,可选地,寄存器文件可由快速的SRAM(Static Random-Access Memory,静态随机存取存储器)实现,也可由触发器搭建。本公开实施例中,使用寄存器文件来存取张量,因此也称为张量寄存器文件。张量有多种形式,本公开实施例方案中,使用矩阵形式,也由此,张量寄存器文件可存储用于MMA计算的多个矩阵的数据。
一种存储用于MMA计算的多个矩阵的数据的张量寄存器文件的示例性实现形式如图4B所示。
由图4B中可见,该张量寄存器文件包括3个张量寄存器组,每个张量寄存器组中包括8个张量寄存器,不同的张量寄存器组用于存储不同矩阵的数据。具体到图4B中,该3个张量寄存器组被分别称为张量寄存器组A、B和C,以分别存储如图1中所示的、用于进行MMA计算的矩阵A、B和C(需要说明的是,本公开实施例中,以矩阵A、B、C指示前述图1的MMA计算中各个位置的矩阵,并不表示某一具体矩阵)。本公开实施例中,每个张量寄存器组中包括的多个张量寄存器的位数相同,可选地,整个张量寄存器文件中包含的所有张量寄存器的位数均相同。本公开实施例中,不对张量寄存器的位数进行具体限制。需要说明的是,虽然图4B中以三个张量寄存器组为示例,但本领域技术人员应当明了,在实际应用中,可以设置更多的张量寄存器组,以满足实际运算需求。当将该更多的张量寄存器组用于MMA计算时,各张量寄存器组与存储相同MMA计算位置的矩阵的张量寄存器组结合使用。假设,有六个张量寄存器组,分别为张量寄存器组A1、A2、B1、B2、C1、C2,则张量寄存器组A1和A2结合使用,B1和B2结合使用,C1和C2结合使用。每个张量寄存器组中的张量寄存器的数量也可由本领域技术人员根据实际需求适当设置,本公开实施例对此也不作限制。
此外,本公开实施例的MMA运算单元还可包括存储器,该存储器至少可以用于存储从MMA运算单元外部(如硬件加速器、或硬件加速器外部的元件)获得的、待进行MMA计算的多个矩阵的数据,以在后续提供给数据加载存储引擎。可选地,还可存储MMA运算结果和/或过程数据等。但不限于此,该存储器也可设置于MMA运算单元的外部。在具体存储时,存储器可采用以行主序的方式存储获得的矩阵的数据,或者,也可以采用以列主序的方式存储获得的矩阵的数据。
仍以MMA为计算矩阵A*B+C为例,如图4A所示,在接收到指令解码器发送来的指示进行MMA计算的指令后,数据加载存储引擎可以从存储器中读取待进行MMA计算的多个矩阵即矩阵A、B和C的数据;接着,张量寄存器文件再从数据加载存储引擎读取矩阵A、B和C的数据,本公开实施例中,矩阵A、B和C的数据将分别存储至对应的张量寄存器组A、B和C中;张量寄存器文件具有3个读端口和1个写端口,矩阵乘法引擎可以通过该3个读端口分别从张量寄存器组A、B和C中读取出当前计算使用的矩阵A、B和C的数据,并进行MMA计算。在计算完成后,矩阵乘法引擎会将MMA计算结果返回张量寄存器文件存储,如存储至张量寄存器组C中,再在到达设定时机或接收到指令时,由数据加载存储引擎从张量寄存器文件中读出数据存储至存储器中。
其中,数据加载存储引擎可以实现为任意适当的元件形式,包括但不限于加载器、或者用于进行数据加载和/或存储的硬件逻辑。而矩阵乘法引擎则可基于包括加法器和乘法器在内的元件实现。
为了保证矩阵数据存取的高效性,提高MMA计算的整体效率,在一种可行方式中,张量寄存器文件会在接收到多个矩阵的数据后,根据各矩阵的数值精度,按照从低位存储的规则,将各矩阵的数据分别存储至对应的不同张量寄存器组的张量寄存器中。其中,不同的数据类型对应有不同的数值精度,而对于一个矩阵来说,该矩阵中所有元素具有相同的类型,由此,也具有相同的数值精度。
因在实际计算中,张量寄存器中存储的都是即将要进行计算的矩阵的数据,也即矩阵元素,则一个张量寄存器一次可存储的某个矩阵的所有元素。对于较大的矩阵,可以先将其切分为适于张量寄存器存储的子矩阵,再将该子矩阵的所有元素存储至其对应的张量寄存器组的某个张量寄存器中。由此可见,一个张量寄存器组可同时存储多个矩阵的数据或者多个子矩阵的数据,以便于后续的并行计算。例如,在图4B中,一个张量寄存器组中包括有8个张量寄存器,则意味着该张量寄存器组一次可读入8个矩阵的矩阵元素。示例性地,假设矩阵A-1、A-2、A-3、A-4均为4*5维的矩阵,则张量寄存器组A可将读入的矩阵A-1、A-2、A-3、A-4的矩阵元素分别存储至其中的四个张量寄存器中;再假设有矩阵A-1、A-2、A-3、……A-8共8个矩阵,则张量寄存器组A可以将这8个矩阵的数据分别存储至张量寄存器组A包括的8个张量寄存器中,每个张量寄存器存储其中的一个矩阵的矩阵元素。
对于某一个矩阵来说,其矩阵元素的数据类型大小即数值精度是相同的,数据类型通常包括:4位精度(FP4/NF4,4bit)、8位精度(FP8,8bit)、半精度(FP16/BF16,16bit)、单精度(FP32/TF32,32bit)、双精度(FP64,64bit)等。为此,张量寄存器文件在接收到多个矩阵的数据后,针对各矩阵的数据类型,按照数据类型对应的数值精度,从张量寄存器的低位开始,将该矩阵的数据存储至对应的张量寄存器组的张量寄存器中,未使用的高位可置0,以使存储方式更便于不同元素大小的矩阵存储。
例如,假设张量寄存器为64位寄存器,矩阵A为一个的整形矩阵,其矩阵元素数据类型大小为8bit。再假设将矩阵A存储至张量寄存器组A的第01号寄存器中,则a11将被存储至第01号寄存器的第0-7位,a12将被存储至第01号寄存器的第8-15位,a21将被存储至第01号寄存器的第16-23位,a22将被存储至第01号寄存器的第24-31位,而第01号寄存器的第32-63位将被置0。以半字为单位或以全字为单位存储的情况与此类似。
通过这种存储的方式,一方面,因数据读、写均从低位开始,可以使得对张量寄存器中存储的数据的存入和读出都更符合实际需求,降低存入和读出成本;另一方面,在存储单位确定后,后续从张量寄存器中读取这些数据时,也可以更为高效的读取,提高了数据存入和读出效率。
以下,结合图4C对该存储方式进行说明。针对张量寄存器,根据矩阵元素的数据类型为其设置了相对应的存储规则。由图4C中可见,不管是哪种存储规则,均是从张量寄存器的最低有效位LSB开始向最高有效位MSB方向进行数据存储。对于某个维度为(8*8)的矩阵来说,假如其矩阵元素对应的数值精度为8bit(如FP8(8-bit Floating Point)),则会使用以8位精度为单位进行存储的低位存储方式,该方式下,一次读入某个张量寄存器的该矩阵的元素将占用64个字节(byte)的寄存器位宽。若假如该矩阵的矩阵元素的数值精度为16bit(如FB16/BF16(Brain Floating Point 16)),则会使用以半精度为单位进行存储的低位存储方式,该方式下,一次读入某个张量寄存器的该矩阵的元素将占用128字节的寄存器位宽。而若假如该矩阵的矩阵元素的数值精度为32bit(如FP32),则会使用以全精度为单位进行存储的低位存储方式,该方式下,一次读入某个张量寄存器的该矩阵的元素将占用256个字节的寄存器位宽。
结合图4B,假设在张量寄存器组A中已读入了矩阵A的矩阵元素至某个张量寄存器,在张量寄存器组B中已读入了矩阵B的矩阵元素至某个张量寄存器,在张量寄存器组C中已读入矩阵C的矩阵元素至某个张量寄存器,则这些读入的矩阵元素会被作为MMA计算的操作数,由矩阵乘法引擎从各个张量寄存器组中读出,进行MMA计算。
此外,需要说明的是,上述示例均以读入张量寄存器组中的为同一矩阵的矩阵元素为例,但在实际应用中,可能某个张量寄存器组在一次读入操作中,会读入不同矩阵的矩阵元素,此种情况下,同一张量寄存器组的不同张量寄存器间可能存在不同存储方式,如,部分张量寄存器为以8位精度为单位低位存储的方式、部分张量寄存器为以半精度为单位低位存储的方式等等。
在张量寄存器文件已读入相应的矩阵数据后,则可由矩阵乘法引擎基于这些矩阵数据执行MMA计算。为进一步提高MMA计算效率,本公开实施例中提供了一种执行效率更高的矩阵乘法引擎架构,如图4D所示。
由图4D中可见,该矩阵乘法引擎通过列选择器阵列、行选择器阵列、乘法器阵列和加法器阵列,基于张量寄存器文件中存储的多个矩阵的数据,进行矩阵乘法累加计算。
具体地,当张量寄存器文件接收到读数据信号(如图4D中所示的“MMA Read signals”),则会将其中的数据分别发送至矩阵乘法引擎中相对应的各个阵列,如,将张量寄存器组A中存储的矩阵A(m*k)的数据发送给列选择器阵列,将张量寄存器组B中存储的矩阵B(k*n)的数据发送给行选择器阵列,将张量寄存器组C中存储的矩阵C(m*n)的数据发送给加法器阵列。列选择器阵列和行选择器阵列再分别将对应的数据发送给3D乘法器阵列,以同时对多个矩阵元素进行矩阵乘法计算,计算结果再发送给加法器阵列,与矩阵C的数据相加,获得MMA计算累加结果后,可写回张量寄存器文件中,如写回张量寄存器文件的张量寄存器组C中。
其中,列选择器阵列包括k列多路选择器,第i列多路选择器会将矩阵A的第i列数据<a1i,a2i,…,ami>发送给3D乘法器阵列中的第i个阵列,i={1,2,……k}。行选择器阵列包括k行多路选择器,第i行多路选择器会将矩阵B的第i行数据<bi1,bi2,…,bin>发送给3D乘法器阵列中的第i个阵列,如上所述,i={1,2,……k}。3D乘法器阵列包括k个阵列,第i个阵列通过第m x n个MUL(乘法)单元进行外积计算:MUL_Resultmn=<a1i,a2i,…,ami>Tx<bi1,bi2,…,bin>。加法器阵列包括mxn个加法器单元,第<i,j>个加法器ADDij将来自于3D乘法器阵列的k个阵列中对应于同一乘法器位置的加和结果MUL_Resultij与输入加法器阵列的矩阵C中的数据Cij进行加法计算(例如,图4D中,第k个阵列的MUL1n将与第k-1个阵列、第k-2个阵列……第1个阵列中的对应位置的MUL1n加和,获得加和结果MUL_Result1n,该MUL_Result1n会在加法器阵列中,通过ADD1n与矩阵C中对应位置的数据相加);张量累加寄存器Tensor ACC将加法器阵列中的所有值进行约减(reduce),形成以行为主序的张量数据ACCm*n,并将其写回张量寄存器文件。由此可见,因列选择器阵列、行选择器阵列、3D乘法器阵列等都为3D结构,更易于通过3D堆叠架构实现,能够使得芯片面积更小,节约芯片空间。
上述内容对本公开实施例中的MMA运算单元从硬件角度进行了说明,但MMA计算的执行不仅需要硬件支持,也需有相适配的ISA(Instruction Set Architecture,指令集架构)支持。为此,本公开实施例中提供了与硬件实现相适配的预设指令集,使得MMA运算单元可以基于该预设指令集中的机器指令,控制数据加载存储引擎、张量寄存器文件和矩阵乘法引擎(可选地,还可包括存储器)中的至少一者,执行机器指令所指示的操作。其中,所述机器指令中携带有待使用的张量寄存器组的信息及张量寄存器组的张量寄存器的信息。根据实现功能的不同,将该预设指令集分为:数据加载指令子集、矩阵乘法累加指令子集、和数据存储指令子集。以下,分别进行说明。
(一)数据加载指令子集
该指令子集可以包括:用于指示从存储器中加载矩阵的数据至对应的张量寄存器组的张量寄存器中的指令。
示例性,该指令子集中的机器指令可如下表一所示:
(二)MMA指令子集
该指令子集可以包括:用于指示基于张量寄存器中存储的矩阵的数据,进行矩阵乘法累加计算的指令。
示例性,该指令子集中的机器指令可如下表二所示:
(三)数据存储指令子集
该指令子集包括:用于指示将存储MMA计算的结果的张量寄存器的数据存储至存储器的指令。
示例性,该指令子集中的机器指令可如下表三所示:
通过本实施例的方案,在MMA运算单元中设置张量寄存器文件,并且,该张量寄存器文件被划分为至少三个张量寄存器组,用来存储待进行MMA计算的不同矩阵的数据。由此,在需要进行MMA计算时,MMA运算单元中的数据加载存储引擎可以将待计算的多个矩阵的数据分别加载发送至不同的张量寄存器组;在此基础上,矩阵乘法引擎可以同时从这些张量寄存器组中读取不同矩阵的数据,进而进行MMA计算。相较于多个存储器存储矩阵数据的方案,一方面,这种方式从张量寄存器中读取数据,而非直接从存储器Memory中读取数据,不仅提高了数据访问效率,也避免了由存储器访问数据带来的功耗;另一方面,因无需使用多个存储器存储数据,也减小了由其占用的空间;再一方面,使用一个张量寄存器文件相较于使用多个存储器,也降低了方案实现成本。由此,本公开实施例的方案在低成本和低功耗、且具有较少占用空间的条件下,实现了更为高效的MMA计算。
以下,基于上述硬件架构,对本公开实施例的一种MMA运算方法进行说明,其步骤流程如图5所示。
参照图5,该MMA运算方法包括以下步骤:
步骤S502:将待进行MMA计算的多个矩阵的数据加载至张量寄存器文件。
当采用如上所述的硬件加速器,尤其是硬件加速器中的MMA运算单元实施本实施例的步骤时,则本步骤可实现为:通过MMA单元中的数据加载存储引擎,将待进行MMA计算的多个矩阵的数据加载至张量寄存器文件中。
在具体计算时,可以基于第一机器指令,将待进行矩阵乘法累加计算的多个矩阵的数据加载至张量寄存器文件。其中,该第一机器指令中携带有待使用的张量寄存器组的信息及该张量寄存器组的张量寄存器的信息。示例性地,如表一中所示的机器指令。
例如,MMA运算单元中的数据加载存储引擎接收到用于指示读取数据的指令后,会从存储器中读取待进行MMA计算的多个矩阵的数据的机器指令。然后,张量寄存器文件接收到指示读取数据的指令即第一机器指令后,会从数据加载存储引擎读取相关数据,并读入至张量寄存器文件的各个张量寄存器组中。张量寄存器文件包括至少三个张量寄存器组,每个张量寄存器组中包括多个张量寄存器,不同张量寄存器组用于存储多个矩阵中不同矩阵的数据。如图4B所示,张量寄存器文件中包括三个张量寄存器组,每个张量寄存器组包括8个张量寄存器。但需要说明的是,图4B仅为示例性说明,在实际应用中,张量寄存器文件中可以包括更多数量的张量寄存器组,以备计算所需。每个张量寄存器组中包括的张量寄存器的数量也可以更多,当然,也可以更少,由本领域技术人员根据实际需求设置即可。
张量寄存器文件在具体存储时,在接收到多个矩阵的数据后,根据各矩阵的数据所占字节的大小,按照从低位存储的规则,将各矩阵的数据分别存储至对应的不同张量寄存器组的张量寄存器中。
仍以MMA为计算矩阵A*B+C为示例,数据加载存储引擎会从存储器中读取矩阵A、B、C中的多个数据,进而张量寄存器文件基于读取数据的第一机器指令的触发,将数据加载存储引擎获得的矩阵A、B、C和数据分别读入对应的张量寄存器组A、B、C中。张量寄存器组A、B、C各自通过各自的张量寄存器,根据各矩阵的数据所占字节的大小,按照从低位存储的规则,存储矩阵A、B、C的数据。
步骤S504:基于张量寄存器文件中存储的多个矩阵的数据,进行MMA计算。
如前所述,当采用前述硬件加速器,尤其是其中的MME运算单元执行本实施例的方案时,本步骤可以通过MME运算单元中的矩阵乘法引擎,基于张量寄存器存储的多个矩阵的数据,进行MMA计算。
在具体进行计算时,矩阵乘法引擎可以根据第二机器指令,基于张量寄存器文件中存储的多个矩阵的数据,进行MMA计算。其中,该第二机器指令中携带有待使用的张量寄存器组的信息及该张量寄存器组的张量寄存器的信息。示例性地,如表二中所示的指令。矩阵乘法引擎可采用如图4D中所示的结构,基于列选择器阵列、行选择器阵列、乘法器阵列和加法器阵列,基于张量寄存器文件中存储的多个矩阵的数据,进行MMA计算。
通过本实施例,实现了MMA的有效计算,相较于多个存储器存储矩阵数据的方案,一方面,本实施例的方案从张量寄存器中读取数据,而非直接从存储器Memory中读取数据,不仅提高了数据访问效率,也避免了由存储器访问数据带来的功耗;另一方面,因无需使用多个存储器存储数据,也减小了由其占用的空间;再一方面,使用一个张量寄存器文件相较于使用多个存储器,也降低了方案实现成本。由此,本实施例的方案在低成本和功耗、少占用空间的条件下,实现了更为高效的MMA计算。
需要说明的是,本实施例中各步骤的具体实现描述较为简单,本领域技术人员在具体实现时,可参照前述硬件实施例中的相关描述,在此不再赘述。
参照图6,本公开实施例还提供了另一种MMA运算方法。该方法基于预设指令集,从指令被执行的角度对MMA运算方法进行描述。但需要说明的是,前述指令的执行以本公开实施例提供的MMA运算单元为基础,但本领域技术人员应当明了的是,该指令集也可在具有本公开实施例的张量寄存器文件的其它器件上执行。
本实施例的MMA运算方法包括以下步骤:
步骤S602:获取用于矩阵乘法累加运算过程的机器指令。
一般来说,机器指令会包括操作码和操作数,操作码通常用于指示进行何种操作,如数据加载、数据存储、数据计算,等等;操作数则是操作码的操作对象。本实施例中,机器指令中包含有操作数所在的寄存器的信息,所述寄存器为张量寄存器文件中的至少三个张量寄存器组中的寄存器,不同张量寄存器组用于存储待进行矩阵乘法累加计算的多个矩阵中不同矩阵的数据。
其中,该张量寄存器文件、张量寄存器文件中的张量寄存器组及张量寄存器组中的张量寄存器的具体设置和实现,均可参照前述实施例中相应部分的描述,在此不再赘述。
本实施例中,所述机器指令至少包括:加载指令、计算指令和存储指令。
其中:
加载指令,用于指示从存储器中加载待进行矩阵乘法累加运算的矩阵的数据至对应的张量寄存器组的张量寄存器中;计算指令,用于指示基于张量寄存器中加载的矩阵的数据,进行矩阵乘法累加计算;存储指令,用于指示将存储矩阵乘法累加计算的结果的张量寄存器的数据存储至存储器。
则,
当所述机器指令为加载指令时,加载指令中的操作数包括:待加载的数据所在的存储器的地址、加载入所述数据的张量寄存器组的标识和该张量寄存器组中的张量寄存器的标识。以前述表一中的“LD_TensorA reg_id,mem_addr”为示例,“LD”为操作码,指示数据加载操作;“mem_addr”为待加载的数据所在的存储器的地址;“TensorA”为加载入所述数据的张量寄存器组的标识;“reg_id”为“TensorA”中的张量寄存器的标识。
当所述机器指令为计算指令时,计算指令中的操作数包括:待进行矩阵乘法累加计算的多个矩阵的数据所在的张量寄存器组的标识和该张量寄存器组中的张量寄存器的标识。以前述表二中的“IMMA reg_a_id,reg_b_id,reg_c_id,e_size,m,k,n”为示例,“IMMA”为操作码,指示整形MMA计算;“reg_a_id”表示A[a_id],其中,“A”为张量寄存器组的标识,即TensorA,“a_id”表示张量寄存器组中的张量寄存器的标识,即TensorA中标识id的寄存器。“reg_b_id”和“reg_c_id”和“reg_a_id”类似,不再一一详述。
当所述机器指令为存储指令时,存储指令中的操作数包括:待存储的数据所在的张量寄存器组的标识和该张量寄存器组中的张量寄存器的标识。以前述表二中的“ST_TensorC reg_id,mem_addr”为例,“ST”为操作码,指示存储数据;“TensorC”为待存储数据所在的张量寄存器组的标识;“reg_id”为该待存储数据所在的张量寄存器组中的具体寄存器的标识,即TensorC中的“reg_id”所标识的寄存器。
步骤S604:执行所述机器指令所指示的操作。
在获取到上述机器指令后,相应的器件即可基于机器指令进行相应的操作,如根据机器指令中的操作码对操作数进行操作码对应的操作。如前所述,本实施例中,所述相应的器件不限于本公开实施例中的MMA运算单元,也可为其它器件。
但若该机器指令仍由本公开实施例中的MMA运算单元执行,则前述获取用于矩阵乘法累加运算过程的机器指令可以实现为:通过指令解码器解码获取用于矩阵乘法累加运算过程的机器指令。此外,前述执行所述机器指令所指示的操作可以实现为:根据所述机器指令,控制矩阵乘法累加运算单元执行所述机器指令所指示的操作。
如前所述,该矩阵乘法累加运算单元包括:数据加载存储引擎、张量寄存器文件、矩阵乘法引擎。则,具体地,根据所述机器指令,控制矩阵乘法累加运算单元执行所述机器指令所指示的操作将实现为:
当所述机器指令为加载指令时,将该加载指令发送给数据加载存储引擎,以指示数据加载存储引擎从存储器加载待进行矩阵乘法累加运算的矩阵的数据至对应的张量寄存器组的张量寄存器中;
当所述机器指令为计算指令时,将该计算指令发送给矩阵乘法引擎,以指示矩阵乘法引擎基于张量寄存器中加载的矩阵的数据,进行矩阵乘法累加计算;
当所述机器指令为存储指令时,将该存储指令发送给数据加载存储引擎,以指示数据加载存储引擎将存储矩阵乘法累加计算的结果的张量寄存器的数据存储至存储器中。
由MMA运算单元实现所述机器指令的具体过程可参照前述实施例中相关部分的描述,在此不再赘述。
通过本实施例可见,本公开实施例提供的适用于MMA运算的机器指令,可普适于具有相应张量寄存器文件结构的任意适当器件中,以实现MMA运算,提高MMA访存和计算效率。
本公开实施例还提供了一种硬件加速器,其至少包括指令解码器,和矩阵乘法累加运算单元;其中,指令解码器用于对指示进行矩阵乘法累加计算的机器指令进行解码,并根据解码结果控制所述矩阵乘法累加运算单元进行矩阵乘法累加计算。
本公开实施例还提供了一种电子设备,其至少包括:处理器和硬件加速器;其中,处理器用于向硬件加速器发送指示进行矩阵乘法累加计算的指令;硬件加速器根据指令进行矩阵乘法累加计算。
本公开实施例还提供了一种计算机可读存储介质,其中,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行被处理器指定时用于实现上述方法实施例中的MME运算方法对应的操作。
本公开实施例还提供了一种计算机程序产品,包括计算机指令,该计算机指令指示电子设备通过硬件加速器,尤其是硬件加速器中的MME运算单元,执行上述方法实施例中的MME运算方法对应的操作。
此外,需要说明的是,本公开实施例所涉及到的与用户有关的信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于计算的数据、用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,并且相关数据的收集、使用和处理需要遵守相关地区的相关法律法规和标准,并提供有相应的操作入口,供用户选择授权或者拒绝。
需要指出,根据实施的需要,可将本公开实施例中描述的各个部件/步骤拆分为更多部件/步骤,也可将两个或多个部件/步骤或者部件/步骤的部分操作组合成新的部件/步骤,以实现本公开实施例的目的。
上述根据本公开实施例的方法可在硬件、固件中实现,或者被实现为可存储在记录介质(诸如CD-ROM、RAM、软盘、硬盘或磁光盘)中的软件或计算机代码,或者被实现通过网络下载的原始存储在远程记录介质或非暂时机器可读介质中并将被存储在本地记录介质中的计算机代码,从而在此描述的方法可被存储在使用通用计算机、专用处理器或者可编程或专用硬件(诸如专用集成电路(Application Specific Integrated Circuit,ASIC)或现场可编辑门阵列(Field Programmable Gate Array,FPGA))的记录介质上的这样的软件处理。可以理解,计算机、处理器、微处理器控制器或可编程硬件包括可存储或接收软件或计算机代码的存储组件(例如,随机存储器(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、闪存等),当所述软件或计算机代码被计算机、处理器或硬件访问且执行时,实现在此描述的方法。此外,当通用计算机访问用于实现在此示出的方法的代码时,代码的执行将通用计算机转换为用于执行在此示出的方法的专用计算机。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及方法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本公开实施例的范围。
以上实施方式仅用于说明本公开实施例,而并非对本公开实施例的限制,有关技术领域的普通技术人员,在不脱离本公开实施例的精神和范围的情况下,还可以做出各种变化和变型,因此所有等同的技术方案也属于本公开实施例的范畴,本公开实施例的专利保护范围应由权利要求限定。
Claims (16)
- 一种矩阵乘法累加运算单元,包括:数据加载存储引擎、张量寄存器文件、矩阵乘法引擎;其中:所述数据加载存储引擎,用于加载待进行矩阵乘法累加计算的多个矩阵的数据;所述张量寄存器文件,用于存储从所述数据加载存储引擎获取的所述多个矩阵的数据;其中,所述张量寄存器文件包括至少三个张量寄存器组,每个张量寄存器组包括多个张量寄存器,不同张量寄存器组用于存储所述多个矩阵中不同矩阵的数据;所述矩阵乘法引擎,用于基于所述张量寄存器文件中存储的多个矩阵的数据,进行矩阵乘法累加计算。
- 根据权利要求1所述的矩阵乘法累加运算单元,其中,还包括:存储器;所述存储器,用于存储从所述矩阵乘法累加运算单元外部获得的、待进行矩阵乘法累加计算的多个矩阵的数据,以提供给所述数据加载存储引擎。
- 根据权利要求1或2所述的矩阵乘法累加运算单元,其中,所述张量寄存器文件,用于接收所述多个矩阵的数据,并根据各矩阵的数值精度,按照从低位存储的规则,将各矩阵的数据分别存储至对应的不同张量寄存器组的张量寄存器中。
- 根据权利要求3所述的矩阵乘法累加运算单元,其中,所述张量寄存器文件,用于接收所述多个矩阵的数据,并针对各矩阵的数据类型,按照所述数据类型对应的数值精度,从所述张量寄存器的低位开始,将该矩阵的数据存储至对应的张量寄存器组的张量寄存器中。
- 根据权利要求1-4任一项所述的矩阵乘法累加运算单元,其中,所述矩阵乘法累加运算单元基于预设指令集中的机器指令,控制所述数据加载存储引擎、所述张量寄存器文件和所述矩阵乘法引擎中的至少一者,执行所述机器指令所指示的操作;所述机器指令中携带有待使用的张量寄存器组的信息及所述张量寄存器组的张量寄存器的信息。
- 根据权利要求1-4任一项所述的矩阵乘法累加运算单元,其中,所述矩阵乘法引擎,通过列选择器阵列、行选择器阵列、乘法器阵列和加法器阵列,基于所述张量寄存器文件中存储的多个矩阵的数据,进行矩阵乘法累加计算。
- 一种矩阵乘法累加运算方法,包括:获取用于矩阵乘法累加运算过程的机器指令,所述机器指令中包含有操作数所在的寄存器的信息,所述寄存器为张量寄存器文件中的至少三个张量寄存器组中的寄存器,不同张量寄存器组用于存储待进行矩阵乘法累加计算的多个矩阵中不同矩阵的数据;执行所述机器指令所指示的操作。
- 根据权利要求7所述的方法,其中,所述机器指令包括:加载指令,用于指示从存储器中加载待进行矩阵乘法累加运算的矩阵的数据至对应的张量寄存器组的张量寄存器中;计算指令,用于指示基于张量寄存器中加载的矩阵的数据,进行矩阵乘法累加计算;存储指令,用于指示将存储矩阵乘法累加计算的结果的张量寄存器的数据存储至存储器。
- 根据权利要求8所述的方法,其中,当所述机器指令为加载指令时,所述加载指令中的操作数包括:待加载的数据所在的存储器的地址、加载入所述数据的张量寄存器组的标识和所述张量寄存器组中的张量寄存器的标识;当所述机器指令为计算指令时,所述计算指令中的操作数包括:待进行矩阵乘法累加计算的多个矩阵的数据所在的张量寄存器组的标识和所述张量寄存器组中的张量寄存器的标识;当所述机器指令为存储指令时,所述存储指令中的操作数包括:待存储的数据所在的张量寄存器组的标识和所述张量寄存器组中的张量寄存器的标识。
- 根据权利要求8或9所述的方法,其中,所述获取用于矩阵乘法累加运算过程的机器指令,包括:通过指令解码器解码获取用于矩阵乘法累加运算过程的机器指令;所述执行所述机器指令所指示的操作,包括:根据所述机器指令,控制矩阵乘法累加运算单元执行所述机器指令所指示的操作。
- 根据权利要求10所述的方法,其中,所述矩阵乘法累加运算单元包括:数据加载存储引擎、张量寄存器文件、矩阵乘法引擎;所述根据所述机器指令,控制矩阵乘法累加运算单元执行所述机器指令所指示的操作,包括:当所述机器指令为加载指令时,将所述加载指令发送给所述数据加载存储引擎,以指示所述数据加载存储引擎从所述存储器加载待进行矩阵乘法累加运算的矩阵的数据至对应的张量寄存器组的张量寄存器中;当所述机器指令为计算指令时,将所述计算指令发送给所述矩阵乘法引擎,以指示所述矩阵乘法引擎基于张量寄存器中加载的矩阵的数据,进行矩阵乘法累加计算;当所述机器指令为存储指令时,将所述存储指令发送给所述数据加载存储引擎,以指示所述数据加载存储引擎将存储矩阵乘法累加计算的结果的张量寄存器的数据存储至存储器中。
- 一种矩阵乘法累加运算方法,包括:将待进行矩阵乘法累加计算的多个矩阵的数据加载至张量寄存器文件,其中,所述张量寄存器文件包括至少三个张量寄存器组,每个张量寄存器组中包括多个张量寄存器,不同张量寄存器组用于存储所述多个矩阵中不同矩阵的数据;基于所述张量寄存器文件中存储的多个矩阵的数据,进行矩阵乘法累加计算。
- 一种硬件加速器,其至少包括指令解码器,和如权利要求1-6任一项中所述的矩阵乘法累加运算单元;其中,所述指令解码器用于对指示进行矩阵乘法累加计算的机器指令进行解码,并根据解码结果控制所述矩阵乘法累加运算单元进行矩阵乘法累加计算。
- 一种电子设备,其至少包括:处理器和如权利要求13中所述的硬件加速器;其中,所述处理器用于向所述硬件加速器发送指示进行矩阵乘法累加计算的指令;所述硬件加速器根据所述指令进行矩阵乘法累加计算。
- 一种计算机可读存储介质,其中,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行被处理器指定时用于实现如权利要求7-12任一项所述的方法。
- 一种计算机程序产品,包括计算机指令,所述计算机指令指示电子设备通过如权利要求13中所述的硬件加速器,尤其是硬件加速器中的矩阵乘法累加运算单元,执行如权利要求7-12任一项所述的方法。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410371734.4A CN120724025A (zh) | 2024-03-28 | 2024-03-28 | 矩阵乘法累加运算单元及运算方法、硬件加速器、电子设备 |
| CN202410371734.4 | 2024-03-28 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025200693A1 true WO2025200693A1 (zh) | 2025-10-02 |
Family
ID=97165327
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2024/144639 Pending WO2025200693A1 (zh) | 2024-03-28 | 2024-12-31 | 矩阵乘法累加运算单元及运算方法、硬件加速器、电子设备 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN120724025A (zh) |
| WO (1) | WO2025200693A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN121349709A (zh) * | 2025-12-16 | 2026-01-16 | 上海壁仞科技股份有限公司 | 计算资源管理方法、装置、电子设备及存储介质 |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120950263B (zh) * | 2025-10-15 | 2026-01-16 | 摩尔线程智能科技(北京)股份有限公司 | 数据处理方法、处理器、芯片、显卡及电子设备 |
| CN121167099B (zh) * | 2025-11-17 | 2026-02-13 | 苏州亿铸智能科技有限公司 | 张量计算方法、电子设备及计算机可读存储介质 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110678840A (zh) * | 2017-05-24 | 2020-01-10 | 微软技术许可有限责任公司 | 张量寄存器文件 |
| CN116127261A (zh) * | 2023-04-19 | 2023-05-16 | 北京微核芯科技有限公司 | 处理器中矩阵乘累加方法、装置及电子设备 |
| CN116783578A (zh) * | 2021-05-13 | 2023-09-19 | 辉达公司 | 执行矩阵值指示 |
| CN117111884A (zh) * | 2023-09-26 | 2023-11-24 | 上海壁仞科技股份有限公司 | 乘累加优化方法、系统、设备和介质 |
| US20240070223A1 (en) * | 2022-08-31 | 2024-02-29 | Microsoft Technology Licensing, Llc | Increased computation efficiency with multi-stage 8-bit floating point matrix multiplication with format conversion |
-
2024
- 2024-03-28 CN CN202410371734.4A patent/CN120724025A/zh active Pending
- 2024-12-31 WO PCT/CN2024/144639 patent/WO2025200693A1/zh active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110678840A (zh) * | 2017-05-24 | 2020-01-10 | 微软技术许可有限责任公司 | 张量寄存器文件 |
| CN116783578A (zh) * | 2021-05-13 | 2023-09-19 | 辉达公司 | 执行矩阵值指示 |
| US20240070223A1 (en) * | 2022-08-31 | 2024-02-29 | Microsoft Technology Licensing, Llc | Increased computation efficiency with multi-stage 8-bit floating point matrix multiplication with format conversion |
| CN116127261A (zh) * | 2023-04-19 | 2023-05-16 | 北京微核芯科技有限公司 | 处理器中矩阵乘累加方法、装置及电子设备 |
| CN117111884A (zh) * | 2023-09-26 | 2023-11-24 | 上海壁仞科技股份有限公司 | 乘累加优化方法、系统、设备和介质 |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN121349709A (zh) * | 2025-12-16 | 2026-01-16 | 上海壁仞科技股份有限公司 | 计算资源管理方法、装置、电子设备及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN120724025A (zh) | 2025-09-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2025200693A1 (zh) | 矩阵乘法累加运算单元及运算方法、硬件加速器、电子设备 | |
| US8713080B2 (en) | Circuit for compressing data and a processor employing same | |
| CN107608715B (zh) | 用于执行人工神经网络正向运算的装置及方法 | |
| CN109213962B (zh) | 运算加速器 | |
| US20200210516A1 (en) | Apparatuses, methods, and systems for fast fourier transform configuration and computation instructions | |
| CN108874445A (zh) | 神经网络处理器及使用处理器执行向量点积指令的方法 | |
| EP3623940A2 (en) | Systems and methods for performing horizontal tile operations | |
| WO2018139177A1 (ja) | プロセッサ、情報処理装置及びプロセッサの動作方法 | |
| US12474928B2 (en) | Processors, methods, systems, and instructions to select and store data elements from strided data element positions in a first dimension from three source two-dimensional arrays in a result two-dimensional array | |
| JP4979169B2 (ja) | 2次元マトリクス処理のためのレジスタ | |
| US20140047199A1 (en) | Memory-Link Compression for Graphic Processor Unit | |
| CN108108189B (zh) | 一种计算方法及相关产品 | |
| CN115708090A (zh) | 一种计算装置、方法、系统、电路、芯片及设备 | |
| WO2022068328A1 (zh) | 数据迁移的方法、装置、处理器和计算设备 | |
| CN115827555B (zh) | 数据处理方法、计算机设备、存储介质和乘法器结构 | |
| JP2002358288A (ja) | 半導体集積回路及びコンピュータ読取り可能な記録媒体 | |
| CN117076533A (zh) | 交易数据序列化方法、装置、电子设备及存储介质 | |
| CN111158757B (zh) | 并行存取装置和方法以及芯片 | |
| CN111831328A (zh) | 数据处理的方法及装置 | |
| WO2018165939A1 (en) | Flash data compression decompression method and apparatus | |
| CN112766473A (zh) | 运算装置及相关产品 | |
| CN116362303B (zh) | 数据处理装置、数据处理方法及相关装置 | |
| CN117786293A (zh) | 矩阵装置及其操作方法 | |
| CN116360575A (zh) | 数据处理方法、装置、终端设备及存储介质 | |
| CN119202491B (zh) | 一种基于矩阵运算单元的离散傅立叶变换实现方法和设备 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 24932947 Country of ref document: EP Kind code of ref document: A1 |