A hardware acceleration method for point cloud object detection network based on column reconstruction convolution

Through the hardware acceleration method based on column reconstruction convolution, the problems of data invalid time and low resource utilization of FPGA accelerator in convolution calculation are solved, and efficient calculation speed and resource utilization are achieved, which is suitable for volumes with a step size greater than 1. Lamination.

CN118364872BActive Publication Date: 2024-10-01DALIAN UNIV OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410417802.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-09
Publication Date
2024-10-01
Estimated Expiration
2044-04-09

AI Technical Summary

Technical Problem

Existing FPGA accelerators have problems with data invalidation time and low resource utilization in convolution calculations, especially in convolution layers with a step size other than 1, and the transmission bandwidth is limited, which affects the calculation speed.

Method used

Using a hardware acceleration method based on column reconstruction convolution, through quantized weights and input feature maps, block calculations and ping-pong operations, the invalid time of sliding window calculations is reduced, the feature map caching strategy is optimized, and the bus channel is used to transmit weights and feature maps. Improve parallelism and resource utilization.

Benefits of technology

It significantly improves the utilization of computing resources and computing speed, especially in convolutional layers with a step size greater than 1, reduces the demand for storage resources, saves bus bandwidth, and enhances the versatility and flexibility of the accelerator.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118364872B_ABST
    Figure CN118364872B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of FPGA hardware accelerator design, and in particular, relates to a point cloud target detection network hardware acceleration method based on column reconstruction convolution. Quantized weights and input feature maps are used to configure the parameters of each module so that the same convolution accelerator is applicable to different layers of the network convolution layer to complete the convolution calculation of the entire network. A unique block calculation method is used to reduce the on-chip cache pressure so that it can achieve a higher output parallelism to improve computing power. The feature map is divided into blocks by column, and reconstructed into several sub-feature maps with a size of the original feature map height × width in the feature map cache module. During the calculation of the sub-feature map, the invalid time in the sliding window calculation is reduced by frequently switching the weight method, and the sliding window preparation time is reduced by ping-pong operation. The feature map cache strategy is designed to reduce the repeated transmission of data when forming sub-feature maps, so that the weights can be transmitted at the interval of feature map data transmission to improve computing power.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of FPGA hardware accelerator design, and in particular relates to a point cloud target detection network hardware acceleration method based on column reconstruction convolution. Background Art

[0002] Neural networks used for point cloud target detection, such as VoxelNet, PointPillars, FastPillars, etc., all contain a large number of convolutional layers. At the same time, most of the network calculations are concentrated in the convolutional layers, and 3×3 convolutions in these convolutional layers account for the majority. Taking PointPillars as an example, its backbone network only contains 3×3 convolutions. Therefore, accelerating the 3×3 convolutional layer can accelerate these algorithms. And due to the huge amount of calculation, these algorithms need to be deployed on high-performance computing platforms. Common computing platforms include CPU, GPU, FPGA and ASIC. FPGA's high parallelism, low power consumption and flexible design scheme are suitable as a platform for accelerating convolutional networks. Therefore, according to the characteristics of 3×3 convolution, it is of practical significance to use FPGA to design a point cloud target detection network hardware acceleration method based on column reconstruction convolution.

[0003] Existing multiplexed accelerators can already make full use of computing resources for convolution calculations, but there are still some problems. If the traditional sliding window method is used to fill and calculate the feature map window to be convolved, there will be a certain amount of invalid data time when the first convolution window of the feature map is ready and each time the window content is wrapped, especially when facing a convolution layer with a step size of not 1. Taking the convolution with a step size of 2 as an example, nearly 3 / 4 of the time when performing a feature map convolution is invalid, which reduces the utilization of computing resources to a certain extent. In addition, if you want to increase computing power, you need to increase the parallelism of the calculation. When increasing the output parallelism, if the feature map size is too large, especially in the point cloud target detection network, the resources of the accumulation module used to temporarily store the intermediate results of the convolution will increase exponentially and the utilization rate will be low. At the same time, the increase in parallelism will also be subject to the transmission bandwidth. If you want to improve the utilization of storage resources in FPGA, the weights and feature map data used in convolution calculations are generally transmitted from the outside. The data transmission strategy commonly used by existing accelerators is that if the weights and feature maps share the same bus channel during transmission, the transmission of the weights will affect the transmission of the feature maps, thereby affecting the calculation speed. If the weights and feature maps use different channels, the bus utilization will be affected because the weight transmission time accounts for a small proportion. Therefore, a point cloud target detection neural network accelerator with excellent reusability, low resource consumption, and high performance is designed based on FPGA. At the same time, through a unique block calculation method, ping-pong operation and resource allocation, the above-mentioned problems are solved, so that the network can efficiently use FPGA resources and computing power during calculation, which has important practical significance in the field of point cloud target detection. Summary of the invention

