Reduced propagation latency
By implementing a scheduling technique that optimizes operation allocation in machine learning accelerators, latency issues between neural network layers are mitigated, resulting in improved performance and utilization rates.
Patent Information
- Application Number
- JP2023126257
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2019-08-22
- Filing Date
- 2023-08-02
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-08-20
AI Technical Summary
Machine learning accelerators face inherent latency issues due to dependencies between neural network layers, leading to computational and propagation delays, which are exacerbated as devices scale up.
A scheduling technique is employed to reduce latency by rescheduling operations, switching allocation directions between rows and columns, and optimizing block processing to minimize idle cycles and propagation delays.
This approach significantly reduces computational and propagation latencies, achieving near-100% utilization rates without requiring complex hardware changes, thereby enhancing performance.
Smart Images

Figure 0007541163000001 
Figure 0007541163000007 
Figure 0007541163000006
Abstract
Description
[Technical field]
[0001] This specification relates to a machine learning accelerator. [Background technology]
[0002] Machine learning accelerators are application-specific integrated circuits (ASICs) designed to perform highly parallel synchronous operations. Parallel processing is achieved by integrating various independent processing elements that can execute simultaneously.
[0003] Such devices are suitable for accelerating inference passes through neural networks. Neural networks are machine learning models that employ multi-layer operations to predict one or more outputs from one or more inputs. Neural networks typically include one or more hidden layers between an input layer and an output layer. The output of each layer is used as input for another layer in the network, for example the next hidden layer or the output layer.
[0004] Typically, the computational operations required for each layer can be achieved by performing matrix multiplications. In most cases, one of the matrices is a vector, e.g., a matrix-vector multiplication. Thus, machine learning accelerators allow the multiplication and addition of matrix multiplications to be performed in a highly parallel manner.
[0005] However, due to dependencies between layers in a neural network, these computational mechanisms have inherent latency. Latency occurs because the output of one layer becomes the input for the next layer. Therefore, layers of a neural network must usually be executed sequentially, not in parallel. In other words, the last computational operation of one layer must generally be completed before the first computation of the next layer can begin.
[0006] In general, machine learning accelerators that use multiple tiles assigned to different layers incur two types of latency. First, computation latency occurs by waiting for input data when the chip's elements are actually available to perform the computation. Second, propagation latency occurs because the output of one layer computed by one tile needs to be propagated to become the input of another layer computed by a second tile. Computation latency can be improved by making larger devices with more computation elements. However, as devices become larger, the distance between tiles over which data needs to travel becomes longer, and propagation latency tends to increase. Summary of the Invention [Means for solving the problem]
[0007] This specification describes how the system generates schedules for machine learning accelerators that not only reduce computation latency, but also reduce propagation latency when data needs to be communicated between tiles.
[0008] Certain embodiments of the subject matter described herein may be implemented to achieve one or more of the following advantages: The computational and propagation latencies of the machine learning accelerator may be reduced by rescheduling operations, thereby improving performance without requiring expensive or complex hardware modifications. The performance improvements of the scheduling techniques described below are computationally advantageous even when there is only one tile, in which case some schedules may achieve near 100% utilization despite inherent computational dependencies.
[0009] The details of one or more embodiments of the subject matter herein are set forth in the accompanying drawings and the description below. Other features, aspects, and advantages of the subject matter will become apparent from the description, drawings, and claims. [Brief description of the drawings]
[0010] [Figure 1A] FIG. 1 illustrates how the schedule can be varied to reduce the latency between two layers of a neural network. [Figure 1B] FIG. 1 illustrates a scheduling assignment for a single tile. [Diagram 2] 4 is a flow diagram of an example process for generating a schedule that reduces latency between tiles of an accelerator. [Figure 3A] FIG. 13 illustrates performing row-major ordering and then switching to column-major ordering. [Figure 3B] FIG. 13 illustrates enforcement of row-major ordering with row constraints. [Figure 4] FIG. 1 illustrates diagonal scheduling. [Diagram 5] FIG. 2 is a schematic diagram illustrating an example of a dedicated logic circuit. [Figure 6] FIG. 1 is a diagram showing an example of a tile used in an ASIC chip. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0011] Like reference numbers and designations in the various drawings indicate like elements.
[0012] This specification describes techniques for scheduling tile operations in a multi-tile accelerator, such as a machine learning accelerator, to reduce propagation latency between tiles.
[0013] As used herein, a tile refers to a device having a computational array of cells that can perform calculations on a portion of a matrix. Thus, a tile refers to any suitable accelerator configured to perform fixed-size blocks of matrix-vector multiplication. Each cell may include circuitry that enables the cell to perform mathematical or other calculations. In a typical scenario, a tile receives an input vector and uses a computational array to multiply the input vector by a weight matrix to generate an output vector.
[0014] As used herein, a schedule refers to the chronological sequence of portions of a matrix that a particular tile should act upon. Such individual portions of a matrix are also referred to as blocks herein. Thus, a schedule specifies the ordering of blocks with respect to a particular tile.
[0015] Each time a tile operates on a separate block of the matrix may be referred to as one iteration of the schedule. If the matrix fits entirely within the computation array of the tile, all matrix operations may be performed without scheduling. However, when the matrix is larger than the computation array, the system may generate a schedule that specifies the order in which the separate blocks of the matrix should be processed. For convenience, the operations of the schedule herein are considered to be assigned to clearly identifiable clock cycles. However, these clock cycles need not correspond to actual hardware clock cycles, and the same techniques may be used to assign computations to periods that include multiple hardware clock cycles.
[0016] Figure 1A shows how the schedule can be changed to reduce the latency between two layers of a neural network. The left side of Figure 1 shows a simple schedule where two tiles are used to perform the operations of two neural network layers. Nevertheless, this simple schedule has a latency that can be reduced by using the improved schedule on the right side of Figure 1.
[0017] The first layer 102 has a first weighting matrix M1 110. The operations of the first layer 102 include receiving an input vector V1 115 and multiplying the input vector 115 by the first weighting matrix 110 to generate an output vector V2 117.
[0018] In this example, the first weight matrix 110 is larger than the computation array of the first tile assigned to perform the operations of the first layer 102. The first weight matrix 110 is twice as wide and twice as tall as the computation array of the first tile. Thus, the operations of the first layer must be performed in multiple blocks over multiple clock cycles according to a specific schedule.
[0019] In the example of Fig. 1, the first schedule 106 assigns a row-major schedule to the operations of the first layer 102, which means that the first tile assigned to the first layer 102 performs two repeated operations on the top half of the first matrix 110, and then performs two repeated operations on the bottom half of the first matrix 110. In Fig. 1, the clock cycle assignments are shown on the corresponding matrix blocks. Thus, according to the first schedule, the order in which the first tile processes the first matrix 110 is to process the top half of the matrix in cycles 0 and 1, and the bottom half of the matrix in cycles 2 and 3.
[0020] The partial results of each iteration are then summed to generate output vector 117 for first tier 102. Thus, the first half of output vector 117 includes summing the partial result from clock cycle 0 with the partial result from clock cycle 2. The second half of output vector 117 includes summing the partial result from clock cycle 1 with the partial result from clock cycle 3.
[0021] The output vector 117 is then propagated through the communication hardware to a second tile assigned to perform a matrix operation of the second layer 104 with a second weight matrix M2 120. In this example, the accelerator propagation latency is assumed to be two clock cycles.
[0022] In this figure, the second tier 104 also has a row-major schedule according to the first schedule 106 .
[0023] A first tile assigned to the first layer 102 and a second tile assigned to the second layer 104 can operate simultaneously. However, inter-layer computations inherently introduce certain data dependencies and propagation latencies introduce delays that affect the time when the second layer 104 can begin operation.
[0024] In particular, the top left block of the second matrix 120 cannot be executed until both cycle 0 and cycle 2 have been executed by the first layer 102. Thus, after cycle 2 of the first layer is executed, cycles 3 and 4 will be spent propagating the left half of the output vector 117 up to the second tile that computes the second layer 104. Thus, the earliest the second layer can be computed is in cycle 5.
[0025] For the same reason, the bottom left block of the second matrix 120 in the second tier 104 cannot execute until both cycles 1 and 3 have been executed and data propagated to the first tier 102, incurring a two cycle propagation delay. Since cycle 6 has already been assigned to the top right block, the first schedule 106 assigns processing to the bottom left portion of the second matrix 120 starting with cycle 7.
[0026] Thus, FIG. 1A shows how the first schedule 106 results in a total of eight cycles when executed.
[0027] The second schedule 108 adjusts the order of execution of the first tier 102. The second schedule 108 assigns column-major ordering to the first tier 102 instead of row-major ordering.
[0028] In other words, the first layer may first operate on the top left portion of the first matrix 110 in cycle 0, and then operate on the bottom left portion of the first matrix 110 in cycle 1.
[0029] Note that at this point, the operation of the second layer 104 may immediately begin processing on the top left block of the second matrix 120. Thus, the top left block of the second matrix 120 may already be processed in cycle 4 after a two cycle propagation delay of cycle 2 and cycle 3, and the top right block of the second matrix 120 may be processed in cycle 5.
[0030] Rearranging the row / column ordering of the operations in the first layer 102 in this manner reduces the overall execution time of the two layers to seven cycles. In effect, the system was able to hide one entire cycle of propagation latency between the two tiles assigned to act on the first and second layers by changing the row / column ordering in the first layer 102. Although this is a simple example, the time savings for a single pass through layers 102 and 104 was still 12.5%.
[0031] This technique involves (1) a specific cycle M that switches the allocation direction, and (2) a specific cycle T that processes the “bottom left block” of the matrix. iThis can be generalized and improved to the problem of selecting two values, i.e., 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
[0032] For an accelerator with a propagation latency of N cycles between layer n-1 and layer n, and a propagation latency of C cycles between layer n and layer n+1, the system can reduce the propagation latency by scheduling the bottom left block of the matrix in layer n to be processed at least N cycles from the beginning of the layer and at least C cycles from the end of the layer.
[0033] The improved schedule thus switches the allocation direction after a selected cycle M. In general, M is the number of cycles T i Cycle in, or T i In cycle M, the schedule can switch block allocation from row-major to column-major order, or vice versa. This is the case in cycle T. i After , the tile continues to receive enough data to generate further output for the next layer. The techniques described below further explain how to re-orient the row / column allocation of the schedule to reduce latency for matrices of any size.
[0034] The same switch in allocation direction can also reduce latency in machine learning accelerators that have only one tile and near-zero propagation latency. For example, consider a situation where a device contains only a single tile to which the computation results for both layers have been assigned.
[0035] FIG. 1B shows the scheduling assignment for a single tile with 9 computational elements processing a 4×4 matrix in each of two layers.
[0036] The first schedule 107 shows a basic row-major ordering. A problem can arise where some computational elements have nothing to do because they are waiting for other computations to complete.
[0037] In cycle 0, all nine computational elements successfully work on the first two rows of M1 111 and the first element of the third row of M1 111. However, in cycle 1 in the first schedule 107, only seven of the nine computational elements have work to do. This is because, using a row-major schedule, the top-left corner of the second tier cannot be computed until the bottom-right corner of the first tier has been processed. Thus, it is one cycle late before the first result for the second tier 104 can be computed.
[0038] Instead, consider a second schedule 109 that uses allocation direction switching: the system can switch to column-major allocation after allocating the first column of matrix 111. Thus, instead of cycle 1, the bottom left block of matrix 111 is calculated in cycle 0. Then, the second layer operation can start immediately in cycle 1 since the bottom left block has already been processed in cycle 0.
[0039] As a result, cycle 1 in the second schedule that switched allocation directions was able to achieve 100% utilization because some elements of the computational array were able to start working on second layer operations without waiting for first layer operations to complete. The same technique can be used to improve utilization through the layers of a neural network.
[0040] 2 is a flow diagram of an example process for generating a schedule that reduces accelerator latency. For convenience, the process is described as being performed by one or more computer systems in one or more locations and suitably programmed in accordance with this specification.
[0041] The system receives 210 a request to generate a schedule for a first layer having a first matrix. The first layer may be one of multiple layers defined by an input program that specifies operations to be performed by each of the layers. In a device having multiple tiles, each layer may be assigned to a respective tile of a device having multiple tiles. Each layer may have a respective matrix. For example, the input program may specify operations of a neural network architecture.
[0042] The system allocates 220 initial blocks of the schedule according to an initial allocation direction in a first dimension. The allocation direction specifies the first dimension of the matrix along which iterations of the schedule will be executed. For example, the allocation direction may initially specify row-major ordering or column-major ordering.
[0043] The system selects the cycle for the bottom left block (230). As explained above, T i represents the cycle in which the bottom left block of the matrix is executed. This, as explained above, also applies to certain types of schedules. i By selecting , it is also possible to determine M, which is the cycle for switching the allocation direction.
[0044] In general, T i Regardless of the choice of , there is no T between layer i-1 and layer i. i The latency of 1 cycle can be hidden, and there is a latency of W i ×H i -T iThe latency of T cycles can be hidden. In other words, the system can hide the latency of T i At the expense of choosing a cycle latency, we can hide the latency in the transition from i to i+1.
[0045] Some matrices may be large enough to completely hide the propagation latency. At the end of layer i, L i Let denote the latency of the entire last layer, including not only the propagation latency but also any terminating computations or activation functions. To hide all latencies for layer i, the following inequality must hold: W i ×H i ≧L i-1 +L i W i is the width of the matrix in blocks, and H i is the height of the matrix in blocks. The block size can be determined by the tiling hardware.
[0046] When this condition is met, the system is T i L i-1 can be selected.
[0047] In other words, the system can schedule each block such that the bottom left block executes as soon as possible after the previous layer has produced the output needed to process this block.
[0048] However, not all matrices are large enough to completely hide the latency between layers. In that case, the schedule can introduce idle cycles to force waiting for results. i idle cycles, the following inequality holds for all valid schedules for tier i: W i ×H i ≧max(L i-1-S i-1 ,0)+max(L i -S i ,0).
[0049] If this inequality holds for a valid schedule, the system optimizes T according to i can be assigned. T i =max(L i-1 -S i-1 ,0)
[0050] When the system uses this mechanism with idle cycles, it programmatically selects the number of idle cycles through each layer to minimize the total delay time introduced by the idle cycles. To do so, the system may run an optimization procedure to select an integer number of idle cycles, Sk, for each layer k such that the following inequality holds: W i ×H i -max(L i -S i ,0)≧0 and S i-1 ≧L i-1 +max(L i -S i ,0)-W i ×H i
[0051] The system switches the allocation direction (240) so that each block processed after a particular block is processed sequentially along the second dimension. The selection of the switching cycle M depends on the type of schedule being used. Examples of the selection of M are described in more detail below with reference to Figures 3A-3C.
[0052] The system allocates all remaining unallocated blocks according to the switched allocation direction (250). In other words, the system can allocate all remaining unallocated blocks in an ordering according to the second dimension.
[0053] Figures 3A-4 show example schedules using switched allocation directions: In Figures 3A-3C, the numbered arrows represent lines of blocks that are assigned to be executed in a particular order.
[0054] 3A shows performing a row-major order and then switching to a column-major order: in other words, the system assigns the first processed block along the top row, then the second processed block along the second column, and so on.
[0055] In this example, cycle M occurs somewhere halfway along the fourth row of blocks. The system thus switches allocation direction and begins allocating blocks in column-major order. The system thus selects cycle T i In other words, the system can schedule the bottom left corner of the matrix to be executed in the current cycle and T i Calculate the row-major order until it equals the difference between
[0056] In the schedule shown in Figure 3A, most of the computation is performed in a column-major stage. This tends to send out the outputs at a very uniform rate, leaving some idle cycles at the end of each column. This can be advantageous when the outputs for each layer require additional processing, as is the case for LSTM, for example.
[0057] FIG. 3B illustrates performing row-major ordering with row constraints. In this example, the row-major stage processes only a limited number of blocks before moving on to the next row. In this example schedule, earlier rows contain more blocks than later rows. In some implementations, the system performs row-major ordering with N=(T i / H i -1) and calculate the row limit by calculating the value of H i is the number of blocks in each column of the matrix. The system can then use an upper bound on N for early rows and a lower bound on N for later rows.
[0058] Therefore, the bottom left block T in this example i The cycles of are given by two values of N and the number of rows in the matrix. In other words, if the matrix has 8 rows, floor(N)=3, and ceiling(N)=4, then T i = 5 × 4 + 3 × 3 - (3 - 1) = 27. In this case, the switching cycle M is given by M = 5 × 4 + 3 × 3 = 29.
[0059] The schedule of Figure 3B eliminates delays and reduces memory requirements when processing the first few columns, but may be more complicated to implement.
[0060] FIG. 4 illustrates diagonal scheduling. As shown, during row-major ordering, each row receives a decreasing number of blocks, defined by the slope of the diagonal. In this example, the system optimizes T by calculating the number of blocks needed to fill the top-left diagonal. i Select M=T i can be selected.
[0061] Diagonal schedules provide symmetry between row-major and column-major phases, but also suffer from the disadvantages of both schedules mentioned above.
[0062] FIG. 5 is a schematic diagram illustrating an example of a dedicated logic circuit, specifically an ASIC 500. The ASIC 500 includes multiple synchronous processors, referred to as tiles for simplicity. For example, one or more of the tiles 502 included by the ASIC 500 include dedicated circuitry configured to perform synchronous calculations, such as, for example, multiplication and addition operations. In particular, each cell in a computational array of cells that may be included in each tile 502 is configured to perform a mathematical operation (see, for example, the exemplary tile 200 described herein and illustrated in FIG. 6). In some implementations, the tiles 502 are arranged in a grid pattern along a first dimension 501 (e.g., rows) and a second dimension 503 (e.g., columns). For example, in the example illustrated in FIG. 5, the tiles 502 are divided into four separate sections (510a, 510b, 510c, 510d), each section containing 288 tiles arranged in an 18 (vertical) by 16 (horizontal) grid. In some implementations, the ASIC 500 shown in FIG. 5 may be understood as including a single systolic array of cells subdivided / arranged into individual tiles, each containing a subset / sub-array of cells, local memory and bus lines (see, for example, FIG. 6).
[0063] The ASIC 500 also includes a vector processing unit 504. The vector processing unit 504 includes circuitry configured to receive outputs from the tiles 502 and calculate vector computation output values based on the received outputs. For example, in some implementations, the vector processing unit 504 includes circuitry (e.g., multiplier circuits, adder circuits, shifters, and / or memories) configured to perform accumulation operations on the outputs received from the tiles 502. Alternatively, or in addition, the vector processing unit 504 includes circuitry configured to apply a non-linear function on the outputs of the tiles 502. Alternatively, or in addition, the vector processing unit 504 generates normalized numbers, pooled values, or both. The vector computation output of the vector processing unit may be stored in one or more tiles. For example, the vector computation output may be stored in a memory uniquely associated with the tiles 502. Alternatively, or in addition, the vector computation output of the vector processing unit 504 may be transferred to a circuit external to the ASIC 500, for example, as an output of the computation. In some implementations, the vector processing unit 504 is segmented, with each segment including circuitry configured to receive outputs from a corresponding set of tiles 502 and calculate a vector computation output based on the received outputs. For example, in the example shown in FIG. 5, the vector processing unit 504 includes two rows spanning along the first dimension 501, with each of the two rows including 32 segments 506 arranged in 32 columns. Circuitry (e.g., multiplication circuitry, addition circuitry, shifters, and / or memory) included in each segment 506 is configured to perform a vector computation based on the outputs (e.g., accumulated sums) from the corresponding column of tiles 502, as described herein. The vector processing unit 504 may be located in the center of a grid of tiles 502, as shown in FIG. 5. Other location arrangements of the vector processing unit 504 are also possible.
[0064] The ASIC 500 also includes a communication interface 508 (e.g., interfaces 508a, 508b). The communication interface 508 includes one or more sets of serializer / deserializer (SerDes) interfaces and general purpose input / output (GPIO) interfaces. The SerDes interfaces are configured to receive commands (e.g., commands to operate controllable bus lines, described below) and / or input data for the ASIC 500 and to output data from the ASIC 500 to external circuitry. For example, the SerDes interfaces may be configured to transmit commands and / or input data at 32 Gbps, 56 Gbps, or any suitable data rate through the set of SerDes interfaces included in the communication interface 508. The GPIO interfaces are configured to provide an interface for debugging and / or bootstrapping. For example, the ASIC 500 may execute a boot program when turned on. If the program fails, an administrator may use the GPIO interfaces to debug the cause of the failure.
[0065] The ASIC 500 further includes a communication interface 508, a vector processing unit 504, and a plurality of controllable bus lines configured to communicate data between the plurality of tiles 502 (see, e.g., FIG. 6). The controllable bus lines include, for example, wiring extending along both a first dimension 501 (e.g., rows) and a second dimension 503 (e.g., columns) of the grid. A first subset of the controllable bus lines extending along the first dimension 501 may be configured to transfer data in a first direction (e.g., to the right in FIG. 5). A second subset of the controllable bus lines extending along the first dimension 501 may be configured to transfer data in a second direction (e.g., to the left in FIG. 5). A first subset of the controllable bus lines extending along the second dimension 503 may be configured to transfer data in a third direction (e.g., up in FIG. 5). A second subset of the controllable bus lines extending along the second dimension 503 may be configured to transfer data in a fourth direction (eg, downward in FIG. 5).
[0066] Each controllable bus line includes a plurality of conveyor elements, such as flip-flops, that are used to convey data along the line by a clock signal. Forwarding data through the controllable bus line may include shifting data from a first conveyor element of the controllable bus line to an adjacent second conveyor element of the controllable bus line at each clock cycle. In some implementations, data is conveyed through the controllable bus line at a rising edge or a falling edge of the clock cycle. Data present on a first conveyor element (e.g., a flip-flop) of the controllable bus line at a first clock cycle may be transferred to a second conveyor element (e.g., a flip-flop) of the controllable bus line at a second clock cycle. In some implementations, the conveyor elements may be periodically spaced a predetermined distance from each other. For example, in some cases, each controllable bus line includes a plurality of conveyor elements, with each conveyor element being located within or proximate to a corresponding tile 502.
[0067] Each controllable bus line also includes a number of multiplexers and / or demultiplexers. The multiplexers / demultiplexers of the controllable bus lines are configured to transfer data between the bus lines and elements of the ASIC chip 500. For example, the multiplexers / demultiplexers of the controllable bus lines may be configured to transfer data between the tiles 502, the vector processing units 504, or the communication interface 508. Transferring data between the tiles 502, the vector processing units 504, and the communication interface may include sending control signals to the multiplexers based on the desired data transfer. The control signals may be stored in registers directly coupled to the multiplexers and / or demultiplexers. The value of the control signal may then determine, for example, what data is transferred from a source (e.g., an internal memory of the tile 502 or the vector processing units 504) to the controllable bus lines or how data is transferred from the controllable bus lines to a sink (e.g., an internal memory of the tile 502 or the vector processing units 504).
[0068] The controllable bus lines are configured to be controlled at a local level, with each tile, vector processing unit, and / or communication interface including its own set of control elements for operating the controllable bus lines passing through the tile, vector processing unit, and / or communication interface. For example, each tile, 1D vector processing unit, and communication interface may include a corresponding set of conveyor elements, multiplexers, and / or demultiplexers for controlling data transfer to and from that tile, 1D vector processing unit, and communication interface.
[0069] To minimize latency associated with the operation of the ASIC chip 500, the tiles 502 and vector processing units 504 may be arranged to reduce the distance that data travels between the various elements. In certain implementations, both the tiles 502 and the communication interface 508 may be separated into multiple sections, with both the tile sections and the communication interface sections arranged to reduce the maximum distance that data travels between the tiles and the communication interface. For example, in some implementations, a first group of tiles 502 may be arranged in a first section on a first side of the communication interface 508, and a second group of tiles 502 may be arranged in a second section on a second side of the communication interface. As a result, the distance from the communication interface to the furthest tile may be halved compared to a configuration in which all of the tiles 502 are arranged in a single section on one side of the communication interface.
[0070] Alternatively, the tiles may be arranged in a different number of sections, such as four sections. For example, in the example shown in FIG. 5, the tiles 502 of the ASIC 500 are arranged in a number of sections 510 (510a, 510b, 510c, 510d). Each section 510 includes a similar number of tiles 502 arranged in a grid pattern (e.g., each section 510 may include 256 tiles arranged in 16 rows by 16 columns). The communication interface 508 is also divided into a number of sections, such as a first communication interface 508a and a second communication interface 508b arranged on either side of the section 510 of the tile 502. The first communication interface 508a may be coupled to the two tile sections 510a, 510c on the left side of the ASIC chip 500 via a controllable bus line. The second communication interface 508b may be coupled to the two tile sections 510b, 510d on the right side of the ASIC chip 500 via a controllable bus line. As a result, the maximum distance that data travels to and from the communications interface 508 (and therefore the latency associated with data propagation) may be halved compared to an arrangement in which only a single communications interface is available. Other coupling arrangements between the tiles 502 and the communications interface 508 may also reduce data latency. The coupling arrangements between the tiles 502 and the communications interface 508 may be programmed by providing control signals to the conveyor elements and multiplexers of the controllable bus lines.
[0071] In some implementations, one or more tiles 502 are configured to initiate read and write operations to controllable bus lines and / or other tiles (referred to herein as "control tiles") within the ASIC 500. The remaining tiles within the ASIC 500 may be configured to perform calculations (e.g., calculate layer inference) based on input data. In some implementations, the control tiles include the same elements and arrangement as other tiles within the ASIC 500. The control tiles may be added as an extra tile or tiles, extra rows or columns, or extra columns of the ASIC 500. For example, for a symmetric grid of tiles 502 where each tile 502 is configured to perform calculations on input data, one or more additional rows of control tiles may be included to handle read and write operations for tiles 502 that perform calculations on input data. For example, each section 510 may include 18 rows of tiles, with the last two rows of the tiles including control tiles. In some implementations, providing separate control tiles increases the amount of memory available in other tiles used for calculations. A separate tile dedicated to control as described herein is not required, and in some cases a separate control tile is not provided: rather, the instructions for each tile to initiate read and write operations may be stored in the local memory of that tile.
[0072] 5 includes tiles arranged in 18 rows and 16 columns, the number of tiles 502 and their arrangement within a section may vary. For example, a section 510 may include an equal number of rows and columns in some cases.
[0073] Moreover, although the tiles 502 are shown divided into four sections in FIG. 5, they may be divided into other different groupings. For example, in some implementations, the tiles 502 are grouped into two different sections, such as a first section above the vector processing unit 504 (e.g., closer to the top of the page shown in FIG. 5) and a second section below the vector processing unit 504 (e.g., closer to the bottom of the page shown in FIG. 5). In such an arrangement, each section may contain 576 tiles, such as 32 tiles (along the vertical direction 503) by 18 tiles (along the horizontal direction 501). A section may contain a different total number of tiles and may be arranged in an array of different sizes. In some cases, the division between the sections is delineated by the hardware capabilities of the ASIC 500. For example, as shown in FIG. 5, sections 510a, 510b may be separated from sections 510c, 510d by the vector processing unit 504.
[0074] Latency may also be reduced by centrally locating the vector processing units 504 with respect to the tile sections 510. In some implementations, a first half of the tiles 502 is located on a first side of the vector processing units 504 and a second half of the tiles 502 is located on a second side of the vector processing units 504.
[0075] For example, in the ASIC chip 500 shown in FIG. 5, the vector processing unit 504 includes two sections (e.g., two rows), each of which includes a number of segments 506, as many as there are columns of the tile 502. Each segment 506 may be configured and arranged to receive an output, such as an accumulated sum, from a corresponding column of the tile 502 within the section 510 of the tile. In the example shown in FIG. 5, the tile sections 510a, 510b located on a first side of the vector processing unit 504 (e.g., above the vector processing unit 504) may be coupled to the top row of the segments 506 via controllable bus lines. The tile sections 510c, 510d located on a second side of the vector processing unit 504 (e.g., below the vector processing unit 504) may be coupled to the bottom row of the segments 506 via controllable bus lines. Moreover, each tile 502 in a first half above the processing unit 504 and each tile 502 in a second half below the processing unit 504 may be positioned the same distance from the vector processing unit 504, so there is no difference in overall latency between the two halves. For example, a tile 502 in row i (where variable i corresponds to row position) in the first section 510a and a tile 502 in row m-1-i in a second section of the tile (e.g., section 510c) may be positioned the same distance from the vector processing unit 504 (where m represents the total number of rows in each section, assuming that the rows increase along the same direction in both sections).
[0076] With tile sections 510 configured in this manner, the distance that data travels to and from vector processing units 504 (and thus the latency associated with data propagation) may be halved, as compared to an arrangement in which vector processing units 504 are located at the farthest ends (e.g., at the bottom) of all tiles 502. For example, the latency associated with receiving a sum accumulated through a column of tiles 502 from section 510a may be half the latency associated with receiving a sum accumulated through a column of tiles 502 from sections 510a and 510c. The coupling arrangement between tiles 502 and vector processing units 504 may be programmed by providing control signals to conveyor elements and multiplexers of controllable bus lines.
[0077] Activation inputs may be shifted between tiles during operation of the ASIC chip 500. For example, activation inputs may be shifted along a first dimension 501. In addition, outputs from computations by tiles 502 (e.g., outputs of computations by computation arrays internal to tile 502) may be shifted between tiles along a second dimension 503.
[0078] In some implementations, the controllable bus lines may be physically wired such that data skips tiles 502 to reduce latency associated with operation of the ASIC chip 500. For example, the output of a computation by a first tile 502 may be shifted from the first tile 502 to a second tile 502 that is at least one tile away along the second dimension 503 of the grid, thus skipping the intervening tiles. In another example, an activation input from the first tile 502 may be shifted from the first tile 502 to a second tile 502 that is at least one tile away along the first dimension 501 of the grid, thus skipping the intervening tiles. By skipping at least one tile when shifting activation input or output data, the overall data path length may be reduced, and data may be transferred faster to reduce latency (e.g., the skipped tiles do not need to utilize clock cycles to store data).
[0079] In an example implementation, each tile 502 within each column of section 510a may be configured to pass output data along the second dimension 503 toward vector processing unit 504 by controllable bus lines. The tiles 502 within each column may be further configured to pass data toward vector processing unit 504 by skipping the next adjacent tile (e.g., by physical wiring of controllable bus lines between tiles). That is, tile 502 at position (i,j)=(0,0) in the first section 510a (where variable i corresponds to a row position and variable j corresponds to a column position) may be wired to pass output data to tile 502 at position (i,j)=(2,0), similarly, tile 502 at position (i,j)=(2,0) in the first section 510a may be wired to pass output data to tile 502 at position (i,j)=(4,0), and so on. The last tile that is not skipped (e.g., tile 502 at position (i,j)=(16,0)) passes output data to vector processing unit 504. For a section 510 having 18 rows of tiles, such as the example shown in FIG. 5, skipping tiles ensures that all tiles within section 510 are at most nine "tile hops" from vector processing unit 504, thus improving performance of ASIC chip 500 by shortening data path lengths and halving data latency.
[0080] In another example implementation, each tile 502 within each row of sections 510a, 510c and each tile 502 within each row of sections 510b, 510d may be configured to pass activation inputs along the first dimension 501 through controllable bus lines. For example, some tiles within sections 510a, 510b, 510c, 510d may be configured to pass activation inputs toward the center of the grid 500 or toward the communications interface 508. The tiles 502 within each row may be further configured to skip adjacent tiles, for example, by routing controllable bus lines between the tiles. For example, tile 502 at position (i,j)=(0,0) in first section 510a (where variable i corresponds to a row position and variable j corresponds to a column position) may be configured to pass activation input to tile 502 at position (i,j)=(0,2), which in turn may be configured to pass output data to tile 502 at position (i,j)=(0,4), etc. In some cases, the last tile that is not skipped (e.g., tile 502 at position (i,j)=(0,14)) does not pass activation input to another tile.
[0081] Similarly, skipped tiles may pass activation inputs in the opposite direction. For example, tile 502 at position (i,j)=(0,15) in the first section 510a (where variable i corresponds to a row position and variable j corresponds to a column position) may be configured to pass activation inputs to tile 502 at position (i,j)=(0,13), which in turn may be configured to pass output data to tile 502 at position (i,j)=(0,11), etc. In some cases, the last tile that is not skipped (e.g., tile 502 at position (i,j)=(0,1)) does not pass activation inputs to another tile. In some implementations, skipping tiles can improve performance of the ASIC chip 500 by halving data path lengths and resulting data latencies.
[0082] As described herein, in some implementations, one or more of the tiles 502 are dedicated to storing control information. That is, tiles 502 dedicated to storing control information do not participate in operations on input data, such as weight inputs and activation inputs. The control information can include, for example, control data for configuring the controllable bus lines during operation of the ASIC chip 500, so that data can be moved around the ASIC chip 500. The control data can be provided to the controllable bus lines in the form of control signals for controlling the conveyor elements and multiplexers of the controllable bus lines. The control data specifies whether a particular conveyor element of the controllable bus line passes data to the next conveyor element of the controllable bus line, so that data is transferred between tiles according to a predetermined schedule. The control data further specifies whether to perform data transfers to or from the bus lines. For example, the control data can include control signals instructing the multiplexers to transfer data from the bus lines to memory and / or other circuitry internal to the tile. In another example, the control data may include control signals that instruct the multiplexers to transfer data from memory and / or circuitry internal to the tile to the bus lines. In another example, the control data may include control signals that instruct the multiplexers to transfer data between the bus lines and the communications interface 508 and / or between the bus lines and the vector processing unit 504. Alternatively, as disclosed herein, a dedicated control tile is not used. Rather, in such a case, the local memory of each tile stores control information for that particular tile.
[0083] FIG. 6 illustrates an example of tiles 600 for use in the ASIC chip 500. Each tile 600 includes a local memory 602 and a computation array 604 coupled to the memory 602. The local memory 602 includes a physical memory located proximate to the computation array 604. The computation array 604 includes a number of cells 606. Each cell 606 of the computation array 604 includes a circuit configured to perform a computation (e.g., multiplication and accumulation operations) based on data inputs, such as activation inputs and weight inputs for the cell 606. Each cell can perform a computation (e.g., multiplication and accumulation operations) based on cycles of a clock signal. The computation array 604 can have more rows than columns, more columns than rows, or an equal number of columns and rows. For example, in the example illustrated in FIG. 6, the computation array 604 includes 64 cells arranged in 8 rows by 8 columns. Other sizes of computation arrays are possible, such as computation arrays having 16 cells, 32 cells, 128 cells, or 256 cells, among others. Each tile may contain the same number of cells and / or the same size of computational array. Thus, the total number of operations that can be performed in parallel on an ASIC chip depends on the total number of tiles with the same size of computational array inside the chip. For example, for the ASIC chip 500 shown in FIG. 5 containing about 1150 tiles, this means that about 72,000 parallel computations are possible per cycle. Examples of clock speeds that may be used include, but are not limited to, 225 MHz, 500 MHz, 750 MHz, 1 GHz, 1.25 GHz, 1.5 GHz, 1.75 GHz, or 2 GHz. The computational array 604 of an individual tile is a subset of the larger systolic array of the tile, as shown in FIG. 1.
[0084] The memory 602 contained in the tiles 600 may include a random access memory (RAM), such as, for example, an SRAM. Each memory 602 may be configured to store 1 / n of the total memory associated with the n tiles 502 of the ASIC chip shown in FIG. 5. The memory 602 may be provided as a single chip or in multiple chips. For example, the memory 602 shown in FIG. 6 is provided as four single-port SRAMs, each of which is coupled to a computation array 604. Alternatively, the memory 602 may be provided as two single-port SRAMs or eight single-port SRAMs, among other configurations. The combined capacity of the memory may be, for example, but not limited to, 16 kB, 32 kB, 64 kB, or 128 kB after error correction coding. By providing the physical memory 602 locally to the computation array, the wiring density of the ASIC 500 may be significantly reduced in some implementations. In an alternative configuration where memory is centralized inside the ASIC 500, as opposed to being provided locally as described herein, a wire would be required for each bit of memory bandwidth, and the total number of wires required to cover each tile of the ASIC 500 would far exceed the available space inside the ASIC 100. In contrast, providing dedicated memory for each tile can significantly reduce the total number of wires required to span the area of the ASIC 500.
[0085] The tile 600 also includes controllable bus lines. The controllable bus lines may be categorized into a number of different groups. For example, the controllable bus lines may include a first group of general purpose controllable bus lines 610 configured to transfer data in respective cardinal directions between tiles. That is, the first group of controllable bus lines 610 may include a bus line 610a configured to transfer data in a first direction (referred to as "East" in FIG. 6) along a first dimension 501 of the grid of tiles, a bus line 610b configured to transfer data in a second direction (referred to as "West" in FIG. 6) opposite the first direction along the first dimension 101 of the grid of tiles, a bus line 610c configured to transfer data in a third direction (referred to as "North" in FIG. 6) along the second dimension 103 of the grid of tiles, and a bus line 610d configured to transfer data in a fourth direction (referred to as "South" in FIG. 6) opposite the third direction along the second dimension 103 of the grid of tiles. The general-purpose bus lines 610 may be configured to carry control data, activation input data, data to and from the communication interface, data to and from the vector processing unit, data stored in and / or used by the tile 600 (e.g., weight inputs). The tile 600 may include one or more control elements 621 (e.g., flip-flops and multiplexers) for controlling the controllable bus lines and thus routing data to and from the memory 602.
[0086] The controllable bus lines may also include a second group of controllable bus lines, referred to herein as computation array partial sum bus lines 620. The computation array partial sum bus lines 620 may be configured to carry data output from computation by the computation array 604. For example, as shown in FIG. 6, the bus lines 620 may be configured to carry partial sum data obtained from rows of the computation array 604. In such a case, the number of bus lines 620 would match the number of rows of the array 604. For example, there may be eight partial sum bus lines 620 for an 8×8 computation array, each coupled to an output of a corresponding row in the computation array 604. The computation array output bus lines 620 may be further configured to couple to this tile, e.g., as an input to a computation array of another tile within the ASIC chip. For example, the array partial sum bus lines 620 of the tile 600 may be configured to receive an input (e.g., partial sum 620a) of a computation array of a second tile located at least one tile away from the tile 600. The outputs of the computation arrays 604 are then added to the partial sum lines 620 to generate new partial sums 620b, which may be output from the tile 600. The partial sums 620b may then be passed to another tile or to a vector processing unit. For example, each bus line 620 may be coupled to a corresponding segment of a vector processing unit (such as segment 506 in FIG. 5).
[0087] As described with reference to FIG. 5, the controllable bus lines can include circuits such as conveyor elements (e.g., flip-flops) configured to allow data to be transmitted along the bus lines. In some implementations, each controllable bus line includes a corresponding conveyor element for each tile. As further described with reference to FIG. 5, the controllable bus lines can include circuits such as multiplexers configured to allow data to be transferred between separate tiles of the ASIC chip, vector processing units, and communication interfaces. The multiplexers can be located wherever there is a source or sink for data. For example, in some implementations, as shown in FIG. 6, control circuitry 621 such as multiplexers can be located at the intersections of the controllable bus lines (e.g., at the intersections of generic bus lines 610a and 610d, at the intersections of generic bus lines 610a and 610c, at the intersections of generic bus lines 610b and 610d, and / or at the intersections of generic bus lines 610b and 610c). Multiplexers at the intersections of the bus lines may be configured to transfer data between the bus lines at the intersections. Thus, by appropriate operation of the multiplexers, the direction in which data travels across the controllable bus lines may be changed. For example, data traveling along the first dimension 101 on the generic bus line 610a may be transferred to the generic bus line 610d to travel along the second dimension 103 instead. In some implementations, the multiplexers may be located adjacent to the memory 602 of the tile 600 such that the multiplexers can transfer data to and from the memory 602.
[0088] The subject matter and embodiments of the functional operations described herein may be implemented in digital electronic circuitry, tangibly embodied computer software or firmware, computer hardware including the structures disclosed herein and their structural equivalents, or one or more combinations thereof. The subject matter described herein may be implemented as one or more computer programs, i.e., as one or more modules of computer program instructions encoded on a tangible, non-transitory storage medium for execution by or for controlling the operation of a data processing apparatus. The computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random access memory device or a serial access memory device, or one or more combinations thereof. Alternatively, or in addition, the program instructions may be encoded based on artificially generated and propagated signals, such as machine-generated electrical, optical, or electromagnetic signals to encode information for transmission to an appropriate receiving device for execution by the data processing apparatus, for example.
[0089] The term "data processing apparatus" refers to data processing hardware and encompasses any kind of apparatus, device, and machine for processing data, including, by way of example, a programmable processor, a computer, or multiple processors or computers. A data processing apparatus may also be or further include special purpose logic circuitry, e.g., an FPGA (field programmable gate array), or an ASIC (application specific integrated circuit). In addition to hardware, a data processing apparatus may optionally include code that creates an execution environment for a computer program, e.g., code that constitutes a processor's firmware, a stack of protocols, a database management system, an operating system, or one or more combinations thereof.
[0090] A computer program (which may also be referred to or described as a program, software, software application, app, module, software module, script, or code) may be written in any type of programming language, including compiled or interpreted, declarative or procedural, and may be distributed in any form, either as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A computer program may correspond to a file in a file system, but this is not required. A program may be stored in part of a file that holds other programs or data, e.g., one or more scripts stored in a markup language document, in a single file dedicated to the program in question, or in multiple integrated files, e.g., files that store one or more modules, subprograms, or code portions. A computer program may be distributed to be executed on one computer or on multiple computers located at one site or distributed across multiple sites and interconnected by a data communication network.
[0091] With reference to a system of one or more computers configured to perform particular operations or actions, it means that the software, firmware, hardware, or combination thereof is installed and, when activated, causes the system to perform the operations or actions. With reference to one or more computer programs configured to perform particular operations or actions, it means that the one or more programs contain instructions that, when executed by a data processing device, cause the device to perform the operations or actions.
[0092] As used herein, "engine" or "software engine" refers to a software-implemented input / output system that provides an output that is distinct from an input. An engine may be an encoded block of functionality, such as a library, a platform, a software development kit ("SDK"), or an object. Each engine may be implemented on any suitable type of computing device, such as, for example, a server, a mobile phone, a tablet computer, a notebook computer, a music player, an e-book reader, a laptop or desktop computer, a PDA, a smartphone, or other fixed or portable device that includes one or more processors and a computer-readable medium. In addition, two or more engines may be implemented on the same computing device or on separate computing devices.
[0093] The process and logic flows described herein may be performed by one or more programmable computers executing one or more computer programs to perform functions by operating on input data and generating output. The process and logic flows may also be performed by special purpose logic circuitry, e.g., FPGAs, ASICs, or a combination of special purpose logic circuitry and one or more programmed computers.
[0094] A computer suitable for executing a computer program may be based on a general-purpose or special-purpose microprocessor, or both, or any other type of central processing unit. In general, the central processing unit receives instructions and data from a read-only memory, or random access memory, or both. The essential elements of a computer are a central processing unit for implementing or executing instructions and one or more storage devices for storing instructions and data. The central processing unit and memory may be supplemented by or incorporated in special-purpose logic circuitry. In general, a computer also includes one or more mass storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, or is operatively coupled to receive data from or transfer data to them, or both. However, a computer need not have such devices. Moreover, a computer may be incorporated in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a mobile storage device (e.g., a Universal Serial Bus (USB) flash drive), to name just a few.
[0095] Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile storage devices including, by way of example, semiconductor memory devices such as EPROM, EEPROM, and flash memory devices, magnetic disks such as internal hard disks, removable disks, magneto-optical disks, and CD-ROM and DVD-ROM disks.
[0096] To provide for user interaction, embodiments of the subject matter described herein may be implemented on a computer having a display device, e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor, for displaying information to the user, as well as a keyboard and a pointing device, e.g., a mouse, trackball, or presence-sensitive display or other surface, through which the user can provide input to the computer. Other types of devices may be used to provide for user interaction as well, e.g., feedback provided to the user may be any form of sensory feedback, e.g., visual feedback, auditory feedback, haptic feedback, and input from the user may be received in any form, including acoustic, speech, or tactile input. In addition, a computer may interact with a user by sending documents to and receiving documents from a device the user is using, e.g., by sending a web page to a web browser on the user's device in response to a request received from the web browser. A computer may also interact with a user by sending text messages or other forms of messages to a personal device, e.g., a smartphone running a messaging application, and receiving a response message in return from the user.
[0097] An embodiment of the subject matter described herein may be implemented in a computer system that includes a back-end component, e.g., as a data server, or a middleware component, e.g., an application server, or a front-end component, e.g., a client computer having a graphical user interface, a web browser, or an application that allows a user to interact with an implementation of the subject matter described herein, or any combination of one or more such back-end, middleware, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include local area networks (LANs) and wide area networks (WANs), e.g., the Internet.
[0098] A computer system may include clients and servers. Generally, clients and servers are remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of respective computer programs running on the respective computers having a client-server relationship to each other. In some embodiments, the server transmits data, e.g., HTML pages, to a user device, e.g., to display data to a user interacting with the device acting as a client and to receive user input. Data generated at the user device, e.g., a result of a user interaction, may be received from the device at the server.
[0099] In addition to the above-mentioned embodiments, the following embodiments are also innovative.
[0100] In embodiment 1, receiving a request to generate a schedule for a first tier of a program to be executed by an accelerator configured to perform matrix operations at least partially in parallel, the program defining a number of tiers including the first tier, each tier of the program defining a matrix operation to be performed using a respective matrix of values; allocating a number of initial blocks of the schedule according to an initial allocation direction, the initial allocation direction specifying a first dimension of a first matrix for a first tier in which the number of initial blocks are to be executed; - selecting a specific cycle for processing the last block of the matrix that is required before starting processing of the next layer; switching the allocation direction such that the blocks processed after the selected particular cycle are processed along a different second dimension of the first matrix; allocating all remaining unallocated blocks according to the switched allocation direction; The method includes:
[0101] Embodiment 2 is the method of embodiment 1, wherein the step of selecting a particular cycle comprises: Calculating the propagation latency of the previous layer; assigning a particular cycle based on the propagation latency of the previous layer; The method includes:
[0102] Embodiment 3 is the method of embodiment 1 or 2, wherein the step of selecting a particular cycle comprises: Calculating the propagation latency of the previous layer; calculating the number of idle cycles of the previous layer; selecting a maximum value between the propagation latency of the previous layer and the number of idle cycles of the previous layer; The method includes:
[0103] Embodiment 4 is a method according to any one of embodiments 1 to 3, wherein the schedule allocates the initial blocks in row-major order, and the step of allocating all remaining unallocated blocks allocates the blocks in column-major order.
[0104] Embodiment 5 is a method according to embodiment 4, further comprising a step of selecting a cycle in which to switch the allocation direction, the step including a step of selecting a cycle in which the number of unscheduled rows is equal to the difference between the current cycle and the selected specific cycle.
[0105] Example 6 is the method according to example 4, in which the schedule allocates the initial blocks along only partial rows of the matrix.
[0106] Example 7 is the method according to Example 6, in which the schedule allocates an initial number of partial rows and a subsequent number of partial rows that are smaller than the initial number of partial rows.
[0107] Embodiment 8 is a method according to embodiment 7, wherein the initial partial row has a length given by ceiling(N) and the subsequent partial row has a length given by floor(N), where N is given by dividing the selected cycle by the block height of the matrix in the previous layer.
[0108] Example 9 is the method of example 4, wherein the schedule allocates initial blocks in row-major order to fill a space defined by a diagonal of the matrix.
[0109]
[0023] Example 10 is the method of example 9, wherein the step of switching the allocation direction occurs at a specific selected cycle.
[0110] An eleventh embodiment is a method according to any one of the first to tenth embodiments, wherein the accelerator has a plurality of tiles, and each layer is calculated by a respective tile of the plurality of tiles.
[0111]
[0023] Example 12 is a method according to any one of examples 1 to 10, wherein the accelerator has a single tile that performs operations of both layers.
[0112] Embodiment 13 is a system comprising one or more computers and one or more storage devices storing instructions, wherein the one or more computers execute the instructions to perform the method of any one of embodiments 1 to 12.
[0113] Embodiment 14 is a computer storage medium encoded with a computer program, the computer storage medium causing a data processing device to execute instructions contained in the computer program to perform the method of any one of embodiments 1 to 12.
[0114] Although this specification contains many specific implementation details, these should not be construed as limitations on the scope of any invention or on the scope of what may be claimed, but rather as descriptions of features that may be specific to certain embodiments of a particular invention. Certain features described in the context of individual embodiments of this specification may also be implemented in combination in one embodiment. Conversely, various features described in the context of one embodiment may also be implemented separately in multiple embodiments or in any suitable subcombination. Moreover, although each feature is described above as working in a combination and in some cases originally claimed as such, one or more features of a claimed combination may in some cases be realized from the combination, and the claimed combination may be directed to a subcombination or a variation of the subcombination.
[0115] Similarly, although operations are shown in the figures in a particular order, this should not be understood as requiring that such operations be performed in the particular order or sequential order shown, or that all of the illustrated operations be performed, to achieve desirable results. In certain environments, multitasking and parallel processing may be advantageous. Moreover, it should be understood that the separation of various system modules and components in the above-described embodiments should not be understood as requiring such separation in all embodiments, and that the described program components and systems may generally be integrated together in a single software product or packaged in multiple software products.
[0116] Particular embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. For example, the actions recited in the claims can be performed in a different order and still achieve desirable results. By way of example, the processes depicted in the accompanying figures do not necessarily require the particular order or sequence shown to achieve desirable results. In certain instances, multitasking and parallel processing may be advantageous. [Explanation of symbols]
[0117] 102 First Layer 104 Second Layer 106 First Schedule 107 First Schedule 108 Second Schedule 109 Second Schedule 110 First Weight Matrix 111 Matrix 115 Input Vectors 117 Output Vector 119 Output Vector 120 Second Weight Matrix 121 Matrix 500 ASIC 501 The First Dimension 502 tiles 503 The Second Dimension 504 Vector Processing Unit 506 Segments 508 Communication Interface 508a Communication Interface 508b Communication Interface Section 510a Section 510b 510c Section 510d Section 600 tiles 602 Local Memory 604 Calculation Array 606 Cell 610a Bus Line 610b Bus Line 610c Bus Line 610d Bus Line 620 Partial Sum Bus Line 620a partial sum 620b partial sum 621 Control Elements
Claims
1. Receiving a request to generate a schedule for a first tier of a program to be executed by a hardware circuit, the program defining a number of tiers including the first tier, each tier of the program defining a matrix operation to be performed using a respective matrix of values; allocating a plurality of initial blocks of the schedule according to an initial allocation direction, the initial allocation direction specifying a first dimension of a first matrix for the first tier in which the plurality of initial blocks of the schedule are to be executed; selecting a specific cycle for processing the last block of the matrix that is required before starting processing of the next layer; switching the allocation direction such that blocks processed after the selected particular cycle are processed along a different second dimension of the first matrix; allocating unallocated blocks according to the switched allocation direction; [0023] 2. The hardware circuitry configured to perform operations including:
2. Selecting the particular cycle Calculating the propagation latency of the previous layer; assigning the particular cycle based on the propagation latency of the previous layer; The hardware circuit of claim 1 , comprising:
3. Selecting the particular cycle Calculating the propagation latency of the previous layer; calculating a number of idle cycles of the previous layer; selecting a maximum value between the propagation latency of the previous layer and the number of idle cycles of the previous layer; The hardware circuit of claim 1 , comprising:
4. The hardware circuit of claim 1, wherein the multiple initial blocks of the schedule are assigned in row-major order, and allocating the unassigned blocks includes allocating the unassigned blocks in column-major order.
5. 5. The hardware circuit of claim 4, further comprising: selecting a cycle for switching the allocation direction, the cycle comprising selecting a cycle in which a number of unscheduled rows is equal to a difference between a current cycle and the selected particular cycle.
6. The hardware circuit of claim 4 , wherein the initial blocks of the schedule are allocated along only partial rows of the matrix.
7. The hardware circuit of claim 6 , wherein the schedule allocates an initial number of partial rows and subsequent number of partial rows that are smaller than the initial number of partial rows.
8. 8. The hardware circuit of claim 7, wherein the initial partial row has a length given by ceiling(N) and the subsequent partial row has a length given by floor(N), where N is given by dividing the selected cycle by a block height of a matrix in a previous layer.
9. 5. The hardware circuit of claim 4, wherein the initial blocks of the schedule are allocated in the row-major order to fill a space defined by a diagonal of the matrix.
10. 10. The hardware circuit of claim 9, wherein the switching of allocation direction occurs at the particular selected cycle.
11. The hardware circuit of claim 1 , wherein the hardware circuit has a plurality of tiles, and each layer is computed by a respective tile of the plurality of tiles.
12. The hardware circuit of claim 1 , wherein the hardware circuit comprises a single tile that performs operations of both layers.
13. One or more non-transitory machine-readable storage devices of a hardware circuit that store instructions that, when executed by one or more processing devices, cause the following operations to be performed: receiving a request to generate a schedule for a first tier of a program to be executed by the hardware circuit, the program defining a number of tiers including the first tier, each tier of the program defining a matrix operation to be performed using a respective matrix of values; allocating a plurality of initial blocks of the schedule according to an initial allocation direction, the initial allocation direction specifying a first dimension of a first matrix for the first tier in which the plurality of initial blocks of the schedule are to be executed; selecting a specific cycle for processing the last block of the matrix that is required before starting processing of the next layer; switching the allocation direction such that blocks processed after the selected particular cycle are processed along a different second dimension of the first matrix; allocating unallocated blocks according to the switched allocation direction; A non-transitory machine-readable storage device comprising:
14. The method of claim 13, wherein the step of selecting the particular cycle comprises the steps of: Calculating the propagation latency of the previous layer; assigning the particular cycle based on the propagation latency of the previous layer; 14. The non-transitory machine-readable storage device of claim 13, comprising:
15. The method of claim 1, wherein selecting the particular cycle comprises: Calculating the propagation latency of the previous layer; calculating a number of idle cycles of the previous layer; selecting a maximum value between the propagation latency of the previous layer and the number of idle cycles of the previous layer; 14. The non-transitory machine-readable storage device of claim 13, comprising:
16. The non-transitory machine-readable storage device of claim 13, wherein the multiple initial blocks of the schedule are allocated in row-major order, and wherein allocating the unallocated blocks includes allocating the unallocated blocks in column-major order.
17. The non-transitory machine-readable storage device of claim 16, further comprising selecting a cycle in which to switch the allocation direction, the cycle comprising selecting a cycle in which a number of unscheduled rows is equal to a difference between a current cycle and the selected particular cycle.
18. The non-transitory machine-readable storage device of claim 16, wherein the initial blocks of the schedule are allocated along only partial rows of the matrix.
19. The non-transitory machine-readable storage device of claim 16, wherein the schedule allocates an initial number of partial rows and a subsequent number of partial rows that are smaller than the initial number of partial rows.
20. The non-transitory machine-readable storage device of claim 19, wherein the initial partial row has a length given by ceiling(N) and the subsequent partial row has a length given by floor(N), where N is given by dividing the selected cycle by a block height of a matrix in a previous layer.
21. The non-transitory machine-readable storage device of claim 16, wherein the initial blocks of the schedule are allocated in row-major order to fill a space defined by a diagonal of the matrix.
22. The non-transitory machine-readable storage device of claim 21, wherein switching the allocation direction occurs at the particular selected cycle.
Citation Information
Patent Citations
Accelerating convolutional neural network computation throughput
JP2019079505A
Arithmetic processing apparatus and method in deep running system
KR1020190093932A
System and method for speeding up general matrix-matrix multiplication on the GPU
US20170344514A1
Accelerated mathematical engine
US20190026078A1
Parallel execution of gated activation unit operations
WO2019078885A1
