Shaders: paired Wave64 form for the wave64 compute programs no wave32 form takes (6b82bc7d22016cb5, 6871d6e4b3ac9a10), opt-in with VICTORY_WAVE_PAIRS=1 #348

Open
github-bot wants to merge 5 commits from github-bot/gh-348 into main AGit
Owner

@⁠grosterr on GitHub · 2026-11-27 21:15 UTC · original
grosterr:pr/paired-wave64 → main · +3111 −144 · 11 files · 5 commits · open

On a 32-lane host the translator refuses some wave64 compute programs ("no wave32 lowering for this wave64 program") and their dispatches are dropped. #101 takes four of them wave-wide and names one that is left: 6b82bc7d22016cb5 (vfx_triangleClip:CS_CollectTriangles_Meshlets, groups of 1,024, LDS past the host's 32 KiB in the meeting forms). The water program 6871d6e4b3ac9a10 (water_shading:CS_TransmissionVolumetrics) is refused for another reason: a floating-point wave reduction with no exact wave32 tree.

This brings the paired form from fxceless/victory-fork: one host thread runs two console lanes (lane and lane+32), so a console wave of 64 is one host wave of 32 and its cross-lane operations stay inside the thread. It is off by default and taken only with VICTORY_WAVE_PAIRS=1, as a last form after the existing ones.

Commits (authorship kept):

  • f134f48 (ByFxbian) — the paired lowering, fxceless/victory-fork#1397 (b27e0b1), which builds on PiloteCode's #854. Merged by hand into this tree's lower.rs / mod.rs (lane_regions_of, wave_base with a step of 64 for the pair, console_thread); the dispatch-spread hook that tree had is left out (this tree has none).
  • a1c0f9d — ordered paired FP32 reductions, from fxceless#1419 (cb4f23b, ByFxbian), taken in part: its move of lds_meetings / signature packing into files of their own is left out, and its fast-math guard (this tree has no fast-math pass).
  • 36b16ba (ByFxbian) — fxceless#1419 8d1162e, as is.
  • e9c13e6 (fxceless) — water programs in paired form, their wave64 sums replayed exactly (e3307c7); exact_floats / Cast::FpExt kept, the fast-math part not applied.
  • ad29fe0 — what the two programs still needed here: LDS reached through Lower::ds in the paired form; a memory-only barrier(8) for groups over 64 threads and LDS slot 0 reused when the group's LDS already fills 32 KiB; paired_with reusing the caller's io/res and a last-resort paired_fallback (exact RNE/FTZ FP32 replay); the v_add_f64 simulation in wave.rs (+0.0 identity, s_mov_b64) and the dead inactive-lane vdst read of v_permlane[x]16_b32 inside the FP32 replay; #854's two paired tests; and VICTORY_WAVE_PAIRS / VICTORY_WAVE_PAIRS_FP32 in the shader cache key.

