arXiv:2610.28429cs.SCOct 2026

Manuscript Offprint

arXiv:2610.28429

Racer: Hunting GPU Kernel Bugs with Symbolic Equivalence Checking

Tuan Truong Vu, Cheng Tan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

GPU kernels are critical to the performance of today's AI services, yet the same operators are rewritten repeatedly: for each GPU generation, numeric format, serving regime, and kernel language. Every rewrite must preserve the function computed by the implementation it replaces. Today, this obligation depends almost entirely on differential testing: run the new kernel and a trusted reference on randomly sampled tensors, then compare their outputs within a tolerance. This approach has blind spots that additional test cases cannot eliminate. For example, a logical bug may produce an error smaller than the tolerance required to accommodate a correct optimized kernel.

We propose symbolic equivalence checking, which executes a kernel and its reference on symbolic inputs, turning each output cell into an exact algebraic expression, and then checks whether the paired expressions agree for all inputs. Because these expressions are exact, symbolic equivalence checking distinguishes floating-point error from logical bugs, while a single check covers the entire input space.

We implement RACER, a PTX-level symbolic equivalence checking engine, with three techniques that make this approach practical for production kernels: (1) Shape Reduction to control checking cost, (2) a lockstep CTA scheduler to handle concurrency, and (3) idiom templates with exact numeric refutation for otherwise inconclusive results. Across 2,408 production kernels from 41 collection targets, RACER found 82 real bugs in 23 libraries, including 76 previously unknown bugs and 41 confirmed so far.

1 Introduction

GPUs power modern AI, and GPU kernels largely determine its performance. AI model throughput is closely tied to the throughput of its GPU kernels [54]. Optimized kernels are therefore central to the performance of modern AI systems: they directly determine inference latency and serving throughput, and can make impractical workloads feasible. FlashAttention, for example, substantially reduced the cost of attention and enabled efficient long-context inference [14].

Because performance matters, the same GPU kernel gets written over and over. Attention alone has been rewritten for each architecture generation as new primitives arrived, from Ampere's asynchronous copies to Hopper's TMA and warpgroup MMA [7, 10, 13]; specialized per head dimension and per serving regime, prefill against decode [62]; re-tuned for each numeric format [18, 29, 40]; and written again in new languages such as Triton [21, 50, 58]. It happens across serving platforms too: vLLM [24] and SGLang [60] each ship their own fused RMSNorm, one written to accept any hidden size, the other optimized for the shapes it expects to serve.

This rewriting paradigm is the norm in modern GPU kernel development: a set of mathematical functions is implemented repeatedly, with each new implementation striving to outperform its predecessors.

Beyond performance, every rewrite carries a critical obligation: it must still compute the same function as the implementation it replaces. For today, meeting that obligation is left almost entirely to differential testing: run the new kernel and a trusted implementation, usually PyTorch's, on randomly sampled input tensors, and compare the outputs elementwise within an absolute and relative tolerance [38, 46]. This practice is widespread in production, and for good reason. The operator set is bounded, and each operator has a precise mathematical meaning, so a trusted reference implementation is almost always available. Moreover, kernels are typically pure functions from input tensors to output tensors, making side-by-side execution straightforward.

And yet, production systems still ship GPU kernels with bugs. By studying 82 bugs we found in deployed libraries (§7) that slipped through differential testing, we identified four major obstacles: (a) sampling cannot cover the input space: some bugs trigger only on needle-in-a-haystack values that random sampling is unlikely to produce; (b) not every input is an explicit argument: many bugs depend on implicit inputs, such as uninitialized memory that happens to contain zeros during testing but may hold arbitrary values in practice; (c) not every output is checked: some bugs we found corrupt memory outside the intended output region, which tests therefore never inspect; and most notably, (d) floating-point error can be indistinguishable from a bug: 6 bugs we found cause only small numerical errors—smaller than the tolerance required for correct optimized kernels.

As a real bug example, FlagGems' InstanceNorm reconstructs the variance from the stored rstd = 1/ var+ϵ\sqrt{\text{var} + \epsilon} as 1/rstd 2^2 + ϵ\epsilon, instead of the correct 1/rstd 2^2 - ϵ\epsilon. Such a bug cannot be detected by differential testing. This is because, for typical input tensors, the output deviation caused by the logical bug is smaller than the tolerance required to accommodate normal floating-point error. But this is not harmless numerical noise: the kernel computes the wrong function, and the resulting systematic error can compound over millions of training steps and ultimately cause training to fail.

