Let the console waves of a group take wave-wide branches apart #5

Closed
github-bot wants to merge 5 commits from gh-pr/5/head into gh-pr/5/base
Owner

@⁠TaynanGT on GitHub · 2026-11-25 08:47 UTC · original
TaynanGT:claude/pair-meetings → local/fxceless-render · +397 −16 · 6 files · 5 commits · closed without merging

What and why

Console compute programs built for 64-lane waves are refused by the NVIDIA driver (WaveSize(64), E_INVALIDARG) when their cross-lane code spans the whole console wave, so every dispatch of them is dropped. The wave-wide form (VICTORY_WAVE_WIDE_ONLY) already ran such programs as two 32-lane host waves, but only in thread groups of one console wave. This PR extends it to groups of several console waves, which covers three more programs of the first room, among them the cascade shadows of alpha-tested casters.

Full write-up: docs/wave64-on-wave32.md.

How it works

  • In a group of several console waves, each console wave takes wave-wide branches on its own, so a group barrier inside one would wait forever. The two host waves of each console wave now meet only each other: a per-console-wave LDS counter, the first wave to arrive spins until the other does (lower.rs, pair_wait), with LDS fences on both sides and a spin limit (wrong values rather than a hung GPU).
  • Module::split_before (bitcode.rs) places the wait between the code emitted so far and the current block, so callers that hold the current block keep emitting after the wait.
  • A lane mask from an earlier block is exchanged where it is used, where every lane of the console wave runs.
  • Programs named in VICTORY_WAVE_WIDE_ONLY whose LDS already fills 32 KiB put the meeting dwords over their last ones (shortcut, used by 6b82bc7d).
  • Gated: groups of several console waves take the wave-wide form only with VICTORY_WAVE_WIDE_ONLY (or VICTORY_WAVE_WIDE=1), so default behaviour does not change.

Results

Offline (victory translate --validate --pipelines, RTX 4090): 8 of the 9 WaveSize 64 programs of the first room translate, validate and create pipelines; new are 02384a60, 6b82bc7d and f133e35e.

Live, first room, same binary, only the list differs, 25 s per run:

Run Wave-wide list FPS ms/frame Refused pipelines Image
control 1 4 programs 7.2 138 3 clean
control 2 4 programs 6.9 145 3 posterized
change 1 8 programs 6.6 151 1 posterized
change 2 8 programs 6.3 159 1 posterized

About 8% slower because three more programs run. No device loss. The posterized image also appears in control runs (intermittent, not caused by this change).

List for the first room:

VICTORY_WAVE_WIDE_ONLY=6f225b641c5b0708,5dc3b25986622949,369cbe906ea72764,2cc4c197ee29e291,926c46bab3b86bd6,02384a60fda6f2d0,6b82bc7d22016cb5,f133e35efed2a48a

Tests

  • cargo test --release -p victory-shader: 272 passed, 2 ignored, after the merge of local/fxceless-render.
  • New two_console_waves_take_a_wave_wide_branch_apart: a 128-thread group in which only the first console wave takes the branch; ran on the RTX 4090.
  • cargo clippy clean; asset policy: 192 files ok. CI green.

Known limits

  • 2da4beb3 (alpha transmission prefilter) still fails: it builds a sampler inside a region the console skips when no lane runs it.
  • The LDS overlap for 6b82bc7d assumes the program does not reach its last bytes.

🤖 Generated with Claude Code

**@⁠TaynanGT** on GitHub · 2026-11-25 08:47 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/5) `TaynanGT:claude/pair-meetings` → `local/fxceless-render` · +397 −16 · 6 files · 5 commits · closed without merging ## What and why Console compute programs built for 64-lane waves are refused by the NVIDIA driver (`WaveSize(64)`, `E_INVALIDARG`) when their cross-lane code spans the whole console wave, so every dispatch of them is dropped. The wave-wide form (`VICTORY_WAVE_WIDE_ONLY`) already ran such programs as two 32-lane host waves, but only in thread groups of one console wave. This PR extends it to groups of several console waves, which covers three more programs of the first room, among them the cascade shadows of alpha-tested casters. Full write-up: [`docs/wave64-on-wave32.md`](../blob/claude/pair-meetings/docs/wave64-on-wave32.md). ## How it works - In a group of several console waves, each console wave takes wave-wide branches on its own, so a group barrier inside one would wait forever. The two host waves of each console wave now meet only each other: a per-console-wave LDS counter, the first wave to arrive spins until the other does (`lower.rs`, `pair_wait`), with LDS fences on both sides and a spin limit (wrong values rather than a hung GPU). - `Module::split_before` (`bitcode.rs`) places the wait between the code emitted so far and the current block, so callers that hold the current block keep emitting after the wait. - A lane mask from an earlier block is exchanged where it is used, where every lane of the console wave runs. - Programs named in `VICTORY_WAVE_WIDE_ONLY` whose LDS already fills 32 KiB put the meeting dwords over their last ones (shortcut, used by `6b82bc7d`). - Gated: groups of several console waves take the wave-wide form only with `VICTORY_WAVE_WIDE_ONLY` (or `VICTORY_WAVE_WIDE=1`), so default behaviour does not change. ## Results Offline (`victory translate --validate --pipelines`, RTX 4090): 8 of the 9 WaveSize 64 programs of the first room translate, validate and create pipelines; new are `02384a60`, `6b82bc7d` and `f133e35e`. Live, first room, same binary, only the list differs, 25 s per run: | Run | Wave-wide list | FPS | ms/frame | Refused pipelines | Image | |---|---|---|---|---|---| | control 1 | 4 programs | 7.2 | 138 | 3 | clean | | control 2 | 4 programs | 6.9 | 145 | 3 | posterized | | change 1 | 8 programs | 6.6 | 151 | 1 | posterized | | change 2 | 8 programs | 6.3 | 159 | 1 | posterized | About 8% slower because three more programs run. No device loss. The posterized image also appears in control runs (intermittent, not caused by this change). List for the first room: ``` VICTORY_WAVE_WIDE_ONLY=6f225b641c5b0708,5dc3b25986622949,369cbe906ea72764,2cc4c197ee29e291,926c46bab3b86bd6,02384a60fda6f2d0,6b82bc7d22016cb5,f133e35efed2a48a ``` ## Tests - `cargo test --release -p victory-shader`: 272 passed, 2 ignored, after the merge of `local/fxceless-render`. - New `two_console_waves_take_a_wave_wide_branch_apart`: a 128-thread group in which only the first console wave takes the branch; ran on the RTX 4090. - `cargo clippy` clean; asset policy: 192 files ok. CI green. ## Known limits - `2da4beb3` (alpha transmission prefilter) still fails: it builds a sampler inside a region the console skips when no lane runs it. - The LDS overlap for `6b82bc7d` assumes the program does not reach its last bytes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A wave64 program on a 32-lane host runs each console wave as two host
waves. In a group of several console waves, each console wave takes a
wave-wide branch on its own, so a group barrier inside the branch waits
for waves that never arrive. The two host waves of a console wave now
meet through an LDS counter of their own instead: the first to arrive
spins until the other does, with a spin limit so a missing partner
gives wrong values rather than a hung GPU.

