Data processing method and apparatus, processor, computer device, and system

By merging the matrix sets of multiple matrix calculation instructions to form a larger matrix for calculation, the problem of low utilization of the SME instruction processor is solved and the calculation throughput and hardware resource utilization are improved.

WO2024179326A1PCT designated stage expired Publication Date: 2024-09-06HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/077603
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-27
Filing Date
2024-02-19
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

In the existing technology, processors that execute Scalable Matrix Extension (SME) instructions have low utilization when performing scalar calculations, and cannot fully utilize hardware resources when calculating smaller matrices, resulting in low computing throughput.

Method used

By merging matrix sets associated with multiple matrix calculation instructions, a larger matrix is ​​formed for one matrix calculation, which reduces the number of matrix calculations and improves processor utilization.

Benefits of technology

By merging matrix calculations, the matrix size is increased, processor utilization and computing throughput are improved, and hardware resources are fully utilized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024077603_06092024_PF_FP
    Figure CN2024077603_06092024_PF_FP
Patent Text Reader

Abstract

Disclosed are a data processing method and apparatus, a processor, a computer device, and a system, relating to the field of computers. The method comprises: combining matrix sets associated with multiple matrix calculation instructions, to execute matrix calculation. Since a processor core can only process one instruction each time, multiple matrix calculations need to be executed when the processor core processes the multiple matrix calculation instructions, and if the size of a matrix associated with a matrix calculation instruction is small, hardware resources of the processor for executing matrix calculation instructions cannot be fully utilized, resulting in low calculation throughput. According to the solution provided by the present application, multiple matrix calculations are combined into one matrix calculation, namely, matrixes associated with the multiple matrix calculation instructions are combined into a large matrix, and matrix calculation is executed once on the combined matrix, so that the matrix size is increased by means of the combined matrix, the number of matrix calculations is reduced, and the utilization rate of the processor for executing the matrix calculation instructions is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Data processing method, device, processor, computer equipment and system

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 27, 2023, with application number 202310231360.1 and application name “Data processing method, device, processor, computer equipment and system”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of computers, and in particular to a data processing method, apparatus, processor, computer equipment, and system. Background Art

[0003] Currently, computers compile applications into a language they can understand and run them. This means that a computer compiles a source program written in a high-level language into a target program and then runs the target program. Application snippets suitable for using Scalable Matrix Extension (SME) instructions are compiled into calls to SME instructions. SME defines an architecture capable of storing two-dimensional matrices and a series of instructions related to matrix calculations, which are used to instruct the execution of matrix calculations. Matrix calculations primarily involve scalars and vectors, where a scalar is a number and a vector is a sequence of numbers. When a user process performs scalar calculations, since scalars are simply numbers, the register utilization of the processor executing SME instructions is lower than that of vector calculations. Furthermore, if the user process needs to perform calculations on smaller matrices, the hardware resources of the processor executing SME instructions cannot be fully utilized, resulting in low computational throughput. Therefore, improving the utilization of processors executing SME instructions has become a pressing technical issue.

[0004] Summary of the Invention

[0005] The present application provides a data processing method, apparatus, processor, computer device and system, thereby improving the utilization rate of the processor executing SME instructions.

[0006] In a first aspect, a data processing method is provided, comprising: after obtaining multiple matrix calculation instructions, merging matrix sets associated with the multiple matrix calculation instructions to perform matrix calculations. For example, a first matrix set associated with a first matrix calculation instruction and a second matrix set associated with a second matrix calculation instruction are obtained, wherein the first matrix calculation instruction and the second matrix calculation instruction are each one of the multiple matrix calculation instructions, the first matrix set includes at least two first matrices, and the second matrix set includes at least two second matrices. The matrices of the first matrix set and the second matrix set are merged to obtain a merged matrix; and calculation operations on the merged matrix are performed to obtain calculation results of the first matrix calculation instruction and calculation results of the second matrix calculation instruction, respectively.

[0007] Because a processor core can only process one instruction at a time, multiple matrix calculations need to be performed when the processor core processes multiple matrix calculation instructions. Moreover, if the size of the matrix associated with the matrix calculation instruction is small, the hardware resources of the processor executing the matrix calculation instruction cannot be fully utilized, resulting in low computational throughput. The solution provided in this application combines multiple matrix calculations into one matrix calculation, that is, combines the matrices associated with multiple matrix calculation instructions into a large matrix, and performs a single matrix calculation on the combined matrix. Thus, the matrix size is increased by the combined matrix, thereby reducing the number of matrix calculations and improving the utilization rate of the processor executing the matrix calculation instruction.

[0008] In one possible implementation, when the matrices associated with the matrix calculation instructions meet a merge condition, multiple matrices associated with multiple matrix calculation instructions are merged to obtain a merged matrix. The merge condition indicates a size threshold and a merge period that must be met before the merged matrix calculation is performed. The size threshold is determined by the size of the register used to store the matrix. The merge period indicates the time unit for performing the merged matrix calculation.

[0009] For example, merging matrices of the first matrix set and the second matrix set to obtain a merged matrix includes: when the matrices of the first matrix set and the second matrix set meet a size threshold, merging the matrices of the first matrix set and the second matrix set to obtain a merged matrix. It is understandable that when merging multiple matrix sets, multiple merged matrices can be obtained, and the sizes of the multiple merged matrices are as close to the size threshold as possible, that is, the sizes of the multiple merged matrices are close to the size of the register. In this way, the hardware resources of the processor that executes the matrix calculation instructions and the storage resources of the register that stores the matrices are fully utilized, thereby improving the utilization rate of the processor that executes the matrix calculation instructions.

[0010] For another example, merging matrices of a first matrix set and a second matrix set to obtain a merged matrix includes: merging matrices of the first matrix set and the second matrix set within a merging cycle to obtain a merged matrix. It should be understood that the shorter the merging cycle, the more frequently the matrix calculations are performed by merging; and the longer the merging cycle, the fewer times the matrix calculations are performed by merging. Thus, within the merging cycle, if the size of the merged matrix is ​​close to the size of the register, the multiple matrix sets are merged; if within the merging cycle, if the size of the merged matrix is ​​significantly different from the size of the register, but the merging cycle has ended, the multiple matrix sets are also merged. Thus, by reasonably setting the merging cycle, the matrix calculation instruction merge is executed within the merging cycle, thereby improving the utilization rate of the processor that executes the matrix calculation instructions. Avoiding frequent execution of matrix calculation instruction merges, which reduces the utilization rate of the processor that executes the matrix calculation instructions.

