# US 2023/0015148 A1 · Multiplier and Adder in Systolic Array

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

- Number: US 2023/0015148 A1
- Document ID: US20230015148A1
- Status: Published application
- Kind: A1
- Application number: 17/377,743
- Filed: 2021-07-16
- Published: 2023-01-19
- Earliest claimed: 2021-07-16
- Assignees: Google Inc.
- Applicants: Google LLC
- Inventors: Doe Hyun Yoon; Lifeng Nai
- Web page: https://patentgrep.com/patent/US20230015148A1

## CPC

- G06F 7/5443: {Sum of products (for applications thereof, see the relevant places, e.g. G06F17/10, H03H17/00)}
- G06F 7/50: Adding; Subtracting (G06F7/483 - G06F7/491, G06F7/544 - G06F7/556 take precedence)
- G06F 7/5312: {using carry save adders}
- G06F 7/533: Reduction of the number of iteration steps or stages, e.g. using the Booth algorithm, log-sum, odd-even
- G06F 15/8046: {Systolic arrays}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The subject matter described herein provides systems and techniques for the design and use of multiply-and-accumulate (MAC) units to perform matrix multiplication by systolic arrays, such as those used in accelerators for deep neural networks (DNNs). These MAC units may take advantage of the particular way in which matrix multiplication is performed within a systolic array. For example, when a matrix A is multiplied with a matrix B, the scalar value, a, of the matrix A is reused many times, the scalar value, b, of the matrix B may be streamed into the systolic array and forwarded to a series of MAC units in the systolic array, and only the final values and not the intermediate values of the dot products, computed for the matrix multiplication, may be correct. MAC unit hardware that is particularized to take advantage of these observations is described herein.

## Claims

### Claim 1

A multiply-and-accumulate (MAC) unit for multiplying two numbers to produce a result, the MAC unit comprising:
a first flip/flop configured to latch a first number and to output the first number and a multiple number based on the first number;
a second flip/flop configured to load a second number and to output the second number;
a multiplexer, in communication with the first flip/flop and the second flip/flop, configured to receive the first number and the multiple number from the first flip/flop and the second number from the second flip/flop, and to output a plurality of partial products based on the first number, the multiple, number, and the second number;
at least one carry save adder, in communication with the multiplexer, configured to receive the plurality of partial products, and a partial sum, and to output at least two partially summed numbers based on the plurality of partial products and the partial sum; and
a plurality of parallel segmented adders, in communication with the at least one carry save adder, configured to receive the at least two partially summed numbers, perform an addition operation on the at least two partially summed numbers, and to output the result.

### Claim 2 (depends on 1)

The MAC unit of claim 1, wherein the second number is encoded using Booth encoding.

### Claim 3 (depends on 1)

The MAC unit of claim 1, further comprising at least one hard multiple calculator, in communication with the first flip/flop, configured to receive a preloaded number and to output the multiple number to the first flip/flop.

### Claim 4 (depends on 1)

The MAC unit of claim 1, wherein the at least one carry save adder includes solely a multi-to-two carry save adder.

### Claim 5 (depends on 1)

The MAC unit of claim 1, wherein the at least one carry save adder includes a carry save adder and a multi-to-two carry save adder.

### Claim 6 (depends on 5)

The MAC unit of claim 5, further comprising a third flip/flop, in communication with the multi-to-two carry save adder, configured to load the partial sum and to output the partial sum to the multi-to-two carry save adder.

### Claim 7 (depends on 6)

The MAC unit of claim 6, wherein the third flip/flop is configured to load the partial sum from a partial sum output from another MAC unit.

### Claim 8 (depends on 1)

The MAC unit of claim 1, wherein the plurality of parallel segmented adders are configured to operate in parallel on segments of numbers that are in a partially redundant form.

### Claim 9 (depends on 1)

The MAC unit of claim 1, wherein the first flip/flop is configured to latch the first number at two times the normal clock speed.

### Claim 10 (depends on 1)

The MAC unit of claim 1, wherein the MAC unit is an enhanced MAC unit that uses a fused version of a multiplier and adder.

### Claim 11 (depends on 1)

The MAC unit of claim 1, wherein the MAC unit is within a systolic array.

### Claim 12

A multiply-and-accumulate (MAC) unit, the MAC unit comprising:
a first flip/flop configured to latch a first number and output to the first number;
a second flip/flop configured to latch a multiple number based on the first number and to output the multiple number;
a third flip/flop configured to load a second number and to output the second number;
a multiplier in communication with the first, second, and third flip/flops, and configured to:
receive the first number from the first flip/flop, the multiple number from the second flip/flop, and the second number from the third flip/flop,
produce partial products based on the first number, the multiple number, and the second number,
and to output the partial products;
an adder in communication with the multiplier, and configured to
receive the partial products from the multiplier, and
add the partial products with a partial sum number to produce a result.

### Claim 13 (depends on 12)

The MAC unit of claim 12, further comprising a double data rate flip/flop configured to latch the first number and the multiple number at two times the normal clock speed.

### Claim 14 (depends on 13)

The MAC unit of claim 13, further comprising a demultiplexer in communication with the double data rate flip/flop, and the first and the second flip/flops, and configured to:
receive the first number and the multiple number from the double data rate flip/flop;
output the first number to the first flip/flop; and
output the multiple number to the second flip/flop.

### Claim 15 (depends on 12)

The MAC unit of claim 12, further comprising a fourth flip/flop, in communication with the adder, and configured to load the partial sum number and to output the partial sum number to the adder.

### Claim 16 (depends on 12)

The MAC unit of claim 12, wherein the MAC unit is within a systolic array.

### Claim 17

A method of computing a result of at least one multiply and accumulate operation, the method comprising:
latching a first number, and a multiple number based on the first number, using a first flip/flop;
loading a second number using a second flip/flop;
producing a plurality of partial products based on the first number, the multiple, number, and the second number using a multiplexer;
receiving the plurality of partial products and a partial sum using at least one carry save adder;
producing at least two partially summed numbers based on the plurality of partial products and the partial sum using the at least one carry save adder;
receiving the at least two partially summed numbers using a plurality of parallel segmented adders; and
performing an addition operation on the at least two partially summed numbers to compute the result.

### Claim 18 (depends on 17)

The method of claim 17, wherein the second number is encoded using Booth encoding.

### Claim 19 (depends on 17)

The method of claim 17, wherein the multiple number is computed using at least one hard multiple calculator.

### Claim 20 (depends on 17)

The method of claim 17, further comprising:
loading the partial sum; and
outputting the partial sum to the at least one carry save adder.
