Benanza: Automatic μBenchmark Generation to Compute "Lower-bound" Latency and Inform Optimizations of Deep Learning Models on GPUs

Cheng Li, Abdul Dakkak, Jinjun Xiong, Wen-Mei Hwu · DOI

Abstract

Optimizing deep learning (DL) models for GPUs is often hindered by a lack of clear performance baselines, a challenge termed the "characterization-optimization gap." This paper presents Benanza, an automated tool that generates micro-benchmarks for DL layers to compute the "lower-bound" latency—the theoretical ideal performance on a target GPU. By bypassing high-level frameworks and directly utilizing low-level libraries like cuDNN and cuBLAS, Benanza identifies inefficiencies in frameworks such as MXNet and PyTorch. Our evaluation across 30 ONNX models and 7 GPU generations shows that Benanza-informed optimizations can achieve speedups of up to 1.95x.

Introduction

Deep learning models are evolving at a breakneck pace, yet optimizing them for GPUs remains a manual, "black-box" process. While profilers like NVIDIA’s Nsight can show where time is spent, they do not indicate whether that time is necessary. This creates a characterization-optimization gap: researchers often guess which optimizations (like layer fusion or algorithm selection) will work without a systematic way to quantify the "ideal" performance of a model on a given hardware/software stack. Without a baseline of what is theoretically possible, it is difficult to determine if a framework is performing poorly or if the hardware has reached its physical limits.

The Benanza Framework

Benanza is a sustainable and extensible benchmarking suite designed to bridge this gap. It consists of four main components that automate the characterization process.

The Benanza system architecture, illustrating the workflow from ONNX model processing to performance analysis.

1. Model Processor

The Model Processor parses ONNX models and performs shape inference to identify the dimensions of every layer. A key observation driving Benanza is layer repeatability: DL models are highly repetitive. For example, the ResNet family contains over 1,200 layers, but only 60 are unique. By identifying unique layer configurations, Benanza significantly reduces the benchmarking search space.

2. Benchmark Generator and Performance Database

The Generator automatically produces C++ code to measure the latency of unique layers using direct calls to low-level libraries (cuDNN and cuBLAS). This approach bypasses the DL framework entirely, isolating the performance of the underlying kernels. Results are stored in a persistent Performance Database, allowing for reuse across different models and systems.

3. Analyzer

The Analyzer is the core of the system. It uses the model's execution graph and micro-benchmark data to compute the "lower-bound" latency in two modes:

  • Sequential: The sum of all individual layer latencies.
  • Parallel: The latency of the "critical path" (the longest path through the graph), assuming independent layers can execute simultaneously.
A model execution graph showing individual layer latencies and the identified critical path (red arrows) used to calculate lower-bound parallel latency.

Key Insights and Results

The study evaluated 30 ONNX vision models across 7 NVIDIA GPU generations (ranging from Kepler to Turing/Volta architectures).

Identifying Framework Inefficiencies

By comparing actual framework performance (MXNet, PyTorch) against the Benanza lower-bound, the authors identified significant overhead. For instance, PyTorch (v1.3) was found to introduce 100$\mu$s stalls between layers due to excessive synchronization calls—a major penalty for low-latency models. Similarly, a bug in the MXNet ONNX loader was found to add unnecessary padding layers; fixing this one-line error resulted in a 1.15x speedup for ResNet50.

Optimizing Kernel Selection

DL libraries like cuDNN use heuristics to select convolution algorithms, which Benanza found to be frequently sub-optimal. Manually selecting the fastest algorithm based on Benanza’s micro-benchmarks improved single-layer performance by up to 2.75x.

Cumulative Performance Gains

On average, the lower-bound analysis suggested models could be 1.14x faster by removing framework overhead and 1.32x faster through parallel execution. For ResNet50-v1 on a Tesla V100, combining parallel execution, optimal algorithm selection, layer fusion, and Tensor Core usage resulted in a total 1.95x speedup.

Conclusion

Benanza provides a systematic methodology for identifying and quantifying performance bottlenecks in deep learning deployments. By establishing a theoretical "speed limit" for hardware, it enables targeted optimizations that significantly outperform standard framework defaults. Future work includes extending support to non-NVIDIA hardware and incorporating memory-bound analysis to further refine the lower-bound estimates.

Summary updated

BibTeX
@inproceedings{li2019benanza,
  author = {Cheng Li and Abdul Dakkak and Jinjun Xiong and Wen-Mei Hwu},
  title = {{Benanza: Automatic μBenchmark Generation to Compute "Lower-bound" Latency and Inform Optimizations of Deep Learning Models on GPUs}},
  booktitle = {IPDPS},
  year = {2019},
  doi = {10.1109/ipdps47924.2020.00053},
}
Figure