[0011] The matrix calculation operation includes at least one of matrix multiplication, matrix addition, matrix subtraction, number multiplication and matrix joint multiplication and addition.

[0012] In another possible implementation, the matrix calculation operation is matrix multiplication, and the multiple matrices in the merged matrix are arranged diagonally. This avoids matrix multiplication of matrices associated with different matrix calculation instructions, which may lead to incorrect matrix calculation results.

[0013] In another possible implementation, obtaining a first matrix set associated with a first matrix calculation instruction and a second matrix set associated with a second matrix calculation instruction includes: when the remote device performs a non-matrix calculation, obtaining the first matrix set associated with the first matrix calculation instruction and the second matrix set associated with the second matrix calculation instruction from the remote device. The remote device includes any one of a processor core, a processor, and a computer device. The remote device may be a device that supports matrix calculation or a device that does not support matrix calculation. Thus, by offloading the matrix calculation instructions from the remote device, the matrix calculation instructions are merged, thereby improving the utilization of the processor that executes the matrix calculation instructions.

[0014] In another possible implementation, after performing the calculation operation on the merged matrix, the calculation result of the first matrix calculation instruction and the calculation result of the second matrix calculation instruction are obtained from the calculation result of the merged matrix. The method further includes: feeding back the calculation result of the first matrix calculation instruction to the remote device that sent the first matrix calculation instruction based on an identifier associated with the first matrix calculation instruction; and feeding back the calculation result of the second matrix calculation instruction to the remote device that sent the second matrix calculation instruction based on an identifier associated with the second matrix calculation instruction.

[0015] In a second aspect, a data processing device is provided, the data processing device including various modules for executing the data processing method in the first aspect or any possible design of the first aspect. For example, the data processing device includes a communication module and a merging module. The communication module is used to obtain a first matrix set associated with a first matrix calculation instruction and a second matrix set associated with a second matrix calculation instruction, wherein the first matrix calculation instruction and the second matrix calculation instruction are respectively one of a plurality of matrix calculation instructions, the first matrix set includes at least two first matrices, and the second matrix set includes at least two second matrices. The merging module is used to merge the matrices of the first matrix set and the second matrix set to obtain a merged matrix; the merging module is also used to perform calculation operations on the merged matrix to obtain the calculation results of the first matrix calculation instruction and the calculation results of the second matrix calculation instruction, respectively.

[0016] In one possible implementation, the merging module merges the matrices of the first matrix set and the second matrix set to obtain a merged matrix, specifically for: when the matrices of the first matrix set and the second matrix set meet a size threshold, merging the matrices of the first matrix set and the second matrix set to obtain a merged matrix, where the size threshold is determined by a size of a register used to store the matrix.

[0017] In another possible implementation, when the merging module merges the matrices of the first matrix set and the second matrix set to obtain the merged matrix, it is specifically used to: merge the matrices of the first matrix set and the second matrix set within a merging period to obtain the merged matrix, where the merging period is used to indicate the time unit for performing the merged matrix calculation.

[0018] In another possible implementation, the computing operation includes at least one of matrix multiplication, matrix addition, matrix subtraction, number multiplication, and matrix joint multiplication and addition.

[0019] In another possible implementation, the computing operation is matrix multiplication, and at least two matrices in the merged matrix are arranged diagonally.

[0020] In another possible implementation, when the communication module obtains the first matrix set associated with the first matrix calculation instruction and the second matrix set associated with the second matrix calculation instruction, it is specifically used to: when the remote device performs non-matrix calculation, obtain the first matrix set associated with the first matrix calculation instruction and the second matrix set associated with the second matrix calculation instruction from the remote device.

[0021] The remote device includes any one of a processor core, a processor and a server, and the remote device is a device that supports matrix calculation or a device that does not support matrix calculation.

[0022] In another possible implementation, when the merging module obtains the calculation result of the first matrix calculation instruction and the calculation result of the second matrix calculation instruction, it is specifically used to: obtain the calculation result of the first matrix calculation instruction and the calculation result of the second matrix calculation instruction from the calculation result of the merged matrix.

[0023] In another possible implementation, the communication module is further used to feed back the calculation result of the first matrix calculation instruction to the remote device that sent the first matrix calculation instruction according to the identifier associated with the first matrix calculation instruction; and feed back the calculation result of the second matrix calculation instruction to the remote device that sent the second matrix calculation instruction according to the identifier associated with the second matrix calculation instruction.

[0024] In a third aspect, a processor is provided, comprising at least two processor cores and a memory, the memory being used to store a set of computer instructions; when the processor core executes the set of computer instructions, the operating steps of the method in the first aspect or any possible implementation of the first aspect are executed.

[0025] In a fourth aspect, a computer device is provided, comprising a processor configured to execute the operation steps of the method in the first aspect or any possible implementation of the first aspect.

[0026] In a fifth aspect, a computer system is provided, which includes multiple computer devices, and the computer devices are used to execute the operating steps of the method in the first aspect or any possible implementation of the first aspect.

[0027] In a sixth aspect, a computer-readable storage medium comprises: computer software instructions; when the computer software instructions are executed in a processor, the processor executes the operating steps of the method described in the first aspect or any possible implementation of the first aspect.

[0028] In a seventh aspect, a computer program product is provided. When the computer program product is run on a computer, the computer is caused to execute the operating steps of the method described in the first aspect or any possible implementation of the first aspect.

[0029] The technical effects brought about by any design method in the second to seventh aspects can be referred to the technical effects brought about by the first aspect or different design methods in the first aspect, and will not be repeated here.

[0030] Based on the implementation methods provided in the above aspects, this application can also be further combined to provide more implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] FIG1 is a schematic diagram of the composition of a computer device provided by the present application;

[0032] FIG2 is a schematic diagram of a scenario of matrix calculation instruction offloading provided by the present application;

[0033] FIG3 is a flow chart of a data processing method provided by the present application;

[0034] FIG4 is a schematic diagram of matrix calculation instruction offloading provided by the present application;

[0035] FIG5 is a schematic diagram of a combined execution matrix calculation provided by the present application;

[0036] FIG6 is a schematic diagram of a matrix merging method provided by the present application;

[0037] FIG7 is a schematic structural diagram of a data processing device provided in this application. DETAILED DESCRIPTION

[0038] For the convenience of description, the terms involved in this application are first briefly introduced.

[0039] Single instruction multiple data (SIMD) is a technology that achieves spatial parallelism by performing the same operation on each piece of data in a set of data (also known as a "data vector"). SIMD is an extension of the basic instruction set of the central processing unit (CPU).