[0004] In view of the above problems, the present invention proposes a hardware acceleration method for point cloud target detection network based on column reconstruction convolution. By using quantized weights and input feature maps and configuring the parameters of each module, the same convolution accelerator is applied to different layers of the network convolution layer to complete the convolution calculation of the entire network. At the same time, a unique block calculation method is used to reduce the on-chip cache pressure so that it can achieve a higher output parallelism to improve computing power. The feature map is divided into blocks by column, and reconstructed into several sub-feature maps of the original feature map height × width F (convolution kernel width) in the feature map cache module. In the sub-feature map calculation process, the invalid time in the sliding window calculation is reduced by frequently switching the weight method, and the sliding window preparation time is reduced by ping-pong operation. The feature map cache strategy is designed to reduce the repeated transmission of data when forming the sub-feature map, so that the weight can be transmitted at the interval of the feature map data transmission, thereby saving bus bandwidth, so that the accelerator can achieve a higher input parallelism to improve computing power. In this way, the resource utilization and computing performance of the FPGA accelerator are improved. It is worth mentioning that the design idea of ​​the acceleration method of the present invention can maximize the utilization of resources when applied to 3×3 convolution. At the same time, the accelerator can also be compatible with the traditional sliding window method by adding some resources, so that convolutions of other sizes can be calculated to improve the versatility of the accelerator.

[0005] The technical solution of the present invention is as follows:

[0006] A hardware acceleration method for point cloud target detection network based on column reconstruction convolution, the corresponding accelerator design is hierarchically divided into an instruction decoding unit and a convolution calculation unit. The convolution calculation unit includes a convolution module, an accumulation module, a truncation module and an activation function. The instruction decoding unit receives data transmitted from the PS end through the GP interface, and controls the convolution, accumulation and truncation modules according to the data in the parsing register. The input feature map is divided by column and reconstructed into multiple sub-feature maps with unchanged height and width F. The data (including feature map data and corresponding weights) is transmitted from the PS end to the PL end through the HP interface. After passing through the convolution module, accumulation module, truncation module and activation function, the convolution calculation of the sub-feature map after the block of one layer of convolution is completed, and the result is transmitted back to the PS end. After the convolution of all sub-feature maps of this layer is completed, the results are selected at the PS end and transmitted back to the PL end as the input of the next layer. The above operation is repeated until all convolution layers are calculated. The PS end can perform subsequent processing on the convolution result.

[0007] The following describes the composition and functions of each module:

[0008] 1. Instruction decoding: Obtain the control instructions for the convolution calculation from the PS side, that is, the PS side writes to the register of the instruction decoding unit through the bus. The instruction decoding unit parses the values ​​at different positions in the register into the parameter values ​​required by each module in the convolution calculation unit, and transmits the parsed parameters to each module. After each module obtains the parameter value, it starts the convolution calculation.

[0009] 2. Convolution calculation unit: responsible for receiving weight data and feature map data. The convolution module processes the received feature map into a window to be convolved, and processes the weight into a form corresponding to the feature map window. Then it performs parallel convolution calculations and transmits part of the convolution results to the accumulation module. The accumulation module accumulates the obtained convolution intermediate values ​​into a complete convolution result, reorders it and outputs it to the truncation module; the truncation module completes the data conversion to maintain the bit width, and finally transmits it to the activation function module; the activation function module completes the activation function calculation of the convolution layer and outputs the final result. The convolution module includes a feature map and weight control module, a feature map cache module, a feature map window, a weight buffer module, a weight cache module, a multiplier array and an adder tree.

[0010] 3. Feature map and weight control module: Contains the main control logic for processing the received feature map and weight data into the window required for convolution. Responsible for sorting the input data (including feature maps and weights) according to the received parameters and internal logic, distinguishing the data input through the same channel at different times into feature map data and weight data, sending the separated data to the feature map cache and weight buffer modules respectively, and controlling these two modules (controlling the data in the feature map cache to flow into the feature map window, controlling the data in the weight buffer to flow to the weight cache, and controlling the data in the feature map window and weight cache to enter the multiplier array).

[0011] 4. Feature map cache module: In order to save bandwidth and prevent the transmission of duplicate data (when constructing a sub-feature map, the sub-feature map will have duplicate data in the overlapping part of the original feature map), all the sub-feature map data that need to be calculated are stored in the feature map cache module, and then the cache module inputs it into the feature map window to prepare for convolution calculation. The feature map cache consists of two large and small BRAMs (inbufl, inbufs). The width of the sub-feature map corresponding to the cached data is F, and the height and number of channels are determined by the convolution layer structure. The number of channels is the number of channels of this layer, and the height is divided into two parts, large and small. The height of the smaller part corresponds to the height of a convolution window, that is, FH (convolution kernel height). If the layer contains padding operations, it is the FH-padding size. The height of the larger part is the height of the feature map of this layer minus FH or minus the FH-padding size.

[0012] 5. Feature map window module: There are a total of two identical feature map window modules (datawd1, datawd2) for ping-pong operation.

[0013] 6. Weight Buffer Module: The input weight size is 1×1×input parallelism, and the weight size of each convolution operation is F×FH×input parallelism×true output parallelism. The data size in each address of the weight cache module is F×FH×input parallelism×true output parallelism. After the weight buffer module obtains the full size of weight required in one address of the weight cache module, it is passed to the weight cache module.

[0014] 7. Weight cache module: The weight cache module stores the weights corresponding to more output channels, and switches frequently during the invalid period of the feature map window data, and performs operations with the valid window data latched last time. The weight cache module needs to store all the parameters of the first layer of the network during initialization, and store the parameters required for the next layer calculation during the subsequent feature map transmission gap.

