Mixed granularity sparse neural network training accelerator and calculation acceleration method

By adopting a mixed-granularity sparse training accelerator in the neural network accelerator and utilizing row bitmap and element bitmap caches, the coarse- and fine-grained sparsity in the neural network training process can be utilized, which solves the problem of difficulty in reducing computing and energy consumption in the existing technology. problem, improve training efficiency and reduce energy consumption.

CN118569329AActive Publication Date: 2024-08-30TIANJIN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410729121.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-08-30
Estimated Expiration
2044-06-06

AI Technical Summary

Technical Problem

Existing neural network accelerators are difficult to fully utilize the sparsity of coarse and fine granularity in the neural network training process, resulting in the inability to effectively reduce computing and energy consumption.

Method used

Design a hybrid-granularity sparse neural network training accelerator, using multi-channel parallel sparse computing modules, combined with row bitmap and element bitmap cache, to achieve coarse and fine granularity of convolution calculations through row sparse skip units and sparse convolution units Sparsity exploit, skip invalid calculations and accumulate.

Benefits of technology

It improves the efficiency of neural network training and reduces energy consumption, and fully utilizes the coarse- and fine-grained sparsity of inputs, weights, and outputs in the neural network training process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569329A
    Figure CN118569329A
Patent Text Reader

Abstract

The invention discloses a mixed granularity sparse neural network training accelerator and a calculation acceleration method. The mixed granularity sparse neural network training accelerator comprises an input cache, a weight cache, an output cache, a line bitmap cache, an element bitmap cache and a sparse calculation module. The sparse calculation module further comprises a row sparse skipping unit, a plurality of sparse convolution units and an accumulator; using a row and element two-level bitmap to represent sparsity of row and element granularity of input, weight and output of convolution calculation in different stages of neural network training; aiming at a non-zero mark of an output slide map, carrying out sliding matching on the input and weighted slide maps, discovering and eliminating invalid one-dimensional convolution calculation containing all-zero lines, and realizing utilization of coarseness sparse; in the process of executing effective one-dimensional convolution calculation, invalid multiply-accumulate calculation containing zero values is found and eliminated, and utilization of fine-grained sparsity is achieved. Compared with the prior art, the neural network training efficiency can be improved, and the training duration and energy consumption can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of neural network accelerators, relates to the design of neural network accelerators, and particularly to an accelerator for sparse neural network training. Background Art

[0002] With the development of deep learning technology, more and more deep neural networks (DNNs) are deployed on edge devices to achieve fast response in different application scenarios. Neural networks are usually pre-trained by high-computing devices such as cloud servers, and then deployed to edge devices for inference. However, there are usually differences between pre-trained data sets and the real data of edge devices in specific application environments, which may cause the model accuracy to decrease, and the network needs to be fine-tuned based on the user's real data. Sending these real data back to the cloud server to re-fine-tune the model will face the risks of network latency and data security. Therefore, retraining the model directly in the edge device becomes one of the more effective solutions.

[0003] However, the training process of a neural network includes three processes: forward propagation, back propagation, and weight gradient calculation. All three processes involve a large number of convolution calculations, which are often unbearable for edge devices with limited computing power and energy consumption. In recent years, the development of neural network pruning technology and the widespread use of the ReLU (linear rectification function) activation function have introduced a large number of zero values ​​that can be skipped for calculation into the neural network, namely sparsity. Using sparsity to reduce the calculation and energy consumption of the training process has become a research hotspot in recent years.

[0004] Existing accelerators mainly use various methods to check and skip the calculation of single zero-value elements contained in the neural network training process one by one, that is, fine-grained sparsity. However, neural networks usually also contain coarse-grained sparsity, that is, continuous and large numbers of zero values, such as all-zero channels in weights caused by structured pruning, all-zero rows filled in deconvolution operations, etc. If coarse-grained sparsity is also utilized, more invalid calculations can be skipped at one time, further improving the efficiency of sparse detection and calculation. Therefore, it is necessary to design a training accelerator that supports mixed-grained sparsity, which can fully utilize the coarse-grained and fine-grained sparsity in the above-mentioned neural network training process at the same time. Summary of the invention

