# US 2024/0202277 A1 · Apparatus and method for matrix multiplication

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

- Number: US 2024/0202277 A1
- Document ID: US20240202277A1
- Status: Published application
- Kind: A1
- Application number: 18/538,145
- Filed: 2023-12-13
- Published: 2024-06-20
- Earliest claimed: 2022-12-15
- Assignees: Electronics and Telecommunications Research Institute
- Applicants: Electronics and Telecommunications Research Institute
- Inventors: Joo-Hyun LEE
- Web page: https://patentgrep.com/patent/US20240202277A1

## CPC

- G06F 17/16: Matrix or vector computation {, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization (matrix transposition G06F7/78)}
- G06F 7/5443: {Sum of products (for applications thereof, see the relevant places, e.g. G06F17/10, H03H17/00)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Disclosed herein is an apparatus and method for a matrix multiplication operation. The apparatus may include memory for storing first matrix data and second matrix data, an X buffer for storing the first matrix data, a Y buffer for storing the second matrix data, multiple operation units for performing Multiply-and-Accumulate (MAC) operations in parallel on the data input from the X buffer and the Y buffer, and a data loader for storing the first matrix data and the second matrix data read from the memory in the X buffer and the Y buffer, respectively.

## Claims

### Claim 1

An apparatus for a matrix multiplication operation, comprising:
memory for storing data of a first matrix and data of a second matrix;
an X buffer for storing the data of the first matrix;
a Y buffer for storing the data of the second matrix;
multiple operation units for performing Multiply-and-Accumulate (MAC) operations in parallel on data input from the X buffer and the Y buffer; and
a data loader for storing the data of the first matrix read from the memory in the X buffer and storing the data of the second matrix read from the memory in the Y buffer.

### Claim 2 (depends on 1)

The apparatus of claim 1, wherein each of the multiple operation units for performing the MAC operations in parallel includes
a multiplier for multiplying a value output from the X buffer and a value output from the Y buffer;
a partial sum register; and
an adder for adding an output value of the multiplier and a value stored in the partial sum register and again storing a result value of addition in the partial sum register.

### Claim 3 (depends on 1)

The apparatus of claim 1, wherein the data loader is configured to
store pieces of matrix data in the X buffer or the Y buffer in a first mode or a second mode,
simultaneously load the pieces of matrix data into respective First-In First-Out (FIFO) units inside the X buffer or the Y buffer in parallel in the first mode, and
load the pieces of matrix data into one of the FIFO units inside the X buffer or the Y buffer in the second mode.

### Claim 4 (depends on 3)

The apparatus of claim 3, wherein, when multiplication of the first matrix and the second matrix is performed, the data loader stores the data of the first matrix in the X buffer by loading the data in the first mode and stores the data of the second matrix in the Y buffer by loading the data in the second mode.

### Claim 5 (depends on 3)

The apparatus of claim 3, wherein, when multiplication of a transpose matrix of the first matrix and the second matrix is performed, the data loader stores the data of the first matrix in the X buffer by loading the data in the second mode and stores the data of the second matrix in the Y buffer by loading the data in the second mode.

### Claim 6 (depends on 3)

The apparatus of claim 3, wherein, when multiplication of the first matrix and a transpose matrix of the second matrix is performed, the data loader stores the data of the first matrix in the X buffer by loading the data in the first mode and stores the data of the second matrix in the Y buffer by loading the data in the first mode.

### Claim 7 (depends on 3)

The apparatus of claim 3, wherein, when multiplication of a transpose matrix of the first matrix and a transpose matrix of the second matrix is performed, the data loader stores the data of the first matrix in the X buffer by loading the data in the second mode and stores the data of the second matrix in the Y buffer by loading the data in the first mode.

### Claim 8 (depends on 1)

The apparatus of claim 1, wherein each of the X buffer and the Y buffer is formed of two buffers, and while a predetermined number of pieces of matrix data is being output from one of the buffers, a predetermined number of pieces of matrix data is stored in the other one of the buffers.

### Claim 9 (depends on 2)

The apparatus of claim 2, further comprising:
a data saver for simultaneously outputting values stored in the respective partial sum registers of the multiple operation units for performing the MAC operations in parallel and storing the values in the memory.

### Claim 10

A method for a matrix multiplication operation, comprising:
loading data of a first matrix and data of a second matrix from memory into an X buffer and a Y buffer, respectively; and
performing simultaneous Multiply-and-Accumulate (MAC) operations in parallel on the data of the first matrix, which is loaded into the X buffer, and the data of the second matrix, which is loaded into the Y buffer, multiple times.

### Claim 11 (depends on 10)

The method of claim 10, wherein the MAC operation comprises
multiplication of a value output from the X buffer and a value output from the Y buffer,
addition of a result value of the multiplication and a previously calculated partial sum, and
update of the partial sum with a result value of the addition.

### Claim 12 (depends on 10)

The method of claim 10, wherein:
loading the data comprises storing pieces of matrix data in the X buffer or the Y buffer in a first mode or a second mode,
the pieces of matrix data are simultaneously loaded into respective First-In First-Out (FIFO) units inside the X buffer or the Y buffer in parallel in the first mode, and
the pieces of matrix data are loaded into one of the FIFO units inside the X buffer or the Y buffer in the second mode.

### Claim 13 (depends on 12)

The method of claim 12, wherein loading the data comprises storing the data of the first matrix in the X buffer by loading the data in the first mode and storing the data of the second matrix in the Y buffer by loading the data in the second mode when multiplication of the first matrix and the second matrix is performed.

### Claim 14 (depends on 12)

The method of claim 12, wherein loading the data comprises storing the data of the first matrix in the X buffer by loading the data in the second mode and storing the data of the second matrix in the Y buffer by loading the data in the second mode when multiplication of a transpose matrix of the first matrix and the second matrix is performed.

### Claim 15 (depends on 12)

The method of claim 12, wherein loading the data comprises storing the data of the first matrix in the X buffer by loading the data in the first mode and storing the data of the second matrix in the Y buffer by loading the data in the first mode when multiplication of the first matrix and a transpose matrix of the second matrix is performed.

### Claim 16 (depends on 12)

The method of claim 12, wherein loading the data comprises storing the data of the first matrix in the X buffer by loading the data in the second mode and storing the data of the second matrix in the Y buffer by loading the data in the first mode when multiplication of a transpose matrix of the first matrix and a transpose matrix of the second matrix is performed.

### Claim 17 (depends on 10)

The method of claim 10, wherein each of the X buffer and the Y buffer is formed of two buffers, and while a predetermined number of pieces of matrix data is being output from one of the buffers, a predetermined number of pieces of matrix data is stored in the other one of the buffers.

### Claim 18 (depends on 11)

The method of claim 11, further comprising:
simultaneously outputting partial sums, which are results of performing the simultaneous MAC operations in parallel multiple times, and storing the partial sums in the memory.

### Claim 19

An apparatus for a matrix multiplication operation, comprising:
memory for storing data of a first matrix and data of a second matrix;
an X buffer for storing the data of the first matrix;
a Y buffer for storing the data of the second matrix;
multiple operation units for performing Multiply-and-Accumulate (MAC) operations in parallel on data input from the X buffer and the Y buffer;
a data loader for storing the data of the first matrix read from the memory in the X buffer and storing the data of the second matrix read from the memory in the Y buffer; and
a data saver for simultaneously outputting values stored in respective partial sum registers of the multiple operation units for performing the MAC operations in parallel and storing the values in the memory.

### Claim 20 (depends on 19)

The apparatus of claim 19, wherein the data loader is configured to
store pieces of matrix data in the X buffer or the Y buffer in a first mode or a second mode,
simultaneously load the pieces of matrix data into respective First-In First-Out (FIFO) units inside the X buffer or the Y buffer in parallel in the first mode, and
load the pieces of matrix data into one of the FIFO units inside the X buffer or the Y buffer in the second mode.
