{'fraction_non_alphanumeric': 0.03278384886090017, 'fraction_numerical': 0.00994011236648762, 'mean_word_length': 4.890181818181818, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Enabling Resource-Aware Mapping of Spiking Neural Networks via Spatial Decomposition

With growing model complexity, mapping Spiking Neural Network (SNN)-based applications to tile-based neuromorphic hardware is becoming increasingly challenging. This is because the synaptic storage resources on a tile, viz. a crossbar, can accommodate only a fixed number of pre-synaptic connections per post-synaptic neuron. For complex SNN models that have many pre-synaptic connections per neuron, some connections may need to be pruned after training to fit onto the tile resources, leading to a loss in model quality, e.g., accuracy. In this work, we propose a novel unrolling technique that decomposes a neuron function with many pre-synaptic connections into a sequence of homogeneous neural units, where each neural unit is a function computation node, with two pre-synaptic connections. This spatial decomposition technique significantly improves crossbar utilization and retains all pre-synaptic connections, resulting in no loss of the model quality derived from connection pruning. We integrate the proposed technique within an existing SNN mapping framework and evaluate it using machine learning applications on the DYNAP-SE state-of-the-art neuromorphic hardware. Our results demonstrate an average 60% lower crossbar requirement, 9x higher synapse utilization, 62% lower wasted energy on the hardware, and between 0.8% and 4.6% increase in model quality.


I. INTRODUCTION
S PIKING Neural Networks (SNNs) are machine learning approaches designed using spike-based computation and bio-inspired learning algorithms [1]. In an SNN, pre-synaptic neurons communicate information encoded in spike train to post-synaptic neurons, via the synapses (see Fig. 1). One of the key quality metrics in SNNs is the inter-spike interval (ISI) defined as the inverse of the mean firing rate of a neuron, which directly impacts model quality, e.g., accuracy. SNNs are executed on tile-based neuromorphic hardware such as DYNAP-SE [2]. A tile consists of a crossbar [3], which is illustrated in Fig. 2. At each crosspoint of a crossbar there is a synaptic element, which can be implemented using Non-Volatile Memory (NVM) [4]. Beside neuromorphic computing, NVMs such as Phase-Change Memory (PCM) are also used as main memory in conventional computers to improve performance and energy efficiency [5]- [8].
Within each crossbar, synaptic weights between pre-and postsynaptic neurons are programmed as conductance of NVM cells. A pre-synaptic neuron's voltage (applied on a row) is multiplied by the conductance to generate current (according to Ohm's Law). Current summation occurs on each column according to Kirchoff's Current Law, when integrating excitation from its pre-synaptic neurons. A neuron circuit takes as its input this current and generates at its output a train of spikes. A spike is generated only if the current is higher than a threshold. The spike firing frequency increases with input current, saturating at a frequency determined by the refractory period of the neuron. A n × n crossbar in a tile can accommodate only n presynaptic connections per post-synaptic neuron (n = 128 for the crossbars in DYNAP-SE). Fig. 3 reports the number of neurons with more than 128 pre-synaptic connections, i.e., fanins as a fraction of the total number of neurons in a few standard machine learning models, which are pruned iteratively to eliminate the near-zero weights without loss in accuracy [9] (see our design framework in Fig. 4 We observe that, even after model pruning, on average 2.6% of neurons in these models cannot be mapped to the crossbars in DYNAP-SE. There are two currently-used solutions to this problem -1) implement larger crossbars, which increases the power consumption exponentially, and 2) remove synaptic connections, which reduces the model quality.
Instead, we propose an unrolling technique which decomposes each neuron having many pre-synaptic inputs or fanin into a sequence of homogeneous neural units, where each neural unit is a function computation node having a maximum fanin-of-two (or FIT). Our technique ensures information integrity as well as the quality of these unrolled machine learning models. Furthermore, the unrolling technique allows denser packing of the homogeneous neural units per crossbar, significantly improving the crossbar utilization. We evaluate our technique using standard machine learning applications and demonstrate an average 60% lower resource usage and 62% lower wasted energy. The proposed spatial decomposition technique retains all pre-synaptic connections for each neuron in an SNN, improving model quality between 0.8% and 4.6% compared to an existing SNN mapping approach. Fig. 4 illustrates the integration of the proposed technique (shown in the two colored boxes) inside an existing design flow SpiNeMap [10] for mapping SNNs to the hardware. 1 This design flow incorporates 1) Artificial Neural Network (ANN) models written in PyTorch [22] and Tensorflow [23], and 2) SNN models written in PyCARL [24] and Brian [25]. For ANN models, analog operations are first converted to spike-based operations using the ANN2SNN converter [26]. These models are first pruned to eliminate near-zero weights [9]. This is to keep the model size small for embedded platforms. The pruned models are then presented to the proposed unrolling technique, which compiles these models to crossbar-based hardware.  Our proposed technique works in two steps -1) the unrolling step, which decomposes the SNN to limit the number of pre-synaptic connections for each neuron, and 2) the weight normalization step, which ensures the quality of the decomposed model. The latter is then clustered and mapped to the neuromorphic hardware using SpiNeMap [10].