[0005] To solve the above problems, the present invention proposes a mixed-granularity sparse neural network training accelerator and an accelerated computing method, which realizes a convolution computing accelerator for fine-grained sparse neural network training with mixed row granularity and element granularity.

[0006] In order to achieve the above-mentioned object of the invention, the present invention proposes the following technical solutions:

[0007] A hybrid granularity sparse neural network training accelerator, comprising an input cache, a weight cache, an output cache, a row bitmap cache, an element bitmap cache and a sparse computing module; wherein the sparse computing modules connected in multiple parallel paths are arranged between the input cache and the output cache, and are respectively connected to the row bitmap cache and the element bitmap cache;

[0008] The input buffer is used to store input data of the convolution calculation and transmit the input data to the sparse convolution unit;

[0009] The weight cache is used to store weight data of convolution calculation and transmit the weight data to the sparse convolution unit;

[0010] The output buffer is used to store the output data of the convolution calculation;

[0011] The row bitmap cache is used to store the row bitmaps of the convolution calculation input, weight and output, and transmit the row bitmaps to the row sparse skip unit; specifically, the row bitmap cache adopts the row bitmap format in the two-level bitmap sparse representation format;

[0012] The element bitmap cache is used to store the element bitmaps of the convolution calculation input, weight and output, and transmit the element bitmaps to the sparse convolution unit; specifically, the element bitmap cache adopts the element bitmap format in the two-level bitmap sparse representation format;

[0013] Each of the sparse computing modules further includes a row sparse skip unit and a plurality of sparse convolution units served by the row sparse skip unit and an accumulator for accumulating the results of the sparse convolution units, each of the row sparse skip units forms a matrix connection with each of the sparse convolution units, each of the sparse convolution units is commonly connected to the accumulator, and is connected to the output buffer via the accumulator; the sparse computing module is used to complete the convolution operation corresponding to an output graph during the acceleration process;

[0014] The row sparse skipping unit is used to identify the non-zero flag in the output row bitmap and perform sliding matching on the row bitmap of the convolution calculation input and weight, eliminate invalid one-dimensional convolution calculations containing all-zero row inputs, weights or outputs, and record the index of the valid one-dimensional convolution calculation input data row and the index of the weight row;

[0015] The sparse convolution unit obtains the input data of the convolution calculation from the input cache according to the index of the effective one-dimensional convolution calculation input data row, obtains the weight data of the convolution calculation from the weight cache according to the index of the weight row, and obtains the element bitmap from the element bitmap cache, identifies the non-zero flag in the output element bitmap and performs sliding matching on the element bitmap of the effective one-dimensional convolution convolution calculation input and weight, finds and eliminates invalid multiplication and accumulation calculations containing zero values ​​in the process of executing the effective one-dimensional convolution calculation, and obtains the partial sum data of the convolution calculation of each sparse convolution unit;

[0016] The accumulator is used to accumulate the partial sum data of the convolution calculations of multiple sparse convolution units to obtain the total output data of the convolution calculations.

[0017] The invention relates to an accelerated computing method based on a hybrid granularity sparse neural network training accelerator, comprising the following steps:

[0018] Two-level bitmaps of row and element are used to represent the sparsity of row and element granularity of input, weight and output of convolution calculation in different stages of neural network training; for each non-zero flag of output row bitmap, sliding matching is performed on the row bitmaps of input and weight to find and eliminate invalid one-dimensional convolution calculations containing all-zero rows, thereby realizing coarse-grained sparsity acceleration of convolution calculation; for each non-zero flag of output element bitmap, sliding matching is performed on the element bitmaps of input and weight to find and eliminate invalid multiplication and accumulation calculations containing zero values ​​in the process of executing valid one-dimensional convolution calculations, thereby realizing fine-grained sparsity acceleration of convolution calculation.

