# US 2022/0291923 A1 · Register-based matrix multiplication

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0291923 A1
- Document ID: US20220291923A1
- Status: Published application
- Kind: A1
- Application number: 17/678,221
- Filed: 2022-02-23
- Published: 2022-09-15
- Earliest claimed: 2017-06-28
- Assignees: Arm Limited
- Applicants: Arm Limited
- Inventors: David Hennah MANSELL; Rune HOLM; Ian Michael CAULFIELD; Jelena MILANOVIC
- Web page: https://patentgrep.com/patent/US20220291923A1

## CPC

- G06F 9/3001: {Arithmetic instructions}
- G06F 9/30036: {Instructions to perform operations on packed data, e.g. vector, tile or matrix operations}
- G06F 9/30043: {LOAD or STORE instructions; Clear instruction}
- G06F 9/30076: {to perform miscellaneous control operations, e.g. NOP}
- G06F 9/30109: {having multiple operands in a single register}
- G06F 9/30189: {according to execution mode, e.g. mode flag}
- G06F 17/16: Matrix or vector computation {, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization (matrix transposition G06F7/78)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques for performing matrix multiplication in a data processing apparatus are disclosed, comprising apparatuses, matrix multiply instructions, methods of operating the apparatuses, and virtual machine implementations. Registers, each register for storing at least four data elements, are referenced by a matrix multiply instruction and in response to the matrix multiply instruction a matrix multiply operation is carried out. First and second matrices of data elements are extracted from first and second source registers, and plural dot product operations, acting on respective rows of the first matrix and respective columns of the second matrix are performed to generate a square matrix of result data elements, which is applied to a destination register. A higher computation density for a given number of register operands is achieved with respect to vector-by-element techniques.

## Claims

### Claim 1

(canceled)

### Claim 2

Apparatus comprising:
register storage circuitry having a plurality of registers, each register to store at least four data elements;
decoder circuitry responsive to a matrix multiply instruction to generate control signals, wherein the matrix multiply instruction specifies in the plurality of registers: a first source register, and second source register, and a destination register; and
data processing circuitry responsive to the control signals to perform a matrix multiply operation comprising:
extracting a first matrix of data elements from the first source register;
extracting a second matrix of data elements from the second source register;
performing plural dot product operations to generate a square matrix of result data elements, wherein each dot product operation acts on a respective row of the first matrix of data elements and a respective column of the second matrix of data elements to generate a respective result data element of the square matrix of result data elements; and
applying the square matrix of result data elements to the destination register.

### Claim 3 (depends on 2)

The apparatus of claim 2, wherein applying the square matrix of result data elements to the destination register comprises storing the square matrix of result data elements in the destination register.

### Claim 4 (depends on 2)

The apparatus of claim 2, wherein applying the square matrix of result data elements to the destination register comprises accumulating the square matrix of result data elements with a previously stored square matrix of result data elements stored in the destination register.

### Claim 5 (depends on 2)

The apparatus of claim 2, wherein each data element of the first matrix of data elements and each data element of the second matrix of data elements has a source element bit length which is equal to a result element bit length of each data element of the square matrix of result data elements.

### Claim 6 (depends on 2)

The apparatus of claim 2, wherein each data element of the first matrix of data elements and each data element of the second matrix of data elements has a source element bit length which is different from a result element bit length of each data element of the square matrix of result data elements.

### Claim 7 (depends on 2)

The apparatus of claim 2, wherein the matrix multiply instruction specifies a dimension of the square matrix of result data elements.

### Claim 8 (depends on 2)

The apparatus of claim 2, wherein the data elements of the first matrix of data elements, the data elements of the second matrix of data elements, and the result data elements are floating point values.

### Claim 9 (depends on 2)

The apparatus of claim 2, wherein the data elements of the first matrix of data elements, the data elements of the second matrix of data elements, and the result data elements are integer values.

### Claim 10 (depends on 2)

The apparatus any claim 2, wherein the first matrix of data elements and the second matrix of data elements are non-square rectangular matrices.

### Claim 11 (depends on 2)

The apparatus of claim 2, wherein the decoder circuitry is further responsive to a configuration instruction to generate configuration control signals, wherein the configuration instruction specifies a maximum vector length, and the data processing circuitry is responsive to the configuration control signals to constrain subsequent matrix multiply operations such that a total size of the result data elements does not exceed the maximum vector length.

### Claim 12 (depends on 7)

The apparatus of claim 7, wherein a storage capacity of the destination register is capable of storing more than one square matrix of result data elements having the dimension specified in the matrix multiply instruction.

### Claim 13 (depends on 2)

The apparatus of claim 2, wherein the destination register has a storage capacity accommodating at least eight data elements and to store at least a second square matrix of result data elements, wherein the data processing circuitry is responsive to the control signals to apply the square matrix of result data elements to a first portion of the destination register wherein the data processing circuitry is further responsive to the control signals to perform a second matrix multiply operation to generate the second square matrix of result data elements and to apply the second square matrix of result data elements to a second portion of the destination register.

### Claim 14 (depends on 13)

The apparatus of claim 13, wherein the first matrix of data elements from the first source register is extracted from a first portion of the first source register, and the data processing circuitry is responsive to the control signals to perform the matrix multiply operation as a first matrix multiply operation comprising:
extracting the second matrix of data elements from a first portion of the second source register; and
applying the square matrix of result data elements to a first portion of the destination register;
and the data processing circuitry is responsive to the control signals to perform the second matrix multiply operation comprising:
extracting the second matrix of data elements from a second portion of the second source register; and
applying the square matrix of result data elements to the second portion of the destination register.

### Claim 15 (depends on 14)

The apparatus of claim 14, wherein the data processing circuitry is further responsive to the control signals to perform at least one further matrix multiply operation to generate at least a further square matrix of result data elements.

### Claim 16 (depends on 14)

The apparatus of claim 14, wherein the decoder circuitry is responsive to a copying load instruction preceding the matrix multiply instruction and specifying a memory location and the first source register to generate copying load control signals, and the data processing circuitry is responsive to the copying load control signals to perform a copying load operation comprising:
loading the first square matrix of data elements from the specified memory location into the first portion of the first source register; and
copying the first square matrix of data elements into the second portion of the first source register,
and wherein the second matrix of data elements from the second source register is extracted from the first portion of the second source register.

### Claim 17 (depends on 2)

The apparatus of claim 2, wherein the matrix multiply instruction further specifies at least one of:
a third source register, and wherein the matrix multiply operation comprises extracting the first matrix of data elements from the first source register and the third source register;
a fourth source register, and wherein the matrix multiply operation comprises extracting the second matrix of data elements from the second source register and the fourth source register; and
a further destination register, and wherein the matrix multiply operation comprises applying the square matrix of result data elements split between the destination register and the further destination register.

### Claim 18

A method of operating a data processing apparatus comprising:
generating control signals in response to a matrix multiply instruction, wherein the matrix multiply instruction specifies in a plurality of registers, each register capable of storing at least four data elements: a first source register, and second source register, and a destination register; and
performing a matrix multiply operation in response to the control signals comprising:
extracting a first matrix of data elements from the first source register;
extracting a second matrix of data elements from the second source register;
performing plural dot product operations to generate a square matrix of result data elements, wherein each dot product operation acts on a respective row of the first matrix of data elements and a respective column of the second matrix of data elements to generate a respective result data element of the square matrix of result data elements; and
applying the square matrix of result data elements to the destination register.

### Claim 19 (depends on 2)

A non-transitory, computer-readable storage medium storing a virtual machine computer program comprising program instructions to control a host data processing apparatus to provide an instruction execution environment corresponding to the apparatus according to claim 2.

### Claim 20 (depends on 18)

A non-transitory, computer-readable storage medium storing a virtual machine computer program comprising program instructions to control a host data processing apparatus to provide an instruction execution environment in which the method of claim 18 can be carried out.
