Shaders: groups of several console wave64s run in the console flow on 32-lane hosts (pair meetings) #3683

Open
neonbyte1 wants to merge 85 commits from upstream-pr/3683 into main
neonbyte1 commented 2026-11-28 06:16:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-28T06:16:14Z.


Draft, stacked on #439 (e2d3cfd). Only the last commit is new; please review that one. I'll rebase once #439 lands.

Problem

On a host without 64-lane waves (NVIDIA), #439's console flow runs a console wave64 as two 32-lane host waves ("halves"). The halves meet at group barriers to exchange lane masks and data. A thread group holding several console waves is refused ("console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves"): its console waves branch and loop differently, so no group barrier is reached by every thread. On the title's shader pack that refusal stops 44 compute programs on a 32-lane host. Among them are 19 tiled cascade and hair shadow programs, and 5 stages of the ray-tracing structure builder.

Change: pair meetings (emit/lower/pairs.rs)

The two halves of each console wave meet on their own, without a group barrier:

  • The meeting. Each console wave has an LDS counter. One lane of each half adds 1. Each half then reads the counter until it reaches the next even number. There is a group-shared fence before the count and after the wait.
  • What goes through meetings. Exchanges of masks read as data and of lane values (v_readlane, v_readfirstlane, v_mbcnt, s_bcnt1 of ballots), wave-wide branch decisions (execz/vccz/scc), and the order of the console wave's own LDS accesses (a meeting before each).
  • Exchange buffers. Two buffers of two dwords per console wave, alternating by meeting parity.
  • Title barriers. The title's s_barrier stays a group barrier. A program is refused unless every block holding one runs exactly once on every path (in no cycle, and post-dominating the entry). That keeps every barrier call in group-uniform control flow.
  • 2-D groups. A host need not give each host wave an aligned run of flat ids. So each host wave takes the next 32 console thread ids from an LDS ticket in the entry block, and each host wave holds exactly one half.
  • Safety net. A module where a value is used before the meeting that makes it is refused, not emitted (bitcode::defs_dominate_uses).
  • Refused as before: groups that aren't a whole number of console waves, and groups whose LDS leaves no room for the state (5 dwords per console wave, plus 1).
  • Switch. On by default. VICTORY_BVH_HALVES=0 (or translate --no-pair-meetings) turns it off, and the shader cache keys the two apart. Only programs that were refused before change (census below).

Why it's exact, and its limits

  • Same blocks, same order. In the console flow every branch decision is the console wave's own, exchanged, so both halves run the same blocks in the same order. When a half counts in for its k-th meeting, the counter reads 2k−2 or 2k−1, and it reaches 2k only once both halves have counted. What either half wrote to LDS before a meeting, the other reads after it.
  • Buffers aren't overwritten early. A half can't rewrite an exchange buffer before the meeting after next, and that meeting needs the other half to be past its reads.
  • Console waves are ordered only at the title's s_barrier, as on the console.
  • Poll limit (2^20). Each wait gives up after 2^20 polls, so a wait can never hang the GPU. In a correct run the limit must never trigger: the other half is at most one meeting step behind. Both halves leave a loop at LOOP_LIMIT on the same iteration, because the loop decision is exchanged [inference from the construction]. If it ever triggered, the results would be inexact. The test builder_meetings_end_far_below_the_poll_limit runs with the limit cut to 2^10 and is still exact. That bounds the waits; it doesn't instrument a give-up.
  • Forward progress. The wait is a spin on group-shared memory between two waves of one group. D3D12 doesn't promise forward progress there. It relies on the waves of a group being scheduled independently, which they are on the NVIDIA cards this is for [inference; measured only on an RTX 5090]. The 2^20 limit bounds the cost if they weren't.
  • UAV memory. Meetings fence group-shared memory only, like #439's exchange and LDS barriers. A UAV or title-memory write in one half isn't ordered before a read in the other half of the same console wave. That is the same as #439's console flow today; see the note on e2d3cfd below.

Measured

