Shaders: the SCC a waterfall loop's s_andn2_wrexec leaves is false after the loop #3016

Open
github-bot wants to merge 2 commits from github-bot/gh-3016 into main AGit
Owner

@⁠Anzymanz on GitHub · 2026-11-26 03:29 UTC · original
Anzymanz:waterfall-scc → main · +103 −1 · 2 files · 2 commits · open

AI disclosure: written with Claude Code (Claude Opus 5.5) at the request of the account owner, who reviews what goes out. The measurements below were run on our machine; no game data is included (hashes, counts and error text only).

Problem

The console compiler's waterfall loop runs, one pass per distinct value, the lanes holding the first active lane's value. Its form, as this PR's test writes it:

    s_mov_b32            s20, exec_lo
    s_mov_b32            s21, exec_lo
loop:
    v_readfirstlane_b32  s22, v1
    v_cmpx_eq_u32        s22, v1
    s_andn2_wrexec_b32   s21, s21       ; EXEC = s21 & ~EXEC, s21 = EXEC, SCC = EXEC != 0
    s_cbranch_execnz     loop
    s_mov_b32            exec_lo, s20
    s_cselect_b32        s23, s1, s2    ; reads the SCC the s_andn2_wrexec wrote

sop() refuses any SALU that writes EXEC, and the refusal marks every value the instruction writes, its SCC included, as a lane mask read as data. When a block after the loop reads that SCC (an s_cselect, s_cbranch_scc* or s_addc), the program is refused, though nothing reads a lane mask as a number.

Change

emit/lower.rs, sop(): when the instruction writing EXEC is an s_andn2_wrexec_b32/_b64 that is the second-last instruction of a block whose last is s_cbranch_execnz back to the same block, its SCC is the constant false. The loop is left only on its not-taken edge, that is once EXEC is 0, so EXEC != 0 is false wherever a later block reads it. If one of the loop block's own phis takes the SCC (a later iteration's, on the back edge), the old refusal stands. Its other writes (EXEC and the SGPR) stay a lane mask read as data, as before.