[0015] 8. Multiplier array: An array composed of multiple multipliers to complete the multiplication calculation of the feature map window and the corresponding window of the weight cache output and its parallelism weight.

[0016] 9. Adder tree: It is a pipeline composed of multiple adders, each with three inputs and one output. The adder tree module transfers the multiplication results of the multiplication array as the intermediate value of the convolution to the accumulation module after summing.

[0017] 10. Accumulation module: The intermediate value result of the convolution obtained by the addition tree is stored in the accumulation module, and the intermediate value cache is composed of BRAM. After multiple calculations are completed to traverse the input channel, the result of the accumulation module is the data of a pixel of the corresponding output channel. When each accumulation operation is added for the last time, in addition to adding the intermediate value of the convolution result, the offset of the corresponding output channel must also be added. When inputting, the results of the addition tree module are input in sequence, and when outputting, a column of data corresponding to the parallelism required by the next layer of input is output. The ping-pong strategy is used to allow the input and output of the accumulation module to proceed simultaneously, eliminating the need for the PS side to re-arrange the data at the beginning of the next layer of convolution calculation.

[0018] 11. Truncation module: used to complete the data conversion between two quantization convolution calculations and maintain the data bit width.

[0019] 12. Activation function: The output feature map after the truncation module completes the activation function processing in the network.

[0020] The acceleration method includes the following steps:

[0021] Step 1: Convolution module calculation:

[0022] Step 1.1: Before inputting the feature map to the PL end, divide the input feature map into blocks by column. Under the premise of including the input parallelism, it is transmitted to the PL end in columns, and the transmission of each sub-input feature map is completed in the channel direction first, and stored in the feature map cache module, where a complete sub-feature map is constructed.

[0023] Step 1.2: The feature map cache module uses a ping-pong operation when transferring data to the feature map window. The feature map cache module is composed of two BRAMs (inbufl, inbufs) of different sizes, and the feature map window module is composed of two parts of the same size (datawd1, datawd2). The input feature map data is stored in the feature map cache module by column and passed to the feature map window module by row. The padding operation is implemented when the data is input from the feature map cache module to the feature map window. When inbufl transfers data to the feature map window datawd1 and the sub-feature map data transmission of the input parallelism is about to be completed, inbufs starts to transfer data to the feature map window datawd2. And before the inbufl transmission is completed, the preparation of window datawd2 is completed. After inbufl completes the transmission, window datawd2 is enabled immediately, and the subsequent data is also transferred to window datawd2, and so on for transmission and exchange.

[0024] Step 1.3: When the data of all output channels of a layer of convolution is obtained, the number of times the input feature map is completely transmitted is called the number of rounds. In order to save bandwidth, the weights and feature maps are transmitted in time-sharing using the same bus channel. During the calculation of a sub-feature map, the transmission of the feature map cache data has been completed. At this time, the feature map cache module is transmitting data to the feature map window, and the calculation can be completed without relying on external data. Use this time to pass the weights required for the next round into the weight buffer module. The above time will occur during the calculation of each sub-feature map. During the calculation of each sub-feature map in a round, the weights of the next round will be gradually transferred to the weight buffer module and stored in the weight cache module until all the weights of the next round are stored in the weight cache module, which can save the weight loading time at the beginning of the next round of calculation.

[0025] Step 1.4: In the convolution calculation with a step size of S, a window effective calculation can generate pixel intermediate value data of (TParlO, true output parallelism) output channels. Invalid data is not used during the invalid period of line break, and the valid feature map window data of the previous cycle continues to be used. At this time, a set of weights is switched to generate pixel intermediate value data of TParlO output channels. When the data arrives at the F-1th invalid moment, the feature map input of N (greater than F×S and the minimum value that can be divided by the number of input channels of this layer of convolution)-F cycles is closed, and the valid window data is latched after the data of the next cycle arrives. Different weights are switched in each cycle during this period, and a total of N×TParlO output channels of pixel intermediate value data are obtained. These N×TParlO output channels are defined as pseudo output parallelism FParlO.

[0026] Step 1.5: Send the feature map data of size (F×FH×Width (data bit width)×ParlI (input parallelism)) in the feature map window module and the weight data of size (F×FH×Width (data bit width)×ParlI (input parallelism)×TparlO (true output parallelism)) selected each time in the convolution buffer into the multiplier array to complete the multiplication calculation.

[0027] Step 1.6: Send the multiplication result to the addition tree, and after summing, transmit it to the accumulation module as an intermediate value. The addition tree adopts a pipeline structure with three inputs and one output at each level.

[0028] Step 2: Accumulation module calculation:

[0029] Step 2.1: Store the convolution intermediate value data obtained by the addition tree into the accumulation module. If the input parallelism is less than the total number of channels of this layer, the remaining channel data will be transmitted and calculated according to the input parallelism, and the convolution will be performed again. The addition tree result will be added to the last convolution result until the convolution calculation of all input channel feature maps is completed. The offset corresponding to each channel is added at the last accumulation to complete the calculation. Reorder by site selection before output. The data needs to remain unchanged during site selection, so a ping-pong operation is used, one part is used for accumulation operation, and the other part is output to the truncation module through re-site selection.

