ANN / SNN accelerator and ANN / SNN neuron acceleration calculation method

Through neuron encapsulation technology and synaptic compression module, the computing resources of the neural network accelerator are dynamically adjusted, solving the problem of fixed processing core and fan-in parameter limitations, achieving efficient neural network computing and resource utilization, and supporting ANN and SNN hybrid intelligence .

CN118627562AActive Publication Date: 2024-09-10PEKING UNIV

Patent Information

Application Number
CN202410678677.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-09-10
Estimated Expiration
2044-05-29

AI Technical Summary

Technical Problem

The size of the processing core in existing neural network accelerators is fixed, making it difficult to adapt to convolution kernels of different sizes, and the fan-in parameters are fixed, making it difficult to be compatible with complex and changeable neural network model topologies, resulting in underutilization of hardware resources and affecting the acceleration effect. .

Method used

An ANN/SNN accelerator is designed, which uses neuron encapsulation technology and synaptic compression module. Through neuron encapsulation group and synaptic compression technology, it dynamically adjusts the fan-in and fan-out of neurons, optimizes the utilization of computing resources, and Optimizing inter-core communication using a hybrid routing network.

Benefits of technology

It greatly increases the number of fan-in of neurons and the number of fan-out of computing cores, improves the utilization of hardware resources, supports two computing modes of ANN and SNN, realizes hybrid intelligent computing, and reduces communication delays and data congestion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627562A
    Figure CN118627562A
Patent Text Reader

Abstract

The invention provides an ANN / SNN accelerator and an ANN / SNN neuron acceleration calculation method, the accelerator comprises M neural calculation kernels, and each neural calculation kernel comprises Q neurons; the neuron packaging module is used for packaging N neurons into a neuron packaging group and extracting W inputs through a first neuron in the neuron packaging group when the neuron calculation core needs to receive the inputs larger than a fan-in threshold value of a single neuron at the same time, and the first neuron in the neuron packaging group is used for extracting the W inputs through a second neuron in the neuron packaging group; the method comprises the following steps: acquiring W inputs, acquiring weight parameters of each synapse in a first neuron according to a storage position of the first neuron in an SRAM, dividing the W inputs into a plurality of input batch data according to a preset interval, sending the input batch data to a membrane potential accumulator, and calculating the input batch data with the weight parameters, and transmitting the operated membrane potential to the next neuron in the neuron packaging group for the operation of W inputs in the next group until the operation of the N neurons is completed. According to the invention, the neuron packaging technology is utilized, so that the fan-in quantity which can be received by each neuron can be greatly expanded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an ANN / SNN accelerator and an ANN / SNN neuron acceleration calculation method. Background Art

[0002] The traditional von Neumann computer architecture separates the processing unit and the storage unit. Since the training and reasoning of artificial neural networks (ANN) and spiking neural networks (SNN) require a lot of computing and storage, the traditional central processing unit (CPU) often cannot meet their high performance and low latency requirements. Therefore, in order to overcome this shortcoming, it is necessary to design hardware accelerators, namely neural network accelerators, specifically for ANN and SNN. Compared with general-purpose processors, neural network accelerators can accelerate core operations such as convolution, pooling, and nonlinear activation through model-hardware co-optimization, thereby providing faster computing speed and lower power consumption.

[0003] Among the existing internal structures of accelerators, the crossbar structure is the most commonly used computing architecture. In this architecture, the horizontal direction is used as the input axon, the vertical direction is used as the output dendrite, and the intersection of the horizontal and vertical directions is the synapse, which stores different weights. Each MAC operation in the neural network model is only executed when the synaptic weight is valid and the axon at that location emits a pulse, which is equivalent to combining the storage and processing modules, thereby reducing the number of data movements to save energy and enhance the parallelism of operations.

[0004] However, the size of the processing cores in the above-mentioned structural accelerators is fixed, so they are difficult to adapt to convolution kernels of different sizes; and when designing fixed parameters in the accelerator, the fan-in of its neurons will be limited, and a fixed fan-in is difficult to be compatible with the complex and changeable topology of the neural network model, which results in the network having to be split, resulting in some hardware resources being unable to be used, and may bring additional inter-core communication overhead, thus affecting the hardware acceleration effect. Summary of the invention

[0005] The present invention provides an ANN / SNN accelerator and an ANN / SNN neuron acceleration calculation method, which are used to solve the defects that the processing core size in the accelerator in the prior art is fixed and it is difficult to adapt to convolution kernels of different sizes, and because the fan-in parameters in the existing accelerator are fixed, it is difficult to be compatible with the complex and changeable neural network model topology structure, thereby bringing additional inter-core communication overhead and affecting the hardware acceleration effect.

[0006] The present invention provides an ANN / SNN accelerator, comprising M neural computing cores, each of which comprises Q neurons, and the ANN / SNN accelerator further comprises a register stack, an SRAM, a membrane potential accumulator, a transmitter, a neuron encapsulation module and a synaptic compression module; The register file is used to store the operating state and intrinsic parameters of the neuron, each of the neurons integrates W synapses, and the W synapses are used to receive W input parameters of the neuron, and the intrinsic parameters include a fan-in threshold W of each neuron; The SRAM is used to store the position information of each synapse of the neuron and the weight parameters of each synapse; The membrane potential accumulator is used to perform corresponding operations on the input parameters and the weight parameters; The transmitter is used to activate the membrane voltage of the membrane potential accumulator and emit voltage pulses; The neuron encapsulation module is used for encapsulating N neurons into a neuron encapsulation group when the neural computing core needs to simultaneously receive inputs greater than the fan-in threshold W of a single neuron, extracting W inputs through the first neuron in the neuron encapsulation group, and obtaining the weight parameters of each synapse in the first neuron according to the storage location of the first neuron in the SRAM, dividing the W inputs into multiple input batch data at preset intervals, sending the input batch data to the membrane potential accumulator to perform operations with the weight parameters, and transmitting the membrane potential after the operation to the next neuron in the neuron encapsulation group for the operation of the next group of W inputs, until the N neurons complete the operation.

