Shared multiply-accumulate block design for convolutional neural network hardware accelerator

Through the design of the shared multiply-accumulate block for the LeNet-5 network, using technologies such as the base-8 Booth algorithm and the improved Wallace tree compression circuit, the problems of resource limitations and IP customization in FPGA implementation are solved, and an efficient neural network is realized. Accelerator circuit for LeNet-5 and other CNN models.

CN118761445APending Publication Date: 2024-10-11UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410389906.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-02
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

Due to resource limitations and data transmission efficiency issues, existing neural network accelerators implemented in FPGA are difficult to meet the increasingly complex CNN computing requirements, and ASIC implementation lacks control and customization of the internal process of the IP.

Method used

Design a shared multiply-accumulate block for the LeNet-5 convolutional neural network, using the base-8Booth algorithm to optimize partial product generation, an improved Wallace tree compression circuit and a redundant binary compression circuit to implement a 32-bit parallel prefix adder and 16× 16's complement binary multiplier, and reduces circuit size through multiply-accumulator multiplexing.

Benefits of technology

It achieves a more efficient, smaller area, and lower power consumption circuit design that is autonomous and controllable, easy to modify and transplant, reduces hardware resource overhead, and improves computing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118761445A_ABST
    Figure CN118761445A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of integrated circuits, and particularly relates to a shared multiply-accumulate block design for a convolutional neural network hardware accelerator. According to the method, a LeNet-5 convolutional neural network is taken as an example, and for a shared multiply-accumulate block of a LeNet-5 network hardware accelerator, three aspects of design including multiplier design, adder design and shared multiply-accumulate block structure design are mainly carried out. In the design of the multiplier, the invention provides an optimization method of a partial product generation algorithm, an improved Wallace tree compression circuit based on a 4-2 compressor and an optimized redundant binary compression circuit. In the design of the adder, a 32-bit parallel prefix adder is realized, and the structure is applied to a numerical value conversion circuit behind an optimized redundant binary compression circuit in a multiplier. The 16 * 16 complement binary multiplier is realized by the structure. For the structural design of a shared multiply-accumulate block, the invention provides a convolution calculation circuit implementation method based on multiply-accumulator multiplexing, and the circuit scale of a calculation module in a LeNet-5 network hardware accelerator 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 integrated circuits, and in particular relates to a shared multiplication-accumulation block design for a convolutional neural network hardware accelerator. Background Art

[0002] At present, neural networks are mostly implemented at the software level. When the network performs calculations, it needs to call the CPU or GPU of the computer system itself, which is slow. In addition, more and more devices need to calculate CNN independently, and the use of general computer structures will result in low computing efficiency. Designing a specialized CNN hardware accelerator is an important way to accelerate computing and promote the implementation of neural networks.

[0003] At present, the hardware implementation of neural network accelerators is mainly achieved through FPGA, but FPGA implementation is limited by FPGA circuit resource conditions, such as the number of DSPs, memory capacity, etc., and off-chip memory is often used in FPGA implementation. The network computing efficiency is also limited by the data transmission efficiency. It is becoming increasingly difficult to use FPGA to implement neural network accelerators to meet the requirements of CNN computing.

[0004] Therefore, the ASIC implementation of neural network accelerators has received more and more attention. A large number of convolution operations are involved in the implementation of CNN hardware accelerators. In the hardware implementation, the convolution operation is actually a multiplication and accumulation operation, which is also the core of the hardware accelerator calculation. In FPGA, designers often implement convolution calculations by calling DSP units, such as DSP48e, and the circuit design is limited to control logic. However, these IPs are protected by intellectual property rights and are encrypted content. They cannot be implemented in ASIC implementation, and the internal process of the IP cannot be customized. Therefore, it is necessary and practical to design and implement a fully controllable multiplication and accumulation device suitable for CNN.

[0005] Taking the LeNet-5 convolutional neural network as an example, it has 2 convolutional layers, 2 pooling layers, and 3 fully connected layers. It is one of the most classic CNN structures with complete components and is very representative. Designing a shared multiplication-accumulation block in a neural network hardware accelerator for the LeNet-5 model can serve as a reference for other neural network hardware accelerators in a relatively simple but sufficiently complete way, and it also has certain applicability to other CNNs. Summary of the invention

[0006] The present invention takes the LeNet-5 convolutional neural network as an example, and mainly designs three aspects for the shared multiplication and accumulation block of the LeNet-5 network hardware accelerator: multiplier design, adder design, and shared multiplication and accumulation block structure design. In the multiplier design, the present invention proposes an optimization method for the partial product generation algorithm, an improved Wallace tree compression circuit based on a 4-2 compressor, and an optimized redundant binary compression circuit. In the adder design, a 32-bit parallel prefix adder is implemented, and the structure is used in the numerical conversion circuit after the optimized redundant binary compression circuit in the multiplier. The above structure realizes a 16×16 complement binary multiplier. For the structural design of the shared multiplication and accumulation block, the present invention proposes a convolution calculation circuit implementation method based on multiplication and accumulation multiplexing, which can reduce the circuit scale of the calculation module in the LeNet-5 network hardware accelerator.

