# US 2022/0066760 A1 · Deep Neural Networks Compiler for a Trace-Based Accelerator

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

- Number: US 2022/0066760 A1
- Document ID: US20220066760A1
- Status: Published application
- Kind: A1
- Application number: 17/003,476
- Filed: 2020-08-26
- Published: 2022-03-03
- Earliest claimed: 2020-08-26
- Assignees: Micron Technology, Inc.
- Applicants: Micron Technology, Inc.
- Inventors: Andre Xian Ming Chang; Aliasger Zaidy; Eugenio Culurciello; Marko Vitez
- Web page: https://patentgrep.com/patent/US20220066760A1

## CPC

- G06F 8/458: {Synchronisation, e.g. post-wait, barriers, locks (synchronisation among tasks G06F9/52)}
- G06N 3/063: using electronic means
- G06F 8/41: Compilation
- G06F 9/30087: {Synchronisation or serialisation instructions}
- G06F 9/5027: {the resource being a machine, e.g. CPUs, Servers, Terminals}
- G06N 3/02: Neural networks
- G06N 3/045: Combinations of networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/048: Activation functions
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A method of compiling neural network code to executable instructions for execution by a computational acceleration system having a memory circuit and one or more acceleration circuits having a maps data buffer and a kernel data buffer is disclosed, such as for execution by an inference engine circuit architecture which includes a matrix-matrix (MM) accelerator circuit having multiple operating modes to provide a complete matrix multiplication. A representative compiling method includes generating a list of neural network layer model objects; fusing available functions and layers in the list; selecting a cooperative mode, an independent mode, or a combined cooperative and independent mode for execution; selecting a data movement mode and an ordering of computations which reduces usage of the memory circuit; generating an ordered sequence of load objects, compute objects, and store objects; and converting the ordered sequence of load objects, compute objects, and store objects into the executable instructions.

## Claims

### Claim 1

A method of compiling neural network code to a plurality of executable instructions or other into executable code for execution by a computational acceleration system having a memory circuit and one or more acceleration circuits having a maps data buffer and a kernel data buffer, the method comprising:
using one or more processors, from the neural network code, generating a list of neural network layer model objects;
using the one or more processors, fusing available functions and layers in the list of neural network layer model objects;
using the one or more processors, selecting a cooperative mode, an independent mode, or a combined cooperative and independent mode for code execution by the one or more acceleration circuits;
using the one or more processors, selecting a data movement mode and an ordering of computations which reduces usage of the memory circuit;
using the one or more processors, generating an ordered sequence of load objects, compute objects, and store objects; and
using the one or more processors, converting the ordered sequence of load objects, compute objects, and store objects into the plurality of executable instructions.

### Claim 2 (depends on 1)

The method of compiling of claim 1, wherein the step of selecting a data movement mode and an ordering of computations further comprises:
using the one or more processors, determining memory circuit usage when kernel data is maintained in the kernel data buffer for a predetermined number of computations with reordering of maps data movement and computations to utilize the selected kernel data which is currently loaded in the kernel data buffer.

### Claim 3 (depends on 1)

The method of compiling of claim 1, further comprising:
using the one or more processors, reordering at least one computation to utilize selected maps data or kernel data which is currently loaded respectively in the maps data buffer or in the kernel data buffer.

### Claim 4 (depends on 1)

The method of compiling of claim 1, wherein the step of selecting a data movement mode and an ordering of computations further comprises:
using the one or more processors, determining memory circuit usage when maps data is maintained in the maps data buffer for a predetermined number of computations with reordering of kernel data movement and computations to utilize the selected maps data which is currently loaded in the maps data buffer.

### Claim 5 (depends on 1)

The method of compiling of claim 1, wherein the step of selecting a data movement mode and an ordering of computations further comprises:
using the one or more processors, determining memory circuit usage when maps data movement is reordered, kernel data movement is reordered, and computations are reordered to utilize the selected maps data or kernel data which is currently loaded respectively in the maps data buffer or in the kernel data buffer.

### Claim 6 (depends on 1)

The method of compiling of claim 1, wherein the step of selecting a data movement mode and an ordering of computations further comprises:
using the one or more processors, determining memory circuit usage when maps data movement is reordered, kernel data movement is reordered, and computations are reordered to utilize one or more rows of the selected maps data or kernel data which is currently loaded respectively in the maps data buffer or in the kernel data buffer.

### Claim 7 (depends on 1)

The method of compiling of claim 1, further comprising:
using the one or more processors, further ordering load objects to provide data pre-fetching; and
using the one or more processors, pipelining the plurality of executable instructions for execution across a plurality of acceleration circuits.

### Claim 8 (depends on 1)

The method of compiling of claim 1, further comprising:
using the one or more processors, further ordering the sequence of load objects, compute objects, and store objects to reduce any computational latency.

### Claim 9 (depends on 1)

The method of compiling of claim 1, further comprising:
using the one or more processors, determining a maps data size for transferring maps data from the memory circuit to the maps data buffer.

### Claim 10 (depends on 1)

The method of compiling of claim 1, further comprising:
using the one or more processors, determining a kernel data size for transferring kernel data from the memory circuit to the kernel data buffer.

### Claim 11 (depends on 1)

The method of compiling of claim 1, further comprising:
using the one or more processors, merging a plurality of executable instructions into a plurality of instruction banks without branching between banks of the plurality of instruction banks.

### Claim 12 (depends on 1)

The method of compiling of claim 1, further comprising:
using the one or more processors, generating one or more synchronization instructions.

