A brain-like computing chip mapping method for recurrent spiking neural networks
By calculating the constraints of the dendrite table and axon table, allocating neuron nodes layer by layer and performing split processing, the deadlock problem of the recurrent spiking neural network on the brain-like computing chip is solved, and efficient mapping and running speed improvement are achieved. .
Patent Information
- Application Number
- CN202210104658.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-28
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-01-28
AI Technical Summary
The deployment of recurrent spiking neural networks on brain-inspired computing chips has a configuration deadlock problem, which makes it impossible to determine the configuration sequence of neuron nodes, affecting efficient parallel and low-power operation.
Adopting the strategy of exchanging space for time, by calculating the maximum number of synapses that a single node dendrite table can accommodate, combined with the input logical graph structure of the recurrent spiking neural network, neuron nodes are allocated, and the axon table is performed layer by layer. Constraints are checked, and if the constraints are not met, they are split until all nodes meet the hardware constraints, and binary chip configuration information is generated to complete the mapping.
It solves the mapping deadlock problem of recurrent spiking neural networks on brain-inspired computing chips, significantly improves the program running speed, can efficiently complete the mapping of RSNN, and achieves accurate deployment and performance improvement.
Smart Images

Figure CN114492770B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of chip deployment, and in particular to a brain-like computing chip mapping method for recurrent spiking neural networks. Background Art
[0002] Brain-like computing with non-von Neumann architecture that integrates storage and computing has attracted widespread attention from the scientific community for its high performance and low power consumption. As the basis of brain-like computing, spiking neural networks cannot exert their biological characteristics when running on ordinary hardware devices, and their performance will be greatly reduced. The hardware designed and developed to improve the running speed of traditional artificial neural networks is now relatively mature, including GPU parallel frameworks, Cambrian series processors, etc. However, such chips are only targeted at specific algorithms or networks, and the acceleration effect on spiking neural networks is not good. Therefore, brain-like computing chips that apply spiking neural networks to computer architecture design have been launched one after another. The Darwin chip is a highly parallel, non-von Neumann architecture that integrates storage and computing. A single chip can support 150,000 neurons and tens of millions of synapses, and can support the cascading and expansion of multiple chips.
[0003] The brain-like computing chip compilation tool shields the physical details of the brain-like chip, provides an interface for a unified pulse neural network description framework, maps the pulse neural network model provided by the user and deploys it on the hardware. Since the brain-like computing chip adopts a non-von Neumann architecture design, it is not suitable for traditional programming models. Moreover, with the scale of the SNN model, purely manual programming is cumbersome and repetitive. Different deployment structures of the pulse neural network model on the brain-like chip may result in different results and performance of the chip's real-time operation. Achieving efficient parallel and low-power operation is a topic that the industry has been researching and exploring. Through the brain-like computing compiler, the development threshold of brain-like algorithms can be significantly lowered, and at the same time, the encapsulation of the underlying hardware can be achieved, making it easier for users to use the chip for algorithm research and application development, and shortening the manpower and time costs of model deployment.
[0004] For example, a Chinese patent document with publication number CN112561042A discloses a neural model mapping method for a brain-like computer operating system, including the following steps: obtaining a directed graph G of a pulse neural network model, whose nodes are logical neuron clusters v; calculating the topological sequence O(G) of the directed graph, and calculating the mappable area R of the logical neuron cluster v based on the hardware constraints of the brain-like computer; according to the topological sequence O(G), for the logical neuron cluster v, selecting a physical neuron cluster in the mappable area R for mapping.
[0005] Recurrent Neural Network (RNN) is an important network structure in the field of machine learning. Correspondingly, in the field of brain-like computing, Recurrent Spiking Neural Network (RSNN) also has many application scenarios. However, how to deploy RSNN on a chip has always been a difficult problem. Brain-like compilation tools are usually oriented towards acyclic spiking neural networks. According to the hardware characteristics of the chip, the configuration of SNN neurons is related to the node configuration results of the next layer of the network. Therefore, the reverse order of topological sorting is generally used to configure neuron nodes, and the cyclic network structure forms a deadlock, making it impossible to determine the configuration order of neuron nodes. Summary of the invention
[0006] The present invention provides a brain-like computing chip mapping method for recurrent spiking neural networks to solve the configuration deadlock problem in recurrent network mapping. It adopts a strategy of trading space for time and sacrifices a smaller memory cost in exchange for a faster running speed, so as to efficiently complete the mapping of recurrent spiking neural networks on brain-like computing chips.
[0007] A brain-like computing chip mapping method for recurrent spiking neural networks comprises the following steps:
[0008] S1, obtains the input of the recurrent spiking neural network and converts it into a logical graph structure that represents the information required for mapping;
[0009] S2, calculate the maximum number of synapses that a single node dendrite table can accommodate;
[0010] S3, without considering the axon table constraint, the neuron nodes are allocated according to the maximum number of synapses that the dendrite table of each layer of nodes can accommodate, combined with the input logical graph structure of the recurrent spiking neural network;
[0011] S4, check the constraints of the axon table of each node layer by layer, if the constraints are not met, proceed to step S5, if the constraints are met, proceed to step S6;
[0012] S5, split the nodes that do not satisfy the axon table constraint, and return to step S4 to check the axon table constraint of each node;
[0013] S6, when all nodes meet the hardware constraints, node coordinates are assigned;
[0014] S7, generates the configuration information of the binary chip and completes the mapping of deploying the recurrent pulse neural network onto the brain-like computing chip.
[0015] In step S2, the formula for calculating the maximum number of synapses that a single-node dendrite table can accommodate is as follows:
[0016]
[0017] Among them, DepthMemDendrite is the depth of the dendrite table, BitWidthMemDendrite is the bit width of a single row of the dendrite table, BitWidthNeuronID is the bit width of the neuron ID, and BitWidthWeight is the bit width of the weight, rounded down.
[0018] In step S3, the configuration of the axon table is related to the number of physical nodes configured for the postsynaptic neurons. When there is a cyclic connection between the two layers of the network, the configuration of the axon table is mutually dependent, forming a deadlock. And the depth of the dendrite table is the bottleneck of the number of neurons of the node, and the number of neurons that the dendrite table generally determines the number of neurons that the node can accommodate. Therefore, in step S3, the constraints of the axon table are not considered for the time being, and only the number of neurons that the dendrite table can accommodate is calculated. At this time, the problem of configuration deadlock in the cyclic pulse neural network is resolved. The maximum number of synapses that the dendrite table obtained by S2 can accommodate is used to estimate the number of neurons, and then converge. The number of nodes required for this layer is determined by allocating the neurons of this layer in turn, and the operation is performed layer by layer until the mapping of all nodes is completed.
[0019] The specific process of step S3 is as follows:
[0020] First, according to step S2, the maximum number of synapses that the dendrite table can accommodate is obtained to estimate the maximum number of neurons that the node can accommodate, and then the following formula is used for convergence:
[0021]
[0022] Among them, n is the number of dendrites of the node, that is, the number of presynaptic neurons of the node, NumNeuronPre, 1 means that each dendrite occupies a row in the dendrite table header, NumNeuronPost i is the number of postsynaptic neurons of the ith dendrite, SizeNeuronID is the number of neuron IDs that can be stored in a single-row dendrite table, SizeWeight is the number of weights that can be stored in a single-row dendrite table, and the number of rows occupied by the calculated neuron ID and weight are rounded up;
[0023] The neurons of this layer are allocated in sequence to determine the number of nodes required for this layer, and the operation is performed layer by layer until the mapping of all nodes is completed.
[0024] In step S4, the axon table of the presynaptic node is established according to the number of pre-allocated nodes, and the axon table is checked according to the following formula to see if it satisfies the axon constraint. If not, it is split. The axon table constraint check uses the following formula:
[0025] m×(1+NumNodePost all )≤DepthMemAxon
[0026] Among them, m is the number of neurons in the node, NumNodePost all is the number of all postsynaptic nodes in the network layer where the node is located, and DepthMemAxon is the depth of the axon table.
[0027] In fact, except for the fully connected mode, a single neuron in a network layer will not be connected to all neurons in the next layer, that is, the number of postsynaptic nodes of a single neuron should be less than NumNodePost all Here, the axon table constraints are slightly enlarged. Since the axon table usually has free memory, the change here will not cause a lot of waste, but it can simplify the axon table calculation and save calculation time.
[0028] In step S5, a greedy strategy is adopted when splitting nodes that do not satisfy the axon table constraints.
[0029] If a simple binary splitting method is used, the number of nodes may increase significantly after multiple iterations, while the utilization rate of the axon table of each node is low, the overall algorithm converges slowly, and the time complexity increases. Therefore, the present invention adopts a greedy strategy for axon splitting, traversing the network layer one by one, checking the axon constraints of each node, and if they do not meet the requirements, modifying them to the maximum number of neurons that can be accommodated at present, and the remaining neurons generate a new node to be added to the tail of the node set of the original network layer.
[0030] In step S5, when the node is split, the NumNodePost all If the neuron size increases, the axonal constraints of the presynaptic neuron layer of this layer need to be re-examined.
[0031] When performing node splitting, all nodes in this layer meet the constraints. If axon splitting exists in this layer, for the presynaptic nodes of this layer, NumNodePost all The increase will cause the axon storage memory of the presynaptic node to increase, which may exceed the constraint threshold. Therefore, after splitting the node, the axon verification of the presynaptic node of this layer is required.
[0032] In step S6, a greedy strategy is used to allocate node coordinates so that the sum of the Manhattan distances of the nodes is as small as possible.
[0033] When allocating the coordinates of the nodes, it is necessary to combine the hardware resource constraints and consider the communication cost. The network operation time mainly consists of two parts: calculation and pulse transmission. Compared with the information transmission time, the calculation time is much smaller. Therefore, the real-time performance of the network operation is related to the information transmission time, that is, the distance of information transmission should be as small as possible. The present invention adopts a greedy strategy, and the nodes are preferentially allocated on the side close to the input and output ports, and the coordinates with the smallest Manhattan distance and the previous layer of the network are selected in turn.
[0034] In step S7, a binary configuration file is generated according to the format requirements of the brain-like computing chip to complete the mapping of the recurrent pulse neural network to the chip.
[0035] Compared with the prior art, the mapping method of the present invention has the following beneficial effects:
[0036] (1) The present invention studies and analyzes RSNN and chip hardware structure, identifies the main bottleneck of memory constraints, and solves the deadlock problem in the process of mapping RSNN to chip, so that RSNN can be accurately mapped and deployed on brain-like computing chips.
[0037] (2) The present invention adopts a strategy of trading space for time, significantly improving the program running speed at a relatively small memory cost, and can efficiently map RSNN. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 This is the workflow diagram of the Darwin compiler;
[0039] Figure 2 This is a schematic diagram of the three-level index of Darwin brain-like computing chip;
[0040] Figure 3 This is a schematic diagram of the RSNN network model sample structure;
[0041] Figure 4 This is a schematic diagram of the synaptic file connection format;
[0042] Figure 5 Compile the model structure diagram for RSNN;
[0043] Figure 6 This is a flow chart of a brain-like computing chip mapping method for recurrent spiking neural networks according to the present invention;
[0044] Figure 7 This is a diagram of the mapping result in an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be pointed out that the embodiments described below are intended to facilitate the understanding of the present invention and do not have any limiting effect on the present invention.
[0046] The purpose of this algorithm is to solve the deadlock problem in the process of mapping RSNN to chip. It studies and analyzes the RSNN and chip hardware structure, grasps the bottleneck dendritic table memory that constrains the number of node neurons, and then considers other constraints, which significantly reduces the time complexity of the mapping algorithm.
[0047] The Darwin compiler workflow is as follows Figure 1As shown in the figure, the Darwin compiler compiles the SNN model using the pulse neural network obtained through SNN model training or ANN model training conversion as input to obtain a binary target file. The target file is deployed on the hardware platform to run, and the output pulse of the SNN model is obtained. Through the visualization of the output pulse and the result analysis, the performance of the SNN model can be analyzed and the algorithm can be tuned. The compiler is mainly divided into three steps: graph parsing, graph mapping, and graph compilation. Graph parsing converts the SNN model input into a unified logical graph structure. Graph mapping maps the logical graph to the physical neuron node to obtain the SNN physical structure graph. Graph compilation generates a binary target file from the SNN physical structure graph according to the agreed format.
[0048] In one embodiment, the Darwin brain-like computing chip architecture is as follows: The Darwin brain-like computing chip contains 576 computing cores, distributed in a 24×24 matrix. The on-chip network is a two-dimensional grid topology, and each node consists of an NPU (Neuromorphic Processing Unit) and a router. Each neural core can simulate 256 neurons through time division multiplexing. A single chip can support 150,000 neurons and tens of millions of neural synapses, and can support cascading and expansion of multiple chips. The chip transmits information through pulse data packets and communicates through the on-chip network and routers. A synaptic storage area is set in the neuron core to store the connection relationship between neurons, and pulses are sent to the corresponding subsequent neurons according to the connection.
[0049] like Figure 2 As shown, in one embodiment, the depth of the axon table of each node is 2 12 bit, the dendrite table depth is 2 12 bit. According to the presynaptic neuron, the corresponding axon is found in the axon table of the neuron node, and the neuron node connected to the neuron and the dendrite ID of the node are determined according to the axon. The dendrite ID of the neuron is indexed in the dendrite table to find the dendrite to which the neuron is connected, and the corresponding postsynaptic neuron list and the corresponding synaptic connection weight are found. The axon table stores the first-level connection, from the neuron to the node, and stores the corresponding node coordinates; the dendrite table stores the second-level connection, finds the corresponding neuron from the node, and stores the postsynaptic neuron number list and weight list. A chip node can simulate 256 neurons, so the number of neurons is greater than the number of nodes, that is, the memory requirement of the dendrite table is much greater than the memory requirement of the axon table.
[0050] In one embodiment, the specific network structure is as follows: Figure 3 As shown, the recurrent pulse neural network has 4 layers, Layer0 has 784 neurons, Layer1 has 1000 neurons, Layer2 has 100 neurons, and Layer3 has 10 neurons. The connection relationship is as follows Figure 3 shown.
[0051] In one embodiment, the network connection synapse file connection format is as follows Figure 4 As shown, a connection is represented by the four-tuple format [src, dst, weight, delay]. src is the number of the source neuron in the source neuron cluster; dst is the number of the destination neuron in the destination neuron cluster; weight is the weight of the synaptic connection between the source neuron and the destination neuron; delay is the pulse delay. In the embodiment, 0_to_1 has 391367 synaptic connections, 1_to_2 has 50031 synaptic connections, 2_to_1 has 49983 synaptic connections, and 2_to_3 has 493 synaptic connections. The entire network has a total of 1894 neurons and 491874 synapses.
[0052] The structure diagram of the compilation model for recurrent pulse neural network of the present invention is as follows: Figure 5 As shown, step 1 converts the network input by the user into a logical structure diagram to facilitate subsequent mapping. The logical structure diagram can express the connection relationship between each layer.
[0053] In step 2, the logical graph structure of the pulse neural network is topologically sorted to determine whether the network is a cyclic pulse neural network. If True is output, it is acyclic, and the network is compiled in reverse order according to the obtained topology; otherwise, False is output, and there is a cycle in the network, where there is a cycle between Layer 1 and Layer 2. The brain-like computing chip mapping method of the present invention is deployed. The specific process is as follows: Figure 6 shown.
[0054] In step 3, calculate the maximum number of synapses that a single node dendrite table can accommodate, given that DepthMemDendrite is 2 12 bit, BitWidthMemDendrite is 48 bits, BitWidthNeuronID is 12 bits, BitWidthWeight is 8 bits, and the calculation is
[0055]
[0056] In step 4, without considering the axon constraint, the number of neurons that the dendrite table can accommodate is used to calculate the number of neuron nodes allocated to each layer. The maximum number of synapses that the dendrite table can accommodate obtained by S3 is used to estimate the number of neurons, and then the precise calculation convergence is performed. The neurons of this layer are sequentially allocated to determine the number of nodes required for this layer and the number of neurons in each node, and the operation is performed layer by layer until the mapping of all nodes is completed. The number of neuron nodes required for each layer of the network is shown in Table 1 below, as well as the maximum number of neurons allocated to each layer of the network.
[0057] Table 1
[0058] Network Layer Number of nodes Maximum number of neurons in a node Layer0 4 256 Layer1 77 13 Layer2 10 11 Layer3 1 10
[0059] In step 5, further, after obtaining the preliminary configuration of the network nodes, we need to establish an axon table and check whether the axons meet the constraints. Substitute the formula to calculate the maximum number of neurons that the axon table of each layer can accommodate as shown in Table 2 below.
[0060] Table 2
[0061]
[0062]
[0063] It can be seen that there are nodes in Layer0 that cannot meet the axon constraint. The number of neurons of the four nodes configured in Layer0 according to the dendrite table constraint are 256, 256, 256, and 16 respectively. Among them, the first three nodes do not meet the axon table constraint and need to be split.
[0064] In step 6, taking node 0 as an example, the present invention adopts a greedy algorithm for splitting, that is, the number of neurons is modified to the maximum number of neurons that can be accommodated currently, 52, and the remaining 204 neurons generate new nodes and split again until all meet the axon constraint. Finally, neuron 0 is split into 5 nodes, with the number of neurons being 52, 52, 52, 52, and 48 respectively.
[0065] Layer0 is split from 4 nodes to 16 nodes. Since Layer0 does not have a presynaptic neuron layer, the split of Layer0 will not cause the NumNodePost all Increased, so there is no need to check the axon table constraints again.
[0066] In step 7, when all nodes meet the hardware constraints, node coordinates are assigned. The left side of the brain-like chip is the input and output port, and XY dimensional order routing is adopted. The node address index is limited to 16×16. The present invention adopts a greedy strategy, starting from the left side of 0-15, mapping the network layer by column, and selecting the coordinates with the smallest Manhattan distance and the previous layer of the network in turn. The sample mapping results are shown as follows: Figure 7 shown.
[0067] In step 8, according to the format requirements of the Darwin brain-like computing chip, the corresponding binary configuration file of the network is generated to complete the mapping of deploying the recurrent pulse neural network to the chip.
[0068] The embodiments described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A brain-like computing chip mapping method for recurrent spiking neural networks, characterized in that: The following steps are involved: S1, obtains the input of the recurrent spiking neural network and converts it into a logical graph structure that represents the information required for mapping; S2, calculate the maximum number of synapses that a single node dendrite table can accommodate; S3, without considering the axon table constraint, the neuron nodes are allocated according to the maximum number of synapses that the dendrite table of each layer of nodes can accommodate, combined with the input logical graph structure of the recurrent spiking neural network; S4, check the constraints of the axon table of each node layer by layer, if the constraints are not met, proceed to step S5, if the constraints are met, proceed to step S6; S5, using a greedy strategy to split the nodes that do not meet the axon table constraints, and returning to step S4 to check the axon table constraints of each node; S6, when all nodes meet the hardware constraints, node coordinates are assigned; S7, generates the configuration information of the binary chip and completes the mapping of deploying the recurrent pulse neural network onto the brain-like computing chip.
2. The method for mapping a brain-like computing chip for a recurrent spiking neural network according to claim 1, characterized in that: In step S2, the formula for calculating the maximum number of synapses that a single-node dendrite table can accommodate is as follows: Among them, DepthMemDendrite is the depth of the dendrite table, BitWidthMemDendrite is the bit width of a single row of the dendrite table, BitWidthNeuronID is the bit width of the neuron ID, and BiWidthWeight is the bit width of the weight, rounded down.
3. The method for mapping a brain-like computing chip for a recurrent spiking neural network according to claim 1, characterized in that: The specific process of step S3 is as follows: First, according to step S2, the maximum number of synapses that the dendrite table can accommodate is obtained to estimate the maximum number of neurons that the node can accommodate, and then the following formula is used for convergence: Among them, n is the number of dendrites of the node, that is, the number of presynaptic neurons of the node, NumNeuronPre, 1 means that each dendrite occupies a row in the dendrite table header, NumNeuronPost i is the number of postsynaptic neurons of the ith dendrite, SizeNeuronID is the number of neuron IDs that can be stored in a single-row dendrite table, SizeWeight is the number of weights that can be stored in a single-row dendrite table, and the number of rows occupied by the calculated neuron ID and weight are rounded up; The neurons of this layer are allocated in sequence to determine the number of nodes required for this layer, and the operation is performed layer by layer until the mapping of all nodes is completed.
4. The method for mapping a brain-like computing chip for a recurrent spiking neural network according to claim 1, characterized in that: In step S4, the axon table constraint check uses the following formula: m×(1+NumNodePost all )≤DepthMemAxon Among them, m is the number of neurons of the node, NumNodePost all is the number of all postsynaptic nodes in the network layer where the node is located, and DepthMemAxon is the depth of the axon table.
5. The method for mapping a brain-like computing chip for a recurrent spiking neural network according to claim 1, characterized in that: In step S5, when the node is split, the NumNodePost all If the neuron size increases, the axonal constraints of the presynaptic neuron layer of this layer need to be re-examined.
6. The method for mapping a brain-like computing chip for a recurrent spiking neural network according to claim 1, characterized in that: In step S6, a greedy strategy is used to allocate node coordinates so that the sum of the Manhattan distances of the nodes is as small as possible.
7. The method for mapping a brain-like computing chip for a recurrent spiking neural network according to claim 1, characterized in that: In step S7, a binary configuration file is generated according to the format requirements of the brain-like computing chip to complete the mapping of the recurrent pulse neural network to the chip.
