Repository navigation
Shaders: a mask built up in a loop every lane runs the same way (stacked on #1407) - #1420
marquezinii wants to merge 2 commits into
Conversation
987c173 to
7b7d5fd
Compare
|
Independent verification of \7b7d5fd\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, \gfx1200, native wave32 + wave64) / Rust 1.98.1 MSVC:
AI-assisted; synthetic tests only, no game files. |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96. GPU/valu execution tests are Windows-gated and were not run here.
Same lane-mask work as #1407 plus the loop cases: a mask built up in a loop every lane runs the same way now reads as a number and counts its lanes (accumulating_loop variants). New lane_mask_tests.rs (380 lines) — Windows-gated hardware cases, not run on macOS (96 green).
Note: conflicts with #1407 (same new file, same helpers/tests); this one is the superset, so landing this one and closing #1407 would avoid a rebase.
|
On the conflict with #1407: this branch is stacked on it, not a copy. It contains #1407's two commits unchanged, plus one commit for the loops, so the two do not conflict. Merging this one lands both. Merging #1407 first (as a merge, not a squash) leaves only the last commit here. If #1407 is squashed, I'll rebase this one. |
Offline measurement on a retail dump, and the shader tests on AdaResult: no count change against Offline. I merged head 7b7d5fd onto 5 programs move from "a lane mask holding lanes elsewhere read as data" to later failures. Tests: with the same merge, No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
Thanks for running the comparison on this one too. It gives the same 5 programs as #1407 alone, so the loop handling here doesn't move any program on top of it in this build. Their next refusal is what blocks them, not the masks. If you still have both lists, the reason each of those 5 fails with now would settle where to look next. That one comparison covers both PRs, so there's no need to repeat it on #1407. |
7b7d5fd to
9f57d9c
Compare
|
Rebased onto On an RTX 5070, the two loop tests fail on plain |
|
Automated triage for the maintainers. This pull request no longer merges cleanly into Generated by Claude Code |
A join of masks read by a VALU instruction (a compare written in a branch, read after EXEC is restored) is tracked as a mask and read as one, before the first loop, when every lane's own incoming mask is the wave's: the wave leaves a join from its last predecessor in program order, so a lane must find there the mask of every later edge. A constant joined in (s20 = 0 before the branch) is taken by its lane bit in such joins only. Masks holding lanes elsewhere are left to mask_number, which replays the scalar operation that writes them. The lane-mask tests run only where 32-lane waves run.
A mask ORed together over a loop (`s20 |= v_cmp(...)` with a scalar counter) and read after it failed with "a lane-mask join of an untracked mask": the join at the loop's head takes in the 0 written before it, which is no mask. When no branch in the loop depends on the lane, each lane goes round as often as the wave and enters the head over the wave's edge, so its own value there is the wave's; such joins, and the forward joins checked edge by edge, are now recorded as per-lane joins, and only those take in a number by its lane bit. A loop that lanes leave after different passes is still refused.
9f57d9c to
f9fb9aa
Compare
|
Restacked on the new #1407 (head On the CI failure: the |
Stacked on #1407: the first two commits are that pull request's, the last one is this change.
A mask ORed together over a loop and read after it failed with "a lane-mask join of an untracked mask":
The join at the loop's head takes in the 0 written before the loop, which is no mask, so the lowering had no lane bit for that edge. When no branch in the loop depends on the lane (here an SCC test of a scalar counter), each lane goes round as often as the wave and enters the head over the wave's edge, so its own value there is the wave's.
structurenow records those joins, with the forward joins that #1407 checks edge by edge, asper_lane_joins, and only those take in a number by its lane bit. A loop that lanes leave after different passes (v_cmpx_lt_u32thens_cbranch_execnz) is still refused: there the wave's s20 keeps growing after a lane has left, so the lane's own copy is not the wave's.How I checked it
Three tests in
lane_mask_tests.rs, on synthetic wave32 programs of 32 lanes:0x7) and counted withs_bcnt1_i32_b32(3);On an RTX 5070 (driver 621.40), all eight tests of the file pass. Devices without 32-lane waves (WARP, the CI's adapter) are skipped, as in #1407.
cargo test --workspace --lockedpasses andcargo clippy --workspace --all-targets --locked -- -D warningsis clean.Not checked: the title's shaders (I have no dump), wave64 on a GPU, and loops with a lane-dependent branch inside that does not leave the loop. Those are still refused, which is safe but stricter than needed.