Shaders: a mask built up in a loop every lane runs the same way (stacked on #1407) #1420
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1420
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1420"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@marquezinii on GitHub · 2026-11-24 17:54 UTC · original
marquezinii:shader/lane-mask-loops→main· +542 −6 · 4 files · 2 commits · openStacked 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.
@geiyiliyabumo on GitHub · 2026-11-24 18:09 UTC · original
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.
@marquezinii on GitHub · 2026-11-24 19:56 UTC · original
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.
@sinan-cmyk on GitHub · 2026-11-24 20:44 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head 7b7d5fd onto
mainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.5 programs move from "a lane mask holding lanes elsewhere read as data" to later failures.
Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 128, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@marquezinii on GitHub · 2026-11-24 21:40 UTC · original
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.
@marquezinii on GitHub · 2026-11-24 22:06 UTC · original
Rebased onto
main70564ae, still stacked on #1407 (head9f57d9c: #1407's two commits, then the loop commit). The only conflict came frommain's new fields in the structure builder.On an RTX 5070, the two loop tests fail on plain
mainand pass here.cargo test -p victory-shader --locked: 214 passed, and 3 failures that plainmainhas on this card too (listed on #1407).@Marvisak on GitHub · 2026-11-25 03:27 UTC · original · edited 2026-11-25 16:04 UTC
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-shader/src/emit/lower.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
@marquezinii on GitHub · 2026-11-25 04:41 UTC · original
Restacked on the new #1407 (head
f9fb9aa, onmain940d32f): #1407's single commit, then the loop commit. #1407 has dropped itsoutsidefallback, so the per-lane joins here no longer look at it either. A uniform loop's head joins and the forward joins checked edge by edge go intoper_lane_joins, and only those take in a number.On the CI failure: the
checkjob's failing tests aresynthetic_tests::gathers_at_a_level_match_the_hardwareandpermutes_read_the_lane_named_and_zero_from_lanes_left_out, which this branch does not touch. On an RTX 5070, plainmain940d32ffailsgathers_at_a_level…and twostride_teststhe same way. Here,cargo test -p victory-shader --locked -- lane_maskgives 9 passed,cargo clippy -p victory-shader --all-targets --locked -- -D warningsis clean, and the full crate gives 252 passed with only those 3mainfailures.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.