Offline census. Whole shader pack, victory translate <pack> --list --validate --host-lanes 32-32, this branch against #439 e2d3cfd:

  • Compute emitted goes from 2,593 to 2,619 of 2,682; validated from 1,858 to 1,884.
  • The 26 gained programs were all refused for the group size before, and all 26 validate. 0 lost.
  • The 25,590 programs emitted by both are byte-identical, and with --no-pair-meetings every program's outcome matches the base.
  • 18 more programs get past the group-size check but stay refused for other reasons: 12 have a title barrier not met once, 2 have a value used before its meeting, 2 have an exchange outside the block being lowered, and 2 have no LDS room.

Builder. On #439's current head the five builder stages that this PR otherwise translates are still refused, by e2d3cfd's title-memory limit (question for #439 below). With that limit lifted locally, the builder dll gives 52 of 52 stages emitted and validated for a 32-lane host, against 47 of 52 without this change.

In the title, on our integration tree, not on this branch. Setup: RTX 5090 (32-lane waves), Linux, Wine 11 with GE-Proton11-14's vkd3d-proton. The tree is our perf/bvh-halves branch (an older #439 without e2d3cfd, #2118, and an earlier version of this change): one adjacent pair of the same exe, VICTORY_BVH_HALVES 1 against 0, both with a warm pipeline library. (Edited 2026-11-29: this said fork main, and left the frame cost out.) Results:

  • The builder runs about 345 dispatches a frame instead of being held back.
  • The frame costs 76 ms more with the builder running (188.5 to 264.5 ms; preparing +51, on the GPU +16, copying back +9). The pair compares the builder running against held back, so that holds the builder's dispatches and what the ray-traced passes then do, not the meetings alone.
  • Dropped draws went from 375 to 34 a frame.
  • The captured frames show ray-traced shadows and lighting.
  • 0 crashes.

Those runs also contain other unmerged changes, so they show that the mechanism holds up in the title; they don't measure this PR alone.

Tests

In emit::pair_meeting_tests (GPU tests skip unless the hardware adapter runs 32-lane waves only):

  • several_console_waves_translate_with_pair_meetings (CPU). Without pair meetings a 256-thread group is refused, as before. With them it translates, unless the program's LDS fills 32 KiB. A 32..64 target gives identical output either way. Fails on #439 (refused).
  • a_lane_read_in_a_loop_each_console_wave_leaves_on_its_own (GPU). Hand-written GFX10, no title code. Groups of four console waves ([256,1] at lanes 5 and 40, [16,16], [8,16], [8,32]) run a loop each console wave leaves after a different count, with v_readlane across the halves inside it. Every lane is checked word for word against a CPU reference.
  • builder_programs_equal_the_console and builder_meetings_end_far_below_the_poll_limit (GPU). The title's five builder stages, loaded from the local disk (VICTORY_BVH_PROGRAMS, a directory of <hash>.dxbc files, never committed). They're compared against CPU references for a block scan, a digit histogram, and a block sort and scatter. Without the variable these tests skip; on #439's current head they also skip, with the title-memory reason.
  • split_tests, select_tests and each_adapter_gets_what_it_runs now expect groups of whole console waves to translate. A 96-thread group is still refused.

Results on RTX 5090, Wine with vkd3d-proton:

  • pair_meeting_tests: 4 passed.
  • With e2d3cfd's limit lifted locally, the five builder stages match word for word (8 seeds; 4 seeds at a 2^10 poll limit).
  • #2214's four multi-wave split tests, applied to this branch, pass too.
  • Whole victory-shader lib: 348 passed, 4 failed, 3 ignored. #439 e2d3cfd gives 344 passed with the same 4 failures (hosts_that_do_not_fuse_are_named, rounding_matches_the_hardware, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, stub_pipeline_is_created).
  • Checks: cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features, is clean, and cargo xtask policy is clean.

