Repository navigation
[pr-fix] Shaders: the wave64 fold takes branches by the wave, and nine smaller faults in it - #14
Conversation
A folded program without LDS, barriers or a mask opened again took its EXEC branches lane by lane. The console's wave takes them together: scalar code behind a skip runs when some lane is left and sets every lane's scalar, not the taken lanes' alone, and lanes that leave a loop one by one are still there for the ballot behind it. One host wave is one console wave, so taking every such branch wave-wide is exact. A program with a branch lanes would still take one by one is left to the other forms. Branches on EXEC are taken so from the start: their conditions over both halves' compares can be too large to follow lane by lane, as before this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A join of numbers one of which is a lane mask takes the mask's ballot after
the lane-mask joins were filled; a mask join only that ballot reads stayed
without a value, which is no valid DXIL ("PHI nodes must have at least one
entry").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A jump comes to a label with EXEC as a run of vector code left it (one half's lanes). The rewrite took it for E.lo | E.hi when the code above the label had settled it, and a s_cbranch_execz there tested one half: code the console runs was skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… dword v_mbcnt_lo_u32_b32 of exec_lo, then v_cmpx: the upper half's copy of the count reads E.lo, which the lower half's copy of the compare had written by then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v_readfirstlane_b32 with EXEC 0 read lane 32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…console's EXEC Its result stayed in the host's EXEC; E never got it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It names the console wave's four rows of 16 lanes. The upper half's copy kept the bits of rows 0 and 1 for its own two, the console's rows 2 and 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Past the count are the twins, another console lane's registers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pipeline workers catch it and go on; the thread's later programs were lowered as folded ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its last words may name VGPR bases past the registers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I read the ten commits against One question before merging. Also: a folded program is now refused whenever a per-lane region is left. Your corpus shows no new refusals; the title's own programs may differ, so I will compare AI-assisted (Claude Code, Claude Fable 5.2). |
|
Merged (
My question about the second AI-assisted (Claude Code, Claude Fable 5.2). |
Found by comparing folded programs with an interpreter of the machine code, and by reading
fold.rsagainst the RDNA 2 ISA. The code is trustno1-coder/VIctory-NVIDIA#1504's (merged there); the same faults are in its head 53af8605 and in that tree's main 829188e9.What it changes
The fold (
crates/victory-shader/src/fold.rs,foldedinemit/mod.rs) is the first form tried for a wave64 compute program whose plain form needs 64 lanes or code every lane runs. It gave wrong results. One commit each:v_cmpx_gt_u32 s0, v0; s_cbranch_execz over; s_mov_b32 s12, 9; over:set s12 for the lanes below s0 only; the console sets it for the wave. Scalars behind loops that lanes leave one by one were wrong the same way. Every branch on a lane mask is now taken wave-wide, which is exact with one host wave per console wave. EXEC branches are taken so from the start, so a program with "lane conditions too large" still folds. This removes the retries inside the folded form, which structured the program lane by lane again.docs/wave64-folded.mdis brought up to date.PHI nodes must have at least one entry, no valid DXIL.s_cbranch_execzthere could test one half and skip code the console runs.v_mbcntthenv_cmpx. The upper half counted lanes the lower half's compare had already turned off.v_readfirstlane_b32with EXEC 0 read lane 32; the ISA says lane 0.v_lshlrev_b64 v[15:16]of 16) read another lane's register. Refused now.How it was tested
emit/folded_tests.rsthat dispatches a program and compares every lane. They run on Windows with a card.emit/folded_tests.rson the card, the 80-second test included: 28 passed, 0 failed. I did not sort the 71 wrong one by one. A mask dword through two joins, which this does not fix, still fails as a hand case; so does the fault below.ldsdeclared and not used) are on main too.cargo testpassed for the crates it touches: yes, Linux, Rust 1.98.1,cargo test -p victory-formats -p victory-shader --lib: 57 and 245 passed, 0 failed, at each commit.CARGO_FEATURE_PURE=1 cargo clippy -p victory-gpu -p victory-shader --tests --target x86_64-pc-windows-msvc: exit 0, no more warnings than main.cargo xtask policy: ok.Checked for overlap
emit/lower.rselsewhere; the two merge without conflict.🤖 Generated with Claude Code