DOSA: Differentiable Model-Based One-Loop Search for DNN Accelerators

Charles Hong, Qijing Huang, Grace Dinh, Mahesh Subedar, Yakun Sophia Shao

TL;DR

This paper introduces DOSA, a novel approach to designing efficient Deep Neural Network (DNN) accelerators. By creating a differentiable performance model, DOSA enables a single-loop optimization process that simultaneously tunes hardware parameters and software mappings, achieving significant improvements in energy-delay product (EDP) compared to existing methods.

What Problem Does This Paper Address?

Designing efficient DNN accelerators is a complex challenge. It involves optimizing two vast and intertwined spaces: the hardware design space (e.g., interconnect topology, buffer sizes) and the mapspace (how applications are executed on the hardware, e.g., tiling, dataflow). Traditional methods often tackle these separately in a "two-loop" fashion, leading to a combinatorial explosion of possibilities and making it difficult to find optimal solutions. This paper aims to bridge this gap by developing a unified, efficient approach to explore both spaces simultaneously.

Methods

The core innovation of DOSA is its differentiable performance model. Instead of relying on expensive simulations for every design point, DOSA uses analytical models (inspired by Timeloop) that are mathematically expressed and can be optimized using gradient descent. This allows for a one-loop, mapping-first search strategy:

  • Mapping-First Approach: DOSA prioritizes finding optimal mappings for a given hardware configuration.
  • Differentiable Models: The performance (latency and energy) is modeled using differentiable functions, enabling gradient descent to efficiently navigate the design space.
  • Simultaneous Optimization: By optimizing the differentiable model, DOSA can adjust both mapping variables (like spatial and temporal tiling factors) and infer optimal hardware parameters in a single optimization loop.
  • Augmented Models: To improve accuracy for real hardware, DOSA also incorporates a learned DNN model that predicts the difference between the analytical model and actual hardware performance.

Datasets

  • Training Data: The paper mentions using data generated from Gemmini-RTL simulations (via FireSim) to train the DNN-augmented latency model. This dataset consisted of 1567 random mappings.
  • Evaluation Data: The authors evaluated their approach on various DNN workloads, including AlexNet, ResNeXt-50-32x4d, VGG-16, DeepBench, BERT, ResNet-50, RetinaNet, and U-Net. These workloads were used to test both the analytical model's accuracy against Timeloop and the overall DSE performance on Gemmini-TL and Gemmini-RTL.

Key Insights and Ideas

  • The Power of Differentiability: Making performance models differentiable is a game-changer for DSE. It unlocks the efficiency of gradient descent, allowing for much faster convergence and exploration of a larger design space compared to black-box methods.
  • One-Loop is Better Than Two: By unifying the hardware and mapping search into a single loop, DOSA avoids the combinatorial explosion inherent in two-loop approaches, leading to significantly better performance with fewer samples.
  • Analytical + Learned Models Synergy: Combining the interpretability and generalizability of analytical models with the accuracy of learned models (DNNs) for real hardware provides a robust and effective DSE solution. The learned component helps capture nuances missed by pure analytical models.
  • Mapping-First is a Viable Strategy: Contrary to some prior work, DOSA demonstrates that a mapping-first approach, when combined with differentiable models, can effectively drive hardware co-design.

Key Results

  • DSE Sample Efficiency: DOSA outperforms random search by 2.80x and Bayesian optimization by 12.59x in terms of improving DNN model energy-delay product (EDP) for a similar number of samples.
  • Real Hardware Improvement: DOSA achieved a 1.82x improvement in EDP on the Gemmini accelerator compared to hand-tuned configurations when using the DNN-augmented analytical model.
  • Hardware vs. Mapping Contributions: DOSA shows that its generated hardware designs are 3.21x better than start-point hardware designs (even with a constant mapper), and its mappings provide a 1.79x improvement over a state-of-the-art mapper (CoSA) on the same hardware.
  • Model Accuracy: The differentiable model's predictions are highly correlated with Timeloop, with EDP errors averaging 0.18%. The combined analytical and DNN model for Gemmini-RTL latency achieved a Spearman rank correlation of 0.92.

Limitations and Future Work

  • Loop Ordering: While the paper explores iterative and gradient-based loop ordering optimization, it notes that iterative optimization is computationally less demanding and slightly better for the experiments. Future work could explore more advanced gradient-based methods for loop ordering.
  • Pipeline Fusion: DOSA currently does not search the space of pipeline fused layers, which is a discrete optimization problem. This is identified as a limitation and a potential area for future research.
  • Generalization of DNN Models: The paper acknowledges that DNN models can struggle with generalization, especially with unseen weight sizes (as seen with U-Net). The DNN-augmented analytical model mitigates this by constraining outputs with the analytical model.
  • Discrete Design Decisions: While DOSA excels at optimizing continuous parameters like tiling factors, discrete hardware decisions (e.g., interconnect topology) are not directly optimized by gradient descent.
  • Future Work: The authors suggest that the modularity of DOSA allows for easy replacement and augmentation of performance models, paving the way for incorporating more complex objectives like area or power constraints, and exploring different optimization strategies.

Summary updated

BibTeX
@inproceedings{hong2023dosa,
  author = {Charles Hong and Qijing Huang and Grace Dinh and Mahesh Subedar and Yakun Sophia Shao},
  title = {{DOSA: Differentiable Model-Based One-Loop Search for DNN Accelerators}},
  booktitle = {MICRO},
  year = {2023},
  url = {https://openreview.net/forum?id=yN41D6oZMg},
}
Figure