Not tested

  • This branch in the title (only our integration tree).
  • Native Windows, WARP, AMD or Intel adapters. The GPU tests only ran on an RTX 5090 under Wine.
  • The 26 newly translating title programs dispatched one by one. They're only covered through the same operation classes in the synthetic test.
  • A UAV write in one half read by the other: not ordered, and not tested.
  • A run where the 2^20 poll limit triggers.
  • #2214's reworked version (not up yet).

Overlap

  • #2214 (shawshanker18, draft, also on #439) lifts the same refusal with a different mechanism: group barriers paired by count. r4tedx's review on #1433 pointed out that those barriers sit in group-divergent control flow, which D3D12 leaves undefined, and a rework is in progress. This PR puts no group barrier in divergent flow: the halves meet through an LDS counter, and the title's s_barrier must be met once on every path. On the tests here both are exact. I ran #2214 b3efa1c on #439's head with our synthetic test and the builder stages, and this branch with #2214's four multi-wave tests, all on the same RTX 5090. So these tests can't tell the two apart. I'm happy to measure #2214's reworked version on the same programs and setup so maintainers can choose.
  • #2711 (moe-miau) is the approximate alternative: halves act as waves and a ballot's high dword is 0. Its builder stages hung the GPU (0x887A0006), and that PR holds the builder back. This PR exchanges both halves' words instead.
  • #2633 (chippy01) runs halves that trade at blocks every thread reaches, in groups where that holds. This PR covers the groups where console waves diverge.
  • #439 / #320 / #233 are the console flow this builds on. e2d3cfd's title-memory limit keeps the builder stages refused (see the question on #439).
  • #2118 is the builder's all-or-none gate. Once every builder stage translates it opens; it's still needed for robustness.
  • #385 note: #385's per-edge lane-mask phis together with #320's console flow crashed the title (+0x23cf683) as soon as the builder ran on our tree. A fix for that interaction is in our integration tree; it isn't part of this PR, and it matters if #385 merges.