Tests

  • valu_tests::the_scc_a_waterfall_loop_leaves_is_false (GPU): the loop above over v1, then s_cselect_b32 s23, s1, s2 after it; s2 expected. Fails on main at lowering (a lane mask read as data); passes with this commit on an RX 9070 XT (RADV through vkd3d-proton, GE-Proton 11-14, DXC's dxil.dll).

Measured over the title's shader pack

All 25,889 distinct containers in shaders.rpf went through emit::translate_with offline, on main 63bcca4 and then with this commit:

main 63bcca4 + this
translated / refused 25,669 / 220 25,673 / 216
refused on a lane mask read as data 4 0
programs whose output changes 4 (827b309e779552d7, 82a2ad6d07417d36, 90a0692af4320129, 9ffcaff533995118, all refused before)

Every other program's output is byte-identical. Two of the four are the title's skinning kernels that put animated characters into the ray-tracing structures.

All four programs' DXIL converts with dxil-spirv (master). On main + #2348 + #2978 + #385 the same commit changes exactly four programs as well (a lane mask read as data: 202 → 198 refused there), with 0 going from translated to refused.

Windows test binary under Proton on the RX 9070 XT: 301 passed and 2 failed. The 2 failures (hosts_that_do_not_fuse_are_named, stub_pipeline_is_created) fail on main in the same environment too. cargo clippy -p victory-shader -- -D warnings is clean, cargo xtask policy is ok, and lower.rs is 521,918 bytes (+1,355 B).

Not run: the differential tests (no console compiler here) and NVIDIA.


🤖 Generated with Claude Code

**@⁠Anzymanz** on GitHub · 2026-11-26 03:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/3016) `Anzymanz:waterfall-scc` → `main` · +103 −1 · 2 files · 2 commits · open > **AI disclosure:** written with Claude Code (Claude Opus 5.5) at the request of the account owner, who reviews what goes out. The measurements below were run on our machine; no game data is included (hashes, counts and error text only). ## Problem The console compiler's waterfall loop runs, one pass per distinct value, the lanes holding the first active lane's value. Its form, as this PR's test writes it: ``` s_mov_b32 s20, exec_lo s_mov_b32 s21, exec_lo loop: v_readfirstlane_b32 s22, v1 v_cmpx_eq_u32 s22, v1 s_andn2_wrexec_b32 s21, s21 ; EXEC = s21 & ~EXEC, s21 = EXEC, SCC = EXEC != 0 s_cbranch_execnz loop s_mov_b32 exec_lo, s20 s_cselect_b32 s23, s1, s2 ; reads the SCC the s_andn2_wrexec wrote ``` `sop()` refuses any SALU that writes EXEC, and the refusal marks every value the instruction writes, its SCC included, as `a lane mask read as data`. When a block after the loop reads that SCC (an `s_cselect`, `s_cbranch_scc*` or `s_addc`), the program is refused, though nothing reads a lane mask as a number. ## Change `emit/lower.rs`, `sop()`: when the instruction writing EXEC is an `s_andn2_wrexec_b32/_b64` that is the second-last instruction of a block whose last is `s_cbranch_execnz` back to the same block, its SCC is the constant `false`. The loop is left only on its not-taken edge, that is once EXEC is 0, so `EXEC != 0` is false wherever a later block reads it. If one of the loop block's own phis takes the SCC (a later iteration's, on the back edge), the old refusal stands. Its other writes (EXEC and the SGPR) stay `a lane mask read as data`, as before. ## Tests - `valu_tests::the_scc_a_waterfall_loop_leaves_is_false` (GPU): the loop above over `v1`, then `s_cselect_b32 s23, s1, s2` after it; `s2` expected. Fails on main at lowering (`a lane mask read as data`); passes with this commit on an RX 9070 XT (RADV through vkd3d-proton, GE-Proton 11-14, DXC's `dxil.dll`). ## Measured over the title's shader pack All 25,889 distinct containers in `shaders.rpf` went through `emit::translate_with` offline, on main `63bcca4` and then with this commit: | | main `63bcca4` | + this | |---|---|---| | translated / refused | 25,669 / 220 | **25,673 / 216** | | refused on `a lane mask read as data` | 4 | **0** | | programs whose output changes | | **4** (`827b309e779552d7`, `82a2ad6d07417d36`, `90a0692af4320129`, `9ffcaff533995118`, all refused before) | Every other program's output is byte-identical. Two of the four are the title's skinning kernels that put animated characters into the ray-tracing structures. All four programs' DXIL converts with dxil-spirv (master). On main + #2348 + #2978 + #385 the same commit changes exactly four programs as well (`a lane mask read as data`: 202 → 198 refused there), with 0 going from translated to refused. Windows test binary under Proton on the RX 9070 XT: 301 passed and 2 failed. The 2 failures (`hosts_that_do_not_fuse_are_named`, `stub_pipeline_is_created`) fail on main in the same environment too. `cargo clippy -p victory-shader -- -D warnings` is clean, `cargo xtask policy` is ok, and `lower.rs` is 521,918 bytes (+1,355 B). Not run: the differential tests (no console compiler here) and NVIDIA. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The console compiler's waterfall loop (v_readfirstlane, v_cmpx_eq,
s_andn2_wrexec, s_cbranch_execnz back to the same block) is left only once
the s_andn2_wrexec leaves no lane, so the SCC it writes (EXEC != 0) is 0
wherever a block after the loop reads it. That SCC was refused with the
EXEC write ('a lane mask read as data'), and a later s_cselect or
s_cbranch_scc reading it stopped the program. It is now the constant false;
the loop's own phis taking it (a later iteration's) still refuse.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:20:11 +00:00
Review on #3016: a loop cut short by VICTORY_SHADER_LOOP_LIMIT leaves
through its normal exit with lanes still pending, so its SCC is not 0. The
fold now needs the loop to compare its v_readfirstlane result with the VGPR
that was read (each pass then drops at least the first lane, so it runs at
most 64 passes) and loop_limit() of at least 64; otherwise the old refusal
stands. A second GPU test runs the loop over 32 lanes with 1, 2, 8 and 32
distinct keys, so the back edge is taken.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 03:40 UTC · original

I extended the single-thread check to groups with 1, 2, 4 and 8 distinct keys. All 1,152 lane outputs per adapter matched on the RTX 5080, Windows built-in WARP and WARP 1.0.22 at 84a02d8. The 24 synthetic shader containers use both the 32-lane guest form (s_andn2_wrexec_b32) and the 64-lane guest form (_b64). Each lane saves its own key inside the loop, then writes a value that also depends on the exit flag. The three consumers were s_cselect_b32, s_cbranch_scc1 and s_addc_u32. The emitted DXIL validated. These are guest wave sizes; the RTX 5080 uses 32 physical lanes.

