[Paper Review] CodeX: Bit-Flexible Encoding for Streaming-based FPGA Acceleration of DNNs
CodeX introduces a bit-flexible, nonlinear encoding framework for streaming-based FPGA acceleration of DNNs, enabling on-chip execution of encoded activations via hardware-optimized streaming buffers and a reinforcement learning-inspired bitwidth auto-tuning algorithm. It achieves 4.65× higher throughput than weight-only encoding and 3.6× and 2.54× improvements in throughput and performance-per-watt over full-precision DNN accelerators on ImageNet.
This paper proposes CodeX, an end-to-end framework that facilitates encoding, bitwidth customization, fine-tuning, and implementation of neural networks on FPGA platforms. CodeX incorporates nonlinear encoding to the computation flow of neural networks to save memory. The encoded features demand significantly lower storage compared to the raw full-precision activation values; therefore, the execution flow of CodeX hardware engine is completely performed within the FPGA using on-chip streaming buffers with no access to the off-chip DRAM. We further propose a fully-automated algorithm inspired by reinforcement learning which determines the customized encoding bitwidth across network layers. CodeX full-stack framework comprises of a compiler which takes a high-level Python description of an arbitrary neural network architecture. The compiler then instantiates the corresponding elements from CodeX Hardware library for FPGA implementation. Proof-of-concept evaluations on MNIST, SVHN, and CIFAR-10 datasets demonstrate an average of 4.65x throughput improvement compared to stand-alone weight encoding. We further compare CodeX with six existing full-precision DNN accelerators on ImageNet, showing an average of 3.6x and 2.54x improvement in throughput and performance-per-watt, respectively.
Motivation & Objective
- Address the high memory footprint of DNN activations in FPGA-based accelerators, which limits on-chip streaming execution and increases off-chip DRAM access.
- Overcome the challenge of training non-differentiable nonlinearly encoded DNNs by developing gradient approximation routines for fine-tuning.
- Automate per-layer encoding bitwidth selection to minimize accuracy loss while maximizing memory savings, avoiding manual, sub-optimal tuning.
- Provide a high-level, open-source API for rapid FPGA hardware generation from PyTorch models, reducing non-recurring engineering costs.
- Enable end-to-end, bit-flexible hardware acceleration of encoded DNNs using on-chip streaming buffers to eliminate off-chip memory access.
Proposed method
- Introduces online, nonlinear encoding of DNN activations to drastically reduce memory footprint, enabling full on-chip streaming execution without off-chip DRAM access.
- Develops a differentiable approximation of gradients for non-differentiable encoding functions to allow end-to-end backpropagation and fine-tuning of encoded DNNs.
- Employs a reinforcement learning-inspired algorithm with state-action-reward formulation to automatically select optimal per-layer encoding bitwidths balancing accuracy and memory savings.
- Designs a hardware library with bit-flexible, streaming-aware computational units (MVAUs) that support variable-precision fixed-point arithmetic and on-chip buffering.
- Builds a high-level compiler API that translates high-level PyTorch-style DNN descriptions into Vivado HLS-compatible C++ code for FPGA implementation.
- Uses a streaming dataflow architecture where intermediate features are encoded on-the-fly and streamed between layers using on-chip buffers, eliminating off-chip memory access.
Experimental results
Research questions
- RQ1How can nonlinear encoding of DNN activations be integrated into the training and inference pipeline to reduce memory footprint without sacrificing accuracy?
- RQ2What is an effective, automated method for determining the optimal encoding bitwidth per layer that balances model accuracy and memory savings?
- RQ3Can on-chip streaming execution of encoded DNNs be achieved without off-chip DRAM access, and what performance gains does it yield?
- RQ4How does the proposed reinforcement learning-based bitwidth selection strategy compare to hand-crafted or heuristic methods in terms of accuracy and efficiency?
- RQ5To what extent can a high-level, open-source API streamline FPGA deployment of encoded DNNs with minimal engineering overhead?
Key findings
- CodeX achieves an average of 4.65× higher throughput compared to stand-alone weight encoding on MNIST, SVHN, and CIFAR-10 datasets.
- On ImageNet, CodeX outperforms six existing full-precision DNN accelerators by 3.6× in throughput and 2.54× in performance-per-watt.
- The runtime overhead of encoding/decoding in the MVAU engine is negligible, with over 90% of cycles dedicated to VDP computation and less than 10% to encoding/decoding operations.
- The reinforcement learning-based bitwidth selection algorithm successfully identifies near-optimal configurations that minimize accuracy loss while maximizing memory reduction.
- The framework enables full on-chip execution of DNNs using only on-chip streaming buffers, eliminating off-chip DRAM access and reducing power and latency.
- The open-source API allows direct conversion of PyTorch-style DNN models into FPGA-optimized hardware code with minimal engineering effort.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.