Credit: the idea of half-wave pair meetings comes from trustno1-coder/VIctory-NVIDIA (fork PR #12; with_pair_meetings, Lower::meet, exchange_first; 2-D relabelling after wave_base, Vice-Tay c125c0c). It's re-implemented here on #439's console flow. That fork's FIRSTLANE_OWN shortcut (the host wave's own first lane taken as the console wave's) is not used; values are exchanged instead.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5537380732 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3683). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-28T06:16:14Z. --- **Draft, stacked on #439** (`e2d3cfd`). Only the last commit is new; please review that one. I'll rebase once #439 lands. ## Problem On a host without 64-lane waves (NVIDIA), #439's console flow runs a console wave64 as two 32-lane host waves ("halves"). The halves meet at group barriers to exchange lane masks and data. A thread group holding several console waves is refused ("console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves"): its console waves branch and loop differently, so no group barrier is reached by every thread. On the title's shader pack that refusal stops 44 compute programs on a 32-lane host. Among them are 19 tiled cascade and hair shadow programs, and 5 stages of the ray-tracing structure builder. ## Change: pair meetings (`emit/lower/pairs.rs`) The two halves of each console wave meet on their own, without a group barrier: - **The meeting.** Each console wave has an LDS counter. One lane of each half adds 1. Each half then reads the counter until it reaches the next even number. There is a group-shared fence before the count and after the wait. - **What goes through meetings.** Exchanges of masks read as data and of lane values (`v_readlane`, `v_readfirstlane`, `v_mbcnt`, `s_bcnt1` of ballots), wave-wide branch decisions (`execz`/`vccz`/`scc`), and the order of the console wave's own LDS accesses (a meeting before each). - **Exchange buffers.** Two buffers of two dwords per console wave, alternating by meeting parity. - **Title barriers.** The title's `s_barrier` stays a group barrier. A program is refused unless every block holding one runs exactly once on every path (in no cycle, and post-dominating the entry). That keeps every barrier call in group-uniform control flow. - **2-D groups.** A host need not give each host wave an aligned run of flat ids. So each host wave takes the next 32 console thread ids from an LDS ticket in the entry block, and each host wave holds exactly one half. - **Safety net.** A module where a value is used before the meeting that makes it is refused, not emitted (`bitcode::defs_dominate_uses`). - **Refused as before:** groups that aren't a whole number of console waves, and groups whose LDS leaves no room for the state (5 dwords per console wave, plus 1). - **Switch.** On by default. `VICTORY_BVH_HALVES=0` (or `translate --no-pair-meetings`) turns it off, and the shader cache keys the two apart. Only programs that were refused before change (census below). ## Why it's exact, and its limits - **Same blocks, same order.** In the console flow every branch decision is the console wave's own, exchanged, so both halves run the same blocks in the same order. When a half counts in for its k-th meeting, the counter reads 2k−2 or 2k−1, and it reaches 2k only once both halves have counted. What either half wrote to LDS before a meeting, the other reads after it. - **Buffers aren't overwritten early.** A half can't rewrite an exchange buffer before the meeting after next, and that meeting needs the other half to be past its reads. - **Console waves are ordered only at the title's `s_barrier`,** as on the console. - **Poll limit (2^20).** Each wait gives up after 2^20 polls, so a wait can never hang the GPU. In a correct run the limit must never trigger: the other half is at most one meeting step behind. Both halves leave a loop at `LOOP_LIMIT` on the same iteration, because the loop decision is exchanged [inference from the construction]. If it ever triggered, the results would be inexact. The test `builder_meetings_end_far_below_the_poll_limit` runs with the limit cut to 2^10 and is still exact. That bounds the waits; it doesn't instrument a give-up. - **Forward progress.** The wait is a spin on group-shared memory between two waves of one group. D3D12 doesn't promise forward progress there. It relies on the waves of a group being scheduled independently, which they are on the NVIDIA cards this is for [inference; measured only on an RTX 5090]. The 2^20 limit bounds the cost if they weren't. - **UAV memory.** Meetings fence group-shared memory only, like #439's exchange and LDS barriers. A UAV or title-memory write in one half isn't ordered before a read in the other half of the same console wave. That is the same as #439's console flow today; see the note on `e2d3cfd` below. ## Measured **Offline census.** Whole shader pack, `victory translate <pack> --list --validate --host-lanes 32-32`, this branch against #439 `e2d3cfd`: - Compute emitted goes from 2,593 to **2,619** of 2,682; validated from 1,858 to **1,884**. - The 26 gained programs were all refused for the group size before, and all 26 validate. 0 lost. - The 25,590 programs emitted by both are byte-identical, and with `--no-pair-meetings` every program's outcome matches the base. - 18 more programs get past the group-size check but stay refused for other reasons: 12 have a title barrier not met once, 2 have a value used before its meeting, 2 have an exchange outside the block being lowered, and 2 have no LDS room. **Builder.** On #439's current head the five builder stages that this PR otherwise translates are still refused, by `e2d3cfd`'s title-memory limit (question for #439 below). With that limit lifted locally, the builder dll gives 52 of 52 stages emitted and validated for a 32-lane host, against 47 of 52 without this change. **In the title, on our integration tree, not on this branch.** Setup: RTX 5090 (32-lane waves), Linux, Wine 11 with GE-Proton11-14's vkd3d-proton. The tree is our `perf/bvh-halves` branch (an older #439 without `e2d3cfd`, #2118, and an earlier version of this change): one adjacent pair of the same exe, `VICTORY_BVH_HALVES` 1 against 0, both with a warm pipeline library. (Edited 2026-11-29: this said fork `main`, and left the frame cost out.) Results: - The builder runs about 345 dispatches a frame instead of being held back. - **The frame costs 76 ms more with the builder running** (188.5 to 264.5 ms; preparing +51, on the GPU +16, copying back +9). The pair compares the builder running against held back, so that holds the builder's dispatches and what the ray-traced passes then do, not the meetings alone. - Dropped draws went from 375 to 34 a frame. - The captured frames show ray-traced shadows and lighting. - 0 crashes. Those runs also contain other unmerged changes, so they show that the mechanism holds up in the title; they don't measure this PR alone. ## Tests In `emit::pair_meeting_tests` (GPU tests skip unless the hardware adapter runs 32-lane waves only): - `several_console_waves_translate_with_pair_meetings` (CPU). Without pair meetings a 256-thread group is refused, as before. With them it translates, unless the program's LDS fills 32 KiB. A 32..64 target gives identical output either way. Fails on #439 (refused). - `a_lane_read_in_a_loop_each_console_wave_leaves_on_its_own` (GPU). Hand-written GFX10, no title code. Groups of four console waves ([256,1] at lanes 5 and 40, [16,16], [8,16], [8,32]) run a loop each console wave leaves after a different count, with `v_readlane` across the halves inside it. Every lane is checked word for word against a CPU reference. - `builder_programs_equal_the_console` and `builder_meetings_end_far_below_the_poll_limit` (GPU). The title's five builder stages, loaded from the local disk (`VICTORY_BVH_PROGRAMS`, a directory of `<hash>.dxbc` files, never committed). They're compared against CPU references for a block scan, a digit histogram, and a block sort and scatter. Without the variable these tests skip; on #439's current head they also skip, with the title-memory reason. - `split_tests`, `select_tests` and `each_adapter_gets_what_it_runs` now expect groups of whole console waves to translate. A 96-thread group is still refused. Results on RTX 5090, Wine with vkd3d-proton: - `pair_meeting_tests`: 4 passed. - With `e2d3cfd`'s limit lifted locally, the five builder stages match word for word (8 seeds; 4 seeds at a 2^10 poll limit). - #2214's four multi-wave split tests, applied to this branch, pass too. - Whole `victory-shader` lib: 348 passed, 4 failed, 3 ignored. #439 `e2d3cfd` gives 344 passed with the same 4 failures (`hosts_that_do_not_fuse_are_named`, `rounding_matches_the_hardware`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `stub_pipeline_is_created`). - Checks: `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features`, is clean, and `cargo xtask policy` is clean. ## Not tested - This branch in the title (only our integration tree). - Native Windows, WARP, AMD or Intel adapters. The GPU tests only ran on an RTX 5090 under Wine. - The 26 newly translating title programs dispatched one by one. They're only covered through the same operation classes in the synthetic test. - A UAV write in one half read by the other: not ordered, and not tested. - A run where the 2^20 poll limit triggers. - #2214's reworked version (not up yet). ## Overlap - **#2214** (shawshanker18, draft, also on #439) lifts the same refusal with a different mechanism: group barriers paired by count. r4tedx's review on #1433 pointed out that those barriers sit in group-divergent control flow, which D3D12 leaves undefined, and a rework is in progress. This PR puts no group barrier in divergent flow: the halves meet through an LDS counter, and the title's `s_barrier` must be met once on every path. On the tests here both are exact. I ran #2214 `b3efa1c` on #439's head with our synthetic test and the builder stages, and this branch with #2214's four multi-wave tests, all on the same RTX 5090. So these tests can't tell the two apart. I'm happy to measure #2214's reworked version on the same programs and setup so maintainers can choose. - **#2711** (moe-miau) is the approximate alternative: halves act as waves and a ballot's high dword is 0. Its builder stages hung the GPU (`0x887A0006`), and that PR holds the builder back. This PR exchanges both halves' words instead. - **#2633** (chippy01) runs halves that trade at blocks every thread reaches, in groups where that holds. This PR covers the groups where console waves diverge. - **#439 / #320 / #233** are the console flow this builds on. `e2d3cfd`'s title-memory limit keeps the builder stages refused (see the question on #439). - **#2118** is the builder's all-or-none gate. Once every builder stage translates it opens; it's still needed for robustness. - **#385** note: #385's per-edge lane-mask phis together with #320's console flow crashed the title (`+0x23cf683`) as soon as the builder ran on our tree. A fix for that interaction is in our integration tree; it isn't part of this PR, and it matters if #385 merges. **Credit:** the idea of half-wave pair meetings comes from trustno1-coder/VIctory-NVIDIA (fork PR #12; `with_pair_meetings`, `Lower::meet`, `exchange_first`; 2-D relabelling after `wave_base`, Vice-Tay c125c0c). It's re-implemented here on #439's console flow. That fork's `FIRSTLANE_OWN` shortcut (the host wave's own first lane taken as the console wave's) is not used; values are exchanged instead. _AI-assisted (Claude); measured on my machine, no game data shared._
Aniseto commented 2026-11-28 07:50:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Aniseto on 2026-11-28T07:50:39Z.


Ran the pair-meeting tests at 82f99f7 (draft, stacked on #439) on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build.

cargo test -p victory-shader --lib pair_meeting_tests -- --test-threads=1
4 passed; 0 failed; 0 ignored; 0 measured; 351 filtered out      (exit 0)

All four tests pass on a genuine 32-lane host, including several console waves translating with pair meetings and the builder meetings staying below the poll limit. They are translation-level tests; I did not run the title's 44 affected programs or a dispatch. The PR has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti.

Not tested: the title's shadow/builder shaders, a paired smoke run, the full workspace suite, release profile, AMD and Intel GPUs, native wave64 hosts, Wine, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7236196987 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3683#issuecomment-7236196987). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-28T07:50:39Z. --- Ran the pair-meeting tests at `82f99f7` (draft, stacked on #439) on an NVIDIA Blackwell desktop part: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build. ``` cargo test -p victory-shader --lib pair_meeting_tests -- --test-threads=1 4 passed; 0 failed; 0 ignored; 0 measured; 351 filtered out (exit 0) ``` All four tests pass on a genuine 32-lane host, including several console waves translating with pair meetings and the builder meetings staying below the poll limit. They are translation-level tests; I did not run the title's 44 affected programs or a dispatch. The PR has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti. Not tested: the title's shadow/builder shaders, a paired smoke run, the full workspace suite, release profile, AMD and Intel GPUs, native wave64 hosts, Wine, game data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
neonbyte1 commented 2026-11-28 07:52:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-28T07:52:34Z.


@Aniseto thanks, the first run on another card. Two notes on what the four tests cover:

  • a_lane_read_in_a_loop_each_console_wave_leaves_on_its_own does dispatch: when Host::new finds an SM 6.6 NVIDIA adapter, it runs on the GPU and compares against the expected values. If it can't find one, it prints skipped and passes. -- --nocapture shows which of the two happened on your 5070 Ti.
  • The two builder tests need the title's builder programs (VICTORY_BVH_PROGRAMS). Without them they print VICTORY_BVH_PROGRAMS not set; skipped, which is the right call with no game data.

A gap I found since opening this, which affects this PR and #439's console flow. Meetings and console-flow barriers fence group-shared memory only. A UAV write by one half of a console wave isn't ordered before a later read of the same address by the other half, though on the console that's plain program order. I wrote a synthetic test: lane 5 stores, then lane 40 loads the same dword, and the reverse. It ran 1024 groups × 16 dispatches per shape on an RTX 5090:

group stale reads, before with fix
64 threads (one console wave, console flow) 131 / 383 of 16384 0
128 threads (pair meetings) 13840 / 16455 of 32768 0
256 threads (pair meetings) 24384 / 34820 of 65536 0

The fix finds each UAV access that conflicts with an earlier one with no barrier between them, on any path. Before each such access the halves now meet with a group-scope UAV fence. Programs that don't write UAVs stay byte-identical. Over the whole pack: 0 programs lost, 308 compute programs change, and the rest are byte-identical. A switch VICTORY_UAV_ORDER=raw keeps only the read-after-write meetings (167 programs) as a cheaper second arm. The builder's programs read before they write, so the results above for them stand.

Branch (on my fork's integration, which carries #439 and these meetings): https://github.com/neonbyte1/VIctory/tree/suggest/console-flow-uav-order, commits 7797c99d9 and 5df170e23. I haven't measured its in-game cost yet. I'll fold it into this PR after an A/B, and report it on #439 too.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7236217374 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3683#issuecomment-7236217374). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-28T07:52:34Z. --- @Aniseto thanks, the first run on another card. Two notes on what the four tests cover: - `a_lane_read_in_a_loop_each_console_wave_leaves_on_its_own` does dispatch: when `Host::new` finds an SM 6.6 NVIDIA adapter, it runs on the GPU and compares against the expected values. If it can't find one, it prints `skipped` and passes. `-- --nocapture` shows which of the two happened on your 5070 Ti. - The two builder tests need the title's builder programs (`VICTORY_BVH_PROGRAMS`). Without them they print `VICTORY_BVH_PROGRAMS not set; skipped`, which is the right call with no game data. **A gap I found since opening this, which affects this PR and #439's console flow.** Meetings and console-flow barriers fence group-shared memory only. A UAV write by one half of a console wave isn't ordered before a later read of the same address by the other half, though on the console that's plain program order. I wrote a synthetic test: lane 5 stores, then lane 40 loads the same dword, and the reverse. It ran 1024 groups × 16 dispatches per shape on an RTX 5090: | group | stale reads, before | with fix | |---|---|---| | 64 threads (one console wave, console flow) | 131 / 383 of 16384 | 0 | | 128 threads (pair meetings) | 13840 / 16455 of 32768 | 0 | | 256 threads (pair meetings) | 24384 / 34820 of 65536 | 0 | **The fix** finds each UAV access that conflicts with an earlier one with no barrier between them, on any path. Before each such access the halves now meet with a group-scope UAV fence. Programs that don't write UAVs stay byte-identical. Over the whole pack: 0 programs lost, 308 compute programs change, and the rest are byte-identical. A switch `VICTORY_UAV_ORDER=raw` keeps only the read-after-write meetings (167 programs) as a cheaper second arm. The builder's programs read before they write, so the results above for them stand. Branch (on my fork's integration, which carries #439 and these meetings): https://github.com/neonbyte1/VIctory/tree/suggest/console-flow-uav-order, commits `7797c99d9` and `5df170e23`. I haven't measured its in-game cost yet. I'll fold it into this PR after an A/B, and report it on #439 too. _AI-assisted (Claude); measured on my machine, no game data shared._
neonbyte1 commented 2026-11-28 14:40:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-28T14:40:46Z.


In-game cost of the UAV-order fix I reported earlier. RTX 5090, Wine 11.22 + vkd3d-proton, A-B-A-B with 420 s per run on a quiet machine, same exe, switched with VICTORY_UAV_ORDER:

arm runs (ms per frame) average
off (no extra meetings) 210.2, 206.2 208.2
raw (read-after-write only) 212.9, 203.9 208.4
all (read-after-write, write-after-read, write-after-write) 213.1, 209.2 211.2

So all costs about 3 ms a frame (1.4 %), and raw costs no measurable time. Pictures and refusals were the same in every run.

Since then, the fix also covers the per-lane form and plain split halves. Both were exposed too: before the fix, 536 to 22,732 stale reads per shape in the synthetic test; after, 0. Programs with a conflict go to the console flow where it's allowed (about 460), and a small address analysis drops conflicts that provably can't alias. Over the pack: 0 programs lost, 785 compute programs change.

Branch: https://github.com/neonbyte1/VIctory/tree/suggest/uav-order-all-forms (its 3 commits on top of my fork's main).

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7240849801 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3683#issuecomment-7240849801). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-28T14:40:46Z. --- In-game cost of the UAV-order fix I reported earlier. RTX 5090, Wine 11.22 + vkd3d-proton, A-B-A-B with 420 s per run on a quiet machine, same exe, switched with `VICTORY_UAV_ORDER`: | arm | runs (ms per frame) | average | |---|---|---| | off (no extra meetings) | 210.2, 206.2 | 208.2 | | raw (read-after-write only) | 212.9, 203.9 | 208.4 | | all (read-after-write, write-after-read, write-after-write) | 213.1, 209.2 | **211.2** | So `all` costs about 3 ms a frame (1.4 %), and `raw` costs no measurable time. Pictures and refusals were the same in every run. Since then, the fix also covers the per-lane form and plain split halves. Both were exposed too: before the fix, 536 to 22,732 stale reads per shape in the synthetic test; after, 0. Programs with a conflict go to the console flow where it's allowed (about 460), and a small address analysis drops conflicts that provably can't alias. Over the pack: 0 programs lost, 785 compute programs change. Branch: https://github.com/neonbyte1/VIctory/tree/suggest/uav-order-all-forms (its 3 commits on top of my fork's `main`). _AI-assisted (Claude); measured on my machine, no game data shared._
neonbyte1 commented 2026-11-29 08:00:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-29T08:00:35Z.


A correction to this body, and where the measurement now lives.

  • The frame cost was missing. The in-title numbers above are one adjacent on/off pair of an earlier version of the mechanism on our perf/bvh-halves branch (the body said fork main): RTX 5090, Linux/Wine 11.22, vkd3d-proton of GE-Proton11-14, same exe, VICTORY_BVH_HALVES 1 against 0, both runs with a warm pipeline library. With the builder running (0 to about 345 dispatches a frame) 341 fewer draws are dropped a frame, and the frame costs 76 ms more: 188.5 to 264.5 ms (preparing +51, on the GPU +16, copying back +9). The pair compares the builder running against held back, so the 76 ms holds the builder's dispatches and what the ray-traced passes then do, not the meetings alone. I edited the body.
  • Still unmeasured: any game run of this branch (on #439 e2d3cfd the builder stages stay refused, so there is nothing for it to change in the title there), the 26 newly translating programs dispatched in the title, and a second pair.

Fork issue with the evidence table: https://github.com/neonbyte1/VIctory/issues/179 (RESULT: https://github.com/neonbyte1/VIctory/issues/179#issuecomment-7252785665). We now hold our own PRs to a rule there: a hardware test with an adjacent control before a PR leaves draft. This one does not meet it yet and stays a draft.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7252826467 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3683#issuecomment-7252826467). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-29T08:00:35Z. --- A correction to this body, and where the measurement now lives. - **The frame cost was missing.** The in-title numbers above are one adjacent on/off pair of an earlier version of the mechanism on our `perf/bvh-halves` branch (the body said fork `main`): RTX 5090, Linux/Wine 11.22, vkd3d-proton of GE-Proton11-14, same exe, `VICTORY_BVH_HALVES` 1 against 0, both runs with a warm pipeline library. With the builder running (0 to about 345 dispatches a frame) 341 fewer draws are dropped a frame, and **the frame costs 76 ms more: 188.5 to 264.5 ms** (preparing +51, on the GPU +16, copying back +9). The pair compares the builder running against held back, so the 76 ms holds the builder's dispatches and what the ray-traced passes then do, not the meetings alone. I edited the body. - **Still unmeasured:** any game run of this branch (on #439 `e2d3cfd` the builder stages stay refused, so there is nothing for it to change in the title there), the 26 newly translating programs dispatched in the title, and a second pair. Fork issue with the evidence table: https://github.com/neonbyte1/VIctory/issues/179 (`RESULT`: https://github.com/neonbyte1/VIctory/issues/179#issuecomment-7252785665). We now hold our own PRs to a rule there: a hardware test with an adjacent control before a PR leaves draft. This one does not meet it yet and stays a draft. _AI-assisted (Claude); measured on my machine, no game data shared._
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3683:upstream-pr/3683'
git switch 'upstream-pr/3683'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3683'
git switch 'upstream-pr/3683'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3683'
git switch 'upstream-pr/3683'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3683'
git switch 'main'
git merge --squash 'upstream-pr/3683'
git switch 'main'
git merge --ff-only 'upstream-pr/3683'
git switch 'main'
git merge 'upstream-pr/3683'
git push origin 'main'
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
Marvisak/VIctory!3683
No description provided.