# US 2021/0342265 A1 · Device and method for allocating intermediate data from an artificial neural network

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

- Number: US 2021/0342265 A1
- Document ID: US20210342265A1
- Status: Published application
- Kind: A1
- Application number: 17/229,161
- Filed: 2021-04-13
- Published: 2021-11-04
- Earliest claimed: 2020-04-30
- Assignees: STMicroelectronics (Rousset) SAS; STMicroelectronics S.r.l.
- Applicants: STMicroelectronics (Rousset) SAS; STMicroelectronics S.r.l.
- Inventors: Laurent Folliot; Emanuele Plebani; Mirko Falchetto
- Web page: https://patentgrep.com/patent/US20210342265A1

## CPC

- G06F 12/0646: {Configuration or reconfiguration}
- G06N 3/063: using electronic means
- G06F 12/0207: {with multidimensional access, e.g. row/column, matrix}
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/045: Combinations of networks
- G06N 3/0499: Feedforward networks
- G06F 2212/1044: Space efficiency improvement
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

According to one aspect, a method for determining, for a memory allocation, placements in a memory area of data blocks generated by a neural network, comprises a development of an initial sequence of placements of blocks, each placement being selected from several possible placements, the initial sequence being defined as a candidate sequence, a development of at least one modified sequence of placements from a replacement of a given placement of the initial sequence by a memorized unselected placement, and, if the planned size of the memory area obtained by this modified sequence is less than that of the memory area of the candidate sequence, then this modified sequence becomes the candidate sequence, the placements of the blocks for the allocation being those of the placement sequence defined as a candidate sequence once each modified sequence has been developed.

## Claims

### Claim 1

A method for determining placements, for a memory allocation in a global memory area, of intermediate data blocks generated by layers of an artificial neural network, the method comprising:
defining several possible placements of the intermediate data blocks of each layer in the global memory area;
developing an initial sequence of placements of the intermediate data blocks of each layer from a first layer to a last layer of the neural network, each placement of the initial sequence being selected from the several possible placements of the intermediate data block to be placed, the initial sequence allowing definition of a planned size of the global memory area, the initial sequence being set as a candidate sequence;
memorizing unselected placements for the intermediate data blocks of each layer;
developing at least one sequence of placements that is modified compared to the initial sequence from a given placement of the initial sequence, the developing comprising modifying the given placement by a memorized unselected placement;
in accordance with the planned size of the global memory area obtained by the modified sequence being less than the planned size of the global memory area of the candidate sequence, setting the modified sequence to be the candidate sequence; and
using the sequence of placements, set as the candidate sequence once each modified sequence has been developed, as the placements of the intermediate data blocks for the memory allocation.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising assigning an order of priority to each possible placement for each intermediate data block, the selection of the placement of each intermediate data block for the developing the initial sequence being carried out according to the order of priority of the placement.

### Claim 3 (depends on 2)

The method according to claim 2, further comprising memorizing the placements not selected for the initial sequence from bottom to top in a stack according to their order of priority for each intermediate data block.

### Claim 4 (depends on 3)

The method according to claim 3, further comprising:
developing each modified sequence so that it maintains the same placements as those of the initial sequence until the placement associated with the same intermediate data block as the placement placed at the top of the stack, the placement of a main sequence being replaced by the placement placed at the top of the stack which is then removed from the stack; and
selecting the placements of the intermediate data blocks of subsequent layers of the modified sequence from the possible placements for these intermediate data blocks, the unselected placements being memorized in the stack.

### Claim 5 (depends on 4)

The method according to claim 4, further comprising developing the modified sequences until the stack is empty.

### Claim 6 (depends on 4)

The method according to claim 4, wherein each placement memorized in the stack is associated with a size of the global memory area that could have been obtained by the placement had it been selected from the possible placements of an intermediate data block.

### Claim 7 (depends on 6)

The method according to claim 6, further comprising:
before each developing of the modified sequence, comparing between the size of the global memory area associated with each placement of the stack and the planned size of the global memory area obtained for the candidate sequence; and
removing from the stack the placements associated with a size of the global memory area greater than the planned size.

### Claim 8 (depends on 6)

The method according to claim 6, further comprising, before each developing of the modified sequence, organizing the placements of the stack associated with the same intermediate data block according to the size of the global memory area associated therewith and according to an order of execution of these placements.

### Claim 9 (depends on 3)

The method according to claim 3 wherein the stack has a limited size.

### Claim 10 (depends on 1)

The method according to claim 1, wherein an area of the global memory area chosen for a placement of an intermediate data block is considered to be freed as soon as the placements of data blocks of all the layers taking as input the intermediate data block placed in the area have been selected.

### Claim 11 (depends on 10)