[0040] Scalable Vector Extension (SVE) is a SIMD instruction set for the ARM AArch64 architecture, designed to accelerate high-performance computing. It supports variable vector lengths, per-lane prediction, gather-load and scatter-store operations, and horizontal operations. SVE differs from SIMD in that SIMD processes fixed-length data, while SVE processes variable-length data.

[0041] Scalable Matrix Extension (SME) is an instruction set based on the Scalable Vector Extension (SVE and SVE2) under the ARMv9-A architecture that supports matrix calculations. It can be understood that the processor provides a new mode, that is, the processor provides matrix calculation capabilities, making it easier for the processor to use different vector sizes when processing matrix calculations, as well as SVE or SIMD calculations. SME defines an architecture capable of storing two-dimensional matrices and a series of instructions related to matrix calculations, including: ① Instructions for calculating the outer product of two vectors to implement matrix multiplication; ② Instructions for reading, storing, and moving vectors from a matrix. SME supports vector lengths ranging from 128 to 2048 bits.

[0042] A matrix is ​​a set of complex or real numbers arranged in an array.

[0043] In the computer memory hierarchy, the closer the memory is to the processor, the faster it is to access and the smaller its storage capacity. In descending order of distance from the processor, memory is divided into registers, cache memory, main memory, and disk.

[0044] Main memory, also known as internal memory, is a crucial component of a computer system, serving as the bridge between external memory and the processor. It temporarily stores computational data within the processor and data exchanged between the processor and external memory, such as a hard drive. For example, when a computer starts running, data to be computed is loaded from main memory into the processor for computation. Once the computation is complete, the processor stores the result in main memory. Examples of main memory include dynamic random access memory (DRAM) and double data rate synchronous DRAM (DDR SDRAM).

[0045] External storage, also known as auxiliary storage or simply external memory, has a larger storage capacity than main memory but slower access speeds. Examples of external storage include network storage, solid-state drives (SSDs), and hard disk drives (HDDs).

[0046] Cache memory is a high-speed, small-capacity memory located between the processor and main memory. Cache memory is often referred to as cache. Compared to main memory, cache has a smaller storage capacity and faster access speeds. Cache includes Level 1 (L1 cache), Level 2 (L2 cache), and Level 3 (L3 cache). Level 1 cache is located inside the processor core. Level 2 cache can be located inside or outside the processor core. Level 1 and Level 2 caches are typically exclusive to the processor core they are located in. Level 3 cache is typically located outside the processor core and is shared by multiple processor cores.

[0047] A register is a small memory inside a processor that temporarily stores data and results involved in a calculation. A register can be a commonly used sequential logic circuit.

[0048] A socket is a mechanism for application-layer processes to exchange data using network protocols. It abstracts the endpoints for bidirectional communication between application processes on different hosts on a network. In terms of their position, a socket connects the application process above and the network protocol stack below. It is the interface through which applications communicate using network protocols and the interface between applications and the network protocol stack.

[0049] In order to improve the utilization rate of the processor that executes the SME instruction, the present application provides a data processing method, that is, after obtaining multiple matrix calculation instructions, the matrix sets associated with the multiple matrix calculation instructions are merged to perform matrix calculation. For example, after obtaining multiple matrix calculation instructions, the multiple matrix calculation instructions are merged to perform matrix calculation. For example, a first matrix set associated with a first matrix calculation instruction and a second matrix set associated with a second matrix calculation instruction are obtained, wherein the first matrix calculation instruction and the second matrix calculation instruction are respectively one of the multiple matrix calculation instructions, the first matrix set includes at least two first matrices, and the second matrix set includes at least two second matrices. The matrices of the first matrix set and the second matrix set are merged to obtain a merged matrix; the calculation operation of the merged matrix is ​​performed to obtain the calculation results of the first matrix calculation instruction and the calculation results of the second matrix calculation instruction, respectively.

[0050] Because a processor core can only process one instruction at a time, multiple matrix calculations need to be performed when the processor core processes multiple matrix calculation instructions. Moreover, if the size of the matrix associated with the matrix calculation instruction is small, the hardware resources of the processor executing the matrix calculation instruction cannot be fully utilized, resulting in low computational throughput. The solution provided in this application combines multiple matrix calculations into one matrix calculation, that is, combines the matrices associated with multiple matrix calculation instructions into a large matrix, and performs a single matrix calculation on the combined matrix. Thus, the matrix size is increased by the combined matrix, thereby reducing the number of matrix calculations and improving the utilization rate of the processor executing the matrix calculation instruction.

[0051] The embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0052] FIG1 is a schematic diagram of the composition of a computer device provided by the present application. As shown in FIG1 , the computer device 100 includes a processor 110 and a main memory 120. The processor 110 includes a cache memory 111 and a register 112.

[0053] Processor 110 is the control center of computer device 100. Processor 110 can be a computing unit with computing capabilities, such as a central processing unit (CPU), a graphics processing unit (GPU), a data processing unit (DPU), or a neural processing unit (NPU). Processor 110 includes one or more processor cores. For example, processor 110 shown in FIG1 includes N processor cores.

[0054] The cache memory 111 is used to store instructions or data that may be accessed multiple times by the processor core in the processor 110 , thereby increasing the speed at which the processor processes data and preventing the processor from frequently accessing the main memory 120 .

[0055] In terms of physical form, the cache memory 111 may be a random access memory (RAM), a static random-access memory (SRAM), a dynamic RAM (DRAM), or other types of storage devices that can store information and instructions.

[0056] In terms of logical form, the cache memory 111 can be a level 1 cache (L1 cache), a level 2 cache (L2 cache), a level 3 cache (L3 cache), or any other level of cache. For example, as shown in FIG1 , the cache memory 111 disposed inside the processor core can be a level 1 cache (L1 cache) and a level 2 cache (L2 cache). The cache memory 111 disposed outside the processor core can be a level 3 cache (L3 cache).

[0057] Register 112 is used to store instructions or data that may be accessed multiple times by the processor core in processor 110. Because register access speed is higher than cache memory access speed, instructions or data that may be accessed multiple times by the processor core can be stored in registers first, which can further increase the speed at which the processor processes data.

[0058] Among them, the instructions that the processor core can process include SIMD instructions, SVE instructions, and SME instructions. The processor core uses different data types and performs different calculations when processing different instructions. For example, when the processor processes SIMD instructions, it processes fixed-length data (such as integer data, floating-point data) and performs addition, subtraction, or other calculations on the data. For another example, when the processor processes SVE instructions, it processes variable-length data (such as integer data, floating-point data) and performs addition, subtraction, or other calculations on the data. For another example, when the processor processes SME instructions, it performs matrix calculations on matrices.

