shader: two console lanes a thread for wave64 groups on 32-lane hosts #180

Manually merged
github merged 3 commits from github-bot/gh-180 into gh-pr/180/base 2026-12-02 20:02:17 +00:00 AGit
Owner

@⁠360900 on GitHub · 2026-12-02 00:29 UTC · original
360900:feat/shader-wave64-pairs → main · +1408 −3557 · 19 files · 3 commits · merged 2026-12-02 20:00 UTC

What

Stacked on #169 (the first commit is that pull request's).

On a host of 32-lane waves, a console wave64 compute group of more than 32 threads that reads its wave runs two console lanes a host thread (emit/pairs.rs): thread t holds lanes t and t+32, so one 32-lane subgroup is one console wave.

  • Each instruction is lowered once per slot; every lane branch is taken wave-wide with EXEC as data; cross-lane operations run the host's once a half and combine; the host group has half the threads. LDS and s_barrier are as on a 64-lane host.
  • It applies where the program needs the console's lanes, reads a first lane not proven the same in every lane, or has LDS accesses that may meet without an s_barrier (pairs::sees_its_wave).
  • A program whose pair form resource tracking refuses translates as a 64-lane host keeps it, one console lane a thread, and says so in kept_per_lane.
  • It replaces the per-host-wave forms (with_local_waves, own_bits.rs, lds_flags.rs, the early-out and skip forms, exchange_halves) and their switches VICTORY_WAVE_LOCAL, VICTORY_WAVE_OWN_BITS, VICTORY_WAVE_DEEP_SKIPS, VICTORY_FIRSTLANE_OWN. All of them ran only behind host_max_wave() == 32.

The reference

No counterpart in the D3D12 path or vkd3d-proton. The console's wave is the reference: 64 lanes, lane order t.

