Skip to content

xshader: prove bounded reductions in full-mask Wave32 - #149

Merged
brcly merged 3 commits into
brcly:mainfrom
nztom:fix/xshader-compute-wave-rejoin
Nov 25, 2026
Merged

brcly merged 3 commits into
brcly:mainfrom
nztom:fix/xshader-compute-wave-rejoin

Conversation

@nztom

@nztom nztom commented Nov 25, 2026

Copy link
Copy Markdown

The structured emitter can lower bounded loops around a native wave reduction. The existing region check refuses that control flow, and the per-lane retry can change values observed by a later first-lane read.

This change uses the existing full-mask Wave32 emitter. It checks that scalar operations preserve uniformity along every reachable path and that fixed buffer descriptors have consistent reaching definitions. The loop proof checks the counter initialization and increment, bitmap progress, and the restored EXEC at the bitmap header. The emitter omits the watchdog only at the validated latches and retains it in other loops.

The patch stands alone on main. It overlaps #144 in the branch check and is independent of the forward EXECZ vote in #143.

Synthetic validation

  • The same synthetic ISA input matched all 34 GPU readbacks with the patch. Current main (97b8ad3) differed from the CPU oracle in 30 cases. The oracle checked reduction values, loop counters, constant-buffer branch markers, restored EXEC, and guard storage.
  • Tested on CachyOS with Proton Experimental (20261112) and DXC 1.9.2609.5. Adapters were the RTX 4080 SUPER and Radeon RAPHAEL_MENDOCINO iGPU.
  • Synthetic translator controls cover an unresolved offset, a writable buffer, a skipped or clobbered descriptor definition, a bypassed counter initializer, empty or clobbered EXEC, and a missing bitmap update. Verified that an unrelated loop keeps its watchdog.
  • Median warm translator time was 76.19 µs on main and 77.77 µs with the patch. Median DXC process time for the same fixture at cs_6_6 -O0 was 6.06 ms and 6.59 ms, respectively.
  • Passed the five checks in CONTRIBUTING.md, including the Windows D3D12 typecheck.

Prepared by a mostly unsupervised AI agent.

@nztom
nztom marked this pull request as ready for review November 25, 2026 07:50
@brcly
brcly merged commit 0a8d2ee into brcly:main Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants