[Paper Review] 8 Steps to 3.7 TFLOP/s on NVIDIA V100 GPU: Roofline Analysis and Other Tricks
This paper presents eight optimization steps to achieve 3.7 TFLOP/s in double-precision performance on an NVIDIA V100 GPU using hierarchical Roofline analysis and Nsight Compute. By addressing high register usage, low occupancy, complex data access, and long-latency instructions—particularly through register limiting, loop reordering, cache blocking, and FMA ratio-aware tuning—it achieves 70% of a customized peak based on a 58% FMA ratio, demonstrating a practical framework for HPC kernel optimization.
Performance optimization can be a daunting task especially as the hardware architecture becomes more and more complex. This paper takes a kernel from the Materials Science code BerkeleyGW, and demonstrates a few performance analysis and optimization techniques. Despite challenges such as high register usage, low occupancy, complex data access patterns, and the existence of several long-latency instructions, we have achieved 3.7 TFLOP/s of double-precision performance on an NVIDIA V100 GPU, with 8 optimization steps. This is 55% of the theoretical peak, 6.7 TFLOP/s, at nominal frequency 1312 MHz, and 70% of the more customized peak based on our 58% FMA ratio, 5.3 TFLOP/s. An array of techniques used to analyze this OpenACC kernel and optimize its performance are shown, including the use of hierarchical Roofline performance model and the performance tool Nsight Compute. This kernel exhibits computational characteristics that are commonly seen in many high-performance computing (HPC) applications, and are expected to be very helpful to a general audience of HPC developers and computational scientists, as they pursue more performance on NVIDIA GPUs.
Motivation & Objective
- To address performance bottlenecks in a double-precision HPC kernel from the BerkeleyGW code running on NVIDIA V100 GPUs.
- To demonstrate a systematic, multi-step optimization process for scientific kernels facing high register pressure, complex memory access, and long-latency instructions.
- To validate the effectiveness of hierarchical Roofline analysis and Nsight Compute in identifying and resolving performance bottlenecks.
- To establish a realistic performance ceiling based on FMA ratio, improving upon theoretical peak estimates for double-precision workloads.
- To provide a transferable methodology applicable to other HPC applications with similar computational characteristics.
Proposed method
- Applying hierarchical Roofline analysis to identify performance bottlenecks related to arithmetic intensity and memory bandwidth.
- Using Nsight Compute to collect detailed performance metrics, including instruction-level statistics and cache hit rates.
- Reducing register usage via compiler flags (-Mcuda=maxregcount:128) or OpenACC clauses (vector_length(512)) to increase occupancy.
- Reordering loops to improve arithmetic intensity and better utilize the memory hierarchy.
- Implementing cache blocking (tiling) to enhance data reuse and improve L1/L2 cache hit rates.
- Replacing long-latency instructions (e.g., reciprocals) with shorter-latency alternatives to reduce instruction-level latency.
Experimental results
Research questions
- RQ1How can hierarchical Roofline analysis be effectively applied to identify performance bottlenecks in GPU kernels with complex data access and high-precision arithmetic?
- RQ2What impact does register pressure have on GPU occupancy and performance, and how can it be mitigated without excessive register spill penalties?
- RQ3To what extent can performance improvements be achieved through loop reordering and cache blocking in kernels with irregular memory access patterns?
- RQ4How does the FMA ratio influence the realistic performance ceiling of double-precision GPU kernels, and how can it be used to calibrate theoretical peak estimates?
- RQ5Can a combination of compiler-level tuning, algorithmic restructuring, and profiling tools like Nsight Compute consistently yield significant performance gains in real HPC workloads?
Key findings
- The optimized kernel achieved 3.7 TFLOP/s in double-precision performance on a single NVIDIA V100 GPU, representing a 3x speedup from the original 2.3 TFLOP/s.
- The final performance reached 55% of the theoretical FP64 peak (6.7 TFLOP/s) at 1312 MHz nominal frequency.
- The performance achieved 70% of a more realistic, FMA ratio-adjusted peak of 5.3 TFLOP/s, based on a measured 58% FMA ratio.
- Cache blocking and loop reordering significantly improved L1 and L2 cache hit rates, as confirmed by Nsight Compute profiling.
- Register limiting increased occupancy from 16 to 32 warps per SM, despite introducing register spills, which was outweighed by improved latency hiding.
- The combination of architectural awareness (e.g., FMA utilization) and iterative profiling with Nsight Compute proved essential for achieving high performance on complex scientific kernels.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.