[0019] Compared with the prior art, the present invention can make full use of the coarse and fine granularity sparsity of the input, weight and output of the neural network at different stages of training, improve the efficiency of neural network training, and reduce training time and energy consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A schematic diagram of a mixed granularity sparse neural network training accelerator of the present invention;

[0021] Figure 2 A schematic diagram of a two-level bitmap sparse representation format adopted by the present invention;

[0022] Figure 3 A schematic diagram of the data flow for implementing mixed granularity sparse computing in the present invention;

[0023] Figure 4 This is a schematic diagram of a row sparse skip unit of the present invention;

[0024] Figure 5 Schematic diagram of a sparse convolution unit of the present invention;

[0025] Figure 6Schematic diagram of the working mechanism of the sparse convolution unit of the present invention;

[0026] Figure 7 The present invention is a flow chart of an accelerated computing method implemented by a hybrid granularity sparse neural network training accelerator. DETAILED DESCRIPTION

[0027] The present invention is further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation methods described herein are only used to explain the present invention and are not used to limit the present invention.

[0028] Embodiment 1:

[0029] like Figure 1 As shown, a hybrid granularity sparse neural network training accelerator of the present invention includes an input cache, a weight cache, an output cache, a row bitmap cache, an element bitmap cache and N sparse computing modules. The multi-path parallel sparse computing modules are arranged between the input cache and the output cache.

[0030] Input buffer, used to store input data for convolution calculation and transmit input data to sparse convolution unit;

[0031] Weight cache, used to store weight data of convolution calculation and transmit weight data to sparse convolution unit;

[0032] Output buffer, used to store the output data of convolution calculation;

[0033] A row bitmap cache is used to store row bitmaps of convolution calculation input, weight and output, and transmit the row bitmap to the row sparse skip unit; specifically, the row bitmap cache adopts the row bitmap format in the two-level bitmap sparse representation format;

[0034] An element bitmap cache is used to store element bitmaps of convolution calculation input, weight and output, and transmit the element bitmap to the sparse convolution unit; specifically, the element bitmap cache adopts the element bitmap format in the two-level bitmap sparse representation format;

[0035] The sparse computing module includes a row sparse skip unit and M sparse convolution units served by it and an accumulator for accumulating the results of the sparse convolution units; each row sparse skip unit forms a matrix connection with each sparse convolution unit, each sparse convolution unit is connected to the accumulator, and is connected to the output buffer through the accumulator. The sparse computing module is used to complete the convolution operation corresponding to an output graph during the acceleration process. Specifically, the output graph is an output feature graph of an output channel in the forward propagation stage; an error of an input channel in the backward propagation stage; and a gradient of a weight kernel in the weight gradient calculation stage.

[0036] A row sparse skip unit is used to execute the row sparse skip stage in the mixed granularity sparse calculation data flow. Specifically, the row sparse skip unit obtains the row bitmap of the convolution calculation input, weight and output from the row bitmap cache and performs sliding matching, removes invalid one-dimensional convolution calculations containing all-zero row input, weight or output, and records the index of the valid one-dimensional convolution calculation input data row and the index of the weight row and assigns them to the sparse convolution unit it serves;

[0037] A sparse convolution unit is used to execute the sparse convolution stage in the mixed granularity sparse calculation data stream. Specifically, the input data of the convolution calculation is obtained from the input cache according to the index of the effective one-dimensional convolution calculation input data row, the weight data of the convolution calculation is obtained from the weight cache according to the index of the weight row, and the element bitmap is obtained from the element bitmap cache, the non-zero flag in the output element bitmap is identified, and the element bitmap of the effective one-dimensional convolution convolution calculation input and weight is sliding matched, and in the process of executing the effective one-dimensional convolution calculation, invalid multiplication and accumulation calculations containing zero values ​​are found and eliminated, and the partial sum data of the convolution calculation of each of the sparse convolution units is obtained;

[0038] The accumulator is used to accumulate the partial sum data of the convolution calculations of multiple sparse convolution units to obtain the total output data of the convolution calculations and transmit it to the output buffer.