Parent 63bcca4 refused the new selected-key fixture at lowering with a lane mask read as data. A separate compile-only check exercises your guard: an s_cselect_b32 at the loop header reads the preceding iteration's SCC. The PR kept the refusal for this program. Removing the loop-phi check made the translator accept it, which the regression caught.

The test-only commit 672c4bc applies to your head. Run cargo test --locked -p victory-shader --lib waterfall_scc_tests -- --nocapture --test-threads=1. I also ran your original check, strict Clippy and asset policy. Your title-pack census remains the evidence for the four game shaders.

**@⁠steven-seagull27** on GitHub · 2026-11-26 03:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/3016#issuecomment-7181930093) I extended the single-thread check to groups with **1, 2, 4 and 8 distinct keys**. All **1,152 lane outputs per adapter** matched on the RTX 5080, Windows built-in WARP and WARP 1.0.22 at `84a02d8`. The 24 synthetic shader containers use both the 32-lane guest form (`s_andn2_wrexec_b32`) and the 64-lane guest form (`_b64`). Each lane saves its own key inside the loop, then writes a value that also depends on the exit flag. The three consumers were `s_cselect_b32`, `s_cbranch_scc1` and `s_addc_u32`. The emitted DXIL validated. These are guest wave sizes; the RTX 5080 uses 32 physical lanes. Parent `63bcca4` refused the new selected-key fixture at lowering with `a lane mask read as data`. A separate compile-only check exercises your guard: an `s_cselect_b32` at the loop header reads the preceding iteration's SCC. The PR kept the refusal for this program. Removing the loop-phi check made the translator accept it, which the regression caught. The [test-only commit `672c4bc`](https://github.com/steven-seagull27/VIctory/commit/672c4bc64c6f23ad1061e93a2c7c01435be2c65c) applies to your head. Run `cargo test --locked -p victory-shader --lib waterfall_scc_tests -- --nocapture --test-threads=1`. I also ran your original check, strict Clippy and asset policy. Your title-pack census remains the evidence for the four game shaders.
Author
Owner

@⁠zed6000 on GitHub · 2026-11-26 04:09 UTC · original

Measured offline on the title's shaders (the method in #1247): head 84a02d8 merged onto main 63bcca4 (a clean merge, security-reviewed first): +4, 0 lost. The 4 are compute programs that fail on main with emit: a lane mask read as data. They're the last 4 of that refusal on main, and exactly the 4 #2289 gained before it was closed for rework. cargo test -p victory-shader --lib --locked passes 303/0 on an RX 7900 XTX.

It also stacks. On top of #1924 (port) + #2978 + #385 + #2999 + #1737 on 63bcca4, it conflicts in emit/lower.rs where your s_andn2_wrexec helper and #1924's store_lds_outputs sit at the same spot. Keep both. The result is 26,011 of 26,084 programs validated (+1,161, 0 lost), and 334/0 tests. Offline counts only; no program names or data.

**@⁠zed6000** on GitHub · 2026-11-26 04:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/3016#issuecomment-7182350187) Measured offline on the title's shaders (the method in #1247): head `84a02d8` merged onto `main` `63bcca4` (a clean merge, security-reviewed first): **+4, 0 lost.** The 4 are compute programs that fail on `main` with `emit: a lane mask read as data`. They're the last 4 of that refusal on `main`, and exactly the 4 #2289 gained before it was closed for rework. `cargo test -p victory-shader --lib --locked` passes 303/0 on an RX 7900 XTX. It also stacks. On top of #1924 (port) + #2978 + #385 + #2999 + #1737 on `63bcca4`, it conflicts in `emit/lower.rs` where your `s_andn2_wrexec` helper and #1924's `store_lds_outputs` sit at the same spot. Keep both. The result is **26,011 of 26,084 programs validated (+1,161, 0 lost)**, and 334/0 tests. Offline counts only; no program names or data.
Author
Owner

@⁠Anzymanz on GitHub · 2026-11-26 04:43 UTC · original