We argue that ensuring the correctness of GPU kernels requires a more systematic and principled approach than differential testing. To this end, we propose symbolic equivalence checking. Symbolic equivalence checking executes two GPU programs over symbolic inputs rather than concrete values. As a result, each output element is represented by an algebraic expression over free variables rather than a concrete number. The two kernels are equivalent exactly when, for every output element, the corresponding expressions evaluate to the same value for all possible inputs.

In symbolic equivalence checking, each blind spot of differential testing is eliminated by design rather than by testing harder. First, a free variable stands for every input value at once, so one check covers the entire space. Second, uninitialized memory is symbolic too, so a kernel that depends on what the previous launch left behind is checked over every value it could have left. Third, symbolic execution knows the address of every store, so a write outside a declared tensor is caught where it happens. Finally, expressions are exact rather than floating-point, removing floating-point error from the checking problem. Any difference between the two kernels therefore reflects a difference in the function they compute, rather than an artifact of rounding.

In this paper, we introduce RACER, a symbolic equivalence checking engine for GPU kernels. RACER takes two kernels—one under test and one reference implementation—together with a launch configuration, and returns one of three outcomes: Equivalent, Inequivalent with a concrete input that distinguishes the two kernels, or Unknown.

RACER executes symbolic equivalence checking at the level of PTX, NVIDIA's virtual instruction set [44]. PTX provides a stable interface across GPU generations and is, in fact, the lowest-level instruction set that NVIDIA publicly documents. As a result, many front ends, including CUDA C++ and Triton, compile to it. Moreover, PTX exposes memory operations explicitly, allowing the engine to model the address space that a kernel actually accesses.

Checking production GPU kernels poses three technical challenges for RACER. First, symbolic equivalence checking is expensive at the scale of real kernels. For example, a naive implementation of symbolic equivalence checking times out under a 600s budget even for a simple Softmax kernel with tensor shape 4×644 \times 64. Second, a kernel launch is not a single piece of code running on one core, but thousands of concurrent threads executing and interacting through synchronization and shared memory. RACER must therefore reason not only about each thread's arithmetic computation, but also about synchronization and cross-thread interactions. Finally, deciding the equivalence of arbitrary arithmetic expressions is fundamentally difficult. In many cases, the underlying computer algebra system cannot establish equivalence and returns Unknown. RACER must therefore reduce the frequency of such inconclusive cases while preserving soundness.

RACER introduces three techniques to answer the three challenges: Shape reduction proves one representative output cell per uniformity class and transports the proof to the rest by a verified renaming, rather than paying for every cell ( §5.1§5.1); a CTA scheduler steps every thread in lockstep between synchronization points and refuses what it cannot order, so that no verdict rests on an interleaving the engine chose ( §5.2§5.2); and idiom templates with exact numeric refutation plus a second prover for inconclusive results ( §5.3§5.3).

We evaluate RACER on production kernels from 41 GitHub repositories. In total, RACER checks 2,408 GPU kernels. It identifies 82 real bugs, including 76 previously unknown bugs, of which 41 have been confirmed. These bugs are nontrivial: among the 82 bugs, an oracle differential tester could, in theory, detect only 47. In comparison, NVIDIA's compute-sanitizer [42] detects 18, while Volta [16], the closest existing equivalence checker, detects only 9 ( §7.2§7.2).

We are not the first to check GPU kernels symbolically, nor the first to decide equivalence of tensor programs [2, 16, 34]. We are, to our knowledge, the first to scale symbolic equivalence checking to bug detection in production GPU kernels: handling whole grids rather than a single thread block, multi-launch programs, atomics, and asynchronous copies, while achieving the performance needed to check real-world kernels. This paper contributes:

  • A study of 82 real bugs in production GPU kernels that identifies four blind spots of differential testing and shows, bug by bug, why the practice cannot close them ( §2§2, §6§6).

  • RACER, a symbolic equivalence checking engine that decides kernel equivalence at PTX level over exact arithmetic, models GPU execution faithfully, and fails closed rather than approximating ( §4§4).

  • Three techniques that make the check practical on production kernels: shape reduction, a lockstep CTA scheduler, and idiom templates ( §5§5).

  • An evaluation on 2,408 production kernels: 82 real bugs across 23 libraries, 76 previously unknown, and 41 confirmed at the moment. ( §7§7).

References (31)