TL;DR
This research introduces the Time-Based Roofline, an evolution of the classic performance model that incorporates total work (complexity) and execution time. By mapping these metrics into a unified 4D visualization, researchers can distinguish between frameworks with high throughput and those that are actually faster, identifying bottlenecks caused by algorithmic overhead or kernel launch latency.
What Problem Does This Paper Address?
In high-performance computing (HPC), the Roofline Model is the gold standard for identifying whether a program is limited by compute power or memory bandwidth. However, deep learning (DL) introduces two critical factors that the traditional model overlooks:
- Algorithmic Variability: Different DL frameworks (e.g., PyTorch vs. TensorFlow) may employ different algorithms to solve the same problem, such as Winograd vs. GEMM for convolutions. A framework might exhibit higher throughput (GFLOP/s) but perform significantly more total work, leading to longer overall run times.
- Kernel Overhead: DL models often consist of thousands of small operations. The time spent "launching" these kernels on a GPU can exceed the time spent on actual computation—a bottleneck the traditional model ignores.
The authors address these gaps by extending the Roofline to account for "how much work is done" and "how long it actually takes," moving beyond simple "engine speed" metrics.
Methods
The authors propose a 4D Complexity-Time Roofline. This model is implemented on a 2D log-log scale using two sets of symbols for every data point to represent the four dimensions:
- Closed Symbols (Complexity): Represent the total computational (GFLOPs) and bandwidth (GBytes) complexity, illustrating the "algorithmic footprint."
- Open Symbols (Time): Represent the "Compute Time" and "Bandwidth Time."
The visual distance between the closed and open symbols represents the performance gap; proximity to the "roof" indicates better hardware utilization. Additionally, the model incorporates a Kernel Launch Overhead Ceiling. By measuring the average latency of a GPU kernel launch (~4.2 $\mu$s on an NVIDIA V100), the authors identify "overhead-bound" regions where increasing workload (e.g., batch size) does not improve run time because the GPU is idling between tasks.
Datasets and Benchmarking
The study benchmarks fundamental DL building blocks across three frameworks—PyTorch, TensorFlow v1, and TensorFlow v2—on the Cori supercomputer using NVIDIA V100 GPUs. The primary kernels analyzed include:
- 2D Convolution (Conv2D): Specifically kernels used in ResNet50.
- Long Short-Term Memory (LSTM): Representing recurrent neural networks with complex dependencies and high kernel counts.
Key Insights and Ideas
- The Throughput Trap: A kernel may appear efficient on a traditional Roofline (high GFLOP/s) but be suboptimal if it achieves that speed through redundant work. The Time-Based Roofline exposes this by showing the "Complexity" symbol shifting further from the origin.
- LSTMs are Overhead-Bound: Unlike convolutions, which are typically compute-bound, LSTMs are often limited by kernel launch frequency. For LSTMs, run time is often independent of batch size at smaller scales because the GPU is bottlenecked by CPU-side kernel dispatch.
- Framework Efficiency: The model revealed that PyTorch likely utilizes efficient implicit type conversion. When switching from FP32 to FP16, PyTorch’s bandwidth complexity remained constant, whereas TensorFlow’s tripled, suggesting superior data movement management in PyTorch.
Key Results
- Overhead Quantification: The average kernel launch latency on a V100 is approximately 4.2 $\mu$s. For an LSTM forward pass, PyTorch required only 36 invocations, while TF1 and TF2 required 277 and 243, respectively.
- TF2's "Eigen" Problem: TensorFlow v2 showed significantly higher overhead in backward passes compared to v1. This was traced to the extensive use of Eigen functions, which increased kernel launch counts and overall latency.
- Algorithmic Shifts: In Conv2D backward passes, the model tracks frameworks as they switch algorithms based on filter counts. TF2 achieved the highest arithmetic intensity but, paradoxically, the longest run time in certain configurations due to higher complexity.
Limitations and Future Work
The current model focuses on single-node, single-GPU performance and does not yet account for multi-GPU communication overhead (e.g., NCCL/MPI), which is critical for distributed training. While it captures the output of graph compilers like XLA, it does not explicitly model the optimization process itself. Future work involves integrating this methodology into automated profiling tools like NVIDIA Nsight to provide developers with a unified view of performance bottlenecks.
Summary updated