TL;DR
This paper introduces a novel digital compute-in-memory (DCIM) architecture for FP8 computations that dynamically adjusts the precision of weights and inputs on-the-fly. This "shift-aware" approach balances accuracy and efficiency, achieving 2.8x higher FP8 efficiency than prior work on Llama-7b while maintaining accuracy.
What Problem Does This Paper Address?
The increasing size and complexity of large language models (LLMs) necessitate efficient hardware accelerators. Low-precision formats like FP8 are crucial for reducing computation and power consumption, offering a better dynamic range than integer formats for handling outliers. However, existing digital compute-in-memory (DCIM) architectures struggle with the diverse distributions of FP8 data. Different FP8 formats (e.g., E2M5, E3M4, E4M3, E5M2) have varying exponent and mantissa ranges, requiring flexible bitwidth support for both weights and inputs. Current DCIM designs either use a fixed, high bitwidth that wastes resources and reduces efficiency, or a fixed, low bitwidth that leads to significant accuracy loss due to truncation errors. This paper tackles the challenge of supporting variable FP8 aligned-mantissa bitwidths efficiently and accurately.
Methods
The authors propose a hardware-software co-designed FP8 DCIM accelerator with three key innovations:
- Dynamic Shift-aware Bitwidth Prediction (DSBP): This is the core of their approach. DSBP analyzes the distribution of exponent shifts for weights and inputs within a group (e.g., a column in the CIM array) and dynamically predicts the optimal aligned-mantissa bitwidth. It uses a weighted average based on the "shift" values, prioritizing elements that would cause greater accuracy loss if truncated. Configurable hyperparameters (k and Bfix) allow users to tune the trade-off between accuracy and efficiency.
- FIFO-based Input Alignment Unit (FIAU): To avoid the area and complexity overhead of traditional barrel shifters for mantissa alignment, the FIAU uses a pointer-based control mechanism. This significantly reduces area (21.7%) and power (34.1%) while offering greater flexibility for variable bitwidth support.
- Precision-Scalable INT MAC Array: The architecture employs a 2/4/6/8b weight and 2~12b input precision-scalable INT MAC array. This array is designed for efficient computation with flexible fusion paths, minimizing overhead for different precision configurations.
Datasets
The paper evaluates its approach using the following datasets:
- Llama-7b: Used for evaluating LLM inference accuracy and efficiency on the BoolQ and Winogrande datasets.
- ResNet50 on ImageNet: Used to demonstrate the generalization capability of the proposed method across different model architectures.
The paper does not introduce new benchmarks but rather uses existing ones to validate its FP8 DCIM architecture.
Key Insights and Ideas
- Dynamic Bitwidth Prediction is Key: The most significant insight is that a static, fixed bitwidth for FP8 computations in DCIM is inherently inefficient. Dynamically adjusting the bitwidth based on the actual data distribution (specifically, exponent shifts) allows for a much better balance between accuracy and energy efficiency.
- Exponent Shift as a Proxy for Importance: The DSBP algorithm cleverly uses the exponent shift value as a proxy for the "importance" of an element. Larger shifts indicate values that are further from the typical range, and their truncation has a more significant impact on accuracy.
- FIAU's Simplicity Wins: Replacing complex barrel shifters with a simple FIFO and pointer-based control for input alignment is a clever design choice that yields substantial area and power savings without sacrificing flexibility.
- Software-Hardware Co-design Pays Off: The integration of DSBP (software) with the hardware architecture (MPU, FIAU, MAC array) is crucial for achieving the reported performance gains.
Key Results
- 2.8x Higher FP8 Efficiency: The proposed DCIM macro achieves 20.4 TFLOPS/W for fixed E5M7 format, which is 2.8x higher than previous work ([15]) achieving 7.1 TFLOPS/W.
- Improved Efficiency with DSBP: On Llama-7b, the DSBP approach achieves higher energy efficiency than fixed bitwidth modes at the same accuracy level on both BoolQ and Winogrande datasets.
- Flexible FP8 Format Support: The architecture supports all FP8 formats (E2M5 to E5M2) with variable aligned-mantissa bitwidths.
- Area and Power Savings in FIAU: The FIFO-based input alignment unit (FIAU) achieves 21.7% area reduction and 34.1% power reduction compared to barrel shifters.
- Generalization: The approach shows good performance on ResNet50 on ImageNet, achieving 76.1% accuracy with the "Precise" configuration and 74.7% accuracy with 1.5x higher energy efficiency for the "Efficient" configuration.
Limitations and Future Work
- Hyperparameter Tuning: The DSBP algorithm relies on configurable hyperparameters (k and Bfix). While these allow for flexible trade-offs, finding the optimal values for different models and applications might require further exploration.
- Fixed Bitwidth Baseline: The paper compares its dynamic approach against fixed bitwidth configurations. While this highlights the benefits of DSBP, further analysis of the performance impact of different fixed bitwidth strategies could be beneficial.
- Future Work: The authors suggest that the effective software-hardware co-design demonstrated in this work can be extended to other low-precision formats and AI workloads. Further optimization of the fusion unit and exploration of more aggressive quantization techniques could also be future directions.
Summary updated