Towards Scalable GPU-Accelerated SNN Training via Temporal Fusion

Yanchen Li, Jiachun Li, Kebin Sun, Luziwei Leng, Ran Cheng

Abstract

Drawing on the intricate structures of the brain, Spiking Neural Networks (SNNs) emerge as a transformative development in artificial intelligence, closely emulating the complex dynamics of biological neural networks. While SNNs show promising efficiency on specialized sparse-computational hardware, their practical training often relies on conventional GPUs. This reliance frequently leads to extended computation times when contrasted with traditional Artificial Neural Networks (ANNs), presenting significant hurdles for advancing SNN research. To navigate this challenge, we present a novel temporal fusion method, specifically designed to expedite the propagation dynamics of SNNs on GPU platforms, which serves as an enhancement to the current significant approaches for handling deep learning tasks with SNNs. This method underwent thorough validation through extensive experiments in both authentic training scenarios and idealized conditions, confirming its efficacy and adaptability for single and multi-GPU systems. Benchmarked against various existing SNN libraries/implementations, our method achieved accelerations ranging from $5\times$ to $40\times$ on NVIDIA A100 GPUs. Publicly available experimental codes can be found at https://github.com/EMI-Group/snn-temporal-fusion.

Introduction

Spiking Neural Networks (SNNs) are often hailed as the "third generation" of neural networks. By mimicking the discrete, time-dependent pulses (spikes) of the human brain, they promise extreme energy efficiency, especially on specialized neuromorphic hardware. However, the lack of widespread access to neuromorphic chips means most researchers rely on GPUs for training.

The primary bottleneck in GPU-based SNN training is the inherent temporal dimension. Unlike traditional Artificial Neural Networks (ANNs) that process data in a single pass, SNNs require tracking a neuron's "membrane potential" over many discrete time steps. In standard frameworks like PyTorch, this often results in a sequential loop over time, forcing the GPU to repeatedly read and write states to global memory. This "memory wall" makes SNN training significantly slower than equivalent ANNs, despite the simplicity of the underlying Leaky-Integrate-and-Fire (LIF) dynamics.

Temporal Fusion Methodology

To address this bottleneck, we propose Temporal Fusion, a computational optimization that processes all time steps of a neuron within a single, fused CUDA kernel.

Operator Fusion and Neuron Autonomy

The core innovation lies in recognizing neuron autonomy: spiking neurons within the same layer do not need to communicate with their neighbors during the temporal loop. This independence allows the method to "fuse" the temporal axis. A single custom CUDA kernel is launched where each GPU thread handles the entire temporal history of an individual neuron. By keeping the membrane potential state in fast, on-chip registers or L1 cache throughout the simulation window, the method avoids costly global memory swaps.

Illustration of Temporal Fusion for single and multi-GPU systems.

Multi-GPU Pipeline Parallelism

The architecture extends to multi-GPU setups by distributing temporal segments across GPUs rather than relying solely on batch-based parallelism. This allows for handling larger temporal windows that would exceed a single GPU's memory capacity.

Gradient Calculation

Importantly, temporal fusion is not an approximation; it maintains mathematical identity with standard SNN training. The backpropagation process is also fused, allowing for efficient gradient flow through the temporal steps within the same kernel.

Gradient flow and backpropagation dynamics within the fused temporal layers.

Experimental Evaluation

The method was validated across static image datasets (MNIST, CIFAR-10) and natively temporal neuromorphic datasets (N-MNIST, DvsGesture).

Key Results

Benchmarks on NVIDIA A100 GPUs against libraries like SpikingJelly and snnTorch revealed:

  • Significant Acceleration: Speedups ranging from 5× to 40×. A controlled test of a single LIF layer with 1 million neurons achieved a 41.22× speedup.
  • Accuracy Parity: The fused method maintained identical accuracy levels to non-fused baselines across all datasets.
  • Scalability: Speedup increases as the number of time steps grows, as more memory trips are saved. Multi-GPU pipelines showed near-linear scaling.

Conclusion and Future Work

Temporal fusion effectively bridges the performance gap for SNN training on conventional hardware. Future research will focus on extending this to multi-node clusters, accommodating more complex biological neuron models beyond LIF, and optimizing the data hand-off in hybrid SNN-ANN architectures.

Summary updated

Abstract

Drawing on the intricate structures of the brain, Spiking Neural Networks (SNNs) emerge as a transformative development in artificial intelligence, closely emulating the complex dynamics of biological neural networks. While SNNs show promising efficiency on specialized sparse-computational hardware, their practical training often relies on conventional GPUs. This reliance frequently leads to extended computation times when contrasted with traditional Artificial Neural Networks (ANNs), presenting significant hurdles for advancing SNN research. To navigate this challenge, we present a novel temporal fusion method, specifically designed to expedite the propagation dynamics of SNNs on GPU platforms, which serves as an enhancement to the current significant approaches for handling deep learning tasks with SNNs. This method underwent thorough validation through extensive experiments in both authentic training scenarios and idealized conditions, confirming its efficacy and adaptability for single and multi-GPU systems. Benchmarked against various existing SNN libraries/implementations, our method achieved accelerations ranging from $5\times$ to $40\times$ on NVIDIA A100 GPUs. Publicly available experimental codes can be found at https://github.com/EMI-Group/snn-temporal-fusion.
BibTeX
@misc{li2024towards,
  author = {Yanchen Li and Jiachun Li and Kebin Sun and Luziwei Leng and Ran Cheng},
  title = {{Towards Scalable GPU-Accelerated SNN Training via Temporal Fusion}},
  year = {2024},
  eprint = {2408.00280},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.00280},
}
Figure