Programs named in VICTORY_WAVE_WIDE_ONLY whose LDS already fills
32 KiB place these dwords over their last ones (6b82bc7d uses its LDS
as a bitset that is read from the start).

Offline on an RTX 4090, 8 of the 9 WaveSize 64 compute programs the
driver refused or translated approximately now translate, validate and
create pipelines; 02384a60, 6b82bc7d and f133e35e are new. 2da4beb3
still fails: it builds a sampler inside a region it can skip.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/wave64-on-wave32.md: why the driver refuses WaveSize 64, how the
translator places a console wave on two host waves, the wave-wide form,
pair meetings for groups of several console waves and the LDS budget,
the switches, the first room's programs with their state, offline and
live results, known gaps and the test. The README's shader row links it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:57:14 +00:00
github-bot closed this pull request 2026-11-26 05:57:14 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-25 08:47 UTC · original

Comentário original de TaynanGT em 11/25/2026 08:35:11. Ver original.

Live results, first room, same binary (`6c79b66`), only `VICTORY_WAVE_WIDE_ONLY` differs, 25 s per run after the room is steady:

| Run | Wave-wide list | FPS | ms/frame | Refused pipelines | Image |
|---|---|---|---|---|---|
| control 1 | 4 programs | 7.2 | 138 | 3 | clean |
| control 2 | 4 programs | 6.9 | 145 | 3 | posterized |
| change 1 | 8 programs | 6.6 | 151 | 1 | posterized |
| change 2 | 8 programs | 6.3 | 159 | 1 | posterized |

- About 8% slower with the change: three more compute programs run (shadows and VFX triangle clipping) instead of being dropped.
- No device loss in any run.
- The posterized image also shows in a control run, so it is the intermittent defect seen before, not this change.

**@⁠TaynanGT** on GitHub · 2026-11-25 08:47 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/5#issuecomment-7157479941) Comentário original de `TaynanGT` em 11/25/2026 08:35:11. [Ver original](https://github.com/TaynanGT/victory-windows/pull/5#issuecomment-7157220765). ``` Live results, first room, same binary (`6c79b66`), only `VICTORY_WAVE_WIDE_ONLY` differs, 25 s per run after the room is steady: | Run | Wave-wide list | FPS | ms/frame | Refused pipelines | Image | |---|---|---|---|---|---| | control 1 | 4 programs | 7.2 | 138 | 3 | clean | | control 2 | 4 programs | 6.9 | 145 | 3 | posterized | | change 1 | 8 programs | 6.6 | 151 | 1 | posterized | | change 2 | 8 programs | 6.3 | 159 | 1 | posterized | - About 8% slower with the change: three more compute programs run (shadows and VFX triangle clipping) instead of being dropped. - No device loss in any run. - The posterized image also shows in a control run, so it is the intermittent defect seen before, not this change. ``` <!-- migracao:comentario-7157220765 -->
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-25 09:06 UTC · original

After the merge of local/fxceless-render (dee2deb): cargo test --release -p victory-shader 272 passed, 2 ignored, including two_console_waves_take_a_wave_wide_branch_apart on the RTX 4090.

**@⁠TaynanGT** on GitHub · 2026-11-25 09:06 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/5#issuecomment-7157874282) After the merge of `local/fxceless-render` (`dee2deb`): `cargo test --release -p victory-shader` 272 passed, 2 ignored, including `two_console_waves_take_a_wave_wide_branch_apart` on the RTX 4090.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-25 19:21 UTC · original · edited 2026-11-25 20:01 UTC

Moved into #11, which holds all of this work on one branch, since merged into main.

**@⁠TaynanGT** on GitHub · 2026-11-25 19:21 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/5#issuecomment-7172179030) · edited 2026-11-25 20:01 UTC Moved into #11, which holds all of this work on one branch, since merged into `main`.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.