[0007] According to the ANN / SNN accelerator provided by the present invention, the ANN / SNN accelerator also includes a synapse compression module, wherein the synapse compression module is used to compress the storage of the SRAM to store only effective synapses and weight parameters of the effective synapses, and is adapted to only select neurons containing the effective synapses to participate in the operation during the neuron operation, and neurons not containing the effective synapses do not participate in the operation, thereby avoiding the waste of neurons, wherein the effective synapses are synapses participating in the operation.

[0008] According to the ANN / SNN accelerator provided by the present invention, the neuron encapsulation module is further used for, when the last neuron in the neuron encapsulation group performs operation, the SNN emits a pulse by comparing the membrane level with the threshold voltage, or the ANN emits a pulse by an activation function; The membrane voltage and the operating state of the neuron are updated, and the updated membrane voltage and the operating state of the neuron are written back to the register file and the SRAM respectively.

[0009] According to the ANN / SNN accelerator provided by the present invention, the storage of the SRAM is compressed to store only the effective synapses within the effective weight window and the weight parameters of the effective synapses, specifically including: The synaptic region where each neuron actually performs calculations is defined as a valid weight window, and the synapses that do not participate in the calculations are defined as invalid synapses; based on the valid weight window, the storage of the SRAM is adjusted so that it only stores the synapses within the valid weight window, and the weight parameters of the invalid synapses outside the valid weight window are deleted.

[0010] According to the ANN / SNN accelerator provided by the present invention, the step of selecting only neurons containing the effective synapses to participate in the calculation, and neurons not containing the effective synapses not participating in the calculation, specifically includes the following steps: S1. Define neurons that contain effective synapses as effective neurons, and neurons that do not contain effective synapses as invalid neurons; S2, starting from the first neuron in the neuron encapsulation group, searching for valid neurons in sequence; S3, judging whether the currently searched neuron reaches the effective weight window; S4, if not, it is determined to be an invalid neuron and jumps to S3; S5. If yes, search the starting synaptic position of the effective weight window in the neuron in sequence according to the intervals between the input batch data, and start executing the neuron operation at the starting synaptic position.

[0011] According to the ANN / SNN accelerator provided by the present invention, starting to execute neuron operations at the starting synaptic position specifically includes: Starting from the starting synaptic position, performing neuron calculation on the effective synapses within the effective weight window; If the effective weight window spans multiple neurons, two operations are performed at the boundaries of each neuron; After the calculation of the effective weight window is completed, the remaining invalid synapses of the neuron encapsulation group where the effective weight window is located are skipped, and the effective weight window of the next neuron encapsulation group is entered for calculation.

[0012] According to the ANN / SNN accelerator provided by the present invention, the neuron includes a neuron model and a neuron operator.

[0013] According to the ANN / SNN accelerator provided by the present invention, the value range of N is 2 to 64, and the maximum value of W is 1152.

[0014] According to the ANN / SNN accelerator provided by the present invention, the ANN / SNN accelerator includes 64 neural computing cores, each of which includes 512 neurons; the ANN / SNN accelerator also includes an L1 router; Wherein, every four neural computing cores of the ANN / SNN accelerator are connected to one L1 router to form a quadtree structure, and 16 L1 routers form a two-dimensional grid structure; Each of the L1 routers comprises four pairs of asynchronous first transmitters and receivers, wherein the first transmitters and receivers are used for data exchange with adjacent L1 routers in four directions of the two-dimensional grid structure; Each of the L1 routers further includes 4 pairs of asynchronous second transmitters and receivers, where the second transmitters and receivers are used for data interaction between the L1 router and each neural computing core; The L1 router also includes a distributor; The distributor is used to determine the sending direction of the data frame in the L1 router, and the data frame carries data or pulses that comply with the address event representation rule.

[0015] The present invention also provides an ANN / SNN neuron accelerated computing method, the method is implemented by an ANN / SNN accelerator as described above, the ANN / SNN accelerator includes M neural computing cores, each of the neural computing cores includes Q neurons, and the method includes: When the input of the neural computing core is greater than the fan-in threshold W of a single neuron of the neural computing core, determining the number N of neurons participating in the calculation in the neural computing core; Encapsulating N neurons into a neuron encapsulation group, extracting W inputs through a first neuron in the neuron encapsulation group, and obtaining a weight parameter of each synapse in the first neuron according to a storage location of the first neuron in the SRAM; The W inputs of a single neuron are divided into multiple input batch data according to preset intervals, the input batch data are sent to the membrane potential accumulator for operation with the weight parameters, and the membrane potential after the operation is transmitted to the next neuron in the neuron encapsulation group for operation of the next group of W inputs, until N neurons complete the operation.

[0016] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the ANN / SNN neuron acceleration calculation method described above is implemented.

[0017] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the ANN / SNN neuron acceleration calculation methods described above.

[0018] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the ANN / SNN neuron acceleration calculation methods described above.

[0019] The ANN / SNN accelerator and ANN / SNN neuron acceleration computing method provided by the present invention can greatly expand the number of fan-in that each neuron can receive through neuron packaging technology, and can respectively increase the fan-in in a single neuron and a computing core with fewer fixed resources, thereby improving the hardware utilization rate during model deployment; at the same time, the present invention can support neuron models of both ANN and SNN computing operations, and can execute ANN / SNN hybrid intelligence. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 It is a schematic diagram of the structure of the ANN / SNN accelerator provided in an embodiment of the present invention.

