# US 2019/0244096 A1 · Memory management for machine learning training on gpu

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

- Number: US 2019/0244096 A1
- Document ID: US20190244096A1
- Status: Published application
- Kind: A1
- Application number: 15/948,706
- Filed: 2018-04-09
- Published: 2019-08-08
- Earliest claimed: 2018-02-02
- Assignees: Samsung Electronics Co., Ltd.
- Applicants: Samsung Electronics Co., Ltd.
- Inventors: Joo Hwan Lee; Yang Seok Ki
- Web page: https://patentgrep.com/patent/US20190244096A1

## CPC

- G06N 3/08: Learning methods
- G06F 3/0604: {Improving or facilitating administration, e.g. storage management}
- G06F 3/0638: {Organizing or formatting or addressing of data}
- G06F 3/0683: {Plurality of storage devices}
- G06N 3/0499: Feedforward networks
- G06N 3/063: using electronic means
- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06T 1/20: Processor architectures; Processor configuration, e.g. pipelining
- G06T 1/60: Memory management
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL

## Abstract

A system and method for memory management. In one embodiment, the method includes generating a dependency structure comprising one or more task identifiers and one or more data object identifiers. The dependency structure includes a list of one or more dependencies for a first data object identifier of the one or more data object identifiers, a first dependency of the list identifying a first task for which a data object identified by the first data object identifier is an input. The method further includes counting the number of dependencies for the first data object identifier, decrementing the count by one when the first task completes execution, and, when the count reaches zero, deallocating the first data object.

## Claims

### Claim 1

A method for memory management, comprising:
generating a dependency structure comprising one or more task identifiers and one or more data object identifiers, the dependency structure including a list of one or more dependencies for a first data object identifier of the one or more data object identifiers, a first dependency of the list identifying a first task for which a first data object identified by the first data object identifier is an input;
determining a count, the count being a number of dependencies for the first data object identifier;
determining that the first task completed execution;
decrementing the count by one based at least in part on determining that the first task completed execution;
determining that the count is less than a first threshold; and
deallocating the first data object based at least in part on determining that the count is less than the first threshold.

### Claim 2 (depends on 1)

The method of claim 1, wherein the first threshold is one.

### Claim 3 (depends on 1)

The method of claim 1, further comprising determining a number of dependencies associated with the first task.

### Claim 4 (depends on 1)

The method of claim 1, wherein the first task is a compute operation in a first layer of a neural network.

### Claim 5 (depends on 4)

The method of claim 4, wherein the first data object is an activation in the first layer.

### Claim 6 (depends on 5)

The method of claim 5, wherein the first task comprises, during a backward pass:
computing a gradient in the activation; and
computing a gradient in a weight.

### Claim 7 (depends on 4)

The method of claim 4, wherein the first data object is a gradient for input in the first layer.

### Claim 8 (depends on 7)

The method of claim 7, wherein the first task comprises, during a backward pass:
computing a gradient in an activation; and
computing a gradient in a weight.

### Claim 9 (depends on 4)

The method of claim 4, wherein the first data object is a gradient for weight in the first layer.

### Claim 10 (depends on 9)

The method of claim 9, wherein the first task comprises performing an in-place update of a weight corresponding to the gradient for weight.

### Claim 11 (depends on 1)

The method of claim 1, further comprising:
generating a list of zero or more pass-persistent data object identifiers, a first pass-persistent data object identifier identifying a first data object in a neural network;
determining that a backward pass is completed; and
deallocating the first data object based on determining that the backward pass is completed.

### Claim 12 (depends on 11)

The method of claim 11, wherein the first data object is an activation for a first layer of a neural network.

### Claim 13 (depends on 1)

The method of claim 1, further comprising:
generating a list of zero or more training-persistent data object identifiers, a first pass-persistent data object identifier identifying a first data object in a neural network,
determining that training of the neural network is completed, and
deallocating the first data object based on determining that training of the neural network is completed.

### Claim 14 (depends on 13)

The method of claim 13, wherein the first data object is a weight in a first layer of a neural network.

### Claim 15

A system for machine learning, the system comprising:
a graphics processing unit, and
a memory connected to the graphics processing unit,
the graphics processing unit being configured to:
invoke a no reuse detector; and
launch a graphics processing unit kernel, after invoking the no reuse detector, the no reuse detector being configured to:
identify a first data object having a persistence defined at least by one or more tasks for which the data object is an input;
generate a dependency structure including:
a first data object identifier identifying the first data object, and
a first task, of the one or more tasks for which the data object is an input;
determine a count, the count being a number of dependencies for the first data object identifier;
determine that the first task completed execution;
decrement the count by one based at least in part on determining that the first task completed execution;
determine that the count is less than a first threshold; and
deallocate the first data object based at least in part on determining that the count is less than the first threshold.

### Claim 16 (depends on 15)

The system of claim 15, wherein the first threshold is one.

### Claim 17 (depends on 15)

The system of claim 15, wherein the first task is a compute operation in a first layer of a neural network.

### Claim 18 (depends on 17)

The system of claim 17, wherein the first data object is an activation in the first layer.

### Claim 19 (depends on 18)

The system of claim 18, wherein the first task comprises, during a backward pass:
computing a gradient in the activation; and
computing a gradient in a weight.

### Claim 20

A method for machine learning, the method comprising:
allocating memory for a first data object in a neural network;
determining that the first data object has a persistence defined at least by one or more tasks for which the first data object is an input;
determining that a last one of the one or more tasks for which the first data object is an input has completed execution;
deallocating the first data object based on determining that the last one of the one or more tasks for which the first data object is an input has completed execution, and based on determining that the first data object has a persistence defined at least by one or more tasks for which the first data object is an input.

### Claim 21 (depends on 20)

The method of claim 20, further comprising allocating memory for a second data object in the neural network;
determining that the second data object has a persistence defined by completion of a backward pass; and
deallocating the second data object at a completion of the backward pass, based on determining that the second data object has a persistence defined by the completion of the backward pass.

### Claim 22 (depends on 21)

The method of claim 21, further comprising allocating memory for a third data object in the neural network;
determining that the second data object has a persistence defined by completion of training of the neural network; and
deallocating the second data object at a completion of training of the neural network, based on determining that the second data object has a persistence defined by completion of training of the neural network.
