cd /news/ai-research/ai-written-gpu-kernels-14-of-31-that… · home › topics › ai-research › article
[ARTICLE · art-182159] src=github.com ↗ pub= topic=ai-research verified=true sentiment=↓ negative

AI-written GPU kernels: 14 of 31 that pass their tests race under the PTX model

An audit of every public model-written GPU kernel that passes its tests and synchronizes across thread blocks found that 14 of 31 contain a data race under the PTX memory model, with 10 missing a release or acquire in a block-to-block handoff and 4 racing on shared memory inside a single block. In 7 of the 14, returning stale values at the racing loads in syncsan's adversarial mode made the benchmark's own correctness check fail while the control run passed, and none of the 31 failed its check under normal runs of 1 to 4 each. The kernels all come from 2026 frontier-model megakernel work — 31 from kernelbench.com Mega (Kimi-Linear decode megakernels) and 3 from KernelBench-Hard — while older collections including Sakana AI CUDA Engineer's 16,459 test-passing kernels, KernelBench's roughly 13,000 samples, CUDA-L1's 1,250 and flashinfer-trace's 393 had zero cross-block-synchronizing kernels.

recommendation

Run test-passing GPU kernels under syncsan's adversarial stale-read mode, not just normal runs, and add the missing __threadfence(), acquire/release or __syncthreads() at each cross-block handoff.

more in playbook: Evals and testing for LLM apps
read5 min views1 publishedDec 4, 2026
AI-written GPU kernels: 14 of 31 that pass their tests race under the PTX model
Image: Michielbdejong (auto-discovered)

Language models now write GPU kernels that synchronize thread blocks through global memory: grid barriers, flags, tickets, last-block reductions. Those handoffs need a release and an acquire under the PTX memory model, and a missing one rarely changes the output on today's GPUs, so a kernel can pass its tests and still be wrong under the model. We checked every public model-written kernel we could find that passes its tests and synchronizes across blocks.

Of 31 test-passing, model-written kernels that synchronize across thread blocks, 14 contain a data race under the PTX memory model:

  • 10 are missing a release or an acquire in a handoff between blocks;
  • 4 have a race in shared memory inside one block (a buffer reused with no barrier in between).

In 7 of them, returning at the racing loads the stale values the PTX model allows (syncsan's adversarial mode) makes the benchmark's own correctness check fail, while the control run, which redirects the same loads but returns current values, passes. None of the 31 failed its check when run normally (1 to 4 runs each).

Every synchronization shape behind these verdicts is written as a litmus test and checked with Dartagnan's formal PTX models (6.0, 7.5 and stock 7.5): the racy shapes are racy and allow the stale read under all three, and the clean ones are clean.

This does not mean these kernels give wrong answers on current hardware; we never saw one do so. It means their correctness depends on an ordering the PTX model does not promise. Each model has one to three kernels here, so the data says nothing about which model writes better kernels.

We counted kernels that pass their tests and synchronize blocks through global memory, reading each one.

Source Test-passing kernels With cross-block sync
Sakana AI CUDA Engineer archive 16,459 0
KernelBench samples about 13,000 0
CUDA-L1 1,250 0
flashinfer-trace agent solutions 393 0
kernelbench.com Mega (Kimi-Linear decode megakernels) 69 31
KernelBench-Hard 49 3

The older collections have none: their kernels are single-block-at-a-time operators. All of these come from 2026 frontier-model megakernel work. Of the 34, one had its cooperative path switched off, one failed its check natively on our setup, and one timed out under syncsan, which leaves 31.

Shape Kernels What is missing
Grid barrier polls a volatile counter, no fence after the spin 4, 11, 27 acquire
Grid barrier arrival is a relaxed atomicAdd with no fence before it 5, 7 release
Last block reads the other blocks' partials, but its only fence comes before its ticket (CUDA's threadFenceReduction shape) 13, 15, 27 acquire
Last arriver bumps the generation or sets the flag right after its relaxed ticket 13, 19 acquire
Fences in every thread, then a barrier, then a relaxed arrival by thread 0 6 release (racy under PTX, probably harmless on current GPUs)
A block zeroes a buffer other blocks may still be reading 34 ordering between the phases
Shared-memory buffer rewritten with no barrier after it was read 12, 17, 19, 21, 26 __syncthreads()

A fence (__threadfence()) in the right place, or an ld.acquire / atom.release instead of the relaxed access,

fixes each cross-block case; a __syncthreads() fixes each shared-memory case. H100 and B200 kernels ran with the benchmark's graded random seeds only, because its newer attention cases stop with a grader error on H100 before any solution runs. Kernels graded on an RTX PRO 6000 ran on one.

# Model Normal run Adversarial / control Verdict
4 GLM 5.2 pass fail (0.338) / pass race: no acquire after the spin
5 GLM 5.3 pass fail (non-finite) / pass race: no release before the arrival
6 Claude Fable 5.1 pass fail (0.94-0.97) / pass race under PTX only
7 Muse Spark 1.3 pass fail (0.009-0.018) / pass race: no release before the arrival
11 Claude Fable 5.2 pass fail (0.14-0.21) / pass race: no acquire after the spin
13 Ergo 1.0 pass fail (0.85-0.89) / pass race: generation bump and last-block reads
15 Claude Fable 5 (paged attention) pass fail / pass race: last block reads without an acquire
19 Kinetic-0715 pass pass race: flag set without a fence; shared-memory race
27 DeepSeek Flash pass pass race: no acquire after the spin
34 Gemini 4 Neon pass fails under instrumentation alone race: buffer zeroed while still read
12, 17, 21, 26 Gemini 4 Carbon, GPT-5.6 Sol (2), GPT-6 Astra Pro pass nothing to substitute shared-memory race inside a block
17 others Claude Fable 5, 5.1, Opus 5.5, Sonnet 5.5, GPT-6 Sol, 6.1 Sol, 6.2 Astra (2), Gemini 3.8 Flash (2), Grok 4.5, 4.7, Muse Spark 1.3, Kinetic 1m, ... pass no race found

The numbers in parentheses are the check's error measure against its tolerance. Case 4's adversarial failure is from syncsan's default mode only; the other six held with SYNCSAN_WARP_ORDER=0.

syncsan also reported pairs in kernels that are correct, and we did not count them:

  • Its default warp-order mode reported pairs across correct handoffs in two kernels (49 pairs in one, 5 across grid.sync() in another). They vanish withSYNCSAN_WARP_ORDER=0 , and in one of them adversarial mode then broke the output with values the model forbids. So an adversarial failure here counts only once its pairs are shown to be real by reading the code and by the litmus test of its shape.
  • A counter reset after an acq_rel ticket, and write-after-read pairs across release/acquire barriers, in two more.

Every verdict above rests on reading the source against the PTX model, with syncsan pointing at the lines.

syncsan 0.11.1 from PyPI, built for the GPU each kernel was graded on, run through Modal: reproduce/ai_kernels. The kernels and their checks are MIT-licensed, from Infatoshi/kernelbench.com. The source lines behind each verdict are in VERDICTS.md.

── more in #ai-research 4 stories · sorted by recency
── more on @sakana ai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/ai-written-gpu-kerne…] indexed:0 read:5min 2026-12-04 · —