Abstract
SIRA (Scaled-Integer Range Analysis) is a novel static analysis technique that leverages interval arithmetic to optimize FPGA-based neural network accelerators. By precisely tracking the range, scale, and bias of tensors within the QONNX representation, SIRA enables significant hardware savings—reducing DSP usage by 66% and LUTs by 17%—while shrinking accumulator bitwidths without any loss in accuracy.
Introduction: The "Layer Tail" Bottleneck
In the development of Quantized Neural Networks (QNNs), significant effort has been directed toward optimizing Multiply-Accumulate (MAC) operations. As these operations become increasingly efficient (often utilizing only 1 or 2 bits), the primary bottleneck shifts to the "layer tail." This component encompasses all operations following matrix multiplication, including scaling, bias addition, batch normalization, and activation functions. In highly quantized models, these non-MAC operations can account for up to 89% of total energy consumption.
Furthermore, hardware designers frequently over-provision resources, using 32-bit accumulators to avoid overflow, which wastes valuable FPGA fabric. SIRA addresses this by providing a formal, automated method to analyze these tails and minimize their hardware footprint.
Methods: Scaled-Integer Range Analysis
SIRA operates by treating every tensor as a scaled integer defined by the range $[q_{min}, q_{max}]$, a scale $s$, and a bias $b$. The framework utilizes several key techniques:
- Static Range Analysis: Using interval arithmetic, SIRA traverses the neural network graph in QONNX format to determine the absolute minimum and maximum possible values for every intermediate tensor.
- Accumulator Minimization: Rather than relying on generic datatype bounds, SIRA uses the specific weights of a trained model to calculate the exact bitwidth required to prevent overflow, ensuring a lossless optimization.
- Streamlining 2.0: SIRA formalizes the aggregation of multiple scales and biases into a single operation, improving upon previous heuristic-driven streamlining techniques.
- Thresholding via Binary Search: For low-bitwidth activations, the layer tail can be fused into a multi-threshold operation. SIRA introduces an efficient RTL kernel using binary search, making this viable even for higher-precision activations (up to 8 bits).
Key Insights and Optimization Strategies
A critical realization of SIRA is that standard 32-bit accumulators are often unnecessary; 12 to 18 bits are frequently sufficient for bit-accurate results. Shrinking these widths has a compounding effect on resource savings throughout the FPGA pipeline. Additionally, SIRA identifies "stuck channels"—neurons that output constant values—allowing them to be pruned entirely.
The framework also provides analytical models to help designers choose between "composite" implementations (separate Add/Mul/ReLU blocks) and "thresholding" implementations. Thresholding is generally superior for outputs under 4 bits, while composite blocks become more efficient as precision increases.
Experimental Results
SIRA was evaluated using the QONNX Model Zoo across various architectures, including MNIST (MLP), CIFAR-10 (VGG10), CIFAR-100 (ResNet-8), and ImageNet (MobileNet-v1). Integration into the FINN compiler yielded the following improvements:
- Resource Reduction: Average LUT usage decreased by 17%, and DSP usage was reduced by 66%.
- Accumulator Efficiency: Bitwidths were reduced by an average of 22% compared to standard bounds.
- Accuracy: These savings were achieved with zero impact on Top-1 accuracy.
- Latency: In specific workloads like TFC-w2a2, thresholding halved latency by reducing kernel instantiations.
Conclusion
SIRA provides a rigorous mathematical foundation for optimizing the "tails" of quantized neural networks on FPGAs. While currently limited to monotonic activation functions and per-channel scaling, future work aims to extend support to transformer architectures and per-group scaling. The open-sourcing of SIRA offers the community a powerful tool for more efficient FPGA-based AI deployment.
Summary updated