[0030] Step 3: Calculation of the truncation module:

[0031] The result of the accumulation module is output to the truncation module. The accumulation module implements the formula (M (coefficient) × P (convolution result) >> n (shift amount)) in the quantization calculation, and maintains the result at the same quantized data bit width as the input, where M and n are pre-trained parameters, which are written into the PL register by the PS through the GP port and included in the instruction.

[0032] Step 4: Activation function calculation:

[0033] The output of the truncation module is sent to the activation function module, and the activation function can be implemented by table lookup method. Finally, the result is sent back to the PS end.

[0034] Beneficial effects of the present invention:

[0035] 1. Compared with the existing convolution accelerator, the accelerator of the present invention has a very high utilization rate of computing resources. When the transmission capacity is sufficient, only the initial sub-feature map construction time and the sliding window filling time are invalid in the entire network convolution calculation. After that, the calculation data is valid, that is, the computing resources are almost completely in working state, thereby improving the calculation speed. The speed-up is particularly obvious in the convolution layer with a step size greater than 1.

[0036] 2. The present invention divides the original input feature map into a number of smaller sub-feature maps, and preferentially transmits the sub-feature maps in the channel direction and completes the convolution. Therefore, the BRAM used in the convolution intermediate result accumulation module is significantly reduced. Thus, the output parallelism can be increased to increase the computing power, thereby achieving the effect of saving resources and improving the computing speed.

[0037] 3. The weights and input feature maps of the present invention share a data input channel, and the weight input is transmitted in the gap of the input feature map transmission, which does not affect the work of computing resources, not only can it save transmission bandwidth but also does not affect the computing speed.

[0038] 4. The present invention has flexible configurability and excellent multiplexability. The configurability includes controlling the convolution feature map size, number of channels, step size, padding size and other parameters by transmitting data to a specified register before the accelerator starts calculation; the multiplexability includes changing instructions to enable the accelerator to complete the calculation of all convolution layers in the entire network.

[0039] 5. The design concept of the acceleration method of the present invention has the best adaptability and acceleration effect on existing algorithms when applied to 3×3 convolution. Pseudo-output parallelism will be generated during block calculation processing. The pseudo-parallelism generated when applied to convolutions of other sizes may not be suitable for the number of channels of most existing networks. If the number of channels is designed accordingly during network training, this acceleration method can still be used and good results can be obtained. At the same time, this accelerator can be compatible with the traditional sliding window method by adding some resources, so that convolutions of other sizes can be calculated. Although there is no additional acceleration effect, it can improve the flexibility of accelerator deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is an architecture diagram of an accelerator corresponding to the hardware acceleration method of point cloud target detection network based on column reconstruction convolution of the present invention; Figure 1 The thick arrows in the middle are data flows, and the thin arrows are control signals;

[0041] Figure 2 is a schematic diagram of a sub-feature graph;

[0042] Figure 3 It is a schematic diagram of the sub-feature map construction process in the feature map cache module;

[0043] Figure 4 It is a schematic diagram of the process of the feature map cache module outputting data to the feature map window;

[0044] Figure 5 This is a schematic diagram of the process of switching outputs of the weight cache module to achieve pseudo-parallelism;

[0045] Figure 6 It is a schematic diagram of the process of accumulating module input and output.

[0046] Note: For easy observation, the feature maps used in the attached figure are all of size 5×5, and the convolution calculations involved in the schematic diagram are all in the case of step size 1. At the same time, to simplify the content in the figure, each data represents the data containing the input parallelism. Taking the input parallelism of 8 as an example, because 8 data are operated simultaneously during the operation, it is simplified to 1 data in the figure. DETAILED DESCRIPTION

[0047] In order to make the technical solution of the present invention clearer, the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0048] The present invention selects PointPillars as the network model, and takes the feature map with a convolution kernel size of 3×3, a height of 496, a width of 432, and a number of channels of 64 as an example, that is, the feature map size of the convolution layer input of the PointPillars backbone network, and selects the first layer of convolution of the backbone network, the convolution step size is 2, the padding size is 1, and the padding value is 0. The present solution is explained in detail through the convolution process, and the operation mode when the step size is 1 is also mentioned. The transmission bit width is set to 64 bits, that is, the bit width of each data is 8 bits, the input parallelism is 8, and the true output parallelism is 8. The usage of all storage resources is selected to be the amount of resources that can be applied to the layer with the largest resource consumption of the network, that is, this accelerator design can be reused to complete the calculation of all convolutional layers in the network model. The data corresponding to the input parallelism are all operated simultaneously in subsequent calculations, and the input parallelism will no longer be emphasized in the subsequent description. The structure of the corresponding accelerator is as follows Figure 1 shown.

[0049] The specific steps are as follows:

[0050] Step 1: Convolution module calculation:

[0051] Step 1.1: Before the input feature map is transmitted to the PL end, the input feature map is rearranged. Three directions are defined, namely the channel direction Z, the row direction X, and the column direction Y. The input feature map is divided into multiple columns by blocking in the row direction X, and then transmitted to the PL end by column, a sub-feature map is constructed at the PL end, and then the sub-feature map is convolutionally calculated. Different from the (X→Y→Z) direction used in the traditional calculation method when transmitting the feature map, the input direction of the present invention can be approximated as the (Y→Z→X) direction on the feature map before blocking. Taking the input channel number of 64 and the input parallelism of 8 as an example, when padding is included, padding does not need to transmit data. The way to complete the transmission of the first sub-feature map is to preferentially transmit the two columns of data of the first 8 channels to the feature map cache module, and then transmit the two columns of data of 9 to 16 channels, until the two columns of data of 64 channels are fully transmitted, that is, the construction of the first sub-feature map is completed. When the feature map cache module transfers the data of channels 57 to 64 of the first sub-feature map to the feature map window, it then transfers the next sub-feature map to the address where the original 1 to 8 channel data is located. Figure 1 The data of ~8 channels are covered, and so on. The sub-feature map obtained after reconstruction is as follows Figure 2 As shown in the figure, if the step size is 1, the padding size is 0, and the original size of the feature map is 5×5, it is divided into 3 sub-feature maps of size 5×3. The repeated information of the original feature map is contained between each two sub-feature maps, that is, the convolution overlap part. If the first layer of the network is used, the feature map of size 496×432 is used, and the padding size is 1 and the step size is 2. The original feature map is divided into 496×2 on both sides, and the padding value is added when the feature map cache module is subsequently transferred to the feature map window. The middle part is 214 sub-feature maps of size 496×3. After each sub-feature map is convolved, the result is a column of the input feature map of the next layer.

[0052] Step 1.2:

[0053] After the sub-feature map is constructed by transferring data to the feature map cache module using the (Y→Z→X) direction, the sub-feature map data is transferred to the feature map window module using the (X→Y→Z) direction. The control module controls the storage and output addresses.

[0054] like Figure 3 As shown in the figure, the case is a feature map of size 5×5 and a convolution with a stride of 1. When the feature map data is input to the feature map cache module, it is input in the column direction, and two columns are filled in the first filling, and then output to the feature map window module by row.

[0055] The padding operation is implemented when the feature map cache module inputs data into the feature map window. First, determine whether there is padding, design the padding signal, and the corresponding counter to control the padding. When the padding signal is valid, pull down the feature map cache data output enable, and send the padding value as valid data to the feature map window. After the padding is completed, pull down the padding signal and pull up the data output enable to complete the padding at the corresponding position.

[0056] During the first filling, data is transferred from the feature map cache module to the feature map window module in sequence only after two columns (channel number is 1 to 8) are completely filled, otherwise data loss will occur. Take the first layer feature map input channel number of 64 and input parallelism of 8 as an example. Figure 3 As shown in the figure, the first padding needs to be performed 8 times to complete the complete construction of the first sub-feature map. After completing the padding of the first two columns of data (the number of channels is 1 to 8), data is continuously transmitted to the feature map window. Because there is a padding operation and only one or two columns of data need to be transmitted for the subsequent construction of the sub-feature map, the time for transmission to the feature map window module is always greater than the filling time, and the larger the feature map size, the greater the time difference. At this time, there is no need to transmit feature map data on the bus. Using this time difference, the weights required for the next round of calculations are transmitted to the weight buffer module.

[0057] The case with a step size of 2 is similar, except that in the second filling and thereafter, the data filled each time is two columns, and the two columns of data that have been used are also overwritten to form a new sub-feature map.

[0058] In the above situation, when a column of data is transmitted continuously, that is, when the step size is 1 and the construction of the first sub-feature map has been completed, when the PS end bursts data to the PL end, the column of data of all input channels is bursted at one time. According to the number of input channels of 64 and the input parallelism of 8, the 64 columns of data of these 64 channels are arranged in groups of 8 columns and transmitted to the PL end using burst. In other cases, that is, the construction of the sub-feature map needs to cover two columns of data, it is necessary to find the two columns corresponding to the feature map and contain the data with a total of 16 columns of input parallelism of the 128 columns of data of the 64 channels and arrange them according to the input parallelism, and transmit them to the PL end in 8 times. If you want to complete it in one burst, you need to rearrange the feature map data in this order on the PS end.

[0059] The feature map buffer is divided into two parts. The first part is inbufs, which only stores the data of the window size. The other part is inbufl, which stores the remaining part of the three columns of input feature maps minus the above window size. The feature map window module is divided into two of the same size (datawd1, datawd2), and a ping-pong operation is adopted, such as Figure 4As shown in the figure, the data in the first group of inbufl is transferred to datawd1, and when the output data of inbufl of the input parallelism (8 channels) is about to reach the end, the inbufs of the next group of channels also start to transfer data to datawd2, and prepare the next feature map window in advance. After the feature map transmission of the first group of channels is completed, it is immediately switched to datawd2, and the subsequent data of inbufl is directly transferred to datawd2, eliminating the window data preparation time, and the subsequent process is analogous. The implementation method of the feature map window adopts the traditional sliding window method.

[0060] The data bit width in the feature map cache module inbufs and inbufl is 64, that is, each data is 8 bits, including 8 input parallelisms, and the depth is determined by the maximum demand for the network to be implemented. The depth of inbufs is set to 192 (2 (height, because it contains a padding of size 1, so the small cache module only needs to cache two lines) × 3 (width) × 256 (maximum number of channels in the convolutional network) / 8 (input parallelism)). The depth of inbufl is set to 11856 ((496 (maximum height) - 2 (height cached by the small cache)) × 3 (width) × 64 (number of channels in this layer) / 8 (input parallelism)).