A. Spatial Decomposition using Model Unrolling
We propose an unrolling approach, which decomposes a neuron function computation with many fanins into a sequence of homogeneous neural units, where each neural unit is a computation node with a maximum fanin-of-two (FIT). Fig. 5 illustrates the decomposition () of the neuron function shown in . Here, one m-input neuron function is decomposed into (m − 1) two-input neural units connected in sequence. The neuron where f represents the neuron functionality of generating spike trains with a mean firing rate proportional to its input excitation, n 1 , n 2 , · · · , nm are the m pre-synaptic neurons of the post-synaptic neuron no, and w 1 , w 2 , · · · , wm are the corresponding synaptic weights. The total number of FIT neural units generated from a neural network with N neurons

B. Weight Normalization
We apply weight normalization to optimize the synaptic weights w i of the unrolled model (Fig. 5) such that the firing rate of a neuron in this model is proportional to its input activation in the original model (Fig. 5). The weight normalization is performed for each decomposed neural unit and the weight normalization factor is applied to all its presynaptic weights. Using Fig 5, the weight updates are The normalization factor is computed as the maximum activation on the corresponding synaptic weight in the original model using a batch from the training set, i.e., where a i is the activation on the synaptic weight w i in the original model and the scaling factor k is used to limit the mean firing rate of a neuron to lower energy consumption on the hardware [26]. The weight normalization overhead can be reduced by allowing non-uniform decomposition of neuron functions. This is part of our future exploration.

C. Motivating Example
Fig. 6 provides a motivating example demonstrating 1) how the proposed technique results in a difference in the SNN mapping to hardware when compared to SpiNeMap and 2) the improvements in model quality.
This example illustrates the mapping of three neuron functions y 1 , y 2 and y 3 , shown in to a neuromorphic hardware consisting of 4 × 4 crossbars. SpiNeMap and other similar techniques will use three crossbars to implement the three functions, as shown in . Since a crossbar can accommodate only a limited number of pre-synaptic connections per output neuron (4 in this example), the component x 6 · wg of neuron function y 2 cannot be mapped to the crossbar. This may result in a degradation of the model quality.
In the proposed technique, neuron functions y 2 , with fanin of 5 and y 3 , with fanin of 4 are decomposed to generate homogeneous neural computation units u 1 , u 2 , · · · , u 7 as shown in . The neuron function y 1 is not decomposed because the proposed technique unrolls only those neuron functions that have fanin greater than 2. During packing of these units to a crossbar with a limited number of input ports, some of the decomposed units may need to be combined to generate larger units. In this example, the new computations are represented using functions fa, f b , fc & f d , where fa and fc can be implemented on the first crossbar alongside y 1 , while f b (y 2 ) and f d (y 3 ) are implemented on a second cluster (). Finally, the two generated clusters are shown in .
We make the following three key observations. First, the proposed technique only uses two crossbars to implement the three neuron functionalities y 1 , y 2 and y 3 , one less than that used by SpiNeMap. This reduces hardware requirement and improves energy consumption. Second, it does not eliminate any component of the neuron functionality, which improves the model quality. Third, it increases the crossbar utilization.

