Gemmini: Enabling Systematic Deep-Learning Architecture Evaluation via Full-Stack Integration

Hasan Genc, Seah Kim, Alon Amid, Ameer Haj-Ali, Vighnesh Iyer, Pranav Prakash, Jerry Zhao, Daniel Grubb, Harrison Liew, Howard Mao, Albert J. Ou, Colin Schmidt, Samuel Steffl, John Charles Wright, Ion Stoica, Jonathan Ragan-Kelley, Krste Asanovic, Borivoje Nikolic, Yakun Sophia Shao

Introduction

Gemmini is an open-source, full-stack Deep Neural Network (DNN) accelerator generator designed to bridge the gap between isolated hardware design and real-world system performance. Unlike many research accelerators that focus solely on peak compute metrics, Gemmini provides a flexible architectural template integrated into a complete System-on-Chip (SoC) environment. By including a full software stack and support for features like virtual memory and RISC-V integration, it enables researchers to evaluate deep-learning hardware within the context of operating system overheads and shared resource contention.

The "System Tax" in Deep Learning

A significant challenge in modern deep-learning acceleration is the "system tax"—the performance overhead incurred by data movement, OS context switches, and virtual-to-physical address translation. Research indicates that modern DL workloads can spend up to 77% of their execution time on the host CPU rather than the accelerator due to programming inefficiencies or unoptimized data movement. Most existing hardware generators lack the necessary software stack or SoC integration to measure these effects, leading to optimistic performance reports that don't translate to production environments.

A Full-Stack Approach

Gemmini addresses these issues through a three-pillared approach: hardware flexibility, software usability, and robust SoC integration.

Figure 1: Gemmini SoC integration within the Chipyard ecosystem, featuring a RISC-V CPU, shared L2 cache, and the Gemmini accelerator with its local TLB and DMA engine.

Hardware Template

The Gemmini hardware is a highly parameterizable spatial array generator. It utilizes a two-level hierarchy consisting of tiles connected via pipeline registers and Processing Elements (PEs) within those tiles connected combinationally. This design allows Gemmini to emulate various architectures, from systolic arrays like Google’s TPU to parallel vector engines like NVIDIA’s NVDLA.

Figure 2: The hierarchical hardware template of Gemmini, showing the spatial array composed of tiles, which in turn contain processing elements (PEs).

Software Stack

To support diverse user needs, Gemmini offers a multi-level programming interface. High-level users can utilize a "push-button" flow to convert ONNX models directly into binaries. For those requiring fine-grained control, C/C++ APIs are available to manually tune loop tiling and data movement.

SoC Integration

Integrated into the Chipyard ecosystem, Gemmini can be paired with RISC-V cores such as the in-order Rocket or out-of-order BOOM. A standout feature is its Local TLB, which provides virtual memory support. This allows the accelerator to operate directly on virtual addresses, a capability rarely found in open-source generators but essential for modern OS-managed systems.

Key Insights and Evaluation

The authors evaluated Gemmini using popular DNN benchmarks, including CNNs (ResNet50, AlexNet, SqueezeNet, MobileNetV2) and language models (BERT). Testing was conducted using FireSim for cycle-exact simulation and commercial ASIC synthesis flows (Intel 22nm FFL).

Several critical insights emerged from this evaluation:

  • The "im2col" Bottleneck: Performing image-to-column transformations on the CPU can severely limit performance. Gemmini includes a dedicated hardware unit for on-the-fly im2col, making total performance less dependent on the host CPU's power.
  • Virtual Memory Locality: DNNs exhibit high page locality, with 87% of consecutive TLB requests hitting the same page. Gemmini uses "filter registers" to cache the last TLB hit, reducing hit latency to zero cycles with minimal area cost.
  • Memory Partitioning: In multi-core systems, increasing the shared L2 cache is often more effective for memory-bound layers (like residual additions) than simply increasing private scratchpad memory.
  • Area Distribution: Synthesis results show that SRAM (scratchpads and accumulators) consumes 67% of the area, while the compute array takes only 11%, highlighting that memory management is the primary design challenge.

Performance Results

Gemmini demonstrates significant performance gains over traditional CPU execution:

  • ResNet50: Achieved up to a 2,670x speedup over an in-order Rocket CPU, reaching 22.8 FPS at 1 GHz.
  • BERT: Provided a 144x improvement over the CPU baseline.
  • Architectural Flexibility: The generator can produce a high-frequency TPU-like systolic array (1.89 GHz) or a more area-efficient NVDLA-like vector engine (1.8x smaller), allowing for extensive PPA (Power-Performance-Area) exploration.

Limitations and Future Work

While Gemmini is highly effective for dense computations, it faces challenges with depthwise convolutions (as seen in MobileNetV2) due to low data reuse. Future work aims to incorporate hardware support for sparsity in weights and activations to improve efficiency. Additionally, the team is exploring automated hardware-software co-tuning, such as using reinforcement learning to optimize tile sizes, to further enhance the generator's utility for non-expert users.

Summary updated

BibTeX
@inproceedings{genc2021gemmini,
  author = {Hasan Genc and Seah Kim and Alon Amid and Ameer Haj-Ali and Vighnesh Iyer and Pranav Prakash and Jerry Zhao and Daniel Grubb and Harrison Liew and Howard Mao and Albert J. Ou and Colin Schmidt and Samuel Steffl and John Charles Wright and Ion Stoica and Jonathan Ragan-Kelley and Krste Asanovic and Borivoje Nikolic and Yakun Sophia Shao},
  title = {{Gemmini: Enabling Systematic Deep-Learning Architecture Evaluation via Full-Stack Integration}},
  booktitle = {DAC},
  year = {2021},
  doi = {10.1109/dac18074.2021.9586216},
}
Figure