[0022] Figure 2 It is a schematic diagram of the oblique line phenomenon when the crossbar structure deployment model is used in the prior art.

[0023] Figure 3 It is a block diagram of the working principle of synaptic compression performed by the synaptic compression module provided by the present invention.

[0024] Figure 4 It is the overall structure of the hybrid routing network system and the internal structure diagram of L1 routing provided by the present invention.

[0025] Figure 5 It is a flow chart of the ANN / SNN neuron acceleration calculation method provided by an embodiment of the present invention.

[0026] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] With the gradual development of artificial intelligence, related applications such as image classification, target detection, and natural language processing have begun to play an increasingly important role in people's lives and work. Traditional artificial neural networks (ANN), such as convolutional neural networks (CNN), mainly achieve high accuracy and performance in different tasks through deep local feature extraction and spatial translation invariance. Neuromorphic computing, such as the third-generation neural network, the spiking neural network (SNN), attempts to imitate the operation of the human brain's nervous system, imitate the architecture of its biological sensing and information processing system, and use the spatiotemporal sparsity of pulses to achieve higher speed and energy efficiency. It is believed that it has the ability to release the greater potential of neuromorphic computing and is more conducive to further exploration of neurobehavior and brain science.

[0029] In order to deploy ANN or SNN models on mobile devices or edge devices to perform tasks, dedicated neural network accelerators have been proposed and widely studied in recent years. The design of neural network accelerators usually has two schemes: ASIC (Application-Specific Integrated Circuit)-based and FPGA (Field-Programmable Gate Array)-based. ASIC is a customized design scheme that directly constructs computing circuits through physical transistors. It usually has higher performance and energy efficiency, but its design and manufacturing process is relatively complex and expensive, and the cost of tape-out is high. As a result, its design usually needs to consider versatility, making it difficult to thoroughly optimize for specific networks. Its versatility is also limited, making it difficult to deploy a variety of emerging computing operations. FPGA is a programmable logic chip with high flexibility and configurability. It can be customized according to the needs of specific applications. Unlike ASIC, FPGA needs to build circuits through lookup tables, which is equivalent to a layer of hardware overhead caused by reconfiguration. Its energy efficiency and area efficiency are not as good as ASIC, but the reconfigurability of FPGA determines its advantages in the design of neural network accelerators. As neural networks are developing rapidly, it is necessary to continuously design neural network accelerators with updated architectures. FPGAs can verify or directly deploy new hardware architectures without tape-out. At the same time, this also allows a model to be thoroughly optimized in a hardware design, which is more advantageous than ASICs in collaborative optimization.

[0030] Among the existing internal structures of accelerators, the crossbar structure is the most commonly used computing architecture. In this architecture, the horizontal direction is used as the input axon, the vertical direction is used as the output dendrite, and the intersection of the horizontal and vertical directions is the synapse, which stores different weights. Each MAC operation in the neural network model is only executed when the synaptic weight is valid and the axon at that location emits a pulse, which is equivalent to combining the storage and processing modules. Therefore, the number of data movements can be reduced to save energy and enhance the parallelism of operations. However, there are several key problems in this structure: (1) The size of the processing cores in the accelerator is fixed, so they are difficult to adapt to convolution kernels of different sizes; (2) When designing fixed parameters in the accelerator, the fan-in and fan-out of its neurons will be limited. A fixed fan-in and fan-out will inevitably be incompatible with the complex and changeable topology of the neural network model, which means that the network must be split, resulting in some hardware resources being unable to be used, and may bring additional inter-core communication overhead, thus affecting the hardware acceleration effect.

[0031] In view of this, the present invention combines the characteristics of ANN / SNN neural network models and hardware accelerators to explore efficient neuromorphic computing acceleration circuit design solutions and data flow design and deployment solutions.

[0032] In some specific embodiments of the present invention, the present solution provides an ANN / SNN accelerator, comprising M neural computing cores, each of which comprises Q neurons. Figure 1 is a schematic diagram of the structure of the ANN / SNN accelerator provided by an embodiment of the present invention, which can also be regarded as a principle block diagram of the neuron packaging technology used in the crossbar structure, such as Figure 1 As shown, the ANN / SNN accelerator also includes: Register file 10, SRAM 20, membrane potential accumulator 30, transmitter 40, neuron packaging module 50; The register file 10 is used to store the operation state and intrinsic parameters of the neuron, each of the neurons integrates W synapses, and the W synapses are used to receive W input parameters of the neuron, and the intrinsic parameters include the fan-in threshold W of each neuron; The SRAM 20 is used to store the position information of each synapse of the neuron and the weight parameters of each synapse; The membrane potential accumulator 30 is used to perform corresponding operations on the input parameters and the weight parameters; The transmitter 40 is used to activate the membrane voltage of the membrane potential accumulator and emit voltage pulses; The neuron encapsulation module 50 is used for encapsulating N neurons into a neuron encapsulation group when the neural computing core needs to simultaneously receive inputs greater than the fan-in threshold of a single neuron, extracting W inputs through the first neuron in the neuron encapsulation group, and obtaining the weight parameters of each synapse in the first neuron according to the storage location of the first neuron in the SRAM, dividing the W inputs into multiple input batch data at preset intervals, sending the input batch data to the membrane potential accumulator for operation with the weight parameters, and transmitting the membrane potential after operation to the next neuron in the neuron encapsulation group for operation of the next group of W inputs, until the N neurons complete the operation.

[0033] In some possible implementations of the present invention, a neuron includes a neuron model and a neuron operator.