[0059] In some embodiments, register types are classified based on the type of instruction stored in the register. One register type can be used to store data for one type of instruction. A processor core can include multiple types of registers. For example, as shown in FIG1 , processor 110 includes M registers 112. M registers 112 include three types of registers. For example, a first type of register is used to store data for the processor core to process SIMD instructions, a second type of register is used to store data for the processor core to process SVE instructions, and a third type of register is used to store data for the processor core to process SME instructions.

[0060] Alternatively, a register may be used to store data for multiple instructions. For example, the register may be used to store data for any one of a SIMD instruction, an SVE instruction, and an SME instruction.

[0061] For ease of description, a storage medium storing data for a SIMD instruction may be referred to as a SIMD register. A storage medium storing data for an SVE instruction may be referred to as an SVE register. A storage medium storing data for an SME instruction may be referred to as an SME register.

[0062] It should be understood that at a given moment, when a processor core executes an instruction, the data for that instruction is stored in the register corresponding to that instruction type, while registers corresponding to other types of instructions remain idle. For example, when a processor core processes a SIMD instruction and stores the SIMD instruction data in the SIMD register, the SME register remains idle. When a processor core processes an SVE instruction and stores the SVE instruction data in the SVE register, the SME register remains idle. Furthermore, if the matrix associated with the SME instruction is small, the processor core will use fewer storage and computing resources when performing matrix calculations on the smaller matrix, resulting in lower computational throughput.

[0063] In this application, the processor core provides a matrix calculation instruction offloading function and a matrix calculation instruction merging function. The matrix calculation instruction described in this application may refer to an SME instruction.

[0064] When a processor core performs a non-matrix calculation, or when the size of a matrix performed by a processor core on a matrix calculation is less than or greater than a threshold, the matrix calculation instruction is offloaded to a processor core that supports matrix calculation, and the processor core that supports matrix calculation includes an SME register. After the processor core that supports matrix calculation obtains multiple matrix calculation instructions, it merges the matrices associated with the multiple matrix calculation instructions, that is, merges the matrices associated with the multiple matrix calculation instructions into a large matrix, and performs a matrix calculation on the merged matrix. Thus, the matrix size is increased by merging the matrices, thereby reducing the number of matrix calculations, improving the utilization of the processor that executes the matrix calculation instructions, and increasing the computational throughput.

[0065] The processor core that unloads the matrix calculation instruction may support matrix calculation or not support matrix calculation, that is, the processor core that unloads the matrix calculation instruction may support the function of processing the matrix calculation instruction or not support the function of processing the matrix calculation instruction.

[0066] For example, processor core 1 does not support matrix calculations, while processor core 2 does. If processor core 1 reads an SME instruction, it offloads the SME instruction to processor core 2 because it does not support matrix calculations. Processor core 1 then processes other instructions. If processor core 1 reads an SVE instruction, it processes the SVE instruction and performs non-matrix calculations. This allows the non-matrix-supporting processor core to indirectly implement matrix calculations, expanding the scope of matrix calculation instructions in the computer system. Furthermore, the non-matrix-supporting processor core can perform non-matrix calculations asynchronously, improving computational throughput.

[0067] For another example, processor core 1, processor core 2, and processor core 3 all support matrix calculations. Processor core 1 reads the first SME instruction, and processor core 2 reads the second SME instruction. The size of the matrix associated with the first SME instruction and the size of the matrix associated with the second SME instruction are both smaller than the size threshold. Processor core 1 unloads the first SME instruction to processor core 3, and processor core 2 unloads the second SME instruction to processor core 3. Processor core 1 and processor core 2 can process other instructions (such as SVE instructions and SIMD instructions). Processor core 3 obtains the first SME instruction and the second SME instruction, merges the matrix associated with the first SME instruction and the matrix associated with the second SME instruction, performs calculation operations on the merged matrix, and obtains the calculation results of the first SME instruction and the calculation results of the second SME instruction, respectively. Thus, the utilization rate of the processor that executes the matrix calculation instructions is improved and the calculation throughput is improved.

[0068] In addition, the present application does not limit the execution entities of the matrix calculation instruction offloading function and the matrix calculation instruction merging function. The matrix calculation instruction offloading function and the matrix calculation instruction merging function can be implemented by the same computer device or by different computer devices.

[0069] For example, as shown in FIG2(a), a matrix calculation instruction offloading function and a matrix calculation instruction merging function are implemented within a processor. The matrix calculation instruction offloading function is implemented between different processor cores within the same processor. Processor core 0, processor core 1, and processor core 2 are located on the same processor. Processor core 0 offloads matrix calculation instruction 1 to processor core 1, and processor core 2 offloads matrix calculation instruction 2 to processor core 1. Processor core 1 merges matrix calculation instruction 1 and matrix calculation instruction 2 to perform matrix calculations.

[0070] As shown in FIG2(b), a matrix calculation instruction offloading function and a matrix calculation instruction merging function are implemented within the same computer device. Specifically, the matrix calculation instruction offloading function is implemented between different processors within the same computer device. Processor 0 includes processor core 0 and processor core 1. Processor 1 includes processor core 0 and processor core 1. Processor core 0 in processor 0 offloads matrix calculation instruction 1 to processor core 1 in processor 1, and processor core 1 in processor 0 offloads matrix calculation instruction 2 to processor core 1 in processor 1. Processor core 1 in processor 1 merges matrix calculation instruction 1 and matrix calculation instruction 2 to perform matrix calculation.

[0071] As shown in (c) of Figure 2 , matrix calculation instruction offloading and matrix calculation instruction merging functions are implemented on different computer devices. The matrix calculation instruction offloading function is implemented between different processors in different computer devices. Computer device 1 includes processor 0 and processor 1. Computer device 2 includes processor 0 and processor 1. Processor 0 in computer device 1 offloads matrix calculation instruction 1 to processor 0 in computer device 2, and processor 1 in computer device 1 offloads matrix calculation instruction 2 to processor 0 in computer device 2. Processor 0 in computer device 2 merges matrix calculation instruction 1 and matrix calculation instruction 2 to perform matrix calculation.

[0072] The processor core is connected to other devices in the processor (such as the processor core and cache memory 111) via bus 112, and accesses other devices via bus 112. For example, matrix calculation instructions are transmitted between processor cores via bus 112. For another example, the processor core transmits a write instruction or a read instruction to cache memory 111 via bus 112, causing cache memory 111 to write to a cache line according to the write instruction or read from a cache line according to the read instruction. Bus 112 can be an industry standard architecture (ISA) bus, a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), or a non-standard proprietary bus standard. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in FIG1 , but this does not mean that there is only one bus or one type of bus.

