Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

A Shader Loop That Never Ran: What GPU Readback Found in gogpu/naga, a Go WGSL Compiler

Description and use

naga v0.20.2 produced DXIL where a WGSL loop never executed due to missing initializer. Microsoft's validator reported VALID, yet the GPU never ran the loop. After fixing in v0.20.3 the loop runs correctly and passes both static validation and GPU readback tests.

Problem

naga v0.20.2 emitted DXIL that never executed a WGSL loop, causing incorrect shader results on real GPUs.

Outcome

After fixing the DXIL backend, naga produces correct DXIL that executes loops as specified, passing both static validation and GPU runtime tests.

Workflow

  • 1. Compile WGSL shader with naga v0.20.2 to DXIL.
  • 2. Run IDxcValidator – it reports VALID (S_OK).
  • 3. Execute shader on Intel/NVIDIA GPUs – loop body never runs.
  • 4. Identify bug via GPU readback experiment.
  • 5. Update DXIL backend in naga v0.20.3 to store loop initializer and correct loop logic.
  • 6. Re‑validate with IDxcValidator and run GPU tests to confirm correct execution.

Evidence

Microsoft's validator looked at the module and said it was valid. On an Intel and an NVIDIA GPU the loop body didn't execute once.

Source

naga v0.20.3 fixed three bugs of this kind in the DXIL backend: ... never stored the initializer; the loop didn't run

Source

What it doesn't check is whether the module computes what the source says. No static validator does, not DXC's and not spirv-val.

Source

  • Record date: 2026-11-03T18:28:46.134Z