[0039] like Figure 2 As shown, the data structure of the two-level bitmap sparse representation format adopted by the present invention is composed of non-zero data, element bitmap and row bitmap. The row bitmap indicates whether a row in the data matrix is ​​all zero values, the all-zero row in the data matrix corresponds to the 0 of the flag bit in the row bitmap, and the non-all-zero row (a row containing at least one non-zero element) corresponds to the 1 of the flag bit in the row bitmap; the element bitmap indicates the position of the non-zero value in a non-all-zero row, the non-zero value in the row corresponds to the 1 of the corresponding flag bit in the element bitmap, and the zero value corresponds to the 0 of the corresponding flag bit of the non-zero element; the non-zero data includes the non-zero value in the data matrix. For the all-zero rows in the data matrix, a row of all-zero flag bits in the element bitmap can be replaced by a 1-bit flag in the row bitmap, thereby reducing the amount of data indexed under high sparsity. In addition, the accelerator can use the row bitmap to skip the one-dimensional convolution calculation containing all-zero rows, and use the coarse-grained sparsity; the accelerator can use the element bitmap to skip the multiplication and accumulation calculation containing zero values, and use the fine-grained sparsity.

[0040] In the specific implementation of the present invention, this sparse representation format is adopted for the convolution input data and weight data in the acceleration stage. In addition, in order to realize the utilization of the prior output sparsity, the element bitmap and row bitmap corresponding to the output of the convolution calculation are also sent to the accelerator. Specifically, when the acceleration stage is the forward propagation stage, the convolution input is the input activation value of the current layer, the weight is the weight of the neural network layer, and the output is the output activation value of the current layer; when the acceleration stage is the reverse propagation stage, the convolution input is the error value of the current layer, the weight is the weight of the neural network layer, and the output is the error value of the previous layer; when the acceleration stage is the weight gradient calculation stage, the input value is the input activation value of the current layer, the weight is the error value of the previous layer, and the output is the weight gradient value of the current layer.

[0041] like Figure 3 As shown, the data flow for implementing hybrid granularity sparse computing in the present invention is based on the two-level bitmap sparse representation format, and includes two stages, one is a row sparse skipping stage for utilizing coarse-grained sparsity, and the other is a sparse convolution stage for utilizing fine-grained sparsity. The white squares in the convolution input matrix and the convolution weight matrix used for convolution computing in the figure represent zero values.

[0042] For an output row of convolution calculation, the calculation in the corresponding convolution sliding window can be divided into one-dimensional convolution calculations of several pairs of input rows and their corresponding weight rows. The partial sums obtained by these one-dimensional convolution calculations can be accumulated to obtain the final result of the output row. The row sparse skipping stage first identifies the valid one-dimensional convolution calculations between non-all-zero input rows and non-all-zero weight rows in the convolution sliding window according to the row bitmap, eliminates invalid one-dimensional convolution calculations containing all-zero input rows or all-zero weight rows, and records the index of the convolution input rows and convolution weight rows of each pair of valid one-dimensional convolution calculations for the sparse convolution stage to load the corresponding non-zero data and element bitmap.

[0043] The sparse convolution stage obtains the element bitmap and non-zero data of the corresponding convolution input row and weight row according to the index obtained in the row sparse skip stage, performs one-dimensional sparse convolution calculation on the convolution input row and weight row, and obtains a series of partial sums. The complete result of an output row of the convolution calculation can be obtained by accumulating the partial sums. After completing an output row of the convolution calculation, the convolution sliding window moves down, and the above two stages are re-executed until the entire convolution calculation is completed.

[0044] like Figure 4 As shown, the row sparse skip unit of the present invention includes a row bitmap detector and a matching row memory, wherein: the row bitmap detector is used to perform sliding matching on the row bitmaps of the convolution input, weight and output transmitted from the bitmap cache, and obtain the address indexes of the input rows and weight rows of the effective one-dimensional convolution calculation in the input cache and the weight cache.

[0045] The sliding matching process of the row bitmap detector is as follows:

[0046] The row bitmap detector first checks the flag bit in the output row bitmap, skipping the coarse-grained prior output sparsity in the back-propagation stage or the weight calculation stage. If the flag bit of the row bitmap of the output row is 0, the row bitmap detector will not generate any index, so all one-dimensional convolution calculations corresponding to the output row will be skipped. If the flag bit of the row bitmap of the output row is 1, the row bitmap detector will further match the row bitmaps of the convolution input and weights. Only when the row bitmap flags of the convolution input and weights are both 1 in the corresponding positions, the row bitmap detector will generate an index, and the one-dimensional convolution corresponding to the index will be performed. Otherwise, the row bitmap detector will not generate an index, skipping the one-dimensional convolution of the convolution input row and the weight row.

[0047] The matching row memory is used to record the address index generated by the row bitmap detector and distribute it to the M sparse convolution units it serves.

[0048] like Figure 5 As shown, the sparse convolution unit of the present invention includes:

[0049] An input register group, used to store input values ​​of one-dimensional convolution calculation;

[0050] A weight register group, used to store weight values ​​for one-dimensional convolution calculation;

[0051] The partial sum register group is used to store the partial sum results of the one-dimensional convolution calculation and send them to the corresponding accumulator;

[0052] An output skip controller is used to detect the output element bitmap of the one-dimensional convolution calculation, skip the prior output sparsity caused by the ReLU activation function or pruning, and output a shift enable signal to the shifter to control the sliding of the one-dimensional convolution sliding window;

[0053] A shifter, used to shift the weight element bitmap to achieve sliding of the one-dimensional convolution window;

[0054] A bitmap matcher is used to perform an AND operation on the input element bitmap and the weight element bitmap after shifting and sliding, so as to obtain a valid bitmap of the input and weight that actually needs to participate in the multiplication and accumulation calculation;

[0055] A bitmap decoder is used to decode the effective bitmap to obtain the addresses of the non-zero input values ​​and non-zero weight values ​​required to participate in the multiplication and accumulation calculation in the input register group and the weight register group;

[0056] A multiply-accumulator, configured to perform a multiply-accumulate operation on the non-zero input value and the non-zero weight value to obtain a partial sum result of the one-dimensional convolution calculation;

[0057] The memory access control module is used to send the address index passed by the sparse skip unit to each cache to load the input value and weight value of the one-dimensional convolution calculation.

[0058] The bitmap matcher is connected in parallel with the bitmap decoder through the input end and the output end, the output end of the shifter is connected to the input end of the bitmap matcher, the output end of the output skip controller is connected to the enable end of the shifter, the input end of the bitmap matcher inputs the element bitmap, the input end of the shifter inputs the weight element bitmap, the output skip controller outputs the shift enable signal, the address end of the input register group is connected to the output end of the bitmap decoder to obtain the input value address, the address end of the weight register group is connected to the output end of the bitmap decoder to obtain the weight value address, the output ends of the input register group and the weight register group are respectively connected to the input end of the multiplication accumulator, the output end of the multiplication accumulator is connected to the input end of the partial sum register, and the output end of the partial sum register is sent to the accumulator.

