IP Library Granted Patent US 12,093,791
Granted Patent B2
US 12,093,791 · App. 16/854,868 · Granted Sep 17, 2024

Partitioning for an execution pipeline

Inventors: Ryota Tomioka (Cambridge, GB); Juliana Patrícia Vicente Franco (Cambridge, GB); Alberto Magni (Cambridge, GB); Nuno Claudino Pereira Lopes (Cambridge, GB); Siddharth Krishna (Cambridge, GB); Renato Golin (Cambridge, GB)
Assignee: Microsoft Technology Licensing, LLC
G06N20/00G06F9/3867
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,093,791
App. No.
16/854,868
Granted
Sep 17, 2024
Kind
B2
Abstract

A computation graph of a machine learning model is accessed from memory and a constraint solver is used to compute a partition of the computation graph into ordered stages of an execution pipeline. In use, when inference or training of the machine learning model takes place by executing the pipeline, execution cost of the stages are balanced according to the computed partition.

Claims (49)

1. A computer-implemented method comprising:

accessing a computation graph of a machine learning model from memory, the computation graph comprising a plurality of vertices connected by edges, wherein the vertices represent operations of the machine learning model and the edges represent communication between operations of the machine learning model;

generating, using the vertices and edges of the computation graph, a constraint for the computation graph, wherein the constraint comprises at least one of:

for any edge in the graph, an origin of the edge is either assigned to the same stage as a destination or is assigned to an earlier stage than the destination,

for a weight of the machine learning model, vertices which use the weight are assigned to the same stage, or

if one of the vertices is known not to require any space for code, it is assignable to the same stage as another of the vertices which consumes or produces the one of the vertices; and

computing, using the constraint, a partition of the computation graph that includes graph partitions of serially ordered stages of an execution pipeline, wherein computing the partition comprises computing execution costs of the stages, and wherein computing the partition comprises computing the graph partitions using an allocation of the stages to machines on which the execution pipeline is deployed.

2. The computer-implemented method of claim 1 further comprising computing a revision to the computation graph before using the computation graph to compute the partition, such that in use, the method is scalable to a large scale machine learning model, and wherein computing the revision comprises one or more of: serialization of operations which require more than a threshold amount of memory, recomputation, stashing of activations to external memory, and stashing of weights to external memory.

3. The computer-implemented method of claim 1 wherein computing the partition comprises assigning individual ones of the vertices to only one of the stages.

4. The computer-implemented method of claim 1 wherein computing the partition comprises computing the partition such that the execution costs comprising one or more of: execution cycles, execution time, energy use, are balanced between individual ones of the stages.

5. The computer-implemented method of claim 4 wherein computing the execution costs of the stages comprises computing one or more of: a sum of individual execution cost of operations assigned to a machine which hosts the stage, an execution of sending and receiving messages in the machine which hosts the stage, an execution cost of stashing and reloading tensors in the machine which hosts the stage.

6. The computer-implemented method of claim 1 wherein the constraint comprises one or more of the following correctness constraints: any vertex of the graph is assigned to one and only one stage, the memory required by operations of a stage fits in memory capacity of a machine hosting the stage.

7. The computer-implemented method of claim 1 wherein generating the constraint comprises generating a memory constraint whereby the memory required by operations of a stage fit in memory capacity of a machine hosting the stage, further comprising computing the memory capacity using one or more of:

code size of operations assigned to the machine;

size of tensors representing weights assigned to the machine;

size of messages that live throughout execution of the stages;

an amount of temporary memory live throughout execution of the stages; or

size of data to be stashed in the machine during execution of the stages.

8. The computer-implemented method of claim 1 wherein where the execution is to train the machine learning model, vertices representing operations in a forward pass of the training are assigned to stages labelled as forward while vertices representing operations in a backward pass of the training are assigned to stages labelled as backward.

9. The computer-implemented method of claim 1 wherein computing the partition comprises computing the partition such that the execution costs are balanced between individual ones of the stages and that data parallelism is implemented, whereby data is processed in parallel by individual ones of the graph partitions.

10. The computer-implemented method of claim 1 further comprising carrying out inference or training of the machine learning model by executing the pipeline.