[0061] Step 1.3:

[0062] In the case of including pseudo output parallelism, set the pseudo output parallelism to 32. Assuming that the number of output channels is 256, it takes 8 rounds of calculation to complete this layer of convolution. After each sub-feature map in a round of calculation is constructed, the feature map cache module transmits data to the feature map window, and there is no need to occupy the bus to receive feature map data. Use this time to pass some of the weights required for the next round to the weight buffer module. The above time will occur in the calculation process of each sub-feature map. In each of the above processes in a round of calculation, the weights of the next round are gradually transferred to the weight buffer module and stored in the weight cache module until all the weights of the next round are stored in the weight cache module, which can save the weight loading time at the beginning of the next round of calculation, and so on.

[0063] The weight cache module uses BRAM, and the data bit width of each address is 4608 (3 (width) × 3 (height) × 8 (data bit width) × 8 (input parallelism) × 8 (true output parallelism)) bits. The weight buffer module uses a shift operation, receiving 64 bits of weight data each time, until the weight required for the address of a weight cache is fully stored, and then all are stored in one address of the weight cache. The depth of the weight cache is set to 256, that is, two 128 (maximum weight depth required for one round of calculation: 256 (maximum number of input channels) / 8 (input parallelism) * 4 (pseudo output parallelism multiple of this layer)) depths are used for ping-pong operations, one group is used for this round of calculation, and the other group is used to fill the weights required for the next round of calculation.

[0064] Step 1.4:

[0065] like Figure 5 As shown in the figure, taking the true output parallelism of 8 as an example, a normal window valid calculation can generate pixel intermediate value data for 8 output channels. No invalid data is stored during the invalid period of line change, and the valid feature map window data of the previous cycle continues to be used. At this time, a set of weights is switched to generate pixel intermediate value data for 8 output channels. When the data arrives at the second invalid moment, the feature map input of one cycle is closed, and the valid window data is latched after the data transmission of the next cycle arrives, and the pixel intermediate value data of 32 output channels is obtained, that is, a pseudo output parallelism of size 32 is achieved. The above is the processing method when the step size is 1. If the step size is 2, the invalid period and waiting time during line change will double. According to the corresponding time, the number of weights used for switching is increased to increase the pseudo output parallelism to 64.

[0066] Step 1.5:

[0067] The feature map data of size 576 (3 (width) × 3 (height) × 8 (data bit width) × 8 (input parallelism)) in the feature map window module and the weight data of size 4608 (3 × 3 × 8 (data bit width) × 8 (input parallelism) × 8 (true output parallelism)) selected each time in the convolution cache are sent to the multiplier array to complete the multiplication calculation.

[0068] Step 1.6:

[0069] The multiplication results are sent to the addition tree, and after summation, they are transmitted to the accumulation module as intermediate values. The addition tree adopts a pipeline structure with three inputs and one output at each stage.

[0070] Step 2: Accumulation module calculation:

[0071] Step 2.1:

[0072] The accumulation process is as follows Figure 6 shown.

[0073] The states are divided according to the number of channels in this layer and the input parallelism. Each time the input channel is replaced, the count and change state detection are performed. There are three states in total, named Head, Midd, and Tail. Taking the number of input channels as 64 as an example, when the number of input channels being calculated is the first part of this layer (channels 1 to 8), it is the first state. After the received data is valid, the address is increased by 1, and the data is stored in accuram. When the input channel moves to the second part of the feature map channel of this layer to the first part of the last part (channels 9 to 56), it enters the second state. Before storing in accuram, the data at the corresponding address is taken out, added to the input data, and then stored in the address. When the input channel moves to the last part of the feature map channel of this layer (channels 57 to 64), it enters the third state. Before storing in accuram, the data at the corresponding address is taken out, added to the input data and offset B, and then stored in the address. When all channels are completed, switch the written accuram from accuram1 to accuram2 or vice versa. Initially write accuram1. When state three switches to state one in the next cycle, there are two clock cycles during which both accuram1 and accuram2 are being written.

[0074] When accuram is switched to write, the read enable is pulled high and the data of accuram1 is initially read out. A row counter is required to count the read position of each column of data in the column, a column counter to count which pseudo-parallelism corresponding data is being read out, and an address counter to select the read address. Prioritize increasing the row count. When the row counter counts the output feature map height - 1, the address counter is reset and the column counter is incremented by 1 until the column counter counts the pseudo-output parallelism over the true output parallelism ratio - 1, resets the column counter to 0, and pulls the read enable low. The read address is calculated by reading the row and column counters and the pseudo-output parallelism ratio. The read address is (row count * pseudo-output parallelism ratio) + column count.

[0075] Both accurams are implemented using BRAM. The data size in each address is 256 (32 (data bit width after accumulation) × 8 (true output parallelism)), and the address size is 1984 (248 (maximum number of columns of output feature map) × 8 (maximum pseudo output parallelism ratio)).

[0076] Step 3: Calculation of the truncation module:

[0077] The result of the accumulation module is output to the truncation module. The accumulation module implements the formula (M (coefficient) × P (convolution result) >> n (shift amount)) in the quantization calculation, and maintains the bit width of the result at 8 bits, the same as the input. M and n are pre-trained parameters, which are written into the PL register by the PS through the GP port and included in the instruction.

[0078] Step 4: Activation function calculation:

[0079] The activation function uses ReLU to compare the output of the truncation module with 0. If the result is less than 0, 0 is output, otherwise the data is output. Finally, the result is transmitted back to the PS end.

Claims

1. A point cloud target detection network hardware acceleration method based on column reconstruction convolution, characterized in that: The corresponding accelerator design is hierarchically divided into an instruction decoding unit and a convolution calculation unit; the convolution calculation unit includes a convolution module, an accumulation module, a truncation module and an activation function; the instruction decoding unit receives data transmitted from the PS end through the GP interface, and controls the convolution, accumulation and truncation modules according to the data in the parsing register; the input feature map is divided into columns and reconstructed into multiple sub-feature maps with unchanged height and width F, where F is the convolution kernel width; the data containing the feature map data and the corresponding weights are transmitted from the PS end to the PL end through the HP interface, and after passing through the convolution module, accumulation module, truncation module and activation function, the convolution calculation of the sub-feature map after the block of one layer of convolution is completed, and the result is transmitted back to the PS end; after the convolution of all sub-feature maps of this layer is completed, the result obtained at the PS end is selected and transmitted back to the PL end as the input of the next layer, and the above operation is repeated until all convolution layers are calculated, and the PS end performs subsequent processing on the convolution result; The acceleration method includes the following steps: Step 1: Convolution module calculation: Step 1.1: Before inputting the feature map to the PL end, the input feature map is divided into blocks by column. Under the premise of including the input parallelism, it is transmitted to the PL end in columns, and each sub-input feature map is transmitted in the channel direction first, and stored in the feature map cache module to form a complete sub-feature map in the feature map cache module; Step 1.2: The feature map cache module adopts ping-pong operation when transferring data to the feature map window. The feature map cache module is composed of two BRAMs of different sizes, namely inbufl and inbufs; the feature map window module is composed of two parts of the same size, namely datawd1 and datawd2; the input feature map data is stored in the feature map cache module by column and passed into the feature map window module by row; the padding operation is implemented when the data is input from the feature map cache module to the feature map window; when inbufl transfers data to the feature map window datawd1 and the sub-feature map data transmission of the input parallelism is about to be completed, inbufs starts to transfer data to the feature map window datawd2; and before the inbufl transmission is completed, the preparation of window datawd2 is completed; after inbufl completes the transmission, window datawd2 is enabled immediately, and the subsequent data is also transmitted to window datawd2, and so on for transmission and exchange; Step 1.3: When the data of all output channels of a layer of convolution is obtained, the number of times the input feature map is fully transmitted is called the number of rounds; in order to save bandwidth, the weights and feature maps are transmitted in time-sharing mode using the same bus channel; in the calculation process of a sub-feature map, the transmission of the feature map cache data has been completed. At this time, the feature map cache module is transmitting data to the feature map window, and the calculation can be completed without relying on external data; use this time to pass the weights required for the next round into the weight buffer module; each sub-feature map calculation process will have the above time. In the calculation process of each sub-feature map in a round, the weights of the next round are gradually transmitted to the weight buffer module and stored in the weight cache module until all the weights of the next round are stored in the weight cache module, which can save the weight loading time at the beginning of the next round of calculation; Step 1.4: In the convolution calculation with a step size of S, one effective window calculation can generate pixel intermediate value data of TPar10 output channels with true output parallelism. Invalid data is not used during the invalid period of line break, and the valid feature map window data of the previous cycle continues to be used. At this time, a set of weights is switched to generate pixel intermediate value data of TPar10 output channels again; When the data of the F-1th invalid moment arrives, the feature map input of NF cycles is closed, and the valid window data is latched after the data of the next cycle arrives. Different weights are switched in each cycle during this period, and a total of N×TParlO output channels of pixel intermediate value data are obtained. These N×TParlO output channels are defined as pseudo output parallelism FParlO; where N is the minimum value greater than F×S and divisible by the number of convolution input channels of this layer; Step 1.5: Send the feature map data of size F×FH×data bit width Width×input parallelism ParlI in the feature map window module and the weight data of size F×FH×Width×ParlI×true output parallelism TparlO selected each time in the convolution buffer to the multiplier array to complete the multiplication calculation; where FH is the convolution kernel height; Step 1.6: Send the multiplication result to the addition tree, sum it up and transmit it to the accumulation module as the intermediate value. The addition tree adopts a pipeline structure with three inputs and one output at each stage. Step 2: Accumulation module calculation: Step 2.1: The convolution intermediate value data obtained by the addition tree is stored in the accumulation module; if the input parallelism is less than the total number of channels of this layer, the remaining channel data is transmitted and calculated according to the input parallelism, and the convolution is performed again, and the addition tree result is added to the last convolution result until the convolution calculation of all input channel feature maps is completed. The offset corresponding to each channel is added at the last accumulation to complete the calculation; the data is reordered by site selection before output; the data needs to be kept unchanged during site selection, so a ping-pong operation is used, one part is used for accumulation operation, and the other part is output to the truncation module through re-site selection; Step 3: Calculation of the truncation module: The result of the accumulation module is output to the truncation module. The accumulation module implements the formula in the quantization calculation: coefficient M×convolution result P>>shift amount n, and maintains the result in the same quantized data bit width as the input, where M and n are pre-trained parameters, written into the PL register by the PS through the GP port and included in the instruction; Step 4: Activation function calculation: The output of the truncation module is sent to the activation function module. The activation function can be implemented using a table lookup method; finally, the result is sent back to the PS end.

