Recovering single precision accuracy from Tensor Cores while surpassing the FP32 theoretical peak performance

Hiroyuki Ootomo, Rio Yokota · DOI

Introduction

In high-performance computing (HPC), researchers often face a trade-off between speed and accuracy. NVIDIA’s Tensor Cores are specialized hardware units designed to accelerate matrix multiplications for deep learning, but they typically operate in lower-precision formats like FP16 or TF32. Scientific simulations, however, generally require single-precision (FP32) accuracy. Researchers from the Tokyo Institute of Technology have developed a novel method to perform matrix multiplications on Tensor Cores that matches standard FP32 accuracy while running up to 2.6x faster than the hardware's theoretical FP32 peak.

The Challenge: Speed vs. Precision

Tensor Cores are the high-speed engines of modern GPUs, but using them for FP32 workloads usually involves truncating data, leading to "mantissa loss" that compromises precision. Previous error-correction techniques, such as the Markidis method, attempted to bridge this gap by splitting FP32 numbers into multiple FP16 parts. However, these methods often failed to achieve true FP32 parity or introduced so much computational overhead that they were slower than standard FP32 units (SIMT cores).

Methodology: Bypassing Hardware Limitations

The researchers introduced three critical innovations to achieve true FP32 parity and high performance:

  1. Bypassing Internal Rounding: They identified that Tensor Cores use "Round toward Zero" (RZ) internally during accumulation, causing errors to accumulate. By performing the final accumulation outside the Tensor Core using standard FP32 units (which use "Round to Nearest"), they eliminated this source of error.
  2. Scaling to Prevent Underflow: To prevent the "low" part of split numbers from disappearing during the correction phase, the authors applied a scaling factor ($2^{11}$) to keep these bits within the hardware's readable range.
  3. Algorithmic Pruning: By mathematically proving that one of the four required correction terms was negligible, they reduced the Tensor Core workload by 25% without sacrificing accuracy.

This implementation was integrated into NVIDIA’s CUTLASS library and tested on Ampere-generation hardware (A100, RTX A6000, and RTX 3090).

Performance and Accuracy Results

The proposed method achieves bit-wise parity with standard single-precision cuBLAS SGEMM, a feat previous error-correction methods could not claim.

Relative residual comparison showing our method matching FP32 SIMT accuracy while other methods diverge as the matrix dimension k increases.

Beyond accuracy, the performance gains are significant. On an NVIDIA A100, where the theoretical peak for standard FP32 is 19.5 TFlop/s, the new method achieved 51 TFlop/s using FP16 Tensor Cores and 33 TFlop/s using TF32 Tensor Cores.

Performance comparison on NVIDIA A100 showing the proposed method significantly exceeding the theoretical FP32 peak and standard cuBLAS SGEMM.

Furthermore, the implementation proved more energy-efficient, reaching up to 121 GFlops/W compared to the 67 GFlops/W of standard FP32 units. This efficiency stems from the inherent architectural advantages of Tensor Cores over general-purpose SIMT cores.

Conclusion and Future Work

By cleverly managing rounding modes and pruning unnecessary calculations, this research demonstrates that "low-precision" hardware can be repurposed for rigorous scientific computing without compromising accuracy. While the current FP16-based method has a limited exponent range for extremely small values, the TF32 variant covers most standard FP32 use cases. Future research may focus on further optimizing register usage or applying similar techniques to recover Double Precision (FP64) accuracy from lower-precision hardware.

Summary updated

BibTeX
@article{ootomo2022recovering,
  author = {Hiroyuki Ootomo and Rio Yokota},
  title = {{Recovering single precision accuracy from Tensor Cores while surpassing the FP32 theoretical peak performance}},
  journal = {Int. J. High Perform. Comput. Appl.},
  year = {2022},
  doi = {10.1177/10943420221090256},
}
Figure