[0034] In a possible embodiment, the value range of N is 2 to 64, and the maximum value of W is 1152.

[0035] In a possible embodiment, the ANN / SNN accelerator includes 64 neural computing cores, each of which includes 512 neurons.

[0036] It should be noted that the existing crossbar neural network accelerator cannot simultaneously receive inputs that exceed the number of neuron fan-in. This fan-in limitation usually comes from parameter limitations during hardware design, which also limits the number of synapses and lacks configurability and flexibility.

[0037] The present invention uses neuron packaging technology to configure the fan-in of neurons according to demand. Compared with the traditional method of adapting the fan-in of the accelerator by stacking the number of neurons or dividing the neural network model, the present invention can achieve a maximum fan-in of 73,724.

[0038] In some possible embodiments of the present invention, Figure 1 As shown, Figure 1 It can be regarded as a principle block diagram of the application of neuron packaging technology to the crossbar structure, which shows the principle framework of how the embodiment of the present invention uses neuron packaging technology to improve fan-in.

[0039] Specifically, this embodiment provides an implementation method of neuron packaging technology, which greatly expands the number of fan-ins that each neuron can receive.

[0040] In a possible embodiment, the neuron developed by the present invention includes the following components: a register stack that stores the operating state of the neuron (resting state, depolarized state or hyperpolarized state) and neuron intrinsic parameters such as threshold and leakage; a configurable SRAM that can be shared by all cores to store all synaptic connections and weights; a membrane potential accumulator and a transmitter that can activate the membrane level and emit pulses. Each neuron integrates up to 1152 (128×9) synapses to better adapt to the most common 3×3 convolution kernel. In actual use, according to the requirements of the model, the user can reconfigure the neuron parameters or weights in the synapse to fine-tune the network. The neuron not only supports a large number of neuron models, such as accumulation-release (IF) model, leakage-accumulation-release (LIF) model, degenerate Izhikevich model, etc., but also supports most operators such as multiplication and accumulation, pooling, ReLu activation, etc. in convolutional neural networks.

[0041] In some possible embodiments of the present invention, the neuron encapsulation module is also used for, when the last neuron in the neuron encapsulation group performs an operation, the SNN emits a pulse by comparing the membrane level with the threshold voltage, or the ANN emits a pulse through an activation function; updating the membrane voltage and the operating state of the neuron, and writing the updated membrane voltage and the operating state of the neuron back to the register stack and SRAM respectively.

[0042] Specifically, in order to support the situation where neurons may need to receive more than 1152 fan-in, neuron packaging technology can "package" neurons together to form larger neurons and modify the data flow connection within the computing core. The parameter N is used to specify the number of neurons in a group of packages, with a valid range of 1 to 64. When the acceptable fan-in of a single neuron cannot meet the model requirements, N will be pre-calculated. When the computing core detects that N>1 at the beginning of the calculation, neuron packaging is enabled. The synapses and weights of the packaged neurons are independent of each other, but other parameters are preset to be the same. During the operation, the controller first decodes the received pulses (SNN mode) or the input 8-b data (ANN mode) and assigns them to the input buffer level of the corresponding neuron. At the same time, a group of packaged neurons reads their states and intrinsic parameters (the same color REG is used in the same group of packages in the figure) and searches the storage location of the first neuron in SRAM to obtain the weights of all its synapses. Next, the first neuron extracts its 1152 inputs in parallel and divides them into different batches at certain intervals. Then, these input data batches are sent to the accumulator for pulse accumulation or multiplication and accumulation operations, and the acquired membrane voltage is passed to the next neuron in the same package for the calculation of the next set of 1152 inputs. Since the neuron calculations in the same package are performed sequentially, the access to the weight SRAM can also be performed sequentially, and the next address can be directly accessed each time. When all N neurons have completed their work within a time step, the SNN mode membrane level is compared with the threshold voltage to emit pulses, or the ANN mode passes the activation function. This operation will only occur in the last neuron, and the previous N-1 neurons will not be performed. Finally, the membrane voltage and neuron state are updated according to the working mode and written back to the corresponding registers and SRAM. In this way, the fan-in of the neuron is amplified to 1152×N by the NPM, and a maximum of 73728 (N=64) input values ​​can be received simultaneously for calculation.

[0043] In some possible implementations of the present invention, the ANN / SNN is fine-tuned by configuring the neuron parameters or weight parameters in the synapse.

[0044] In a possible embodiment, based on the basic LIF neuron model, the neuron package mechanism (NPM) is used to increase the fan-in of each neuron in the computing core to N×1152, where N ranges from 1 to 64.

[0045] In some possible embodiments of the present invention, the ANN / SNN accelerator also includes a synapse compression module, wherein the synapse compression module is used to compress the storage of the SRAM to store only valid synapses and weight parameters of the valid synapses, and is adapted to only select neurons containing the valid synapses to participate in the calculation during neuron calculations, and neurons not containing valid synapses do not participate in the calculations, thereby avoiding waste of neurons, wherein the valid synapses are synapses participating in the calculations.

[0046] It is worth noting that in existing crossbar neural network accelerators, since each neuron selects different inputs when calculating, not all synapses in the neuromorphic core are used. Figure 2 It is a schematic diagram of the oblique line phenomenon when the crossbar structure deployment model is used in the prior art, such as Figure 2 As shown in the example in (a), the 2×2 convolution kernel slides on the feature map with a stride of 1, and the input is flattened into a 16×1 vector. However, each output neuron only takes 4 products as the accumulated weight window, and the rest of the input is ignored, that is, this part of the weight is invalid. When all neurons are arranged together, a diagonal line shape is formed, and the synapses and silicon area in other areas are completely wasted, resulting in extremely low synaptic resource utilization (only 25% in the figure). In addition, if the slope of this diagonal line is large, the shape will not be as Figure 2 (a) does not extend along the diagonal line, but reaches the bottom of the neuron array earlier, resulting in the right neuron not actually being used, causing fan-out waste, such as Figure 2 As shown in (b), this deployment phenomenon will greatly reduce the number of available fan-out neurons.

