Equivalence Checking of ML GPU Kernels

Kshitij Dubey, Benjamin Driscoll, Anjiang Wei, Neeraj Kayal, Rahul Sharma, Alex AikenarXiv 2025 · DOI

Abstract

As machine learning relies increasingly on aggressively optimized GPU kernels—written by humans, compilers, or even LLMs—ensuring their correctness is critical. This paper introduces VOLTA, the first formal equivalence checker for GPU kernels. By symbolically evaluating PTX assembly, VOLTA mathematically proves that an optimized kernel is functionally identical to a reference implementation and completely free of concurrency bugs, even when arithmetic operations are reordered.

Introduction

Training and running Large Language Models (LLMs) requires executing tensor operations on GPUs at massive scale. To maximize performance, developers and domain-specific compilers aggressively optimize GPU kernels. However, verifying these optimizations is notoriously difficult. Standard unit testing often fails to catch concurrency bugs like data races or deadlocks that only trigger under rare hardware schedules. Furthermore, because floating-point math is not strictly associative, optimized kernels often produce slightly different numerical outputs than reference code, making it hard for tests to distinguish between acceptable numerical drift and genuine semantic bugs.

Methodology

VOLTA is a black-box equivalence checker that operates directly on NVIDIA PTX assembly. It works in two main phases:

  1. Symbolic Execution: VOLTA simulates the execution of both a reference and an optimized kernel, treating input tensors as symbolic variables. It uses a round-robin scheduler to step through threads while tracking memory accesses to guarantee the code is free of data races and deadlocks.
  2. Decision Procedure: VOLTA generates symbolic mathematical expressions for the final output tensors and checks if they are equivalent. Crucially, it treats floating-point operations as real numbers, matching the mental model of ML compilers that assume associativity to optimize code.
Parallel execution flow of a Softmax kernel across four threads, illustrating the use of synchronization barriers and shared memory access.

A major theoretical contribution of the paper is proving confluence: the authors mathematically guarantee that if a kernel is free of data races, the specific scheduling order of threads does not change the final symbolic expression. This bypasses the state-explosion problem usually associated with verifying concurrent programs.

Experimental Evaluation

The authors evaluated VOLTA on a diverse suite of real-world ML kernels, including human-optimized tutorials for Matrix Multiplication, FlashAttention-1 and FlashAttention-2, and kernels generated by LLMs (like Claude Code) and compilers (like TileLang).

VOLTA successfully verified complex kernels utilizing warp-level tensor core synchronization in under 10 minutes. It also identified known data races in repositories like OpenMM and MegatronLM. Notably, VOLTA caught an out-of-bounds shared memory read in an LLM-generated kernel that achieved 179% of PyTorch's performance; this bug was missed by NVIDIA's official Compute Sanitizer because current hardware silently tolerated the error.

Key Insights

  • Real Numbers for ML Verification: Modeling tensor elements as mathematical reals allows VOLTA to verify aggressive optimizations that standard floating-point verifiers would reject.
  • Decidability of Exponents: To verify kernels like Softmax (illustrated in the figure above), the decision procedure must handle algebra with exponentiation. The authors provided a formal proof that deciding the equality of these specific multivariate exponential polynomials is mathematically decidable.
  • Universal Backend: Because it analyzes PTX assembly, VOLTA seamlessly verifies code written in raw CUDA, generated by Python DSLs, or utilizing CUTLASS templates.

Limitations and Future Work

VOLTA currently assumes "structured-CTAs," meaning tensor sizes must be statically known and loop bounds must be unrollable. It does not yet support asynchronous CUDA features like pipeline and tma, nor can it verify grid-level optimizations that change work distribution across multiple thread blocks. Future work will focus on extending the tool to these more dynamic and large-scale GPU programming patterns.

Summary updated

BibTeX
@misc{dubey2025equivalence,
  author = {Kshitij Dubey and Benjamin Driscoll and Anjiang Wei and Neeraj Kayal and Rahul Sharma and Alex Aiken},
  title = {{Equivalence Checking of ML GPU Kernels}},
  year = {2025},
  eprint = {2511.12638},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.12638},
}
Figure