A. Evaluation Methodology
We evaluated 10 machine learning applications that are representative of the three most commonly used neural network classes -convolutional neural network (CNN), multi-layer perceptron (MLP), and recurrent neural network (RNN). Table I summarizes the original models and their baseline accuracy, which is assessed from the inter-spike interval [10]. We evaluated these applications on the DYNAP-SE neuromorphic hardware [2], where each tile has one 128×128 crossbar. Table II reports the hardware parameters of DYNAP-SE.  First, on average, the proposed technique requires 60% fewer crossbars than SpiNeMap to execute these applications. This reduction is because the unrolling technique allows to densely pack the fanin synapses of different neurons into the same crossbar, reducing the overall crossbar count. This reduces the hardware energy consumption. Second, the number of crossbars required in the proposed technique is 10x lower than SpiNeMap for EdgeDet, even though EdgeDet has no neurons with more than 128 fanin synapses. This is because many neurons in EdgeDet have fanin close to the maximum limit that a crossbar in DYNAP-SE can accommodate. Therefore, these high-fanin neurons cannot be packed in the same crossbar by SpiNeMap, needing a separate crossbar for each of these neurons. The proposed technique, on the other hand, unrolls a high-fanin neuron to create a structure with a maximum-fanin-of-two. This results in a denser packing of crossbars and a correspondingly lower crossbar requirement. Third, for CNN-based applications (LeNet, AlexNet, VGG16, and HeartClass), the proposed technique requires 37% fewer crossbars than SpiNeMap. We observe that the reduction over SpiNeMap is higher for networks with more layers; the reduction is 16% for LeNet, compared to 48% for VGG16. This is because, with more layers, the proposed technique has more freedom to improve crossbar utilization (see Sec. III-C). Finally, for RNN-based applications (HeartEstm, VisualPursuit, and DigitRecogSTDP), the proposed approach requires 80% fewer crossbars than SpiNeMap. This is due to the cyclic nature of connections between neurons in these applications. SpiNeMap cannot optimally pack neurons in cyclic connections to the crossbars. The proposed technique decomposes a cyclic connection to pack its neurons densely into crossbars, reducing the crossbar requirement.  Figures 8 and 9 compare respectively, the neuron and synapse utilization of SpiNeMap and the proposed technique on DYNAP-SE for each evaluated application. We observe that the average neuron utilization of SpiNeMap is 53% and of the proposed technique is 62% for these applications. The average synapse utilization of SpiNeMap is only 9% and of the proposed technique is 25% for these applications. The reason for the high crossbar utilization is because of the proposed spatial decomposition technique, which allows to densely pack fanin and fanout synapses from different neurons in the same crossbar, improving utilization. Higher utilization leads to lower wasted energy as reported next. Figure 10 reports the energy wasted for each evaluated application on DYNAP-SE using the proposed technique, normalized to SpiNeMap. The wasted energy incorporates the neurons and synapses in each crossbar that are not utilized during the execution of these applications. We observe that the energy wasted using the proposed technique is on average 62% lower than SpiNeMap. This significant reduction is due to 1) the reduction in the use of crossbars and 2) the increase in the utilization of neurons and synapses in each crossbar.  Figure 11 plots the model quality i.e., the accuracy of each evaluated application on DYNAP-SE using SpiNeMap and the proposed technique. For comparison, the quality using software simulation is also reported in the figure as Baseline. We make the following two key observations. First, the accuracy loss for some applications such as ImgSmooth, EdgeDet, HeartEstm, and VisualPursuit are the same for SpiNeMap and the proposed technique. This is because no neuron in these applications has more than 128 fanin synapses (see Fig. 3) and therefore, no pre-synaptic connections are eliminated by SpiNeMap. So, the quality of the two techniques are the same. However, for these applications, the proposed technique is significantly better than SpiNeMap in terms of crossbar usage, their utilization, and the wasted energy. Second, for all other applications that do not initially fit on the available crossbar space, the quality of the proposed technique is better than SpiNeMap by average 3% (between 0.8% and 4.6%). For these applications, the proposed technique is better in terms of all the evaluated metrics.

IV. DISCUSSION
We note that, the decomposition technique proposed here negatively impacts accuracy and energy in following two aspects. First, by decomposing a large neuron function, the proposed technique maps some of the decomposed synaptic connections on the shared interconnect of a neuromorphic hardware, negatively impacting spike latency. This can lower the model accuracy. However, the SpiNeMap framework, which integrates the decomposition technique minimizes such impact by intelligent cluster mapping and placement on the hardware [10]. Furthermore, by not eliminating any synaptic connections, the proposed technique, in fact, improves accuracy compared to SpiNeMap (see Sec. III-E). Second, with additional synapses mapped to the shared interconnect, the energy consumption on the interconnect increases. However, we find this increase in energy is much lower than the energy savings obtained by reducing the crossbar usage (see Sec. III-D).

V. CONCLUSION
We present a technique to map SNN-based applications to crossbar-based neuromorphic hardware. The proposed technique involves unrolling of neurons, which decomposes a complex neuron functionality into a sequence of homogeneous neural units, where each neural unit is a fanin-of-two (FIT) neuron. The unrolling technique significantly improves crossbar utilization and ensures information integrity, resulting in no loss of model quality derived from connection pruning. We integrate this unrolling technique inside an existing SNN mapping framework and evaluate it using machine learning applications for a state-of-the-art neuromorphic hardware. Our results demonstrate an average 60% lower crossbar requirement, 9x higher synapse utilization, 62% lower wasted energy, and 3% increase in model quality compared to an existing SNN mapping approach. In the future, we will explore the trade-offs involved in non-uniform tree decomposition of neural function.