KernelArmor adds safety proofs to CUDA kernels: it catches every cuCatch memory bug and keeps 99% of optimization speedup
Synopsis
KernelArmor pairs LLM-generated annotations with an extended SMT verifier, VerCors, to decide memory and thread safety of optimized CUDA kernels under explicit contracts. Across 740 instances and 1,370 production-grade kernels it reports potential bugs in 78.6% of instances and establishes safety for 11.4%; on the cuCatch memory-safety suite it detects all 56 bugs, and all 14 in-scope cuHadron races. Placed inside an agentic optimization loop, it yields verified kernels in all 77 trajectories while retaining 99% of the geometric-mean speedup.
Interpretation
Optimized CUDA kernels can pass testing while retaining subtle memory and concurrency bugs, and KernelArmor decides memory and thread safety under explicit contracts instead of relying only on the inputs that were run. Dynamic tools such as NVIDIA Compute Sanitizer observe errors only during execution, so coverage is limited by the inputs exercised and the error classes supported, and a clean run does not establish the absence of errors on untested inputs and paths. Across 740 instances and 1,370 kernels, KernelArmor fully establishes safety for 84 instances, reports potential findings in 582, and is inconclusive on 74; on the 56 memory-safety bugs of the cuCatch suite it detects 56, against 20, 8, 24 and 40 for Compute Sanitizer, GMOD, GPUShield and cuCatch.
A deterministic frontend scans and normalizes the CUDA code, then an LLM proposes preconditions, postconditions, loop invariants and synchronization annotations that VerCors checks. VerCors is a deductive verifier built on permission-based separation logic and originally covered only a small subset of CUDA, while tensor-core instructions, packed accesses, warp synchronization, asynchronous copies and library calls used by optimized kernels fall outside its model. The extensions cover a pending-copy resource for asynchronous copies, barriers restricted to lanes selected by __syncwarp, dynamic shared memory and thread-local arguments, byte offsets in pointer arithmetic, alignment requirements of packed accesses, and typed safety contracts for cuBLAS, cuBLASLt, CUTLASS, WMMA and PTX, totaling about 20.6 KLOC of changes and supporting CUDA 13.1.
Verifier diagnostics come back at source level and separate three outcomes: a likely defect to fix, a proof the verifier could not complete, and a construct outside its model, so the agent can target annotation or implementation revisions. Conflating these cases either lets unsafe code through or steers the agent away from correct optimizations. In an optimization loop over 11 KernelBench tasks with seven trajectories per task, the gated arm produces verified kernels in all 77 trajectories at 0.99 of the unconstrained arm's geometric-mean speedup, while the unconstrained arm ends with a verified kernel in only 12 trajectories.
Perspective
The demonstrated scope is three benchmark suites totaling 740 instances and 1,370 production-grade CUDA kernels, plus an agentic optimization loop on 11 KernelBench tasks; safety conclusions are conditional on the explicit preconditions, postconditions and supported CUDA model. The nine cuHadron race tests spanning streams, CPU and GPU, or multiple GPUs exceed the current analysis scope.
On cuHadron, KernelArmor covers 61% of all 23 race-positive tests, below SuperCollider's 87%, but detects all 14 in-scope tests with no false positives on the four race-free controls. Sixty inconclusive KernelBench cases exhaust the 12-turn repair budget, and matrix and fused-GEMM workloads account for 75% of KernelBench's inconclusive outcomes, pointing to library-modeling limits. A single verification run takes a median of 12 minutes, and a gated trajectory spends a median of 1.45 hours in KernelArmor.