[0059] like Figure 6 As shown, a schematic diagram of the working mechanism of the sparse convolution unit of the present invention. The basic task of the sparse convolution unit is to perform a one-dimensional sparse convolution calculation of a row of convolution input values ​​and a row of weight values ​​to obtain a row of partial sum results. The sparse convolution unit calculates each output value in sequence. For each output value, the output skip controller in the sparse convolution unit first checks the corresponding flag bit of the output value in the output element bitmap to skip the fine-grained prior output sparsity during back propagation and weight gradient calculation. If the flag bit of the output element bitmap is 1, it means that the output element needs to be calculated. The sparse convolution unit then uses a bitmap matcher to perform an AND operation on the element bitmap of the convolution input and the element bitmap of the weight to obtain a valid bitmap. 1 in the valid bitmap indicates that the input value and weight value corresponding to the position need to be multiplied and added; 0 in the valid bitmap indicates that the multiplication and addition operation of the input value and weight value corresponding to the position can be skipped. The valid bitmap is then sent to the bitmap decoder for decoding to obtain the addresses of the input value and weight value in the input register group and the weight register group. The input register group and the weight register group output the input value and weight value to be calculated to the multiplication and accumulation device according to the address. Through the above steps, only when the input value and the weight value are both non-zero will they be input into the multiplication and accumulation device for calculation, thus realizing the utilization of fine-grained input and weight sparsity. The partial sum result calculated by multiplication and accumulation is written into the corresponding position in the partial sum register. When all the values ​​to be calculated in the valid bitmap are calculated, the weight element bitmap will be logically shifted right by the shifter to realize the sliding window movement of the one-dimensional convolution and calculate the next output element. If the value of the output element bitmap is 0, it means that the output element does not need to be calculated. At this time, the weight element bitmap is directly shifted right, that is, the sliding window of the one-dimensional convolution is moved to the right, and the calculation of the next output element begins, thus realizing the utilization of fine-grained prior output sparsity.

[0060] Embodiment 2:

[0061] like Figure 7 As shown, an accelerated calculation method implemented by a hybrid granularity sparse neural network training accelerator based on the present invention, a row bitmap and an element bitmap are used to form a two-level bitmap to represent the sparsity of the row and element granularity of the input, weight and output of the convolution calculation in different stages of the neural network training; for each output row bitmap non-zero flag, the row sparse skip unit performs sliding matching on the row bitmap of the input and weight, discovers and eliminates invalid one-dimensional convolution calculations containing all zero rows, and realizes the utilization of coarse-grained sparsity; for each output element bitmap non-zero flag, the sparse convolution unit performs sliding matching on the element bitmap of the input and weight, discovers and eliminates invalid multiplication and accumulation calculations containing zero values ​​in the process of executing effective one-dimensional convolution calculations, and realizes the utilization of fine-grained sparsity. The present invention can make full use of the sparsity of coarse and fine granularity in the input, weight and output of the neural network at different stages of training, improve the efficiency of neural network training, and reduce training time and energy consumption.

[0062] In summary, the present invention can skip the coarse-grained sparsity of input, weight and output in the process of neural network training through sparse skip units, and utilize the fine-grained sparsity of input, weight and output in the process of neural network training through sparse convolution units, thereby achieving the purpose of improving the efficiency of neural network training and reducing training time and energy consumption.

[0063] The above is only a preferred embodiment of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A hybrid granularity sparse neural network training accelerator, characterized in that: It includes an input cache, a weight cache, an output cache, a row bitmap cache, an element bitmap cache and a sparse computing module; wherein the sparse computing module connected in multiple parallel paths is arranged between the input cache and the output cache, and is connected to the row bitmap cache and the element bitmap cache respectively; The input buffer is used to store input data of the convolution calculation and transmit the input data to the sparse convolution unit; The weight cache is used to store weight data of convolution calculation and transmit the weight data to the sparse convolution unit; The output buffer is used to store the output data of the convolution calculation; The row bitmap cache is used to store the row bitmaps of the convolution calculation input, weight and output, and transmit the row bitmaps to the row sparse skip unit; specifically, the row bitmap cache adopts the row bitmap format in the two-level bitmap sparse representation format; The element bitmap cache is used to store the element bitmaps of the convolution calculation input, weight and output, and transmit the element bitmaps to the sparse convolution unit; specifically, the element bitmap cache adopts the element bitmap format in the two-level bitmap sparse representation format; Each of the sparse computing modules further includes a row sparse skip unit and a plurality of sparse convolution units served by the row sparse skip unit and an accumulator for accumulating the results of the sparse convolution units, each of the row sparse skip units forms a matrix connection with each of the sparse convolution units, each of the sparse convolution units is commonly connected to the accumulator, and is connected to the output buffer via the accumulator; the sparse computing module is used to complete the convolution operation corresponding to an output graph during the acceleration process; The row sparse skipping unit is used to identify the non-zero flag in the output row bitmap and perform sliding matching on the row bitmap of the convolution calculation input and weight, eliminate invalid one-dimensional convolution calculations containing all-zero row inputs, weights or outputs, and record the index of the valid one-dimensional convolution calculation input data row and the index of the weight row; The sparse convolution unit obtains the input data of the convolution calculation from the input cache according to the index of the effective one-dimensional convolution calculation input data row, obtains the weight data of the convolution calculation from the weight cache according to the index of the weight row, and obtains the element bitmap from the element bitmap cache, identifies the non-zero flag in the output element bitmap and performs sliding matching on the element bitmap of the effective one-dimensional convolution convolution calculation input and weight, finds and eliminates invalid multiplication and accumulation calculations containing zero values ​​in the process of executing the effective one-dimensional convolution calculation, and obtains the partial sum data of the convolution calculation of each sparse convolution unit; The accumulator is used to accumulate the partial sum data of the convolution calculations of multiple sparse convolution units to obtain the total output data of the convolution calculations and transmit it to the output buffer.