11. The computer-implemented method of claim 1 wherein computing the partition comprises computing the partition such that the execution costs are balanced between individual ones of the stages during a steady state of the execution pipeline.

12. The computer-implemented method of claim 1 , wherein at least one of the ordered stages comprises at least two subgraphs of the computation graph that are executed in parallel.

13. The computer-implemented method of claim 1 , wherein computing the partition of the computation graph comprises computing one of the graph partitions per stage.

14. The computer-implemented method of claim 1 , wherein an output of each but a final stage of the serially ordered stages of the execution pipeline is an input to another stage of the serially ordered stages.

15. The computer-implemented method of claim 1 , wherein generating the constraint comprises computing the constraint using pipeline information comprising one or more of: a number of the stages of the execution pipeline, a number of machines on which the execution pipeline is deployed, a memory capacity of one or more machines on which the execution pipeline is deployed.

16. The computer-implemented method of claim 1 , further comprising carrying out inference or training of the machine learning model by executing the execution pipeline such that the execution costs of the stages are balanced according to the computed partition.

17. A machine comprising:

a memory storing a machine learning model;

a constraint generator which generates a constraint for a computation graph of the machine learning model using vertices and edges of the computation graph, wherein the vertices represent operations of the machine learning model and the edges represent communication between operations of the machine learning model, wherein the constraint comprises at least one of:

for any edge in the graph, an origin of the edge is either assigned to the same stage as a destination or is assigned to an earlier stage than the destination,

for a weight of the machine learning model, vertices which use the weight are assigned to the same stage, or

if one of the vertices is known not to require any space for code, it is assignable to the same stage as another of the vertices which consumes or produces the one of the vertices; and

a constraint solver which uses the constraint to compute a partition of the computation graph that includes graph partitions of serially ordered stages of an execution pipeline, wherein computing the partition comprises computing execution costs of the stages, and wherein computing the partition comprises computing the graph partitions using an allocation of the stages to machines on which the execution pipeline is deployed.

18. An apparatus comprising:

an execution pipeline comprising ordered stages hosted on a machine,

each of the stages comprising a graph partition of a computation graph of a machine learning model, the computation graph comprising vertices connected by edges, wherein the vertices represent operations of the machine learning model and the edges represent communication between operations of the machine learning model; and

a constraint solver configured to:

compute the graph partitions using a constraint, wherein computing the graph partitions comprises computing execution costs of the stages, wherein the graph partitions are computed using an allocation of the stages to machines on which the execution pipeline is deployed, and wherein the constraint comprises at least one of:

for any edge in the graph, an origin of the edge is either assigned to the same stage as a destination or is assigned to an earlier stage than the destination,

for a weight of the machine learning model, vertices which use the weight are assigned to the same stage, or

if one of the vertices is known not to require any space for code, it is assignable to the same stage as another of the vertices which consumes or produces the one of the vertices; and

send the partitions to the stages.

19. The apparatus of claim 18 wherein a constraint generator is configured to call the following functions in order to generate the constraint for use by the constraint solver:

load(v), which returns a computational load of executing a vertex v;

storeAndLoad(v), which returns a number of cycles it takes to store and load an output of vertex v;

static(v), which returns a number of bytes that a vertex v occupies in memory throughout the whole execution of the machine learning model; and

tensor(v), which returns a number of bytes that output of a vertex v occupies in memory.

20. The apparatus of claim 18 wherein the constraint solver is configured to compute the execution costs by computing at least one of: an execution cost of sending and receiving messages in a machine which hosts a stage of the stages, or an execution cost of stashing and reloading tensors in the machine which hosts the stage.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 21, 2020
From: TOMIOKA, RYOTA; VICENTE FRANCO, JULIANA PATRÍCIA; MAGNI, ALBERTO; CLAUDINO PEREIRA LOPES, NUNO; KRISHNA, SIDDHARTH; GOLIN, RENATO
To: MICROSOFT TECHNOLOGY LICENSING, LLC
Reel/Frame 052458/0513 →
Continuity (1)
Related Publication 20210304066A1 · Sep 30, 2021