SYSTOLIC ARRAY-BASED DATA PROCESSING METHOD, COMPUTING APPARATUS, AND COMPUTER PROGRAM
The method optimizes systolic array operations for shallow depth models by aligning input and output depths and connection quantities, enhancing data movement and computational efficiency, addressing inefficiencies in existing systolic array structures.
Patent Information
- Application Number
- JP2023547488
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-02-26
- Filing Date
- 2022-02-21
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2042-02-21
AI Technical Summary
Systolic array structures are inefficient in utilizing and moving data for shallow depth models due to mismatched input and output depths, leading to reduced computational efficiency and increased data movement costs.
A data processing method and device that optimizes systolic array operations by determining target input and output depths, input and output connection quantities, and batch processing input and output data to align with shallow depth model requirements, enhancing data movement and computational efficiency.
Improves the utilization efficiency of systolic arrays for shallow depth models by optimizing data movement and computation, reducing computational delays and total cost of ownership.
Smart Images

Figure 0007551223000014 
Figure 0007551223000001 
Figure 0007551223000003
Abstract
Description
[Technical field]
[0001] This application claims priority to a Chinese patent application filed with the China Patent Office on February 26, 2021, bearing application number 202110219814.4 and entitled "Method and apparatus for computational optimization of shallow depth model based on systolic array," the entire contents of which are incorporated herein by reference.
[0002] The present disclosure relates to the field of computers, and more particularly to systolic array based data processing methods, apparatus, media, and program products. [Background technology]
[0003] In the data processing field, many data processing processes, such as deep learning processes, can be performed by convolutional neural networks (CNNs), which require a large number of calculation steps, most of which are multiply-add operations.
[0004] Systolic array structures are currently used to realize many multiplication and accumulation processes. The systolic array structure includes a calculation unit (represented by PE, each PE includes a multiplication and accumulation unit or a similar calculation device and a storage unit) installed at each row and each column node, and its advantage is that it can process the operands or intermediate results involved in the internal calculation in a fast parallel pipeline manner, that is, it can realize simple and efficient systolic transmission throughout the array for each part of input data (data input to each row) and the calculation result of each PE, which has the effect of improving data multiplexing, reducing off-chip data movement, and reducing bandwidth demand. Therefore, single or multiple two-dimensional systolic arrays are used in large quantities in artificial intelligence (AI) processors such as TPUs as the calculation core of multiplication and accumulation operations. Summary of the Invention [Problem to be solved by the invention]
[0005] To solve the above problems, embodiments of the present disclosure provide a data processing method, apparatus, medium, and program product based on a systolic array. [Means for solving the problem]
[0006] According to one aspect of the present disclosure, there is provided a data processing method based on a systolic array, the method including the steps of: determining a standard input depth and a standard output depth of the systolic array, and determining a target input depth and a target output depth of a shallow depth model, determining an input connection quantity for the systolic array based on the target input depth and the standard input depth, and determining an output connection quantity for the systolic array based on the target output depth and the standard output depth, generating input data of the input connection quantity, inputting the input data of the input connection quantity into an input buffer of the systolic array in batches so as not to overlap with each other, processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data, each input data having the target input depth and each output data having the target output depth, and outputting the output data of the output connection quantity in the output buffer in batches when a quantity of output data received by an output buffer of the systolic array from the systolic array reaches the output connection quantity.
[0007] According to another aspect of the present disclosure, a computing device is provided that may include a controller, a data retriever, a systolic array, an input buffer, and an output buffer, the controller determining a standard input depth and a standard output depth of the systolic array, Shallow depth modeldetermining a target input depth and a target output depth, the controller determines an input connection quantity for the systolic array based on the target input depth and a standard input depth, and determines an output connection quantity for the systolic array based on the target output depth and a standard output depth, the controller controls the data acquirer to acquire and generate input data of the input connection quantity, input the input data of the input connection quantity to an input buffer of the systolic array in batches so as not to overlap with each other, controls the systolic array to process the input data in the input buffer and generate output data corresponding to each input data, and when a quantity of output data received by an output buffer of the systolic array from the systolic array reaches the output connection quantity, controls an output buffer to output the output data of the output connection quantity in batches, wherein each input data has the target input depth and each output data has the target output depth.
[0008] According to another aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon instructions or code which, when executed by a processor, cause the controller of a computing device to perform operations as described above.
[0009] According to another aspect of the present disclosure there is provided a computer program product comprising instructions or code which, when executed by a computing device, causes the data processing method as defined above to be performed.
[0010] In order to more clearly describe the configuration of the embodiments of the present disclosure, the drawings necessary for the description of the embodiments are briefly introduced below. The drawings in the following description are merely exemplary embodiments of the present disclosure. [Brief description of the drawings]
[0011] [Figure 1] 1 shows a schematic diagram of a systolic array-based computing device configuration according to an embodiment of the present disclosure. [Diagram 2]2 shows a flow diagram of a systolic array based data processing method 200 according to an embodiment of the present disclosure. [Diagram 3] 3 shows a schematic diagram of an exemplary flow of steps of the method shown in FIG. 2. [Figure 4A] Here is one concrete example. [Figure 4B] Here is one concrete example. [Diagram 5] 3 shows a schematic diagram of an exemplary flow of steps of the method shown in FIG. 2. [Figure 6] Here is one concrete example. [Figure 7] 3 shows a schematic diagram of an exemplary flow of steps of the method shown in FIG. 2. [Figure 8A] One case of the flow shown in FIG. 7 and one corresponding concrete example will be described. [Figure 8B] One case of the flow shown in FIG. 7 and one corresponding concrete example will be described. [Figure 9A] Another case of the flow shown in FIG. 7 and another specific example corresponding thereto will be described. [Figure 9B] Another case of the flow shown in FIG. 7 and another specific example corresponding thereto will be described. [Figure 9C] Another case of the flow shown in FIG. 7 and another specific example corresponding thereto will be described. [Figure 9D] Another case of the flow shown in FIG. 7 and another specific example corresponding thereto will be described. [Figure 10A] Another case of the flow shown in FIG. 7 and another corresponding concrete example will be described below. [Figure 10B] Another case of the flow shown in FIG. 7 and another corresponding concrete example will be described below. [Figure 10C] Another case of the flow shown in FIG. 7 and another corresponding concrete example will be described below. [Figure 10D] Another case of the flow shown in FIG. 7 and another corresponding concrete example will be described below. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0012] In order to make the object, configuration, and advantages of the present disclosure more clear, exemplary embodiments according to the present disclosure will be described in detail below with reference to the drawings. Obviously, the described embodiments are only some embodiments of the present disclosure, and are not all embodiments of the present disclosure. It should be understood that the present disclosure is not limited by the exemplary embodiments described herein.
[0013] In the present specification and drawings, steps and elements that are essentially the same or similar are represented by the same or similar reference numerals, and repeated description of these steps and elements is omitted. In addition, in the description of the present disclosure, the terms "first", "second", etc. are merely used for distinguishing and describing, and cannot be understood as indicating or implying relative importance or rank.
[0014] Deep learning (also called deep structured learning or layered learning) is part of a broader family of machine learning methods based on artificial neural networks. Learning can be supervised, semi-supervised, or unsupervised.
[0015] As described above, deep learning may process data by, for example, a convolutional neural network (CNN). The convolutional neural network (CNN) is mainly composed of an input layer, a convolutional layer, an activation function, a pooling layer, a fully connected layer, and a loss function, and each intermediate layer (e.g., a convolutional layer, a pooling layer) may be multiple. The calculation of the convolutional layer involves a large amount of multiplication and accumulation of data. For this reason, the calculation process of the convolutional layer can be realized by a systolic array structure. It should be noted that, in the context of this disclosure, the systolic array structure is applied to the calculation of the convolutional layer as an example, but the systolic array structure can also be applied to any matrix calculation.
[0016] Before describing the embodiments of the present disclosure in detail, a brief introduction to some of the terms used herein will be provided.
[0017] Shallow depth model (also called "shallow depth model" or "shallow deep model")is a lightweight model used in deep learning to generate output data based on input data, and the depth of the input data and output data is generally small. The computation process of this shallow depth model is realized based on a systolic array, which will be described below.
[0018] A systolic array has multiple calculation units arranged in rows and columns, and the calculation units include, for example, multiplier-accumulator calculation elements (for example, realized by multiply-accumulators) to perform matrix multiplication, which is the basic calculation unit of a neural network. These calculation units are connected to each other with conductors, and necessary buffers are incorporated into the calculation units and connected to buffers outside the calculation units. array are named after the contractile function of the heart, and like blood flow, data is "pumped" through these computational units.
[0019] FIG. 1 shows a schematic diagram of a systolic array-based computing device 100 according to an embodiment of the present disclosure.
[0020] As shown in FIG. 1, a computing device 100 includes a controller 101 , a data acquirer 102 , a systolic array 103 , an input buffer 104 , and an output buffer 105 .
[0021] In the embodiment of the present disclosure, for convenience of explanation, only one controller 101 is shown in FIG. 1, but as should be understood by those skilled in the art, the controller may be a collective term for multiple control modules that control all operations of the computing device 100 in a coordinated manner. The controller 101 here may refer to one or more of a global controller for global control, and various types of control logic or control circuits that control the operations of a data acquirer, an input buffer, and an output buffer, or may refer to a combination of a multiplier-accumulator in a computing unit. For example, the global controller may be arranged with a function of, for example, command analysis and parameter setting to provide execution parameters to the data acquirer 102, the input buffer 104, the output buffer 105, etc. The control logic corresponding to the input buffer 104 can control the buffered input data to be sent to the systolic array 103. The control logic corresponding to the output buffer can control the output data of the systolic array 103 to be buffered in the output buffer and the output data to be output from the output buffer.
[0022] The systolic array 103 may be a computation unit array (hereinafter, sometimes used interchangeably with systolic array) and may have a standard input depth and a standard output depth. Here, the number of rows and the number of columns of the computation unit array correspond to the standard input depth and the standard output depth, respectively. In other words, the standard input depth is the number of rows of the computation unit array, and the standard output depth is the number of columns of the computation unit array. In some embodiments, the number of rows and the number of columns of the computation unit array may be equal to the standard input depth and the standard output depth, respectively. In some other embodiments, the number of rows and the number of columns of the computation unit array may be greater than the standard input depth and the standard output depth, respectively, to substitute or make redundant computation units in some rows and columns. This disclosure is not limited thereto. It should be noted that in different situations, the standard input depth and the standard output depth of the computation unit array may be different. For example, different types of AI processors including computation unit arrays may select computation unit arrays of 16×32, 32×32, etc.
[0023] The computation unit array (systolic array) 103 may include at least one row of computation units, with each row of computation units including at least two computation units 103a, and two adjacent computation units 103a of each row of computation units being connected.
[0024] The input buffer 104 buffers at least one input data from the data acquirer 102 to be calculated by the systolic array. The input buffer 104 may buffer each calculation parameter for calculation. The calculation parameter may be provided from the data acquirer 102 directly to the systolic array 103 or provided to the systolic array 103 via the input buffer 104. Each input data may also have a depth (may be considered to include multiple parts of input data or multiple channels of input data). The input buffer 104 may also include multiple (e.g., equal to the number of rows of the systolic array) sub-input buffers (not shown), each of which is for providing one part of input data to a calculation unit in one row of the systolic array. For example, if the depth of a certain input data is m (m is an integer equal to or greater than 1), the input data may be considered to include m parts of input data or m channels of input data. The m parts of input data are buffered in the m sub-input buffers according to the input format and timing required for the systolic array. The m sub-input buffers input the m portions of input data to m rows of the systolic array, respectively, in accordance with the timing of the systolic array.
[0025] The controller 101 (e.g., a control logic corresponding to the input buffer 104) can control the input data in the input buffer 104 to be input to the calculation unit 103a in the corresponding row. Here, the calculation unit 103a in each row transmits each part of the received input data within the calculation unit 103a in the corresponding row. For example, in the case of the calculation unit 103a in the first row and first column, when it receives one part of the input data from the first sub-input buffer, it transmits this part of the input data to the calculation unit in the second column of the first row, and so on in a systolic manner. The times at which the first calculation unit 103a in the adjacent rows receives each part of the input data are shifted by one clock.
[0026] Each calculation unit 103a in the systolic array 103 is for performing calculations on one portion of input data received and corresponding calculation parameters (e.g., weight coefficients of convolution kernels in a CNN model). For each column of the systolic array 103, the calculation results of each calculation unit 103a in the column are overlapped (i.e., accumulated) (from bottom to top in the figure) to obtain output data in the last calculation unit 103a in each column (the m-th row of each column), and the output data of the column is output to the output buffer 105. It should be noted that the calculation parameters may be updated as necessary, and only need to be used by the corresponding calculation unit when each calculation unit of the systolic array performs a calculation task. For example, depending on the setting manner of the systolic array, for the calculation of each input data, the calculation parameters in each calculation unit may be pre-stored in the calculation unit, or may be systolicly transmitted to each calculation unit during calculation with the same clock and different direction (mutually perpendicular) as the systolic transmission of the input data. This is the same as the general principle of the systolic array.
[0027] Similarly, the output buffer 105 may include multiple sub-output buffers for buffering the output data output from the last calculation unit 103a in each row. The controller 101 (e.g., control logic corresponding to the output buffer) can control the output buffer 105 (or multiple sub-output buffers) to output these output data in batches, for example, to provide them to a subsequent storage device, or to move data from the output buffer 105 to the input buffer 104 to prepare for subsequent calculation.
[0028] In the embodiment of the present disclosure, taking a CNN model as an example, the input data of each part input to each calculation unit and the convolution kernel in the provided calculation unit may be a two-dimensional data matrix. For example, taking the case where the CNN model is used to perform an image processing process and the convolution kernel is the feature weight in the CNN model as an example, when performing the convolution calculation, the input data is an image feature map tensor (stored in NHWC format, where N is the number of images in this batch, H is the number of pixels in the vertical direction of the image, W represents the number of pixels in the horizontal direction, and C represents the number of channels). That is, each input data is feature data extracted from an image, and can be represented by the number of pixels in the vertical direction H, the number of pixels in the horizontal direction W, and the number of channels C. The input data of each part of the input data (depth C) may be a data matrix of 10 (H) x 10 (W), that is, the data matrix is divided into 10 rows, and each row contains 10 data elements. Accordingly, each convolution kernel may be a 3×3 weight matrix, i.e., the weight matrix is divided into three rows, each row includes three weight elements, and each weight element is a weight value for multiplying with a data element. For illustrative purposes, only two-dimensional data is exemplified for the above input data and convolution kernel, but in practical applications, the above input data and convolution kernel may be three-dimensional data.
[0029] In the computation unit array shown in the embodiment of the present disclosure, each computation unit in a row of computation units has its own computation parameters stored in advance, and when performing a calculation, the computation unit array 103 may sequentially input a portion of input data corresponding to a computation unit in a row to each computation unit in the row in a pipeline manner, and each computation unit may perform a calculation on the portion of input data and the corresponding computation parameters.
[0030] The above describes a schematic diagram of the configuration and general calculation process of a computing device 100 based on a systolic array according to an embodiment of the present disclosure with reference to Fig. 1. The computing device 100 can realize parallel calculation of multiple depths on input data, so that it can speed up multiply-and-accumulate operations such as convolution calculations.
[0031] In a calculation process based on a systolic array structure, the utilization efficiency of the systolic array structure, the efficiency of moving input data to an input buffer, and the efficiency of moving output data calculated by the systolic array from an output buffer corresponding to the systolic array are factors that are often considered in the calculation process. In practical applications, the input data depth and the output data depth may differ according to different models, and there is a certain variation range. For example, the values of the input data depth and the output data depth of the light model (shallow depth model) are small (abbreviated as the input depth of the shallow depth model and the output depth of the shallow depth model), such as 16, 8, etc. In this case, if the standard input depth and standard output depth of the systolic array are, for example, 32, according to the calculation process based on the systolic array described with reference to FIG. 1, the utilization rate of the systolic array will be greatly reduced. For example, if the standard input depth and standard output depth of the systolic array are all 32, and the input depth and output depth of the shallow depth model are all 8, the calculation results of the 32*32 systolic array by the calculation unit of only 8 rows*8 columns are valid (24 parts of input data input to the remaining 24 rows are filled with 0). This reduces the utilization efficiency of the calculation unit in the systolic array to 1 / 16, which has a significant impact on performance. In addition, since only one input data with a depth of 8 is input to the systolic array each time, and the output data of 8 channels of the shallow depth model (calculated based on the systolic array) is written with a parallelism of 32 when written to the output buffer, there are 24 parts of invalid data each time 32 parts of output data are written. As a result, when the data in the output buffer needs to be used for subsequent processing, the output data of these 32 parts is obtained from the output buffer at the same time. This results in a large amount of invalid data being moved, and the movement efficiency is also reduced. When applied to the calculation process of the shallow depth model, the systolic array structure often does not have high utilization efficiency and data movement efficiency.
[0032] In order to solve the above problem, the embodiment of the present disclosure provides a data processing method and a computing device for a shallow depth model based on a systolic array. The embodiment of the present disclosure concatenates different input data and / or different output data based on the target input depth and target output depth of the shallow depth model, so that the different input data can be input in parallel to the input buffer, and the different input data can be provided to the systolic array, and the different output data can be output in batches from the output buffer. This can improve the efficiency of input / output data movement. In addition, since the data of each row is systolicly transmitted between adjacent computing units, and the calculation results by the computing units of each column are systolicly transmitted and accumulated between adjacent computing units, it is possible for the majority of the computing units in the systolic array to always be in a calculation state. In addition, in the calculation of the shallow depth model, different input data and the corresponding output data can use computing units corresponding to different row sets and column sets, so that the utilization efficiency of the systolic array can be more effectively improved, throughput can be improved, and calculation delay can be reduced, and the total cost of ownership (TCO: total cost of ownership; for evaluating the operating costs of a data center) can be reduced.
[0033] Hereinafter, with reference to FIGS. 2-10D, a data processing method and apparatus for shallow depth model based on systolic array according to an embodiment of the present disclosure will be described.
[0034] 2 shows a schematic flow diagram of a data processing method 200 for a shallow depth model based on a systolic array according to an embodiment of the present disclosure. The data processing method 200 can be applied to, for example, but not limited to, the computing device 100.
[0035] As shown in FIG. 2, in step S210, the standard input depth and standard output depth of the systolic array are determined, and the target input depth and target output depth of the shallow depth model are determined.
[0036] As mentioned above, the systolic array may be a computing unit array, and the number of rows and columns of the computing unit array may correspond to the standard input depth and the standard output depth, respectively. In some embodiments, the number of rows and columns of the computing unit array may be equal to the standard input depth and the standard output depth, respectively. In some other embodiments, the number of rows and columns of the computing unit array may be greater than the standard input depth and the standard output depth, respectively, to substitute or make redundant the computing units in some rows and columns. In the following, the present disclosure takes as an example a case where the rows and columns of the computing unit array are equal to the standard input depth and the standard output depth, respectively, but it is also possible that they are not equal. The present disclosure is not limited thereto.
[0037] The shallow depth model is a depth model that satisfies at least one of the following conditions: the input depth is smaller than the standard input depth of the systolic array, and the output depth is smaller than the standard output depth of the systolic array. In some embodiments of the present disclosure, considering the practical situation of computer data processing, the standard input depth / output depth of the systolic array is usually a power of two, and the target input depth and target output depth of the shallow depth model are both powers of two.
[0038] However, this is not required. Other values of standard input depth / output depth of the systolic array (i.e., values that are not powers of 2) and other values of target input depth and target output depth of the shallow depth model are also feasible. For example, the standard input depth / output depth of the systolic array may be 48 and 96, respectively, and the target input depth and target output depth of the shallow depth model may be 24 and 32, or 31 and 42, respectively. This disclosure is not limited in this respect.
[0039] In the following detailed description, for convenience of explanation, a case will be described as an example in which the depths of one input data input to a systolic array and the corresponding output data are all powers of 2. However, other cases are based on the same principle.
[0040] In step S220, an input connectivity quantity for the systolic array is determined based on the target input depth and the standard input depth, and an output connectivity quantity for the systolic array is determined based on the target output depth and the standard output depth, where the input connectivity quantity and / or the output connectivity quantity are integers greater than 1.
[0041] In some embodiments, step S220 may determine a ratio between the standard input depth and the target input depth, and the integer part of this ratio may be the input connection quantity. Similarly, step S220 may determine a ratio between the standard output depth and the target output depth, and the integer part of this ratio may be the output connection quantity. For example, in order to ensure the consistency between the input depth and the output depth, the standard input depth and the standard output depth of the systolic array may be equal (in the case of the majority of current AI processors), for example, both are 32, and when the target input depth and the target output depth of the shallow depth model are all 8, it can be determined that the input connection quantity is 4 and the output connection quantity is also 4; or when the target input depth of the shallow depth model is 16 and the target output depth is 8, it can be determined that the input connection quantity is 2 and the output connection quantity is 4.
[0042] For example, when the target input depth of the shallow depth model is 32 and the target output depth is 8, it can be determined that the input connection quantity is 1, i.e., the depth of each input data input to the shallow depth model for calculation is 32 (i.e., 32 data input channels), and the output connection quantity is 4. Alternatively, when the target input depth of the shallow depth model is 8 and the target output depth is 32, it can be determined that the input connection quantity is 4 and the output connection quantity is 1, i.e., the depth of the output data output after each input data undergoes calculation of the shallow depth model is 32 (i.e., 32 data output channels).
[0043] Also, when the target input depth and target output depth of the shallow depth model are not powers of 2, the input depth and output depth may be determined based on the standard input depth and standard output depth of the systolic array and the target input depth and target output depth of the shallow depth model. For example, when the standard input depth and standard output depth are 32 and 32, respectively, and the target input depth and target output depth are 15 and 7, respectively, the input connection quantity may be 2, and the output connection quantity may be 4. The calculation units in the remaining rows and columns of the systolic array are not used in the current calculation. That is, the systolic array is divided into rows and columns. number is 30 and column number can be regarded as an array with n being 28.
[0044] It should be noted that when the input connection quantity or the output connection quantity is greater than 1, data connection needs to be performed at the input or output of the systolic array to ensure that there are multiple input data to perform each calculation operation based on the systolic array of the embodiments of the present disclosure.
[0045] In one example, when only one initial input data (one image feature map tensor (NHWC format as described above, N=1)) is acquired, the initial input data may be tiled in the horizontal direction H and the vertical direction W as necessary to acquire multiple input data. When the depth of each tiled input data is greater than the target input depth, the tiled input data is segmented in the depth direction at the target input depth (if it cannot be evenly divided, the data of the channel corresponding to the missing depth in the last segment is complemented with 0). When multiple segmented input data are acquired by segmenting each input data in the depth direction, multiple rounds of operations may be performed on the segmented input data. Furthermore, the subsequent processing unit may acquire the value of multiple output data corresponding to the multiple segmented input data from the output buffer, and then obtain the sum of the multiple output data to acquire the value of the output data corresponding to the input data.
[0046] On the other hand, if multiple initial input data (image feature map tensors (NHWC format as described above, N is an integer greater than 1)) are acquired in a batch, each initial input data (image feature map tensor) may be input as one input data to the systolic array to acquire multiple input data. Then, for each input data, if the depth is also greater than the target input depth, the input data may be re-segmented at the target input depth to acquire input data at the target input depth.
[0047] In step S230, input data for the input connection quantity is generated, the input data for the input connection quantity is input in batches to an input buffer of a systolic array so as not to overlap with each other, the input data in the input buffer is processed by the systolic array to generate output data corresponding to each input data, and when the quantity of output data received by the output buffer of the systolic array from the systolic array reaches the output connection quantity, output data for the output connection quantity in the output buffer is output in batches, each input data has a target input depth and each output data has the target output depth.
[0048] For example, in step S230, multiple (input connection quantity) input data can be provided to an input buffer of a systolic array in a batch, and each input data can be provided to a different set of rows of the systolic array by the input buffer according to timing. For example, each input data of four input data (each input data has a depth of 8) can be input to an input buffer and provided to different 8 rows of the systolic array.
[0049] For example, when the output link quantity is an integer greater than 1, multiple output data, i.e., output data of the output link quantity, can be output from the systolic array at different times, the output data of the output link quantity can be buffered in the output buffer of the systolic array, and the output data of the output link quantity can be obtained in batches from the output buffer. array Four 8-column outputs of The output data (each output data has a depth of 8) is written to the output buffer, and then the four output data can be read out from the output buffer all at once.
[0050] According to the data processing method based on the systolic array described with reference to Fig. 2, for a shallow depth model, multiple input data (having the same depth) can be moved in batches from other devices to an input buffer and jointly used as an input of the systolic array via the input buffer, thereby improving the input data movement efficiency. Also, multiple output data (having the same depth) can be buffered in an output buffer and multiple output data can be output in batches from the output buffer, thereby improving the output data movement efficiency.
[0051] Hereinafter, the data processing method of the shallow depth model based on the systolic array according to the embodiment of the present disclosure will be further described with reference to Figures 3-4B. Figure 3 shows a schematic diagram of a specific flow of step S230 of the method 200 shown in Figure 2. Figures 4A-4B show one specific example of the method 200 shown in Figure 2.
[0052] 3-4B corresponds to the case where the input link quantity is equal to 1 and the output link quantity is greater than 1. In this case, step S230 of the method may be implemented to include the following steps:
[0053] In step S310, the calculation parameters of each calculation unit in the systolic array are set.
[0054] For example, setting the calculation parameters of each calculation unit may include storing the calculation parameters required for each calculation unit in advance before the calculation process of each input data in order to perform calculations in each calculation unit, or, in the calculation process of each input data, sequentially providing the calculation parameters to each calculation unit in a systolic manner based on a clock used in the transmission process of the input data.
[0055] For example, systolic array can be used for the calculation of convolution layer in CNN model, so that the calculation unit can include a calculation parameter, for example, a convolution kernel, and can set the convolution kernel in the calculation unit (for example, the 3×3 weight matrix as mentioned above). In this embodiment, the calculation parameter of each calculation unit is determined for each input data. This will be described in the following steps.
[0056] In step S320, the input data for the output connection quantity is treated as one group of input data, and output data corresponding to different input data among the input data of the group correspond to non-overlapping column sets in the systolic array and to non-overlapping buffer areas in the output buffer.
[0057] For example, as shown in FIG. 4A, the standard input / output depths of the systolic array are all 32, and the target input depth of the shallow depth model is 32 and the target output depth is 8. Thus, it can be determined that the input connection quantity is 1 and the output connection quantity is 4. In addition, four input data (each of which has a depth of 32) are generated as one group of input data, which are input to the input buffer at different times (in order), and then the systolic array is further processed. arrayThe output data corresponding to the first input data (i.e., data that has undergone calculation in the systolic array) is output from columns 1-8 of the systolic array (i.e., corresponding to the columns 1-8) and buffered in the first buffer area of the output buffer. The output data corresponding to the second input data is output from columns 9-16 of the systolic array (i.e., corresponding to the columns 9-16) and buffered in the second buffer area of the output buffer. The output data corresponding to the third input data is output from columns 17-24 of the systolic array (i.e., corresponding to the columns 17-24) and buffered in the third buffer area of the output buffer. The output data corresponding to the fourth input data is output from columns 25-32 of the systolic array (i.e., corresponding to the columns 25-32) and buffered in the fourth buffer area of the output buffer. The different areas of the output buffer do not overlap. Furthermore, as described above, the output buffer may include a plurality of sub-output buffers, and the number of the sub-output buffers may be equal to the number of columns of the systolic array. Thus, the output data output from the last calculation unit in each column in each column set of the systolic array is buffered in a plurality of sub-output buffers, the number of which is equal to the number of columns in the column set. output The buffer corresponds to one buffer area of the output buffer described above.
[0058] In step S330, the input data of the group is sequentially provided to the systolic array via the input buffer, so that each time the systolic array receives one of the input data of the group, the input data is processed based on the calculation parameters of the calculation unit corresponding to the input data, and output data corresponding to the input data is obtained.
[0059] For example, the input data of the group includes four input data (the depth of each input data is 32, and the depth of the corresponding output data is 8). As shown in FIG. 4A, one input data is provided to the input buffer each time, and the input data is further provided to the systolic array via the input buffer (the input data of multiple parts (multiple channels) of the input data is systolicly input to the corresponding rows in the systolic array according to a specific timing). The systolic array outputs the corresponding output data for each input data. At least, the input buffer provides one input data to the systolic array before inputting the other input data to the input buffer.
[0060] In step S340, for each input data of the group, output data corresponding to the input data is output to a buffer area corresponding to the output data.
[0061] In this embodiment, based on the operation principle of the systolic array, the input buffer inputs one input data (for example, the depth is 32) to the systolic array in each calculation process, that is, inputs, for example, 32 parts of the input data into 32 rows of the systolic array according to a specific timing, and each calculation unit in each row performs calculation based on one part of the input data input to the row and calculation parameters, and accumulates with the calculation result by the calculation unit in the previous row in the same column. In this embodiment, since the depth of the output data corresponding to the input data is small (for example, the depth of the output data shown in FIG. 4A is 8), the output data corresponding to the input data only needs to be output from some columns (for example, 8 columns), and the calculation unit at the intersection of these columns (for example, 8 columns) and the row (for example, 32 rows) of the systolic array corresponding to the depth of the input data needs to set a calculation parameter correlated with the input data. For example, the calculation parameter is pre-stored in each calculation unit, or is systolicly provided to each calculation unit according to the timing in the calculation process. Of course, there may be other ways to provide the calculation parameters as long as they can provide the calculation parameters for the current calculation without affecting the previous calculation results of other input data, and the present disclosure is not limited thereto.
[0062] Similarly, for each of the other input data, it is necessary to set calculation parameters correlated with the input data in the calculation unit at the intersection of the corresponding column set (8 columns) and the row (e.g., 32 rows) of the systolic array corresponding to the depth of the input data.
[0063] Therefore, in this embodiment, it is necessary to set the calculation parameters in a specific part of the calculation units for each input data. For example, in the case of the first input data, this specific part of the calculation units is the calculation unit at the intersection of the 1st-8th column and the 1st-32nd row. The calculation parameters in each calculation unit in the calculation unit array may be set. For example, in FIG. 4A, the calculation parameters required for the calculation of the first input data are set in the calculation unit at the intersection of the 1st-8th column and the 1st-32nd row (first area Z1), the calculation parameters required for the calculation of the second input data are set in the calculation unit at the intersection of the 9th-16th column and the 1st-32nd row (second area Z2), the calculation parameters required for the calculation of the third input data are set in the calculation unit at the intersection of the 17th-24th column and the 1st-32nd row (third area Z3), and the calculation parameters required for the calculation of the fourth input data are set in the calculation unit at the intersection of the 25th-32nd column and the 1st-32nd row (fourth area Z4).
[0064] However, considering the operation principle of the systolic array, if no other adjustments are made, when each input data is input to the systolic array, the calculation parameters required for the calculation of other input data are also set in each calculation unit in the calculation unit array, so that calculation is performed for the input data and these calculation parameters (e.g., the third input data and the calculation parameters for the second input data in the calculation unit in the 9th to 16th columns). As a result, other output data is output from columns other than the column set corresponding to the output data corresponding to the input data (e.g., the third input data and the calculation parameters in the calculation unit in the 9th to 16th columns are calculated, and the corresponding output data is output from the 9th to 16th columns) and buffered in the output buffer, overwriting the output data corresponding to the previous input data. On the other hand, when subsequent input data is input, the output data corresponding to the input data in the output buffer is also overwritten. This is not permitted.
[0065] In the embodiment of the present disclosure, this problem can be solved by the following method. That is, when performing calculations on each input data, writing to a buffer area corresponding to output data corresponding to other input data than the input data to be calculated among the input data of the group is prohibited. For example, the controller may prohibit output from the output port of the systolic array (e.g., disable the output enable signal), or the controller may prohibit writing to some areas of the output buffer (e.g., disable the write enable signal corresponding to the write channel corresponding to these areas of the output buffer).
[0066] In this way, each output data corresponding to a plurality of input data can be buffered in a different buffer area of the output buffer so that the output data do not overlap and affect each other.
[0067] In step S350, for the input data of the group, the output buffer outputs output data of the output link quantity in each buffer area of the output buffer in batches so as not to overlap each other.
[0068] For example, as shown in FIG. 4A, four output data corresponding to four input data are stored in four non-overlapping buffer areas of the output buffer (each buffer area includes eight sub-output buffers), and the four output data are moved from the output buffer to another device (e.g., a memory or an input buffer) so that they do not overlap with each other.
[0069] In the embodiment described with reference to Fig. 3-4A, it is assumed that there are a plurality of input data in order to realize output of the output link quantity in each buffer area of the output buffer in a batch so as not to overlap each other. Only in this way can there be a plurality of output data for batch output. For example, the plurality of input data may be divided into at least one group, and the input data of each group includes the input data of the output link quantity. The remaining input data may be combined with the input data whose value is zero and input as one group of input data. For example, if there are 10 input data and the output link quantity is 4, the 10 input data may be divided into at least one group. data may be divided into three groups and the method described above with reference to Figures 3-4A may be performed on each of the three groups of input data. One of the three groups of input data includes two input data whose values are 0.
[0070] In one example, when only one image feature map tensor (NHWC format as described above, N=1) is obtained, this one image feature map tensor may be cut in the H and W directions to obtain multiple input data, as shown in FIG. 4B. When the value of the depth C of the tensor is equal to the target input depth (represented by Ds), which is also the standard input depth in this example, each part of input data (each data matrix) included in each input data can be input exactly to each row of the systolic array. If the value of C is smaller than Ds, each input data needs to be supplemented with (Ds-C) parts of input data whose value is 0 so that the depth of the input data is Ds. Also, if the value of C is larger than Ds (as in FIG. 4B), each input data needs to be further segmented in the C direction by Ds to obtain multiple segmented input data. Also, when there is one remaining input data whose depth is less than Ds, the remaining input data is supplemented with (Ds-(C-nDs)) (n is 1 or more) parts of the input data (data matrix) whose value is 0. Also, when each input data is segmented in the C direction, multiple rounds of operations may be performed on the segmented input data. The subsequent processing unit may obtain the value of multiple output data corresponding to the multiple segmented input data segmented from the input data from the output buffer, and then obtain the sum of the multiple output data to obtain the value of the output data corresponding to the input data.
[0071] On the other hand, when multiple image feature map tensors (NHWC format as described above, N is an integer greater than 1) are acquired in a batch, each image feature map tensor may be taken as one input data. Similarly, based on the magnitude relationship between the value of the depth C of the tensor and the target input depth (represented by Ds), further segmentation or supplementation may be performed on each tensor as each input data, so that the depth of each input data is all Ds. Obviously, the multiple input data corresponding to the multiple tensors may be divided into at least one group of input data (each group includes input data of an output link quantity). For each group of input data, calculations may be performed on these input data by the method described above with reference to FIG. 3.
[0072] Similarly, in each embodiment described below, the acquisition of multiple input data may be similar to that described here, i.e., horizontal and vertical division and possible depth segmentation are performed on one acquired initial input data, or each of the initial input data acquired in a batch is treated as one input data, and therefore the description will not be repeated below.
[0073] According to the data processing method of the shallow depth model based on the systolic array described with reference to Figures 3-4B, when the input connection quantity is equal to 1 and the output connection quantity is greater than 1, output data corresponding to one group of input data (input data of the output connection quantity) can be retrieved in batches from the output buffer, improving the movement efficiency of the output data.
[0074] Hereinafter, the data processing method of the shallow depth model based on the systolic array according to the embodiment of the present disclosure will be further described with reference to Figures 5-6. Figure 5 shows a schematic diagram of a specific flow of step S230 of the method 200 shown in Figure 2. Figure 6 shows a specific example.
[0075] 5-6 corresponds to the case where the input connection quantity is greater than 1 and the output connection quantity is equal to 1. In this case, step S230 of the method 200 may include the following steps.
[0076] In step S510, the input data corresponding to the input connection quantity is treated as one group of input data, and different input data among the input data of the group correspond to non-overlapping row sets in the systolic array, and output data corresponding to different input data among the input data of the group all correspond to all columns in the systolic array.
[0077] Optionally, the output data corresponding to each input data is output from all columns of the systolic array to the output buffer, and if the storage space of the output buffer can only store the output data corresponding to one input data, the output data corresponding to each input data is output to the entire buffer area of the output buffer, the current output data in the output buffer is retrieved, and then the output data corresponding to the next input data is buffered in the output buffer. Alternatively, if the storage space of the output buffer is large enough to store the output data corresponding to multiple input data, the output data obtained for each input data may be arranged in the output buffer in a continuous depth manner. For example, the output data corresponding to the first input data may use the buffer area indicated by addresses 0-7 in the output buffer, 2 By analogy, the output data corresponding to the th input data may use the buffer area designated by addresses 8-15 in the output buffer.
[0078] For example, as shown in FIG. 6, the standard input / output depths of the systolic array are all 32, and the target input depth of the shallow depth model is 8, and the target output depth is 32. This allows the input link quantity to be determined as 4, and the output link quantity to be determined as 1. In addition, four input data (each of which has a depth of 8) are generated and input to the input buffer as one group of input data, and then the systolic array is further processed. array For example, the first input data is provided to rows 1-8 of the systolic array (i.e., corresponding to the row set consisting of rows 1-8) through the input buffer, and the second input data is provided to rows 1-8 of the systolic array (i.e., corresponding to the row set consisting of rows 1-8). Input data is provided to the 9th to 16th rows of the systolic array (i.e., corresponding to the row set consisting of the 9th to 16th rows) via the input buffer, and the third Input data is provided to the 17th to 24th rows of the systolic array (i.e., corresponding to the row set consisting of the 17th to 24th rows) via the input buffer, and the fourth Input data is provided to rows 25-32 (i.e., corresponding to a row set consisting of rows 25-32) of the systolic array via an input buffer. Furthermore, output data (i.e., data that has undergone calculations in the systolic array) corresponding to each of the four input data are all output from columns 1-32 of the systolic array and may be buffered in the entirety or at least a part of the buffer area of the output buffer (depending on the storage space of the output buffer). Furthermore, as described above, the output buffer may include multiple sub-output buffers. Therefore, all of the output data output from the last calculation unit in each column of the systolic array is buffered in multiple sub-output buffers. These multiple sub-output buffers may be used to buffer the output data from the final calculation unit in each column of the systolic array. output The buffer corresponds to the entire buffer area of the output buffer mentioned above or at least a part of the buffer area (depending on the storage space of the output buffer).
[0079] In step S520, the input data of the group is provided to the calculation unit array in parallel through an input buffer. In step S530, calculation is performed for each input data of the group in turn, and in the calculation process of each input data, the calculation parameters of the calculation unit corresponding to the input data are set to valid values, and the calculation parameters of the calculation units other than the calculation unit corresponding to the input data in the systolic array are set to 0.
[0080] Similarly, the method of setting the calculation parameters in the calculation units may include storing the parameters in advance in each corresponding calculation unit, or providing the parameters systolically to each calculation unit according to a timing.
[0081] For example, as described above, in a calculation process, the systolic array accumulates and outputs the calculation results by the calculation units in the same column in the column direction. Therefore, in the process of performing calculations on each input data of the group (depth is 8) provided in parallel to the systolic array, it is necessary to set the values of the calculation parameters of the calculation units in rows other than the row set corresponding to the input data to 0. As a result, for the input data, the calculation results only by the calculation units in the row set corresponding to the input data are valid values, and the calculation results by the other calculation units are all 0. Therefore, when the calculation results in the same column are overlapped, the calculation results only by the calculation units in the row set corresponding to the input data in the column are overlapped. Furthermore, it is possible to avoid erroneously overlapping the calculation results for different input data in the same column (for example, the calculation units in each column can perform calculations on four input data in one calculation process. The result of the calculation in this way will be erroneous). Based on this, each time the input data of the group is input, calculations may be performed on only one input data. For example, in FIG. 6, first, the calculation parameters of the calculation units in the 1st to 8th rows are set to valid values, and the calculation parameters of the other calculation units are set to 0. Calculation parameters The value is set to 0. Next, the input data of the group is input in parallel for the first time, and after the calculation of the systolic array, the calculated output data (depth is 32) corresponding to the first input data (depth is 8) is output from all columns of the systolic array. Next, the calculation parameters of the calculation units in rows 9-16 are set to valid values, and the calculation parameters of the other calculation units are Calculation parametersThe value is set to 0. Next, the input data of the group is input in parallel for the second time, and after the calculation of the systolic array, the calculated output data (depth is 32) corresponding to the second input data (depth is 8) is output from all columns of the systolic array. Only the case of two input data is shown in Figure 6. Similar operations are performed on other input data until all output data corresponding to each of the input data of the group is output.
[0082] For example, as shown in FIG. 6, the input data of the group (four input data) is input to an input buffer (may be simultaneously or at different times). That is, the input data of the group is buffered simultaneously in the input buffer. Also, the input buffer can provide the input data of the group in parallel to the systolic array according to a predetermined timing (controlled by a controller and based on the operating principle of the systolic array). For example, the first input data is provided to the 1st-8th rows of the systolic array, the second input data is provided to the 9th- 16 row, and the third input data is provided to the first row of the systolic array. 17 -24 row, and the fourth input data is provided to rows 25-32 of the systolic array.
[0083] In step S540, the output data corresponding to each input data is output to the output buffer in sequence.
[0084] For example, as shown in FIG. 6, first, output data corresponding to the first input data is output to the buffer area of the output buffer, and at least after the output buffer becomes free again (i.e., the output data buffered in it has been retrieved), or when the remaining memory space is sufficient for buffering the output data corresponding to the next input data, output data corresponding to the second input data is output to the entire buffer area of the output buffer or at least a part of the buffer area (depending on the memory space of the output buffer).
[0085] It should be noted that in the specific description of each embodiment of the present disclosure, the steps of the method are illustrated by using a flowchart, but this does not necessarily mean that the method must be performed in the order shown, and may be performed alternately. By way of example and not of limitation, in the embodiment of FIG. 5-6, when the calculation parameters of each calculation unit for the calculation of the first input data are set (the calculation parameters of the calculation units in rows 1-8 are valid values, and the calculation parameters of the calculation units in the remaining rows are 0), the output data corresponding to the first input data can be obtained by performing the calculation on the first input data. In addition, the calculation parameters of each calculation unit for the calculation of the second input data are set (the calculation parameters of the calculation units in rows 9-16 are valid values, and the calculation parameters of the calculation units in the remaining rows are 0), and then the output data corresponding to the second input data can be obtained by performing the calculation on the second input data. By analogy, the execution order of each step may be flexibly adjusted based on the inventive principle of the present disclosure.
[0086] According to the data processing method of the shallow depth model based on the systolic array described with reference to FIG. 5-6, when the input link quantity is greater than 1 and the output link quantity is equal to 1, one group of input data (input data of the input link quantity) can be buffered in the input buffer and provided to the systolic array in parallel. Since the input provided from the input buffer to the systolic array is the same even in the calculation of each input data, the input data only needs to be moved once (for example, moved from another memory to the input buffer), improving the efficiency of input data movement. On the other hand, when the data processing method described in the embodiment of the present disclosure is not adopted, for the multiple input data included in the input data of the group, multiple moving processes to the input buffer are required for the multiple input data (in this case, the data of the channel corresponding to the shortage of the depth of each input data with respect to the standard input depth of the systolic array is supplemented with 0), but the process of loading the calculation parameters to the calculation unit may be performed only once. When the above data processing method is adopted, the transfer process to the input buffer is only required once, and in this case, the calculation parameters are loaded into the calculation unit multiple times (once for each input data), but since the data size of the calculation parameters is generally much smaller than the data size of the input data, and the time required to load the calculation parameters is much smaller than the time required to transfer the input data, it still has relatively good performance in terms of the overall time required and improves the transfer efficiency.
[0087] The data processing method of the shallow depth model based on the systolic array according to the embodiment of the present disclosure will be further described below with reference to Figures 7-10D. Figure 7 shows a schematic diagram of an example flow of the steps of the method shown in Figure 2. Figures 8A-8B show more details of the data processing method of Figure 7 when the input connection quantity is equal to the output connection quantity. Figures 9A-9D show more details of the data processing method of Figure 7 when the input connection quantity is greater than the output connection quantity. Figures 10A-10D show more details of the data processing method of Figure 7 when the input connection quantity is less than the output connection quantity.
[0088] In the embodiment of FIG. 7, since the input connection quantity is greater than 1 and the output connection quantity is greater than 1, step S230 of the data processing method 200 includes the following steps:
[0089] In step S710, a total connection quantity is determined based on the input connection quantity and the output connection quantity.
[0090] Optionally, as described in more detail below, the total linked quantity may be the greater or lesser of the input linked quantity and the output linked quantity based on a magnitude and multiple relationship between the two, or alternatively, if the input linked quantity is equal to the output linked quantity, then the total linked quantity is equal to either the input linked quantity or the output linked quantity.
[0091] In step S720, the input data for the total linked quantity is treated as one group of input data.
[0092] In step S730, the input data of the group is divided into at least one subgroup based on the input connection quantity and the output connection quantity, and each input data in each subgroup corresponds to a set of rows in the systolic array that do not overlap with each other, the set of rows being equal to the input connection quantity, and output data corresponding to different input data in the subgroup corresponds to a set of columns in the systolic array that do not overlap with each other and corresponds to buffer areas in the output buffer that do not overlap with each other.
[0093] Optionally, the quantity of subgroups may be an integer equal to or greater than 1. Each subgroup may include one or more input data.
[0094] For example, the standard input depth / standard output depth of the systolic array are all 32, and the target input depth of the shallow depth model is 16, and the target output depth is 8. As a result, it can be determined that the input connection quantity is 2, the output connection quantity is 4, and the total connection quantity is 4. Furthermore, the input data of the group includes four input data, but since the input connection quantity is 2, only two input data (depth is 16) can be provided to the systolic array at one time. Therefore, the four input data are divided into two subgroups, each of which includes two input data, and one subgroup of input data is provided to the systolic array each time.
[0095] 8A-8B show more details of the data processing method of FIG. 7 when the input link quantity is equal to the output link quantity. The method of FIG. 7 may further include the following steps.
[0096] In Figures 8A-8B, the input link quantity is equal to the output link quantity (4 in the figures). In this case, it can be considered that there is only one subgroup, and each subgroup contains input data of the input link quantity (output link quantity).
[0097] In FIG. 8A, in step S810, for a subgroup of the input data of the group, the input data in the subgroup is provided in parallel to the systolic array via the input buffer.
[0098] Similarly, the input data of each subgroup corresponds to a non-overlapping set of rows of the input connection quantities in the calculation unit array, and the output data corresponding to different input data of the input data of the group corresponds to a non-overlapping set of columns in the calculation unit array and corresponds to non-overlapping buffer regions of the output buffer.
[0099] For example, as shown in FIG. 8B, the standard input depth and standard output depth of the systolic array are all 32, and the target input depth of the shallow depth model is 8, and the target output depth is 8. This allows the input connection quantity to be determined to be 4, and the output connection quantity to be determined to be 4. In addition, four input data (each of which has a depth of 8) are input to the input buffer as one group of input data, and then the systolic array is further expanded. array In addition, output data corresponding to each of the input data of the group is output from a different column set of the systolic array. For example, the first input data is provided to rows 1-8 of the systolic array (i.e., corresponding to the row set consisting of rows 1-8) via an input buffer, and the corresponding output data is output from columns 1-8 of the systolic array, and the second Input data is input to the systolic array via the input buffer. 9 - 16 The third input data is provided to rows 17-24 (i.e., corresponding to the row set consisting of rows 17-24) of the systolic array via an input buffer, and the corresponding output data is output from columns 17-24 of the systolic array; the fourth input data is provided to rows 25-32 (i.e., corresponding to the row set consisting of rows 25-32) of the systolic array via an input buffer, and the corresponding output data is output from columns 25-32 of the systolic array. That is, the row sets corresponding to the four input data included in the subgroup and the column sets corresponding to the four corresponding output data are the first area Z1 (1-8, 1-8), the second area Z2 (9-16 ,The output buffer can be expressed as a first region Z1 (17-24, 17-24), a second region Z2 (17-24, 17-24), and a fourth region Z3 (25-32, 25-32). As described above, the output buffer may further include multiple sub-output buffers. Thus, any output data output from the last calculation unit in each column of the systolic array is buffered in the multiple sub-output buffers. output The buffer corresponds to the entire buffer area of the output buffer mentioned above or at least a part of it (depending on the storage space of the output buffer).
[0100] In step S820, for the calculation of the subgroup, the calculation parameters of the calculation units corresponding to each input data among the input data of the subgroup are set to valid values, and the calculation parameters of the remaining calculation units in the systolic array other than the calculation units corresponding to each input data are set to zero.
[0101] That is, in the calculation process, the systolic array accumulates the calculation results by the calculation units in the same column in the column direction and outputs them, so for each input data of the input data of each subgroup provided in parallel to the systolic array, in the calculation process for the input data, it is necessary to set the calculation parameters in the calculation units that are not related to the calculation to zero in order to ensure the accuracy and correspondence of the output data. For example, as shown in Figure 8B, four areas (Z1-Z4) are as shown in the filled parts of Figure 8B. The calculation parameters of the calculation units for performing calculations on the corresponding input data in these filled areas are set respectively, and the calculation parameters of the other calculation units in each column are set to 0 (for example, the blank frame area in the figure).
[0102] In step S830, for each input data in the subgroup, the output data corresponding to the input data is output to the buffer area corresponding to the output data, i.e., the output data corresponding to the input data of the subgroup is buffered in the output buffer.
[0103] for example, figure As shown in FIG. 8B, the output buffer buffers output data (four output data) corresponding to each of the input data of the subgroup, so that the four output data can be retrieved from the output buffer in a batch.
[0104] However, in some embodiments, other cases are possible: the input connection quantity is greater than 1, the output connection quantity is greater than 1, and the output connection quantity is greater than or less than the input connection quantity.
[0105] FIG. 9A shows more details of the data processing method of FIG. 7 when the output link quantity is an integer multiple greater than one of the input link quantity.
[0106] In this case, the total link quantity is the output link quantity, and the input data of each subgroup includes the input data of the input link quantity. In addition, for this case, the data processing method described with reference to FIG. 7 may further include the following steps.
[0107] In step S910, for the calculation of the input data in each subgroup, the input data in that subgroup is provided in parallel to the systolic array via the input buffer.
[0108] For example, as shown in FIG. 9B, when the standard input depth and standard output depth of the systolic array are 32, the target input depth of the shallow depth model is 16 and the target output depth is 8, so the input connection quantity may be 2, but the output connection quantity is 4, and the total connection quantity is 4. The generated one group of input data (four input data) is divided into two subgroups, each of which includes two input data. The input data of each subgroup (including two input data) is input in sequence to the input buffer. The input data of each subgroup is provided in parallel to the systolic array.
[0109] In step S920, for the calculation of the input data in each subgroup, the calculation parameters of the calculation units corresponding to each input data in the subgroup are set to valid values, and the calculation parameters of the other calculation units in the systolic array other than the calculation units corresponding to each input data in the subgroup are set to zero. 。
[0110] For example, as shown in FIG. 9B, the row set corresponding to the first subgroup (including the first input data and the second input data) and the column set corresponding to the corresponding output data are represented by the first region Z1 (1-16, 1-8) and the second region Z2 (17-32, 9-16), respectively. Before performing calculations on the first subgroup, it is necessary to set the calculation parameters of the calculation units in the row set and the column set. The row set corresponding to the second subgroup (including the third input data and the fourth input data) and the column set corresponding to the corresponding output data are represented by the third region Z3 (1-16, 17-24) and the fourth region Z4 (17-32, 25-32), respectively. Similarly, before performing calculations on the second subgroup, it is necessary to set the calculation parameters of the calculation units in the row set and the column set. Since the regions covered by these row sets and column sets do not overlap, one simple method is to set the calculation parameters of the calculation units required for the calculations of the two subgroups together. As described above, taking into consideration the calculation principle of the systolic array, when calculation is performed on the input data of each subgroup, writing is performed only to the buffer area corresponding to the output data of the input data of the subgroup, but writing to the buffer areas corresponding to the output data of other subgroups is prohibited. That is, when calculation is performed on the input data of the first subgroup, output data corresponding to each of the two input data is output from only two column sets (including columns 1-16), and when calculation is performed on the input data of the second subgroup, output data corresponding to each of the latter two input data is output from only two column sets (including columns 17-32).
[0111] In step S930, the output data corresponding to the input data of the group is output to the output buffer.
[0112] For example, as shown in Fig. 9B, four output data corresponding to the input data of two subgroups are output from columns 1-32 of the systolic array (two output data corresponding to the first subgroup are output first from columns 1-16, and two output data corresponding to the second subgroup are output later from columns 17-32), i.e., output to the whole or at least a part of the buffer area of the output buffer, so that an external device or an input buffer can take out these output data from the output buffer in batches.
[0113] 9C shows more detail of the data processing method of FIG. 7 when the output link quantity is greater than, but not an integer multiple of, the input link quantity. In this case, the total link quantity is the input link quantity and the number of subgroups is 1, i.e., one group of input data is generated that contains only one subgroup.
[0114] In step S910', the input data of the group is provided in parallel to the systolic array via the input buffers.
[0115] 9D, when the standard input depth and standard output depth of the systolic array are 36 and 64, the target input depth of the shallow depth model is 12 and the target output depth is 16, so the input connection quantity may be 3, but the output connection quantity is 4, and the total connection quantity is 3. The generated one group of input data (three input data) is input to the input buffer in batches, and is provided to the systolic array in parallel.
[0116] In step S920', for the calculation of the input data of the group, the calculation parameters of the calculation units corresponding to each input data of the input data of the group are set to valid values, and the calculation parameters of the remaining calculation units in the systolic array other than the calculation units corresponding to each input data of the input data of the group are set to zero.
[0117] For example, as shown in FIG. 9D, the row set corresponding to the input data of the group (including the first to third input data) and the column set corresponding to the output data are represented as (1-12, 1-16), (13-24, 17-32), and (25-36, 33-48), respectively. The calculation parameters of the calculation units in the row set and column set may be set to valid values, and the calculation parameters of the remaining calculation units may be set to 0 (including the calculation units in columns 49-64). In addition, since the areas covered by these row sets and column sets do not overlap, the calculation parameters of the calculation units required to calculate the input data of the two subgroups may be set together.
[0118] In step S930', output data corresponding to the input data of the group is output to the output buffer, where at least a part of the value in the entire buffer area of the output buffer is set to 0.
[0119] For example, as shown in Fig. 9D, three output data corresponding to the input data of the group are output from columns 1-48 of the systolic array, and the calculation units in columns 49-64 output the calculated 0. That is, valid data is stored in the buffer areas corresponding to columns 1-48 in the output buffer, but 0 is stored in the remaining buffer areas. This allows these output data and 0 to be taken out in batches from the output buffer.
[0120] The above describes, with reference to FIGS. 9A-9D, the case where the input connection quantity is greater than 1, the output connection quantity is greater than 1, and the output connection quantity is greater than the input connection quantity.
[0121] In the following, a case will be mainly explained in which the input connection quantity is greater than 1, the output connection quantity is greater than 1, and the input connection quantity is greater than the output connection quantity.
[0122] In some cases, the input link quantity is an integer multiple greater than one of the output link quantity.
[0123] 10A-10B show more detail of the data processing method of FIG. 7 when the input link quantity is an integer multiple of the output link quantity greater than 1. In this case, the total link quantity is the input link quantity, and the input data of each subgroup includes the input data of the output link quantity.
[0124] For example, when the standard input depth and standard output depth of the systolic array are 32, the target input depth of the shallow depth model is 8 and the target output depth is 16, so the output connection quantity may be 2, but the input connection quantity is 4, and the total connection quantity is 4. The input data of each subgroup includes two input data.
[0125] The method of FIG. 7 may further include the following steps.
[0126] In step S1010, input data in each subgroup is provided in parallel to the array of computing units via an input buffer.
[0127] For example, as shown in Figure 10B, four input data are batched into the input buffer. input and providing the same to the array of computing units in parallel.
[0128] In step S1020, for each subgroup calculation, the calculation parameters of the calculation units corresponding to each input data in the subgroup are set to valid values, and the calculation parameters of the remaining calculation units in the systolic array other than the calculation units corresponding to each input data of the subgroup are set to zero.
[0129] For example, as shown in FIG. 10B, the row set corresponding to the first subgroup (including the first input data and the second input data) and the column set corresponding to the corresponding output data are respectively represented as a first region Z1 (1-8, 1-16), a second region Z2 (9-16, 17-32), a third region Z3 (17-24, 1-16), and a fourth region Z4 (25-32, 17-32). The calculation parameters of the calculation units in the first region Z1 (1-8, 1-16) for performing calculations on the input data of the first subgroup are set to valid values, and the calculation parameters of the calculation units in the second region Z2 (1-8, 1-16) for performing calculations on the input data of the first subgroup are set to valid values. 2 The calculation parameters of the calculation units in (9-16, 17-32) are set to valid values, and the calculation parameters of the other calculation units are set to 0. When performing calculations on the input data of the second subgroup, the input data of the two subgroups are input in parallel, but the calculation parameters of the calculation units in the third region Z3 (17-24, 1-16) are set to valid values, the calculation parameters of the calculation units in the fourth region Z4 (25-32, 17-32) are set to valid values, and the calculation parameters of the other calculation units are set to 0.
[0130] In step S1030, the output data corresponding to each subgroup is output in sequence to the output buffer.
[0131] For example, in FIG. 10B, when the calculation of the input data of the first subgroup is completed, the output data corresponding to each of the first input data and the second input data contained therein are output to the output buffer via all columns of the systolic array, and after the output buffer becomes empty again or when the remaining memory space is sufficient for buffering the output data corresponding to the next input data, the calculation result of the subsequent input data of the second subgroup is output to the output buffer.
[0132] Also, in some cases, the input link quantity is greater than the output link quantity, but is not an integer multiple thereof.
[0133] 10C-10D show more details of the data processing method of FIG. 7 when the input link quantity is greater than, but not an integer multiple of, the output link quantity. In this case, the total link quantity is the output link quantity and the number of subgroups is 1, i.e., one group of input data is generated that contains only one subgroup.
[0134] For example, when the standard input depth and standard output depth of the systolic array are 48 and 36, the target input depth of the shallow depth model is 12, and the target output depth is 12, so the output connection quantity can be 3, but the input connection quantity is 4, and the total connection quantity is 3. The input data of the group and the input data of the subgroup include three input data.
[0135] As shown in FIG. 10C, the method in FIG. 7 may further include the following steps:
[0136] In step S1010', N pieces of input data padded with zeros are added to the input data of the group, where the value of N is equal to the input link quantity minus the output link quantity.
[0137] For example, as shown in FIG. 10D, add one input data (depth is 12) to match the number of rows of the systolic array.
[0138] In step S1020', the input data of the group is provided in parallel to the systolic array via the input buffers.
[0139] For example, as shown in FIG. 10D, four input data are provided in parallel to a systolic array.
[0140] In step S1030', before performing calculations on the input data of the group, calculation parameters of the calculation units corresponding to each input data of the input data of the group are set to valid values, and calculation parameters of the remaining calculation units in the systolic array other than the calculation units corresponding to each input data of the input data of the group are set to zero.
[0141] For example, as shown in FIG. 10D, the row set corresponding to the input data of the group and the column set corresponding to the output data are respectively represented as a first region Z1 (1-12, 1-12), a second region Z2 (13-24, 13-24), and a third region Z3 (25-36, 25-36). It is necessary to set the calculation parameters of the calculation units in the row set and column set for performing calculations on the group. The calculation parameters of the calculation units in the regions of these row sets and column sets are set to valid values, but the calculation parameters of the other calculation units (including the calculation units in rows 37-48 corresponding to the added 0 input data) are set to 0.
[0142] In step S1040', output data corresponding to each input data of the group is output to the output buffer.
[0143] For example, as shown in FIG. 10D, the supplemented 0 input data causes the calculation results of all the calculation units in rows 37-48 to be 0, and does not affect other calculation results in each column, so that the output data corresponding to the three input data are all buffered in the entirety or at least a portion of the buffer area of the output buffer, and are output in batches from the output buffer.
[0144] According to the data processing method of the shallow depth model based on the systolic array described with reference to Fig. 7-10D, when the input connection quantity is greater than 1 and the output connection quantity is greater than 1 (including various cases where the two are equal or unequal), one group of input data (input data of the output connection quantity) can be buffered in an input buffer and provided to the systolic array in parallel, and a plurality of output data corresponding to the input data of the group output from the systolic array can be buffered in an output buffer and output from the output buffer in batches, thereby improving the movement efficiency of the input data and the output data. In addition, the systolic array can perform calculations on at least two input data of the group in one calculation process, which improves the calculation efficiency and the utilization efficiency of the calculation unit in the systolic array compared to the conventional method described with reference to Fig. 1 in which calculations are performed on only one input data in one calculation process.
[0145] According to another aspect of the present disclosure, there is also provided a computing device, which has essentially the same architecture as the computing device 100 described with reference to FIG.
[0146] As shown in FIG. 1, the computing device 100 includes a controller 101 , a data acquirer 102 , a systolic array 103 , an input buffer 104 , and an output buffer 105 .
[0147] According to an embodiment of the present disclosure, the controller 101 determines a standard input depth and a standard output depth of the systolic array 103, and determines a target input depth and a target output depth of a shallow depth model. Then, the controller 101 determines an input connection quantity for the systolic array based on the target input depth and the standard input depth, and determines an output connection quantity for the systolic array based on the target output depth and the standard output depth, where the input connection quantity and / or the output connection quantity are integers greater than 1. The controller 101 controls the data acquirer 102 to acquire and generate input data for the input connection quantity, input the input data for the input connection quantity to the input buffer of the systolic array 103 in batches so as not to overlap with each other, and controls the input buffer to acquire the input data for the input connection quantity. Systolic Array 103 , and controls a systolic array 103 to process the input data in the input buffer to generate output data corresponding to each input data. When the amount of output data received by an output buffer 105 of the systolic array 103 from the systolic array 103 reaches the output connection amount, the output buffer 105 of the systolic array 103 is controlled to output the output data for the output connection amount without overlapping each other, and each input data has a target input depth, and each output data has the target output depth.
[0148] According to an embodiment of the present disclosure, the systolic array 103 is a computation unit array, and the number of rows and columns of the computation unit array correspond to (are equal to or greater than) the standard input depth and standard output depth, respectively. The depth of the input buffer 104 corresponds to (are equal to or greater than) the standard input depth, and the depth of the output buffer 105 corresponds to (are equal to or greater than) the standard output depth.
[0149] According to an embodiment of the present disclosure, when the input link quantity is equal to 1 and the output link quantity is greater than 1, the controller 101 controls each computing unit in the computing unit array to set a calculation parameter (e.g., a convolution kernel in a CNN model), and controls the data acquirer 102 to set the input data of the output link quantity as one group of input data, and the output data corresponding to different input data in the group correspond to non-overlapping column sets in the computing unit array 103 and correspond to non-overlapping buffer areas in the output buffer 105. The controller 101 includes a data acquisition device 102. to input the input data of the group into the input buffer in order, and control the input buffer 104 to provide the input data of the group to the calculation unit array in order, so that every time the systolic array receives one of the input data of the group, the controller 101 processes the input data based on the calculation parameters of the calculation unit corresponding to the input data, and obtains output data corresponding to the input data. For each input data of the group of input data, the controller 101 controls the calculation unit array to output output data corresponding to the input data to a corresponding buffer area in the output buffer. Next, for the input data of the group, the controller 101 controls the output buffer 105 to provide output data corresponding to each input data of the group to the calculation unit array corresponding to the input data. buffer The output data for the output link quantity in the region is output in batches so as not to overlap each other.
[0150] According to an embodiment of the present disclosure, when the input connection quantity is greater than 1 and the output connection quantity is equal to 1, the controller 101 can control the data acquirer 102 to treat the input data of the input connection quantity as one group of input data. Here, different input data among the input data of the group correspond to non-overlapping row sets in the calculation unit array, and output data corresponding to different input data among the input data of the group all correspond to all columns in the calculation unit array and correspond to the whole or at least a part of the buffer area of the output buffer. The controller 101 can control the data acquirer 102 to input the input data of the group to the input buffer 104, and set the calculation parameters of each calculation unit required for calculation of each input data among the input data of the group to each calculation unit in turn. The controller 101 controls the systolic array to perform calculations on each input data among the input data of the group in turn, and in the calculation process of each input data, sets the calculation parameters of the calculation unit corresponding to the input data to a valid value, and sets the calculation parameters of the calculation units other than the calculation unit corresponding to the input data in the calculation unit array to 0. For example, for each input data, the calculation parameters of the calculation units in the row set corresponding to the input data are valid values, while the calculation parameters of the remaining calculation units are zero. The controller 101 controls the systolic array to output the output data corresponding to each input data to the output buffer in sequence. For example, the controller 101 controls the input buffer to provide the input data of the input connection quantity in parallel to the calculation unit array 103, and for the input data of the group, control the output data corresponding to each input data to be output to the whole or at least a part of the buffer area of the output buffer in sequence (according to the storage space of the output buffer), and output by the output buffer in sequence or in batches (according to the storage space of the output buffer).
[0151] According to an embodiment of the present disclosure, when the input connection quantity is greater than 1 and the output connection quantity is greater than 1, the controller 101 can determine a total connection quantity according to the input connection quantity and the output connection quantity, control the data retriever 102 to group the input data of the total connection quantity, and control the data retriever 102 to divide the input data of the group into at least one subgroup according to the input connection quantity and the output connection quantity, wherein each input data in each subgroup corresponds to a set of rows in the computing unit array that do not overlap with each other, the set of rows corresponds to the input connection quantity, and output data corresponding to different input data in the subgroup corresponds to a set of columns in the computing unit array that do not overlap with each other, and corresponds to a buffer area of the output buffer 105 that does not overlap with each other.
[0152] In some embodiments, the input connection quantity is greater than 1, the output connection quantity is greater than 1, and the input connection quantity is equal to the output connection quantity. In this case, the total connection quantity is the input connection quantity or the output connection quantity, and the quantity of the subgroup is 1. The controller 101 performs the following for the subgroups of the input data of the group: 、 The input buffer 104 may be controlled to provide the input data in the subgroup in parallel to the calculation unit array 103, and for the calculation of the subgroup, the calculation parameters of the calculation units corresponding to each input data among the input data of the subgroup may be set to valid values, and the calculation parameters of the remaining calculation units in the calculation unit array 103 other than the calculation units corresponding to each input data may be set to zero; the systolic array may be controlled to output output data corresponding to each input data in the subgroup to the output buffer 105, and the output buffer 105 may be controlled to output the output data in batches.
[0153] In some other embodiments, the input link quantity is an integer multiple of the output link quantity that is greater than 1. In this case, the total link quantity is the input link quantity, and the quantity of the input data in each subgroup included in the input data of the group is the output link quantity. The controller 101 controls the data acquirer 102 to input the input data of the total link quantity to the input buffer 104 in batches, controls the input buffer 104 to provide the input data in each subgroup in parallel to the calculation unit array 103, sets the calculation parameters of the calculation units corresponding to each input data in the subgroup to valid values for the calculation of each subgroup, controls the calculation parameters of the remaining calculation units in the calculation unit array other than the calculation units corresponding to each input data of the input data of the subgroup to zero, and for the input data of the group including the input data of the total link quantity, controls the calculation unit array 103 to output the output data corresponding to each subgroup to the output buffer 105 in sequence, and can also be output by the output buffer 105 in sequence or in batches (depending on the storage space of the output buffer).
[0154] In some other embodiments, the input link quantity is greater than the output link quantity but is not an integer multiple of it. In this case, the total link quantity is the output link quantity and the quantity of the subgroup is 1. The controller 101 can also control the data acquirer 102 to add N pieces of input data supplemented with zeros to the input data of the group (the value of N is equal to the input link quantity minus the output link quantity), control the data acquirer 102 to input the input data of the group to which the N pieces of input data have been added in batches to the input buffer 104, control the input buffer to provide the input data of the group in parallel to the calculation unit array 103, set the calculation parameters of the calculation units corresponding to each input data of the input data of the group to valid values for the calculation of the input data of the group, control the calculation parameters of the remaining calculation units in the calculation unit array other than the calculation units corresponding to each input data of the input data of the group to zero, control the calculation unit array 103 to output the output data corresponding to each input data of the input data of the group to the output buffer 105, and output the output data by the output buffer 105 in batches.
[0155] In some other embodiments, the output link quantity is an integer multiple of the input link quantity greater than 1. In this case, the total link quantity is the output link quantity, and the input data of each subgroup includes the input data of the input link quantity. The controller 101 controls the data acquirer 102 to input the input data of the total link quantity to the input buffer 104 in sequence for each subgroup for the calculation of the input data in each subgroup, controls the input buffer 104 to provide the input data in each subgroup in parallel to the calculation unit array, controls the calculation parameters of the calculation units corresponding to each input data in the subgroup to be set to valid values for the calculation of the input data of each subgroup, controls the calculation parameters of the remaining calculation units in the systolic array other than the calculation units corresponding to each input data in the subgroup to be set to zero, controls the calculation unit array 103 to output the output data corresponding to the input data of the group (including the input data of all subgroups) to the output buffer 105, and can also be output in batches by the output buffer 105. Here, when performing calculations on the input data in each subgroup, writing is performed only to the buffer area in the output buffer that corresponds to the output data of the input data of that subgroup, but writing to other buffer areas that correspond to output data corresponding to other subgroups other than that subgroup is prohibited.
[0156] In some other embodiments, the output link quantity is greater than the input link quantity but is not an integer multiple of it. In this case, the total link quantity is the input link quantity and the quantity of the subgroup is 1. The controller 101 can also control the data acquirer 102 to input the input data of the group to the input buffer 104 in a batch, control the input buffer 104 to provide the input data of the group to the computing unit array in parallel, set the calculation parameters of the computing units corresponding to each input data of the input data of the group to valid values for the calculation of the input data of the group, control the computing parameters of the remaining computing units in the computing unit array other than the computing units corresponding to each input data of the input data of the group to zero, control the computing unit array 103 to output each output data corresponding to the input data of the group to the output buffer 105, and output by the output buffer in a batch. Here, at least some values in the entire buffer area are 0.
[0157] For more details of the above operation of the controller 101, please refer to the contents described above with reference to Figures 2-10D, and the description will not be repeated here.
[0158] The controller or controllers may include any computing device capable of performing any of the above operations described herein, for example implemented or executed by a general purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof. A general purpose processor may be a microprocessor, a microcontroller, or the like. Any of the above operations described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a controller in the form of a processor, the operations may be stored on or transmitted by being encoded into one or more instructions or code on a computer readable storage medium.
[0159] To this end, embodiments of the present disclosure further provide a computer-readable storage medium having instructions or code stored thereon that, when executed by the processor, causes the controller to perform operations as described above.
[0160] The computer-readable storage medium may be a memory containing instructions or codes, which, when executed by a controller (processor), can complete all or part of the steps performed by the controller (including components controlling input buffers, etc., and DSPs in the computing units) in the computing device. For example, the computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0161] For illustrative purposes, the flowcharts and block diagrams in the drawings illustrate possible system architectures, functions, and operations of the methods and apparatus according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams may represent a module, a program segment, or a portion of code, which includes at least one executable instruction for implementing a certain logical function. It should also be noted that in some alternative implementations, the functions described in the blocks may be performed in a different order from the order described in the drawings. For example, two blocks shown in succession may actually be executed essentially in parallel, or may be executed in the reverse order depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented in a dedicated hardware-based system for executing a certain function or operation, or may be implemented in a combination of dedicated hardware and computer instructions.
[0162] The exemplary embodiments of the present disclosure described above are merely illustrative and not limiting. As should be understood by those skilled in the art, various modifications and combinations of these embodiments or features thereof are possible without departing from the principle and spirit of the present disclosure, and such modifications should be within the scope of the present disclosure. [Explanation of symbols]
[0163] 100 Computing equipment 101 Controller 102 Data Acquisition Device 103 Systolic Array 103 Computational Unit Array (Systolic Array) 103 Computational Units 103 Computational Unit Array 104 Input Buffer 105 Output Buffer 200 Data Processing Methods
Claims
1. A systolic array-based data processing method executed by a computing device, comprising: determining a standard input depth and a standard output depth of the systolic array and determining a target input depth and a target output depth of a shallow depth model; determining a number of input connections for the systolic array based on the target input depth and the standard input depth, and determining a number of output connections for the systolic array based on the target output depth and the standard output depth; generating input data of the input link quantity, inputting the input data of the input link quantity in a batch to an input buffer of the systolic array so as not to overlap each other, and processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data, wherein each input data has the target input depth and each output data has the target output depth; when the quantity of output data received by the output buffer of the systolic array from the systolic array reaches the output connection quantity, outputting the output data in the output buffer in a batch for the output connection quantity; Data processing methods, including:
2. determining a number of input connections for the systolic array based on the target input depth and the standard input depth, and determining a number of output connections for the systolic array based on the target output depth and the standard output depth, comprising: determining a ratio between the standard input depth and the target input depth, and defining the input connection quantity as an integer part of the ratio; determining a ratio between the standard output depth and the target output depth, and the output link quantity is an integer part of the ratio; The input connection quantity and / or the output connection quantity is an integer greater than 1; 2. The data processing method according to claim 1.
3. the systolic array is a computation unit array, the number of rows and the number of columns of the computation unit array corresponding to the standard input depth and the standard output depth, respectively; the input buffer depth corresponds to the standard input depth, and the output buffer depth corresponds to the standard output depth; 2. The data processing method according to claim 1.
4. the input connection quantity is equal to 1 and the output connection quantity is greater than 1, inputting the input data of the input connection quantity into an input buffer of the systolic array in batches so as not to overlap each other, and processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data, setting computation parameters for each computation unit in the systolic array; a step of grouping the input data of the output connection quantity into one group of input data, wherein output data corresponding to different input data of the group correspond to non-overlapping column sets in the systolic array and correspond to non-overlapping buffer regions of the output buffer; providing the input data of the group to the systolic array in sequence via the input buffer, so that each time the systolic array receives one of the input data of the group, the systolic array processes the input data according to a calculation parameter of a calculation unit corresponding to the input data, and obtains output data corresponding to the input data; for each input data of the group of input data, outputting output data corresponding to the input data to a buffer area corresponding to the output data; The step of outputting the output data in the output buffer in a batch for the output connection quantity includes: outputting, by the output buffer, output data of the output link quantity in each buffer area of the output buffer in a batch so as not to overlap each other, for the input data of the group; 2. The data processing method according to claim 1.
5. For each input data of the group of input data, outputting output data corresponding to the input data to a buffer area corresponding to the output data, a step of prohibiting writing to a buffer area corresponding to output data corresponding to input data other than the input data to be calculated among the input data of the group when performing a calculation on each input data; 5. The data processing method according to claim 4.
6. the input connection quantity being greater than 1 and the output connection quantity being equal to 1, inputting input data of the input connection quantity into an input buffer of the systolic array in batches so as not to overlap each other, and processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data, a step of grouping the input data of the input connection quantity into one group of input data, wherein different input data of the group correspond to non-overlapping row sets in the systolic array, and output data corresponding to different input data of the group all correspond to all columns in the systolic array; providing input data of the group in parallel to the systolic array via the input buffer; performing calculations on each input data of the group in order, and in the calculation process of each input data, setting the calculation parameters of the calculation unit corresponding to the input data to valid values, and setting the calculation parameters of the calculation units in the systolic array other than the calculation unit corresponding to the input data to 0; outputting output data corresponding to each input data to an output buffer in sequence; 2. The data processing method according to claim 1.
7. the input connection quantity being greater than 1 and the output connection quantity being greater than 1, inputting input data of the input connection quantity into an input buffer of the systolic array in batches so as not to overlap each other, and processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data, determining a total link quantity based on the input link quantity and the output link quantity; A step of grouping the input data of the total linked quantity into one group of input data; dividing the input data of the group into at least one subgroup based on the input connection quantity and the output connection quantity, wherein each input data in each subgroup corresponds to a set of rows in the systolic array that are non-overlapping with respect to the input connection quantity, and output data corresponding to different input data in the subgroup corresponds to a set of columns in the systolic array that are non-overlapping with respect to each other and corresponds to buffer regions in the output buffer that are non-overlapping with respect to each other.
2. The data processing method according to claim 1.
8. When the input link quantity is equal to the output link quantity, the total link quantity is the input link quantity, and the number of subgroups included in the input data of the group is 1, inputting the input data of the input link quantity into the input buffer of the systolic array in batches so as not to overlap each other, and processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data, for a subgroup of input data of the group, providing input data in the subgroup in parallel to the systolic array via the input buffer; for the calculation of the subgroup, setting the calculation parameters of the calculation units corresponding to each input data among the input data of the subgroup to valid values, and setting the calculation parameters of the remaining calculation units in the systolic array other than the calculation units corresponding to each input data to zero; outputting output data corresponding to each input data in the subgroup to an output buffer. The data processing method according to claim 7.
9. when the input link quantity is an integer multiple of the output link quantity greater than 1, the total link quantity is the input link quantity, and the quantity of input data in each subgroup included in the input data of the group is the output link quantity, inputting the input data of the input link quantity into an input buffer of the systolic array in batches so as not to overlap each other, and processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data, providing input data in each subgroup in parallel to the systolic array via the input buffer; For each subgroup calculation, setting the calculation parameters of the calculation units corresponding to each input data in the subgroup to valid values, and setting the calculation parameters of the remaining calculation units in the systolic array other than the calculation units corresponding to each input data of the subgroup to zero; outputting the output data corresponding to each subgroup to an output buffer in sequence; The data processing method according to claim 7.
10. if the input link quantity is greater than the output link quantity but not an integral multiple thereof, the total link quantity is the output link quantity, the number of subgroups included in the input data of the group is 1, inputting the input data of the input link quantity into the input buffer of the systolic array in batches so as not to overlap each other, and processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data; adding N zero-filled input data to the input data of the group, the value of N being equal to the input link quantity minus the output link quantity; providing input data of the group in parallel to the systolic array via the input buffer; For the calculation of the input data of the group, setting the calculation parameters of the calculation units corresponding to each input data of the input data of the group to valid values, and setting the calculation parameters of the remaining calculation units in the systolic array other than the calculation units corresponding to each input data of the input data of the group to zero; outputting output data corresponding to each input data of the group of input data to an output buffer; The data processing method according to claim 7.
11. when the output link quantity is an integer multiple of the input link quantity greater than 1, the total link quantity is the output link quantity, and the input data of each of the subgroups includes input data of the input link quantity, inputting the input data of the input link quantity into an input buffer of the systolic array in batches so as not to overlap with each other, and processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data, providing input data in each subgroup in parallel to the systolic array via the input buffer for computation of the input data in that subgroup; setting the computation parameters of the computation units corresponding to each input data in the subgroup to valid values, and setting the computation parameters of the remaining computation units in the systolic array other than the computation units corresponding to each input data in the subgroup to zero; outputting output data corresponding to the input data of the group to an output buffer; When performing a calculation on the input data in each subgroup, writing is performed only to a buffer area corresponding to the output data corresponding to the subgroup, but writing to a buffer area corresponding to the output data corresponding to other subgroups other than the subgroup is prohibited. The data processing method according to claim 7.
12. if the output link quantity is greater than the input link quantity but not an integer multiple thereof, the total link quantity is the input link quantity and the number of subgroups is 1, inputting the input link quantity of input data into the input buffer of the systolic array in batches without overlapping each other, and processing the input data in the input buffer by the systolic array to generate output data corresponding to each input data; providing input data of the group in parallel to the systolic array via the input buffer; For the calculation of the input data of the group, setting the calculation parameters of the calculation units corresponding to each input data of the input data of the group to valid values, and setting the calculation parameters of the remaining calculation units in the systolic array other than the calculation units corresponding to each input data of the input data of the group to zero; outputting output data corresponding to the input data of the group to an output buffer; The data processing method according to claim 7.
13. A computing device comprising: a controller; a data acquirer; a systolic array; an input buffer; and an output buffer, the systolic array being an array of computational units; the controller determines a standard input depth and a standard output depth of the systolic array and determines a target input depth and a target output depth of a shallow depth model; the controller determines a number of input connections for the systolic array based on the target input depth and the standard input depth, and determines a number of output connections for the systolic array based on the target output depth and the standard output depth; the controller controls the data acquirer to acquire and generate input data of the input link quantity, input the input data of the input link quantity to an input buffer of the systolic array in batches so as not to overlap with each other, controls the systolic array to process the input data in the input buffer and generate output data corresponding to each input data, and when the quantity of output data received by an output buffer of the systolic array from the systolic array reaches the output link quantity, controls an output buffer to output the output data of the output link quantity in batches, each input data having the target input depth and each output data having the target output depth. computing device.
14. A computer program causing a computer to carry out the data processing method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Systolic array calculation structure and method for convolutional neural network
CN110543934A
Deep learning hardware system based on systolic array architecture
CN111506344A
Matrix arithmetic device
JP2015056124A
Processor and control method for processor
JP2020077298A
Systolic arithmetic on sparse data
JP2021082289A