Evidence

  • Default host, whole store (19,108 containers): 38,217 files byte for byte identical before and after, 21 kept per lane on both sides. By the code: every removed piece and the new gate sit behind host_max_wave() == 32.
  • --host 32,0, whole store: kept per lane 127 before, 21 after, the same 21 as on the 64-lane host; none fails; only compute output differs. All 2,734 compute programs compile in the driver with 32-lane subgroups (vk-xlcost).
  • Tests through the production emit: 242 unit tests; on the card under Proton 342 passed, 5 ignored (RTX 5080, NVIDIA 620.73.04, 32 lanes). 11 new pair_tests check against the console's result: ballots, a wave OR in a lane branch, a prefix sum, first-lane reads, lane permutes, v_writelane under a lane branch, thread ids over 3 group shapes, LDS with and without a barrier, the refused pair form.
  • In game on the build with the other NVIDIA pull requests: start, menus and the first minutes in the world, 420 s, no device loss. The rule-32 error "pipeline with a program whose lane branches stayed per lane": 60 hits before, 10 after (5 programs, each among the 64-lane host's 21).
  • Not shown: the on-card tests on RADV (no AMD card here); they run the 64-lane forms, whose code is unchanged.

Checklist (docs/AGENTS.md)

  • One topic (rule 31); docs/TASKS.md not edited (rule 29)
  • "Allow edits by maintainers" on; after review, no force-push and no close-and-reopen
  • No fallback or second path for a case that can't happen (rule 33); unexpected input fails loudly (rule 9)
  • Constants come from the console, the hardware or the title's data (rule 9b)
  • Every switch is listed, read in one place, and a bad value stops the start (rule 2): none added, four removed (toggles.txt, the cache key list)
  • Queues and other externally synchronized Vulkan objects are used under their lock (rule 35)
  • Every unsafe block has a // SAFETY: comment (rule 36): no new unsafe
  • Clippy clean; tests call the production code; TRANSLATOR_VERSION: 13 to 14 (rule 27)
  • Comments say what is true now and name functions, not line numbers (rule 3)
  • Nothing from the title, and no pointers to where non-free data can be found
**@⁠360900** on GitHub · 2026-12-02 00:29 UTC · [original](https://github.com/vktory6/VKtory/pull/180) `360900:feat/shader-wave64-pairs` → `main` · +1408 −3557 · 19 files · 3 commits · merged 2026-12-02 20:00 UTC ## What Stacked on #169 (the first commit is that pull request's). On a host of 32-lane waves, a console wave64 compute group of more than 32 threads that reads its wave runs two console lanes a host thread (`emit/pairs.rs`): thread t holds lanes t and t+32, so one 32-lane subgroup is one console wave. - Each instruction is lowered once per slot; every lane branch is taken wave-wide with EXEC as data; cross-lane operations run the host's once a half and combine; the host group has half the threads. LDS and `s_barrier` are as on a 64-lane host. - It applies where the program needs the console's lanes, reads a first lane not proven the same in every lane, or has LDS accesses that may meet without an `s_barrier` (`pairs::sees_its_wave`). - A program whose pair form resource tracking refuses translates as a 64-lane host keeps it, one console lane a thread, and says so in `kept_per_lane`. - It replaces the per-host-wave forms (`with_local_waves`, `own_bits.rs`, `lds_flags.rs`, the early-out and skip forms, `exchange_halves`) and their switches `VICTORY_WAVE_LOCAL`, `VICTORY_WAVE_OWN_BITS`, `VICTORY_WAVE_DEEP_SKIPS`, `VICTORY_FIRSTLANE_OWN`. All of them ran only behind `host_max_wave() == 32`. ## The reference No counterpart in the D3D12 path or vkd3d-proton. The console's wave is the reference: 64 lanes, lane order t. ## Evidence - Default host, whole store (19,108 containers): 38,217 files byte for byte identical before and after, 21 kept per lane on both sides. By the code: every removed piece and the new gate sit behind `host_max_wave() == 32`. - `--host 32,0`, whole store: kept per lane 127 before, 21 after, the same 21 as on the 64-lane host; none fails; only compute output differs. All 2,734 compute programs compile in the driver with 32-lane subgroups (`vk-xlcost`). - Tests through the production `emit`: 242 unit tests; on the card under Proton 342 passed, 5 ignored (RTX 5080, NVIDIA 620.73.04, 32 lanes). 11 new `pair_tests` check against the console's result: ballots, a wave OR in a lane branch, a prefix sum, first-lane reads, lane permutes, `v_writelane` under a lane branch, thread ids over 3 group shapes, LDS with and without a barrier, the refused pair form. - In game on the build with the other NVIDIA pull requests: start, menus and the first minutes in the world, 420 s, no device loss. The rule-32 error "pipeline with a program whose lane branches stayed per lane": 60 hits before, 10 after (5 programs, each among the 64-lane host's 21). - Not shown: the on-card tests on RADV (no AMD card here); they run the 64-lane forms, whose code is unchanged. ## Checklist (docs/AGENTS.md) - [x] One topic (rule 31); `docs/TASKS.md` not edited (rule 29) - [x] "Allow edits by maintainers" on; after review, no force-push and no close-and-reopen - [x] No fallback or second path for a case that can't happen (rule 33); unexpected input fails loudly (rule 9) - [x] Constants come from the console, the hardware or the title's data (rule 9b) - [x] Every switch is listed, read in one place, and a bad value stops the start (rule 2): none added, four removed (toggles.txt, the cache key list) - [x] Queues and other externally synchronized Vulkan objects are used under their lock (rule 35) - [x] Every `unsafe` block has a `// SAFETY:` comment (rule 36): no new `unsafe` - [x] Clippy clean; tests call the production code; `TRANSLATOR_VERSION`: 13 to 14 (rule 27) - [x] Comments say what is true now and name functions, not line numbers (rule 3) - [x] Nothing from the title, and no pointers to where non-free data can be found
vkback tells translate-dir, victory-gpu and dxil-probe its device (shader::Host): the widest subgroup and whether it is AMD hardware, the subgroup range and DenormPreserve support. The default host's DXIL is unchanged.
On a host of 32-lane waves, a wave64 compute group of more than 32 threads that reads its wave runs console lanes t and t+32 in host thread t: a 32-lane subgroup is one console wave. Replaces the per-host-wave forms and their switches (VICTORY_WAVE_LOCAL, VICTORY_WAVE_OWN_BITS, VICTORY_WAVE_DEEP_SKIPS, VICTORY_FIRSTLANE_OWN), which only ran for 32-lane hosts. The default host's DXIL is unchanged. TRANSLATOR_VERSION 14.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 00:31:58 +00:00
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
#	docs/learnings/shaders-dxil-spirv.md
github-bot changed target branch from main to gh-pr/180/base 2026-12-02 20:02:16 +00:00
github manually merged commit 4ad6a1b29c into gh-pr/180/base 2026-12-02 20:02:17 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 20:00 UTC · original

Merged, thanks. We merged main (with #169 in it) into your branch and kept TRANSLATOR_VERSION at 14. On the reference card: the whole-store DXIL diff translates all 19,112 shaders with 0 failures and 0 changed (wave64 groups stay native on RDNA), and the card tests pass (342). The 32-lane pairing only takes effect on 32-lane hosts, so the NVIDIA runs are its evidence; reports from such cards are welcome.

The wave model on 32-lane hosts is one of the topics in https://github.com/vktory6/VKtory/discussions/270 ("Where should the shader translator go next?").

**@⁠vktory6** on GitHub · 2026-12-02 20:00 UTC · [original](https://github.com/vktory6/VKtory/pull/180#issuecomment-7357069895) Merged, thanks. We merged main (with #169 in it) into your branch and kept `TRANSLATOR_VERSION` at 14. On the reference card: the whole-store DXIL diff translates all 19,112 shaders with 0 failures and 0 changed (wave64 groups stay native on RDNA), and the card tests pass (342). The 32-lane pairing only takes effect on 32-lane hosts, so the NVIDIA runs are its evidence; reports from such cards are welcome. The wave model on 32-lane hosts is one of the topics in https://github.com/vktory6/VKtory/discussions/270 ("Where should the shader translator go next?").
This discussion has been locked. Commenting is limited to contributors.
No description provided.