[0073] The connection between the processor core and other components in the processor in Figure 1 is merely illustrative. In one possible implementation, the processor core connects to the other components in the processor via a ring bus, accessing the other components via the ring bus. In another possible implementation, the processor core connects to the other components in the processor via a mesh bus, accessing the other components via the mesh bus.

[0074] The processor 110 is connected to the main memory 120 via a memory controller (MC) 113. The processor 110 can execute various functions of the computer device 100 by running or executing software programs stored in the main memory 120 and accessing data stored in the main memory 120. For example, the processor 110 writes the calculation results of a matrix calculation instruction back to the main memory 120 via the memory controller (MC) 113.

[0075] The main memory 120 may be a read-only memory (ROM) or other static storage device capable of storing static information and instructions, a random access memory (RAM) or other dynamic storage device capable of storing information and instructions, or an electrically erasable programmable read-only memory (EEPROM). The main memory 120 is also used to store programs related to this embodiment.

[0076] The processor 110 may further include an external device 130 and a peripheral management module 114. The peripheral device 130 is connected to the peripheral management module 114 via a bus 112. The peripheral device 130 may be an application specific integrated circuit (ASIC). For example, a digital signal processor (DSP), one or more field programmable gate arrays (FPGA), a graphics processing unit (GPU), or a neural network processing unit (NPU). The peripheral device 130 may also transmit instructions for performing matrix calculations to the processor core via the bus 112, so that the processor core combines multiple SME instructions to perform matrix calculations.

[0077] The device structure shown in FIG1 does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0078] Next, the data processing method provided in this application is described in detail with reference to the accompanying drawings.

[0079] For ease of explanation, the example of the offloading scenario between computer devices shown in (c) of Figure 2 is used, where the remote device offloads matrix calculation instructions to the local device, and the local device performs the matrix calculation instruction merging function. See Figure 3, which is a flow chart of a data processing method provided by this application. As shown in Figure 3, the method includes the following steps.

[0080] Step 310: The remote device unloads the matrix calculation instruction.

[0081] Before running an application, the remote device compiles the application into a target program, which is a computer-readable language. The target program includes matrix calculation instructions and non-matrix calculation instructions (e.g., SIMD instructions and SVE instructions). In one example, when the remote device does not support matrix calculations and reads a matrix calculation instruction, it offloads the matrix calculation instruction to a device that supports matrix calculations.

[0082] In another possible implementation, when the size of the matrix associated with the matrix calculation instruction read by the remote device is smaller than or greater than a threshold, the remote device unloads the matrix calculation instruction.

[0083] Multiple matrix calculation instructions are processed by a device that supports matrix calculations, thereby improving the utilization of matrix calculation-supporting computing resources and the storage resource utilization of SME registers in the computer device. Remote devices can process non-matrix calculation instructions, thereby improving the utilization of computing resources that do not support matrix calculations in the computer device.

[0084] The remote device includes any one of a processor core, a processor, and a server. It should be understood that within the same computer device, matrix calculation instructions can be offloaded between processor cores, between processors, or between different computer devices.

[0085] In addition, the remote device may be a device that supports matrix calculation or a device that does not support matrix calculation.

[0086] Step 320: The local device obtains a matrix set associated with a plurality of matrix calculation instructions, where the matrix calculation instructions are used to instruct the execution of matrix calculations.

[0087] Multiple matrix calculation instructions are obtained from one or more remote devices. For example, multiple matrix calculation instructions are obtained from a single remote device. Another example is obtaining multiple matrix calculation instructions from multiple remote devices. This application does not limit the source of the multiple matrix calculation instructions. Each matrix calculation instruction is associated with a matrix set that includes at least two matrices, and performing matrix calculations on the at least two matrices can produce a calculation result.

[0088] In some embodiments, the local device obtains a matrix calculation message sent by the remote device, where the matrix calculation message is used to indicate a matrix set associated with a matrix calculation instruction.

[0089] For example, when matrix calculation messages are sent between processors in the same computer device, or when matrix calculation messages are sent between processor cores in the same processor, the matrix calculation messages include a physical address that indicates the storage location of the matrix set associated with the matrix calculation instruction. The processor core or processor sending the matrix calculation message may or may not support matrix calculations. The local device may be a processor core or processor that supports matrix calculations.

[0090] For another example, when a matrix calculation message is sent between computer devices, the matrix calculation message includes a set of matrices associated with the matrix calculation instruction. The computer device sending the matrix calculation message may or may not support matrix calculation. The local device may also support matrix calculation.

[0091] In addition, the matrix calculation message also includes an identifier, which is used to indicate the remote device to which the matrix calculation instruction is to be unloaded, so that the local device can feed back the calculation result of the matrix calculation instruction to the remote device according to the identifier.

[0092] Optionally, matrix calculation messages and calculation results of matrix calculation instructions can be transmitted between the remote device and the local device based on the socket. For example, as shown in Figure 4, the remote device can set up an so library. The so library refers to the program function library under Linux, that is, the compiled code and data that can be used by other programs. In this application, the so library can provide an interface for unloading matrix calculation instructions. The remote device runs a user process (application) to call the unloaded matrix calculation instruction through the interface, and transmits the matrix calculation message to the local device through the socket based on the correspondence between the remote device and the local device. The local device runs a service process, merges the matrix sets associated with multiple matrix calculation instructions, and performs matrix calculation on the merged matrix.

[0093] Step 330: The local device merges the matrix sets associated with the multiple matrix calculation instructions, and performs matrix calculation on the merged matrices.

[0094] The local device merges multiple matrix sets associated with multiple matrix calculation instructions to obtain a merged matrix, and performs a calculation operation on the merged matrix, i.e., performs a matrix calculation on the merged matrix. The calculation operation includes at least one of matrix multiplication, matrix addition, matrix subtraction, number multiplication, and matrix joint multiplication and addition.

[0095] It can be understood that matrix calculation refers to a calculation operation performed on at least two matrices based on an arithmetic operation symbol. For example, multiple matrix calculation instructions include a first matrix calculation instruction and a second matrix calculation instruction. The first matrix calculation instruction is associated with a first matrix set, which includes at least two first matrices. The second matrix calculation instruction is associated with a second matrix set, which includes at least two second matrices. The first matrix calculation instruction is used to instruct the execution of a matrix calculation on the at least two first matrices. The second matrix calculation instruction is used to instruct the execution of a matrix calculation on the at least two second matrices.

