Shaders: console waves' pair meetings stop writing when they run out, and do not wait for a half that left #1537

Merged
mizzied merged 1 commit from upstream-pr/1537 into main 2026-11-29 08:16:56 +00:00
mizzied commented 2026-11-28 21:23:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mizzied on 2026-11-28T21:23:14Z.


What was wrong. In the pair form of the wave64 translation (lower/pair.rs, meet_pair), a half whose wait for its partner ran out (MEETING_POLLS) carried on with values the other half had written for an older meeting, computed from them and stored the result. The group's output for that frame was stale rather than missing. The same form also waited for a half whose 32 lanes had all left the program.

The fix.

  • A half whose polls run out while the other half still runs notes its program in a root UAV (SLOT_PAIR_MISSES, keyed by an FNV-1a of the container), marks its console wave, and leaves the program with the whole host wave. A half that finds its partner marked leaves too. The output is missing for the frame, never stale.
  • Each console wave counts the lanes of each half that have left. A half with all 32 gone is not waited for, and what it would have given an exchange (lane mask, lane read, exchange_pairs) reads 0, as the console gives for lanes that have left.
  • Both only where pair_safe: dispatches counted in threads keep the old behaviour.
  • The first bind of a frame reads and clears the notes and logs pair exchanges that ran out: N this frame, by program hash (victory-gpu pairmiss.rs). The line names VICTORY_WAVE_PAIR_NOT=<hash,...> to keep programs out of the form; VICTORY_WAVE_PAIR=0 leaves the form out, and VICTORY_WAVE_WIDE=0 now also leaves out its last stage of the wave64 ladder.
  • Only programs that didn't translate before can change: programs another form takes translate byte for byte the same with this on or off.

How it was tested. RTX 5070, Windows 11. New card tests in wave64_tests.rs compare every thread with a reference: an OR in a lane branch, a lane count in a lane branch, a loop whose trip count differs by lane, and halves that left first. A pair that really runs out stores nothing and notes its program, and a counted dispatch has no note UAV. cargo test --workspace passes apart from repository_passes_policy, which already fails on main: lower.rs is over the 640 KiB file-size limit there (#1493 raises it). Clippy reports only the 16 findings already on main, none on lines this PR changes.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544702349 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1537). Originally posted by [mizzied](https://github.com/mizzied) on 2026-11-28T21:23:14Z. --- **What was wrong.** In the pair form of the wave64 translation (`lower/pair.rs`, `meet_pair`), a half whose wait for its partner ran out (`MEETING_POLLS`) carried on with values the other half had written for an *older* meeting, computed from them and stored the result. The group's output for that frame was stale rather than missing. The same form also waited for a half whose 32 lanes had all left the program. **The fix.** - A half whose polls run out while the other half still runs notes its program in a root UAV (`SLOT_PAIR_MISSES`, keyed by an FNV-1a of the container), marks its console wave, and leaves the program with the whole host wave. A half that finds its partner marked leaves too. The output is missing for the frame, never stale. - Each console wave counts the lanes of each half that have left. A half with all 32 gone is not waited for, and what it would have given an exchange (lane mask, lane read, `exchange_pairs`) reads 0, as the console gives for lanes that have left. - Both only where `pair_safe`: dispatches counted in threads keep the old behaviour. - The first bind of a frame reads and clears the notes and logs `pair exchanges that ran out: N this frame, by program hash` (`victory-gpu` `pairmiss.rs`). The line names `VICTORY_WAVE_PAIR_NOT=<hash,...>` to keep programs out of the form; `VICTORY_WAVE_PAIR=0` leaves the form out, and `VICTORY_WAVE_WIDE=0` now also leaves out its last stage of the wave64 ladder. - Only programs that didn't translate before can change: programs another form takes translate byte for byte the same with this on or off. **How it was tested.** RTX 5070, Windows 11. New card tests in `wave64_tests.rs` compare every thread with a reference: an OR in a lane branch, a lane count in a lane branch, a loop whose trip count differs by lane, and halves that left first. A pair that really runs out stores nothing and notes its program, and a counted dispatch has no note UAV. `cargo test --workspace` passes apart from `repository_passes_policy`, which already fails on `main`: `lower.rs` is over the 640 KiB file-size limit there (#1493 raises it). Clippy reports only the 16 findings already on `main`, none on lines this PR changes.
nick0451 commented 2026-11-28 22:35:39 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nick0451 on 2026-11-28T22:35:39Z.


Tested in play: RTX 3090 24 GB (driver 610.88), i9-14900K, Windows 11. A release build of this PR merged onto main 923e38c, run in turn with main and four other PR builds. Series S, DLSS Performance, frame generation off. The same frozen save, outdoors on a balcony, standing still. A warm-up start per build, then two rounds, each run 40 s to settle and 60 s measured, then a screenshot. Main: 25.4 and 24.8 fps, 10 compute programs refused (no wave32 lowering). I compare round 2 only, because round 1 was slow for every new build.

  • No crash in the measured runs, no device loss and no ERROR line. The picture matches main, and the same 10 programs are refused as on main, so nothing in this scene visibly depends on this change.
  • fps in round 2: 23.4 against 24.8-25.4 for main, within this setup's noise.
  • So this is a no-harm check; the case it fixes did not show in this scene.

The first start of every new build in this session crashed while loading at +0x23cf683 (main and all five PRs alike; see #628), so that is not from this change.

Tested with an AI assistant (Claude Code); results are from this PC.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246845163 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1537#issuecomment-7246845163). Originally posted by [nick0451](https://github.com/nick0451) on 2026-11-28T22:35:39Z. --- Tested in play: RTX 3090 24 GB (driver 610.88), i9-14900K, Windows 11. A release build of this PR merged onto main `923e38c`, run in turn with main and four other PR builds. Series S, DLSS Performance, frame generation off. The same frozen save, outdoors on a balcony, standing still. A warm-up start per build, then two rounds, each run 40 s to settle and 60 s measured, then a screenshot. Main: 25.4 and 24.8 fps, 10 compute programs refused (`no wave32 lowering`). I compare round 2 only, because round 1 was slow for every new build. - No crash in the measured runs, no device loss and no `ERROR` line. The picture matches main, and the same 10 programs are refused as on main, so nothing in this scene visibly depends on this change. - fps in round 2: 23.4 against 24.8-25.4 for main, within this setup's noise. - So this is a no-harm check; the case it fixes did not show in this scene. The first start of every new build in this session crashed while loading at `+0x23cf683` (main and all five PRs alike; see #628), so that is not from this change. Tested with an AI assistant (Claude Code); results are from this PC.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!1537
No description provided.