[0007] The technical solution of the present invention is:

[0008] With respect to the design of the multiply-accumulate unit and the shared multiply-accumulate block, the present invention proposes the following solutions and optimization schemes:

[0009] The radix-8 Booth algorithm is used as the partial product generation algorithm, and the algorithm is optimized based on the data characteristics of the LeNet-5 network. The partial product generation process is optimized and the scale of the partial product generation circuit is reduced.

[0010] The traditional 4-2 compressor and Wallace tree structure are improved to realize an improved Wallace tree structure based on the 4-2 compressor with higher efficiency, smaller area and lower power consumption. In view of the characteristics of large-scale multiplication and accumulation units, redundant binary full adders and redundant binary half adders are used to realize a redundant binary compression tree with more regular connections. The two compression structures can replace each other without changing other parts of the circuit.

[0011] A 32-bit parallel prefix adder with different carry structures is implemented. The Han-Carlson structure with a more balanced area, performance and power consumption is used in the first stage of post-compression summation, and the faster Kogge-Stone structure is used in the partial product generation circuit.

[0012] According to the timing characteristics of the LeNet-5 network, a three-stage pipeline multiplier-accumulator structure is designed and implemented. The adder uses a 32-bit Brent-Kung adder to reduce power consumption and area while meeting the timing requirements.

[0013] According to the computational characteristics of the LeNet-5 network, a method for reusing multiply-accumulators in a shared multiply-accumulate block is designed. A shared multiply-accumulate block suitable for the LeNet-5 network hardware accelerator is implemented.

[0014] The beneficial effects of the present invention are as follows: by designing a special shared multiplication-accumulation block for the LetNet-5 network hardware accelerator, the calculation of the network is accelerated, and the design is autonomous and controllable, which is convenient for design modification and transplantation. By improving the partial product generation algorithm and compression structure, the two-stage circuit is more balanced, which makes it easier to insert the circuit into the pipeline in a functional division manner, and it is convenient to replace circuit components, such as the replacement of different compression structures. By using different adder structures at different positions of the circuit, unnecessary performance margins are reduced, as well as the resulting power consumption and area consumption, and the overall circuit efficiency is higher. By reasonably setting the multiplication-accumulation multiplexing in the shared multiplication-accumulation block, the hardware resource overhead of the shared multiplication-accumulation block is reduced, and the maximum function is achieved at the lowest cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 Generating a circuit diagram for a partial product of the present invention;

[0016] Figure 2 This is a flow chart of the improved Wallace tree compression in the present invention;

[0017] Figure 3 It is a flow chart of redundant binary compression tree compression in the present invention;

[0018] Figure 4 It is a structural diagram of a 16-bit×16-bit two's complement binary multiplier in the present invention;

[0019] Figure 5 It is a structural diagram of the multiplier-accumulator in the present invention;

[0020] Figure 6 It is a structural diagram of the shared multiplication-accumulation block in the present invention; DETAILED DESCRIPTION

[0021] The present invention will be further described below in conjunction with the accompanying drawings:

[0022] The base-8 Booth algorithm checks four bits of the multiplier each time, overlapping one bit to check the next four bits. The multiplier is calculated according to [B 3i+2 B 3i+1 B 3i B 3i-1 ], starting from i=0. The 16-bit multiplier is divided into six groups, of which the highest group has only two digits. Therefore, the radix-8 Booth algorithm rules for the highest two digits can be optimized to save unnecessary circuit resources. The simplified Booth algorithm rules for the highest two digits are shown in Table 1 below. Table 1 Simplified radix-8 Booth algorithm rules

[0023] The radix-8 Booth algorithm involves the calculation of ±1x, ±2x, and ±3x. 1x and 2x can be directly realized through data line connection, 2x is realized by left shifting the multiplier, and 3x needs to be realized as "1x + 2x", using a faster 16-bit Kogge-Stone parallel prefix adder.

[0024] Negative multiples require optimization of the algorithm implementation process. The process of finding the opposite of a binary complement code can be implemented by the method of "inverting each bit and adding 1". In the process of generating negative multiple partial products, only an inverter is used to achieve inversion, and "add 1" is reserved for the partial product compression part to avoid wasting too much time and resources on the step of finding the opposite. The present invention defines a negative multiple partial product symbol neg, the neg of a negative Booth coding value is 1, and the neg of a positive Booth coding value is 0. They are combined into a correction word correction in the manner of [neg6,00,neg5,00,neg4,00,neg3,00,neg2,00,neg1]. The correction word participates in the next step of partial product compression as an independent data. The structure of the partial product generation circuit is shown in the figure. Figure 1 As shown in the figure, a total of five full Booth encoding circuits and one simplified Booth encoding circuit are used in the design.

[0025] In the Wallace tree compression structure, the present invention uses a 3-2 compressor and a half adder in addition to a 4-2 compressor. The carry structure of the 3-2 compressor is compatible with the carry structure of the 4-2 compressor, and can be used in places where the data is less than four, such as the beginning and end of the data. The use of a 3-2 compressor can further increase the amount of data compressed each time, minimize the number of compression levels, and also avoid the area waste caused by the global use of a 4-2 compressor. In order to solve the problem of increased data volume caused by partial product sign expansion, this design adopts a pre-calculation method to reduce the amount of data. The improved Wallace tree compression process is as follows: Figure 2 shown.

