# US 2022/0019531 A1 · Allocating Variables to Computer Memory

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

- Number: US 2022/0019531 A1
- Document ID: US20220019531A1
- Status: Published application
- Kind: A1
- Application number: 17/110,834
- Filed: 2020-12-03
- Published: 2022-01-20
- Earliest claimed: 2020-07-14
- Assignees: Graphcore Limited
- Applicants: Graphcore Limited
- Inventors: Godfrey DA COSTA; Timothy David HUTT
- Web page: https://patentgrep.com/patent/US20220019531A1

## CPC

- G06F 8/45: {Exploiting coarse grain parallelism in compilation, i.e. parallelism between groups of instructions}
- G06F 8/441: {Register allocation; Assignment of physical memory space to logical memory space}
- G06F 8/4434: {Reducing the memory space required by the program code}
- G06F 8/445: {Exploiting fine grain parallelism, i.e. parallelism at instruction level (run-time instruction scheduling G06F9/3836)}
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/063: using electronic means
- 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 allocating variables to computer memory includes determining at compile time when each of the plurality of variables is live in a memory region and allocating a memory region to each variable wherein at least some variables are allocated at compile time to overlapping memory regions to be stored in those memory regions at runtime at non-overlapping times.

## Claims

### Claim 1

A method of allocating a plurality of variables to computer memory having a plurality of memory regions, the method comprising:
determining at compile time when each of the plurality of variables is live in a given memory region; and
allocating ones of the memory regions to the variables, wherein at least some of the variables are allocated at compile time to overlapping memory regions to be stored in the overlapping memory regions at runtime at non-overlapping times.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising:
storing code on a computer comprising multiple processing units, the code comprising for at least some of the processing units an executable code sequence which causes a variable received at the processing unit to be stored in its allocated memory region.

### Claim 3 (depends on 2)

The method according to claim 2, wherein each processing unit has a local memory configured to store one or more variables and the at least one executable code sequence and an execution stage for executing the at least one executable code sequence stored in the local memory.

### Claim 4 (depends on 3)

The method according to claim 3, further comprising:
identifying at least one of the multiple processing units of the computer as a master processing unit;
compiling executable code sequences for loading into the processing units of the computer, the compiling including allocating at least one shared structure to the master processing unit, the shared structure comprising one or more variable; and
storing the at least once shared structure in the local memory of the master processing unit, and storing in the local memory a transmitting exchange code sequence designated to be executed in the execution stage of the master processing unit at a time point determined at compile time and causing the master processing unit to generate a message comprising the shared structure to be transmitted for reception by at least one other processing unit.

### Claim 5 (depends on 1)

The method according to claim 1, comprising
determining at compile time a residence time for each variable in its allocated memory region by determining a first time point at which the variable is written to its allocated memory region and a second time point at which it is output from its allocated memory region.

### Claim 6 (depends on 1)

The method according to claim 1, comprising
resolving address constraints of the variables when allocating the variables to the memory regions.

### Claim 7 (depends on 4)

The method according to claim 4, comprising
storing in the local memory of the at least one other processing unit a receive exchange code sequence designated to be executed in the execution stage of the at least one other processing unit, the receiving exchange code sequence causing the at least one other processing unit to store the variable received in the message at the allocated address in the local memory of the at least one other processing unit.

### Claim 8 (depends on 1)

The method according to claim 1, wherein a memory region takes the form of a contiguous set of memory addresses.

### Claim 9 (depends on 1)

The method according to claim 1, wherein at least some variables wholly overlap in the memory region.

### Claim 10 (depends on 1)

The method according to claim 1, wherein at least some variables partially overlap in the memory region.

### Claim 11 (depends on 1)

The method according to claim 1, wherein the variables are of different sizes.

### Claim 12 (depends on 1)

The method according to claim 1, wherein the variables are the same size.

### Claim 13 (depends on 1)

The method according to claim 1, wherein a second variable received at the least another processing unit and allocated to a partially overlapping or wholly overlapping memory region overwrites part or all of a first variable in that memory region.

### Claim 14

A computer comprising:
a first processing unit and a second processing unit, the first processing unit having a first local memory configured to store read only elements including executable code sequences, and a first execution stage for executing at least some of the executable code sequences stored in the first local memory, wherein the first processing unit comprises a master processing unit,
wherein the first local memory is configured to store a first shareable read only element which is designated to be used by a second execution stage of the second processing unit, and a transmitting exchange code sequence designated to be executed at the first execution stage and which causes the master processing unit to identify the first shareable read only element and to generate a message to be transmitted for reception by the second processing unit,
wherein the second processing unit has stored in a second local memory a receiving exchange code sequence which causes the second processing unit to receive the first shareable read only element from the message and to store the first shareable read only element at an address in the second local memory for a usage period, the second processing unit being configured to delete the first shareable read only element from the second local memory after the usage period, wherein the first shareable read only element and at least some shareable read only elements have been allocated at compile time to overlapping memory regions in the second local memory to be stored in the overlapping memory regions at runtime at non-overlapping times.

### Claim 15

A computer comprising:
a compiler configured to determine at compile time when each of a plurality of variables is live in a respective memory region of a processing unit, and to allocate at compile time memory regions to the variables, wherein at least some variables are allocated to overlapping memory regions to be stored in the overlapping memory regions at runtime at non-overlapping times.

### Claim 16

A computer program embodied on computer-readable storage and configured to run on one or more processors, the program comprising executable code configured so as, when executed, to perform a compiling method, the method comprising:
determining at compile time when a plurality of variables are live in memory regions of a processing unit; and
allocating the memory regions to the variables, wherein at least some variables are allocated at compile time to overlapping memory regions to be stored in the overlapping memory regions at runtime at non-overlapping times.

### Claim 17 (depends on 14)

The computer of claim 14, wherein the first shareable read only element comprises a variable.

### Claim 18 (depends on 14)

The computer of claim 14, wherein the overlapping memory regions are part of a plurality of memory regions including a contiguous set of memory addresses.

### Claim 19 (depends on 14)

The computer of claim 14, wherein the at least some shareable read only elements wholly overlap in the memory region.

### Claim 20 (depends on 14)

The computer of claim 14, wherein the at least some shareable read only elements partially overlap in the memory region.

### Claim 21 (depends on 14)

The computer of claim 14, wherein the at least some shareable read only elements are of different sizes.

### Claim 22 (depends on 14)

The computer of claim 14, wherein the at least some shareable read only elements are a same size.

### Claim 23 (depends on 15)

The computer of claim 15, wherein the at least some variables wholly overlap in the memory regions.

### Claim 24 (depends on 15)

The computer of claim 15, wherein the at least some variables partially overlap in the memory regions.

### Claim 25 (depends on 15)

The computer of claim 15, wherein the at least some variables are of different sizes.

### Claim 26 (depends on 15)

The computer of claim 15, wherein the at least some variables are a same size.

### Claim 27 (depends on 16)

The computer program of claim 16, wherein the at least some variables wholly overlap in the memory regions.

### Claim 28 (depends on 16)

The computer program of claim 16, wherein the at least some variables partially overlap in the memory regions.
