Skip to content

TensorRace: Verifying Data-Race Freedom of Modern GPU Kernels

Ganxiang Yang, Yi Rong, Wei Qiang, Ronghui Gu

cs.PL

Abstract

GPU kernels are the computational core of modern AI, yet a single data race can silently violate the integrity of training and inference. Formal verification promises data-race freedom, but no existing automated verifier handles asynchronous operations across general kernel inputs. We present TensorRace, the first automated framework to verify data-race freedom of modern GPU kernels. TensorRace builds a happens-before graph of the kernel to capture both synchronous and asynchronous operations as nodes and their orderings as edges. To build the graph soundly and efficiently, TensorRace proposes five well-formedness conditions for kernels. When a kernel satisfies them, TensorRace can soundly order asynchronous operations by comparing their static occurrence counts, without directly reasoning about runtime barrier phases and thread interleavings. TensorRace then proves a kernel race-free by checking with SMT solvers that the happens-before graph orders every pair of conflicting memory operations. We also introduce a series of optimizations for SMT solving precision and efficiency. We mechanize soundness proofs in Rocq and evaluate TensorRace on 345 real-world GPU kernels from four libraries, including components of frontier models such as DeepSeek V4 and Kimi Linear, and common machine learning operators. TensorRace verifies each GPU kernel for NVIDIA Hopper and Blackwell architectures. In verification, we find 12 new harmful races, all confirmed by developers and fixed.

Create a lesson