2. According to claim 1, a point cloud target detection network hardware acceleration method based on column reconstruction convolution is characterized in that: The composition and functions of each module of the accelerator are as follows: Instruction decoding: Obtain the control instructions of the PS end for the convolution calculation, that is, the PS end writes to the register of the instruction decoding unit through the bus. The instruction decoding unit parses the values ​​of different positions in the register into the parameter values ​​required by each module in the convolution calculation unit, and transmits the parsed parameters to each module. After each module obtains the parameter value, it starts the convolution calculation; Convolution calculation unit: responsible for receiving weight data and feature map data. The convolution module processes the received feature map into a window to be convolved, and processes the weight into a form corresponding to the feature map window; Then perform parallel convolution calculations on it, and transmit part of the convolution results to the accumulation module; The accumulation module accumulates the obtained convolution intermediate values ​​into a complete convolution result, reorders it and outputs it to the truncation module; the truncation module completes the data conversion to maintain the bit width, and finally transmits it to the activation function module; the activation function module completes the activation function calculation of the convolution layer and outputs the final result; the convolution module includes a feature map and weight control module, a feature map cache module, a feature map window, a weight buffer module, a weight cache module, a multiplier array and an adder tree; Feature map and weight control module: contains the main control logic for processing the received feature map and weight data into the window required for convolution; is responsible for sorting the input data containing feature maps and weights according to the received parameters and internal logic, distinguishing the data input through the same channel at different times into feature map data and weight data, and sending the separated data to the feature map cache and weight buffer modules respectively, and controlling these two modules to control the data in the feature map cache to flow into the feature map window, control the data in the weight buffer to flow to the weight cache, and control the data in the feature map window and the weight cache to enter the multiplier array; Feature map cache module: In order to save bandwidth and prevent the transmission of duplicate data, all sub-feature map data that need to be calculated are stored in the feature map cache module, and then input into the feature map window by the cache module to prepare for convolution calculation; the feature map cache consists of two parts, large and small BRAM; the width of the sub-feature map corresponding to the cache data is F, and the height and number of channels are determined by the convolution layer structure; the number of channels is the number of channels of this layer, and the height is divided into two parts, large and small. The height of the smaller part corresponds to the height of a convolution window, that is, FH. If the layer contains padding operation, it is FH-padding size; the height of the larger part is the height of the feature map of this layer minus FH or minus FH-padding size; Feature map window module: There are two identical feature map window modules in total for ping-pong operation; Weight buffer module: The input weight size is 1×1×input parallelism, and the weight size of each convolution operation is F×FH×input parallelism×true output parallelism; the data size in each address of the weight cache module is F×FH×input parallelism×true output parallelism; after the weight buffer module obtains the full size of weight required in one address of the weight cache module, it will be passed into the weight cache module; Weight cache module: The weights corresponding to more output channels are stored in the weight cache module, and the feature map window data is frequently switched during invalid periods, and the valid window data latched last time is operated. The weight cache module needs to store all the parameters of the first layer of the network during initialization, and store the parameters required for the next layer calculation in the gaps of feature map transmission afterwards. Multiplier array: An array composed of multiple multipliers to complete the multiplication calculation of the feature map window and the corresponding window of the weight cache output and its parallelism weight; Adder tree: A pipeline consisting of multiple adders, each with three inputs and one output. The adder tree module transfers the multiplication results of the multiplication array to the accumulation module as the intermediate value of the convolution after summing. Accumulation module: The intermediate value result of the convolution obtained by the addition tree is stored in the accumulation module, and the intermediate value cache is composed of BRAM; after multiple calculations are completed to traverse the input channel, the result of the accumulation module is the data of a pixel of the corresponding output channel; when each accumulation operation is added for the last time, in addition to adding the intermediate value of the convolution result, the offset of the corresponding output channel is also added; when inputting, the results of the addition tree module are input in sequence, and when outputting, according to the requirements of the parallelism of the next layer of input, a column of data corresponding to the parallelism is output; the ping-pong strategy is used to allow the accumulation module to input and output at the same time, eliminating the need for the PS end to re-arrange the data at the beginning of the next layer of convolution calculation; Truncation module: used to complete the data conversion between two quantization convolution calculations and maintain the data bit width; Activation function: The output feature map after the truncation module completes the activation function processing in the network.

Citation Information

Patent Citations

  • FPGA-based reconfigurable convolutional neural network accelerator

    CN113222130A

  • Hardware acceleration processing method and accelerator for laser radar point cloud data

    CN116011365A

  • FPGA-based point cloud target detection neural network accelerator and acceleration method

    CN116484929A

  • Configurable universal convolutional neural network accelerator

    WO2020258528A1