# US 2021/0279557 A1 · Dynamic variable bit width neural processor

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

- Number: US 2021/0279557 A1
- Document ID: US20210279557A1
- Status: Published application
- Kind: A1
- Application number: 16/810,675
- Filed: 2020-03-05
- Published: 2021-09-09
- Earliest claimed: 2020-03-05
- Assignees: Apple Inc.
- Applicants: Apple Inc.
- Inventors: Paolo Di Febbo; Waleed Abdulla; Chaminda N. Vidanagamachchi; Yohan Rajan
- Web page: https://patentgrep.com/patent/US20210279557A1

## CPC

- G06N 3/063: using electronic means
- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/045: Combinations of networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/08: Learning methods
- G06N 3/09: Supervised learning
- G06N 3/048: Activation functions
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Embodiments relate to an electronic device that includes a neural processor having multiple neural engine circuits that operate in multiple modes of different bit width. A neural engine circuit may include a first multiply circuit and a second multiply circuit. The first and second multiply circuits may be combined to work as a part of a combined computation circuit. In a first mode, the first multiply circuit generates first output data of a first bit width by multiplying first input data with a first kernel coefficient. The second multiply circuit generates second output data of the first bit width by multiplying second input data with a second kernel coefficient. In a second mode, the combined computation circuit generates third output data of a second bit width by multiplying third input data with a third kernel coefficient.

## Claims

### Claim 1

A neural processor, comprising:
a buffer circuit configured to store input data; and
a neural engine circuit coupled to the buffer circuit, the neural engine circuit comprising a first multiply circuit and a second multiply circuit, and the neural engine circuit configured to:
receive, in a first mode, first input data and second input data from the buffer circuit,
generate, in the first mode using the first multiply circuit, first output data of a first bit width by multiplying the first input data to a first kernel coefficient,
generate, in the first mode using the second multiply circuit, second output data of the first bit width by multiplying the second input data to a second kernel coefficient,
receive, in the second mode, third input data from the buffer circuit, and
operate, in the second mode, the first multiply circuit with at least the second multiply circuit as a combined computation circuit to generate third output data of the second bit width by multiplying the third input data to a third kernel coefficient.

### Claim 2 (depends on 1)

The neural processor of claim 1, wherein the first and second input data correspond to data of a first layer of a convolutional neural network, and the third input data correspond to data of a second layer of the neural network different from the first layer.

### Claim 3 (depends on 2)

The neural processor of claim 2, wherein the second layer precedes the first layer in the convolutional neural network.

### Claim 4 (depends on 1)

The neural processor of claim 1, wherein the first multiply circuit and the second multiply circuit are configured to generate the first output and the second output in parallel.

### Claim 5 (depends on 1)

The neural processor of claim 1, wherein the first multiply circuit comprises a plurality of adders and a plurality of demultiplexers, at least one of the demultiplexers configured to switch to a first output line in the first mode and switch to a second output line in the second mode.

### Claim 6 (depends on 5)

The neural processor of claim 5, wherein the first output line is an output of the first multiply circuit and the second output line is connected to a downstream adder in the second multiply circuit.

### Claim 7 (depends on 1)

The neural processor of claim 1, wherein the first multiply circuit comprises a first adder and the second multiply circuit comprises a second adder, wherein, in the second mode, the first adder is configured to compute one of least significant bits of the third output data and the second adder is configured to compute one of most significant bits of the third output data.

### Claim 8 (depends on 1)

The neural processor of claim 1, wherein the neural engine circuit is further configured to operate at a third bit width in a third mode.

### Claim 9 (depends on 1)

The neural processor of claim 1, wherein the combined computation circuit comprises a first set of input lines coupled to the first multiply circuit and a second set of input lines coupled to the second multiply circuit, wherein, in the first mode, the first set of input lines is configured to receive the first input data and the second set of input lines is configured to receive the second input data, and wherein, in the second mode, the first set of input lines is configured to receive least significant bits of the third input data and the second set of input lines is configured to receive most significant bits of the third input data.