### Claim 13 (depends on 1)

The method of compiling of claim 1, wherein the step of selecting a data movement mode and an ordering of computations further comprises:
using the one or more processors, selecting the data movement mode and the ordering of computations which minimizes usage of the memory circuit.

### Claim 14 (depends on 1)

The method of compiling of claim 1, wherein the neural network code is open neural network exchange (ONNX) interchange format code.

### Claim 15

A compiler system for compiling neural network code to a plurality of executable instructions or other into executable code for execution by a computational acceleration system having a first memory circuit and one or more acceleration circuits having a maps data buffer and a kernel data buffer, the compiler system comprising:
a second memory circuit storing the neural network code; and
one or more processors coupled to the second memory circuit, the one or more processors adapted to generate a list of neural network layer model objects from the neural network code; to fuse available functions and layers in the list of neural network layer model objects; to select a cooperative mode, an independent mode, or a combined cooperative and independent mode for code execution by the one or more acceleration circuits; to select a data movement mode and an ordering of computations which reduces usage of the first memory circuit; to generate an ordered sequence of load objects, compute objects, and store objects; and to convert the ordered sequence of load objects, compute objects, and store objects into the plurality of executable instructions.

### Claim 16 (depends on 15)

The compiler system of claim 15, wherein the one or more processors are further adapted to determine first memory circuit usage when kernel data is maintained in a kernel data buffer for a predetermined number of computations with reordering of maps data movement and computations to utilize the selected kernel data which is currently loaded in the kernel data buffer.

### Claim 17 (depends on 15)

The compiler system of claim 15, wherein the one or more processors are further adapted to reorder at least one computation to utilize selected maps data or kernel data which is currently loaded respectively in the maps data buffer or in the kernel data buffer.

### Claim 18 (depends on 15)

The compiler system of claim 15, wherein the one or more processors are further adapted to determine first memory circuit usage when maps data is maintained in the maps data buffer for a predetermined number of computations with reordering of kernel data movement and computations to utilize the selected maps data which is currently loaded in the maps data buffer.

### Claim 19 (depends on 15)

The compiler system of claim 15, wherein the one or more processors are further adapted to determine first memory circuit usage when maps data movement is reordered, kernel data movement is reordered, and computations are reordered to utilize the selected maps data or kernel data which is currently loaded respectively in the maps data buffer or in the kernel data buffer.

### Claim 20 (depends on 15)

The compiler system of claim 15, wherein the one or more processors are further adapted to determine first memory circuit usage when maps data movement is reordered, kernel data movement is reordered, and computations are reordered to utilize one or more rows of the selected maps data or kernel data which is currently loaded respectively in the maps data buffer or in the kernel data buffer.

### Claim 21 (depends on 15)

The compiler system of claim 15, wherein the one or more processors are further adapted to order load objects to provide data pre-fetching; to order the sequence of load objects, compute objects, and store objects to reduce any computational latency; and to pipeline the plurality of executable instructions for execution across a plurality of acceleration circuits and to generate synchronization instructions.

### Claim 22 (depends on 15)

The compiler system of claim 15, wherein the one or more processors are further adapted to determine a maps data size for transferring maps data from the first memory circuit to the maps data buffer and to determine a kernel data size for transferring kernel data from the first memory circuit to the kernel data buffer.

### Claim 23 (depends on 15)

The compiler system of claim 15, wherein the one or more processors are further adapted to merge a plurality of executable instructions into a plurality of instruction banks without branching between banks of the plurality of instruction banks.

### Claim 24 (depends on 15)

The compiler system of claim 15, wherein the one or more processors are further adapted to select the data movement mode and the ordering of computations which minimizes usage of the first memory circuit.

### Claim 25

A method of compiling neural network code to a plurality of executable instructions or other into executable code for execution by a computational acceleration system having a memory circuit and one or more acceleration circuits having a maps data buffer and a kernel data buffer, the method comprising:
using one or more processors, from the neural network code, generating a list of neural network layer model objects;
using the one or more processors, fusing available functions and layers in the list of neural network layer model objects;
using the one or more processors, selecting a cooperative mode, an independent mode, or a combined cooperative and independent mode for code execution by the one or more acceleration circuits;
using the one or more processors, determining memory circuit usage when kernel data is maintained in the kernel data buffer for a predetermined number of computations with reordering of maps data movement and computations to utilize the selected kernel data which is currently loaded in the kernel data buffer;
using the one or more processors, determining memory circuit usage when maps data is maintained in the maps data buffer for a predetermined number of computations with reordering of kernel data movement and computations to utilize the selected maps data which is currently loaded in the maps data buffer;
using the one or more processors, determining memory circuit usage when maps data movement is reordered, kernel data movement is reordered, and computations are reordered to utilize one or more rows of the selected maps data or kernel data which is currently loaded respectively in the maps data buffer or in the kernel data buffer;
using the one or more processors, reordering at least one computation to utilize one or more rows of selected maps data or kernel data which is currently loaded respectively in the maps data buffer or in the kernel data buffer;
using the one or more processors, selecting a data movement mode and an ordering of computations which minimizes usage of the memory circuit;
using the one or more processors, generating an ordered sequence of load objects, compute objects, and store objects;
further ordering the sequence of load objects, compute objects, and store objects to reduce any computational latency and to provide data pre-fetching; and
using the one or more processors, converting the ordered sequence of load objects, compute objects, and store objects into the plurality of executable instructions.