Thanks all. @⁠fuzeofficlal, you're right about the limiter: a Branch loop cut short by VICTORY_SHADER_LOOP_LIMIT exits through its normal successor with lanes still pending (only Jump back edges go to the abort block), so SCC isn't 0 there. Fixed in 7872701 by narrowing the fold rather than changing the limiter:

  • The loop must be the keyed waterfall form: an instruction compares the v_readfirstlane_b32 result with the same VGPR value it read (v_cmpx_eq_* reading both). Each pass then drops at least the first active lane, so the loop runs at most 64 passes.
  • super::loop_limit() >= 64 is required, so the limiter can never cut such a loop short. With a smaller diagnostic limit, the old refusal stands.
  • The other conditions (self-loop closed by s_cbranch_execnz, the wrexec just before it, no phi of the block taking the SCC) are unchanged.

Multi-lane coverage. New the_scc_a_waterfall_loop_over_many_keys_leaves_is_false runs the loop over a 32-thread group keyed lane & s0 (1, 2, 8 and 32 distinct keys), so the back edge is taken up to 31 times before the SCC is read. Thanks @⁠steven-seagull27 for the much wider check (1/2/4/8 keys, b32/b64, three consumers) on an RTX 5080 and WARP. It adds try_build_valu_cs_lanes, the same edit #2978 makes, so the two merge cleanly in either order.

Re-measured (main 63bcca4 + 7872701), whole shader pack: refused 220 → 216, the same 4 programs as before (827b309e, 82a2ad6d, 90a0692a, 9ffcaff5; all keyed waterfalls, so the narrower check keeps them), every output identical to the first version, 0 programs lost. Both GPU tests pass on an RX 9070 XT (RADV via vkd3d-proton). The full Windows suite is at 302 passed and 2 failed; the 2 (hosts_that_do_not_fuse_are_named, stub_pipeline_is_created) fail on main in this environment too. cargo clippy -p victory-shader --all-targets -- -D warnings (Windows target) is clean, xtask policy is ok, and lower.rs is 522,757 B.

@⁠zed6000: thanks for the stacked numbers. Noted on the store_lds_outputs neighbour from #1924; keep both.

AI-assisted (Claude Code).

**@⁠Anzymanz** on GitHub · 2026-11-26 04:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/3016#issuecomment-7182848619) Thanks all. @⁠fuzeofficlal, you're right about the limiter: a `Branch` loop cut short by `VICTORY_SHADER_LOOP_LIMIT` exits through its normal successor with lanes still pending (only `Jump` back edges go to the abort block), so SCC isn't 0 there. Fixed in 7872701 by narrowing the fold rather than changing the limiter: - The loop must be the keyed waterfall form: an instruction compares the `v_readfirstlane_b32` result with the same VGPR value it read (`v_cmpx_eq_*` reading both). Each pass then drops at least the first active lane, so the loop runs at most 64 passes. - `super::loop_limit() >= 64` is required, so the limiter can never cut such a loop short. With a smaller diagnostic limit, the old refusal stands. - The other conditions (self-loop closed by `s_cbranch_execnz`, the wrexec just before it, no phi of the block taking the SCC) are unchanged. **Multi-lane coverage.** New `the_scc_a_waterfall_loop_over_many_keys_leaves_is_false` runs the loop over a 32-thread group keyed `lane & s0` (1, 2, 8 and 32 distinct keys), so the back edge is taken up to 31 times before the SCC is read. Thanks @⁠steven-seagull27 for the much wider check (1/2/4/8 keys, b32/b64, three consumers) on an RTX 5080 and WARP. It adds `try_build_valu_cs_lanes`, the same edit #2978 makes, so the two merge cleanly in either order. **Re-measured** (main `63bcca4` + 7872701), whole shader pack: refused 220 → 216, the same 4 programs as before (`827b309e`, `82a2ad6d`, `90a0692a`, `9ffcaff5`; all keyed waterfalls, so the narrower check keeps them), every output identical to the first version, 0 programs lost. Both GPU tests pass on an RX 9070 XT (RADV via vkd3d-proton). The full Windows suite is at 302 passed and 2 failed; the 2 (`hosts_that_do_not_fuse_are_named`, `stub_pipeline_is_created`) fail on main in this environment too. `cargo clippy -p victory-shader --all-targets -- -D warnings` (Windows target) is clean, `xtask policy` is ok, and `lower.rs` is 522,757 B. @⁠zed6000: thanks for the stacked numbers. Noted on the `store_lds_outputs` neighbour from #1924; keep both. AI-assisted (Claude Code).
Author
Owner

@⁠zed6000 on GitHub · 2026-11-26 04:54 UTC · original