2. A hybrid granularity sparse neural network training accelerator according to claim 1, characterized in that: The convolution input and the convolution weight are both stored in a two-level bitmap sparse representation format, and the two-level bitmap sparse representation format consists of non-zero data, an element bitmap, and a row bitmap.

3. A hybrid granularity sparse neural network training accelerator according to claim 1, characterized in that: One row sparse skip unit serves multiple sparse convolution units simultaneously, and accumulates the partial sums of the sparse convolution units through an accumulator.

4. A hybrid granularity sparse neural network training accelerator according to claim 1, characterized in that: The row sparse skipping unit further comprises: The row bitmap detector is used to perform sliding matching on the row bitmaps of the convolution input, weight and output passed in by the bitmap cache, and obtain the address indexes of the input row and weight row containing the effective one-dimensional convolution calculation in the input cache and the weight cache; the sliding matching specifically includes that the row bitmap detector first checks the flag bit in the output row bitmap, and skips the coarse-grained prior output sparsity in the back propagation stage or the weight calculation stage; if the flag bit of the row bitmap of the output row is 0, the row bitmap detector will not generate any index, and all one-dimensional convolution calculations corresponding to the output row will be skipped; if the flag bit of the row bitmap of the output row is 1, the row bitmap detector will further match the row bitmaps of the convolution input and weight: only when the row bitmap flags of the convolution input and weight are both 1 at the corresponding positions, the row bitmap detector will generate an index, and the one-dimensional convolution corresponding to the index will be executed; otherwise, the row bitmap detector will not generate an index, and the one-dimensional convolution of the convolution input row and the weight row will be skipped; The matching row memory is used to record the address index obtained by the row bitmap detector and allocate the address index to the sparse convolution unit.

5. A hybrid granularity sparse neural network training accelerator according to claim 4, characterized in that: The row bitmap detector first checks the flag bit in the output row bitmap, skipping the coarse-grained prior output sparsity in the back-propagation phase or the weight calculation phase; If the flag bit of an output row is 0, the row bitmap detector will not generate any index, so all one-dimensional convolution calculations corresponding to this output row will be skipped; If the flag bit of the output row is 1, the row bitmap detector will further match the row bitmap of the convolution input and weight; When the row bitmap flags of the convolution input and weight are both 1 at the corresponding positions, the row bitmap detector generates the index of the corresponding one-dimensional convolution; otherwise, the row bitmap detector will not generate an index and skip the one-dimensional convolution of the convolution input row and weight row.

