Researchers have released TxVerify, an open-source framework for verifying GPU kernels in Lean, and used it to prove four properties for 13 production Blackwell kernels. The proofs covered FlashAttention-4, FlashMLA, a TIRx FP16 GEMM and vLLM’s decode and forward attention kernels for Inkling 2 Small, and they surfaced three real synchronization bugs.
The central question the team asks is simple: when someone says a kernel is verified, what exactly was proved?
Why verification is back
Formal verification has a reputation for being slow. The seL4 microkernel, about 8,700 lines of C with 7,500 verified, took roughly 25 person-years including design and documentation. Two shifts change the math, according to the team. Coding agents now write GPU kernels faster than people can review them, and agents can also write proofs, which Lean checks step by step so nobody has to trust the author.
GPU kernels are a good target because their worst bugs hide well. In a warp-specialized Blackwell kernel, a copy engine, the Tensor Core and several warp groups pass data to each other, and one misplaced barrier or wait breaks a hand-off. Synchronization fixes landed in DeepGEMM, CUTLASS, FlashInfer and FlashMLA during 2026. Such an error can leave a program with undefined behavior even when every test returns the right answer.
The four properties and two goals
Verifying GPU kernels in Lean means every step of the argument is machine checked. For each kernel, TxVerify proves safety, progress, termination and the specified result, working on the actual PTX, including the Blackwell features the kernel uses. The team sets two goals:
- Coverage: the proof should address the real PTX, not a simplified model.
- Soundness: any error the proof rules out must be impossible on the GPU. If a load could return a value the model forbids, the proof never examines what the kernel does with it.
The hard part: no precise PTX model
There’s no precise formal PTX model for these Blackwell kernels. Even with one, assumptions about undefined behavior, numerical approximations and the “No Thin Air” rule would still need human review.
TxVerify handles this by splitting the conditions. A shared core records the authors’ reading of the hardware manual. Each theorem then lists its own kernel-specific assumptions. Once reviewers have checked the core, checking a new kernel reduces to checking its specification and those assumptions.
What the proofs found
The proofs also pinned down exactly which assumptions each kernel depends on, which is information a test suite can’t give.
- 13 Blackwell kernels from compiler-emitted or hand-written PTX were proved in Lean.
- Eight assumptions were pinpointed for FlashAttention-4 and 11 for FlashMLA.
- Two synchronization bugs in Inkling 2 decode and one in the GEMM were fixed as a result.
The GEMM proof alone ran to 69,552 lines of Lean.
Why it matters for kernel authors
Tests only show that a kernel returned the expected answer on the inputs tried. A synchronization mistake can hide behind passing tests and surface later as undefined behavior. A proof that covers the real PTX closes that gap, and the explicit assumption lists tell engineers what to watch when they change the kernel.
A small example
To show what a proof means, the team walks through a nine-instruction add_one kernel in which thread i adds one to the 32-bit word A[i]. The theorem states that, given a valid launch and an aligned array, the kernel runs safely, makes progress and terminates under fair scheduling. Every completed run leaves A[i] equal to x[i] + 1 modulo 2 to the 32nd power, and no byte outside the array changes. The argument checks which bytes each thread loads and stores, which executions the rules allow, and why every allowed execution meets the claim: threads touch disjoint words, so there’s no race.
What comes next for TxVerify
The framework is public on GitHub, and the team invites others to try it, break it or prove their own kernels. The remaining human job is deciding what a proof may rest on, and keeping that list short and explicit is the project’s aim. Verifying GPU kernels in Lean still depends on reviewers trusting the shared core, so expect scrutiny of that reading of the manual to shape how far the approach spreads.
Source: blog.mlc.ai