Re-measured the narrowed head 7872701 on main 63bcca4: still +4, 0 lost, the same 4 programs as 84a02d8. cargo test -p victory-shader --lib --locked passes 304/0 on the RX 7900 XTX. So the narrower fold still covers this title's waterfall loops. Offline counts only; no program names or data.

**@⁠zed6000** on GitHub · 2026-11-26 04:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/3016#issuecomment-7183009340) Re-measured the narrowed head `7872701` on `main` `63bcca4`: still **+4, 0 lost**, the same 4 programs as `84a02d8`. `cargo test -p victory-shader --lib --locked` passes 304/0 on the RX 7900 XTX. So the narrower fold still covers this title's waterfall loops. Offline counts only; no program names or data.
Author
Owner

@⁠pawrenity on GitHub · 2026-11-26 05:04 UTC · original

VERIFY-3016: verified 7872701 on NVIDIA GeForce RTX 4070, Windows 11, and on WARP. The earlier verifications were at 84a02d8; this is the current head.

Review (reading). The fold matches the s_andn2_wrexec rule (EXEC = S0 & ~EXEC, D = EXEC, SCC = EXEC != 0). leaves_with_no_lane (crates/victory-shader/src/emit/lower.rs:3574) requires three things:

  • the wrexec is the second-last instruction;
  • s_cbranch_execnz is the last instruction and loops back to the same block;
  • the block exits only on the not-taken edge, where EXEC is 0, so the SCC is 0.

Two guards make the fold safe:

  • Loop limit. The counter belongs to each loop header, resets on forward entry (enter_loop) and increments on the back edge (count_iteration). The keyed v_readfirstlane/v_cmpx_eq_* form drops at least the first lane on each pass. Requiring loop_limit() >= 64 therefore means the limiter cannot end this loop early.
  • Back-edge phi. The guard on the block's own phis keeps a back-edge SCC refused.

I found no defects. One edge case: an f32/f16 key that is NaN never compares equal to itself, so no lane drops. That loop also never ends on hardware, so I don't count it as a defect.

Regression check. I put the PR's test hunk alone (valu_tests.rs) on origin/main 63bcca4. Both new tests fail at build with Unsupported { what: "a lane mask read as data" }.

At head:

  • the_scc_a_waterfall_loop_leaves_is_false and the_scc_a_waterfall_loop_over_many_keys_leaves_is_false pass on hardware and WARP. Neither backend was skipped.
  • Mutation 1. With the folded SCC changed from false to true, both tests fail. They check the value, not only that the shader compiles.
  • Mutation 2. I removed all three guards at once (keyed, loop_limit() >= 64, the phi check). The full victory-shader lib suite still gives 300 passed and the same 3 known failures. No test in this PR covers the guards. The test-only commit 672c4bc posted earlier covers the phi guard, but it is not in the PR.
  • cargo test --locked -p victory-shader --lib (one test skipped because it crashes the process on NVIDIA): 300 passed, 3 failed. The 3 (stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, synthetic_tests::gathers_at_a_level_match_the_hardware) also fail on main on this card.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings: clean.
  • A trial merge onto current origin/main 63bcca4 is clean.

Not checked: the shader-pack counts (no pack here) and the differential tests.

AI-assisted (Claude Code).