6. A hybrid granularity sparse neural network training accelerator according to claim 1, characterized in that: The sparse convolution unit further includes an input register group, a weight register group, a partial sum register group, an output skip controller, a shifter, a bitmap matcher, a bitmap decoder and a multiplication accumulator; wherein the bitmap matcher is connected in parallel with the bitmap decoder through an input end and an output end, the output end of the shifter is connected to the input end of the bitmap matcher, the output end of the output skip controller is connected to the enable end of another input of the shifter, the input end of the bitmap matcher inputs an element bitmap, the input end of the shifter inputs a weight element bitmap, the output skip controller outputs a shift enable signal, the output skip controller outputs an element bitmap, the input address end of the input register group is connected to the output end of the bitmap decoder to obtain an input value address, the input address end of the weight register group is connected to the output end of the bitmap decoder to obtain a weight value address, the output ends of the input register group, the weight register group, and the partial sum register are respectively connected to the input end of the multiplication accumulator, the output end of the multiplication accumulator is connected to the input end of the partial sum register, and the output end of the partial sum register is sent to the accumulator; The input register group is used to store the input of the one-dimensional convolution calculation; The weight register group is used to store the weights of the one-dimensional convolution calculation; The partial sum register group is used to store the partial sum result of the one-dimensional convolution calculation and send it to the corresponding accumulator; The output skip controller is used to detect the element bitmap output by the convolution calculation to skip the prior output sparsity caused by the ReLU activation function or pruning, and output a shift enable signal to the shifter to control the sliding of the one-dimensional convolution sliding window; The shifter is used to perform a shift operation on the weight element bitmap to achieve sliding of the one-dimensional convolution sliding window; The bitmap matcher is used to perform an AND operation on the input element bitmap and the weight element bitmap to obtain a valid bitmap of the input and weight that actually needs to participate in the multiplication and accumulation calculation; The bitmap decoder is used to decode the effective bitmap to obtain the addresses of the non-zero input values ​​and non-zero weight values ​​required to participate in the multiplication and accumulation calculation in the input register group and the weight register group; The multiplication and accumulation device is used to perform a multiplication and accumulation calculation on the non-zero input value and the non-zero weight value to obtain a partial sum result of the one-dimensional convolution calculation.

7. A hybrid granularity sparse neural network training accelerator according to claim 6, characterized in that: The sparse convolution unit calculates each output value in sequence. For each output value, the output skip controller in the sparse convolution unit first checks the corresponding flag bit of the output value in the output element bitmap to skip the fine-grained prior output sparsity during back propagation and weight gradient calculation; The sparse convolution unit uses a bitmap matcher to perform an AND operation on the element bitmap of the convolution input and the element bitmap of the weight to obtain a valid bitmap; The effective bitmap is then sent to the bitmap decoder for bitmap decoding to obtain the addresses of the input value and the weight value in the input register group and the weight register group; The input register group and the weight register group output the input value and the weight value to be calculated to the multiplier accumulator according to the address; The partial sum results calculated by multiplication and accumulation are written into the corresponding positions in the partial sum registers; When all the values ​​to be calculated in the valid bitmap of an output element are calculated, the weight bitmap will be logically shifted right by the shifter to realize the sliding window movement of the one-dimensional convolution and calculate the next output element.

8. The accelerated computing method implemented by the hybrid granularity sparse neural network training accelerator according to any one of claims 1 to 7, characterized in that: The following steps are involved: The two-level hybrid bitmap representation obtained by using row bitmap representation and element bitmap representation represents the sparsity of row and element granularity of input, weight and output of convolution calculation in different stages of neural network training; For each non-zero flag of the output row bitmap, the row bitmaps of the input and weights are slidingly matched to find and remove invalid one-dimensional convolution calculations containing all-zero rows, thus achieving coarse-grained sparsity for accelerating convolution calculations. For each non-zero flag of the output element bitmap, the element bitmaps of the input and weight are slidingly matched. In the process of executing the effective one-dimensional convolution calculation, invalid multiplication and accumulation calculations containing zero values ​​are discovered and eliminated, thereby realizing fine-grained sparsity acceleration of the convolution calculation.

9. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor includes a structure of a hybrid granularity sparse neural network training accelerator according to any one of claims 1 to 8.

10. A storage medium storing computer-readable instructions, which, when executed by one or more processors, causes the one or more processors to include the structure of a hybrid granularity sparse neural network training accelerator according to any one of claims 1 to 8.