[0096] When a local device merges matrix sets associated with multiple matrix calculation instructions, it may merge matrices located on the same side of an arithmetic operator in the matrix sets associated with the multiple matrix calculation instructions to obtain multiple merged matrices. The merged matrices include matrices located on the same side of an arithmetic operator in the matrix sets associated with the multiple matrix calculation instructions. At least two matrices in a matrix set associated with a matrix calculation instruction are located in the same position in different merged matrices. The matrix sets associated with the multiple matrix calculation instructions perform the same matrix calculation.

[0097] It should be noted that matrix calculations are matrix addition or matrix subtraction, and multiple matrices to be merged can be placed in the same row or column. Matrix calculations are number multiplications, and multiple matrices in a matrix set associated with multiple matrix calculation instructions need to be multiplied by the same number. Multiple matrices to be merged can be placed in the same row or column. Matrix calculations are matrix multiplications, and multiple matrices to be merged cannot be placed in the same row or column, otherwise the calculation results will interfere with each other. Multiple matrices are arranged diagonally, and the remaining positions are filled with 0s. In this way, the multiple matrices in the merged matrix are arranged diagonally. The multiple matrices to be merged include matrices on the same side of the arithmetic operator sign in the matrix set associated with multiple matrix calculation instructions.

[0098] For example, as shown in FIG5(a), the first matrix calculation instruction performs matrix multiplication on matrix A and matrix B. The second matrix calculation instruction performs matrix multiplication on matrix D and matrix E. Matrix A and matrix D, located to the left of the multiplication symbol, are merged to obtain a first merged matrix, in which matrix A and matrix D are arranged diagonally. Matrix B and matrix E, located to the right of the multiplication symbol, are merged to obtain a second merged matrix, in which matrix B and matrix E are arranged diagonally. Matrix A is located in the upper left corner of the first merged matrix, and matrix B is located in the upper left corner of the second merged matrix. Matrix D is located in the lower right corner of the first merged matrix, and matrix E is located in the lower right corner of the second merged matrix. Matrix multiplication is performed on the first merged matrix and the second merged matrix, that is, the rows of the first merged matrix are multiplied by the columns of the first merged matrix, to obtain a matrix multiplication result. Matrix A is multiplied by matrix B to obtain matrix C, and matrix D is multiplied by matrix E to obtain matrix F. The matrix multiplication result includes matrices C and F, which are arranged diagonally. Split the results to obtain matrix C, the result of the matrix multiplication of matrix A and matrix B, and matrix F, the result of the matrix multiplication of matrix D and matrix E.

[0099] For another example, as shown in (b) in Figure 5, the first matrix calculation instruction associates matrix a and matrix b to perform matrix addition. The second matrix calculation instruction associates matrix d and matrix e to perform matrix addition. Matrix a and matrix d located on the left side of the addition symbol are merged to obtain a first merged matrix. In the first merged matrix, matrix a and matrix d can be arranged diagonally. Matrix b and matrix e located on the right side of the addition symbol are merged to obtain a second merged matrix, in which matrix b and matrix e are arranged diagonally. Among them, matrix a is located in the upper left corner of the first merged matrix, and matrix b is located in the upper left corner of the second merged matrix. Matrix d is located in the lower right corner of the first merged matrix, and matrix e is located in the lower right corner of the second merged matrix. Optionally, matrix a and matrix d are located in the same row in the first merged matrix, and matrix b and matrix e are located in the same row in the second merged matrix.

[0100] Perform matrix addition on the first and second merged matrices. This means adding the elements in the same position in the two matrices to obtain a matrix multiplication result. Matrix a plus matrix b produces matrix c, and matrix d plus matrix e produces matrix f. The matrix addition result includes matrices c and f arranged diagonally, or matrices c and f located in the same row. The result is split to obtain matrix c, the matrix addition result of matrices a and b, and matrix f, the matrix addition result of matrices d and e.

[0101] In some embodiments, a merging condition can be pre-configured. When multiple matrices meet the merging condition, multiple matrix sets associated with multiple matrix calculation instructions are merged to obtain a merged matrix. The merging condition is used to indicate the size threshold and merging period that must be met before the matrix calculation is performed.

[0102] The size threshold is determined by the size of the register used to store the matrix. For example, the size threshold may be less than or equal to the size of the register. It should be understood that the size of the merged matrix is ​​less than or equal to the size threshold. As the size of the merged matrix approaches the size threshold, the SME register can be fully utilized, improving the utilization rate of the processor executing the SME instruction and the utilization rate of the storage resources of the SME register. As the size of the merged matrix becomes closer to the size threshold, the utilization rate of the processor executing the SME instruction and the utilization rate of the storage resources of the SME register decrease.

[0103] The merging period is used to indicate the time unit for merging matrix calculations, that is, the time threshold for periodically merging multiple matrix sets. It should be understood that the shorter the merging period, the more frequently the matrix calculations are merged, and more computing resources are consumed; the longer the merging period, the fewer times the matrix calculations are merged, and the processor executing the SME instruction may perform matrix calculations on a smaller matrix size, resulting in lower utilization of the processor executing the SME instruction. Therefore, reasonably setting the merging period is conducive to improving the utilization of the processor executing the SME instruction. The merging period can be configured based on at least one of expert experience and business needs. For example, if the business demand indicates that a faster processing speed and a smaller processing delay are required, the merging period can be set shorter. If the business demand indicates that processing reliability is required, the merging period can be set longer.

[0104] Optionally, the size threshold and the merging period are configured by providing startup parameters, configuration files, hard coding, etc. of a computer program that provides the merge execution matrix calculation function. The startup parameters can be parameters read when the computer program starts, and are usually located at the beginning of the computer program. That is, the size threshold and the merging period can be located at the beginning of the computer program. A configuration file is a computer file that can configure parameters and initial settings for some computer programs, that is, a file that configures different objects differently. The configuration file is usually a file outside the computer program, and the configuration file can be called after the computer program is run. Hard coding is a software development practice that embeds data directly into the source code of a computer program or other executable object, which is different from obtaining data from the outside or generating data at runtime.

[0105] In a first possible implementation, when the sizes of multiple matrices meet a size threshold, the multiple matrices are merged to obtain a merged matrix. For example, when the sum of the sizes of matrices included in multiple matrix sets associated with multiple matrix calculation instructions is equal to the size threshold, the multiple matrices are merged to obtain a merged matrix.

[0106] In a second possible implementation, during a merging cycle, the sizes of multiple matrices preferentially meet a size threshold, and the multiple matrices are merged to obtain a merged matrix. For example, during a merging cycle, the sum of the sizes of matrices included in the multiple matrix sets is equal to the size threshold, and the multiple matrices are merged to obtain a merged matrix. For example, as shown in (a) of FIG6 , during a merging cycle, before the merging cycle ends, if the sizes of the first five matrices are equal to the size threshold, the first five matrices are merged to obtain a merged matrix.