### Claim 10 (depends on 1)

The neural processor of claim 1, wherein the first kernel coefficient and the second kernel coefficient have the same value.

### Claim 11 (depends on 1)

The neural processor of claim 1, wherein the neural processor is configured to determine a mode of the neural engine circuit based on an instruction included in code associated with a convolutional neural network.

### Claim 12 (depends on 1)

The neural processor of claim 1, wherein the neural processor is configured to automatically determine a selection of bit width.

### Claim 13

A method for operating a neural processor, the method comprising:
generating, by a first multiply circuit of a neural engine circuit operating a first mode, first output data of a first bit width by multiplying the first input data to a first kernel coefficient;
generating, by a second multiply circuit of the neural engine circuit operating in the first mode, second output data of the first bit width by multiplying the second input data to a second kernel coefficient; and
by the first circuit and the second circuit operating as a part of a combined computation circuit, third output data of a second bit width by multiplying the third input data with a third kernel coefficient.

### Claim 14 (depends on 13)

The method of claim 13, wherein the first and second input data correspond to data of a first layer of a convolutional neural network, and the third input data correspond to data of a second layer of the neural network different from the first layer.

### Claim 15 (depends on 14)

The method of claim 14, wherein the second layer precedes the first layer in the convolutional neural network.

### Claim 16 (depends on 14)

The method of claim 14, further comprising:
receiving, from code associated with a convolutional neural network, a first instruction to perform calculation of the first layer in the convolutional neural network using the first bit width;
causing, based on the first instruction, the neural engine circuit in the first mode;
receiving, from the code associated with the convolutional neural network, a second instruction to perform calculation of the second layer in the convolutional neural network using the second bit width; and
causing, based on the second instruction, the neural engine circuit in the second mode.

### Claim 17

An electronic device, comprising:
a memory storing a first set of instructions associated with a machine learning model;
a neural processor, comprising:
a buffer circuit configured to store input data associated with the machine learning model; and
a neural engine circuit coupled to the buffer circuit, the neural engine circuit comprising a first multiply circuit and a second multiply circuit, and the neural engine circuit configured to:
receive, in a first mode, first input data and second input data from the buffer circuit,
generate, in the first mode using the first multiply circuit, first output data of a first bit width by multiplying the first input data to a first kernel coefficient,
generate, in the first mode using the second multiply circuit, second output data of the first bit width by multiplying the second input data to a second kernel coefficient,
receive, in the second mode, third input data from the buffer circuit, and
operate, in the second mode, the first multiply circuit with at least the second multiply circuit as a combined computation circuit to generate third output data of the second bit width by multiplying the third input data to a third kernel coefficient.

### Claim 18 (depends on 17)

The electronic device of claim 17, wherein the first set of instructions specifies that data of a first layer in the machine learning model is to be computed at the first bit width and data of a second layer in the machine learning model is to be computed at the second bit width, and wherein the first and second input data correspond to the data of the first layer, and the third input data corresponds to the data of the second layer.

### Claim 19 (depends on 17)

The electronic device of claim 17, further comprises a compiler processor, the compiler processor configured to:
compile the first set of instructions into a second set of instructions that provide commands to the neural processor, wherein the compiling comprises:
generating a first command specifying the neural engine circuit to be operated in the first mode to process the first and second input data, and
generating a second command specifying the neural engine circuit to be operated in the second mode to process the third input data.

### Claim 20 (depends on 19)

The electronic device of claim 19, the neural engine circuit comprises a plurality of adders and a plurality of demultiplexers, at least one of the demultiplexers comprising a first output line and a second output line, the at least one of the demultiplexers configured to:
receive, in the first mode, the first command,
switch to the first output line based on the first command,
receive, in the second mode, the second command, and
switch to the second output line based on the second command.