[0047] Therefore, the synapse compression technology used in the present invention can greatly increase the fan-out number of the computing core by utilizing fewer fixed resources within the computing core, supporting up to 4096 fan-outs, and improving the resource utilization efficiency of the synapse.

[0048] In some possible implementations of the present invention, the step of compressing the storage of the SRAM to store only the effective synapses within the effective weight window and the weight parameters of the effective synapses specifically includes: The synaptic region where each neuron actually performs calculations is defined as a valid weight window, and the synapses that do not participate in the calculations are defined as invalid synapses; based on the valid weight window, the storage of the SRAM is adjusted so that it only stores the synapses within the valid weight window, and the weight parameters of the invalid synapses outside the valid weight window are deleted.

[0049] In a possible embodiment, if Figure 3 As shown, Figure 3It is a block diagram of the working principle of synaptic compression performed by the synaptic compression module provided by the present invention, and the figure shows how the present invention uses synaptic compression technology for improvement.

[0050] Specifically, the synapse compression mechanism (SCM) used in the embodiment of the present invention defines the synaptic region where each neuron actually performs calculations as an effective weight window (hereinafter referred to as a "window"). Based on this, the storage of the weight SRAM can be adjusted to store only the synapses within the window ( Figure 3 The orange part in the middle), while deleting the invalid weights ( Figure 3 Based on this, by calculating two parameters indicating the specific position of the weight window, the composition of a fully encapsulated neuron can be described as: 1152×off N +off index +L w +U=1152×N(1) Among them, off N Indicates how many complete invalid neurons there are before the window, off index Indicates how many invalid synapses are contained in the first valid neuron before the window. w It is defined as the length of the weight window, and U represents an invalid synapse. If the invalid synapse is located after the window, it can be directly ignored after the window calculation.

[0051] In some possible implementations of the present invention, the step of selecting only neurons containing the effective synapses to participate in the calculation, and neurons not containing the effective synapses not participating in the calculation, specifically includes: S1. Define neurons that contain effective synapses as effective neurons, and neurons that do not contain effective synapses as invalid neurons; S2, starting from the first neuron in the neuron encapsulation group, searching for valid neurons in sequence; S3, judging whether the currently searched neuron reaches the effective weight window; S4, if not, it is determined to be an invalid neuron and jumps to S3; S5. If yes, search the starting synaptic position of the effective weight window in the neuron in sequence according to the intervals between the input batch data, and start executing the neuron operation at the starting synaptic position.

[0052] In some possible implementations of the present invention, the step of starting to execute neuron operations at the starting synaptic position specifically includes: Starting from the starting synaptic position, performing neuron calculation on the effective synapses within the effective weight window; If the effective weight window spans multiple neurons, two operations are performed at the boundaries of each neuron; After the calculation of the effective weight window is completed, the remaining invalid synapses of the neuron encapsulation group where the effective weight window is located are skipped, and the effective weight window of the next neuron encapsulation group is entered for calculation.

[0053] Specifically, if Figure 3 Example, starting from the first neuron in the package, first determine whether the neuron has reached the window (with of N If not, this neuron is invalid, and the neuron is skipped and the next neuron is moved to continue searching for the window; if yes, the window is started to detect which synapse of the current neuron starts, and the size of the input batch divided in NPM is used as the interval to search in sequence, and of index Once the window is found, the computation is performed as described in NPM, summing the input spikes or performing a multiply-accumulate operation. Since the window may span multiple neurons ( Figure 3 In the example on the right), the calculations at the boundary of two neurons may need to be performed in stages. After the calculations are completed in the weight window, the remaining synapses can be skipped, and the pointer of the identified neuron points to the next encapsulated neuron and the process is performed on it.

[0054] This embodiment uses the synaptic compression technology SCM to prune invalid synaptic connections when deploying the model, which can eliminate the aforementioned diagonal line phenomenon (the diagonal line can be compressed into a rectangle because the upper and lower invalid areas are cut off). Calculation is only performed when the synapse is valid, making full use of the neurons wasted in the diagonal line shape, which can greatly improve the hardware resource efficiency and the fan-out number of the neuromorphic core, and thus can significantly reduce the total number of computing cores required to deploy a model.

[0055] In a possible embodiment, each core of the present invention can provide up to 4096 neuron fan-outs.

[0056] The embodiment of the present invention uses synaptic compression technology to eliminate the diagonal line phenomenon when the model is deployed on hardware, and no longer stores invalid synapses and weights, so that all synapses in the core can be effectively used and all neurons in the core are activated for output.

[0057] In the practical application of ANN and SNN, multi-core processors have improved computing power, but the communication scheme between internal processing cores has a great impact on the efficiency and delay of the processor. The various routing communication networks that have been proposed are difficult to balance in terms of data transmission speed, congestion handling, etc. Specifically, existing multi-core neural network accelerators usually use tree networks (Tree Structure) or two-dimensional mesh networks (2D-Mesh Structure) to complete data communication between cores. Both of these topological structures have obvious advantages and disadvantages. For large designs, tree networks can reduce delays, but the throughput is very low because the data traffic will be concentrated at the root node, resulting in data congestion, while the two-dimensional mesh network has a higher throughput, but its delay is relatively high. The present invention designs a hybrid routing network that combines the characteristics of the two, which can improve the data transmission speed while alleviating the congestion problem within the network to a certain extent.

[0058] To solve the above problems, the present invention proposes a hybrid routing network that combines a tree network (Tree Structure) and a two-dimensional mesh network (2D-Mesh Structure), which can improve the data transmission speed while alleviating the congestion problem within the network to a certain extent.

[0059] In some possible implementations of the present invention, the ANN / SNN accelerator further includes an L1 router; Wherein, every four neural computing cores of the ANN / SNN accelerator are connected to one L1 router to form a quadtree structure, and 16 L1 routers form a two-dimensional grid structure; Each of the L1 routers includes four pairs of asynchronous first transmitters and receivers, and the first transmitters and receivers are used for data exchange with adjacent L1 routers in four directions of the two-dimensional grid structure; Each of the L1 routers further includes four pairs of asynchronous second transmitters and receivers, and the second transmitters and receivers are used for data interaction between the L1 router and each neural computing core.

[0060] Specifically, this embodiment provides an implementation method of a hybrid routing network, which combines the characteristics of a tree network (TreeStructure) and a two-dimensional mesh network (2D-Mesh Structure), and can improve data transmission speed, reduce latency, and alleviate congestion problems within the network to a certain extent.

[0061] In a possible embodiment, the L1 router further includes a distributor; the distributor is used to determine the sending direction of a data frame in the L1 router, the data frame being data or pulses that carry address event representation rules.

[0062] In a possible embodiment, Figure 4 As shown, Figure 4 The overall multi-core structure, hybrid routing network system and internal structure of L1 routing of the present invention are demonstrated.

[0063] In a possible embodiment, the ANN / SNN accelerator provided by the present invention is composed of 64 neural computing cores. For the SNN mode, each core is equipped with 512 neurons as outputs, and there are 4096 neurons in the ANN mode. Every 4 computing cores are connected to an L1 router to form a quadtree structure. 16 L1 routers form a two-dimensional grid structure. All 12 L1 routers around can interact with the outside for data, and the entire system can achieve 8.9Gbps ​​throughput. This hybrid routing network system also supports multicast from the L1 router to the four cores according to the multicast address. In the L1 router, there are 4 pairs of asynchronous transmitters and receivers for interacting with adjacent routers in four directions of the two-dimensional grid level, and 4 pairs are also equipped for interacting between L1 routing and computing cores. Each computing core is also equipped with a pair of transmitters and receivers to connect the routers and controllers (including crossbar structures) in the core. The L1 router also has a distributor inside to determine which direction the data frame should be sent. The data frame is 64 bits and is used to carry data or pulses that conform to the Address Event Representation (AER) rules.

[0064] In a possible embodiment, in order to measure the internal data transmission distance, a data frame is defined as a step when it is sent from one computing core to an adjacent computing core. In this way, the longest path required for data transmission within this hybrid network is 8 steps (green dotted line), which is much smaller than the 14 steps (red dotted line) of a pure two-dimensional grid structure. According to the measurement results, the average distance between any two computing cores in the network is 4.46875 steps, while the pure two-dimensional grid structure is 5.25 steps and the pure quadtree structure is 5.34375 steps. It can be seen that the present invention successfully reduces communication delays and can also alleviate data congestion in advanced nodes.

[0065] On the basis of the above embodiments, the neuron packaging technology NPM, synapse compression technology SCM and hybrid routing network system proposed in the present invention are applicable to both ASIC and FPGA.

[0066] Table 1 shows the performance comparison of different FPGA-based ANN / SNN neural network accelerator design schemes. The table mainly lists the test results comparison of similar technical solutions on FPGA.

[0067] Table 1 As can be seen from Table 1, the present invention achieves higher computing power and energy efficiency in FPGA design, and successfully improves the fan-in and fan-out of the accelerator while maintaining a higher model accuracy. The specific comparison results can be summarized as follows: First, few existing neural network accelerators support both ANN and SNN computing modes at the same time. The present invention can perform ANN / SNN hybrid intelligence by designing a neuron model that can support multiple computing operations; Second, the existing neural network accelerators usually increase the number of neuron fan-in and computing core fan-out by directly stacking the number of the above two computing units, which has low configurability and resource utilization efficiency. The present invention can directly increase fan-in and fan-out by using fewer fixed resources in a single neuron and computing core, respectively, and improve hardware utilization during model deployment by designing and applying neuron encapsulation technology and synaptic compression technology; Third, the test data sets generally used by the publicly available accelerators are relatively few. The present invention has been deployed and tested on three public data sets (MNIST, Fashion MNIST and CIFAR10), and the results have proved the effectiveness of the present invention.

[0068] The ANN / SNN accelerator provided by the present invention can greatly improve the fan-in of neurons by using neuron encapsulation technology, can greatly improve the fan-out of computing cores by using synaptic compression technology, and improve the utilization efficiency of hardware resources during model deployment; the hybrid on-chip routing system can achieve a balance between communication delay and data congestion and achieve good results. Compared with the traditional method of adapting the fan-in of the accelerator by stacking the number of neurons or splitting the neural network model, the present invention adopts neuron encapsulation technology to make the fan-in size of neurons configurable, and provides a considerable maximum fan-in of 73724. Compared with the traditional model deployment scheme, the synaptic compression technology adopted by the present invention cuts off the storage and calculation of invalid weights, and only operates on valid weights. Therefore, the present invention can increase the fan-out number of computing cores (maximum 4096) and improve the utilization efficiency of hardware resources. It can be seen from the test results of the on-chip network that the present invention successfully reduces the communication delay inside the accelerator, and based on the internal two-dimensional grid structure, it can also reduce the data congestion of high-level nodes.

[0069] In a possible embodiment, the present invention further provides an ANN / SNN neuron accelerated computing method, the method is implemented by an ANN / SNN accelerator as described in any one of the above, the ANN / SNN accelerator includes M neural computing cores, each of the neural computing cores includes Q neurons, Figure 5 : is a flow chart of the ANN / SNN neuron acceleration calculation method provided by an embodiment of the present invention, such as Figure 5 As shown, the method includes: Step 510: When the input of the neural computing core is greater than the fan-in threshold W of a single neuron of the neural computing core, determine the number N of neurons participating in the calculation in the neural computing core; Step 520: encapsulate the N neurons into a neuron encapsulation group, extract W inputs through the first neuron in the neuron encapsulation group, and obtain the weight parameters of each synapse in the first neuron according to the storage location of the first neuron in the SRAM; Step 530: divide the W inputs of a single neuron into multiple input batches according to preset intervals, send the input batches to the membrane potential accumulator to perform operations with the weight parameters, and pass the calculated membrane potential to the next neuron in the neuron encapsulation group for the operation of the next group of W inputs, until N neurons complete the operation.

[0070] Based on the above embodiments, the synapse compression module in the ANN / SNN accelerator can be used to compress the SRAM storage to only store valid synapses and weight parameters of the valid synapses, which is adapted to the process of neuron calculation, in which only neurons containing the valid synapses are selected to participate in the calculation, and neurons not containing valid synapses do not participate in the calculation, thereby avoiding waste of neurons, wherein the valid synapses are synapses participating in the calculation.

[0071] It can be understood that the ANN / SNN accelerator provided in any of the above embodiments can be applied to the ANN / SNN neuron acceleration calculation method provided in this embodiment. The implementation principle and beneficial effects of the ANN / SNN neuron acceleration calculation method provided in the embodiment of the present invention are similar to the implementation principle and beneficial effects of the ANN / SNN accelerator shown in the above embodiments. Therefore, the implementation principle and beneficial effects of the ANN / SNN accelerator shown in the above embodiments can be referred to, and they will not be repeated here.

[0072] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6As shown, the electronic device may include: a processor (processor) 610, a communication interface (Communications Interface) 620, a memory (memory) 630 and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call the logic instructions in the memory 630 to execute the ANN / SNN neuron accelerated calculation method, which includes: when the input of the neural computing core is greater than the fan-in threshold W of a single neuron of the neural computing core, determining the number N of neurons participating in the calculation in the neural computing core; encapsulating the N neurons into a neuron encapsulation group, extracting W inputs through the first neuron in the neuron encapsulation group, and obtaining the weight parameters of each synapse in the first neuron according to the storage location of the first neuron in the SRAM; dividing the W inputs of a single neuron into multiple input batch data at preset intervals, sending the input batch data to the membrane potential accumulator for operation with the weight parameters, and passing the membrane potential after operation to the next neuron in the neuron encapsulation group for operation of the next group of W inputs, until N neurons complete the operation.

[0073] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0074] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the ANN / SNN neuron acceleration calculation method provided by the above methods, which method includes: when the input of the neural computing core is greater than the fan-in threshold W of a single neuron of the neural computing core, determining the number N of neurons participating in the calculation in the neural computing core; encapsulating the N neurons into a neuron encapsulation group, extracting W inputs through the first neuron in the neuron encapsulation group, and obtaining the weight parameters of each synapse in the first neuron according to the storage position of the first neuron in the SRAM; dividing the W inputs of a single neuron into multiple input batch data according to a preset interval, sending the input batch data to a membrane potential accumulator to perform calculations with the weight parameters, and passing the calculated membrane potential to the next neuron in the neuron encapsulation group for the calculation of the next group of W inputs, until N neurons complete the calculation.

[0075] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the ANN / SNN neuron acceleration calculation method provided by the above-mentioned methods, the method comprising: when the input of the neural computing core is greater than the fan-in threshold W of a single neuron of the neural computing core, determining the number N of neurons participating in the calculation in the neural computing core; encapsulating the N neurons into a neuron encapsulation group, extracting W inputs through the first neuron in the neuron encapsulation group, and obtaining the weight parameters of each synapse in the first neuron according to the storage position of the first neuron in the SRAM; dividing the W inputs of a single neuron into multiple input batch data at preset intervals, sending the input batch data to a membrane potential accumulator for operation with the weight parameters, and passing the calculated membrane potential to the next neuron in the neuron encapsulation group for operation of the next group of W inputs, until N neurons complete the operation.

[0076] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. A person of ordinary skill in the art can understand and implement it without creative labor. Through the description of the above implementation methods, a person of ordinary skill in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.

[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An ANN / SNN accelerator, comprising M neural computing cores, each of which comprises Q neurons, characterized in that: The ANN / SNN accelerator further includes a register stack, an SRAM, a membrane potential accumulator, a transmitter, and a neuron encapsulation module; the register stack is used to store the operating state and intrinsic parameters of the neuron, each of the neurons integrates W synapses, and the W synapses are used to receive W input parameters of the neuron, and the intrinsic parameters include a fan-in threshold W of each neuron; The SRAM is used to store the position information of each synapse of the neuron and the weight parameters of each synapse; The membrane potential accumulator is used to perform corresponding operations on the input parameters and the weight parameters; The transmitter is used to activate the membrane voltage of the membrane potential accumulator and emit voltage pulses; The neuron encapsulation module is used for encapsulating N neurons into a neuron encapsulation group when the neural computing core needs to simultaneously receive inputs greater than the fan-in threshold W of a single neuron, extracting W inputs through the first neuron in the neuron encapsulation group, and obtaining the weight parameters of each synapse in the first neuron according to the storage location of the first neuron in the SRAM, dividing the W inputs into multiple input batch data at preset intervals, sending the input batch data to the membrane potential accumulator to perform operations with the weight parameters, and transmitting the membrane potential after the operation to the next neuron in the neuron encapsulation group for the operation of the next group of W inputs, until the N neurons complete the operation.

2. The ANN / SNN accelerator according to claim 1, characterized in that: The ANN / SNN accelerator also includes a synaptic compression module, Among them, the synapse compression module is used to compress the storage of SRAM to only store effective synapses and weight parameters of the effective synapses, which is suitable for selecting only neurons containing the effective synapses to participate in the calculation during the neuron calculation process, and neurons that do not contain effective synapses do not participate in the calculation, thereby avoiding the waste of neurons, wherein the effective synapses are synapses that participate in the calculation.

3. The ANN / SNN accelerator according to claim 1, characterized in that: The neuron packaging module is also used for, when the last neuron in the neuron packaging group performs operation, the SNN emits a pulse by comparing the membrane level with the threshold voltage, or the ANN emits a pulse through the activation function; and, The membrane voltage and the operating state of the neuron are updated, and the updated membrane voltage and the operating state of the neuron are written back to the register file and the SRAM respectively.

4. The ANN / SNN accelerator according to claim 3, characterized in that: Compressing the storage of the SRAM to store only the effective synapses within the effective weight window and the weight parameters of the effective synapses specifically includes: The synaptic region where each neuron actually performs calculations is defined as a valid weight window, and the synapses that do not participate in the calculations are defined as invalid synapses; based on the valid weight window, the storage of the SRAM is adjusted so that it only stores the synapses within the valid weight window, and the weight parameters of the invalid synapses outside the valid weight window are deleted.

5. The ANN / SNN accelerator according to claim 4, characterized in that: The step of selecting only neurons containing the effective synapses to participate in the calculation, and neurons not containing the effective synapses not participating in the calculation, specifically includes the following steps: S1. Define neurons that contain effective synapses as effective neurons, and neurons that do not contain effective synapses as invalid neurons; S2, starting from the first neuron in the neuron encapsulation group, searching for valid neurons in sequence; S3, judging whether the currently searched neuron reaches the effective weight window; S4, if not, it is determined to be an invalid neuron and jumps to S3; S5. If yes, search the starting synaptic position of the effective weight window in the neuron in sequence according to the intervals between the input batch data, and start executing the neuron operation at the starting synaptic position.

6. The ANN / SNN accelerator according to claim 5, characterized in that: The neuron operation is started at the starting synaptic position, specifically including: Starting from the starting synaptic position, performing neuron calculation on the effective synapses within the effective weight window; If the effective weight window spans multiple neurons, two operations are performed at the boundaries of each neuron; After the calculation of the effective weight window is completed, the remaining invalid synapses of the neuron encapsulation group where the effective weight window is located are skipped, and the effective weight window of the next neuron encapsulation group is entered for calculation.

7. The ANN / SNN accelerator according to any one of claims 1 to 6, characterized in that: The neuron includes a neuron model and a neuron operator.

8. The ANN / SNN accelerator according to claim 1, characterized in that: The value range of N is 2 to 64, and the maximum value of W is 1152.

9. The ANN / SNN accelerator according to claim 1, characterized in that: The ANN / SNN accelerator includes 64 neural computing cores, each of which includes 512 neurons; the ANN / SNN accelerator also includes an L1 router; Wherein, every four neural computing cores of the ANN / SNN accelerator are connected to one L1 router to form a quadtree structure, and 16 L1 routers form a two-dimensional grid structure; Each of the L1 routers includes four pairs of asynchronous first transmitters and receivers, and the first transmitters and receivers are used for data exchange with adjacent L1 routers in four directions of the two-dimensional grid structure; Each of the L1 routers further includes 4 pairs of asynchronous second transmitters and receivers, where the second transmitters and receivers are used for data interaction between the L1 router and each neural computing core; The L1 router also includes a distributor; The distributor is used to determine the sending direction of the data frame in the L1 router, and the data frame carries data or pulses that comply with the address event representation rule.

10. An ANN / SNN neuron acceleration calculation method, characterized in that: The method is implemented by the ANN / SNN accelerator according to any one of claims 1 to 12, wherein the ANN / SNN accelerator comprises M neural computing cores, each of which comprises Q neurons, and the method comprises: When the input of the neural computing core is greater than the fan-in threshold W of a single neuron of the neural computing core, determining the number N of neurons participating in the calculation in the neural computing core; Encapsulating N neurons into a neuron encapsulation group, extracting W inputs through a first neuron in the neuron encapsulation group, and obtaining weight parameters of each synapse in the first neuron according to a storage location of the first neuron in the SRAM; The W inputs of a single neuron are divided into multiple input batch data according to preset intervals, the input batch data are sent to the membrane potential accumulator for operation with the weight parameters, and the membrane potential after the operation is transmitted to the next neuron in the neuron encapsulation group for operation of the next group of W inputs, until N neurons complete the operation.

Citation Information

Patent Citations

  • Handling signal saturation in spiking neural networks

    CN108629403A

  • Neuromorphic package devices and neuromorphic computing systems

    CN112734019A

  • Neural network with reconfigurable sparse connectivity and online learning

    EP3343457A1

  • Server for provding user interface for multimedia content creation and operating method therefor

    KR1020250082508A

  • Implementing a neural network algorithm on a neurosynaptic substrate based on criteria related to the neurosynaptic substrate

    US20160335535A1

Cited By

  • ANN and SNN heterogeneous fusion processor and heterogeneous fusion processing method

    CN118940203A

  • Convolution processor and method for spiking neural network, and electronic equipment

    CN120012851A