Accurate Models of NVIDIA Tensor Cores
Faizan A. Khattak, Mantas Mikaitis
TL;DR
This work tackles the lack of reproducible numerical behavior in mixed-precision NVIDIA tensor cores by developing MATLAB-based, hardware-validated models across V100, A100, A2/A30, L40S, H100/H200, and B200 GPUs. It introduces Generalised Numerical Feature Testing (GNFT) and Input Space Search Method (ISSM) to identify and refine the inner-product behavior, yielding accurate, configurable tensor-core models validated against hardware with randomized testing. The resulting MATLAB Tensor Core v0.2 toolbox enables researchers to reproduce, analyze, and experiment with tensor-core arithmetic, including a customizable model for user-defined variants and multi-word high-precision GEMM emulation. The work has practical impact for numerical analysis, cross-platform comparisons, and standardization efforts by providing transparent, testable models that align with hardware specifics.
Abstract
Matrix multiplication is a fundamental operation in for both training of neural networks and inference. To accelerate matrix multiplication, Graphical Processing Units (GPUs) provide it implemented in hardware. Due to the increased throughput over the software-based matrix multiplication, the multipliers are increasingly used outside of AI, to accelerate various applications in scientific computing. However, matrix multipliers targeted at AI are at present not compliant with IEEE 754 floating-point arithmetic behaviour, with different vendors offering different numerical features. This leads to non-reproducible results across different generations of GPU architectures, at the matrix multiply-accumulate instruction level. To study numerical characteristics of matrix multipliers-such as rounding behaviour, accumulator width, normalization points, extra carry bits, and others-test vectors are typically constructed. Yet, these vectors may or may not distinguish between different hardware models, and due to limited hardware availability, their reliability across many different platforms remains largely untested. We present software models for emulating the inner product behavior of low- and mixed-precision matrix multipliers in the V100, A100, H100 and B200 data center GPUs in most supported input formats of interest to mixed-precision algorithm developers: 8-, 16-, and 19-bit floating point.