Measured (RTX 3060 12 GB, driver 621.40, shaders.rpf of 1.0.2.1):

  • With VICTORY_WAVE_PAIRS=1: both programs translate with a 32-lane wave, pass DXIL validation and CreateComputePipelineState (6b82bc7d22016cb5 → c2978aea83f25a9c, "paired Wave64"; 6871d6e4b3ac9a10 → 7bd41fa916dfb216, "paired Wave64" with VICTORY_WAVE_PAIRS_FP32=non-ieee-rne-ftz, the same DXIL through the fallback without it). Over the whole archive "no wave32 lowering for this wave64 program" goes from 22 to 0 (25,667 → 25,689 translated).
  • Without the switch: all 25,667 programs translated before are byte-identical to the base (the translator has not changed upstream since d12eb1b, the base of that comparison).
  • In the game (about an hour over several runs with the switch on, mostly Series S with DLSS): the warm cache had no wave64 refusals left. One device removal happened, on Series X with VRAM over its budget (10.7 / 10.7 GB); it was not traced to these programs, and none happened on Series S. No frame-time change could be told from run-to-run noise; picture effects of the two programs (meshlet triangle culling, water transmission) were not compared side by side.
  • The two programs on this branch: translate --warm with VICTORY_WAVE_PAIRS=1 finds both in the cache made by the same translator (0 do not translate).
  • Tests: cargo test -p victory-shader 299 passed, 0 failed; cargo test -p victory-gpu --lib -- --test-threads=1 422 passed, 2 failed: indirect::tests::host_list_budget_starts_empty_at_each_submission and warp_batch_charges_every_execution, which fail on main as well (#67 fixes them).

Complements #101. Without #101 this form also takes its four programs (they are among the 22 above); with #101 merged they take its wave-wide form first, since the paired form is only tried after the others, and 6b82bc7d22016cb5 and 6871d6e4b3ac9a10 are left to this one. Both are merged together in our test build.

🤖 Generated with Claude Code

**@⁠grosterr** on GitHub · 2026-11-27 21:15 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/348) `grosterr:pr/paired-wave64` → `main` · +3111 −144 · 11 files · 5 commits · open On a 32-lane host the translator refuses some wave64 compute programs ("no wave32 lowering for this wave64 program") and their dispatches are dropped. #101 takes four of them wave-wide and names one that is left: `6b82bc7d22016cb5` (`vfx_triangleClip:CS_CollectTriangles_Meshlets`, groups of 1,024, LDS past the host's 32 KiB in the meeting forms). The water program `6871d6e4b3ac9a10` (`water_shading:CS_TransmissionVolumetrics`) is refused for another reason: a floating-point wave reduction with no exact wave32 tree. This brings the **paired form** from fxceless/victory-fork: one host thread runs two console lanes (lane and lane+32), so a console wave of 64 is one host wave of 32 and its cross-lane operations stay inside the thread. It is **off by default** and taken only with `VICTORY_WAVE_PAIRS=1`, as a last form after the existing ones. **Commits (authorship kept):** - `f134f48` (ByFxbian) — the paired lowering, fxceless/victory-fork#1397 (`b27e0b1`), which builds on PiloteCode's #854. Merged by hand into this tree's `lower.rs` / `mod.rs` (`lane_regions_of`, `wave_base` with a step of 64 for the pair, `console_thread`); the dispatch-spread hook that tree had is left out (this tree has none). - `a1c0f9d` — ordered paired FP32 reductions, from fxceless#1419 (`cb4f23b`, ByFxbian), taken in part: its move of `lds_meetings` / signature packing into files of their own is left out, and its fast-math guard (this tree has no fast-math pass). - `36b16ba` (ByFxbian) — fxceless#1419 `8d1162e`, as is. - `e9c13e6` (fxceless) — water programs in paired form, their wave64 sums replayed exactly (`e3307c7`); `exact_floats` / `Cast::FpExt` kept, the fast-math part not applied. - `ad29fe0` — what the two programs still needed here: LDS reached through `Lower::ds` in the paired form; a memory-only `barrier(8)` for groups over 64 threads and LDS slot 0 reused when the group's LDS already fills 32 KiB; `paired_with` reusing the caller's io/res and a last-resort `paired_fallback` (exact RNE/FTZ FP32 replay); the `v_add_f64` simulation in `wave.rs` (+0.0 identity, `s_mov_b64`) and the dead inactive-lane `vdst` read of `v_permlane[x]16_b32` inside the FP32 replay; #854's two paired tests; and `VICTORY_WAVE_PAIRS` / `VICTORY_WAVE_PAIRS_FP32` in the shader cache key. **Measured (RTX 3060 12 GB, driver 621.40, `shaders.rpf` of 1.0.2.1):** - With `VICTORY_WAVE_PAIRS=1`: both programs translate with a 32-lane wave, pass DXIL validation and `CreateComputePipelineState` (`6b82bc7d22016cb5` → `c2978aea83f25a9c`, "paired Wave64"; `6871d6e4b3ac9a10` → `7bd41fa916dfb216`, "paired Wave64" with `VICTORY_WAVE_PAIRS_FP32=non-ieee-rne-ftz`, the same DXIL through the fallback without it). Over the whole archive "no wave32 lowering for this wave64 program" goes from 22 to 0 (25,667 → 25,689 translated). - Without the switch: all 25,667 programs translated before are **byte-identical** to the base (the translator has not changed upstream since `d12eb1b`, the base of that comparison). - In the game (about an hour over several runs with the switch on, mostly Series S with DLSS): the warm cache had no wave64 refusals left. One device removal happened, on Series X with VRAM over its budget (10.7 / 10.7 GB); it was not traced to these programs, and none happened on Series S. No frame-time change could be told from run-to-run noise; picture effects of the two programs (meshlet triangle culling, water transmission) were not compared side by side. - The two programs on this branch: `translate --warm` with `VICTORY_WAVE_PAIRS=1` finds both in the cache made by the same translator (0 do not translate). - Tests: `cargo test -p victory-shader` 299 passed, 0 failed; `cargo test -p victory-gpu --lib -- --test-threads=1` 422 passed, 2 failed: `indirect::tests::host_list_budget_starts_empty_at_each_submission` and `warp_batch_charges_every_execution`, which fail on `main` as well (#67 fixes them). Complements #101. Without #101 this form also takes its four programs (they are among the 22 above); with #101 merged they take its wave-wide form first, since the paired form is only tried after the others, and `6b82bc7d22016cb5` and `6871d6e4b3ac9a10` are left to this one. Both are merged together in our test build. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
(cherry picked from commit b27e0b1a8202939d7ee119a837a4242e82f197ae)
Carried over from cb4f23b the parts of the paired form: paired_fp32.rs (a
reduction section's FP32 adds, mins and maxes replayed in the console's
order, behind VICTORY_WAVE_PAIRS_FP32=non-ieee-rne-ftz), its hooks in
lower.rs, and the paired.rs and wave64_after_loop.rs changes (bpermute
semantics and tests). Left out: that commit's move of lds_meetings,
lane_constant_masks and the signature packing into files of their own,
which this tree's versions of them would lose; the moved code itself was
unchanged there. The fast-math guard is dropped: this tree has no such
pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 8d1162e31491ca8c462356e921b31f39ee99d58d)
(cherry picked from commit e3307c7727a604d8847ace8751cc6623bad26b5c)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port 5c5035e from victory-fork-n and adapt to VIctory-NVIDIA:
- Extend Lower::ds with bounds-checked LDS access for all LDS ops when paired_lds is active while keeping the non-paired instruction order byte-for-byte identical
- Emit memory-only barrier(8) in multi-wave (>64 threads) paired_inst and reuse LDS slot 0 when group LDS already fills 32 KiB
- Reuse caller (io, res) in paired_with and add last-resort paired_fallback (allowing exact RNE/FTZ paired FP32 replay when VICTORY_WAVE_PAIRS_FP32 is unset)
- Complete wave.rs v_add_f64 simulation (+0.0 identity, s_mov_b64, Red64F combine guard) and skip dead inactive-lane vdst fallback in v_permlane[x]16_b32 inside replay_paired_fp32
- Restore #854 paired tests in wave64_tests.rs and update 128-thread 32 KiB limit test
- Add VICTORY_WAVE_PAIRS and VICTORY_WAVE_PAIRS_FP32 to victory-gpu shader_cache key

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:17:48 +00:00
Author
Owner

@⁠ZanderOS1 on GitHub · 2026-11-27 22:12 UTC · original

Works on my build and now all 22 wave64 shaders now translate cleanly.

**@⁠ZanderOS1** on GitHub · 2026-11-27 22:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/348#issuecomment-7229127766) Works on my build and now all 22 wave64 shaders now translate cleanly.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/shader_cache.rs
  • crates/victory-shader/src/emit/host.rs
  • crates/victory-shader/src/emit/lower.rs
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.
git fetch -u origin '+refs/pull/348/head:github-bot/gh-348'
git switch 'github-bot/gh-348'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-348'
git switch 'github-bot/gh-348'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-348'
git switch 'github-bot/gh-348'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-348'
git switch 'main'
git merge --squash 'github-bot/gh-348'
git switch 'main'
git merge --ff-only 'github-bot/gh-348'
git switch 'main'
git merge 'github-bot/gh-348'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.