[0107] In a third possible implementation, when multiple matrices meet a merging period, the multiple matrices are merged to obtain a merged matrix. That is, during the merging period, if the sum of the sizes of the matrices included in the multiple matrix sets is less than a size threshold, and if the time threshold is preferentially met, the multiple matrices are merged to obtain a merged matrix. For example, as shown in (b) of FIG6 , at the end of the merging period, although the sizes of the first four matrices are less than the size threshold, the first four matrices are merged to obtain a merged matrix.

[0108] In a fourth possible implementation, at the end of the merging period, if there are no matrices to merge within the merging period, matrix calculations are performed on a single matrix. For example, as shown in (c) in FIG6 , at the end of the merging period, if there is only one matrix within the merging period, matrix merging is not required, and matrix calculations are performed on the single matrix.

[0109] Step 340: The local device feeds back to the remote device the calculation result corresponding to the matrix calculation instruction in the matrix calculation result of the merged matrix.

[0110] The local device merges the matrix sets associated with multiple matrix calculation instructions, performs matrix calculation on the merged matrix, and obtains the matrix calculation result of the merged matrix. The matrix calculation result of the merged matrix includes the calculation results of performing matrix calculations on the matrix sets associated with multiple matrix calculation instructions respectively. Among them, the position of the calculation result of the matrix set associated with each matrix calculation instruction in the matrix calculation result is the same as the position of the matrix associated with the matrix calculation instruction in the merged matrix. For example, as shown in (a) in Figure 5, matrix A is located in the upper left corner of the first merged matrix, and matrix B is located in the upper left corner of the second merged matrix. The matrix multiplication result of matrix A and matrix B, matrix C, is located in the upper left corner of the matrix multiplication result. Matrix D is located in the lower right corner of the first merged matrix, matrix E is located in the lower right corner of the second merged matrix, and the matrix multiplication result of matrix D and matrix E, matrix F, is located in the lower right corner of the matrix multiplication result.

[0111] The local device splits the matrix calculation results of the merged matrix to obtain the calculation results of the matrix set associated with each matrix calculation instruction before the merger.

[0112] The local device feeds back to the remote device a calculation result corresponding to the matrix calculation instruction in the matrix calculation result of the merged matrix according to the identifier associated with the matrix calculation instruction included in the matrix calculation message.

[0113] For example, the local device obtains the calculation result of the first matrix calculation instruction and the calculation result of the second matrix calculation instruction from the matrix calculation result of the merged matrix. The calculation result of the first matrix calculation instruction is fed back to the remote device that sent the first matrix calculation instruction based on the identifier associated with the first matrix calculation instruction. The calculation result of the second matrix calculation instruction is fed back to the remote device that sent the second matrix calculation instruction based on the identifier associated with the second matrix calculation instruction.

[0114] Since the processor core can only process one instruction at a time, it needs to perform multiple matrix calculations compared to when the processor core processes multiple matrix calculation instructions. Moreover, if the size of the matrix associated with the matrix calculation instruction is small, the hardware resources of the processor that executes the matrix calculation instruction cannot be fully utilized, resulting in low computing throughput. The solution provided by the present application merges multiple matrix calculations into one matrix calculation, that is, merges the matrices associated with multiple matrix calculation instructions into a large matrix, and performs one matrix calculation on the merged matrix. Thus, the matrix size is increased by the merged matrix, thereby reducing the number of matrix calculations, improving the utilization rate of the processor that executes the matrix calculation instruction, making full use of the storage resources and computing resources that execute the matrix calculation instruction, improving the utilization rate of the processor that executes the matrix calculation instruction, and improving computing throughput.

[0115] It is worth noting that for the offloading scenarios of matrix calculations between processor cores within a processor, as shown in (a) and (b) in Figure 2, and the offloading scenarios of matrix calculations between different processors, the data processing process is similar to the processing process in (c) in Figure 2. For example, for the scenario shown in (a) in Figure 2, processor cores 0 and 2 are equivalent to remote devices, and processor core 1 is equivalent to the local device; for the scenario shown in (b) in Figure 2, processor 0 is equivalent to the remote device, and processor 1 is equivalent to the local device. For the sake of simplicity, only the scenario shown in (c) in Figure 2 is used as an example for explanation. The data processing process for other scenarios is similar to the data processing process shown in Figure 3 and will not be repeated here.

[0116] It is understood that in order to implement the functions in the above embodiments, the processor includes hardware structures and / or software modules corresponding to the execution of each function. It should be readily apparent to those skilled in the art that, in combination with the units and method steps of each example described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.

[0117] The data processing method provided according to this embodiment is described in detail above with reference to FIG. 1 to FIG. 6 . The data processing device provided according to this embodiment will be described below with reference to FIG. 7 .

[0118] Figure 7 is a schematic diagram of the structure of a possible data processing device provided in this embodiment. These data processing devices can be used to implement the functions of the local device in the above-mentioned method embodiments, thereby also achieving the beneficial effects of the above-mentioned method embodiments. In this embodiment, the data processing device can be a processor core as shown in Figure 1, or a module (such as a chip) applied to a server.

[0119] As shown in Figure 7, the data processing device 700 includes a communication module 710, a merging module 720, and a storage module 730. The data processing device 700 is used to implement the functions of the local device in the method embodiment shown in Figure 3 above.

[0120] The communication module 710 is configured to obtain a first matrix set associated with a first matrix calculation instruction and a second matrix set associated with a second matrix calculation instruction, wherein the first matrix calculation instruction and the second matrix calculation instruction are each one of a plurality of matrix calculation instructions, the first matrix set includes at least two first matrices, and the second matrix set includes at least two second matrices. For example, the communication module 710 is configured to execute step 320 in FIG. 3 .

[0121] Merging module 720 is configured to merge matrices of the first matrix set and the second matrix set to obtain a merged matrix, and to perform calculation operations on the merged matrix to obtain calculation results of the first matrix calculation instruction and calculation results of the second matrix calculation instruction, respectively. For example, merging module 720 is configured to perform step 330 in FIG. 3 .

[0122] The computing operation includes at least one of matrix multiplication, matrix addition, matrix subtraction, number multiplication, and matrix joint multiplication and addition. The computing operation is matrix multiplication, and at least two matrices in the combined matrix are arranged diagonally.

