TL;DR
This paper introduces "Tomato," an automated framework for generating highly efficient CNN accelerators on FPGAs. By leveraging "hybrid quantization" (mixing different arithmetic types and precisions per layer) and a "flattened streaming" architecture, Tomato significantly reduces hardware resource usage and boosts performance, enabling complex models like MobileNet-V1 to run on a single FPGA with unprecedented speed.
What Problem Does This Paper Address?
Deep Convolutional Neural Networks (CNNs) are incredibly powerful for tasks like image recognition, but they are also computationally intensive. This makes deploying them on edge devices or in applications demanding low latency and high throughput a significant challenge. While GPUs offer parallelism, FPGAs are increasingly attractive for their reconfigurability and energy efficiency. However, designing custom FPGA accelerators for CNNs is complex and time-consuming. Existing approaches often use a single, large, homogeneous compute core that is time-shared across layers, which is inflexible and inefficient for the diverse computational needs of different CNN layers. Furthermore, standardizing on a single precision (like 32-bit floating-point) is infeasible on FPGAs due to resource constraints, and even uniform low-precision quantization can degrade accuracy. The paper aims to bridge this gap by automating the generation of efficient, specialized CNN accelerators on FPGAs that can handle varying precision and arithmetic requirements per layer.
Methods
The core of this work is the "Tomato" framework, which automates the co-design of CNN accelerators. Its key components include:
- Hybrid Quantization: Instead of a uniform precision for all layers, Tomato allows each convolution layer to use a mixture of different arithmetic types (shift-based for powers-of-2, and fixed-point) and varying bit precisions. This is achieved by first fine-tuning pre-trained CNNs in software to adapt their weights to these mixed precisions with minimal accuracy loss.
- Greedy Search Algorithm: To find the optimal quantization strategy for each layer under accuracy and hardware resource constraints, Tomato employs a greedy search. It iteratively modifies layer quantizations, evaluating their impact on hardware cost (LUTs, BRAMs, DSPs) and accuracy, aiming to minimize hardware usage while staying within an accuracy budget.
- Flattened Streaming Architecture: Unlike traditional homogeneous cores, Tomato generates a pipelined architecture where each convolution layer has its own dedicated, smaller compute engine. This "flattened streaming" approach maximizes FPGA logic utilization and allows for layer-specific optimizations.
- Throughput Matching and Roll-Unrolling: To ensure efficient data flow between layers, Tomato implements a throughput matching mechanism. This involves adjusting "unroll factors" (U and U') for input and output channels, effectively controlling the parallelism within each layer's compute engine. This technique minimizes stalls and idle circuits, further reducing hardware requirements.
- Automated Hardware Generation: The framework takes the optimized model configuration and generates SystemVerilog code for the FPGA implementation, which is then synthesized and routed.
Datasets
The paper evaluates its framework on three distinct datasets:
- ImageNet: Used for evaluating the MobileNet-V1 network.
- CIFAR-10: Used for evaluating the CifarNet network.
- Fashion MNIST: Used for evaluating a smaller, custom FashionNet network.
The authors note that ImageNet is a particularly challenging dataset, making the performance achieved on it a strong indicator of the framework's robustness.
Key Insights and Ideas
- Layer-wise Arithmetic is Key: The most significant insight is that CNN layers have different sensitivities to quantization. Allowing each layer to use its own optimal mix of arithmetic types and precisions (hybrid quantization) is far more effective than uniform quantization for both accuracy and efficiency.
- Flattened Streaming for FPGA Efficiency: Moving away from large, time-shared cores to smaller, dedicated compute engines per layer unlocks significant FPGA resource savings and allows for better pipeline utilization.
- Automated Co-Design is Feasible: The paper demonstrates that a full-stack approach, integrating software-based quantization optimization with automated hardware generation, can successfully produce high-performance accelerators without extensive manual effort.
- Throughput Matching is Crucial for Pipelining: Simply having separate compute units isn't enough; ensuring they can communicate efficiently by matching their throughputs is vital to avoid stalls and maximize overall performance.
Key Results
- MobileNet-V1 on Single FPGA: The framework successfully mapped a complete MobileNet-V1 network (over 4 million parameters) onto a single FPGA, a feat not achieved by previous methods without off-chip memory access.
- Performance Gains: The generated accelerators outperform closest FPGA-based competitors by 2-4x in latency and throughput.
- High Throughput: The MobileNet-V1 accelerator achieved over 3000 frames per second on ImageNet classification.
- High Utilization: The flattened streaming architecture achieved a compute unit utilization of around 84%.
- Resource Reduction: Hybrid quantization and the flattened streaming architecture significantly reduce model sizes and computation complexities.
- Scalability: The framework demonstrated scalability by partitioning MobileNet-V1 across two FPGAs, showing its potential for larger networks.
Limitations and Future Work
- Accuracy vs. Hardware Trade-off: While the framework aims to minimize accuracy loss, there's still a trade-off. The paper explores this trade-off extensively using a greedy search, but further research could explore more advanced optimization techniques.
- Fine-tuning Overhead: The fine-tuning step after quantization, while necessary for accuracy, adds to the overall workflow time.
- Future Work: The authors suggest exploring more complex CNN architectures and different hardware platforms. They also hint at the potential for further optimizations by investigating more aggressive quantization strategies and exploring dynamic precision scaling. The framework's ability to handle new convolution types is also a promising avenue for future development.
Summary updated