Shaders: skip cross-half exchange in active_f64_sum for local waves and groups <= 32 #461
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!461
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-461"
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?
@Fimpos on GitHub · 2026-11-25 01:13 UTC · original
Fimpos:fix/active-f64-sum-wave32→main· +116 −1 · 2 files · 1 commits · open## Problem
Lower::active_f64_sum(added in3bff182forv_add_f64whole-wave sums) checkedif self.exchange.is_some()directly instead of matchingwave_reduction's guard right above it (if !self.local && self.exchange.as_ref().is_some_and(|e| !e.1)).On 32-lane hosts (NVIDIA), that had two consequences for wave64 compute shaders containing
Shape::ActiveF64:with_local_waves/with_local_waves_any(self.local == true), divergent f64 sums still returnedErr("a wave reduction where not every lane runs")instead of taking the host wave's own sum, causing shaders such as5dc3b25986622949and6f225b641c5b0708to fail the local-wave retry (together with #190 /LOCAL_ANYthey now lower atWaveSize(32)and passCreateComputePipelineStateinstead of falling back toWaveSize(64)->E_INVALIDARG).group <= 32(e.1 == true), one host wave already holds the whole group, so no cross-half exchange should be emitted.Change
crates/victory-shader/src/emit/lower.rs: guard the cross-half exchange inLower::active_f64_sumwithif !self.local && self.exchange.as_ref().is_some_and(|e| !e.1), matchingLower::wave_reduction.crates/victory-shader/src/emit/wave64_tests.rs: addwave64_f64_sum_on_wave32_host_respects_small_groups_and_local_waves, covering both the 64-thread divergentwith_local_waves_anypath and a 32-thread wave64 group executed on the host GPU.Verification
cargo xtask policy: ok (169 files)cargo clippy -p victory-shader --tests -- -D warnings: cleancargo test -p victory-shader --lib wave64_f64_sum_on_wave32_host_respects_small_groups_and_local_waves: passed on Windows 11 + NVIDIA RTX 5070 (dxil.dllvalidation + hardware GPU dispatch)VICTORY_HOST_MAX_WAVE=32that5dc3b25986622949and6f225b641c5b0708get past the0x7e8/0x7f8a wave reduction where not every lane runsstop (and together with thescc_some/LOCAL_ANYwave32 fixes, both validate withdxil.dlland create D3D12 pipelines on RTX 5070).Related: #394
(AI-assisted fix & test; built and verified on real RTX 5070 hardware.)
@Yorivel on GitHub · 2026-11-25 01:47 UTC · original
Tested together with #190 and #156 on an RTX 4090 (32-lane, driver 621.40), on
a803c87:5dc3b25986622949and6f225b641c5b0708now lower atWaveSize(32)and create pipelines. Offline (VICTORY_HOST_MAX_WAVE=32 victory translate --validate --pipelines) and in game, both had beenE_INVALIDARGon every run before.Of the seven wave64 refusals of this scene, four remain:
2da4beb386509b77,2cc4c197ee29e291,02384a60fda6f2d0,6b82bc7d22016cb5. A fifth,369cbe906ea72764, is handled in #500.@HAL9000RELOADED on GitHub · 2026-11-25 19:29 UTC · original
RX 7900 XTX (RDNA3), Windows 10 + #402 for SM 6.6, main
d510ee4: the new testwave64_f64_sum_on_wave32_host_respects_small_groups_and_local_wavespasses on the card with this PR, and fails with the test alone on the base. No other test changed. Run table: #129 (#129).@Dathinel on GitHub · 2026-11-25 22:19 UTC · original
Independent synthetic readback on an RTX 3050 Laptop (Windows D3D12). I applied the active_f64_sum guard to our local Series S branch and adapted the PR fixture to require DXIL validation, successful PSO creation, and actual dispatch. Before the guard, lowering stopped at offset 220 with “a wave reduction where not every lane runs”. Afterward both variants validated and created pipelines. In the 32-thread variant, 1, 4, 16, 31 and 32 active lanes each contributing 1.25 produced exactly 1.25, 5, 20, 38.75 and 40. The 64-thread local variant was checked through pipeline creation only. On this PC WARP reports a maximum wave size of 4 and refuses the required WaveSize(32) PSO. No water rendering or performance comparison in this test. AI-assisted.
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.