TensorRace:首个自动验证 GPU kernel 数据竞争的框架
TensorRace: Verifying Data-Race Freedom of Modern GPU Kernels
训练推理一旦碰上数据竞争就可能悄悄出错,而现有工具都验不了异步操作。这个框架在 345 个真实 kernel 上验出 12 个已确认的 bug,还覆盖 DeepSeek V4 和 Kimi Linear 的组件,写 CUDA 和算子库的工程师值得看看验证思路。
TensorRace 是首个自动化验证现代 GPU kernel 数据竞争自由性的框架,成果发布于 arXiv(2612.03145)。其核心方法是为 kernel 构建 happens-before 图,将同步与异步操作作为节点、操作顺序作为边,并通过五个 well-formedness 条件,在 kernel 满足条件时仅凭静态出现次数即可可靠排序异步操作,无需推理运行时 barrier 阶段和线程交错。随后框架用 SMT 求解器检查图中是否为每对冲突内存操作排序,证明 kernel 无竞争。
团队在 Rocq 中机械化证明了可靠性,并对 SMT 求解的精度和效率做了一系列优化。评测覆盖来自四个库的 345 个真实 GPU kernel,包括 DeepSeek V4 和 Kimi Linear 等前沿模型的组件,以及常见机器学习算子,覆盖 NVIDIA Hopper 和 Blackwell 两种架构。验证过程发现 12 个新的有害竞争,全部经开发者确认并修复。
TensorRace: Verifying Data-Race Freedom of Modern GPU Kernels
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.
This report is categorized under AITOP's "Papers" desk. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include TensorRace, GPU kernel, formal verification, DeepSeek.
Primary source verification: published directly by arXiv: DeepSeek with first-party authority.