Racer: Hunting GPU Kernel Defects with Symbolic Equivalence CheckingRacer: Hunting GPU Kernel Bugs with Symbolic Equivalence Checking
The authors propose Racer, a PTX-level symbolic equivalence checking engine, which found 82 real bugs in 2,408 production GPU kernels, 76 of which were previously unknown.
- GPU kernels are repeatedly rewritten for performance, and each rewrite must keep the function unchanged, but correctness relies almost entirely on differential testing; all 82 bugs the authors studied escaped differential testing, and they summarized four blind spots: insufficient sampling coverage, implicit inputs, unchecked outputs, and floating-point error masking bugs.
- The authors propose symbolic equivalence checking: execute the kernel and the reference implementation on symbolic inputs, turn each output unit into an exact algebraic expression and then decide equivalence, and implement the PTX-level engine Racer, supported by three techniques—shape reduction, a lockstep CTA scheduler, and idiom templates plus exact numerical refutation—for production-level kernels.
- On 2,408 kernels from 41 repositories, Racer found 82 real bugs (76 new, 41 confirmed); oracle differential testing could in theory find only 47, compute-sanitizer found 18, and Volta found 9; 70.5% of the kernels were judged equivalent.
- 499 kernels (20.7%) were rejected from execution due to unsupported instructions, symbol-related control flow, etc.; the authors leave extending coverage as future work; 6 bugs were found by manual inspection of Unknown cases; the comparison with oracle differential testing is a per-bug evaluation rather than an actual measurement.
- Benchmarks
- 41 个 GitHub 仓库的 2,408 个生产 GPU kernel(23 个库中发现 bug)
- Metrics
- 发现的 bug 数等价判定覆盖率端到端检查耗时
The researchers propose a symbolic equivalence checking method for GPU kernels and implement the Racer engine, finding 82 real bugs in 2408 production GPU kernels across 41 GitHub repositories, involving 23 libraries, of which 76 were previously unknown and 41 have been confirmed. The method performs symbolic execution of kernels and reference implementations at the PTX level, converts each output into an exact algebraic expression, and then compares them cell by cell; the paper states that this by design eliminates four categories of blind spots in differential testing, namely insufficient random sampling coverage, implicit inputs such as uninitialized memory, writes beyond declared outputs, and floating-point tolerances masking logic errors. Racer makes checking applicable to production kernels through three techniques: Shape Reduction, a lockstep CTA scheduler, and idiom templates; the authors evaluate that an ideal differential tester could theoretically find only 47 of them, NVIDIA compute-sanitizer detects 18, and the closest existing equivalence checker, Volta, detects 9.
Why it was selectedThe paper points out that differential testing has blind spots such as insufficient sampling coverage and tolerances masking logic errors, and symbolic equivalence checking found 82 real bugs in 2408 production GPU kernels.
Paper analysis
What problem does this paper attempt to solve?
Repeatedly rewriting GPU kernels requires preserving functional equivalence, but differential testing has four categories of blind spots, so the authors propose symbolic equivalence checking.
Core problem: GPU kernels are repeatedly rewritten for performance, and each rewrite must compute the same function as the implementation it replaces, but today this obligation relies almost entirely on differential testing, and differential testing has blind spots that cannot be eliminated by adding test cases.
- Problem setting: The same set of operators (matrix multiplication, attention, normalization, activation) is repeatedly rewritten across frameworks, hardware generations, data types, fusion opportunities, and workload shapes; vLLM and SGLang each maintain their own fused RMSNorm. The authors argue that each rewrite may introduce logic errors.
- Shortcomings of existing methods: Differential testing compares the outputs of a new kernel and a reference implementation on randomly sampled inputs. The authors studied 82 real bugs that escaped differential testing and summarized four blind spots (§2): sampling cannot cover the input space; implicit inputs (such as uninitialized memory) are not in the signature; outputs such as out-of-bounds writes are not checked; floating-point error is indistinguishable from bugs (the error of 6 bugs is smaller than the tolerance required by a correct optimized kernel).
- Core observation: The authors argue that testing compares values, whereas correctness is a proposition about functions; under symbolic execution expressions are exact, floating-point rounding is removed from the checking problem, and any expression difference corresponds to a function difference.
- What the paper proposes: A symbolic equivalence checking method and its implementation Racer—a PTX-level symbolic equivalence checking engine that takes two kernels and a launch configuration as input and returns Equivalent, Inequivalent (with a distinguishing input), or Unknown; it comes with three techniques (shape reduction, a lockstep CTA scheduler, idiom templates) and an empirical study of 82 bugs.
What related research exists?
Related work falls into four groups: GPU kernel testing and property checking, program equivalence and translation validation, tensor program verification, and GPU kernel equivalence checking.
Testing and property checking of GPU kernels
- NNSmith, Tzer, NeuRI—generate or mutate tensor programs to expose compiler bugs; cuFuzz performs coverage-guided fuzzing of CUDA applications.
- NVIDIA compute-sanitizer—checks memory accesses and synchronization during execution; Barracuda, CURD, ScoRD are race detectors, and Simulee detects synchronization bugs through memory access modeling.
- PUG, GPUVerify, GKLEE, ESBMC-GPU—use symbolic execution or formal verification to check properties such as race freedom and synchronization correctness; PUG and GKLEE also check functional assertions; M2K checks CUDA memory safety under parameter constraints inferred from model execution. The paper notes that Racer compares the functions computed by two programs, an equivalence question that memory and synchronization checks cannot answer.
Program equivalence and translation validation
- Translation validation, Alive2—verify the correctness of compiler transformations (Alive2 performs bounded verification for LLVM).
- Regression verification, SymDiff, product programs—reason about relationships between programs; KLEE uses symbolic execution to cross-check implementations along explored paths. The paper notes that GPU kernel equivalence also requires modeling inter-thread communication and synchronization, and that the two implementations may partition work differently.
Tensor program verification
- TASO, TensorRight—prove rewrites correct at the tensor graph level; TrainVerify checks equivalence of distributed training plans against a single-device specification, and its shape reduction shrinks tensor shapes while preserving the equivalence problem.
- Mirage—performs multi-level probabilistic equivalence verification of tensor programs; Ave uses dataflow invariants in the form of symbolic labels to guide kernel optimization. The paper notes that Racer instead executes compiled kernels, and reuses proofs only when the two programs' expression pairs have a verified shared renaming.
GPU kernel equivalence checking
- ProofWright—uses an LLM to generate VerCors annotations, linking CUDA kernels to PyTorch specifications; its functional proofs cover a subclass of element-wise kernels.
- Volta—closest to Racer, likewise symbolically executing PTX on exact reals for equivalence checking. The paper notes that Racer compares complete output tensors across all CTAs and multiple launches, allows the two sides to partition work differently, and supports more production PTX constructs; on the 82 bugs Volta detected only 9 (§7.2).
Baselines and comparison setup: The comparison methods in the experiments are oracle differential testing (a per-bug theoretical evaluation with unlimited compute), compute-sanitizer (run with factory configuration) and Volta (run with factory configuration), compared against the set of 82 bugs found by Racer (§7.2). The authors position their work as, to their knowledge, the first to extend symbolic equivalence checking to production GPU kernel bug detection, handling entire grids, multi-launch programs, atomics and asynchronous copies.
How does the paper address this problem?
Racer symbolically executes two kernels at the PTX level, compares exact expressions output unit by output unit, and uses three techniques to address scale, concurrency and inconclusive results.
Overall approach: execute two GPU programs (the tested implementation and the reference implementation) on symbolic inputs, obtaining an exact algebraic expression for each output cell; the two kernels are equivalent if and only if each pair of expressions takes the same value for all inputs. Racer implements this check at the PTX level and returns one of three verdicts: Equivalent, Inequivalent (with a concrete distinguishing input), or Unknown.
Check instances and PTX symbolic execution
- Check instance: A Python class; setup declares shared tensors (vk.input introduces free variables, vk.empty does not initialize, vk.zeros/vk.full initialize to constants), program_a and program_b each declare a sequence of launches (kernel, arguments, launch configuration), and arguments declare their access mode with vk.read/vk.write/vk.readwrite.
- Frontend-agnostic: Each kernel is first lowered to PTX; the current implementation supports three input forms—CUDA C++, Triton, and PTX—and other languages require only an adapter.
- Symbolic execution: PTX instructions are interpreted one by one, floating-point instructions are interpreted as the corresponding operations over the reals, and SymPy is used as the CAS; cells of uninitialized memory are also free variables, each store records the address, and out-of-bounds writes are caught where they occur.
- Verdict: The expression difference is computed cell by cell and handed to the CAS for simplification; only if all are zero is the verdict Equivalent. An exact numeric refutation can substitute concrete rational values for the free variables: a nonzero result is an Inequivalent witness, but single-point evaluation can only refute, not prove, so otherwise the cell remains Unknown.
Shape reduction (scalability)
- Idea: Kernels often apply the same function to different input slices, and output expressions differ only in the input variables they reference. Output cells are partitioned into uniformity classes by "expression pairs match under a shared renaming," and only one representative cell per class is proved.
- Reuse condition: Cell c reuses the proof of representative r if and only if there exists a renaming τ such that eca = τ(era) and ecb = τ(erb) hold structurally (commutativity parameter reordering is allowed; no CAS simplification is invoked).
- Candidate generation: Candidate renamings come from the input footprint (the set of input indices referenced by the expression): first a translation that shifts the representative footprint to the target footprint is proposed; when the output position falls within the input footprint, a swap of the representative and the target position (such as the numerator of a row softmax) is then proposed. A candidate must pass structural verification before the proof is reused.
Lockstep CTA scheduler (concurrency)
- Coordinating threads: Each thread in a CTA is symbolically executed until exit or a synchronization point; at a barrier it waits until all participating threads arrive before continuing; if they cannot rendezvous at a synchronization point, execution is refused, ensuring the verdict does not depend on the interleaving order chosen by the engine.
- Memory access ordering: Reads and writes are recorded by epoch (the interval between CTA-level barriers), and conflicting accesses lacking the necessary ordering are reported; data from asynchronous copies is visible only after the modeled completion point (the wait of cp.async or the corresponding barrier completion of TMA).
- Atomic operations: Atomic updates by multiple threads to the same cell are merged at the next CTA barrier (shared memory) or at the end of the launch (global memory); this is valid only when the result is independent of update order (real addition, integer add/min/max/bitwise operations). Use of the old value returned by an atomic, mixing atomic operations, and ordinary accesses conflicting with pending updates are refused.
Idiom templates and a second prover (undecided results)
- Idiom templates: Compilation may inline functions such as log(x) into long sequences of bitwise operations and polynomial arithmetic, making them unrecognizable to the CAS. Racer uses templates to match coefficients, operations, guards, and register dependencies, replacing matched sequences with mathematical operations under the real model.
- Exact numeric refutation: When the CAS is undecided, evaluate on concrete inputs satisfying the constraints and domain; rationals use exact fractions, and square roots, exponentials, and logarithms are evaluated with outward-rounded intervals; a nonzero exact difference or an interval not containing zero gives an Inequivalent witness.
- Z3 second prover: When both are undecided, Z3 is used to search for an input that makes the two expressions differ; a candidate counterexample counts as Inequivalent only after confirmation by the numeric procedure; an unsatisfiable query proves equality only if the encoding preserves arithmetic semantics and the input domain, and the proof can be reused by shape reduction. Any undecided cell makes the whole instance Unknown.
What experiments did the paper conduct?
Found 82 bugs on 2,408 production kernels; oracle differential testing could in theory find only 47, and Volta 9.
Experimental setup
- Check targets: 2,408 production GPU kernels from 41 GitHub-collected targets; the bugs are distributed across 23 libraries (Table 1).
- Comparison construction: The kernel entry point is captured together with the actually launched grid, block, and shared-memory size as a check instance; the counterpart is an independent implementation, a naive reference drafted by an LLM agent under the authors' guidance, or another configuration of the same kernel (§7.1).
- Baselines: oracle differential testing (a per-bug theoretical assessment given the triggering configuration and an independent reference, enumerating all inputs; not measured), compute-sanitizer, and Volta (both recorded run results, with factory configurations).
- Runtime environment: Dual AMD EPYC 9575F (128 cores), Python 3.11.16, SymPy 1.13.1; an NVIDIA RTX PRO 6000 is used to capture launches, replay witnesses, and run the concrete baselines; nvcc 12.4 and Triton 3.2.0, both generating PTX ISA 8.4.
- Bug counting basis: 82 deduplicated bugs, and all 76 new bugs have been submitted upstream as issues or PRs; confirmed means fixed upstream, acknowledged by maintainers, or verified by independent contributors.
- Shape experiment sample: 50 kernels (40 Equivalent, 10 with bugs), each run at three shapes ×1, ×2, ×4, for 150 kernel–configuration pairs in total (§7.4).
Main results
According to Table 1 (distribution by library, partial) and §7.1, §7.2:
Swipe horizontally to read the table
Library Found New Confirmed FlagGems 25 23 5 flash-linear-attention 11 11 11 Attorch 6 6 6 CuPy 6 6 1 Triton-distributed 4 3 1 torchao 4 4 3 Liger-Kernel 3 2 2 Total (23 libraries) 82 76 41 - How they were found: Of the 82 bugs, 35 were exposed by race or memory diagnostics, 41 by output refutation, and 6 were found by manual inspection of Unknown cases (§7.1).
- Confirmation status: Of the 41 confirmed, 29 have been fixed upstream, 4 were acknowledged by maintainers, and 8 were independently verified (§7.1).
- The authors state: These bugs are not trivial—oracle differential testing could in theory detect only 47 of them.
Comparison with other methods (§7.2, Figure 5)
- Oracle differential testing: Under the assumption of exhaustive inputs, it can detect all 7 sampled-input bugs, plus 40 bugs in the Other category that can be exposed via an independent reference, for 47/82 in total; the authors note that the remaining assessment retained audit judgment and does not prove that no concrete test could expose these bugs.
- compute-sanitizer: The recorded runs detected 18 bugs (4 implicit input, 3 unchecked output, 11 Other, of which 7 are read-only out-of-bounds); 4 race bugs were not reported, and the authors note that this result is limited to the evaluated configurations and executions.
- Volta: Detected 9 (1 implicit input, 2 unchecked output, 6 Other), and did not detect the sampled-input, below-tolerance categories or the 4 races. The authors report the recorded failure reasons: 41 cases could not execute due to unsupported instructions; 3 cases compared only CTA 0 while the two sides partition work differently; 4 cases required multi-launch comparison, which Volta does not support.
Coverage and resolution of undecided results (§7.3, Table 2)
- Coverage: Of the 2,408 kernels, 1,698 (70.5%) were proved Equivalent in at least one configuration; 197 (8.2%) were bug candidates (77 with refutations, 23 Unknown, 110 with race or memory diagnostics; the counts overlap); 14 (0.6%) timed out with no verdict; 499 (20.7%) were refused execution.
- Resolution of undecided results: Of the 82 bugs, 35 came from diagnostics; among the rest, CAS elimination directly detected only 1 (a FlagGems constant deviation), exact numeric refutation resolved 36, and the Z3 second prover resolved 4 more, resolving 40 of the 46 cases left undecided by the CAS (87.0%) in total; including diagnostics and the constant-deviation refutation, Racer automatically exposed 76 of the 82 (92.7%), and the remaining 6 remained Unknown and were found by manual inspection.
Shape reduction vs. full-grid checking (§7.4, Table 3)
- Consistency: The two methods produced no contradictory verdicts on the 148 kernel–configuration pairs both decided; at ×4, full-grid checking decided 48 and shape reduction decided 49, with 1 timing out under both.
- Time: For the 38 equivalent kernels completed by both methods at all three shapes, the average end-to-end time dropped from 9.5 s to 5.5 s at ×1, from 22.2 s to 14.3 s at ×2, and from 47.0 s to 30.3 s at ×4 (Table 3).
- Case: chunk_ttt_linear_bwd_dv dropped from 204.9 s to 17.4 s at ×1 and from 415.8 s to 34.0 s at ×2; at ×4, full-grid checking exceeded 600 s without a proof, while shape reduction proved it in 70.7 s, using only 16 representatives for 2,048, 4,096, and 8,192 output cells.
- Bottleneck: At ×4, the average decision time dropped from 18.7 s to 2.1 s, but symbolic execution still took about 28 s; the authors state that symbolic execution therefore limits the end-to-end speedup.
Other ablations and analyses
- Coexisting timeouts: Of the 146 kernels with timeout instances, 132 have a proof or refutation in other configurations, and the remaining 14 are listed separately (§7.3).
- Bug category distribution (§6): 7 sampled input, 11 implicit input, 6 unchecked output (out-of-bounds writes, across 5 libraries), 6 below tolerance, and 52 Other (of which 40 can be exposed via an independent reference, 7 are out-of-bounds reads, 4 are data races, and 1 modifies padding).
What are some points that can be further explored?
The authors leave extending execution coverage as future work; 20.7% of kernels were rejected from execution, and 6 bugs were found by manual inspection.
Limitations and future directions noted by the authors
- Execution coverage: 499 kernels (20.7%) fall into the execution-refused category, for reasons including unsupported integer operations, addresses or control flow depending on symbolic data, synchronization patterns beyond the current model, and execution limits; the authors leave extending this coverage to future work (§7.3).
- Unknown requires manual intervention: 6 bugs remained Unknown and were found by manually inspecting the kernel code and symbolic expressions; an Unknown result by itself does not constitute a bug (§7.1, §7.3).
- Symbolic execution is the bottleneck: Even though proof reuse reduces decision time, symbolic execution still limits the end-to-end speedup (§7.4).
- Nature of the oracle comparison: The evaluation against differential testing is a per-bug theoretical assessment rather than a measured testing campaign, and it does not prove that no concrete test could expose those bugs (§7.2).
- Scope of the sanitizer results: The result that compute-sanitizer did not report 4 race bugs is limited to the evaluated configurations and executions (§7.2).
Scope of the experimental coverage
- The check targets are 2,408 kernels from 41 GitHub-collected targets, with bugs distributed across 23 libraries (§7.1, Table 1).
- The baselines are oracle differential testing (theoretical assessment), compute-sanitizer, and Volta (recorded runs), and the comparison set is the 82 bugs Racer found (§7.2).
- The shape experiment covers 50 kernels × 3 shapes, for 150 kernel–configuration pairs in total (§7.4).
- The reference implementations were partly drafted by an LLM agent under the authors' guidance (§7.1); the paper does not report how the correctness of these reference implementations themselves was verified.
- The paper does not report the number of repetitions of the shape experiment, nor the total time to check the 2,408 kernels.
Summarize the main content of the paper
Racer uses PTX-level symbolic equivalence checking to find 82 real bugs in 2,408 production kernels, 76 of which were previously unknown.
A systems and formal methods paper: addressing the problem of guaranteeing functional equivalence when GPU kernels are repeatedly rewritten, it proposes a symbolic equivalence checking method and implements the engine Racer.
- Problem: Differential testing is the de facto standard, but the 82 escaped bugs the authors studied fall into four categories of blind spots—insufficient sampling coverage, implicit inputs, unchecked outputs, and floating-point error masking logic bugs (6 bugs had error smaller than the tolerance required by the correct kernel).
- Method: Execute the kernel and the reference implementation on symbolic inputs, obtain an exact algebraic expression for each output unit, and decide equivalence unit by unit; implemented at the PTX level to be frontend-agnostic. Three techniques: shape reduction reuses proofs by uniformity class; a lockstep CTA scheduler models barriers, asynchronous copies and atomic operations, and rejects execution when ordering cannot be determined; idiom templates plus exact numerical refutation and a Z3 second prover reduce Unknown.
- Main results: On 2,408 production kernels from 41 repositories, found 82 real bugs, 76 previously unknown, 41 confirmed (29 already fixed upstream); oracle differential testing could theoretically detect only 47, compute-sanitizer detected 18, and the closest equivalence checker, Volta, detected 9.
- Coverage: 70.5% of kernels were judged Equivalent, 20.7% were rejected from execution due to unsupported constructs; exact numerical refutation and Z3 resolved 40 of the 46 cases left undecided by CAS.
- Efficiency: shape reduction has no contradictory decisions compared with whole-grid checking; for 38 equivalent kernels, the average end-to-end time ×1 dropped from 9.5 s to 5.5 s; the authors say symbolic execution remains the bottleneck.
- Authors' conclusion: The authors hold that correctness is a proposition about functions, that symbolic equivalence checking by design eliminates the four categories of differential testing blind spots, and that it can scale to production-level kernels; extending execution coverage is left as future work.