[0026] The redundant binary compression tree uses redundant binary full adders and redundant binary half adders as basic compression units. Before compression, in order to make the redundant binary numbers after direct pairing correctly represent the sum of the original two partial products, six inverters need to be added to the highest bit of the partial products during pairing. — Set it as [1110111110111110], and the correction word generated in the first step is used as x + , to achieve the correct correction of the calculation results. The compression process of the compression tree is as follows Figure 3 shown.

[0027] The Han-Carlson structure is used to implement the 32-bit adder in the multiplier-accumulator as the compressed summation and RB-NB converter structure, which is more balanced in performance and area and has no high fan-out nodes. In addition, the 16-bit Kogge-Stone adder is used in the partial product generation circuit to improve the speed of partial product generation.

[0028] The structure of the 16-bit × 16-bit two's complement binary multiplier designed by the present invention is as follows: Figure 4 shown.

[0029] The multiplier-accumulator design in the present invention has three stages of pipeline: multiplication operation, addition operation, data storage and readback, which is implemented by a 16×16 binary complement multiplier, a 32-bit Brent-Kung adder, and a 32-bit data register. It takes three cycles to complete a multiplication-accumulation operation, and N+3 cycles to complete a total of N multiplication-accumulation operations. Among them, in order to adapt to the working requirements of the system, the pipeline is no longer set inside the multiplier, and the multiplication calculation is completed within one cycle at an operating frequency of 200MHz. The method of multiplexing the multiplier-accumulator is adopted in the design to reduce the number of instantiated multipliers. In addition to the main calculation part, a multi-way data selector is added to the input end, and SEL is used as the selection signal. The SEL signal is generated by the control logic of the level according to the current operation level and is used to select the input data. A multiplexer is also added to the clear end of the last level of the data register to receive the clear signal CLR generated by the control logic of different layers, and the clear signal is also used as the clear signal of the multipliers and adders of the first two levels of the pipeline. The multiplication and accumulation device structure of the present invention is as follows: Figure 5 shown.

[0030] The structure of the shared multiplication-accumulation block in the present invention is as follows: Figure 6 As shown. According to actual needs, 204 multiplication and accumulation units described above are instantiated in the shared multiplication and accumulation block of the present invention, reducing the use of 102 multiplication and accumulation units, and only adding a 1-bit selection signal to achieve a good balance between performance and area. The specific allocation of multiplexed multiplication and accumulation units at each layer is shown in Table 2 below. Table 2 Multiplexing allocation table of multiplication and accumulation units in shared multiplication and accumulation blocks

[0031] After comprehensive verification, it is found that the shared multiplication-accumulation block designed by the present invention can correctly implement the function in the LeNet-5 hardware accelerator and has performance advantages.

Claims

1. A shared multiplication-accumulation block design for a convolutional neural network hardware accelerator, characterized in that: The radix-8 Booth algorithm is used as the partial product generation algorithm, and the algorithm is optimized based on the data characteristics of the LeNet-5 network. The partial product generation process is optimized and the scale of the partial product generation circuit is reduced.

2. The shared multiplication-accumulation block design for convolutional neural network hardware accelerator according to claim 1, characterized in that: The traditional 4-2 compressor and Wallace tree structure are improved to realize an improved Wallace tree structure based on the 4-2 compressor with higher efficiency, smaller area and lower power consumption. In view of the characteristics of large-scale multiplication and accumulation units, redundant binary full adders and redundant binary half adders are used to realize a redundant binary compression tree with more regular connections. The two compression structures can replace each other without changing other parts of the circuit.

3. The shared multiplication-accumulation block design for convolutional neural network hardware accelerator according to claim 2, characterized in that: A 32-bit parallel prefix adder with different carry structures is implemented. The Han-Carlson structure with a more balanced area, performance and power consumption is used in the first stage of post-compression summation, and the faster Kogge-Stone structure is used in the partial product generation circuit.

4. The shared multiplication-accumulation block design for convolutional neural network hardware accelerator according to claim 3, characterized in that: According to the timing characteristics of the LeNet-5 network, a three-stage pipeline multiplier-accumulator structure is designed and implemented. The adder uses a 32-bit Brent-Kung adder to reduce power consumption and area while meeting the timing requirements.

5. The shared multiplication-accumulation block design for convolutional neural network hardware accelerator according to claim 4, characterized in that: According to the computational characteristics of the LeNet-5 network, a method for reusing multiply-accumulators in a shared multiply-accumulate block is designed. A shared multiply-accumulate block suitable for the LeNet-5 network hardware accelerator is implemented.

Citation Information

Patent Citations

  • Reconfigurable processor-oriented symbolic multiply-accumulator and method

    CN112540743A

  • Handwritten form recognition network architecture implementation method for reducing FPGA hardware resource consumption

    CN114049636A

  • Low-energy-consumption high-precision approximate parallel fixed-width multiplication and accumulation device

    CN114647399A