Aiming at the division of execution pipeline
By using a constraint solver to automatically partition the computational graph, the inefficiency problem in the prior art is solved, achieving efficient partitioning of the computational graph and improving hardware utilization, thereby enhancing the performance of the execution pipeline.
Patent Information
- Application Number
- CN202180025979.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-04-21
- Filing Date
- 2021-02-22
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2041-02-22
AI Technical Summary
Existing technologies are inefficient in partitioning the computation graph of the execution pipeline. Manual partitioning is complex and error-prone, making it difficult to achieve a uniform distribution of computational load, resulting in low hardware utilization.
The constraint solver automatically partitions the computation graph, balancing the execution costs of each stage of the execution pipeline by encoding multiple factors as constraints, including memory usage, communication costs, and computational load, and optimizing the allocation of the computation graph to achieve efficient hardware utilization.
It enables efficient partitioning of the computation graph on the actual time scale, improves the efficiency of the execution pipeline and hardware utilization, reduces the computational load on the slowest machine, and improves overall computing performance.
Smart Images

Figure CN115362447B_ABST
Abstract
Description
Background Technology
[0001] Execution pipelining is widely used in computer science for efficient computation where large amounts of data need to be processed and scalability is required; that is, to enable computation to be performed on real-world timescales where the amount of data to be processed and / or the execution cost is expected to be very large. Computer vision, robotics, intelligent sensing and control, and machine learning are non-limiting examples of computational applications that utilize pipelining.
[0002] An execution pipeline consists of multiple ordered stages, each a computational process executed on one or more machines. Typically, the machines communicate with each other via a network, enabling distributed computing for scalability. These stages are ordered because, according to the order of the stages in a serial process, the output of one stage is the input of another. Execution pipelines provide scalability through the use of parallelization, as different stages can process different parts of the process simultaneously. That is, the first stage may have already processed the first batch of data and provided its output to the second stage. The second stage processes the information it received from the first stage, while the first stage processes the second batch of data.
[0003] When using execution pipelines, the code of a process executed by the pipeline is divided among the various stages of the execution pipeline. Typically, this division is calculated manually, which is time-consuming. Manually calculated divisions often lead to inefficiency.
[0004] The embodiments described below are not limited to implementations that address any or all the drawbacks of known processes that divide data and / or code into stages of execution pipelines. Summary of the Invention
[0005] The summary of this disclosure is provided to give the reader a basic understanding. This summary is not intended to identify key or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. Its sole purpose is to present the selection of concepts disclosed herein in a simplified form as a prelude to the more detailed description that follows.
[0006] In various examples, there exists a computer-implemented method. The computational graph of the machine learning model is accessed from memory, and a constraint solver is used to compute the partitions of the computational graph into ordered stages of an execution pipeline. In practice, when the machine learning model is inferred or trained via the execution pipeline, the execution cost of the stages is balanced according to the computed partitions.
[0007] The numerous accompanying features will be better understood and thus more readily apparent by referring to the following detailed description in conjunction with the accompanying drawings. Attached Figure Description
[0008] This description will be better understood by reading the following detailed description in conjunction with the accompanying drawings, in which: Figure 1 This is a schematic diagram of an execution pipeline deployed as a cloud service; Figure 2 It is a schematic diagram of multiple machines and stages that execute the pipeline; Figure 3 This is a schematic diagram of the input and output of the constraint solver; Figure 4 This is a schematic diagram of an execution pipeline with 8 levels; Figure 5 This is a schematic diagram of a parallelized execution pipeline; Figure 6 It is a schematic diagram of the elements of a two-dimensional table for each of the two constraints and for any vertex; Figure 7 This is a diagram showing how to divide 8 machines into 2 groups of size 4, or into 4 groups of size 2; Figure 8 It compares sequential execution levels with parallel execution levels for computation graphs that include data-independent subgraphs. Figure 9 The illustration shows an exemplary computing-based device in which an embodiment of a machine that implements a control node or pipeline is shown.
[0009] In the accompanying drawings, the same reference numerals are used to denote the same parts. Detailed Implementation
[0010] The detailed description provided below, in conjunction with the accompanying drawings, is intended to describe this example and is not intended to represent the only form of constructing or utilizing this example. This description illustrates the functionality of the example and the order of operations used to construct and operate the example. However, the same or equivalent functionality and order can be implemented through different examples.
[0011] A computational graph representing a machine learning model consists of multiple vertices connected by edges. Each vertex represents an operation of the machine learning model, and each edge represents communication between two operations.
[0012] The techniques described in this paper can be used in any machine learning model that can be represented using a computational graph. A non-exhaustive list of suitable examples of machine learning models includes: convolutional neural networks, recurrent neural networks, generative adversarial networks, variational autoencoders, random decision forests, and encoder-decoder models based on bidirectional transformers.
[0013] Figure 1This is a schematic diagram of the execution pipeline 104 deployed as a cloud service and the constraint solver 106 deployed as a cloud service. In some cases, the execution pipeline is deployed in end-user devices, such as smartphones with multi-core central processing units and graph processing units (see [link to documentation]). Figure 1 114) or desktop computer (see Figure 1 (118), which has multiple graph processing units and / or artificial intelligence accelerators. Execution pipeline 104 will refer to... Figure 2 A more detailed description is provided, which includes multiple ordered stages. Each stage executes a process of inference using a machine learning model or is part of the process of training a machine learning model. In some examples, the hybrid process between machine learning inference and training is also performed by execution pipeline 104. By using execution pipelines, scalability can be achieved for factors including one or more of the following: the number of parameters of the machine learning model, the amount of training data to be used. Execution pipelines provide scalability because they are deployed across multiple machines and leverage parallelization. Parallelization is model parallelization, which means that the computation graph 122 of the machine learning model is divided into partitions and each partition is executed in a different stage of the execution pipeline. In some examples, data parallelization is also used in conjunction with model parallelization. Data parallelization involves dividing data into batches and processing those batches in parallel. However, using data parallelization is not mandatory.
[0014] For example, the limited amount of memory available in modern machines, such as graph processing units (GPUs) and artificial intelligence accelerators, is often insufficient to accommodate large computational graphs corresponding to, for example, state-of-the-art artificial neural network models. One option is to shard (or partition) the computational graph across different machines, i.e., to divide the computation across different machines. However, doing this manually is a complex and tedious task: different types of computational graphs require different sharding strategies; developers designing these computational graphs need to be familiar with the underlying architecture of the machines they are using; each individual operation may need to be annotated with some machine identifier; and finally, developers may need to iterate more than once until they find a sharding strategy with acceptable performance.
[0015] Manually partitioning the computation graph 122 is time-consuming and error-prone. This leads to inefficiency because the computational load is typically uneven across the stages of the execution pipeline 104. Finding a method for automatically partitioning the computation graph 122 is not directly scalable.
[0016] One option is to use dynamic programming to automatically partition the computational graph. Dynamic programming may seem like a scalable approach at first glance, but it is inefficient because it explores most of the search space and computes dense matrices. To improve hardware utilization, it might be necessary to combine dynamic programming with a scheduler. However, adding a scheduler increases complexity and hinders scalability.
[0017] Another option is to use reinforcement learning, where a sequence-to-sequence model is used to propose partitions for a given computation graph. Multiple proposals are generated using the sequence-to-sequence model, and these proposals are executed on hardware to empirically determine the execution time. The execution time is used as a reward function to train the sequence-to-sequence model using reinforcement learning. However, sequence-to-sequence models cannot scale to computation graphs with thousands of nodes.
[0018] In this disclosure, it is recognized that constraint solver 106 can be used to partition computation graph 122 into stages of execution pipeline 104. This recognition is made despite the fact that constraint solvers are generally time-consuming because they search a vast search space to find solutions and use constraints to limit the search space to find those solutions. It has been unexpectedly discovered that partitioning the computation graph of a machine learning model using a constraint solver is feasible on a practical time scale. Furthermore, partitioning the computation graph of a machine learning model using a constraint solver allows multiple factors to be taken into account by encoding multiple factors into the constraints of the constraint solver. In this way, it is possible to partition computation graph 122 into execution pipeline stages, thereby taking into account the execution costs of deploying multiple machines in the execution pipeline 104 and achieving efficiency. The term "execution cost" is used to refer to any one or more of the following: execution cycle, execution time, energy usage.
[0019] Constraint solvers are more flexible than dynamic programming, and it's easier to encode less common constraints using constraint solvers. Constraint solvers have several optimizations that allow them to ignore most of the search space, whereas dynamic programming-based methods require traversing most of the search space and computing dense matrices. In the deployment described here, the ability to use simplifications in the constraint solver is almost a luxury due to the very low error tolerance regarding memory.
[0020] The constraint generator 107 is used to calculate the constraints to be used by the constraint solver 106. The constraint generator 107 takes the calculation diagram 122 as input.
[0021] In one example, an execution pipeline 104 is deployed to process training data 102 accessed via a communication network 100 and train a machine learning model. The training data 102 includes labeled data instances, such as images, graph representations of molecules, speech signals, text, sensor data, knowledge graphs, or other types of data instances.
[0022] In some examples, execution pipeline 104 is deployed to perform inference using a machine learning model. It receives test data instances from a source via communication network 100 (e.g., end-user devices 114, 116, 118, 120), computes inference using the execution pipeline, and sends the inference results back to the appropriate end-user device.
[0023] In some examples, pipeline 104 is executed to train a machine learning model, which is then instantiated at one or more of end-user devices 114, 116, 118, and 120. Once the machine learning model has been instantiated at the end-user device, the end-user device is able to perform inference locally. Figure 1 An instantiation of machine learning model 108 at end user device 114 is shown. The end user device has processor 110 and memory 112 and is capable of performing inference using the trained machine learning model at end user device 114, such as providing candidate text items in a predictive keyboard in a chat application.
[0024] As mentioned above, in some cases, the execution pipeline is deployed at the end-user device, where inference and / or training of the machine learning model are performed.
[0025] The constraint solver of this disclosure operates in an unconventional manner to achieve efficient execution of the execution pipeline of this disclosure by enabling control over the relative execution costs of each stage of the execution pipeline.
[0026] Constraint solvers improve the functionality of underlying computing devices, at least by being able to control the relative execution costs of stages in the execution pipeline.
[0027] Practical applications of execution pipelines and constraint solvers include using machine learning models to perform tasks such as identifying objects depicted in videos or images, lip reading, medical image analysis, operating autonomous vehicles, controlling home heating systems, controlling telecommunications networks, detecting anomalies in communication networks, and many other tasks using machine learning models. Practical applications of execution pipelines also include training machine learning models to perform any of the above practical tasks, as well as other practical tasks performed by machine learning models.
[0028] Alternatively or additionally, the constraint solver and / or pipeline functionality described herein is performed at least in part by one or more hardware logic components. For example, but not limited to, illustrative types of optional hardware logic components include field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), graph processing units (GPUs), and machine learning accelerators.
[0029] Figure 2 Such as Figure 1A more detailed schematic diagram of the execution pipeline is provided. Multiple machines M1 to M6 are connected to each other via communication link 206 and also to control node 200. The control node is connected to constraint solver 208. Constraint solver 208 receives constraints computed by constraint generator 207 as input. Constraint generator 207 takes a computation graph 122 representing a machine learning model as input. The constraint generator can also access information about the machines. In the example of training a machine learning model, control node 200 communicates with storage 202 for training data. The control node receives a partition of computation graph 122 from constraint solver 208 and runs the computations specified in the computation graph on the machines in the execution pipeline according to the partition.
[0030] A machine is any computing device, such as a graph processing unit, a machine learning accelerator, a central processing unit, a single core of a central processing unit, a trusted execution environment, a virtual machine, or any computing node.
[0031] exist Figure 2 The example has 6 machines, but there could be other numbers of machines. Use two or more machines.
[0032] The execution pipeline consists of multiple stages. Each stage is deployed on one or more machines according to a pre-specified machine-level mapping. Figure 2 In the example, there is a one-to-one mapping between levels and machines, so each level has one machine, and each level has a different machine. However, other mappings can also be used between levels and machines.
[0033] Each level is assigned a portion of computation graph 122, where that portion consists of multiple vertices of computation graph 122. Therefore, in Figure 2 In this model, each machine has a different part of the computation graph 122. By partitioning the computation graph between levels, model parallelization is achieved because different parts of the machine learning model can be executed simultaneously.
[0034] Constraint solver 208 computes partitions of computation graph 122 to generate graph partitions 212, 214, 216, 218, 220, and 222, one for each ordered stage of the execution pipeline. The constraint solver takes constraints computed by constraint generator 207 as input. The constraint generator takes vertices and edges of the computation graph as input. Constraint solver 208 computes partitions by assigning each vertex to only one stage. The constraint solver can be any one or more of the following: Pseudo-Boolean optimizer (PBO), SAT integer programming constraint solver (SAT), constraint programming (CP) constraint solver, answer set programming (ASP) constraint solver, or maximum satisfiability modulo theory (MaxSMT) constraint solver.
[0035] When performing inference or training of machine learning models through an execution pipeline, the execution cost of a stage is balanced according to the partitioning of computation. In this way, the constraint solver and constraint generator can control how the execution costs of stages are balanced and influence the efficiency of the execution pipeline. The constraint solver is configured to partition computation with the aim of balancing execution costs across stages.
[0036] In some examples, modifications to the computation graph are computed before it is fed into the constraint generator, making the method scalable to large-scale machine learning models in use. Computational modifications include one or more of the following: serialization of operations requiring more than a threshold amount of memory, recomputation, storing activations in external memory, and storing weights in external memory.
[0037] The constraint generator 207 is configured to calculate the execution cost of each level by calculating one or more of the following: the sum of the individual execution costs of the operations assigned to the machine hosting the level, the execution cost of sending and receiving messages in the level, and the execution cost of storing and reloading tensors in the machine hosting the level.
[0038] The constraint generator is configured to output one or more of the following correctness constraints: any vertex of the graph is assigned to one and only one level; for any edge in the graph, the origin of the edge is assigned to the same level as the destination or to a level earlier than the destination; the memory required for the operation of a level is appropriate to the memory capacity of the machine hosting that level.
[0039] The constraint generator is configured to output memory constraints, such that the memory required for the operations at a level is appropriate for the memory capacity of the machine hosting that level, and wherein the constraint generator is configured to calculate the memory capacity using one or more of the following: the code size of the operations assigned to the machine; the size of the tensor representing the weights assigned to the machine; the size of the messages present throughout the execution of the level; the amount of temporary memory present throughout the execution of the level; and the size of the data to be stored in the machine during the execution of the level. Implementing memory constraints has been found to be particularly effective in generating graph partitions, leading to efficient pipeline operation.
[0040] The constraint generator may optionally output one or more of the following constraints: Given a set of weights for a machine learning model, vertices using that set of weights are assigned to the same level. If a vertex is known to require no code space, it can be assigned to the same level as the vertex that consumes or produces it. If the execution is training a machine learning model, the vertices representing operations in the forward pass of training are assigned to the levels labeled as forward, while the vertices representing operations in the backward pass of training are assigned to the levels labeled as backward.
[0041] In some examples, the constraint generator is configured to compute constraints to balance execution costs across levels and also to achieve data parallelization, whereby the data is processed in parallel by each partition.
[0042] In some examples, the constraint generator is configured to compute constraints with the aim of balancing execution costs across levels, where the computation graph comprises multiple subgraphs that are executed in parallel.
[0043] In some examples, the constraint solver is configured to compute partitions in the following order: assigning vertices to one level and then assigning vertices to another level.
[0044] Figure 3 Such as Figure 1 and Figure 2 A schematic diagram of the constraint solver 308 is shown. The machine learning model (program 300) is transformed into graph 304 at 302, as the computational graph 122 described above. As mentioned above, the computational graph consists of vertices connected by edges. The computational graph is sent as input to the constraint generator 307.
[0045] The constraint generator 307 also has information about the execution pipeline, including the number of pipeline stages 310, the number M of machines 306 on which the execution pipeline is deployed, and information about the machine's memory capacity 316. The constraint solver 308 has a mapping of 314 or stages to machines.
[0046] Constraint generator 307 generates one or more constraints that vary depending on the specific implementation. These constraints are then fed into constraint solver 308. In a preferred example, the constraints include the memory constraints mentioned above and all the correctness constraints mentioned above. This combination of constraints has been found to produce good working results, thus enabling efficient pipelined execution.
[0047] Once the partitioning has been computed by the constraint solver 308, the assignment of graph vertices to levels 318 is accomplished by sending graph vertices to levels 320. Pipeline execution 322 is performed using the machine and the data 326 sent by the control node as described above. The results are stored 324.
[0048] Figure 4 shows an execution pipeline with 8 stages and 4 machines M1 to M4. Figure 4 The light-colored cells in the table represent the machine's idle time, and it can be seen that... Figure 4 The arrangement is to process single small batches. Machine M1 performs forward work in level 1, then remains idle until level 8, at which point it performs reverse work. Machine M2 is idle in level 1, calculates forward work in level 2, and then remains idle until level 7 when it calculates reverse work. Figure 4When the execution pipeline is used to process 8 batches in parallel, it eventually reaches a stable state where all machines M1 to M4 are busy.
[0049] A computation graph represents computation on a set of inputs called mini-batches. By executing the graph in a pipelined parallel manner, multiple machines can be efficiently utilized by executing different levels of the computation graph in parallel on multiple independent mini-batches. More specifically, in Figure 5 In this table, columns represent time, ordered levels are denoted by A, B, ..., H, and individual mini-batches are represented by integers 1 to 7. In the first column, machine 1 calculates level 1 A for the first mini-batch; in the second column, machine 1 calculates level 1 A for the second mini-batch, while machine 2 calculates level B for the first mini-batch, and so on. When there are multiple calculations per column (e.g., level A for the second mini-batch and level B for the first mini-batch in the second column), the calculations can be performed in any order because they are independent. This order does indeed affect pipeline efficiency and assembly.
[0050] In a pipeline configuration like this, some machines are idle for the first few timestamps (e.g., only stage A executes at timestamp 0, while machines M2, M3, and M4 are idle). At some timestamps, while all machines have code to run, they don't necessarily have the same amount of work to do. However, as more small batches are scheduled, the pipeline reaches a steady state at timestamp 12, where all the different stages are scheduled, even if they are all working in completely independent batches: the steady state represents the entire computation. Furthermore, by increasing the number of batches per iteration, theoretically, the required computational and memory load remains constant as execution moves forward in the timestamps. Finally, the steady state represents the point in time when the machine network is most used. To achieve high hardware utilization, one goal is to balance the computational load allocated to each stage on each machine.
[0051] In the example, the constraint solver identifies the layout of the steady state and finds the stages to assign operations to, thereby minimizing the computational load on the slowest machine when executing the pipeline. The slowest machine will dominate the execution cost in the steady state. Therefore, minimizing this computational load means reducing the idle time of other machines, thus improving pipeline efficiency.
[0052] In the example, given its capacity, the memory required to allocate vertices to a machine (or a level of a machine) is suitable for the machine. In addition to the code space and tensors created and released throughout the execution of the machine learning model, the constraint solver is also able to consider buffers in each machine for communication between levels. The first level allocated to each machine will store all tensors that the second level will use in this buffer. As can be seen in Figure 5, for this particular configuration, the buffer will hold copies of the output of level A that need to be used in level H. The term "reuse distance" refers to the distance that needs to be held in the buffer.
[0053] Figure 5 This is an example of how execution pipelines utilize parallelization. There are four machines (machines 1 through 4 in the diagram) and eight levels, A through H. There are seven mini-batches, represented as 1 through 7. Each column represents a specific moment, called a timestamp, so the leftmost column has a timestamp of 0, the next column to the right has a timestamp of 1, and so on, until the rightmost timestamp is 19. The term "forward pass" is used to refer to the forward propagation of a neural network training algorithm, such as backpropagation, while the term "backward pass" is used to refer to the backward propagation of a neural network training algorithm.
[0054] At timestamp 0, machine 1 processes level A for the forward pass of mini-batch 1, while machines 2 through 4 are idle.
[0055] At timestamp 1, machine 1 processes level A for the forward pass of mini-batch 2, while machine 2 processes level B for the forward pass of mini-batch 1, and machines 3 and 4 are idle.
[0056] At timestamp 2, machine 1 processes level A for the forward pass of mini-batch 3, machine 2 processes level B for the forward pass of mini-batch 2, and machine 3 processes level C for the forward pass of mini-batch 1.
[0057] At timestamp 3, machine 1 processes level A for the forward pass of mini-batch 4, machine 2 processes level B for the forward pass of mini-batch 3, machine 3 processes level C for the forward pass of mini-batch 2, and machine 4 processes level D for the forward pass of mini-batch 1.
[0058] At timestamp 4, machine 1 is idle. Machine 2 processes stage B for the forward pass of mini-batch 4. Machine 3 processes stage C for the forward pass of mini-batch 3. Machine 4 processes stage E for the reverse pass of mini-batch 1.
[0059] At timestamp 5, machines 1 and 2 are idle. Machine 3 processes the forward pass stage C of mini-batch 4, and machine 4 processes the backward pass stage E of mini-batch 1. Note that the backward pass computation takes longer than the forward pass computation, which is represented by repetition in Figure 5. Figure 5 In the diagram, it indicates that each cell in the backward computation is copied. At timestamp 5, the cell for machine 4 is a copy of the cell for machine 4 at timestamp 4.
[0060] At timestamp 6, machines 1 and 2 are idle. Machine 3 processes stage F for the reverse pass of mini-batch 1. Machine 4 processes stage D for the forward pass of mini-batch 2.
[0061] At timestamp 7, machines 1 and 2 are idle. Machine 3 calculates level F for the reverse pass of mini-batch 1, and machine 4 calculates level E for the reverse pass of mini-batch 2.
[0062] At timestamp 8, machine 1 is idle. Machine 2 calculates level G for the reverse propagation of mini-batch 1. Machine 3 is idle. Machine 4 calculates level E for the reverse propagation of mini-batch 2.
[0063] At timestamp 9, machine 1 is idle. Machine 2 calculates level G for the reverse propagation of mini-batch 1. Machine 3 calculates level F for the reverse propagation of mini-batch 2. Machine 4 calculates level D for the forward propagation of mini-batch 3.
[0064] At timestamp 10, machine 1 calculates level H for the reverse propagation of mini-batch 1, machine 2 is idle, machine 3 calculates level F for the reverse propagation of mini-batch 2, and machine 4 calculates level E for the reverse propagation of mini-batch 3.
[0065] At timestamp 11, machine 1 calculates level H for the reverse propagation of mini-batch 1, machine 2 calculates level G for the reverse propagation of mini-batch 2, machine 3 is idle, and machine 4 calculates level E for the reverse propagation of mini-batch 3.
[0066] At timestamp 12, a steady state is reached because all machines are busy. This steady state continues until the remaining timestamps shown in the diagram. The machines process the smaller batches represented by numbers and the levels represented by letters in the diagram.
[0067] A detailed example is now provided. This example is not intended to limit the scope of this disclosure, but rather to provide mathematical details to facilitate understanding of the technique. Note that the detailed example below uses more constraints than required by the working solution, and it takes into account communication load and execution costs even if only execution costs could be considered.
[0068] Calculation graph The program can be represented as a directed acyclic graph G = (V, E), where the vertex set V represents operations on the tensor, and the edge set E represents data and control dependencies between operations, i.e., an edge uv indicates that operation u is consumed by operation v as input. For control dependencies, an edge uv indicates that operation v is scheduled after operation u. Throughout the example, vertices are represented as u,v ∈ V, and edges are represented as u → v ∈ V.
[0069] The constraint solver uses software that generates constraints to call the following functions at vertices: load(v) returns the computational load (e.g., loop count or time) of executing vertex v. storeAndLoad(v) returns the number of cycles required to store and load the output of vertex v; The static(v) function returns the number of bytes that vertex v occupies in memory during the entire model execution (e.g., code size if the vertex represents an operation, tensor size if it represents a weight). The tensor(v) returns the number of bytes occupied in memory by the output of vertex v.
[0070] The constraint solver uses these functions to obtain information for computational load and memory requirements. Functions like `load` and `static` are derived from profiling information—that is, the model has been compiled to a specific machine and trained for a certain period, and the profiling information is used to estimate the number of iterations and code size for each vertex. Functions such as tensors and weights are obtained as part of an intermediate representation used to represent the graph in the machine's software stack. The use of profiling information is just one example; alternatively, a manually written model could be used for each vertex type to produce the same information.
[0071] Constraint Solver The constraint solver divides each graph into a series of levels distributed across different machines. In one example, the constraint solver obtains the graph... The number of machines M, the number of levels S, and the machine capabilities C are determined, and vertices are assigned to level identifiers. Machine identifiers are identified as follows: Where [M] is used for the index set The abbreviation for . Level identifiers are represented as Assumption-level identifiers are ordered, that is, assigned to... The vertices of s are independent of vertices that will be assigned to s'>s in the future. Let m(s) denote the allocation of levels to the machine, and assume that the allocation is pre-specified. The set of levels allocated to machine m is represented as In one example, the set of levels belonging to machine m can be represented as: In one example, the set of classes belonging to machine m can be represented as .
[0072] In this example, the output of the constraint solver is the assignment of vertex hierarchy, which minimizes the overall computational load of the machine learning model.
[0073] The assignment of vertices is modeled using binary variables S(v, s). This describes whether a vertex v is assigned to a level; if v is assigned to s, then... Otherwise, S(v, s) = 0.
[0074] Furthermore, two sets of auxiliary binary variables M(v, m) ∈ {0, 1} and L(v, s1, s2) ∈ {0, 1} are used, defined as follows: Formula 1 Formula 2 Here, M(v, m) = 1 indicates that vertex v is assigned to machine m, and L(v, s1, s2) = 1 indicates that vertex v assigned to level s1 has a user in s2, where the user is a consuming vertex.
[0075] Given these binary variables, the computational load assigned to a level of the machine is defined as the number of cycles required to execute all the vertices assigned to those levels, and the communication load is defined as the number of cycles required to send and receive the results generated and consumed in them, respectively.
[0076] Definition 2.1 (Computational Load). The computational load assigned to a machine is the sum of the cycle counts of the vertices assigned to that machine. Note that this is one definition of computational load; other definitions are possible and used in some examples.
[0077] cost( v )
[0078] Definition 2.2 (Communication Load). The communication load of a machine is the sum of the cycle counts required for any stage of that machine to send and receive data. The formula below gives the communication cost of a traditional topology for a machine network. Other topologies have different cost functions.
[0079]
[0080] Please note that it is not necessarily expected that sending and receiving tensors between different machine pairs will have a uniform load; that is, these loads depend on the topology of the machine network. Therefore, the assumption function send ( v, m, m' ) and recv ( v, m, m' ) is based on tensor ( v The communication load is defined between the machine and the user-defined machine pair.
[0081] The total load allocated to a machine level is the sum of the machine's computing and communication loads.
[0082] Definition 2.3 (Total Load).
[0083]
[0084]
[0085] Find the values of the variables in the domain of S such that the constraint solver can minimize the execution cost of the slowest machine in steady state, i.e., the machine with the largest computational and communication load: (Formula 3) The condition is (Constraint 2.4)
[0086] (Constraint 2.5) (Constraint 2.6) Please note the auxiliary variables. and Defined in formulas (1) and (2).
[0087] In constraint 2.4, all vertices have been assigned, and no vertex is copied across multiple levels.
[0088] Constraint 2.4. Each vertex is assigned to one and only one level.
[0089]
[0090] Constraint 2.5 requires that the user of a vertex always executes at a level later than the vertex itself. This is necessary for correctness, meaning that either the two vertices of an edge are assigned to the same level, or the source is assigned to a level earlier than the destination.
[0091] Constraint 2.5. The source of an edge must occur before the endpoint of the same edge.
[0092]
[0093] Constraint 2.5 is visualized in the left panel of Figure 6.
[0094] Constraint 2.6 requires that all vertices allocated to the machine fit there. That is, the sum of the permanent effective memory and the maximum temporary memory required by these vertices, and the buffer size required by the machine, are less than a given capacity Cm, which may be different for each machine.
[0095] Figure 6 shows a visualization with constraints 2.5 and 2.7. For each constraint, Figure 6 The elements of the two-dimensional table L(v, s1, s2) for any vertex v are displayed. Only shaded level pairs (s1, s2) are allowed to have non-zero values.
[0096] The always-live memory required to allocate the vertices of a given machine includes the code size of those vertices, as well as the size of those vertices representing weights and inputs. This information is provided by each vertex. v of static ( v The function is given.
[0097]
[0098] (Formula 4) Note that if two vertices performing the same computation are assigned to the same machine, they can share code if this feature is available. In this case, the definition of always-available memory can be changed to take into account the type of computation of the vertex assigned to the machine, rather than the vertex itself. The space required for temporary memory depends on the scheduling for each level; that is, the execution order of vertices assigned to a level affects the maximum amount of available memory. A function live ( v , m ; S The function is available; for a given allocation S, this function indicates when... v Machine during execution m How much memory is available? Given this function, the maximum temporary memory is defined as follows:
[0099] With this function in place, it is possible to find the best schedule for each stage, or even take a predefined schedule and estimate its memory usage.
[0100] Local communication happens through buffers, i.e. tensors produced at some earlier stage on the same machine and consumed at one of the later stages are stored in a buffer shared by both stages. This buffer should be large enough to hold D(s, s') instances of all vertex outputs assigned to stage s that are used in a later stage s' for s, s' ∈ Sm. The function D(s,s') is given beforehand.
[0101] In one example, D(s,s') is defined as the reuse distance, which for and s<s' is , and zero otherwise. This is the number of mini-batches that stage s will execute until the result of the first mini-batch is consumed at stage s' assigned to the same machine as stage s. More generally, if there are multiple stages on the same machine that consume the same output from an earlier stage, only the last one is counted to avoid double counting.
[0102] The buffer size is defined as follows.
[0103]
[0104] Constraint 2.6. The total memory required by the set of vertices assigned to machine m should not exceed its capacity Cm.
[0105]
[0106] Additional constraints In addition to constraints 2.4, 2.5 and 2.6, two more constraints can be considered as heuristics to reduce the search space size.
[0107] In the case of training a neural network, it is required that the weights remain in the machines throughout the execution. This is not a requirement for correctness. However, given that the same set of weights is usually reused in every iteration, if they were to move between machines, the extra load of copying them and synchronizing their values between iterations would be significant. This decision leads to configurations that assign the first and last stages to the same machine, since the weight update computation needs to be done on the same machine as the forward stages of that model.
[0108] In constraint 2.7 it is required that the vertices representing weights are never copied from one machine to another.
[0109] Constraint 2.7. Weights stay in the same device.
[0110]
[0111] Here we assume that weights(V) represent weights, for example. The vertex set, , is given by the user or found in an intermediate representation. Constraint 2.7 is visualized in the right panel of Figure 6. In the context of machine learning, it is often interesting to run a computational graph representing the training steps of a model on various machines (CPU, GPU), where the model is represented as a differentiable function (often called a neural network model). In such a computational graph, the vertex that leads to the loss calculation is called the forward operation, and the vertex that follows the loss calculation is called the backward operation. In this case, assuming there are S = 2M levels, it is reasonable to restrict the forward operation to be assigned to one of the first M levels and the backward operation to one of the last M levels. More specifically, use the following constraints.
[0112] Constraint 2.8. Forward and backward operations should be separated.
[0113]
[0114] Here we assume a set of forward and backward operations. Provided by the user, and .
[0115] The framework described above can be extended in several ways, such as data parallelization, parallel execution of subgraphs, computation graph optimization, and sequential partitioning. At a high level, all these optimizations can be combined with the formulas in Equations 1 and 2 and implemented as an outer loop around the minimization problem of Equation 3.
[0116] Data parallelization is a technique for computing multiple small batches of data in parallel across multiple groups of machines; each group is often referred to as a replica. Pipeline parallelization and data parallelization are combined by dividing M available machines into r = M / M' groups, with M' machines in each group.
[0117] Mini-batching involves processing b > 1 data items simultaneously on each level and machine (hence the term mini-batch). When considering parallelization across machines, one can compare the parallelization achievable within a machine (by increasing b) with the parallelization obtained by increasing the number of replicas r. Typically, when one has a fixed budget for the total number of machines M, the former results in fewer replicas r but a larger size for each group M' (allowing for a larger mini-batch size b within each replica), while the latter results in more replicas and fewer machines per replica (and a finite mini-batch size within each replica).
[0118] Figure 7 compares two strategies for dividing 8 machines into (a) 2 groups of size 4 or (b) 4 groups of size 2.
[0119] To maximize the overall system throughput, the objective was set as follows:
[0120] The condition is
[0121] Here, p is the number of mini-batches per iteration in the pipeline configuration, and eff(p, M') is a function characterizing pipeline efficiency, which depends on the pipeline configuration and the replica size M'. As p increases, the pipeline efficiency eff(p, M') approaches 1 because the ascending and descending stages become less dominant compared to the steady state. AllReduceLoad(r) is the time spent synchronizing replicas, which is a function of the number of replicas r. For example, for training a neural network model, this would correspond to the aggregation of gradient computations.
[0122] As an illustration, in Figure 7, consider dividing M = 8 machines into (a) 2 replicas of size 4 or (b) 4 replicas of size 2. For simplicity, assume eff(p, M') = 1 (the minimum batch size p in each iteration is sufficiently large) and communication overhead AllReduceLoad(r) = 0. Configuration (a) is superior to configuration (b) if the following conditions are met.
[0123] in b a and b b These represent the mini-batch size in the two configurations, respectively. In other words, if (i) b a = b b = b and InnerCost ( b , 4)< InnerCost ( b , 2) / 2, if (ii) InnerCost ( b a , 4) = lnnerCost ( b b , 2) and b a >2 bb If, or a combination of the above two, then configuration (a) is superior to configuration (b).
[0124] Please note that when r = M and M' = 1, pure data parallelization (without pipelining) is a special case of the above formula. Furthermore, when r = 1 and M' = M, pure pipelining (without data parallelization) is a special case.
[0125] Parallel execution of subgraphs If the input computation graph contains subgraphs that can be executed in parallel, it makes sense to extend the pipeline configuration to allow a stage to be assigned to multiple machines.
[0126] As an illustration, Figure 8 compares two sequential and parallel pipeline configurations that result in different optimal loads, based on the objective function of Equation 3 above. In the sequential configuration 804, the objective is dominated by stage 2 because subgraphs B and C are executed sequentially. In the parallel configuration 806, the pipeline is better balanced because each stage takes approximately the same amount of time.
[0127] Figure 8 It provides a comparison of sequential and parallel execution levels for computation graphs that include data-independent subgraphs. Figure 8 Part 800 shows nodes B and C, which represent independent subgraphs that execute in parallel. Figure 8 Section 804 illustrates the scheduling corresponding to the sequential execution of subgraphs B and C. Level 2 takes significantly longer than levels 1 and 3, and the pipeline is unbalanced. Figure 8 Part 806 outlines the scheduling corresponding to the parallel execution subgraphs B and C. Level 2 takes roughly the same amount of time as Levels 1 and 3, and the pipeline is more balanced.
[0128] Computational graph optimization Computation graph optimization refers to rewriting the computation graph in a way that maintains computational correctness while achieving lower overhead. This includes, for example, serializing operations that require too much memory, recompiling them, storing activations in external memory, and storing weights in external memory. Applying any of these optimizations can potentially alter the optimal partitioning of the computation graph across levels and the allocation of machines and replicas.
[0129] In any case, as long as these optimizations can be expressed as changes in the input computation graph, the formula in Equation 3 above applies to every output graph of this graph-level optimization, and finds the best combination of graph-level optimization and partitioning to obtain the most efficient pipeline / data parallelization.
[0130] Sequentially classify into levels In Equation 3, it is assumed that each level is assigned to a machine, and that all inputs to that level are valid throughout its execution. This assumption can be relaxed by allowing levels to be partitioned sequentially, and considering the inputs to each sub-level as valid only during its duration. This approach is used to support code and other static data that are no longer needed after a vertex is removed from the machine's memory.
[0131] The following sections present the performance results given by the pipelined execution strategy.
[0132] The neural network model used in the evaluation is ResNet50 (trademark), a convolutional neural network for image recognition that runs in training mode.
[0133] Executing ResNet50 on a single machine with a batch size of 1 is not feasible. The set of weights, vertex codes, and temporary tensors peaks at 368MB, exceeding the device limit of 304MB. However, the performance of single-machine execution was estimated by running the model on a software simulator. This indicates a total of 3 million cycles to process one input image, corresponding to a throughput of 433 samples / second.
[0134] ResNet50 was partitioned across four machines using the pipelined parallelization described in this paper. The total number of cycles processed for the seven input images was 10.7 million, corresponding to a throughput of 850 samples / second, which is a significant improvement over the 433 samples / second throughput of the single-machine execution scenario described above.
[0135] Figure 9 Various components of an exemplary computing-based device 900 are illustrated, which are implemented as any form of computing and / or electronic device, and in some examples, embodiments of control node 200 or machines M1 to M6 are implemented.
[0136] The computation-based device 900 includes one or more processors 902, which are microprocessors, controllers, or any other suitable type of processor, for processing computer-executable instructions to control the operation of the device in order to train a machine learning model, or to process data instances of the machine learning model, or to partition a computational graph of the machine learning model among the various stages of an execution pipeline. In some examples, such as when using a system-on-a-chip architecture, the processor 902 includes one or more fixed-function blocks (also called accelerators) implemented in hardware (rather than software or firmware). Figure 2 and Figure 3Part of the method. In some examples, each processor 902 has local memory 906. Platform software, including an operating system 910 or any other suitable platform software, is provided at the computation-based device to support application software, such as a constraint solver 912, or vertices 914 of a computation graph corresponding to a machine learning model, which will be executed on the device.
[0137] This disclosure includes the following examples listed as terms.
[0138] Clause A. A computer-implemented method comprising: Accessing the computational graph of a machine learning model from memory; and A constraint solver is used to compute the partitioning of the computation graph into ordered levels of the execution pipeline; This ensures that, during use, when the machine learning model is inferred or trained by executing the pipeline, the execution cost of the stage is balanced according to the calculated partition.
[0139] Clause B. The computer-implemented method according to Clause A further includes, before using the computation graph to calculate the partition, calculating a correction to the computation graph such that, in use, the method is scalable for large-scale machine learning models, and wherein calculating the correction includes one or more of the following: serializing operations that require more than a threshold amount of memory, recalculating, storing activations in external memory, and storing weights in external memory.
[0140] Clause C. A computer-implemented method according to Clause A or B, wherein the computation graph comprises a plurality of vertices connected by edges, wherein each vertex represents an operation of the machine learning model, and each edge represents communication between the operations of the machine learning model.
[0141] Clause D. The computer-implemented method according to Clause C, wherein the constraint solver computes the partition by assigning each vertex of the vertices to only one level of the levels.
[0142] Clause E. A computer-implemented method according to any one of the preceding clauses, wherein the constraint solver is configured to calculate the partition with the objective of balancing execution costs among the levels of the level, the execution costs including one or more of the following: execution cycle, execution time, and energy usage.
[0143] Clause F. The computer-implemented method according to Clause E, wherein the constraint solver is configured to calculate the execution cost of each level in the level by calculating one or more of the following: the sum of the individual execution costs of operations assigned to the machine hosting the level, the execution costs of sending and receiving messages in the machine hosting the level, and the execution costs of storing and reloading tensors in the machine hosting the level.
[0144] Clause G. A computer-implemented method according to any of the preceding clauses, wherein the constraint solver is configured to implement one or more of the following correctness constraints: any vertex of the graph is assigned to one and only one level; for any edge of the graph, the starting point of the edge is assigned to the same level as the ending point or to a level earlier than the ending point; and the memory required for the operation of the level is appropriate to the memory capacity of the machine hosting the level.
[0145] Clause H. A computer-implemented method according to any one of the preceding clauses, wherein the constraint solver is configured to implement memory constraints, wherein the memory required for operation of the level is suitable for the memory capacity of the machine hosting the level, and wherein the constraint solver is configured to calculate the memory capacity using one or more of the following: The code size of the operation assigned to the machine; The size of the tensor representing the weights assigned to the machine; The size of the messages that are effective throughout the execution of the level; The amount of temporary memory that is effective throughout the execution of the level; The size of the data to be stored in the machine during the execution of the level.
[0146] Clause I. A computer-implemented method according to any of the preceding clauses, wherein the constraint solver implements one or more of the following constraints: Given a set of weights for vertices in a machine learning model, vertices using that set of weights are assigned to the same level. If a vertex is known to require no code space, it can be assigned to the same level as the vertex that consumes or generates that vertex. When the execution is training the machine learning model, the vertices of operations in the forward pass of the training are assigned to the levels marked as forward, and the vertices of operations in the backward pass of the training are assigned to the levels marked as backward.
[0147] Clause J. A computer-implemented method according to any of the preceding clauses, wherein the constraint solver is configured to compute the partition with the objective of balancing execution costs across all levels of the level and also with the objective of achieving data parallelization, thereby enabling data to be processed in parallel by the partitions of the partition.
[0148] Clause K. A computer-implemented method according to any one of the preceding clauses, wherein the constraint solver is configured to compute the partition with the objective of balancing execution costs between levels of the level and wherein the computation graph comprises multiple subgraphs executed in parallel.
[0149] Clause L. A computer implementation method according to any of the preceding clauses, wherein the constraint solver is configured to compute the partition sequentially by assigning vertices to one level of the levels and then assigning vertices to another level of the levels.
[0150] Clause M. Any computer-implemented method of the foregoing clauses also includes performing inference or training of a machine learning model by executing a pipeline.
[0151] Clause N. A computer implementation method according to any of the preceding clauses, wherein the constraint solver is configured to calculate the partition with the objective of balancing execution costs among the levels of the stage during the steady state of the execution pipeline.
[0152] Clause O. A machine comprising: Memory, containing a computational graph of machine learning models; and A constraint solver that computes the partitioning of the computation graph into ordered stages of the execution pipeline; This ensures that, during use, when the machine learning model is inferred or trained by executing the pipeline, the execution cost of the stage is balanced according to the calculated partition.
[0153] Clause P, an execution pipeline, includes: Multiple ordered levels hosted on machines connected in a machine network; Each level includes the partitioning of the computation graph for the machine learning model; The constraint solver is configured to compute partitions with the aim of balancing execution costs across levels and sending the partition results to the levels.
[0154] Clause Q. An execution pipeline according to Clause P, wherein the constraint solver is configured to implement memory constraints such that the memory required for the operations at this level is appropriate for the memory capacity of the machine hosting that level, and wherein the constraint solver is configured to compute memory using one or more of the following capacities: The code size of the operation assigned to the machine; The size of the tensor representing the weights assigned to the machine; The size of the messages that are effective throughout the execution of the level; The amount of temporary memory that is effective throughout the execution of the level; The size of the data to be stored in the machine during the execution of the level.
[0155] Clause R. Execution pipeline according to Clause P or Q, wherein the constraint generator is configured to call the following function to generate constraints for use by the constraint solver: load(v), which returns the computational load of executing vertex v; storeAndLoad(v) returns the number of cycles required to store and load the output of vertex v; static(v) returns the number of bytes that vertex v occupies in memory during the entire execution of the machine learning model; The tensor(v) returns the number of bytes occupied in memory by the output of vertex v.
[0156] Clause S. An execution pipeline pursuant to any of Clauses P through R, wherein the constraint solver is configured to implement one or more of the following correctness constraints: any vertex of the graph is assigned to one and only one level; for any edge of the graph, the origin of the edge is assigned to the same level as the endpoint or to a level earlier than the endpoint; and the memory required for the operation of the level is appropriate to the memory capacity of the machine hosting the level.
[0157] Clause T. According to any of Clauses P through S in the execution pipeline, the constraint solver is configured to calculate the execution cost of each level in the level by computing one or more of the following: the sum of the individual execution costs of operations assigned to the machine hosting the level, the execution cost of sending and receiving messages in the machine hosting the level, and the execution cost of storing and reloading tensors in the machine hosting the level.
[0158] Computer-executable instructions are provided using any computer-readable medium accessible to the computing device 900. Computer-readable media include, for example, computer storage media such as memory 908 and communication media. Computer storage media such as memory 908 include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, etc. Computer storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), electronically erasable programmable read-only memory (EEPROM), flash memory or other storage technologies, optical disc read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage devices, magnetic tape, magnetic disk storage devices or other magnetic storage devices, or any other non-transmission medium for storing information accessible to the computing device. Conversely, communication media embodies computer-readable instructions, data structures, program modules, etc., in modulated data signals such as carrier waves or other transmission mechanisms. As defined herein, computer storage media does not include communication media. Therefore, computer storage media itself should not be construed as propagating signals. Although the computer storage medium (memory 908) is shown within the computing-based device 900, it should be understood that in some examples, the storage is distributed or located remotely and accessed via a network or other communication link (e.g., using communication interface 904).
[0159] The terms "computer" or "computation-based device" are used herein to refer to any device with processing power in order to execute instructions. Those skilled in the art will recognize that this processing power is incorporated into many different devices; therefore, the terms "computer" and "computation-based device" each include personal computers (PCs), servers, mobile phones (including smartphones), tablet computers, set-top boxes, media players, game consoles, personal digital assistants, wearable computers, and many other devices.
[0160] In some examples, the methods described herein are executed by software in a machine-readable form on a tangible storage medium, such as a computer. The software includes a computer program code apparatus, which, when the program is run on a computer and wherein the computer program can be embodied on a computer-readable medium, is adapted to perform all operations of one or more methods described herein. The software is suitable for execution on a parallel or serial processor, so that the method operations can be performed in any suitable order or simultaneously.
[0161] This acknowledges that software is a valuable, separately tradable commodity. It is intended to encompass software that runs or is controlled on “dumb” or standard hardware to perform desired functions. It also aims to cover software that “describes” or defines hardware configurations, such as HDL (Hardware Description Language) software used to design silicon chips or configure general-purpose programmable chips to perform desired functions.
[0162] Those skilled in the art will recognize that storage devices used to store program instructions may optionally be distributed across a network. For example, a remote computer can store examples of processes described as software. A local or terminal computer can access the remote computer and download part or all of the software to run the program. Alternatively, a local computer can download software fragments as needed, or execute some software instructions on a local terminal and others on a remote computer (or computer network). Those skilled in the art will also recognize that, by utilizing conventional techniques known to them, all or part of the software instructions can be executed by dedicated circuitry, such as digital signal processors (DSPs), programmable logic arrays, etc.
[0163] As will be apparent to those skilled in the art, any range or device value given herein may be extended or altered without losing the desired effect.
[0164] Although the subject matter has been described in language specific to structural features and / or methodological behavior, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or behaviors described above. Rather, the specific features and actions described above are disclosed as exemplary forms for implementing the claims.
[0165] It should be understood that the above benefits and advantages may relate to one embodiment or several embodiments. The embodiments are not limited to embodiments that solve any or all of the described problems or that have any or all of the described benefits and advantages. It will be further understood that reference to "one" item means one or more of those items.
[0166] The operations described herein can be performed in any suitable order, or simultaneously where appropriate. Furthermore, individual blocks can be removed from any method without departing from the scope of the subject matter described herein. Aspects of any of the examples above can be combined with aspects of any other example described to form further examples without losing the desired effect.
[0167] The term “comprising” is used herein to mean that a method block or element is identified, but such a block or element does not include an exclusive list, and the method or apparatus may include additional blocks or elements.
[0168] The term “subgraph” is used in this document to refer to an appropriate subgraph such that a subgraph of a graph does not contain all the elements of the graph (i.e., at least one element of the graph is missing from the subgraph).
[0169] It will be understood that the above description is merely illustrative, and various modifications can be made by those skilled in the art. The foregoing description, examples, and data provide a complete description of the structure and use of the exemplary embodiments. Although various embodiments have been described to a certain extent or with reference to one or more individual embodiments, those skilled in the art can make various changes to the disclosed embodiments without departing from the scope of this specification.
Claims
1. A computer-implemented method, comprising: Accessing a computation graph of a machine learning model from memory, the computation graph comprising multiple vertices connected by edges, wherein the vertices represent operations of the machine learning model, and the edges represent communication between the operations of the machine learning model; Constraints for the computation graph are generated using the vertices and edges of the computation graph, wherein the constraints include at least one of the following: For any edge in the graph, the starting point of the edge is assigned to either the same level as the ending point or to a level earlier than the ending point. For the weights of the machine learning model, vertices using those weights are assigned to the same level, or If one of the vertices is known to require no code space, it may be assigned to the same level as the other vertex in the vertices, which consumes or generates the vertex in the vertices. as well as The constraints are used to compute the partition of the computation graph, the partition comprising a graph partition of the sequential ordering of the execution pipeline, wherein computed partitioning comprises computed the execution cost of the level such that the execution cost is balanced across the levels of the level, and wherein computed partitioning comprises computed the graph partitioning using the allocation of the level to the machines on which the execution pipeline is deployed.
2. The computer-implemented method of claim 1 further includes calculating a correction to the computation graph before using the computation graph to calculate the partition, such that the method is scalable for large-scale machine learning models in use, and wherein calculating the correction includes one or more of the following: serializing operations that require more than a threshold amount of memory, recalculating, storing activations in external memory, and storing weights in external memory.
3. The computer-implemented method of claim 1, wherein calculating the partition comprises assigning each vertex of the vertices to only one level of the levels.
4. The computer-implemented method according to claim 1, wherein the execution cost includes one or more of the following: execution cycle, execution time, and energy usage.
5. The computer-implemented method of claim 4, wherein calculating the execution cost of the level comprises calculating one or more of the following: the sum of the individual execution costs of operations allocated to the machine hosting the level, the execution cost of sending and receiving messages in the machine hosting the level, and the execution cost of storing and reloading tensors in the machine hosting the level.
6. The computer-implemented method of claim 1, wherein the constraints include one or more of the following correctness constraints: any vertex of the graph is assigned to one and only one level, and the memory required for the operation of the level is appropriate to the memory capacity of the machine hosting the level.
7. The computer-implemented method of claim 1, wherein generating the constraints includes generating memory constraints, wherein the memory required for operation of the level is suitable for the memory capacity of the machine hosting the level, and further includes calculating the memory capacity using one or more of the following: The code size of the operation assigned to the machine; The size of the tensor representing the weights assigned to the machine; The size of the messages that are effective throughout the execution of the level; The amount of temporary memory that is effective throughout the execution of the level; The size of the data to be stored in the machine during the execution of the level.
8. The computer-implemented method of claim 1, wherein, when the execution is training the machine learning model, vertices representing operations in the forward pass of the training are assigned to levels labeled as forward, and vertices representing operations in the backward pass of the training are assigned to levels labeled as backward.
9. The computer-implemented method of claim 1, wherein data parallelization is implemented, thereby enabling data to be processed in parallel by partitioning each of the graphs.
10. The computer-implemented method according to claim 1, further comprising: The machine learning model is inferred or trained by executing the pipeline.
11. The computer-implemented method according to any one of the preceding claims, wherein calculating the partition comprises: The partitioning is calculated such that the execution cost is balanced across all levels of the level during the steady state of the execution pipeline.
12. The computer-implemented method of claim 1, wherein at least one level in the ordered levels comprises at least two subgraphs in the computation graph that are executed in parallel.
13. The computer-implemented method of claim 1, wherein calculating the partition of the computation graph includes calculating each level of a graph partition in the graph partition.
14. The computer-implemented method of claim 1, wherein in the sequentially ordered stages of the execution pipeline, the output of each stage except the last stage is the input of another stage in the sequentially ordered stages.
15. The computer-implemented method of claim 1, wherein generating the constraint includes calculating the constraint using pipeline information, the pipeline information including one or more of the following: the number of stages of the execution pipeline, the number of machines deploying the execution pipeline, and the memory capacity of one or more machines deploying the execution pipeline.
16. The computer-implemented method of claim 1, further comprising performing inference or training of the machine learning model by executing the execution pipeline, such that the execution cost of the stage is balanced according to the partitioning of the computation.
17. A machine comprising: The memory stores machine learning models; A constraint generator that uses vertices and edges of a computation graph to generate constraints for the machine learning model, wherein the vertices represent operations of the machine learning model and the edges represent communication between operations of the machine learning model, wherein the constraints include at least one of the following: For any edge in the graph, the starting point of the edge is assigned to either the same level as the ending point or to a level earlier than the ending point. For the weights of the machine learning model, vertices using those weights are assigned to the same level, or If one of the vertices is known to require no code space, it may be assigned to the same level as the other vertex in the vertices, which consumes or generates the vertex in the vertices. as well as A constraint solver that uses the constraints to compute a partition of the computation graph, the partitioning comprising a graph partition of sequentially ordered levels of an execution pipeline, wherein computed partitioning includes computed execution costs of computation levels such that the execution costs are balanced across levels of the level, and wherein computed partitioning includes computed graph partitioning using the allocation of the level to the machines on which the execution pipeline is deployed.
18. An apparatus comprising: The execution pipeline includes ordered levels hosted on machines. Each of the levels includes a graph partition of a computation graph of a machine learning model, the computation graph including 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; as well as The constraint solver is configured as follows: The graph partition is computed using constraints, wherein computed graph partition includes computed execution costs of the levels such that execution costs are balanced across the levels of the level, wherein the graph partition is computed using the allocation of the level to the machines on which the execution pipeline is deployed, and wherein said constraints include at least one of the following: For any edge in the graph, the starting point of the edge is assigned to either the same level as the ending point or to a level earlier than the ending point. For the weights of the machine learning model, vertices using those weights are assigned to the same level, or If one of the vertices is known to require no code space, it may be assigned to the same level as the other vertex in the vertices, which consumes or generates the vertex in the vertices. as well as The division is sent to the level.
19. The apparatus of claim 18, wherein the constraint generator is configured to call the following function to generate the constraints used by the constraint solver: load(v) returns the computational load of executing vertex v; storeAndLoad(v) returns the number of cycles required to store and load the output of vertex v; static(v), which returns the number of bytes of memory occupied by vertex v during the entire execution of the machine learning model; and The tensor(v) returns the number of bytes occupied in memory by the output of vertex v.
20. The apparatus of claim 18, wherein the constraint solver is configured to calculate the execution cost by calculating at least one of the following: the execution cost of sending and receiving messages in a machine hosting one of the levels, or the execution cost of storing and reloading tensors in a machine hosting the level.
Citation Information
Patent Citations
Processing computational graphs
CN108292241A
Information processing apparatus, computer-readable recording medium, and information processing method
US20190205487A1