[0123] The storage module 730 is used to store matrix calculation instructions and matrices, so that the merging module 720 can merge matrices associated with multiple matrix calculation instructions to perform matrix calculation.

[0124] Optionally, the merging module 720 is specifically configured to merge multiple matrices associated with multiple matrix calculation instructions to obtain a merged matrix when multiple matrices meet a merging condition.

[0125] The merging condition is used to indicate the size threshold and merging period that need to be met for merging matrix calculations. The size threshold is determined by the size of the register used to store the matrix. The merging period is used to indicate the time unit for merging matrix calculations.

[0126] The merging module 720 is specifically configured to merge the matrices of the first matrix set and the second matrix set to obtain a merged matrix when the matrices of the first matrix set and the second matrix set meet a size threshold, where the size threshold is determined by the size of a register for storing the matrix.

[0127] The merging module 720 is specifically configured to merge the matrices of the first matrix set and the second matrix set within a merging period to obtain a merged matrix. The merging period is used to indicate a time unit for performing matrix calculations during merging.

[0128] It should be understood that the data processing device 700 of the embodiment of the present application can be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), wherein the PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. Alternatively, when the data processing method shown in FIG. 3 is implemented by software, the data processing device 700 and its modules can also be software modules.

[0129] According to the data processing device 700 of the embodiment of the present application, it can correspond to executing the method described in the embodiment of the present application, and the above-mentioned and other operations and / or functions of each unit in the data processing device 700 are respectively for implementing the corresponding processes of each method in Figure 3. For the sake of brevity, they are not repeated here.

[0130] The present application also provides a processor, which includes a memory and at least two processor cores, wherein the memory is used to store a set of computer instructions; when the processor core executes the set of computer instructions, the operating steps of the methods described in the above embodiments are performed.

[0131] The present application also provides a computer system, which includes multiple computer devices, and the computer devices are used to execute the operating steps of the methods described in the above embodiments.

[0132] The method steps in this embodiment can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC. In addition, the ASIC can be located in a computer device. Of course, the processor and storage medium can also exist in a computer device as discrete components.

[0133] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is performed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instruction can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired or wireless means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, or a tape; it can also be an optical medium, such as a digital video disc (DVD); it can also be a semiconductor medium, such as a solid state drive (SSD). The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A data processing method, characterized in that: The method is executed by a processor, comprising: Obtaining a first matrix set associated with a first matrix calculation instruction and a second matrix set associated with a second matrix calculation instruction, wherein the first matrix calculation instruction and the second matrix calculation instruction are respectively one of a plurality of matrix calculation instructions, the first matrix set includes at least two first matrices, and the second matrix set includes at least two second matrices; Merging matrices of the first matrix set and the second matrix set to obtain a merged matrix; Execute a calculation operation of the merged matrix to obtain a calculation result of the first matrix calculation instruction and a calculation result of the second matrix calculation instruction respectively.

2. The method according to claim 1, characterized in that: Merging matrices of the first matrix set and the second matrix set to obtain a merged matrix includes: When the matrices of the first matrix set and the second matrix set meet a size threshold, the matrices of the first matrix set and the second matrix set are merged to obtain the merged matrix, and the size threshold is determined by the size of a register used to store the matrix.

3. The method according to claim 1 or 2, characterized in that: Merging the matrices of the first matrix set and the second matrix set to obtain the merged matrix includes: Within a merging period, matrices of the first matrix set and the second matrix set are merged to obtain the merged matrix, and the merging period is used to indicate a time unit for performing matrix calculations during merging.

4. The method according to any one of claims 1 to 3, characterized in that The calculation operation includes at least one of matrix multiplication, matrix addition, matrix subtraction, number multiplication and matrix joint multiplication and addition.

5. The method according to claim 4, characterized in that The calculation operation is matrix multiplication, and at least two matrices in the combined matrix are arranged diagonally.

6. The method according to any one of claims 1 to 5, characterized in that Obtaining a first matrix set associated with a first matrix calculation instruction and a second matrix set associated with a second matrix calculation instruction, including: When the remote device performs non-matrix calculations, a first matrix set associated with the first matrix calculation instruction and a second matrix set associated with the second matrix calculation instruction are obtained from the remote device.

7. The method according to claim 6, characterized in that The remote device includes any one of a processor core, a processor and a computer device, and the remote device is a device that supports matrix calculation or a device that does not support matrix calculation.

8. The method according to claim 7, characterized in that Obtaining a calculation result of the first matrix calculation instruction and a calculation result of the second matrix calculation instruction, comprising: The calculation result of the first matrix calculation instruction and the calculation result of the second matrix calculation instruction are obtained from the calculation result of the merged matrix.

9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: Feedback a calculation result of the first matrix calculation instruction to a remote device that sends the first matrix calculation instruction according to an identifier associated with the first matrix calculation instruction; The calculation result of the second matrix calculation instruction is fed back to the remote device that sends the second matrix calculation instruction according to the identifier associated with the second matrix calculation instruction.

10. A data processing device, characterized in that: The device comprises: A communication module, configured to obtain a first matrix set associated with a first matrix calculation instruction and a second matrix set associated with a second matrix calculation instruction, wherein the first matrix calculation instruction and the second matrix calculation instruction are respectively one of a plurality of matrix calculation instructions, the first matrix set includes at least two first matrices, and the second matrix set includes at least two second matrices; a merging module, configured to merge the matrices of the first matrix set and the second matrix set to obtain a merged matrix; The merging module is further used to perform calculation operations on the merged matrix to obtain calculation results of the first matrix calculation instruction and the second matrix calculation instruction respectively.

11. A processor, characterized in that: The processor includes a memory and at least two processor cores, the memory is used to store a group of computer instructions; when the processor core executes the group of computer instructions, the operation steps of the method described in any one of claims 1 to 9 are performed.

12. A computer device, characterized in that: The computer device includes a memory and at least one processor, wherein the memory is used to store a set of computer instructions; when the processor executes the set of computer instructions, the operation steps of the method described in any one of claims 1 to 9 are performed.

13. A computer system, characterized in that: The computer system includes a plurality of computer devices, and the computer devices are used to execute the operation steps of any one of the methods according to claims 1-9.

Citation Information

Patent Citations

  • Implementing fundamental computational primitives using a matrix multiplication accelerator (MMA)

    CN110352422A

  • High throughput matrix processor with support for concurrently processing multiple matrices

    CN112748956A

  • Data processing method and device and storage medium

    CN114065122A

  • Techniques for accelerating matrix multiplication calculations using hierarchical representations of sparse matrices

    CN115374396A

  • Efficient repair of erasure coded data based on coefficient matrix decomposition

    US20180121286A1