Shaders: multi-wave group_any widen, guarded resources, and s_setpc early-out strip #1124
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1124
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1124"
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?
@nameermohammedkhan-art on GitHub · 2026-11-25 20:42 UTC · original
nameermohammedkhan-art:pr/wave32-group-any-widen→main· +820 −97 · 6 files · 1 commits · openSummary
widento support multi-wave compute threadgroups (all_group_blocksconvergence +wave_widecross-wave LDS reduction forgroup_any/group_all).EXECguards inresource::Tracer::activeso resource provenance prunes unreachable lanes afterwithout_early_outsstripss_cbranch_execz/s_setpcearly-out paths (VICTORY_WAVE_DEEP_SKIPS=0disables).v_readfirstlane_b32narrowed byv_cmpx_eq_{i,u}32againstv_mbcnt(single_lane_readfirstlane).lower.rsunder the 512 KiBxtask policylimit by placing the group-convergence / singleton helpers incrates/victory-shader/src/emit/group_wide.rs.wave64_tests.rsandresource.rs.Validation
cargo xtask policy:asset policy: 184 files okcargo clippy -p victory-shader --all-targets -- -D warnings: passed (0 warnings)cargo test -p victory-shader --lib:220 passed; 0 failed; 3 ignored(includes hardware execution testmulti_wave_widen_runs_group_any_on_hardware)@Dathinel on GitHub · 2026-11-25 23:40 UTC · original · edited 2026-11-26 00:12 UTC
Runnable two-store regression and experimental fix: fixture, patch and reproduction commands. On
887d053, the RTX 3050 Laptop produced 4,096 unexpected writes inside the branch and 4,096 after the join. Guarding only the in-branch store left all 4,096 post-join errors. Selecting the incoming EXEC mask of each skipped guest wave at the join also removed those errors (33,280 output words checked). This is a single-block synthetic case; visual impact and complex control flow remain unverified.Correctness counterexample on PR head
887d053(RTX 3050 Laptop, native wave32). With the public translator and VICTORY_WAVE_WIDE=1, a guest wave with empty EXEC loses a live scalar value when the other guest wave takes the body. This matters if enabling multi-wave widening for additional shaders.Reproducer using the 128-thread per-lane variant below: preserve the per-thread byte offset in v9. Before s_and_saveexec_b64 initialize s7=5 (0xBE870385). Immediately after SAVEEXEC branch with s_cbranch_scc0 +20 (0xBF840014) over exactly WAVE_OR_V7_TO_S7. At the join restore EXEC from s[12:13], then copy s7 to v0 and store to each thread's own word. Keep the existing predicate t > threshold. With threshold 63, guest wave 0 skips all writes to s7 and must store 5 into words 0..63. It instead stores zero into all 64. Guest wave 1 produces the expected 0xffffffff. The retry diagnostic confirms wave-wide branches, wave Some(32).
Across thresholds 0..128 inclusive plus 200, precisely 63..126 fail, each by those first 64 words (4,096 of 16,640 comparisons). Both-active and both-empty controls pass. The earlier masked-store fixture below passed because it did not observe the scalar from an empty wave after reconvergence. Please retain the original rejection for this case until the per-wave scalar at the join is preserved. Synthetic fixture only, AI-assisted.
One additional hardware test case for
multi_wave_widen_runs_group_any_on_hardwareat887d053: keep the 128-thread group, set s0 to 32, and give each lane its own output word (preserve its thread index before overwriting v0). With the existingt > s0predicate and OR expression, lanes 0..32 should retain a sentinel, lanes 33..63 should write 0xffff0000, and lanes 64..127 should write 0xffffffff.I checked those expectations with a synthetic CPU reference and a deliberately group-wide OR. The latter differs on 31 words here, versus zero at the current thresholds of 96 and 200. Distinct output words also avoid the two active guest waves racing on the same address. This is a coverage suggestion; I have not observed incorrect output on the PR. AI-assisted.
Hardware follow-up at the same head: tested the per-lane variant on an RTX 3050 Laptop (native wave32), with a zero-initialized 128-word UAV, for every threshold from 0 through 128 and also 200. All 16,640 output words across 130 dispatches matched the per-guest-wave CPU expectation. Pipeline creation and dispatch were required for the test to pass. This covers correctness of the synthetic fixture only.
Public translation path, parent versus head on the same RTX: in the per-lane fixture above, replace s_cbranch_execz +23 (0xBF880017) immediately following s_and_saveexec_b64 with s_cbranch_scc0 +23 (0xBF840017). SAVEEXEC sets SCC according to whether the resulting EXEC is nonempty, so the expected lane outputs are unchanged. With VICTORY_WAVE_WIDE=1, parent
085ee7crefuses multi-wave widening and falls through to approximate local waves (threshold 0, lane 1: 0x0000ffff instead of 0xffffffff). Head887d053takes the wave-wide retry and passes all 16,640 word checks. With the switch unset both commits take the approximation and fail at that same lane. Under VICTORY_WAVE_LOCAL=idiom with widening enabled, the parent refuses translation and the head passes. This isolates a correctness improvement through translate() on native wave32. No frame-time or title-shader claim.@HAL9000RELOADED on GitHub · 2026-11-26 09:29 UTC · original
Dathinel's two-store regression on a second vendor: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2,
887d053on main46bf535+ #402 (Agility),VICTORY_WAVE_WIDE=1.wave32-exec-regression.patch: the retry reportswave Some(32)andmulti_wave_stores_respect_exec_after_the_joingives[4096, 4096], 2 runs of 2, the same counts as the RTX 3050.wave32-exec-candidate.patch: that test passes 2 of 2; with the switch set the wholevictory-shaderrun is 223 passed, 0 failed.So the counterexample is not NVIDIA-specific. The PR's own 5 new tests pass here too (221 passed, 0 failed without the patches, on main
32b31f7+ #402).AI-assisted (Claude Code): tests run on my machine, text drafted with Claude.
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.