**@⁠pawrenity** on GitHub · 2026-11-26 05:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/3016#issuecomment-7183151313) VERIFY-3016: verified `7872701` on NVIDIA GeForce RTX 4070, Windows 11, and on WARP. The earlier verifications were at `84a02d8`; this is the current head. **Review (reading).** The fold matches the `s_andn2_wrexec` rule (EXEC = S0 & ~EXEC, D = EXEC, SCC = EXEC != 0). `leaves_with_no_lane` (`crates/victory-shader/src/emit/lower.rs:3574`) requires three things: - the wrexec is the second-last instruction; - `s_cbranch_execnz` is the last instruction and loops back to the same block; - the block exits only on the not-taken edge, where EXEC is 0, so the SCC is 0. Two guards make the fold safe: - **Loop limit.** The counter belongs to each loop header, resets on forward entry (`enter_loop`) and increments on the back edge (`count_iteration`). The keyed `v_readfirstlane`/`v_cmpx_eq_*` form drops at least the first lane on each pass. Requiring `loop_limit() >= 64` therefore means the limiter cannot end this loop early. - **Back-edge phi.** The guard on the block's own phis keeps a back-edge SCC refused. I found no defects. One edge case: an `f32`/`f16` key that is NaN never compares equal to itself, so no lane drops. That loop also never ends on hardware, so I don't count it as a defect. **Regression check.** I put the PR's test hunk alone (`valu_tests.rs`) on `origin/main` `63bcca4`. Both new tests fail at build with `Unsupported { what: "a lane mask read as data" }`. **At head:** - `the_scc_a_waterfall_loop_leaves_is_false` and `the_scc_a_waterfall_loop_over_many_keys_leaves_is_false` pass on hardware and WARP. Neither backend was skipped. - **Mutation 1.** With the folded SCC changed from `false` to `true`, both tests fail. They check the value, not only that the shader compiles. - **Mutation 2.** I removed all three guards at once (`keyed`, `loop_limit() >= 64`, the phi check). The full `victory-shader` lib suite still gives 300 passed and the same 3 known failures. No test in this PR covers the guards. The test-only commit `672c4bc` posted earlier covers the phi guard, but it is not in the PR. - `cargo test --locked -p victory-shader --lib` (one test skipped because it crashes the process on NVIDIA): 300 passed, 3 failed. The 3 (`stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`, `stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `synthetic_tests::gathers_at_a_level_match_the_hardware`) also fail on main on this card. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings`: clean. - A trial merge onto current `origin/main` `63bcca4` is clean. Not checked: the shader-pack counts (no pack here) and the differential tests. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 06:15 UTC · original

Automated triage for the maintainers.

In crates/victory-shader/src/emit/lower.rs, sop() now folds the SCC of an s_andn2_wrexec_b32/_b64 to false when it is the second-last instruction of a self-loop closed by s_cbranch_execnz. The new leaves_with_no_lane also requires the keyed waterfall form (v_readfirstlane_b32 result compared with the same VGPR value by v_cmpx_eq_*), loop_limit() >= 64, and no phi of the loop block taking that SCC. That follows the RDNA2 rule SCC = (EXEC != 0): the loop is left only on the not-taken edge, where EXEC is 0, and the limit guard covers the diagnostic limiter's early exit. The other writes stay refused as lane masks, as before. Two GPU tests in valu_tests.rs check the selected value, with 1 lane and with 32 lanes and several key counts. Title-pack counts posted by the author and a second contributor show +4, 0 lost. CI check: passing.

Suggestion, not a blocker: no test in the PR exercises the guards (a reviewer reports that removing all three leaves the suite green). Adding the phi-guard regression from the test-only commit offered in this thread would cover that.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 06:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/3016#issuecomment-7184245542) <!-- victory-triage v1 head=787270111490dde63d29e78bc4a428099c9515ad verdict=merge-candidate at=2026-11-26T06:15:09Z --> Automated triage for the maintainers. In `crates/victory-shader/src/emit/lower.rs`, `sop()` now folds the SCC of an `s_andn2_wrexec_b32/_b64` to `false` when it is the second-last instruction of a self-loop closed by `s_cbranch_execnz`. The new `leaves_with_no_lane` also requires the keyed waterfall form (`v_readfirstlane_b32` result compared with the same VGPR value by `v_cmpx_eq_*`), `loop_limit() >= 64`, and no phi of the loop block taking that SCC. That follows the RDNA2 rule SCC = (EXEC != 0): the loop is left only on the not-taken edge, where EXEC is 0, and the limit guard covers the diagnostic limiter's early exit. The other writes stay refused as lane masks, as before. Two GPU tests in `valu_tests.rs` check the selected value, with 1 lane and with 32 lanes and several key counts. Title-pack counts posted by the author and a second contributor show +4, 0 lost. CI `check`: passing. Suggestion, not a blocker: no test in the PR exercises the guards (a reviewer reports that removing all three leaves the suite green). Adding the phi-guard regression from the test-only commit offered in this thread would cover that. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3016/head:github-bot/gh-3016'
git switch 'github-bot/gh-3016'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3016'
git switch 'github-bot/gh-3016'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3016'
git switch 'github-bot/gh-3016'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3016'
git switch 'main'
git merge --squash 'github-bot/gh-3016'
git switch 'main'
git merge --ff-only 'github-bot/gh-3016'
git switch 'main'
git merge 'github-bot/gh-3016'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3016
No description provided.