The method according to claim 10, wherein a defined placement of an intermediate data block comprises placing the intermediate data block in a free area of the global memory area.

### Claim 12 (depends on 1)

The method according to claim 1, wherein a defined placement of an intermediate data block generated by a layer comprises superimposing the intermediate data block on an intermediate data block taken as input of the same layer.

### Claim 13 (depends on 1)

The method according to claim 1, wherein a defined placement of an intermediate data block comprises increasing a memory size of the global memory area to insert the intermediate data block.

### Claim 14

A method for allocating a global memory size, the method comprising:
defining several possible placements of intermediate data blocks, generated by layers of an artificial neural network, in a global memory area;
developing an initial sequence of placements of the intermediate data blocks of each layer from a first layer to a last layer of the neural network, each placement of the initial sequence being selected from the several possible placements of the intermediate data block to be placed, the initial sequence allowing definition of a planned size of the global memory area, the initial sequence being set as a candidate sequence;
memorizing unselected placements for the intermediate data blocks of each layer;
developing at least one sequence of placements that is modified compared to the initial sequence from a given placement of the initial sequence, the developing comprising modifying the given placement by a memorized unselected placement;
in accordance with the planned size of the global memory area obtained by the modified sequence being less than the planned size of the global memory area of the candidate sequence, setting the modified sequence to be the candidate sequence;
using the sequence of placements, set as the candidate sequence once each modified sequence has been developed, as the placements of the intermediate data blocks for the memory allocations;
selecting the global memory size to be equal to the planned size obtained by the candidate sequence; and
allocating the memory according to successive determined placements.

### Claim 15 (depends on 14)

The method according to claim 14, further comprising assigning an order of priority to each possible placement for each intermediate data block, the selection of the placement of each intermediate data block for the developing the initial sequence being carried out according to the order of priority of the placement.

### Claim 16 (depends on 15)

The method according to claim 15, further comprising memorizing the placements not selected for the initial sequence from bottom to top in a stack according to their order of priority for each intermediate data block.

### Claim 17 (depends on 16)

The method according to claim 16, further comprising:
developing each modified sequence so that it maintains the same placements as those of the initial sequence until the placement associated with the same intermediate data block as the placement placed at the top of the stack, the placement of a main sequence being replaced by the placement placed at the top of the stack which is then removed from the stack; and
selecting the placements of the intermediate data blocks of subsequent layers of the modified sequence from the possible placements for these intermediate data blocks, the unselected placements being memorized in the stack.

### Claim 18

An integrated circuit configured to receive a multilayer artificial neural network, the integrated circuit comprising:
a memory configured to memorize intermediate data blocks generated by each of a plurality of layers of the neural network in a global memory area; and
a processing unit coupled to the memory, the processing unit configured to:
define several possible placements of the intermediate data blocks of each layer in the global memory area;
develop an initial sequence of placements of the intermediate data blocks of each layer from a first layer to a last layer of the neural network, each placement of the initial sequence being selected from the several possible placements of the intermediate data block to be placed, the initial sequence allowing definition of a planned size of the global memory area, the initial sequence being set as a candidate sequence;
memorize unselected placements for the intermediate data blocks of each layer;
develop at least one sequence of placements that is modified compared to the initial sequence from a given placement of the initial sequence, the developing comprising modifying the given placement by a memorized unselected placement;
in accordance with the planned size of the global memory area obtained by the modified sequence being less than the planned size of the global memory area of the candidate sequence, set the modified sequence to be the candidate sequence;
use the sequence of placements, set as the candidate sequence once each modified sequence has been developed, as the placements of the intermediate data blocks for in the global memory area; and
during an execution of the neural network:
select a global memory size to be equal to the planned size obtained by the candidate sequence; and
allocate the memory according to successive determined placements.

### Claim 19 (depends on 18)

The integrated circuit according to claim 18, wherein the processing unit is further configured to assign an order of priority to each possible placement for each intermediate data block, the selection of the placement of each intermediate data block for the developing the initial sequence being carried out according to the order of priority of the placement.

### Claim 20 (depends on 19)

The integrated circuit according to claim 19, wherein the memory is further configured to memorize the placements not selected for the initial sequence from bottom to top in a stack according to their order of priority for each intermediate data block.

### Claim 21 (depends on 20)

The integrated circuit according to claim 20, wherein the processing unit is further configured to:
develop each modified sequence so that it maintains the same placements as those of the initial sequence until the placement associated with the same intermediate data block as the placement placed at the top of the stack, the placement of a main sequence being replaced by the placement placed at the top of the stack which is then removed from the stack; and
select the placements of the intermediate data blocks of subsequent layers of the modified sequence from the possible placements for these intermediate data blocks, the unselected placements being memorized in the stack.
