Shaders: one console wave sharing LDS runs in the console flow on 32-lane hosts #439

Open
github-bot wants to merge 84 commits from github-bot/gh-439 into main AGit
Owner

@⁠r4tedx on GitHub · 2026-11-24 03:24 UTC · original
r4tedx:shader/console-flow-lds → main · +4907 −1464 · 28 files · 84 commits · open

Needs a BVH builder gate when merged alone. This PR makes some BVH builder programs translate while a sibling stage can stay refused on a 32-lane host. A half-run builder crashed the title at load in neonbyte1's runs (see the comment below and #2118, comment 7179788584). Merge it together with, or after, an all-or-none builder gate such as #2118.

Current head e2d3cfd (2026-11-26), on top of e9f18c9 below, still with main at 63bcca4. New since e9f18c9: the placed-UAV test fix merged up from #223; steven-seagull27's partial-group reductions and f16 whole-wave sums from fork PR #19 (611184e, f968c54, author kept) and 2658128; e2d3cfd keeps LDS, whole-wave sections and *permute* in halves out of programs that reach title memory (root_memory, from latentdev's patch). An earlier commit on top, 7587052, was removed from the branch by a force-push: its test encodings were taken from one of the title's programs, which the asset policy does not allow. At 2658128, WARP only: cargo xtask policy ok, clippy clean, VICTORY_WARP=1 cargo test --locked -p victory-shader --lib -- --test-threads=1 343 passed, 4 failed, 3 ignored (the same 4 main failures as below). Nobody has run these split tests on 32-lane hardware at this head. No title run for this update.

At e9f18c9, merged with main at 63bcca4 (merges only, no rebase: main into #223, then each PR's new head into the one above it). With main's growth, crates/victory-shader/src/emit/lower.rs would pass the asset policy's 512 KiB limit, so #233 first moves lower.rs's inline tests into emit/lower/tests.rs, unchanged but for one indent level, (desplmfao's idea, beside main's emit/lower/bvh.rs). Here lower.rs is 506,583 bytes. The conflict resolutions follow kawaii-shakal's notes, and each merge commit lists them. Local verification at this head and at the head of each PR under it, on Windows 11 with the software renderer only (WARP, no hardware adapter for this update): cargo xtask policy ok; cargo clippy --locked -p victory-shader --all-targets -- -D warnings clean; VICTORY_WARP=1 cargo test --locked -p victory-shader --lib -- --test-threads=1: 341 passed, 4 failed, 3 ignored. The 4 failures are main's own: on main 63bcca4 the same command gives 298 passed and the same 4 failed. They are synthetic_tests whose "hardware" pass VICTORY_WARP=1 puts on WARP. No title run for this update. AI-assisted (Claude).

Stacked on #320, which is on #233, which is on #223. They are one line of work and merge in that order; each PR's diff contains the ones under it. The commits that are new here start at 7388024 (table below). Head: e2d3cfd.

History, 2026-11-24: The whole stack was rebased onto main 8e79c80 on 2026-11-24 (upstream merged about 55 PRs that day and added CI). New upstream tests call emit and build lower::Parts directly, so the wave-range argument and the two fields this stack adds are given to them in the commits that introduce them (in #223, #233 and #320). CI's first run on these PRs failed in tests, not in clippy: GitHub's runner has no GPU and lists Windows' software renderer (4-lane waves) as an adapter, and tests here assumed every listed adapter runs 32-lane waves. The tests are fixed where they were introduced: the hardware-adapter list leaves that renderer out by its ids and name, and the one test that takes the default device accepts a host without 32-lane waves. No translator code changed. The test-only commit e6936e3 (the lane-read loop test skips hosts without SM 6.6) is folded into #320, where that test is added, so 16 commits are new here. Each commit builds on its own. The head before the rebases was 055aef9. Commit ids in testers' reports below and in older comments are from before the rebases; the table gives each commit's old id.

No new features will be added to this PR. It has grown as testers and contributors reported things; from here it only gets fixes for what review finds. The next step of the work (groups of more than 64 threads) is on a fork branch and is not part of this.

What

#233 runs console wave64 compute programs on hosts without 64-lane waves (NVIDIA) as two 32-lane waves, in the "console flow" where a program needs its whole wave. It still stopped programs that share LDS inside one wave, and a few other forms. This PR takes those:

  • One console wave sharing LDS without s_barrier. The console runs an instruction in all 64 lanes before the next, so a lane reads what another lane wrote one instruction earlier. In the console flow both halves reach every LDS access together, so a group barrier before each access puts it after every earlier one.
  • Whole-wave sections (reductions and prefix sums) in groups of exactly 64 threads: each half's result is exchanged and combined, integers and floats.
  • ds_bpermute_b32, which did not translate on any host: a read within the lane's own 32-lane half.
  • Selects on masks held as numbers, on every host.
  • Loop-carried mask joins in the console structure.
  • Refusals that say why (... in a group of more than 64 threads, ds_permute across the halves, a whole-wave section), and a translate --validate line that prints a failing module's thread-group size, wave size and dx.op names.

Nothing changes for programs that translated before, with two exceptions measured below: on hosts that run 64-lane waves about 18 title programs with a lane read in a divergent branch change from the per-lane form to the console flow, and programs both forms refuse may report a different reason.

Commits new in this PR

commit by what test id before the rebase
7388024 me single-wave LDS in the console flow; specific refusal reasons one_wave_shares_lds_in_instruction_order, lds_order_holds_when_one_half_is_busy 88cb024
c7806a8 me translate --validate prints what a refused module declares and calls the_last_modules_summary_... 9745f35
a31c82e @⁠Raxstreams integer whole-wave reductions and prefix sums across the halves (reviewed here) its prefix test 9b73d66
b0f64c9, 6090b47 me tests for the above (sum, max, min, or, masked sum); plan document whole_wave_reductions_join_both_host_waves, masked_whole_wave_sum_straddles_the_halves 3925b8f, e49302a
fa72507 me test only: LDS written and read in different exec-masked blocks, the pattern measured on #189 lds_written_and_read_in_different_masked_blocks a32c177
ddaae36 me the startup warning's text (a review nit from #233) none 8876ed3
ab7882d @⁠Raxstreams ds_bpermute_b32 as an in-half read (r4tedx/VIctory#2) its two tests 416714c
826577e me more tests for it (masks over both halves, groups of 128 / 48 / 32, beside a lane read) backward_permute_in_other_masks_groups_and_forms f653ea4
00888ac me float sum, min, max and prefix sums across the halves float_whole_wave_reductions_join_both_host_waves, masked_and_prefix_float_sums_cross_the_halves 965ce30
783feee me plan document only none 2467891
e461457 me compute v_cndmask_b32 takes masks held as numbers; fixes the high dword of such a wave64 mask when two instructions write it selects_on_masks_held_as_numbers d2189ff
1c06edd @⁠ifBars loop-carried inputs of console mask joins (r4tedx/VIctory#6) lane_read_loop_with_a_joined_exec_back_edge 9e98b2b
04971f8 me that test dispatched on every hardware adapter same 901eef9
f12df1e me a lane read in a divergent branch beside a whole-wave section takes the console flow on 64-lane hosts too; a mask copied dword by dword no longer recurses until the stack runs out (reachable since #233; found with @⁠aycow's fixture) lane_reads_in_branches_beside_a_whole_wave_section, a_mask_copied_dword_by_dword_stops_instead_of_recursing e4d899f
1ca87f7 MichaelSmithAI (r4tedx/VIctory#5) a numeric select nothing consumes no longer makes a program declare the console wave size (a side effect of d2189ff) selects_from_independently_written_mask_words 055aef9

Measured

On the title, by testers on their own copies

RTX 3070 Ti Laptop, driver 610.88, four-build comparison: across three runs containing #439, DRED named compute 42683eebec081520, dispatched as (128, 64, 1), at device removal on its first world dispatch. On main the driver refused this pipeline and the run later hung in ExecuteIndirect. With #578 alone the run lasted 420 s and dropped 85–98% of world draws. The separate RTX 3070 skip run below used a different stack and driver.

On an RTX 3070 with the #439 1ca87f7 integration stack and loop limit 32, skipping direct and indirect dispatches of 42683eebec081520 still ended in device removal at menu frame 1880. DRED named an indirect mesh operation with a null u9 and empty breadcrumbs. The faulting operation is undetermined. RTX 3070 skip run

  • RTX 5070 Ti, at 9745f35: against main, 71 compute programs gained and 0 lost; of main's 119 driver-refused programs 70 run. The LDS reason goes from 38 to 0.
  • RTX 3070, Windows 10, at f653ea4, whole-title translate with pipelines: 0 pipelines refused; the LDS reason 120 → 0; compute programs emitted 1,470 (at #233) → 1,668.
  • Radeon 610M (32..64 lanes), at e49302a: against main, 0 validation or pipeline results change over 25,889 programs. This is the host the stack is meant to leave alone.
  • RTX 5080, at f653ea4, in the PR set that stays in the world on #71, against the same set with #189 (loop limit 32, one 7-minute run each): no device removal with either. With this stack, draws dropped for want of a host pipeline go from 1,470 to 958 per frame, and the richest G-buffer target in a dumped frame is 67.9% covered by a coherent view against 10.5% with wrong geometry. The presented frame is black in both, and this stack's frame time is higher (1,233 ms against 850 ms).

Nobody has run the title on a head after f653ea4. The world hang (#71) is unchanged by this stack at the default loop limit.

Locally: an offline translate over a local copy of the title's shaders

victory translate --host-lanes 32-32 --validate --list (and 32-64): CPU only, no pipelines, nothing launched or rendered. Counts and reasons only; nothing from the title is in this PR. At 055aef9 (before the rebases), and again after the first rebase on main 2e4e280 with the same results; not rerun on 8e79c80, which merged more shader PRs:

  • For a 32..32 host: 1,691 of 2,581 compute programs emitted, 1,637 validated. Vertex, pixel and mesh counts are those of main. A tester's count at f653ea4 (1,668) matches mine at that head. For a 32..64 host: 1,735 emitted, 1,681 validated, which a tester measured independently on an RX 9070 with pipelines created (1,735 / 1,681 / 1,735).
  • All 54 compute modules that fail validation give the stage-incompatibility message and call sample (see the note below).
  • Step by step, program by program, with 0 programs lost at every step: float reductions +8, loop-carried joins +9, the e4d899f rule +6 (32..32) and +12 (32..64), numeric selects +3 (32..64 only). On the tester tree, which has the descriptor PRs, the numeric-select commit is worth 24.
  • Still stopped for wave size on a 32..32 host: 43 programs in groups of more than 64 threads, 4 whole-wave sections in other group sizes, 2 section steps the simulation does not follow.
  • On a 32..64 host about 18 programs that translated per lane before e4d899f now take the console flow (they have a lane read in a divergent branch beside a whole-wave section).

Validation note

Compute programs that sample with implicit derivatives (image_sample) are emitted as dx.op.sample, which validator 1.6 / 1.7 rules do not allow outside pixel shaders. main emits 23 such modules; this stack lets more such programs translate, so more of them appear (54 here). The cause is not in this stack: diagnosis with a hand-assembled reproduction. #180 replaces these samples and #201 tracks the class; a census rerun measured #180 taking the class to 0 on main. Merging #180 first, or together, keeps those modules from reaching a driver unvalidated.

How this relates to other open PRs

  • #189 and #192 also order single-wave LDS with barriers, in the per-lane form: they analyse where a barrier is needed and legal. In the console flow every block is reached by the whole group, so a barrier is legal before every access and no analysis is needed; the cost is a barrier per LDS access. #189 also handles LDS in groups of several console waves, which this does not. The two approaches conflict in the same code; a tree carries one or the other.
  • #578 refuses pipelines whose emitted module needs a wave size the host lacks. Since its follow-up it checks the emitted PSV0, so it does not refuse what this stack emits.
  • #235 (non-Windows build) and #223 need a one-line addition when both are in: see #223's description.

docs/wave64-on-wave32.md shows as deleted in this diff, with this PR's plan text in it: #233 folded the plan into docs/architecture.md, and the merge carries that up. The design notes are in this description.

Not verified

  • No console hardware. Expected values in the tests follow the ISA's semantics. Why ds_bpermute_b32 stays in each half: AMD, "RDNA 2" Instruction Set Architecture Reference Guide (30 Nov 2020), §10.4.4 "LDS Lane-permute Ops", pp. 96–97: "in wave64 mode the permute operates only across 32 lanes at a time of each half of a wave64 … it executes as if were two independent wave32's. Each half-wave can use indices in the range 0-31 to reference lanes in that same half-wave", "only index bits [6:2] are used", "Reading from disabled lanes returns zero". The lowering follows this (lane ((addr + offset) >> 2) & 31 in the reader's half, 0 where it is inactive). The opcode table's pseudocode (§12.13, p. 206) writes mod 64, which disagrees with §10.4.4; we follow §10.4.4. ds_permute_b32 is not translated yet and still keeps a program out of the split.
  • Nothing after f653ea4 has been run in the title, by anyone. The local run only translates and validates.
  • What the barriers and guards cost on real dispatches, beyond the one frame-time figure above.
  • A float sum across the halves adds each half's sum last: one more order of additions, so its last bits may differ, as they already may within one host wave.
  • Of the LDS tests, one needs the barrier before each LDS access on an RTX 5070 (masked write and masked read with no branch between: the lower half reads 0 in 20 of 20 runs without it). The others pass either way on that card, so they check the result and not the need.
  • Masks copied dword by dword (EXEC restored with two s_mov_b32) stop with a reason; following them is not done.

Tested

Historical, at an earlier head: Independent Windows 10 22H2 run on an RTX 4060 Ti at c153b21 with #175 and #362: 155 shader tests passed, 0 failed, 1 benchmark ignored. The split-wave and joined-back-edge tests executed on hardware and returned exact results. WARP, DXIL validation, and compiler-dependent comparisons had skips. Hardware run and skip breakdown

Windows 11, an NVIDIA RTX 5070 (32..32) and an AMD Radeon iGPU (RDNA2, 32..64) in one machine. Every test in the table is hand-assembled GFX10, validated by dxil.dll, dispatched on each hardware adapter and compared lane by lane with the console's result, except the two that only check what the translator emits (the_last_modules_summary_..., selects_from_independently_written_mask_words).

  • Historical, before the merge of main 63bcca4: At 1ca87f7, on main 8e79c80, with the commands upstream's CI runs: cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features are clean at the head of each of the four PRs; cargo test --workspace --locked: 346 passed, 0 failed, 6 ignored (RTX 5070 + Radeon iGPU). Under the CI runner's conditions emulated here (the software renderer as the default device and no hardware adapter listed) the shader crate's tests pass at each head, the GPU ones by skipping. Before the rebases, cargo test --workspace at 055aef9: 299 passed, 0 failed, 4 ignored.
  • cargo xtask policy: ok at that head and, after the tests move, at e9f18c9.
  • Others ran the split tests on an RTX 4070 SUPER, 5080, 5090, a GTX 1660 Ti (Windows 10 with the Agility SDK) and the shader crate's tests on macOS.

AI-assisted. The tests are synthetic and do not use the title. The counts under "Locally" come from the offline translate run described there.

🤖 Generated with Claude Code

**@⁠r4tedx** on GitHub · 2026-11-24 03:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/439) `r4tedx:shader/console-flow-lds` → `main` · +4907 −1464 · 28 files · 84 commits · open > **Needs a BVH builder gate when merged alone.** This PR makes some BVH builder programs translate while a sibling stage can stay refused on a 32-lane host. A half-run builder crashed the title at load in neonbyte1's runs (see the comment below and #2118, comment 7179788584). Merge it together with, or after, an all-or-none builder gate such as #2118. **Current head `e2d3cfd`** (2026-11-26), on top of `e9f18c9` below, still with `main` at `63bcca4`. New since `e9f18c9`: the placed-UAV test fix merged up from #223; steven-seagull27's partial-group reductions and f16 whole-wave sums from fork PR #19 (`611184e`, `f968c54`, author kept) and `2658128`; `e2d3cfd` keeps LDS, whole-wave sections and `*permute*` in halves out of programs that reach title memory (`root_memory`, from latentdev's patch). An earlier commit on top, `7587052`, was removed from the branch by a force-push: its test encodings were taken from one of the title's programs, which the asset policy does not allow. At `2658128`, WARP only: `cargo xtask policy` ok, clippy clean, `VICTORY_WARP=1 cargo test --locked -p victory-shader --lib -- --test-threads=1` 343 passed, 4 failed, 3 ignored (the same 4 `main` failures as below). Nobody has run these split tests on 32-lane hardware at this head. No title run for this update. *At `e9f18c9`, merged with `main` at `63bcca4`* (merges only, no rebase: `main` into #223, then each PR's new head into the one above it). With `main`'s growth, `crates/victory-shader/src/emit/lower.rs` would pass the asset policy's 512 KiB limit, so #233 first moves lower.rs's inline tests into `emit/lower/tests.rs`, unchanged but for one indent level, (desplmfao's idea, beside `main`'s `emit/lower/bvh.rs`). Here lower.rs is 506,583 bytes. The conflict resolutions follow kawaii-shakal's notes, and each merge commit lists them. Local verification at this head and at the head of each PR under it, on Windows 11 with the software renderer only (WARP, no hardware adapter for this update): `cargo xtask policy` ok; `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` clean; `VICTORY_WARP=1 cargo test --locked -p victory-shader --lib -- --test-threads=1`: 341 passed, 4 failed, 3 ignored. The 4 failures are `main`'s own: on `main` `63bcca4` the same command gives 298 passed and the same 4 failed. They are `synthetic_tests` whose "hardware" pass `VICTORY_WARP=1` puts on WARP. No title run for this update. AI-assisted (Claude). Stacked on #320, which is on #233, which is on #223. They are one line of work and merge in that order; each PR's diff contains the ones under it. The commits that are new here start at `7388024` (table below). Head: `e2d3cfd`. *History, 2026-11-24:* The whole stack was rebased onto `main` `8e79c80` on 2026-11-24 (upstream merged about 55 PRs that day and added CI). New upstream tests call `emit` and build `lower::Parts` directly, so the wave-range argument and the two fields this stack adds are given to them in the commits that introduce them (in #223, #233 and #320). CI's first run on these PRs failed in tests, not in clippy: GitHub's runner has no GPU and lists Windows' software renderer (4-lane waves) as an adapter, and tests here assumed every listed adapter runs 32-lane waves. The tests are fixed where they were introduced: the hardware-adapter list leaves that renderer out by its ids and name, and the one test that takes the default device accepts a host without 32-lane waves. No translator code changed. The test-only commit `e6936e3` (the lane-read loop test skips hosts without SM 6.6) is folded into #320, where that test is added, so 16 commits are new here. Each commit builds on its own. The head before the rebases was `055aef9`. Commit ids in testers' reports below and in older comments are from before the rebases; the table gives each commit's old id. No new features will be added to this PR. It has grown as testers and contributors reported things; from here it only gets fixes for what review finds. The next step of the work (groups of more than 64 threads) is on a fork branch and is not part of this. ## What #233 runs console wave64 compute programs on hosts without 64-lane waves (NVIDIA) as two 32-lane waves, in the "console flow" where a program needs its whole wave. It still stopped programs that share LDS inside one wave, and a few other forms. This PR takes those: - **One console wave sharing LDS without `s_barrier`.** The console runs an instruction in all 64 lanes before the next, so a lane reads what another lane wrote one instruction earlier. In the console flow both halves reach every LDS access together, so a group barrier before each access puts it after every earlier one. - **Whole-wave sections** (reductions and prefix sums) in groups of exactly 64 threads: each half's result is exchanged and combined, integers and floats. - **`ds_bpermute_b32`**, which did not translate on any host: a read within the lane's own 32-lane half. - **Selects on masks held as numbers**, on every host. - **Loop-carried mask joins** in the console structure. - Refusals that say why (`... in a group of more than 64 threads`, `ds_permute across the halves`, `a whole-wave section`), and a `translate --validate` line that prints a failing module's thread-group size, wave size and `dx.op` names. Nothing changes for programs that translated before, with two exceptions measured below: on hosts that run 64-lane waves about 18 title programs with a lane read in a divergent branch change from the per-lane form to the console flow, and programs both forms refuse may report a different reason. ## Commits new in this PR | commit | by | what | test | id before the rebase | |---|---|---|---|---| | `7388024` | me | single-wave LDS in the console flow; specific refusal reasons | `one_wave_shares_lds_in_instruction_order`, `lds_order_holds_when_one_half_is_busy` | `88cb024` | | `c7806a8` | me | `translate --validate` prints what a refused module declares and calls | `the_last_modules_summary_...` | `9745f35` | | `a31c82e` | @⁠Raxstreams | integer whole-wave reductions and prefix sums across the halves ([reviewed here](https://github.com/r4tedx/VIctory/pull/1#issuecomment-7121787943)) | its prefix test | `9b73d66` | | `b0f64c9`, `6090b47` | me | tests for the above (sum, max, min, or, masked sum); plan document | `whole_wave_reductions_join_both_host_waves`, `masked_whole_wave_sum_straddles_the_halves` | `3925b8f`, `e49302a` | | `fa72507` | me | test only: LDS written and read in different exec-masked blocks, the pattern [measured on #189](https://git.gtahub.st/github/Marvisak--VIctory/pulls/189) | `lds_written_and_read_in_different_masked_blocks` | `a32c177` | | `ddaae36` | me | the startup warning's text (a review nit from #233) | none | `8876ed3` | | `ab7882d` | @⁠Raxstreams | `ds_bpermute_b32` as an in-half read ([r4tedx/VIctory#2](https://github.com/r4tedx/VIctory/pull/2)) | its two tests | `416714c` | | `826577e` | me | more tests for it (masks over both halves, groups of 128 / 48 / 32, beside a lane read) | `backward_permute_in_other_masks_groups_and_forms` | `f653ea4` | | `00888ac` | me | float sum, min, max and prefix sums across the halves | `float_whole_wave_reductions_join_both_host_waves`, `masked_and_prefix_float_sums_cross_the_halves` | `965ce30` | | `783feee` | me | plan document only | none | `2467891` | | `e461457` | me | compute `v_cndmask_b32` takes masks held as numbers; fixes the high dword of such a wave64 mask when two instructions write it | `selects_on_masks_held_as_numbers` | `d2189ff` | | `1c06edd` | @⁠ifBars | loop-carried inputs of console mask joins ([r4tedx/VIctory#6](https://github.com/r4tedx/VIctory/pull/6)) | `lane_read_loop_with_a_joined_exec_back_edge` | `9e98b2b` | | `04971f8` | me | that test dispatched on every hardware adapter | same | `901eef9` | | `f12df1e` | me | a lane read in a divergent branch beside a whole-wave section takes the console flow on 64-lane hosts too; a mask copied dword by dword no longer recurses until the stack runs out (reachable since #233; found with @⁠aycow's fixture) | `lane_reads_in_branches_beside_a_whole_wave_section`, `a_mask_copied_dword_by_dword_stops_instead_of_recursing` | `e4d899f` | | `1ca87f7` | MichaelSmithAI (r4tedx/VIctory#5) | a numeric select nothing consumes no longer makes a program declare the console wave size (a side effect of `d2189ff`) | `selects_from_independently_written_mask_words` | `055aef9` | ## Measured ### On the title, by testers on their own copies [RTX 3070 Ti Laptop, driver 610.88, four-build comparison](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439): across three runs containing #439, DRED named compute `42683eebec081520`, dispatched as `(128, 64, 1)`, at device removal on its first world dispatch. On `main` the driver refused this pipeline and the run later hung in `ExecuteIndirect`. With #578 alone the run lasted 420 s and dropped 85–98% of world draws. The separate RTX 3070 skip run below used a different stack and driver. On an RTX 3070 with the #439 `1ca87f7` integration stack and loop limit 32, skipping direct and indirect dispatches of `42683eebec081520` still ended in device removal at menu frame 1880. DRED named an indirect mesh operation with a null `u9` and empty breadcrumbs. The faulting operation is undetermined. [RTX 3070 skip run](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439) - [RTX 5070 Ti, at `9745f35`](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439): against `main`, 71 compute programs gained and 0 lost; of `main`'s 119 driver-refused programs 70 run. The LDS reason goes from 38 to 0. - [RTX 3070, Windows 10, at `f653ea4`](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439), whole-title translate with pipelines: 0 pipelines refused; the LDS reason 120 → 0; compute programs emitted 1,470 (at #233) → 1,668. - [Radeon 610M (32..64 lanes), at `e49302a`](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439): against `main`, 0 validation or pipeline results change over 25,889 programs. This is the host the stack is meant to leave alone. - [RTX 5080, at `f653ea4`, in the PR set that stays in the world on #71, against the same set with #189](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439) (loop limit 32, one 7-minute run each): no device removal with either. With this stack, draws dropped for want of a host pipeline go from 1,470 to 958 per frame, and the richest G-buffer target in a dumped frame is 67.9% covered by a coherent view against 10.5% with wrong geometry. The presented frame is black in both, and this stack's frame time is higher (1,233 ms against 850 ms). Nobody has run the title on a head after `f653ea4`. The world hang (#71) is unchanged by this stack at the default loop limit. ### Locally: an offline translate over a local copy of the title's shaders `victory translate --host-lanes 32-32 --validate --list` (and `32-64`): CPU only, no pipelines, nothing launched or rendered. Counts and reasons only; nothing from the title is in this PR. At `055aef9` (before the rebases), and again after the first rebase on `main` `2e4e280` with the same results; not rerun on `8e79c80`, which merged more shader PRs: - For a 32..32 host: 1,691 of 2,581 compute programs emitted, 1,637 validated. Vertex, pixel and mesh counts are those of `main`. A tester's count at `f653ea4` (1,668) matches mine at that head. For a 32..64 host: 1,735 emitted, 1,681 validated, which [a tester measured independently on an RX 9070](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439) with pipelines created (1,735 / 1,681 / 1,735). - All 54 compute modules that fail validation give the stage-incompatibility message and call `sample` (see the note below). - Step by step, program by program, with 0 programs lost at every step: float reductions +8, loop-carried joins +9, the `e4d899f` rule +6 (32..32) and +12 (32..64), numeric selects +3 (32..64 only). On the tester tree, which has the descriptor PRs, the numeric-select commit is worth 24. - Still stopped for wave size on a 32..32 host: 43 programs in groups of more than 64 threads, 4 whole-wave sections in other group sizes, 2 section steps the simulation does not follow. - On a 32..64 host about 18 programs that translated per lane before `e4d899f` now take the console flow (they have a lane read in a divergent branch beside a whole-wave section). ## Validation note Compute programs that sample with implicit derivatives (`image_sample`) are emitted as `dx.op.sample`, which validator 1.6 / 1.7 rules do not allow outside pixel shaders. `main` emits 23 such modules; this stack lets more such programs translate, so more of them appear (54 here). The cause is not in this stack: [diagnosis with a hand-assembled reproduction](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233). #180 replaces these samples and #201 tracks the class; a [census rerun](https://git.gtahub.st/github/Marvisak--VIctory/issues/201) measured #180 taking the class to 0 on `main`. Merging #180 first, or together, keeps those modules from reaching a driver unvalidated. ## How this relates to other open PRs - #189 and #192 also order single-wave LDS with barriers, in the per-lane form: they analyse where a barrier is needed and legal. In the console flow every block is reached by the whole group, so a barrier is legal before every access and no analysis is needed; the cost is a barrier per LDS access. #189 also handles LDS in groups of several console waves, which this does not. The two approaches conflict in the same code; a tree carries one or the other. - #578 refuses pipelines whose emitted module needs a wave size the host lacks. Since its follow-up it checks the emitted `PSV0`, so it does not refuse what this stack emits. - #235 (non-Windows build) and #223 need a one-line addition when both are in: see #223's description. `docs/wave64-on-wave32.md` shows as deleted in this diff, with this PR's plan text in it: #233 folded the plan into `docs/architecture.md`, and the merge carries that up. The design notes are in this description. ## Not verified - No console hardware. Expected values in the tests follow the ISA's semantics. Why `ds_bpermute_b32` stays in each half: AMD, *"RDNA 2" Instruction Set Architecture Reference Guide* (30 Nov 2020), §10.4.4 "LDS Lane-permute Ops", pp. 96–97: "in wave64 mode the permute operates only across 32 lanes at a time of each half of a wave64 … it executes as if were two independent wave32's. Each half-wave can use indices in the range 0-31 to reference lanes in that same half-wave", "only index bits [6:2] are used", "Reading from disabled lanes returns zero". The lowering follows this (lane `((addr + offset) >> 2) & 31` in the reader's half, 0 where it is inactive). The opcode table's pseudocode (§12.13, p. 206) writes `mod 64`, which disagrees with §10.4.4; we follow §10.4.4. `ds_permute_b32` is not translated yet and still keeps a program out of the split. - Nothing after `f653ea4` has been run in the title, by anyone. The local run only translates and validates. - What the barriers and guards cost on real dispatches, beyond the one frame-time figure above. - A float sum across the halves adds each half's sum last: one more order of additions, so its last bits may differ, as they already may within one host wave. - Of the LDS tests, one needs the barrier before each LDS access on an RTX 5070 (masked write and masked read with no branch between: the lower half reads 0 in 20 of 20 runs without it). The others pass either way on that card, so they check the result and not the need. - Masks copied dword by dword (EXEC restored with two `s_mov_b32`) stop with a reason; following them is not done. ## Tested *Historical, at an earlier head:* Independent Windows 10 22H2 run on an RTX 4060 Ti at `c153b21` with #175 and #362: 155 shader tests passed, 0 failed, 1 benchmark ignored. The split-wave and joined-back-edge tests executed on hardware and returned exact results. WARP, DXIL validation, and compiler-dependent comparisons had skips. [Hardware run and skip breakdown](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439) Windows 11, an NVIDIA RTX 5070 (32..32) and an AMD Radeon iGPU (RDNA2, 32..64) in one machine. Every test in the table is hand-assembled GFX10, validated by `dxil.dll`, dispatched on each hardware adapter and compared lane by lane with the console's result, except the two that only check what the translator emits (`the_last_modules_summary_...`, `selects_from_independently_written_mask_words`). - *Historical, before the merge of `main` `63bcca4`:* At `1ca87f7`, on `main` `8e79c80`, with the commands upstream's CI runs: `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features` are clean at the head of each of the four PRs; `cargo test --workspace --locked`: 346 passed, 0 failed, 6 ignored (RTX 5070 + Radeon iGPU). Under the CI runner's conditions emulated here (the software renderer as the default device and no hardware adapter listed) the shader crate's tests pass at each head, the GPU ones by skipping. Before the rebases, `cargo test --workspace` at `055aef9`: 299 passed, 0 failed, 4 ignored. - `cargo xtask policy`: ok at that head and, after the tests move, at `e9f18c9`. - Others ran the split tests on an RTX 4070 SUPER, 5080, 5090, a GTX 1660 Ti (Windows 10 with the Agility SDK) and the shader crate's tests on macOS. AI-assisted. The tests are synthetic and do not use the title. The counts under "Locally" come from the offline translate run described there. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
How one console wave64 runs as two 32-lane host waves under our
per-lane structurisation, what has to cross halves, why exchanges need
uniform regions, how to test on a machine with both GPU kinds, and the
order of the remaining steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A compute shader that reads other lanes declares the console's wave
size. NVIDIA runs waves of 32 lanes only (D3D12 reports 32..32), so a
console wave64 program of that kind was refused at pipeline creation
and its dispatches were dropped without saying why.

The host's wave range (D3D12 options 1) now goes into translation as
`emit::Target`. A shader that needs a wave size the host does not run
stops there with the reason, the shader cache keys entries by the range,
and the run logs the range once with a warning when 64-lane waves are
missing. `victory translate --host-lanes 32-32` counts these shaders
without a GPU.

This is the first step towards running these programs as two 32-lane
waves on such hosts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`emit::host::Host::on(name)` and `VICTORY_ADAPTER` choose a hardware
adapter by part of its description, and `adapters()` lists them, so a
machine with an AMD and an NVIDIA GPU can run a test on each: the
native wave64 form as the reference on the one with 64-lane waves, the
32-lane form on the other. A new test checks on every adapter that a
wave64 program reading other lanes translates exactly when the adapter
runs 64-lane waves, and that the adapter then takes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a host without 64-lane waves (NVIDIA), a console wave64 compute
program whose lanes read only their own 32-lane half (DPP, ds_swizzle)
now declares WaveSize(32) instead of failing to translate. It must
read no mask whole, test no bit of a mask held as a number, have no
whole-wave sections and use no LDS. Every other wave64 program that
depends on the lane layout still stops with the reason from the
previous step. Mask ballots, wave reductions and lane-bit tests refuse
the split form as a safety net.

New GPU tests run hand-assembled programs on every hardware adapter
and check each lane against the console's layout. On an RTX 5070 the
split form is exact for 1-D groups of 32, 64 and 128 threads and for
3-D groups up to 8x8x4. A Radeon iGPU runs the same programs natively
as the reference, and a read across halves (v_readlane 40) still needs
64-lane waves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A console wave64 program that reads masks whole or lanes of the other
half now runs on a host without 64-lane waves when its group is one
console wave (64 threads or fewer, no LDS). It runs as the console
does ("console flow"):

- `structure::structure_console` never resolves mask joins from what
  the lanes arriving know (every lane arrives); `Structured::execs`
  gives each vector instruction's EXEC bit.
- Vector instructions are guarded by EXEC. Branches are the console's
  s_cbranch_*: EXEC, VCC and mask-operation SCC tests are the console
  wave's, from both halves' ballots exchanged through group-shared
  memory between group barriers, which every thread reaches since both
  halves branch alike.
- Masks read whole are the exchanged ballots. v_readlane and
  v_readfirstlane read the owning half; v_writelane, v_mbcnt and mask
  bit tests use the console lane.

The per-lane form is tried first; a program that needs the console
flow is lowered again from the console structure.

GPU tests on an RTX 5070 are exact against the console: s_bcnt1 over
both halves (64, 48 and 32 threads), v_readlane 40, an exchange inside
a branch only the lower half takes, and a loop the halves leave at
different iterations with a lane read in each. The last one shows that
the per-lane form, which hosts with 64-lane waves get, is wrong for it
(on a Radeon iGPU): noted in docs/wave64-on-wave32.md, not changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A wave64 program split over two 32-lane waves took the DPP row index
from the host lane, so the upper half (console rows 2 and 3) read
row_mask bits 0 and 1. The row now comes from the console lane there.
New test: v_mov_b32_dpp with row_mask:0x3 writes lanes 0 to 31 only,
exact on an RTX 5070 (split) and a Radeon iGPU (native).

Found in review against #189 and #192, which both get this right.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
v_readfirstlane reads the console wave's first lane. A wave64 program
with DPP or ds_swizzle and a v_readfirstlane was split into two 32-lane
waves, where the upper half read its own first lane: with all 64 lanes
active, lanes 32 to 63 got lane 32's value where the console gives
lane 0's (measured on an RTX 5070).

Such programs now take the console flow, which reads the first lane in
EXEC of the whole console wave (groups of at most 64 threads, no LDS),
or stop with the reason as they did before the split existed.

New test, exact on an RTX 5070 and a Radeon iGPU. Found by running the
same program against #192, which has the same result on both adapters.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
On the console v_readlane and v_writelane ignore EXEC, and a wave runs a
loop while any of its lanes does. The per-lane form runs branches and
loops per lane, so a lane that left a loop or skipped a branch is not
there to be read or written, and never sees the scalars set inside
(#225):

- a loop lane t runs t times, reading lane L in each iteration: 12 of
  32 lanes wrong in waves of 32 (RTX 5070, Radeon iGPU), 24 of 64 in
  waves of 64 (Radeon);
- v_writelane to lane 40 inside a branch only lanes below 20 take: lane
  40 was never written.

A compute program with v_readlane or v_writelane, a branch that is not
uniform, no ds_(b)permute and no whole-wave sections now runs in the
console flow on every host. Where the host runs the console's wave
size, one host wave is the console wave: ballots are the wave's own and
nothing is exchanged, so any group size and LDS are fine. A program the
console flow cannot lower keeps the per-lane form
(`Parts::per_lane_only`), so nothing that translated before is refused.

Both cases are now exact on an RTX 5070 (wave32 natively, wave64 in two
halves) and on a Radeon iGPU (both natively).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The loop form compilers emit keeps the lanes that are done in an exit
mask that starts as 0 (s_mov_b64 s[2:3], 0; in the loop s_or_b64
s[2:3], vcc, s[2:3] and s_andn2_b64 exec, exec, s[2:3]). In the console
flow every mask join is a phi, and its incoming values had to be masks
derived from EXEC or a VALU result, so such a loop stopped with "a
lane-mask join of an untracked mask".

`Structured::others` gives the lane's bit of the other values read as
masks (constants, uniform selects, opaque ones), and the console flow's
mask joins take them. The per-lane form is unchanged.

New test: a loop in that form with a lane read in every iteration and
the exit mask counted afterwards. It was refused on an RTX 5070 before
and is exact there (in two halves) and on a Radeon iGPU now.

Found through the test report on #233 that tried #269's programs.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Drivers create pipelines from some modules the DXIL validator refuses
(D3D12 checks only the container hash we write). The hand-assembled
split and console-flow programs now go through dxil.dll's validator
before pipeline creation, where one is installed. All of them pass.

Prompted by a report on #233 of pipelines created from modules that
fail validation.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
On the console one wave shares LDS without s_barrier, because it runs
an instruction in all 64 lanes before the next. A wave64 program of one
console wave per group that uses LDS stopped on hosts without 64-lane
waves (`a wave64 group sharing LDS without barriers`), and so did such
a program with cross-lane reads.

Both now take the console flow there. The halves reach every LDS
access together, and a group barrier before each access puts it after
every earlier one, whichever half made it.

What still stops says why: a group of more than 64 threads, ds_permute
across the halves, or a whole-wave section.

Two new tests (LDS written and read across the halves, one with the
lower half kept busy first) are exact on an RTX 5070 and a Radeon iGPU.
They also pass on the RTX 5070 with the barrier left out, so they check
the result, not that the barrier is needed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The validator's message for an operation the stage or the entry's
properties do not allow ("Entry function performs some operation that
is incompatible with the shader stage or other entry properties") names
neither the operation nor the property, and it is the only message when
the call is in the entry function itself.

`victory translate --validate` now adds to each validator failure what
our own module declares and calls: its thread-group size, its wave size
and its dx.op operations (`emit::last_module_summary`, kept per thread
when a module is finished). Nothing of the console program is in it, so
a report of counts per reason is enough to see what the refused modules
have in common.

Prompted by a report on #233: modules that fail validation with that
message and still create pipelines, 20 of them new with #320, which I
cannot reproduce with hand-assembled programs.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The scan test of the previous commit goes through the carry of a prefix
sum only. These cover the other branch, where each half's reduction is
exchanged and combined: the sum of the lane ids, their maximum (in the
upper half), their minimum (in the lower half) and their bitwise or,
and a sum over a mask of lanes below 40, which straddles the halves.
A group with a partial upper half, or none, still stops with the
section's reason.

All exact on an RTX 5070 (two halves) and a Radeon iGPU (native).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
One console wave with no s_barrier whose LDS write and read sit in
different exec-masked blocks: every lane (or, after a 4096-iteration
loop, only lanes 32..63) writes dword t, then lanes 0..31 read dword
t + 32. A third case has the same masks with no branch around either
access. Hand-assembled; exact on an RTX 5070 (two 32-lane waves, console
flow) and a Radeon iGPU (one 64-lane wave).

The pattern is the one a reviewer measured stale reads for on #189. The
console flow orders the first two cases twice: a branch on EXEC is
decided by both halves through an exchange (a group barrier), and each
LDS access has a group barrier before it, so they also pass with the
second left out. The third has no branch, and with the barrier before
each LDS access left out the lower half of the RTX 5070 reads 0 in 20 of
20 runs (exact in 20 of 20 with it): the first test here that fails
without that barrier.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The startup warning on hosts without 64-lane waves still said every
console wave64 compute program that reads other lanes is dropped, and its
literal carried a run of spaces from a lost line continuation. It now
says such programs run as two 32-lane waves where there is a form for
them, and that the rest do not translate.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Cases for the ds_bpermute_b32 lowering of the commit before, each lane
checked on an RTX 5070 (two 32-lane waves) and a Radeon iGPU (one
64-lane wave): EXEC over part of each half, two console waves per group,
groups of 48 and 32 threads (a source lane that is not there reads 0),
and beside a v_readlane across the halves, which takes the console flow
on a host without 64-lane waves.

Also formats that commit's new lines for this crate's line width, and
the plan now lists ds_bpermute as an in-half read; ds_permute stays
open.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
In the console flow on a host without 64-lane waves, a whole-wave section
that leaves a float sum, minimum or maximum stopped with "a
floating-point whole-wave operation across 32-lane halves". Each half's
result now crosses as its bits, like the integer ones: minimum and
maximum through FMin / FMax, a sum as the two halves' sums added last,
and a prefix sum in the upper half adds the lower half's total. Groups of
exactly 64 threads, as for integers.

A sum's additions are in one more order than the console's and the host
wave's own, so its last bits may differ, as they already may in one host
wave.

Tests (hand-assembled, each lane checked on an RTX 5070 and a Radeon
iGPU): the lane ids as floats, their sum, maximum (in the upper half) and
minimum (in the lower half) with identities 0.0, -inf and +inf, a sum
over a mask that straddles the halves, and an inclusive prefix sum.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The wave64 plan had per-console-wave arrival counters with a bounded wait
for groups of more than 64 threads. A wait is met only if the partner
half runs meanwhile, which D3D12 does not promise and an RTX 5070 does not
do in the LDS tests, so that plan is dropped. For programs without LDS,
each console wave becomes a host group of its own (64 threads, the
dispatch's x count multiplied), which is the console flow as it is.
Groups that share LDS stay open, with the candidates named.

The group sizes and counts come from an offline translate over a local
copy of the title's shaders; no program content is in the document.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A v_cndmask_b32 whose selector derives from neither EXEC nor a compare (a
constant, a number built from scalars) stopped with "a select on an
untracked mask". In compute the lane can test its own bit of such a mask
by its console lane, as guards on such masks already do: the select now
takes the lane's bit from the structure's other masks, and a program
with such a select declares the console's wave size like the ones that
guard on them. Other stages are unchanged.

The high dword of a wave64 mask held as a number was found only when one
instruction wrote both dwords; written by two (s_mov_b32 each), lanes 32
to 63 tested the low dword's bits. The structure pass now records the
pair a mask's reader takes, and that is used where no single writer
exists. This applied to guards on such masks too.

Test (hand-assembled, each lane checked on an RTX 5070 and a Radeon
iGPU): a select on a mask of two constants and on one with a bit that
depends on the group, as a wave64 and as a wave32 program, in groups of
64 and 32 threads.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A loop-carried EXEC phi can depend on a latch phi that is not otherwise used. Discover deferred inputs before emitting mask phis, including inputs discovered while walking the deferred worklist. Extend the authored lane-read loop fixture by adding a second predecessor of the latch.
The test of the commit before dispatched on WARP only, which has no
32-lane waves, so it checked emission alone. It now runs like the other
lane-read loop test: emitted for each hardware adapter's waves,
validated, dispatched, and every lane compared (lane t stores t + 40).
Exact on an RTX 5070 (two 32-lane waves) and a Radeon iGPU; without the
structure change it stops with "a lane-mask join of an untracked mask".

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Two defects found with a contributor's fixture (a waterfall loop over
lane classes with a whole-wave section inside, reported on #439).

A mask copied dword by dword (EXEC restored with two s_mov_b32) is held
as a number, and that number is known only as the mask's own dword. In
the console flow the lowering followed that in a circle until the stack
ran out, which takes the process with it. It now stops with "an opaque
lane mask".

On a host that runs the console's wave size, a program with a lane read
in a divergent branch took the console flow only if it had no whole-wave
section, so one with both stopped with "a lane mask holding lanes
elsewhere read as data" there while a 32-lane host ran it. The rule
counted the lane reads sections make themselves; it now looks for a lane
read or write outside the sections and lets sections be, which the
console flow lowers as wave operations like the per-lane form. Such
programs fall back to the per-lane form as before if the console flow
cannot lower them.

Tests (hand-assembled): a lane read in a branch beside a whole-wave sum,
each lane checked on an RTX 5070 and a Radeon iGPU; and a mask copied
dword by dword, which overflowed the stack before and stops now.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A compute program with a numeric select declared the console's wave size
whether or not anything read the select's result. On a host without
64-lane waves that refused a wave64 program in a group of more than 64
threads only for a select nothing consumes, where it translated before
selects on numeric masks were lowered.

The ordinary lowering now runs first. Only when it stops on a select
with an untracked mask is the program lowered again with numeric selects
counted among the masks held as numbers.

From r4tedx/VIctory#5 (MichaelSmithAI). Picked onto shader/console-flow-lds
by r4.: the selector scan iterates every instruction here (the tester
tree's `live()` filter is another PR's), and the new lines are formatted
for this crate.
The in-half form cannot read the high word of a numeric mask. Let an unused select drop out and use the existing full-wave retry when its result is needed. Exercise both cases alongside a live swizzle and DPP read.
Keep the host wave target and console-flow lowering while bringing in per-lane waterfall resource tracking. Use the structured program for resource tracking in translation and tests, and prefer proved per-lane descriptor reads before the general console read-first-lane path.
The comment on the console flow's SCC said both write the old EXEC to
their scalar destination. Only saveexec does; wrexec writes the new EXEC
to both, so either write names the mask SCC tests.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
# Conflicts:
#	crates/victory-shader/src/emit/split_tests.rs
Lane t stays in the loop for t + 1 iterations and a scalar counts the
wave's iterations: 64. With the console flow branching on the saved EXEC
(fixed in 2466184) the loop ran once more with no lane in it and the
count was 65, on an RTX 5070 in the console flow. The program reads a
lane, so hosts with 64-lane waves run it in the console flow too (exact
on a Radeon iGPU).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
# Conflicts:
#	crates/victory-shader/src/emit/split_tests.rs
Main lowers a descriptor each lane holds by the path it took
(Source::LanePhi, #566) as a DXIL phi over the edges into the join. In
the console flow every lane reaches the join by the edge the wave took,
so the phi gave every lane that edge's descriptor, silently: the joined
if/else program of the waterfall tests, lowered in the console flow,
sampled the second texture in all 32 lanes where lanes 0-15 hold the
first (RTX 5070; the module passes dxil.dll).

The console flow now stops with its own reason there. A program that
takes the console flow only for its lane reads keeps the per-lane form
where that translates; one that needs it for the host's wave size stops
with the reason.

Found on the testers' branch, where #566 and the console flow first met.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A program with a named lane read and branches its lanes take differently
asks for the console flow on every host. With a descriptor joined per
lane the console flow refuses it (b623fd3), and emit keeps the per-lane
form: checked for any host, a 32-lane host and a 32-64 one, each module
validated by dxil.dll when present.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Clippy (chunks_exact_to_as_chunks, an error under -D warnings in CI)
on the test carried in 1f53745. No change in what it checks.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The GPU tests walk every hardware adapter and expect each to take the
console's wave-size-dependent programs in one form or the other. An
integrated GPU with narrower waves (an Intel UHD reporting 16-16 was
reported on #439) runs none of them: the translator refuses, correctly,
and 30 tests failed there for expecting a pipeline. The list now leaves
such an adapter out, by its wave range, as it already left out the
software renderer by name. An adapter no SM 6.6 device can be made on
stays listed, for its user to skip as before.

Checked on an RTX 5070 (32-32) and a Radeon iGPU (32-64): both still
listed, each_adapter_gets_what_it_runs and two split tests exact. Not
checked on a 16-lane adapter (none here).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The tests that walk every hardware adapter (split_tests, the lane-read
loop tests, each_adapter_gets_what_it_runs) opened each one by name, so
neither VICTORY_ADAPTER nor VICTORY_WARP=1 kept them off a card: a run
meant for the software renderer still dispatched on every GPU in the
machine.

The adapter list now honours them. VICTORY_TEST_ADAPTERS=<part of a
name>[,<part>...] lists only the adapters whose description holds one
of the parts; without it VICTORY_ADAPTER=<part> does the same, so one
setting keeps a whole shader test run on one adapter; VICTORY_WARP=1
lists none. An adapter that is left out is not opened at all.

Checked on a machine with an RTX 5070 and a Radeon iGPU, with two of
these tests: VICTORY_ADAPTER=Radeon and VICTORY_TEST_ADAPTERS=radeon
run on the Radeon only; VICTORY_WARP=1 and a name that matches nothing
run on no adapter.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Conflicts were where main's write marks (`emit::Options`, `emit_with`,
`translate_with`, `Parts::view_marks`) and its warm-up (`translate
--cache`, `host_shader` returning whether the entry was cached) met the
branch's `Target`:

- emit: `Options` gains `target` (default `Target::ANY`), so main's
  `emit_with` and `translate_with` keep their signatures; `emit(..,
  target)` and `translate_for(c, target)` stay as they were and fill it
  in. `Parts` has both `target` and `view_marks`. Main's retry with
  `structure::killing` is kept as it is.
- shader cache: `host_shader(container, target)` translates with main's
  write marks for `target` and keeps main's (result, cached) pair; the
  branch's key function is renamed `host_key`, since main now has a
  `key` for the build.
- `translate --cache` (new on main) asks `shader_cache::host_target()`,
  which is what a run's `pipeline::translate` uses, so warm entries are
  keyed as the run looks them up; `--cache` refuses `--host-lanes`.
- `translate` (the census) passes its target with main's `view_marks:
  true`; `--pipelines` documents both the host's wave sizes and main's
  pipeline library.
- victory-gpu `Host` keeps both `target` and main's `heap_atomics64`.
- The `Parts` and `emit` call sites main added (the `fuses_fmad` probe
  in `emit/host.rs` and tests in bvh, memory, semantics, stride,
  synthetic, valu and `emit::tests`) pass `Target::ANY`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Main's newer lowering is kept as it is around the console flow: the
waterfall loop's `v_readfirstlane_b32` and the spilled-SGPR
`v_readlane_b32` keep their arms before the console-flow ones, the
helper-lane read stays in the per-lane `v_readfirstlane_b32`, and
`lane_bit_of`, `mask_number`, the heap and view guards and the write
marks are untouched. Resolutions worth knowing:

- `mask_dword`: the console flow's exchanged ballot comes first, then
  the split form's refusal, then main's `mask_number` for masks holding
  lanes elsewhere (per-lane form only: in the console flow every lane is
  at the block that writes the mask).
- `emit`: one `parts(st, res, console_cf)` closure serves the per-lane
  pass, the `CONSOLE_FLOW` retry with `structure_console`, and main's
  retry with `structure::killing` (pixel discards; never both).
- `structure`: `structure_as(program, helpers, console)` behind
  `structure`, `killing` and `structure_console`; `Structured` has both
  `execs` and main's `restored` / `discards`.
- Test host: `Host::new` takes `VICTORY_ADAPTER` first, else main's
  first adapter that is a GPU (so a machine without one still skips);
  `adapters()` and `Host::on` keep their own hardware test.
- Main's per-lane reasoning that does not hold where the wave takes the
  branches is switched off in the console flow: `never_taken` and the
  branch conditions `live_edges` collects (a lane comes along an edge
  whatever its own condition is, and SGPRs are the wave's). The console
  flow fills phis as it did before the merge.
- Main's 16-bit whole-wave section (`Shape::Half`) reduces over the host
  wave and reads lane `hi` of it: refused in a program split in halves,
  as the other reductions are.
- The `Parts` sites main added pass `console_cf: false`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Main's `v_cndmask_b32` now takes masks that derive from neither EXEC nor
a compare (`Structured::other`, inline constants) and tests the lane's
bit of the number. In a wave64 program run as two 32-lane waves without
the console flow, `lane_bit` has only the host lane: lanes 32..63 would
test the low word. Guards and branch conditions on such masks already
keep a program out of that form, a select's mask does not, so the merged
code reached `lane_bit`'s debug assertion (and, without assertions, the
wrong bits).

`lane_bit` now returns the refusal instead of asserting. The select then
has no result, and the program stops with that reason if the result is
used.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings main (940d32f), the two lower levels' merges of it, and the
console-flow branch's adapter filter for the every-adapter tests
(d8921a5), which this branch did not have yet.

- `emit`: the `parts` closure takes `per_lane_only` too. A program that
  stops with `CONSOLE_FLOW` is lowered from `structure_console`, and
  falls back to the per-lane form (`per_lane_only`) with the console
  flow's reason when that fails, as before; main's retry with
  `structure::killing` stays a separate arm.
- `Structured::others` is dropped for main's `Structured::other`, which
  is the same map (masks that derive from neither EXEC nor a VALU
  result): the console flow's mask joins read `other`.
- The `Parts` sites main added pass `per_lane_only: false`.
- `split_tests`: this branch's tests, then the lower level's new
  `selects_on_numeric_masks_are_refused_in_halves`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings main (940d32f) through the three lower levels' merges, and the
adapter filter for the every-adapter tests (d8921a5).

- `v_cndmask_b32`: main takes selectors from `Structured::other` and
  inline constants; this branch defers a select on a mask held as a
  number until its result is used. Together: a uniform selector (main's
  `s_cselect` case) needs no lanes and is lowered as on main; a constant
  lane set or a number built from scalars tests the console lane's bit
  where there are console lanes outside the in-half form, and is
  deferred (`UNTRACKED_SELECT`, then the pass with console lanes) in
  compute otherwise. The numeric-select pass counts inline constant
  selectors as masks held as numbers too. Other stages keep main's
  refusals.
- `ds_bpermute_b32`: one arm, main's (its 16-bit offset, `lane_bit_of`),
  gathering within the reader's 32-lane half as this branch lowers it
  (RDNA 2). In wave32 programs that is what main did; in wave64 ones main
  gathered across the whole wave. The form decision keeps treating it as
  an in-half read.
- `Structured::others` is main's `Structured::other`; `pairs` reads it.
- The group barrier before an LDS access in the console flow also
  precedes main's byte and half accesses.
- `split_tests`: the lower level's constant-mask select test becomes
  `selects_on_constant_masks_beside_in_half_reads`: here such a program
  takes the console flow on a host without 64-lane waves instead of
  stopping.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A compute program's image_sample or image_sample_b has no valid DXIL
form yet: the module fails validation with "an operation that is
incompatible with the shader stage" (#201). Drivers take such a module
in the per-lane form. In the console flow in two 32-lane halves the
same module also carries group barriers inside its branches and loops,
and a title run on an RTX 4070 lost its device in a submission of two
of them (ptfx_CS_lightAtlas_Sprite and _Trail, reported on #233 from
fxceless/victory-gta6@e9765a7). That is the best-supported reading,
not a proven cause.

On a host without 64-lane waves such a program now stops, by name,
with "an implicit-derivative sample in the console flow on a host
without 64-lane waves". The per-lane form and hosts with 64-lane waves
are unchanged.

Offline over the title's shader pack (local title data, CPU only,
counts only; 32-lane host): exactly 12 compute programs change, all from
"emitted, fails validation" to this refusal; none that validates is
lost. Both programs named in the report and the one tied to an earlier
RTX 3080 report are among them. None of the 12 ran on a 32-lane card
before this stack.

Test (CPU only, no device): emit::tests::
implicit_samples_stop_the_console_flow_in_halves; it fails with the
guard disabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A wave64 program that restores EXEC dword by dword from a mask
(s_mov_b32 exec_lo, s12; s_mov_b32 exec_hi, s13) leaves the structure
pass holding the mask as a number that is known only as the mask's own
dword. With console lanes the lowering followed that in a circle until
the stack ran out, which ends the whole process: a translator run, or
the runtime translating a title's shader. Reproduced at this level after
the merge with main 940d32f with the test below (stack overflow).

The opaque-mask arm now stops with "an opaque lane mask" when it meets
the mask it is already reading, as #439 has done since f12df1e. Test
taken from there: a_mask_copied_dword_by_dword_stops_instead_of_recursing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The copied-mask recursion guard that came with it (7147671) is the one
this branch has had since f12df1e: its field, initialiser and test are
kept once, as they were here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
80f5663 took SGPR spills out of the lane reads that ask for the console's
wave size, so a compute program whose only lane reads and writes are
spills lost WaveSize on every host, Target::ANY included, where main
gives the console's wave size and emulates the lane writes. Keep main's
per-lane form there: on a host that runs the console's wave size, any
v_readlane/v_writelane still asks for it. On a 32-lane host spills stay
per-lane with no wave size, and the console flow still skips them.

The test now wants WaveSize(64) on ANY and none on 32-32, both from the
first (per-lane) pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings d5f8f2c (SGPR spills keep main's wave size where the host runs
it). `whole` keeps this branch's ds_bpermute_b32 exception beside
#320's named_lane.

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

@⁠Raxstreams on GitHub · 2026-11-24 03:33 UTC · original

On an RTX 3080 Ti (32 lanes), I replayed 77 captured compute shaders that the #414 translator had rejected for wave64 lanes or shared LDS. With this change applied, 20 of 77 passed both DXIL validation and actual D3D12 compute pipeline creation. The other 57 still failed. This is offline pipeline coverage. I have not verified the dispatch outputs for these shaders.

**@⁠Raxstreams** on GitHub · 2026-11-24 03:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7121214836) On an RTX 3080 Ti (32 lanes), I replayed 77 captured compute shaders that the #414 translator had rejected for wave64 lanes or shared LDS. With this change applied, 20 of 77 passed both DXIL validation and actual D3D12 compute pipeline creation. The other 57 still failed. This is offline pipeline coverage. I have not verified the dispatch outputs for these shaders.
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 03:37 UTC · original

Verified 88cb024 on Arch Linux x86_64 (rustc 1.98.1, cargo test -p victory-shader): 58 passed, 0 failed, 0 ignored.

Not covered: the new console-wave LDS paths executed on a Windows/Wine GPU (parser/emit tests only here) and title behaviour (no game data).

**@⁠DaviTostes** on GitHub · 2026-11-24 03:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7121267312) Verified `88cb024` on **Arch Linux x86_64** (rustc 1.98.1, `cargo test -p victory-shader`): **58 passed, 0 failed, 0 ignored**. Not covered: the new console-wave LDS paths executed on a Windows/Wine GPU (parser/emit tests only here) and title behaviour (no game data).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 03:38 UTC · original

Thank you. 20 of 77 passing both checks is a useful floor, and the 57 are the more interesting part.

Could you post how the 57 split, as counts only?

  • stopped at translation, by reason (on this branch the wave64 reasons name the cause: a group of more than 64 threads, ds_permute across the halves, a whole-wave section);
  • translated but refused by the validator. On 9745f35 (this PR's head) each validator failure in translate --validate also prints what our module declares and calls (thread-group size, wave size, dx.op operations; nothing of the console program). That line is what I need: a whole-title run found 20 modules that #320's console flow emits and the validator refuses, which I cannot reproduce with hand-assembled programs, and it is why this PR and #320 are drafts;
  • validated but refused at pipeline creation, with the error.

No game data used on my side. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 03:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7121288781) Thank you. 20 of 77 passing both checks is a useful floor, and the 57 are the more interesting part. Could you post how the 57 split, as counts only? - stopped at translation, by reason (on this branch the wave64 reasons name the cause: `a group of more than 64 threads`, `ds_permute across the halves`, `a whole-wave section`); - translated but refused by the validator. On `9745f35` (this PR's head) each validator failure in `translate --validate` also prints what our module declares and calls (thread-group size, wave size, `dx.op` operations; nothing of the console program). That line is what I need: a [whole-title run](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233) found 20 modules that #320's console flow emits and the validator refuses, which I cannot reproduce with hand-assembled programs, and it is why this PR and #320 are drafts; - validated but refused at pipeline creation, with the error. No game data used on my side. AI-assisted.
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 03:42 UTC · original

Re-checked the new head 9745f35 (“translate: say what a module the validator refuses declares and calls”) on Arch Linux x86_64 (rustc 1.98.1): cargo test -p victory-shader 58 passed, 0 failed, 0 ignored — same result as 88cb024, no regression from the force-push.

**@⁠DaviTostes** on GitHub · 2026-11-24 03:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7121340309) Re-checked the new head `9745f35` (“translate: say what a module the validator refuses declares and calls”) on **Arch Linux x86_64** (rustc 1.98.1): `cargo test -p victory-shader` **58 passed, 0 failed, 0 ignored** — same result as `88cb024`, no regression from the force-push.
Author
Owner

@⁠SpaghettiMaster545 on GitHub · 2026-11-24 03:54 UTC · original

Tested with the title at 9745f35 (this PR with the #223 / #233 / #320 stack under it), merged onto main d2a4bae. The same setup as my runs on #320: RTX 5070 Ti, driver 621.24 (32-lane waves), Ryzen 7 9800X3D, Windows 11 10.0.26100, Rust 1.98.1, diag build, its own empty VICTORY_CACHE_DIR, VICTORY_KEYS into story mode, until the host GPU failure (#71).

Program by program:

against gained lost notes
main d2a4bae 71 0 of main's 119 driver-refused compute programs, 70 run now (26 with #320 alone), 45 stop in translation, 4 not reached
#320 a5ba4a4 45 0 a wave64 group sharing LDS without barriers on a host without 64-lane waves: 38 → 0
  • No pipeline is refused by the driver (0, as with #320).
  • The reasons left for the stack's own refusals, over every program this run reached: a whole-wave section of a wave64 on a host without 64-lane waves 24, console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves 20. So the remaining 67 from my #320 run now split into those two.
  • The world hang is unchanged (67 s, within main's 59–111 s), and world frames are as before (~0.7 s), as you expected.

Not tested: a 64-lane adapter, a release build, image results, cargo test on this head.

(Claude Code, Claude Opus 5.5: ran the title and compared the logs program by program.)

**@⁠SpaghettiMaster545** on GitHub · 2026-11-24 03:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7121529117) **Tested with the title** at `9745f35` (this PR with the #223 / #233 / #320 stack under it), merged onto `main` `d2a4bae`. The same setup as my runs on #320: RTX 5070 Ti, driver 621.24 (32-lane waves), Ryzen 7 9800X3D, Windows 11 10.0.26100, Rust 1.98.1, diag build, its own empty `VICTORY_CACHE_DIR`, `VICTORY_KEYS` into story mode, until the host GPU failure (#71). Program by program: | against | gained | lost | notes | |---|---|---|---| | `main` `d2a4bae` | 71 | 0 | of `main`'s 119 driver-refused compute programs, 70 run now (26 with #320 alone), 45 stop in translation, 4 not reached | | #320 `a5ba4a4` | 45 | 0 | `a wave64 group sharing LDS without barriers on a host without 64-lane waves`: 38 → 0 | - No pipeline is refused by the driver (0, as with #320). - The reasons left for the stack's own refusals, over every program this run reached: `a whole-wave section of a wave64 on a host without 64-lane waves` 24, `console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves` 20. So the remaining 67 from my #320 run now split into those two. - The world hang is unchanged (67 s, within `main`'s 59–111 s), and world frames are as before (~0.7 s), as you expected. **Not tested**: a 64-lane adapter, a release build, image results, `cargo test` on this head. (Claude Code, Claude Opus 5.5: ran the title and compared the logs program by program.)
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 03:56 UTC · original

Thank you, that is exactly the split I was after: 70 of main's 119 driver-refused programs running, nothing lost, and the rest now named (whole-wave sections 24, groups of more than 64 threads 20).

That orders what comes after this PR: whole-wave sections in the console flow first, then groups of several console waves. I am not stacking either on top yet. #320 and this PR are drafts because a whole-title validate run found 20 modules the console flow emits that dxil.dll refuses, and a title run cannot show those. If you ever run victory translate --validate over the same files on this head, the validator lines (they now carry thread-group size, wave size and the dx.op operations of our module, nothing of the console program) are what would unblock both.

I have added your numbers to the description.

No game data used on my side. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 03:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7121556022) Thank you, that is exactly the split I was after: 70 of `main`'s 119 driver-refused programs running, nothing lost, and the rest now named (whole-wave sections 24, groups of more than 64 threads 20). That orders what comes after this PR: whole-wave sections in the console flow first, then groups of several console waves. I am not stacking either on top yet. #320 and this PR are drafts because a whole-title validate run found 20 modules the console flow emits that `dxil.dll` refuses, and a title run cannot show those. If you ever run `victory translate --validate` over the same files on this head, the validator lines (they now carry thread-group size, wave size and the `dx.op` operations of our module, nothing of the console program) are what would unblock both. I have added your numbers to the description. No game data used on my side. AI-assisted.
Author
Owner

@⁠Raxstreams on GitHub · 2026-11-24 04:05 UTC · original

Following the offline check above, I tested integer whole-wave scans across the two hardware waves. The synthetic 64-lane prefix sum reads back exactly on an RTX 3080 Ti, including 528 for lane 32. The follow-up against this PR's head is https://github.com/r4tedx/VIctory/pull/1.

In a local integration build the material-tile initialization shader passed offline D3D12 compute pipeline creation and dispatched during the opening scene. The final scene color was still dark in the captured frame.

**@⁠Raxstreams** on GitHub · 2026-11-24 04:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7121693853) Following the offline check above, I tested integer whole-wave scans across the two hardware waves. The synthetic 64-lane prefix sum reads back exactly on an RTX 3080 Ti, including 528 for lane 32. The follow-up against this PR's head is https://github.com/r4tedx/VIctory/pull/1. In a local integration build the material-tile initialization shader passed offline D3D12 compute pipeline creation and dispatched during the opening scene. The final scene color was still dark in the captured frame.
Author
Owner

@⁠Halfect on GitHub · 2026-11-24 05:33 UTC · original

64-lane AMD result for e49302a: AMD Radeon 610M, driver 32.0.21030.2001, Windows 11 build 22631; D3D12 reports 32..64 lanes. I ran translate --validate --pipelines --list --jobs 8 on this head and main d2a4bae, explicitly selecting the Radeon adapter.

All 22,178 emitted modules on this head successfully created D3D12 pipelines. Across 25,889 shared program labels, the comparison against main found 0 DXIL-validation gains/losses and 0 pipeline-creation gains/losses. The aggregate compute totals were 1,715 emitted / 1,672 validated / 1,715 pipelines here versus 1,693 / 1,670 / 1,693 on main; these are whole-stack totals and are not attributed to Wave64 alone.

Full stage table, label-exclusion rule and reason changes: #293

Offline only; no title executable or world run. AI-assisted (Kimi).

**@⁠Halfect** on GitHub · 2026-11-24 05:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123054389) **64-lane AMD result for `e49302a`:** AMD Radeon 610M, driver `32.0.21030.2001`, Windows 11 build 22631; D3D12 reports **32..64 lanes**. I ran `translate --validate --pipelines --list --jobs 8` on this head and `main` `d2a4bae`, explicitly selecting the Radeon adapter. All **22,178 emitted modules** on this head successfully created D3D12 pipelines. Across 25,889 shared program labels, the comparison against `main` found **0 DXIL-validation gains/losses and 0 pipeline-creation gains/losses**. The aggregate compute totals were 1,715 emitted / 1,672 validated / 1,715 pipelines here versus 1,693 / 1,670 / 1,693 on `main`; these are whole-stack totals and are not attributed to Wave64 alone. Full stage table, label-exclusion rule and reason changes: https://git.gtahub.st/github/Marvisak--VIctory/issues/293 Offline only; no title executable or world run. AI-assisted (Kimi).
Author
Owner

@⁠Halfect on GitHub · 2026-11-24 05:42 UTC · original

Follow-up correction to my 64-lane comparison: after normalizing the instruction offset present only on failure labels, the matched result is 22 pipeline-creation gains, 2 DXIL-validation gains, and 0 losses across 25,912 shared labels. The 22 gains are a lane-mask join of an untracked mask → ok, accounting for the aggregate compute increase from the underlying stack.

Details: #293

The earlier stage totals were correct; the initial 0-gain figure omitted these emit-to-success transitions. No 64-lane regression was found.

**@⁠Halfect** on GitHub · 2026-11-24 05:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123192692) Follow-up correction to my 64-lane comparison: after normalizing the instruction offset present only on failure labels, the matched result is **22 pipeline-creation gains, 2 DXIL-validation gains, and 0 losses** across 25,912 shared labels. The 22 gains are `a lane-mask join of an untracked mask` → `ok`, accounting for the aggregate compute increase from the underlying stack. Details: https://git.gtahub.st/github/Marvisak--VIctory/issues/293 The earlier stage totals were correct; the initial 0-gain figure omitted these emit-to-success transitions. No 64-lane regression was found.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 05:47 UTC · original

Head moved from e49302a to 8876ed3 (two commits, nothing below them changed). I force-pushed once in between to correct a commit message; a32c177 replaces 91af621, same diff apart from comments.

  • a32c177: a test for the pattern a reviewer measured stale reads for on #189: one console wave, no s_barrier, LDS written and read in different exec-masked blocks. Exact on the RTX 5070 and the Radeon iGPU in three variants. The third (masks only, no branch around either access) is the first test here that needs the barrier before each LDS access: with it left out, the lower half reads 0 in 20 of 20 runs on the RTX 5070; with it, exact in 20 of 20. The description's "Not verified" paragraph said no test showed that; it is updated. Table on #189.
  • 8876ed3: the startup warning's text (a nit from #233's review).

@⁠Halfect: thank you for the 64-lane A/B. 0 changes over 25,889 programs on a Radeon is the result this stack is supposed to give there, and it is now linked in the description. My reading of the 22 extra compute modules emitted on that host, not checked program by program: they are #320's (lane reads where lanes branch differently go through the console flow on every host, and nothing else in the stack acts on a 64-lane host), and the 20 of them that do not validate are the compute image_sample class that #180 fixes, the same count a 32-lane run found for #320.

cargo test --workspace at 8876ed3: 289 passed, 0 failed, 4 ignored (RTX 5070 + Radeon iGPU, Windows 11). Synthetic programs only; no title data. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 05:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123277304) Head moved from `e49302a` to `8876ed3` (two commits, nothing below them changed). I force-pushed once in between to correct a commit message; `a32c177` replaces `91af621`, same diff apart from comments. - `a32c177`: a test for the pattern a reviewer [measured stale reads for on #189](https://git.gtahub.st/github/Marvisak--VIctory/pulls/189): one console wave, no `s_barrier`, LDS written and read in different exec-masked blocks. Exact on the RTX 5070 and the Radeon iGPU in three variants. The third (masks only, no branch around either access) is the first test here that needs the barrier before each LDS access: with it left out, the lower half reads 0 in 20 of 20 runs on the RTX 5070; with it, exact in 20 of 20. The description's "Not verified" paragraph said no test showed that; it is updated. [Table on #189](https://git.gtahub.st/github/Marvisak--VIctory/pulls/189). - `8876ed3`: the startup warning's text (a nit from #233's review). @⁠Halfect: thank you for the 64-lane A/B. 0 changes over 25,889 programs on a Radeon is the result this stack is supposed to give there, and it is now linked in the description. My reading of the 22 extra compute modules emitted on that host, not checked program by program: they are #320's (lane reads where lanes branch differently go through the console flow on every host, and nothing else in the stack acts on a 64-lane host), and the 20 of them that do not validate are the compute `image_sample` class that #180 fixes, the same count a 32-lane run found for #320. `cargo test --workspace` at `8876ed3`: 289 passed, 0 failed, 4 ignored (RTX 5070 + Radeon iGPU, Windows 11). Synthetic programs only; no title data. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 05:55 UTC · original

Head is now f653ea4 (was 8876ed3; fast-forward, two commits):

  • 416714c, by @⁠Raxstreams (r4tedx/VIctory#2, reviewed and tested there): ds_bpermute_b32, which did not translate on any host, lowered as a read within the lane's own 32-lane half. Per-half is how the contributor reads AMD's RDNA 2 ISA reference for wave64 on GFX10; it is not checked on console hardware.
  • f653ea4: my tests for it (a mask over part of each half, groups of 128, 48 and 32 threads, and the permute beside a lane read across the halves) and the plan document. Exact on the RTX 5070 and the Radeon iGPU. cargo test --workspace: 292 passed, 0 failed, 4 ignored.

The description is updated for this, and corrected in a few places a read-through found: main emits 23 modules of the compute image_sample class (not 22); the title run linked under "Measured" was at 9745f35, and nobody has run the title on a head with the whole-wave-section or backward-permute commits; the list of what still stops now says which whole-wave sections do.

One measurement that would place this stack, if anyone who ran it has the time (@⁠SlopComp, @⁠Zignixx, @⁠Vyral1978): the set that stayed in the world for 7 to 14 minutes on #71 (main + #493 #483 #189 #89 #205 #206 #469 #459 #454, loop limit 32) has #189 doing the wave64 work. Nobody has run that set with this stack in #189's place (the two conflict, so it is one or the other), same loop limit. Whether it also stays up, and the per-frame drop summary next to yours, would say whether the stack is safe to run in the world and what it changes there. Counts and reasons are all that is needed.

Synthetic programs only on my side; no title data. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 05:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123398032) Head is now `f653ea4` (was `8876ed3`; fast-forward, two commits): - `416714c`, by @⁠Raxstreams ([r4tedx/VIctory#2](https://github.com/r4tedx/VIctory/pull/2), reviewed and tested there): `ds_bpermute_b32`, which did not translate on any host, lowered as a read within the lane's own 32-lane half. Per-half is how the contributor reads AMD's RDNA 2 ISA reference for wave64 on GFX10; it is not checked on console hardware. - `f653ea4`: my tests for it (a mask over part of each half, groups of 128, 48 and 32 threads, and the permute beside a lane read across the halves) and the plan document. Exact on the RTX 5070 and the Radeon iGPU. `cargo test --workspace`: 292 passed, 0 failed, 4 ignored. The description is updated for this, and corrected in a few places a read-through found: `main` emits 23 modules of the compute `image_sample` class (not 22); the title run linked under "Measured" was at `9745f35`, and nobody has run the title on a head with the whole-wave-section or backward-permute commits; the list of what still stops now says which whole-wave sections do. **One measurement that would place this stack**, if anyone who ran it has the time (@⁠SlopComp, @⁠Zignixx, @⁠Vyral1978): the set that stayed in the world for 7 to 14 minutes on #71 (`main` + #493 #483 #189 #89 #205 #206 #469 #459 #454, loop limit 32) has #189 doing the wave64 work. Nobody has run that set with this stack in #189's place (the two conflict, so it is one or the other), same loop limit. Whether it also stays up, and the per-frame drop summary next to yours, would say whether the stack is safe to run in the world and what it changes there. Counts and reasons are all that is needed. Synthetic programs only on my side; no title data. AI-assisted (Claude Code).
Author
Owner

@⁠Zignixx on GitHub · 2026-11-24 05:59 UTC · original

@⁠r4tedx I'll run it. Same machine as my #71 reports (RTX 5080, driver 32.0.16.2101, Windows 11 26200, TdrDelay=8): d2a4bae + this stack at f653ea4 + #493 #483 #89 #205 #206 #469 #459 #454, with #189 left out, diag build, VICTORY_SHADER_LOOP_LIMIT=32, DRED, scripted Enter presses, empty shader cache.

I'll post here whether it stays up, and the per-frame summary next to the #189 run: draws run, drops without a host pipeline by stage, indirect prepare failed by kind, pipelines refused, and shader does not translate by reason. Counts and reasons only.

One caveat for the comparison: since my last #71 comment I run with a larger dynamic descriptor range on the capped heap (262,144 slots instead of 65,536), because at 65,536 about 1,700 indirect mesh dispatches per frame were dropped for lack of slots and that would bury any difference between the two wave64 approaches. I'll use the same setting on both sides and say so in the table.

AI use: Claude Code (Claude Mythos 5.2) prepares the branch and runs it on my machine; posted at my request.

**@⁠Zignixx** on GitHub · 2026-11-24 05:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123468387) @⁠r4tedx I'll run it. Same machine as my #71 reports (RTX 5080, driver 32.0.16.2101, Windows 11 26200, `TdrDelay=8`): `d2a4bae` + this stack at `f653ea4` + #493 #483 #89 #205 #206 #469 #459 #454, with #189 left out, diag build, `VICTORY_SHADER_LOOP_LIMIT=32`, DRED, scripted Enter presses, empty shader cache. I'll post here whether it stays up, and the per-frame summary next to the #189 run: draws run, drops without a host pipeline by stage, indirect `prepare failed` by kind, pipelines refused, and `shader does not translate` by reason. Counts and reasons only. One caveat for the comparison: since my last #71 comment I run with a larger dynamic descriptor range on the capped heap (262,144 slots instead of 65,536), because at 65,536 about 1,700 indirect mesh dispatches per frame were dropped for lack of slots and that would bury any difference between the two wave64 approaches. I'll use the same setting on both sides and say so in the table. AI use: Claude Code (Claude Mythos 5.2) prepares the branch and runs it on my machine; posted at my request.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 06:09 UTC · original

Head is now 965ce30 (was f653ea4; fast-forward, one commit): float whole-wave reductions cross the halves. A section that leaves a float sum, minimum or maximum in a 64-thread group no longer stops on a 32-lane host. Each half's result crosses as its bits; minimum and maximum stay exact, and a sum is the two halves' sums added last (one more order of additions, so the last bits may differ, as they already may within one host wave).

Tested (synthetic; the title was not used in these tests): hand-assembled sections over the lane ids as floats, on an RTX 5070 (32..32) and a Radeon iGPU (32..64): sum, maximum, minimum with identities 0.0 / -inf / +inf, a sum over a mask that straddles the halves, an inclusive prefix sum. Exact on both. cargo test --workspace: 294 passed, 0 failed, 4 ignored.

Measured locally (local title data, offline): victory translate --host-lanes 32-32 --validate --list over a local copy of the title's shader archive, CPU only, no pipelines and nothing launched; counts and reasons only. f653ea4 against 965ce30, program by program:

  • Compute programs emitted 1,668 → 1,676 of 2,581; 0 that translated before stop.
  • Of the 18 programs that stopped on a float whole-wave operation, 8 translate now and all 8 validate; 10 reach a later reason (a lane-mask join of an untracked mask 5, v_cvt_f32_f64 4, v_permlanex16_b32 1).
  • Left for wave size on a 32-lane host: 43 programs in groups of more than 64 threads (16x16x1: 15, 1024x1x1: 7, 8x16x1: 6, 256x1x1: 4, 512x1x1: 2, 128x1x1: 2, 32x32x1: 1), 4 sections in other group sizes, 2 section steps the simulation does not follow.
  • 45 compute modules fail validation, all with the stage-incompatibility message, all calling sample (#180's class).

Not run: pipelines, rendering, the title. Groups of more than 64 threads are next.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 06:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123636859) Head is now `965ce30` (was `f653ea4`; fast-forward, one commit): **float whole-wave reductions cross the halves.** A section that leaves a float sum, minimum or maximum in a 64-thread group no longer stops on a 32-lane host. Each half's result crosses as its bits; minimum and maximum stay exact, and a sum is the two halves' sums added last (one more order of additions, so the last bits may differ, as they already may within one host wave). **Tested (synthetic; the title was not used in these tests):** hand-assembled sections over the lane ids as floats, on an RTX 5070 (32..32) and a Radeon iGPU (32..64): sum, maximum, minimum with identities 0.0 / -inf / +inf, a sum over a mask that straddles the halves, an inclusive prefix sum. Exact on both. `cargo test --workspace`: 294 passed, 0 failed, 4 ignored. **Measured locally (local title data, offline):** `victory translate --host-lanes 32-32 --validate --list` over a local copy of the title's shader archive, CPU only, no pipelines and nothing launched; counts and reasons only. `f653ea4` against `965ce30`, program by program: - Compute programs emitted 1,668 → 1,676 of 2,581; 0 that translated before stop. - Of the 18 programs that stopped on a float whole-wave operation, 8 translate now and all 8 validate; 10 reach a later reason (`a lane-mask join of an untracked mask` 5, `v_cvt_f32_f64` 4, `v_permlanex16_b32` 1). - Left for wave size on a 32-lane host: 43 programs in groups of more than 64 threads (16x16x1: 15, 1024x1x1: 7, 8x16x1: 6, 256x1x1: 4, 512x1x1: 2, 128x1x1: 2, 32x32x1: 1), 4 sections in other group sizes, 2 section steps the simulation does not follow. - 45 compute modules fail validation, all with the stage-incompatibility message, all calling `sample` (#180's class). Not run: pipelines, rendering, the title. Groups of more than 64 threads are next. AI-assisted (Claude Code).
Author
Owner

@⁠RealCaCl2 on GitHub · 2026-11-24 06:10 UTC · original

Measured on an RTX 5060 Laptop (Blackwell, 32-lane waves, driver 32.0.16.2124), Windows 11 26300. Ran translate --validate --pipelines over the full corpus (26,148 programs; 2,581 compute) with each stage merged onto main@d2a4bae (also #334, #110, #154). Vertex/pixel and mesh were identical in all three runs.

compute main + #233 + #439 (with #320)
pipelines created 1,372 1,470 1,663
refused by the driver (E_INVALIDARG) 321 0 0
declined: wave64 on a 32-lane host – 282 65 (43 groups > 64 threads, 18 FP whole-wave across halves, 4 whole-wave sections)
failing dxil.dll validation 23 22 45

The validation rise matches your note: exactly 20 of the new failures are 32×1×1 wave-32 compute modules calling sample, the #180 class. The NVIDIA driver still created pipelines for all 45 unvalidated modules, so it doesn't catch them. That's another reason to land #180 with this.

victory-shader tests: 94/94 pass on this GPU when run serially. With parallel threads, lane_reads_in_a_loop_lanes_leave_at_different_iterations once hung for 18 minutes at 0% CPU and GPU (looks like #433).

**@⁠RealCaCl2** on GitHub · 2026-11-24 06:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123660716) Measured on an **RTX 5060 Laptop** (Blackwell, 32-lane waves, driver 32.0.16.2124), Windows 11 26300. Ran `translate --validate --pipelines` over the full corpus (26,148 programs; 2,581 compute) with each stage merged onto main@d2a4bae (also #334, #110, #154). Vertex/pixel and mesh were identical in all three runs. | compute | main | + #233 | + #439 (with #320) | |---|---|---|---| | pipelines created | 1,372 | 1,470 | **1,663** | | refused by the driver (`E_INVALIDARG`) | 321 | 0 | 0 | | declined: wave64 on a 32-lane host | – | 282 | **65** (43 groups > 64 threads, 18 FP whole-wave across halves, 4 whole-wave sections) | | failing `dxil.dll` validation | 23 | 22 | **45** | The validation rise matches your note: exactly 20 of the new failures are 32×1×1 wave-32 compute modules calling `sample`, the #180 class. The NVIDIA driver still created pipelines for all 45 unvalidated modules, so it doesn't catch them. That's another reason to land #180 with this. `victory-shader` tests: 94/94 pass on this GPU when run serially. With parallel threads, `lane_reads_in_a_loop_lanes_leave_at_different_iterations` once hung for 18 minutes at 0% CPU and GPU (looks like #433).
The one conflict was in apps/victory/src/main.rs, where main's
`--jobs` became a `NonZeroUsize` and the branch added `--host-lanes`:
`translate::run` takes both, `jobs.map(NonZeroUsize::get)` as main
passes it and the branch's `host_lanes` after it.

The `emit` and `lower::Parts` call sites main added in tests (census,
crosslane, memory, synthetic, `emit::tests`, `resource` and lower.rs's
own) pass `Target::ANY`, as the earlier merge did for the ones before
them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A pure move, so that the merge of main (63bcca4) keeps emit/lower.rs
under the asset policy's 512 KiB limit: the inline `mod tests` becomes
`mod tests;` beside `mod bvh;`, and its body, one indent level less and
otherwise unchanged, is emit/lower/tests.rs. Its `super::` paths still
name `lower`.

Moving the tests out of lower.rs is desplmfao's idea (#2309).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts, resolved with kawaii-shakal's notes on #439:

- emit/host.rs: main's process-wide WARP device (`SharedDevice`,
  `WARP_LOCK`, `lock_warp`, `from_device`) is kept, and its
  `create_device` takes an optional adapter for the branch's
  `VICTORY_ADAPTER` and `Host::on`.
- emit/lower.rs: `console_read_lane` stays beside main's new
  `helpers_read` doc; main's `uniform_join` sits above `never_taken`,
  which keeps the branch's console-flow note.
- Lane-mask joins: main's path for data joined with masks at a uniform
  join (the BVH walks pop masks from memory) stays beside the console
  flow's masks; `lane_bit` now returns a `Result`, so it takes `?`.
  `no_mask_lane_on_edge` is kept out of the console flow, whose lanes go
  along the wave's edges.
- emit/lower/tests.rs (lower.rs's tests, moved out before this merge):
  main's test changes are ported there. Its `lowers` helper calls
  `lower` directly, so it now lowers a program again in the console flow
  when the first try asks for it, as `emit_with` does
  (`a_scalar_result_needs_no_exec`).
- The `lower::Parts` sites main added in tests (crosslane, memory,
  synthetic, lower's) pass `console_cf: false`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts:

- emit/lower.rs, lane-mask joins: the branch's console-flow masks
  (constants and masks built from scalars, `st.other`) feed main's
  `match`, which keeps main's path for data joined with masks at a
  uniform join (the BVH walks) and keeps `no_mask_lane_on_edge` out of
  the console flow, after kawaii-shakal's notes on #439.
- emit/lower.rs's tests now live in emit/lower/tests.rs (moved on the
  console flow branch): the branch's `per_lane_only: false` lines are
  ported there, and the `lowers` helper keeps the per-lane form where
  the console flow cannot lower a program, as `emit_with` does here.
- The `lower::Parts` sites main added in tests (crosslane, memory,
  synthetic, lower's) pass `per_lane_only: false`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts:

- emit/lower.rs: the branch's `numeric` and main's `scalar_def`,
  `sgpr_operand` and `scalar_constant` were added side by side; both
  are kept.
- `ds_bpermute_b32`: main's lowering, which adds the reader's half as
  the base only for wave64 programs, so a wave32 program reads no
  `waveGetLaneIndex` (main's
  `ds_bpermute_wave64_preserves_32_lane_half`), as kawaii-shakal
  noted. The lane is the same as the branch's in both cases. The
  comment keeps main's ISA reference and the branch's note on programs
  split in halves.
- lower.rs's tests now live in emit/lower/tests.rs (moved on the
  console flow branch): the branch's one change to them (`lower_wave`
  names `crate::emit::Target::ANY`) is ported there. The branch's
  `select_tests` module stays in lower.rs, as it was.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's view-mark test builds emit::Options by hand; this branch adds a
target field to Options, so the test now fills the rest from Default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's placed-UAV diagnostics test calls emit::emit with the six arguments
it had before this branch added the target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Machad3x reported the missing-upper-half minimum and proposed skipping the exchange at 32 threads or fewer in Marvisak/VIctory#2214. Exercise a nonzero minimum and both sides of the host-wave boundary on the current #439 stack.

(cherry picked from commit 9cc76b82f99f8141eafc5ca7a449d65ed4417460)
Machad3x proposed the split f16 reduction in Marvisak/VIctory#2214. Exercise both halves of the packed source word for full, lower-forty and upper-half EXEC masks.

(cherry picked from commit 591c51c486344d265c5351017de233ec32d7ea49)
The split-halves f16 sum test dispatches only on hardware adapters, so
CI and WARP runs check its translation, not which lane gives the high
half. Assert that the scan ending in lane 31 leaves Shape::Half with
lane 31 (and 63 for the other form), and that the sum translates for
groups of 32 and 48 threads as well as 64.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠walterwallaceson on GitHub · 2026-11-24 06:16 UTC · original

Tested f653ea4 (which carries #320 and #233) on Windows 10 22H2 (19045.6466), RTX 3070, NVIDIA 621.14 (waves 32-32), Ryzen 5 5600X, release build, with #175 (19aec59), #55 (56f1d41), #89 (081afbd) and #336 (e8d3b64) merged on top. All merged cleanly.

victory translate --pipelines --validate, whole title:

#233 at 3098672 #439 at f653ea4
compute emitted / programs 1470 / 2581 1668 / 2581
compute validated 1448 1623
host pipelines refused 0 0
"console wave64 lanes on a host without 64-lane waves" 162 0
"a wave64 group sharing LDS without barriers …" 120 0
"console wave64 lanes in a group of more than 64 threads …" — 43
"a whole-wave section of a wave64 …" — 5

So the 120 → 0 from the RTX 5070 Ti run holds here too. Vertex/pixel and mesh counts are unchanged.

Game run: no visible change from the same stack without #320/#439. The intro and the first mission's title card render, the opening cutscene's subtitles advance over a black scene at 0.3–1.1 fps, no free dynamic descriptor slots appears ~8 s into the world load, and the device is removed (0x887A0006, no breadcrumbs) ~1.5 min in (~2 min in the run before; one run each). No title exceptions.

cargo test --workspace: one new failure from #320 on Windows 10. emit::lane_read_loop_tests::lane_reads_in_a_loop_lanes_leave_at_different_iterations panics with NVIDIA GeForce RTX 3070: wave32: The parameter is incorrect. from compute_pipeline. Its devices() only checks that D3D12CreateDevice at feature level 12_0 succeeds; without the Agility SDK in the test executable the root signature is refused, as in #362. The split_tests skip on the same machine with "no SM 6.6 hardware device; skipped", so this test probably wants the same SM 6.6 check. Otherwise only the known Windows 10 failures (#118/#152, #362).

No game data in this report.

AI-assisted (Claude Code); everything above was run on my machine.

**@⁠walterwallaceson** on GitHub · 2026-11-24 06:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123761055) Tested f653ea4 (which carries #320 and #233) on Windows 10 22H2 (19045.6466), RTX 3070, NVIDIA 621.14 (waves 32-32), Ryzen 5 5600X, release build, with #175 (19aec59), #55 (56f1d41), #89 (081afbd) and #336 (e8d3b64) merged on top. All merged cleanly. `victory translate --pipelines --validate`, whole title: | | #233 at 3098672 | #439 at f653ea4 | |---|---|---| | compute emitted / programs | 1470 / 2581 | 1668 / 2581 | | compute validated | 1448 | 1623 | | host pipelines refused | 0 | 0 | | "console wave64 lanes on a host without 64-lane waves" | 162 | 0 | | "a wave64 group sharing LDS without barriers …" | 120 | 0 | | "console wave64 lanes in a group of more than 64 threads …" | — | 43 | | "a whole-wave section of a wave64 …" | — | 5 | So the 120 → 0 from the RTX 5070 Ti run holds here too. Vertex/pixel and mesh counts are unchanged. Game run: no visible change from the same stack without #320/#439. The intro and the first mission's title card render, the opening cutscene's subtitles advance over a black scene at 0.3–1.1 fps, `no free dynamic descriptor slots` appears ~8 s into the world load, and the device is removed (`0x887A0006`, no breadcrumbs) ~1.5 min in (~2 min in the run before; one run each). No title exceptions. `cargo test --workspace`: one new failure from #320 on Windows 10. `emit::lane_read_loop_tests::lane_reads_in_a_loop_lanes_leave_at_different_iterations` panics with `NVIDIA GeForce RTX 3070: wave32: The parameter is incorrect.` from `compute_pipeline`. Its `devices()` only checks that `D3D12CreateDevice` at feature level 12_0 succeeds; without the Agility SDK in the test executable the root signature is refused, as in #362. The `split_tests` skip on the same machine with "no SM 6.6 hardware device; skipped", so this test probably wants the same SM 6.6 check. Otherwise only the known Windows 10 failures (#118/#152, #362). No game data in this report. AI-assisted (Claude Code); everything above was run on my machine.
Author
Owner

@⁠Zignixx on GitHub · 2026-11-24 06:18 UTC · original

Result on the RTX 5080: the stack stays up, and it fills the G-buffer where #189 does not.

Same machine as before (RTX 5080, driver 32.0.16.2101, Windows 11 26200, TdrDelay=8). Two builds, run back to back with identical settings:

Both: diag build, VICTORY_SHADER_LOOP_LIMIT=32, DRED, scripted Enter presses, empty shader cache, 262,144 dynamic descriptor slots on the capped heap (local switch, same on both sides, so no dispatch is dropped for slots), 7 minutes from launch, about 6 minutes in the world. Merging B: only the known #483/#336 conflict in HostHeap::new; one test helper from #459 needed this stack's new target argument. One run each.

Stability and per-frame numbers (medians over the world)

A (#189) B (#439 stack)
Device removed no no
slow host submission lines 0 2 (max 261 ms)
Host pipelines refused 0 0
Frame time 850 ms 1,233 ms
– preparing / on the GPU / copying back 392 / 175 / 233 ms 517 / 211 / 436 ms
Draws run per frame 2,121 2,144
Dropped without a host pipeline 1,470 958
Dropped indirect 1,405 1,357
Pipelines that drop something 110 91
shader does not translate lines 552 455

Translation failures by reason (distinct shaders, top of each list):

Reason A B
a select on an untracked mask 95 100
a lane mask holding lanes elsewhere read as data 91 91
v_readfirstlane in divergent control flow 91 0
a cross-lane wave operation in divergent control flow 57 0
a descriptor read only as data 42 44
an address in an SGPR that is no root parameter 34 35
a structured buffer of unknown stride 28 33
console waveN lanes in a group of more than N threads on a host… 0 26
a scalar memory read as data 22 24

The four instance-culling programs named on #71 (fdd56d97a806bcca, 17af15c4015cb4b6, 55679a0547649d0b, 89d08e561897d4e5): on A they fail with the cross-lane error; on B they fail with a structured buffer of unknown stride, which is what #193 addresses. The largest remaining droppers are the same on both (indirect kind 0: prepare failed 234/frame, compute e30970f1727063fd ~212/frame, pixel 94d281151ca58b4f ~175/frame, compute 3b90165a77d95cdf).

What reaches the G-buffer

VICTORY_DUMP_TARGETS=1, frame 1600 on both, about two minutes into the world:

A (#189) B (#439 stack)
≥2560-wide targets with more than 0.2% non-background pixels 10 of 43 14 of 53
Richest 2560×1440 f28 target 10.5% covered: a lamp post, a line of small marks, and three huge wrong triangles, all inside a sub-rectangle of the target 67.9% covered: a dense, coherent, full-width view (structures, cables, stacked objects, ground detail)
2560×1440 f26 targets all zero all zero
Presented frame black (film grain and UI only) black (film grain and UI only)

So on this card the wrong, sparse geometry I reported on #71 comes with the #189 emulation, and with this stack the scene's geometry is in the G-buffer. The lit targets are still empty on both, so the picture is still black; that is a separate, later gap.

Caveats

One run per build and one dumped frame per build; the two runs are not the same game moment to the frame. B is slower per frame here (more time preparing and copying back); I have not looked at why. Not tested: default loop limit, AMD.

Counts, hashes and coverage numbers only; no game data attached. AI use: Claude Code (Claude Mythos 5.2) prepared both branches, ran them on my machine, analysed the logs and dumps and wrote this comment; posted at my request.

**@⁠Zignixx** on GitHub · 2026-11-24 06:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123794194) **Result on the RTX 5080: the stack stays up, and it fills the G-buffer where #189 does not.** Same machine as before (RTX 5080, driver 32.0.16.2101, Windows 11 26200, `TdrDelay=8`). Two builds, run back to back with identical settings: - **A (#189):** `d2a4bae` + #493 #483 **#189** #89 #205 #206 #469 #459 #454 - **B (this stack):** `d2a4bae` + **#439 at `f653ea4`** + #493 #483 #89 #205 #206 #469 #459 #454 Both: diag build, `VICTORY_SHADER_LOOP_LIMIT=32`, DRED, scripted Enter presses, empty shader cache, 262,144 dynamic descriptor slots on the capped heap (local switch, same on both sides, so no dispatch is dropped for slots), 7 minutes from launch, about 6 minutes in the world. Merging B: only the known #483/#336 conflict in `HostHeap::new`; one test helper from #459 needed this stack's new `target` argument. One run each. ## Stability and per-frame numbers (medians over the world) | | A (#189) | B (#439 stack) | |---|---|---| | Device removed | no | **no** | | `slow host submission` lines | 0 | 2 (max 261 ms) | | Host pipelines refused | 0 | 0 | | Frame time | 850 ms | 1,233 ms | | – preparing / on the GPU / copying back | 392 / 175 / 233 ms | 517 / 211 / 436 ms | | Draws run per frame | 2,121 | 2,144 | | Dropped without a host pipeline | 1,470 | **958** | | Dropped indirect | 1,405 | 1,357 | | Pipelines that drop something | 110 | **91** | | `shader does not translate` lines | 552 | **455** | Translation failures by reason (distinct shaders, top of each list): | Reason | A | B | |---|---|---| | a select on an untracked mask | 95 | 100 | | a lane mask holding lanes elsewhere read as data | 91 | 91 | | `v_readfirstlane` in divergent control flow | 91 | 0 | | a cross-lane wave operation in divergent control flow | 57 | 0 | | a descriptor read only as data | 42 | 44 | | an address in an SGPR that is no root parameter | 34 | 35 | | a structured buffer of unknown stride | 28 | 33 | | console waveN lanes in a group of more than N threads on a host… | 0 | 26 | | a scalar memory read as data | 22 | 24 | The four instance-culling programs named on #71 (`fdd56d97a806bcca`, `17af15c4015cb4b6`, `55679a0547649d0b`, `89d08e561897d4e5`): on A they fail with the cross-lane error; on B they fail with `a structured buffer of unknown stride`, which is what #193 addresses. The largest remaining droppers are the same on both (`indirect kind 0: prepare failed` 234/frame, compute `e30970f1727063fd` ~212/frame, pixel `94d281151ca58b4f` ~175/frame, compute `3b90165a77d95cdf`). ## What reaches the G-buffer `VICTORY_DUMP_TARGETS=1`, frame 1600 on both, about two minutes into the world: | | A (#189) | B (#439 stack) | |---|---|---| | ≥2560-wide targets with more than 0.2% non-background pixels | 10 of 43 | 14 of 53 | | Richest 2560×1440 `f28` target | 10.5% covered: a lamp post, a line of small marks, and three huge wrong triangles, all inside a sub-rectangle of the target | **67.9% covered: a dense, coherent, full-width view** (structures, cables, stacked objects, ground detail) | | 2560×1440 `f26` targets | all zero | all zero | | Presented frame | black (film grain and UI only) | black (film grain and UI only) | So on this card the wrong, sparse geometry I reported on #71 comes with the #189 emulation, and with this stack the scene's geometry is in the G-buffer. The lit targets are still empty on both, so the picture is still black; that is a separate, later gap. ## Caveats One run per build and one dumped frame per build; the two runs are not the same game moment to the frame. B is slower per frame here (more time preparing and copying back); I have not looked at why. Not tested: default loop limit, AMD. Counts, hashes and coverage numbers only; no game data attached. AI use: Claude Code (Claude Mythos 5.2) prepared both branches, ran them on my machine, analysed the logs and dumps and wrote this comment; posted at my request.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 06:19 UTC · original

@⁠walterwallaceson thank you, both for the table and for the test failure.

The Windows 10 failure is a defect in the test, fixed in e6936e3 (head is now e6936e3, fast-forward from 2467891). You read it right: lane_read_loop_tests::devices() took any hardware adapter with a feature-level 12_0 device, and its assert!(ran > 0) would have failed even with the right check. It now takes its devices from Host::on, which checks SM 6.6 as split_tests do, and prints "no SM 6.6 hardware device; skipped" when there is none. I could not reproduce the failure, having no Windows 10 machine: the fix follows from the code, and on Windows 11 the test still runs and is exact on the RTX 5070 and the Radeon iGPU (cargo test --workspace: 294 passed, 0 failed, 4 ignored). If you rerun on your machine, that test should now skip. The test came in with #320, so #320's head still has it; I fixed it at the top of the stack so tested heads below do not move, and it folds down at the next rebase.

Your counts agree with a local run of mine. An offline translate --host-lanes 32-32 --validate --list over a local copy of the title's shaders (CPU only, no pipelines, nothing launched; counts only) also gives 1,668 compute programs emitted at f653ea4 and 43 stopped for groups of more than 64 threads. At 965ce30 (float whole-wave reductions) it gives 1,676, with 8 of the 18 float-section programs translating and validating. Those 18 stop with a floating-point whole-wave operation across 32-lane halves at f653ea4, a row your table does not have.

The game run: noted, and the same as every other run so far: no change in the hang from this stack. no free dynamic descriptor slots 8 s into the world is the descriptor-heap limit measured on #71 (65,536 dynamic slots refuse 22 to 30% of requests there), which is outside this PR.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 06:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123815101) @⁠walterwallaceson thank you, both for the table and for the test failure. **The Windows 10 failure is a defect in the test, fixed in `e6936e3`** (head is now `e6936e3`, fast-forward from `2467891`). You read it right: `lane_read_loop_tests::devices()` took any hardware adapter with a feature-level 12_0 device, and its `assert!(ran > 0)` would have failed even with the right check. It now takes its devices from `Host::on`, which checks SM 6.6 as `split_tests` do, and prints "no SM 6.6 hardware device; skipped" when there is none. I could not reproduce the failure, having no Windows 10 machine: the fix follows from the code, and on Windows 11 the test still runs and is exact on the RTX 5070 and the Radeon iGPU (`cargo test --workspace`: 294 passed, 0 failed, 4 ignored). If you rerun on your machine, that test should now skip. The test came in with #320, so #320's head still has it; I fixed it at the top of the stack so tested heads below do not move, and it folds down at the next rebase. **Your counts agree with a local run of mine.** An offline `translate --host-lanes 32-32 --validate --list` over a local copy of the title's shaders (CPU only, no pipelines, nothing launched; counts only) also gives 1,668 compute programs emitted at `f653ea4` and 43 stopped for groups of more than 64 threads. At `965ce30` (float whole-wave reductions) it gives 1,676, with 8 of the 18 float-section programs translating and validating. Those 18 stop with `a floating-point whole-wave operation across 32-lane halves` at `f653ea4`, a row your table does not have. **The game run:** noted, and the same as every other run so far: no change in the hang from this stack. `no free dynamic descriptor slots` 8 s into the world is the descriptor-heap limit measured on #71 (65,536 dynamic slots refuse 22 to 30% of requests there), which is outside this PR. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 06:21 UTC · original

@⁠Zignixx thank you. That is exactly the measurement that was missing, and a careful one: same settings on both sides, the slot limit taken out of the comparison, and the caveats stated. It is now linked under "Measured on the title" in the description, with your caveats (one run and one dumped frame per build).

What I take from it, and what I do not:

  • Stays up. With the loop limit at 32 the stack's forms ran about 6 minutes in the world on an RTX 5080 without a device removal. That is one run with one loop limit; the default limit is untested, and wbkepler's hang at a console-flow dispatch was with the default, which fits the loop-limit reading on #578 but does not prove it.
  • The G-buffer. 67.9% coherent coverage against 10.5% with wrong triangles is strong evidence that the programs the two builds translate differently matter for geometry, and it says nothing yet about which ones. The 148 shaders that stop on the #189 build with v_readfirstlane in divergent control flow and a cross-lane wave operation in divergent control flow are the cases the console flow is for (every thread of the group reaches every exchange), so that is where I would look first. I would not conclude from one frame that #189's emulation computes wrong results; it may only be that it refuses programs whose absence leaves the buffer sparse.
  • The cost is real. 1,233 ms against 850 ms per frame: more programs run, and the console flow guards every vector instruction and pays two group barriers per exchange and one per LDS access. I have not measured where the time goes on real dispatches. If your logs can split the "on the GPU" time by pipeline, the top few hashes would tell me which form to make cheaper.
  • Next for the stack: the 26 (43 over the whole title) that stop for groups of more than 64 threads. The plan in docs/wave64-on-wave32.md is one console wave per host group for the ones without LDS, which is about two thirds of them.

Two reasons high in both of your lists are compute-only in an offline translate over a local copy of the title's shaders (counts only): a select on an untracked mask (285 programs) and a lane mask holding lanes elsewhere read as data (271). Both are about masks the per-lane form does not track, and the console flow keeps masks explicit, so I will measure how many of them it can take.

Head is e6936e3 now (a test-only fix for Windows 10 and the float reductions since f653ea4); nothing that would change your run except 8 more compute programs translating.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 06:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123841441) @⁠Zignixx thank you. That is exactly the measurement that was missing, and a careful one: same settings on both sides, the slot limit taken out of the comparison, and the caveats stated. It is now linked under "Measured on the title" in the description, with your caveats (one run and one dumped frame per build). What I take from it, and what I do not: - **Stays up.** With the loop limit at 32 the stack's forms ran about 6 minutes in the world on an RTX 5080 without a device removal. That is one run with one loop limit; the default limit is untested, and [wbkepler's hang at a console-flow dispatch](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233) was with the default, which fits the loop-limit reading on #578 but does not prove it. - **The G-buffer.** 67.9% coherent coverage against 10.5% with wrong triangles is strong evidence that the programs the two builds translate differently matter for geometry, and it says nothing yet about which ones. The 148 shaders that stop on the #189 build with `v_readfirstlane in divergent control flow` and `a cross-lane wave operation in divergent control flow` are the cases the console flow is for (every thread of the group reaches every exchange), so that is where I would look first. I would not conclude from one frame that #189's emulation computes wrong results; it may only be that it refuses programs whose absence leaves the buffer sparse. - **The cost is real.** 1,233 ms against 850 ms per frame: more programs run, and the console flow guards every vector instruction and pays two group barriers per exchange and one per LDS access. I have not measured where the time goes on real dispatches. If your logs can split the "on the GPU" time by pipeline, the top few hashes would tell me which form to make cheaper. - **Next for the stack:** the 26 (43 over the whole title) that stop for groups of more than 64 threads. The plan in `docs/wave64-on-wave32.md` is one console wave per host group for the ones without LDS, which is about two thirds of them. Two reasons high in both of your lists are compute-only in an offline translate over a local copy of the title's shaders (counts only): `a select on an untracked mask` (285 programs) and `a lane mask holding lanes elsewhere read as data` (271). Both are about masks the per-lane form does not track, and the console flow keeps masks explicit, so I will measure how many of them it can take. Head is `e6936e3` now (a test-only fix for Windows 10 and the float reductions since `f653ea4`); nothing that would change your run except 8 more compute programs translating. AI-assisted (Claude Code).
Author
Owner

@⁠aycow on GitHub · 2026-11-24 06:34 UTC · original

@⁠r4tedx @⁠alfycs @⁠nathanbzrr I’m comparing the four instance-culling hashes from #71 across the existing wave64 and divergent-flow work. The key synthetic case is a saved EXEC across a loop back edge, a partial-mask whole-wave section, and a producer consumed by another dispatch. #385 already covers per-lane phi inputs, and #320 covers console-flow joins, so I’ll compare exact heads before proposing any translator change. The matched warm-cache tester request asks for aggregate coverage and refusal counts for the four hashes. If you already have a focused regression or branch for the saved-mask join, please link it here.

**@⁠aycow** on GitHub · 2026-11-24 06:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7124072189) @⁠r4tedx @⁠alfycs @⁠nathanbzrr I’m comparing the four instance-culling hashes from #71 across the existing wave64 and divergent-flow work. The key synthetic case is a saved EXEC across a loop back edge, a partial-mask whole-wave section, and a producer consumed by another dispatch. #385 already covers per-lane phi inputs, and #320 covers console-flow joins, so I’ll compare exact heads before proposing any translator change. The [matched warm-cache tester request](https://git.gtahub.st/github/Marvisak--VIctory/issues/71) asks for aggregate coverage and refusal counts for the four hashes. If you already have a focused regression or branch for the saved-mask join, please link it here.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 06:38 UTC · original

Head is now d2189ff (fast-forward from e6936e3, one commit): compute selects take masks held as numbers. A v_cndmask_b32 whose selector is a constant or a number built from scalars stopped with a select on an untracked mask on every host; the lane now tests its own bit by its console lane. The commit also fixes the high dword of a wave64 mask held as a number when two instructions write its dwords (lanes 32..63 tested the low dword's bits; the new test caught it).

Tested (synthetic; the title was not used in these tests): selects on a mask of two constants and on one with a group-dependent bit, as a wave64 and a wave32 program, groups of 64 and 32 threads, exact on an RTX 5070 and a Radeon iGPU. cargo test --workspace: 295 passed, 0 failed, 4 ignored.

Measured locally (local title data, offline, CPU only; counts and reasons): that reason goes from 285 compute programs to 0, and 0 programs that translated before stop. But only 3 of the 285 translate (on a 32..64 host; none on 32..32). The others reach reasons outside this stack, mostly a descriptor read only as data (244). So alone this removes a blocker and gains almost nothing; what it gains with the descriptor PRs (#180, #309) on top I have not measured yet and will.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 06:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7124148700) Head is now `d2189ff` (fast-forward from `e6936e3`, one commit): **compute selects take masks held as numbers.** A `v_cndmask_b32` whose selector is a constant or a number built from scalars stopped with `a select on an untracked mask` on every host; the lane now tests its own bit by its console lane. The commit also fixes the high dword of a wave64 mask held as a number when two instructions write its dwords (lanes 32..63 tested the low dword's bits; the new test caught it). **Tested (synthetic; the title was not used in these tests):** selects on a mask of two constants and on one with a group-dependent bit, as a wave64 and a wave32 program, groups of 64 and 32 threads, exact on an RTX 5070 and a Radeon iGPU. `cargo test --workspace`: 295 passed, 0 failed, 4 ignored. **Measured locally (local title data, offline, CPU only; counts and reasons):** that reason goes from 285 compute programs to 0, and 0 programs that translated before stop. But only 3 of the 285 translate (on a 32..64 host; none on 32..32). The others reach reasons outside this stack, mostly `a descriptor read only as data` (244). So alone this removes a blocker and gains almost nothing; what it gains with the descriptor PRs (#180, #309) on top I have not measured yet and will. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 06:47 UTC · original

Head is now 901eef9 (fast-forward from d2189ff, two commits), and two answers.

@⁠aycow: yes, there is now a focused regression for the saved-mask join, as of this push.

  • 9e98b2b (by @⁠ifBars, from r4tedx/VIctory#6) fixes the case you describe: a loop header joins EXEC on its back edge from a latch whose mask is itself a join, which stopped with a lane-mask join of an untracked mask. The test is lane_read_loop_tests::lane_read_loop_with_a_joined_exec_back_edge; 901eef9 makes it dispatch on every hardware adapter. Exact on an RTX 5070 (two 32-lane waves) and a Radeon iGPU.
  • The earlier join case (an exit mask that starts as a constant 0) is split_tests::loops_with_an_exit_mask_grown_from_zero, from #320.
  • Whole-wave sections under a partial mask: split_tests::masked_whole_wave_sum_straddles_the_halves (and the float one beside it). Only in groups of exactly 64 threads; in other group sizes a section still stops.
  • Not covered by any test here: a producer consumed by another dispatch.
  • On the four instance-culling hashes: per the RTX 5080 run above they stop on this stack with a structured buffer of unknown stride, which is #193's subject and outside this PR. The contributor of 9e98b2b reports that with #193's stride lowering added privately all four validate; I have not reproduced that.

@⁠erLCoder: thank you. A GTX 1660 Ti on Windows 10 with the Agility SDK is a card and a driver branch nobody had run the split tests on, and 24 of 24 there is useful. Noted that the no-SM-6.6 skip path is still untested by anyone on such a machine.

Tested (synthetic; the title was not used in these tests): cargo test --workspace at 901eef9: 296 passed, 0 failed, 4 ignored (RTX 5070 + Radeon iGPU).

Measured locally (local title data, offline, CPU only; counts): d2189ff → 901eef9 for a 32..32 host: 9 more compute programs translate (1,676 → 1,685), 6 validate, 3 are in the sample class (#180); 0 that translated before stop. No change for a 32..64 host.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 06:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7124288763) Head is now `901eef9` (fast-forward from `d2189ff`, two commits), and two answers. **@⁠aycow:** yes, there is now a focused regression for the saved-mask join, as of this push. - `9e98b2b` (by @⁠ifBars, from [r4tedx/VIctory#6](https://github.com/r4tedx/VIctory/pull/6)) fixes the case you describe: a loop header joins EXEC on its back edge from a latch whose mask is itself a join, which stopped with `a lane-mask join of an untracked mask`. The test is `lane_read_loop_tests::lane_read_loop_with_a_joined_exec_back_edge`; `901eef9` makes it dispatch on every hardware adapter. Exact on an RTX 5070 (two 32-lane waves) and a Radeon iGPU. - The earlier join case (an exit mask that starts as a constant 0) is `split_tests::loops_with_an_exit_mask_grown_from_zero`, from #320. - Whole-wave sections under a partial mask: `split_tests::masked_whole_wave_sum_straddles_the_halves` (and the float one beside it). Only in groups of exactly 64 threads; in other group sizes a section still stops. - Not covered by any test here: a producer consumed by another dispatch. - On the four instance-culling hashes: per [the RTX 5080 run above](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439) they stop on this stack with `a structured buffer of unknown stride`, which is #193's subject and outside this PR. The contributor of `9e98b2b` reports that with #193's stride lowering added privately all four validate; I have not reproduced that. **@⁠erLCoder:** thank you. A GTX 1660 Ti on Windows 10 with the Agility SDK is a card and a driver branch nobody had run the split tests on, and 24 of 24 there is useful. Noted that the no-SM-6.6 skip path is still untested by anyone on such a machine. **Tested (synthetic; the title was not used in these tests):** `cargo test --workspace` at `901eef9`: 296 passed, 0 failed, 4 ignored (RTX 5070 + Radeon iGPU). **Measured locally (local title data, offline, CPU only; counts):** `d2189ff` → `901eef9` for a 32..32 host: 9 more compute programs translate (1,676 → 1,685), 6 validate, 3 are in the `sample` class (#180); 0 that translated before stop. No change for a 32..64 host. AI-assisted (Claude Code).
Author
Owner

@⁠erLCoder on GitHub · 2026-11-24 06:27 UTC · original · edited 2026-11-24 06:48 UTC

Tested head e6936e351b667193385fef95c94da48a18fce542 on Windows 10 Enterprise 22H2, GTX 1660 Ti, NVIDIA 581.42, Rust 1.98.1. The device reports 32..32 lanes.

With locally added test-executable exports for Agility SDK 620 and the SDK beside the executable, emit::split_tests passed 24/24, including both single-wave LDS ordering tests and LDS across masked blocks. The log identifies the GTX 1660 Ti and confirms per-lane results. lane_read_loop_tests passed 1/1 on this GPU for both wave32 and wave64 cases.

This exercises the SM 6.6-capable Agility path on Windows 10. The new no-SM-6.6 skip path was not tested.

Follow-up, game run on the same PC. One Series X run with #439 (e6936e3, including #233/#320), #334 (af2aecf), #89 (081afbd), and #152 (18b2716), plus Agility SDK 1.620.2 and local logging. Fresh cache. At about eight minutes the intro HUD appeared on a black background; world geometry was not visible in the frames I observed. The world frames took 4.9–8.0 s each. The log had zero host pipeline refused messages, but frame summaries still showed 758–1,501 draws dropped per frame while some pipelines were still being built. The process ended at about 8m37s with DXGI_ERROR_DEVICE_HUNG; DRED stopped on a DispatchMesh breadcrumb. This measures the combined build, with no isolated A/B for #439.

AI-assisted report.

**@⁠erLCoder** on GitHub · 2026-11-24 06:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7123945715) · edited 2026-11-24 06:48 UTC Tested head e6936e351b667193385fef95c94da48a18fce542 on Windows 10 Enterprise 22H2, GTX 1660 Ti, NVIDIA 581.42, Rust 1.98.1. The device reports 32..32 lanes. With locally added test-executable exports for Agility SDK 620 and the SDK beside the executable, `emit::split_tests` passed 24/24, including both single-wave LDS ordering tests and LDS across masked blocks. The log identifies the GTX 1660 Ti and confirms per-lane results. `lane_read_loop_tests` passed 1/1 on this GPU for both wave32 and wave64 cases. This exercises the SM 6.6-capable Agility path on Windows 10. The new no-SM-6.6 skip path was not tested. **Follow-up, game run on the same PC.** One Series X run with #439 (`e6936e3`, including #233/#320), #334 (`af2aecf`), #89 (`081afbd`), and #152 (`18b2716`), plus Agility SDK 1.620.2 and local logging. Fresh cache. At about eight minutes the intro HUD appeared on a black background; world geometry was not visible in the frames I observed. The world frames took 4.9–8.0 s each. The log had zero `host pipeline refused` messages, but frame summaries still showed 758–1,501 draws dropped per frame while some pipelines were still being built. The process ended at about 8m37s with `DXGI_ERROR_DEVICE_HUNG`; DRED stopped on a `DispatchMesh` breadcrumb. This measures the combined build, with no isolated A/B for #439. AI-assisted report.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 06:49 UTC · original

I posted the original Wave64 fixture and ran the same CPU reference against d2189ff. Main on AMD returned zero for all 16 selected lanes reading EXEC-inactive lane 40. #439 returned the expected value for all 64 lanes on AMD and RTX 5070 Laptop and passed the plain waterfall control on both. The partial-mask case produced the expected class output on NVIDIA and still refused translation on AMD at the lane-mask-as-data step. WARP returned an expected wave capability refusal. #385 covered a different join case and reproduced the main diagnostic for this fixture.

The readback validates producer bytes. The four title hashes and their downstream rendering remain the matched tester question on #71. I'd be happy to contribute the original positive controls directly to #439. Reproducer and commands · Exact comparison branch

**@⁠aycow** on GitHub · 2026-11-24 06:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7124332021) I posted the original Wave64 fixture and ran the same CPU reference against `d2189ff`. Main on AMD returned zero for all 16 selected lanes reading EXEC-inactive lane 40. #439 returned the expected value for all 64 lanes on AMD and RTX 5070 Laptop and passed the plain waterfall control on both. The partial-mask case produced the expected class output on NVIDIA and still refused translation on AMD at the lane-mask-as-data step. WARP returned an expected wave capability refusal. #385 covered a different join case and reproduced the main diagnostic for this fixture. The readback validates producer bytes. The four title hashes and their downstream rendering remain the matched tester question on #71. I'd be happy to contribute the original positive controls directly to #439. [Reproducer and commands](https://github.com/aycow/VIctory/blob/1f2bfe99ab41765d4b866006a23da3d04cd925a8/docs/wave64-culling-reproducer.md) · [Exact comparison branch](https://github.com/aycow/VIctory/tree/test/instance-culling-pr439)
Author
Owner

@⁠aycow on GitHub · 2026-11-24 07:29 UTC · original

@⁠r4tedx On the latest 901eef9, the original literal partial-mask waterfall still refused at the saved-mask-as-data step on Wave64. I added a focused retry through your existing console flow when a single native Wave64 compute group with a recognized whole-wave section reaches that refusal. I also added an observable class-sum variant so the readback checks the section itself.

AMD Radeon Graphics and RTX 5070 Laptop each returned all 128 expected words for both variants under full GBV. WARP correctly reports a wave capability refusal on this machine. The fix is on your current head; I'd be happy to contribute it to #439. The four title culling hashes still need the structured view path and matched downstream measurements. Exact implementation and reproduction

**@⁠aycow** on GitHub · 2026-11-24 07:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7125055306) @⁠r4tedx On the latest `901eef9`, the original literal partial-mask waterfall still refused at the saved-mask-as-data step on Wave64. I added a focused retry through your existing console flow when a single native Wave64 compute group with a recognized whole-wave section reaches that refusal. I also added an observable class-sum variant so the readback checks the section itself. AMD Radeon Graphics and RTX 5070 Laptop each returned all 128 expected words for both variants under full GBV. WARP correctly reports a wave capability refusal on this machine. The fix is on your current head; I'd be happy to contribute it to #439. The four title culling hashes still need the structured view path and matched downstream measurements. [Exact implementation and reproduction](https://github.com/aycow/VIctory/blob/e49783014536623f3cdb64bf4066cd6ad384798a/docs/wave64-partial-mask-waterfall.md)
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 07:30 UTC · original

@⁠aycow thank you: your fixture found two defects here, both fixed in e4d899f (head; fast-forward from 901eef9).

I reproduced with your culling_tests.rs from test/instance-culling-pr439, run through this branch's own test host on an RTX 5070 (32..32) and a Radeon iGPU (32..64). Your file is not in the commit.

variant RTX 5070 before RTX 5070 at e4d899f Radeon before Radeon at e4d899f
plain waterfall exact exact exact exact
partial section exact exact refused at 0x58 (your result) exact
word latch stack overflow in the translator refused: an opaque lane mask refused refused: an opaque lane mask
word restore (not reached) refused, same reason refused refused, same reason
word latch and restore (not reached) refused, same reason refused refused, same reason
  1. The AMD refusal. On a host that runs the console's wave size, a program with a lane read in a divergent branch took the console flow only if it had no whole-wave section, because the rule counted the lane reads sections make themselves. It now looks for a lane read or write outside the sections, and a section is lowered in the console flow as it is elsewhere.
  2. A stack overflow, which is worse than a refusal. Your word latch form (EXEC written with two s_mov_b32) made the console-flow lowering recurse without end: such a mask is held as a number, and that number was known only as the mask's own dword. It takes the process down, and it has been reachable since #233. It stops with a reason now. Your table has no row for it because the two forms you ran on NVIDIA come before it.

Still refused after this, on both hosts: the three forms that copy a mask dword by dword. That needs the structure pass to follow mask halves through s_mov_b32, which I have not done.

Yes, please contribute the controls. A PR against shader/console-flow-lds on r4tedx/VIctory with the fixture under your name would be the right form (two others came in that way). The three word-copy forms are useful as they are, as expected refusals. If the native test can take its device from emit::host::Host::on and adapters() like split_tests, it runs here without an Agility path.

Tested (synthetic; the title was not used in these tests): my own two regression tests in split_tests (a lane read in a branch beside a whole-wave sum, exact on both adapters; a mask copied dword by dword, which overflowed before). cargo test --workspace: 298 passed, 0 failed, 4 ignored.

Measured locally (local title data, offline, CPU only; counts): 901eef9 → e4d899f: 6 more compute programs translate for a 32..32 host and 12 for a 32..64 host, 0 lost; all but one are in the compute sample class that #180 fixes. On a 32..64 host about 18 programs that translated per lane before now take the console flow. No title program hit the recursion.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 07:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7125075513) @⁠aycow thank you: your fixture found two defects here, both fixed in `e4d899f` (head; fast-forward from `901eef9`). I reproduced with your `culling_tests.rs` from [`test/instance-culling-pr439`](https://github.com/aycow/VIctory/tree/test/instance-culling-pr439), run through this branch's own test host on an RTX 5070 (32..32) and a Radeon iGPU (32..64). Your file is not in the commit. | variant | RTX 5070 before | RTX 5070 at `e4d899f` | Radeon before | Radeon at `e4d899f` | |---|---|---|---|---| | plain waterfall | exact | exact | exact | exact | | partial section | exact | exact | refused at `0x58` (your result) | **exact** | | word latch | **stack overflow in the translator** | refused: `an opaque lane mask` | refused | refused: `an opaque lane mask` | | word restore | (not reached) | refused, same reason | refused | refused, same reason | | word latch and restore | (not reached) | refused, same reason | refused | refused, same reason | 1. **The AMD refusal.** On a host that runs the console's wave size, a program with a lane read in a divergent branch took the console flow only if it had no whole-wave section, because the rule counted the lane reads sections make themselves. It now looks for a lane read or write outside the sections, and a section is lowered in the console flow as it is elsewhere. 2. **A stack overflow, which is worse than a refusal.** Your `word latch` form (EXEC written with two `s_mov_b32`) made the console-flow lowering recurse without end: such a mask is held as a number, and that number was known only as the mask's own dword. It takes the process down, and it has been reachable since #233. It stops with a reason now. Your table has no row for it because the two forms you ran on NVIDIA come before it. Still refused after this, on both hosts: the three forms that copy a mask dword by dword. That needs the structure pass to follow mask halves through `s_mov_b32`, which I have not done. **Yes, please contribute the controls.** A PR against `shader/console-flow-lds` on r4tedx/VIctory with the fixture under your name would be the right form (two others came in that way). The three word-copy forms are useful as they are, as expected refusals. If the native test can take its device from `emit::host::Host::on` and `adapters()` like `split_tests`, it runs here without an Agility path. **Tested (synthetic; the title was not used in these tests):** my own two regression tests in `split_tests` (a lane read in a branch beside a whole-wave sum, exact on both adapters; a mask copied dword by dword, which overflowed before). `cargo test --workspace`: 298 passed, 0 failed, 4 ignored. **Measured locally (local title data, offline, CPU only; counts):** `901eef9` → `e4d899f`: 6 more compute programs translate for a 32..32 host and 12 for a 32..64 host, 0 lost; all but one are in the compute `sample` class that #180 fixes. On a 32..64 host about 18 programs that translated per lane before now take the console flow. No title program hit the recursion. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 07:36 UTC · original

@⁠catminou4 thank you, both for the macOS run (nobody had built this stack off Windows) and for the catch: a conflict that merges cleanly and then breaks a build is the kind nobody sees until it lands.

You are right about the cause and the fix. Host::target() comes from #223 at the bottom of the stack, and translate.rs calls it; #235's stub Host for other hosts has no such method. Target::ANY is the right value for a stub whose Host::new always fails. I have not reproduced the merge myself; I am taking your error message as the reproduction.

Neither branch can fix it alone, since the stub does not exist on main and target() does not exist in #235. So I have written it into #223's description as a known interaction, with the fix you give: whichever lands second adds the method to the stub, and I will do it on this side if #235 goes in first.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 07:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7125175768) @⁠catminou4 thank you, both for the macOS run (nobody had built this stack off Windows) and for the catch: a conflict that merges cleanly and then breaks a build is the kind nobody sees until it lands. You are right about the cause and the fix. `Host::target()` comes from #223 at the bottom of the stack, and `translate.rs` calls it; #235's stub `Host` for other hosts has no such method. `Target::ANY` is the right value for a stub whose `Host::new` always fails. I have not reproduced the merge myself; I am taking your error message as the reproduction. Neither branch can fix it alone, since the stub does not exist on `main` and `target()` does not exist in #235. So I have written it into #223's description as a known interaction, with the fix you give: whichever lands second adds the method to the stub, and I will do it on this side if #235 goes in first. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 07:39 UTC · original

@⁠aycow our messages crossed: the head moved to e4d899f about when you posted, and it fixes the refusal you measured on 901eef9 by another route (see my reply just above for the table from your first fixture).

I applied only the test half of your e497830 (split_tests.rs, without the lower.rs change) on e4d899f and ran it on an RTX 5070 (32..32) and a Radeon iGPU (32..64):

test RTX 5070 Radeon
masked_section_inside_waterfall_uses_the_full_wave exact exact
whole_wave_section_returns_each_waterfall_class_sum exact exact

So both pass here without the retry in mask_dword. The reason is the rule e4d899f changes: on a host that runs the console's wave size, a program with a lane read or write outside its whole-wave sections and a branch its lanes take differently goes to the console flow up front, sections or not. Your waterfall has the v_readlane of the class in the loop, so it qualifies before it ever reaches the saved-mask read.

What I would like from your commit, as a PR against shader/console-flow-lds on r4tedx/VIctory (rebased on e4d899f), under your name:

  1. The two tests. The class-sum variant is the better one: it observes what the section computes, which no test here does inside a waterfall. The ignored GPU-validation test is welcome too.
  2. The balloting guard. e4d899f guards the recursion I hit with your word-latch form at a different place (where a mask held as a number reads its own dword). Yours sits at the ballot and would also catch a cycle that does not go through such a mask, so it is worth having beside it.
  3. The retry only with a case that needs it. With the rule above I could not make it fire on your fixtures. If you have a program that still stops at a lane mask holding lanes elsewhere read as data on a 64-lane host at e4d899f (a saved-mask read with no lane access outside a section, say), a test for it would justify the retry; without one I would rather not carry a second way into the console flow.

Your file is not in my tree; I removed it after the run. The title was not used in these tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 07:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7125233420) @⁠aycow our messages crossed: the head moved to `e4d899f` about when you posted, and it fixes the refusal you measured on `901eef9` by another route (see [my reply just above](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439) for the table from your first fixture). I applied only the test half of your `e497830` (`split_tests.rs`, without the `lower.rs` change) on `e4d899f` and ran it on an RTX 5070 (32..32) and a Radeon iGPU (32..64): | test | RTX 5070 | Radeon | |---|---|---| | `masked_section_inside_waterfall_uses_the_full_wave` | exact | exact | | `whole_wave_section_returns_each_waterfall_class_sum` | exact | exact | So both pass here without the retry in `mask_dword`. The reason is the rule `e4d899f` changes: on a host that runs the console's wave size, a program with a lane read or write outside its whole-wave sections and a branch its lanes take differently goes to the console flow up front, sections or not. Your waterfall has the `v_readlane` of the class in the loop, so it qualifies before it ever reaches the saved-mask read. What I would like from your commit, as a PR against `shader/console-flow-lds` on r4tedx/VIctory (rebased on `e4d899f`), under your name: 1. **The two tests.** The class-sum variant is the better one: it observes what the section computes, which no test here does inside a waterfall. The ignored GPU-validation test is welcome too. 2. **The `balloting` guard.** `e4d899f` guards the recursion I hit with your word-latch form at a different place (where a mask held as a number reads its own dword). Yours sits at the ballot and would also catch a cycle that does not go through such a mask, so it is worth having beside it. 3. **The retry only with a case that needs it.** With the rule above I could not make it fire on your fixtures. If you have a program that still stops at `a lane mask holding lanes elsewhere read as data` on a 64-lane host at `e4d899f` (a saved-mask read with no lane access outside a section, say), a test for it would justify the retry; without one I would rather not carry a second way into the console flow. Your file is not in my tree; I removed it after the run. The title was not used in these tests. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 07:57 UTC · original

Head is 055aef9, and this PR is now closed to new features so it stays reviewable.

  • 055aef9 (from r4tedx/VIctory#5, by its author): a compute program with a numeric select that nothing consumes no longer declares the console's wave size. That was a side effect of d2189ff here: it refused a 128-thread wave64 program on a 32-lane host only for a dead select. Their test fails without the change and passes with it; my hardware test of live numeric selects is still exact on the RTX 5070 and the Radeon iGPU; cargo test --workspace: 299 passed, 0 failed, 4 ignored. An offline translate over a local copy of the title's shaders (CPU only, counts only) is identical to e4d899f program by program, so no title program had hit it.
  • The description is rewritten as a guide for review: the merge order of the stack (#223, #233, #320, then this), a table of the 17 commits that are new here with who wrote each and which test covers it, what was measured and by whom, and what is not verified. The facts are the ones already in this thread; only the arrangement is new.
  • From here: fixes for what review or testers find, nothing else. Groups of more than 64 threads are on a fork branch (shader/wave-per-group) and are not part of this PR.

The title was not used in the tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 07:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7125561519) Head is `055aef9`, and this PR is now closed to new features so it stays reviewable. - **`055aef9`** (from [r4tedx/VIctory#5](https://github.com/r4tedx/VIctory/pull/5), by its author): a compute program with a numeric select that nothing consumes no longer declares the console's wave size. That was a side effect of `d2189ff` here: it refused a 128-thread wave64 program on a 32-lane host only for a dead select. Their test fails without the change and passes with it; my hardware test of live numeric selects is still exact on the RTX 5070 and the Radeon iGPU; `cargo test --workspace`: 299 passed, 0 failed, 4 ignored. An offline translate over a local copy of the title's shaders (CPU only, counts only) is identical to `e4d899f` program by program, so no title program had hit it. - **The description is rewritten** as a guide for review: the merge order of the stack (#223, #233, #320, then this), a table of the 17 commits that are new here with who wrote each and which test covers it, what was measured and by whom, and what is not verified. The facts are the ones already in this thread; only the arrangement is new. - **From here:** fixes for what review or testers find, nothing else. Groups of more than 64 threads are on a fork branch (`shader/wave-per-group`) and are not part of this PR. The title was not used in the tests. AI-assisted (Claude Code).
Author
Owner

@⁠walterwallaceson on GitHub · 2026-11-24 08:11 UTC · original

@⁠r4tedx confirmed on Windows 10: the test now skips instead of failing.

Head 055aef9, merged into my local stack (fast-forward from f653ea4, no conflicts), Windows 10 22H2 (19045.6466), RTX 3070, NVIDIA 621.14. cargo test --workspace --no-fail-fast -- --test-threads=1:

  • lane_reads_in_a_loop_lanes_leave_at_different_iterations and lane_read_loop_with_a_joined_exec_back_edge: both pass by skipping, with NVIDIA GeForce RTX 3070: no SM 6.6 device (the device supports SM 0x65 only …); skipped and no SM 6.6 hardware device; skipped.
  • victory-shader: 96 passed, 8 failed. The 8 are valu_tests that need an SM 6.6 device and fail with "neither hardware nor WARP SM 6.6 device available" on the in-box runtime (#362): seven from main plus #483's guard-slot test, which is in my stack. None of them comes from this PR.
  • Otherwise only victory-hle's only_loopback_is_reachable (#118).

No game run on this head yet.

AI-assisted (Claude Code); everything above was run on my machine.

**@⁠walterwallaceson** on GitHub · 2026-11-24 08:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7125828364) @⁠r4tedx confirmed on Windows 10: the test now skips instead of failing. Head `055aef9`, merged into my local stack (fast-forward from `f653ea4`, no conflicts), Windows 10 22H2 (19045.6466), RTX 3070, NVIDIA 621.14. `cargo test --workspace --no-fail-fast -- --test-threads=1`: - `lane_reads_in_a_loop_lanes_leave_at_different_iterations` and `lane_read_loop_with_a_joined_exec_back_edge`: both pass by skipping, with `NVIDIA GeForce RTX 3070: no SM 6.6 device (the device supports SM 0x65 only …); skipped` and `no SM 6.6 hardware device; skipped`. - `victory-shader`: 96 passed, 8 failed. The 8 are `valu_tests` that need an SM 6.6 device and fail with "neither hardware nor WARP SM 6.6 device available" on the in-box runtime (#362): seven from `main` plus #483's guard-slot test, which is in my stack. None of them comes from this PR. - Otherwise only `victory-hle`'s `only_loopback_is_reachable` (#118). No game run on this head yet. AI-assisted (Claude Code); everything above was run on my machine.
Author
Owner

@⁠likecrank-dotcom on GitHub · 2026-11-24 08:24 UTC · original · edited 2026-11-24 08:29 UTC

RTX 5060 Ti 8 GB hardware data point on 055aef933dc678c68214465007caeab63c12079a (this PR's current head, without additional PRs).

Windows 11, Ryzen 5 3600, 32 GB, NVIDIA 621.14, native D3D12, title 1.0.2.1 Series X. Diag build, DRED on, default loop limit, VICTORY_LOG=info; fresh state copied from the same existing settings, scripted Enter presses. Host reports lane range 32..32. No other title, GPU tests or build ran during this title run.

  • Build passed. cargo test --profile diag -p victory-shader --features diagnostics -- --test-threads=1, with VICTORY_ADAPTER=NVIDIA and SDK DLLs on PATH: 103 passed, 0 failed, 0 ignored (22.28 s test execution).
  • The earlier main d2a4bae log on this PC contains 131 distinct driver-refused compute hashes. This PR's new run has 0 host pipeline refused lines and 595 accepted compute hashes. Importantly, 75 exact hashes refused in that earlier main run are explicitly accepted here; examples: 13dfdd3b1136e407, 88994c3496045f51, 339d476c267c03c7, 2dc602192abf6288. This is an intersection of observed runtime logs, not a whole-title shader census.
  • The world-entry GPU hang remains: process exit 0x887A0005, removed reason 0x887A0006, 159.2 s from process start. DRED stops at command 3/14, op 42; the no-barrier interval contains mesh 4adfa13bea1c556a, 8361a47172e52f1d, 3a93976a475b8bdb, 1617bda5757a7804. No visible controllable scene confirmed.
  • Late frame samples are about 0.2-0.5 fps; both CPU copies and occasional long GPU work contribute. One sample: 5266.6 ms/frame, 3814.5 ms copying to host, 201.1 ms GPU, 697.6 ms copying back. A different sample has 2284 ms GPU. Timing against the old main run is not matched and is not a regression claim.

Now testing the identical executable with only VICTORY_SHADER_LOOP_LIMIT=4096 changed. Will report the result separately. No title files, shader binaries, raw dumps or full logs attached. AI-assisted/Codex: build, scripted run and log/code analysis; hardware and title belong to the user.

Follow-up: the identical 055aef9 executable with VICTORY_SHADER_LOOP_LIMIT=4096 also lost the device (126.8 s from process start; 0x887A0005 / removed reason 0x887A0006). DRED: command 234/256, op 42, mesh 51ff151f75cd5759 / pixel 7fe75645c406cac6. Before it, the dynamic descriptor pool ran out (no free dynamic descriptor slots). This is the old d2a4bae-based PR head, without the now-merged #336; moving the local integration onto current main is the next check. No performance conclusion: the changed loop-limit cache key caused cold translation, and the capture cadence differed. The user reports clear dialogue after the Two years ago title over a black scene, with long pauses followed by later dialogue. Clarification: opening credits and the second city cutscene were observed in the earlier main-series-x-matched run (d2a4bae, 308.9 s), not established for these PR439 runs. These user observations are separate from the later logged GPU stops.

**@⁠likecrank-dotcom** on GitHub · 2026-11-24 08:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7126103012) · edited 2026-11-24 08:29 UTC RTX 5060 Ti 8 GB hardware data point on 055aef933dc678c68214465007caeab63c12079a (this PR's current head, without additional PRs). Windows 11, Ryzen 5 3600, 32 GB, NVIDIA 621.14, native D3D12, title 1.0.2.1 Series X. Diag build, DRED on, default loop limit, VICTORY_LOG=info; fresh state copied from the same existing settings, scripted Enter presses. Host reports lane range 32..32. No other title, GPU tests or build ran during this title run. - Build passed. `cargo test --profile diag -p victory-shader --features diagnostics -- --test-threads=1`, with VICTORY_ADAPTER=NVIDIA and SDK DLLs on PATH: 103 passed, 0 failed, 0 ignored (22.28 s test execution). - The earlier main d2a4bae log on this PC contains 131 distinct driver-refused compute hashes. This PR's new run has 0 `host pipeline refused` lines and 595 accepted compute hashes. Importantly, 75 exact hashes refused in that earlier main run are explicitly accepted here; examples: 13dfdd3b1136e407, 88994c3496045f51, 339d476c267c03c7, 2dc602192abf6288. This is an intersection of observed runtime logs, not a whole-title shader census. - The world-entry GPU hang remains: process exit 0x887A0005, removed reason 0x887A0006, 159.2 s from process start. DRED stops at command 3/14, op 42; the no-barrier interval contains mesh 4adfa13bea1c556a, 8361a47172e52f1d, 3a93976a475b8bdb, 1617bda5757a7804. No visible controllable scene confirmed. - Late frame samples are about 0.2-0.5 fps; both CPU copies and occasional long GPU work contribute. One sample: 5266.6 ms/frame, 3814.5 ms copying to host, 201.1 ms GPU, 697.6 ms copying back. A different sample has 2284 ms GPU. Timing against the old main run is not matched and is not a regression claim. Now testing the identical executable with only VICTORY_SHADER_LOOP_LIMIT=4096 changed. Will report the result separately. No title files, shader binaries, raw dumps or full logs attached. AI-assisted/Codex: build, scripted run and log/code analysis; hardware and title belong to the user. Follow-up: the identical 055aef9 executable with VICTORY_SHADER_LOOP_LIMIT=4096 also lost the device (126.8 s from process start; 0x887A0005 / removed reason 0x887A0006). DRED: command 234/256, op 42, mesh 51ff151f75cd5759 / pixel 7fe75645c406cac6. Before it, the dynamic descriptor pool ran out (no free dynamic descriptor slots). This is the old d2a4bae-based PR head, without the now-merged #336; moving the local integration onto current main is the next check. No performance conclusion: the changed loop-limit cache key caused cold translation, and the capture cadence differed. The user reports clear dialogue after the Two years ago title over a black scene, with long pauses followed by later dialogue. Clarification: opening credits and the second city cutscene were observed in the earlier main-series-x-matched run (d2a4bae, 308.9 s), not established for these PR439 runs. These user observations are separate from the later logged GPU stops.
Author
Owner

@⁠mohammadallami75-ops on GitHub · 2026-11-24 08:30 UTC · original

Preserve scalar state across divergent Wave64 compute control flow

Patch base PR #439 at 055aef9

PR #269 reconstructs scalar values after divergence with a maximum over each hardware wave. On an RTX 2080 SUPER, a 64-thread console wave runs in two 32-lane hardware waves, so that reconstruction produces separate scalar values. The two mask-count fixtures in #269 require a 64-lane pipeline, which this adapter refuses. PR #233 introduces a synchronized console-flow path for split waves, #320 uses it for divergent named-lane accesses, and #439 extends it to LDS and recognized whole-wave sections. The two mask-count fixtures already pass on #439. Scalar-only joins still used per-lane execution. #269, #233, #320, #439

The patch detects live Wave64 scalar SSA joins reached through lane-dependent edges, including loop back edges. It selects the existing console-flow lowering so EXEC guards vector work and scalar updates follow one wave-wide branch sequence. This preserves dependencies between scalar updates in disjoint EXEC regions. On Wave32 hardware, the two halves share branch decisions through the existing exchange. Shaders that require this path report any lowering error during translation.

Results on the RTX 2080 SUPER

Windows 11 Pro N build 26200, NVIDIA driver 621.01, Ryzen 5 5600, 32 GB RAM. The #439 comparison used Rust 1.98.1 (x86_64-pc-windows-msvc, debug) and dxil.dll 1.9.2609.5. All shaders were hand-assembled GFX10 fixtures and checked by GPU readback against CPU expectations.

Fixture Original #269 9356bee #439 055aef9 with fixtures Patched #439
Loop exit mask Pipeline refused 64 in every lane 64 in every lane
Branch-grown mask Pipeline refused 32 in every lane 32 in every lane
Divergent loop counter Lower half 32, upper half 64 Lane i reads i + 1 64 in every lane
Nested divergent loop counter Lower half 8, upper half 16 Lane-dependent values from 1 to 16 16 in every lane
Disjoint scalar updates Fixture added here Lower half 5, upper half 3 15 in every lane, and 5 in a 32-thread group that only runs the first update

The focused tests also check PSV0 wave size for Wave32 and Wave64 targets, the existing refusal for more than one console wave on a Wave32 target, and the unpinned wave size at a uniform scalar join. With VICTORY_DXIL set, the GPU test helper fails if the explicit validator cannot be loaded or rejects the emitted module.

  • Original #269 VALU suite: 7 passed, 4 failed.
  • #439 split suite with the new fixtures, before the fix: 30 passed, 4 failed. The fourth failure was the DXIL wave-size assertion.
  • Patched #439 split suite: 34 passed, 0 failed. The DXIL validator accepted the GPU fixtures and the RTX 2080 SUPER returned the expected values.
  • Patched workspace suite: 306 passed, 0 failed, 4 ignored. Shader Clippy and formatting checks passed. The asset policy check passed for 154 files.

Reproduce

Use Windows, the repository’s pinned Rust toolchain, the MSVC linker and Windows SDK libraries, and a D3D12 SM 6.6 adapter. Set VICTORY_ADAPTER to the adapter's name and VICTORY_DXIL to the full path to the x64 validator. To reproduce the before result, apply only the test-file hunk to the exact base. Reset the test file before applying the full patch, or use a second checkout of the base.

git fetch https://github.com/Marvisak/VIctory.git refs/pull/439/head
git checkout --detach 055aef933dc678c68214465007caeab63c12079a
$env:VICTORY_ADAPTER = 'RTX 2080 SUPER'
$env:VICTORY_DXIL = 'C:\path\to\x64\dxil.dll'
git apply --include=crates/victory-shader/src/emit/split_tests.rs wave-scalar-state.patch
cargo test --locked -p victory-shader --lib -- split_tests --nocapture --test-threads=1
git restore crates/victory-shader/src/emit/split_tests.rs
git apply wave-scalar-state.patch
cargo test --locked -p victory-shader --lib -- split_tests --nocapture --test-threads=1
cargo test --locked --workspace --no-fail-fast
cargo clippy --locked -p victory-shader --all-targets
cargo fmt --check -p victory-shader
cargo xtask policy

For the original #269 baseline, check out 9356beeae173723585c2aeac91f68c34862c00a4 and run cargo test --locked -p victory-shader --lib -- emit::valu_tests --nocapture --test-threads=1.

Scope and disclosure

Tested synthetic compute shaders in a debug build. Wave64-native hardware, title data, release performance, and the #71 world hang were outside this run. The Wave32 host path still uses one console wave per group for this class. The separate shader/wave-per-group branch is working on larger groups, and #180 addresses compute implicit-derivative sampling. The patch uses conservative classification when a divergent mask join occurs in a shader that reads masks numerically. Multi-wave branch, #180, #71

OpenAI Codex investigated, wrote the patch and adapted four fixtures from TheHoracio’s #269. Codex also wrote the disjoint-path fixture and ran the validation on the contributor’s system.

Patch against 055aef9 (save as wave-scalar-state.patch)
diff --git a/crates/victory-shader/src/emit/lower.rs b/crates/victory-shader/src/emit/lower.rs
index fcf9bc1..84400f2 100644
--- a/crates/victory-shader/src/emit/lower.rs
+++ b/crates/victory-shader/src/emit/lower.rs
@@ -15,7 +15,7 @@ use super::shader::{Shader, flags};
 use crate::ShaderError;
 use crate::gfx10::{Dpp, Fields, NULL, Operand};
 use crate::io::{Barycentric, Export, Input, Interp, Io, Target};
-use crate::ir::{EXEC, Exit, Inst, Program, Reg, Value};
+use crate::ir::{EXEC, Exit, Inst, Program, Reg, VCC, Value};
 use crate::native::{HwStage, NativeProgram, ResourceType, RootType, StageIo, Usage, UsedResource};
 use crate::resource::{Address, CODE, Resources, Role, Site, Source};
 use crate::structure::{Atom, Bool, LaneExit, Structured};
@@ -64,7 +64,7 @@ pub(crate) struct Parts<'a> {
 /// it: lower it again from [`crate::structure::structure_console`] with
 /// [`Parts::console_cf`]. Every lane of a console wave then runs every
 /// block, branches are the console's (taken wave-wide) and EXEC guards the
-/// vector instructions. Two kinds of program ask for it:
+/// vector instructions. Programs ask for it when:
 ///
 /// * a wave64 program whose two 32-lane halves must exchange values on a
 ///   host without 64-lane waves (a group of one console wave): the wave-wide
@@ -79,7 +79,11 @@ pub(crate) struct Parts<'a> {
 ///   the scalars set inside. One host wave is the console wave here, so
 ///   nothing is exchanged. If the console flow cannot lower such a program
 ///   it keeps the per-lane form ([`Parts::per_lane_only`]).
+/// * live Wave64 scalar state crosses a divergent join
+///   ([`SCALAR_CONSOLE_FLOW`]).
 pub(crate) const CONSOLE_FLOW: &str = "a wave64 program whose halves exchange lanes (console flow)";
+/// A per-lane retry could translate while silently returning the wrong scalars.
+pub(crate) const SCALAR_CONSOLE_FLOW: &str = "scalar state crosses divergent wave control flow";
 
 enum Stop {
     /// A phi whose incoming value has no DXIL form was read: redo with it missing.
@@ -218,6 +222,7 @@ struct Lower<'a> {
     console_cf: bool,
     /// Split without [`Self::console_cf`] cannot run it, the console flow can.
     wants_console_flow: bool,
+    scalar_console_flow: bool,
     /// Why a wave64 program that needs its whole wave cannot take the
     /// console flow on a host without 64-lane waves.
     no_console_flow: Option<Why>,
@@ -401,6 +406,7 @@ impl<'a> Lower<'a> {
         let mut console_lanes = false;
         let mut split = false;
         let mut wants_console_flow = false;
+        let mut scalar_console_flow = false;
         let mut no_console_flow = None;
         if let StageIo::Cs(cs) = x.native.io {
             s.threads = Some(cs.threads);
@@ -420,9 +426,32 @@ impl<'a> Lower<'a> {
                 (n.contains("permute") && n != "ds_bpermute_b32")
                     || n.starts_with("v_mbcnt")
                     || matches!(n, "v_readlane_b32" | "v_writelane_b32")
-                    || reads_mask_as_data(x.st, i)
             };
-            let reads_whole = insts().any(whole);
+            let reads_mask_data = insts().any(|i| reads_mask_as_data(x.st, i));
+            let reads_whole = reads_mask_data || insts().any(whole);
+            // SSA only keeps live, nontrivial phis. SGPR and SCC state at a
+            // divergent join belongs to the wave. Running both paths per
+            // lane loses updates from paths a lane skipped, including earlier
+            // exit iterations. A mask used only for lane bits can still be
+            // merged per lane.
+            scalar_console_flow = x.native.wave64
+                && p.blocks
+                    .iter()
+                    .zip(&x.st.divergent_joins)
+                    .any(|(b, &divergent)| {
+                        divergent
+                            && b.phis.iter().any(|phi| match phi.reg {
+                                Reg::Scc => true,
+                                Reg::S(r)
+                                    if r != EXEC && r != EXEC + 1 && r != VCC && r != VCC + 1 =>
+                                {
+                                    !(x.st.masks.contains_key(&phi.value)
+                                        || x.st.highs.contains_key(&phi.value))
+                                        || reads_mask_data
+                                }
+                                _ => false,
+                            })
+                    });
             let masks_held = {
                 // Masks held as numbers or constant lane sets: the lane
                 // tests its own bit by its console lane.
@@ -463,7 +492,8 @@ impl<'a> Lower<'a> {
                         .any(|a| matches!(a, Atom::Opaque(_) | Atom::Constant(_)))
                 })
             };
-            console_lanes = reads_whole || masks_held || insts().any(in_half);
+            console_lanes =
+                scalar_console_flow || reads_whole || masks_held || insts().any(in_half);
             let wave = if x.native.wave64 { 64 } else { 32 };
             let one_wave = cs.threads.iter().product::<u32>() <= wave;
             // On a host without 64-lane waves, a wave64 program whose lanes
@@ -477,6 +507,7 @@ impl<'a> Lower<'a> {
             // flow below.)
             split = console_lanes
                 && x.native.wave64
+                && !scalar_console_flow
                 && !reads_whole
                 && !insts().any(|i| i.name() == "v_readfirstlane_b32")
                 && !masks_held
@@ -537,6 +568,7 @@ impl<'a> Lower<'a> {
                     .iter()
                     .any(|e| matches!(*e, LaneExit::Branch { when, .. } if !uniform(when)))
                 && !insts().any(|i| i.name().contains("permute") && i.name() != "ds_bpermute_b32");
+            wants_console_flow |= x.target.runs(wave) && scalar_console_flow;
             if x.console_cf {
                 console_lanes = true;
                 // In halves only where the host cannot run the console wave.
@@ -633,6 +665,7 @@ impl<'a> Lower<'a> {
             split,
             console_cf: x.console_cf,
             wants_console_flow,
+            scalar_console_flow,
             no_console_flow,
             console_flat: None,
             xchg: None,
@@ -1040,7 +1073,14 @@ impl<'a> Lower<'a> {
 
     fn run(mut self) -> Result<Lowered, Stop> {
         if self.wants_console_flow && !self.x.console_cf && !self.x.per_lane_only {
-            return Err(unsupported(0, CONSOLE_FLOW));
+            return Err(unsupported(
+                0,
+                if self.scalar_console_flow {
+                    SCALAR_CONSOLE_FLOW
+                } else {
+                    CONSOLE_FLOW
+                },
+            ));
         }
         if let Some(n) = self.s.wave_size
             && !self.x.target.runs(n)
diff --git a/crates/victory-shader/src/emit/mod.rs b/crates/victory-shader/src/emit/mod.rs
index 90a547a..c0ce9d4 100644
--- a/crates/victory-shader/src/emit/mod.rs
+++ b/crates/victory-shader/src/emit/mod.rs
@@ -339,7 +339,9 @@ pub fn emit(
         per_lane_only: false,
     };
     let l = match lower::lower(&parts) {
-        Err(ShaderError::Unsupported { what, .. }) if what == lower::CONSOLE_FLOW => {
+        Err(ShaderError::Unsupported { what, .. })
+            if matches!(what, lower::CONSOLE_FLOW | lower::SCALAR_CONSOLE_FLOW) =>
+        {
             let console = structure::structure_console(p);
             let lowered = match &console {
                 Ok(console) => {
@@ -357,6 +359,7 @@ pub fn emit(
             };
             match lowered {
                 Ok(l) => l,
+                Err(e) if what == lower::SCALAR_CONSOLE_FLOW => return Err(e),
                 // What the console flow cannot lower keeps the per-lane form
                 // where that translates; else the console flow's reason.
                 Err(e) => {
diff --git a/crates/victory-shader/src/emit/split_tests.rs b/crates/victory-shader/src/emit/split_tests.rs
index 3f01e05..3f606a0 100644
--- a/crates/victory-shader/src/emit/split_tests.rs
+++ b/crates/victory-shader/src/emit/split_tests.rs
@@ -69,13 +69,15 @@ const IN_HALF: &[u32] = &[
 fn run(host: &Host, native: &crate::NativeProgram, groups: u32) -> Result<Vec<u32>, String> {
     let target = host.target();
     let cs = emit_for(native, target).map_err(|e| e.to_string())?;
-    // The validator, where one is installed: drivers take some modules it
-    // refuses.
-    if let Ok(mut v) =
-        super::validator::Validator::load(super::validator::Validator::default_path().as_deref())
-    {
-        v.validate(&mut cs.dxil.clone())
-            .map_err(|e| format!("validation: {e}"))?;
+    // A driver may accept a module the validator refuses. An explicitly
+    // configured validator must run so a bad path cannot hide a failure.
+    let path = super::validator::Validator::default_path();
+    match super::validator::Validator::load(path.as_deref()) {
+        Ok(mut v) => v
+            .validate(&mut cs.dxil.clone())
+            .map_err(|e| format!("validation: {e}"))?,
+        Err(e) if std::env::var_os("VICTORY_DXIL").is_some() => return Err(e),
+        Err(_) => {}
     }
     let (root, pso) = host.compute_pipeline(&cs)?;
     let data = vec![0; (cs.user_data_dwords() as usize).max(1)];
@@ -1063,3 +1065,162 @@ fn a_mask_copied_dword_by_dword_stops_instead_of_recursing() {
         assert!(e.contains(why), "{lanes_min}..{lanes_max}: {e}");
     }
 }
+
+// Scalar-state regressions adapted from the GFX10 fixtures in PR #269.
+#[test]
+fn loop_exit_mask_counted_after_the_loop() {
+    let body = [
+        0x4A02_0081, // v_add_nc_u32 v1, 1, v0  (lane i loops i + 1 times)
+        0xBE8A_0480, // s_mov_b64 s[10:11], 0
+        0x4E02_0281, // loop: v_subrev_nc_u32 v1, 1, v1 (v1 - 1)
+        0x7D84_0280, // v_cmp_eq_u32 vcc, 0, v1
+        0x888A_0A6A, // s_or_b64 s[10:11], vcc, s[10:11]
+        0x8AFE_0A7E, // s_andn2_b64 exec, exec, s[10:11]
+        0xBF89_FFFB, // s_cbranch_execnz loop
+        0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11]
+        0xBE89_100A, // s_bcnt1_i32_b64 s9, s[10:11]
+        0x7E04_0209, // v_mov_b32 v2, s9
+    ];
+    console_flow_case("loop_exit_mask_counted_after_the_loop", &body, 64, |_| 64);
+}
+
+#[test]
+fn scalar_counted_in_a_divergent_loop_read_after_it() {
+    let body = [
+        0x4A02_0081, // v_add_nc_u32 v1, 1, v0  (lane i loops i + 1 times)
+        0xBE8A_0480, // s_mov_b64 s[10:11], 0
+        0xBE89_0380, // s_mov_b32 s9, 0
+        0x8109_8109, // loop: s_add_u32 s9, s9, 1
+        0x4E02_0281, // v_subrev_nc_u32 v1, 1, v1 (v1 - 1)
+        0x7D84_0280, // v_cmp_eq_u32 vcc, 0, v1
+        0x888A_0A6A, // s_or_b64 s[10:11], vcc, s[10:11]
+        0x8AFE_0A7E, // s_andn2_b64 exec, exec, s[10:11]
+        0xBF89_FFFA, // s_cbranch_execnz loop
+        0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11]
+        0x7E04_0209, // v_mov_b32 v2, s9
+    ];
+    console_flow_case(
+        "scalar_counted_in_a_divergent_loop_read_after_it",
+        &body,
+        64,
+        |_| 64,
+    );
+}
+
+#[test]
+fn mask_grown_inside_a_branch_counted_after_it() {
+    let body = [
+        0x7D88_0090, // v_cmp_gt_u32 vcc, 16, v0      (lanes 0-15)
+        0xBE8A_046A, // s_mov_b64 s[10:11], vcc
+        0x7D86_00A0, // v_cmp_le_u32 vcc, 32, v0      (lanes 32-63)
+        0xBE8C_246A, // s_and_saveexec_b64 s[12:13], vcc
+        0xBF88_0002, // s_cbranch_execz -> join
+        0x7D88_00B0, // v_cmp_gt_u32 vcc, 48, v0      (of those: 32-47)
+        0x888A_0A6A, // s_or_b64 s[10:11], vcc, s[10:11]
+        0x88FE_0C7E, // join: s_or_b64 exec, exec, s[12:13]
+        0xBE89_100A, // s_bcnt1_i32_b64 s9, s[10:11]
+        0x7E04_0209, // v_mov_b32 v2, s9
+    ];
+    console_flow_case(
+        "mask_grown_inside_a_branch_counted_after_it",
+        &body,
+        64,
+        |_| 32,
+    );
+}
+
+#[test]
+fn scalar_counted_in_nested_divergent_loops() {
+    let body = [
+        0x3602_0083, // v_and_b32 v1, 3, v0          outer count - 1
+        0x4A02_0281, // v_add_nc_u32 v1, 1, v1
+        0x2C08_0084, // v_lshrrev_b32 v4, 4, v0      inner count - 1
+        0x4A08_0881, // v_add_nc_u32 v4, 1, v4
+        0xBE89_0380, // s_mov_b32 s9, 0
+        0xBE8A_0480, // s_mov_b64 s[10:11], 0
+        0xBE8C_0480, // outer: s_mov_b64 s[12:13], 0
+        0x7E0A_0304, // v_mov_b32 v5, v4
+        0x8109_8109, // inner: s_add_i32 s9, s9, 1
+        0x4E0A_0A81, // v_subrev_nc_u32 v5, 1, v5
+        0x7D84_0A80, // v_cmp_eq_u32 vcc, 0, v5
+        0x888C_0C6A, // s_or_b64 s[12:13], vcc, s[12:13]
+        0x8AFE_0C7E, // s_andn2_b64 exec, exec, s[12:13]
+        0xBF89_FFFA, // s_cbranch_execnz inner
+        0x88FE_0C7E, // s_or_b64 exec, exec, s[12:13]
+        0x4E02_0281, // v_subrev_nc_u32 v1, 1, v1
+        0x7D84_0280, // v_cmp_eq_u32 vcc, 0, v1
+        0x888A_0A6A, // s_or_b64 s[10:11], vcc, s[10:11]
+        0x8AFE_0A7E, // s_andn2_b64 exec, exec, s[10:11]
+        0xBF89_FFF2, // s_cbranch_execnz outer
+        0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11]
+        0x7E04_0209, // v_mov_b32 v2, s9
+    ];
+    console_flow_case(
+        "scalar_counted_in_nested_divergent_loops",
+        &body,
+        64,
+        |_| 16,
+    );
+}
+
+const DISJOINT_SCALAR_UPDATES: &[u32] = &[
+    0xBE89_0381, // s_mov_b32 s9, 1
+    0x7D88_00A0, // v_cmp_gt_u32 vcc, 32, v0
+    0xBE8A_246A, // s_and_saveexec_b64 s[10:11], vcc
+    0xBF88_0001, // s_cbranch_execz -> first restore
+    0x8109_8409, // s_add_u32 s9, s9, 4
+    0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11]
+    0x7D86_00A0, // v_cmp_le_u32 vcc, 32, v0
+    0xBE8A_246A, // s_and_saveexec_b64 s[10:11], vcc
+    0xBF88_0001, // s_cbranch_execz -> second restore
+    0x9309_8309, // s_mul_i32 s9, s9, 3
+    0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11]
+    0x7E04_0209, // v_mov_b32 v2, s9
+];
+
+#[test]
+fn disjoint_branch_paths_update_the_same_scalar_in_order() {
+    // When both regions run, the second starts with the first one's scalar.
+    console_flow_case("both scalar updates", DISJOINT_SCALAR_UPDATES, 64, |_| 15);
+    console_flow_case("only the first update", DISJOINT_SCALAR_UPDATES, 32, |_| 5);
+}
+
+#[test]
+fn divergent_scalar_state_requires_one_console_wave_on_wave32_hosts() {
+    let wave32 = super::Target {
+        lanes_min: 32,
+        lanes_max: 32,
+    };
+    let wave64 = super::Target {
+        lanes_min: 32,
+        lanes_max: 64,
+    };
+    let one = program(DISJOINT_SCALAR_UPDATES, 64);
+    assert_eq!(wave_size(&emit_for(&one, wave32).unwrap().dxil), Some(32));
+    assert_eq!(wave_size(&emit_for(&one, wave64).unwrap().dxil), Some(64));
+
+    let two = program(DISJOINT_SCALAR_UPDATES, 128);
+    let err = emit_for(&two, wave32).unwrap_err();
+    assert!(
+        err.to_string().contains("a group of more than 64 threads"),
+        "{err}"
+    );
+    assert_eq!(wave_size(&emit_for(&two, wave64).unwrap().dxil), Some(64));
+}
+
+#[test]
+fn a_uniform_scalar_join_does_not_pin_the_wave_size() {
+    let body = [
+        0xBE89_0381, // s_mov_b32 s9, 1
+        0xBF06_8001, // s_cmp_eq_u32 s1, 0 (group id x)
+        0xBF85_0001, // s_cbranch_scc1 -> join
+        0xBE89_0382, // s_mov_b32 s9, 2
+        0x7E04_0209, // join: v_mov_b32 v2, s9
+    ];
+    let wave32 = super::Target {
+        lanes_min: 32,
+        lanes_max: 32,
+    };
+    let shader = emit_for(&program(&body, 128), wave32).unwrap();
+    assert_eq!(wave_size(&shader.dxil), None);
+}
diff --git a/crates/victory-shader/src/structure.rs b/crates/victory-shader/src/structure.rs
index 582a0be..c0385ae 100644
--- a/crates/victory-shader/src/structure.rs
+++ b/crates/victory-shader/src/structure.rs
@@ -301,6 +301,8 @@ pub struct Structured {
     pub bools: Bools,
     /// Per block.
     pub exits: Vec<LaneExit>,
+    /// Joins with an incoming edge that only part of a wave can take.
+    pub(crate) divergent_joins: Vec<bool>,
     /// Per block and instruction: the condition, beyond reaching it, under
     /// which a lane runs a vector instruction; `None` when reaching it is
     /// enough (lanes outside EXEC then never get there, so a VGPR write
@@ -574,6 +576,25 @@ impl<'a> Lanes<'a> {
         cond: &[Bool],
     ) -> Result<Structured, ShaderError> {
         let blocks = &self.p.blocks;
+        // Test the incoming edges before the loop-header path calculation
+        // forgets the atoms defined in the loop. A scalar phi on a divergent
+        // back edge must carry one value for the wave's next iteration.
+        let divergent_joins = blocks
+            .iter()
+            .enumerate()
+            .map(|(n, block)| {
+                !self.console
+                    && block.phis.iter().any(|phi| !matches!(phi.reg, Reg::V(_)))
+                    && (0..self.incoming[n].len()).any(|i| {
+                        let (q, taken) = self.incoming[n][i];
+                        let edge = self.edge(cond[q], q, taken);
+                        self.b
+                            .support(edge)
+                            .iter()
+                            .any(|a| !matches!(a, Atom::Uniform(_)))
+                    })
+            })
+            .collect();
         let b = &mut self.b;
         let guards = blocks
             .iter()
@@ -622,6 +643,7 @@ impl<'a> Lanes<'a> {
             active: self.active,
             bools: self.b,
             exits,
+            divergent_joins,
             guards,
             execs: execs.to_vec(),
             others: self.other.iter().map(|(&(lo, _), &m)| (lo, m)).collect(),
**@⁠mohammadallami75-ops** on GitHub · 2026-11-24 08:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7126214250) # Preserve scalar state across divergent Wave64 compute control flow **Patch base** [PR #439 at `055aef9`](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439/commits/055aef933dc678c68214465007caeab63c12079a) PR #269 reconstructs scalar values after divergence with a maximum over each hardware wave. On an RTX 2080 SUPER, a 64-thread console wave runs in two 32-lane hardware waves, so that reconstruction produces separate scalar values. The two mask-count fixtures in #269 require a 64-lane pipeline, which this adapter refuses. PR #233 introduces a synchronized console-flow path for split waves, #320 uses it for divergent named-lane accesses, and #439 extends it to LDS and recognized whole-wave sections. The two mask-count fixtures already pass on #439. Scalar-only joins still used per-lane execution. [#269](https://git.gtahub.st/github/Marvisak--VIctory/pulls/269), [#233](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233), [#320](https://git.gtahub.st/github/Marvisak--VIctory/pulls/320), [#439](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439) The patch detects live Wave64 scalar SSA joins reached through lane-dependent edges, including loop back edges. It selects the existing console-flow lowering so EXEC guards vector work and scalar updates follow one wave-wide branch sequence. This preserves dependencies between scalar updates in disjoint EXEC regions. On Wave32 hardware, the two halves share branch decisions through the existing exchange. Shaders that require this path report any lowering error during translation. ## Results on the RTX 2080 SUPER Windows 11 Pro N build 26200, NVIDIA driver 621.01, Ryzen 5 5600, 32 GB RAM. The #439 comparison used Rust 1.98.1 (`x86_64-pc-windows-msvc`, debug) and `dxil.dll` 1.9.2609.5. All shaders were hand-assembled GFX10 fixtures and checked by GPU readback against CPU expectations. | Fixture | Original #269 `9356bee` | #439 `055aef9` with fixtures | Patched #439 | | --- | --- | --- | --- | | Loop exit mask | Pipeline refused | 64 in every lane | 64 in every lane | | Branch-grown mask | Pipeline refused | 32 in every lane | 32 in every lane | | Divergent loop counter | Lower half 32, upper half 64 | Lane `i` reads `i + 1` | 64 in every lane | | Nested divergent loop counter | Lower half 8, upper half 16 | Lane-dependent values from 1 to 16 | 16 in every lane | | Disjoint scalar updates | Fixture added here | Lower half 5, upper half 3 | 15 in every lane, and 5 in a 32-thread group that only runs the first update | The focused tests also check `PSV0` wave size for Wave32 and Wave64 targets, the existing refusal for more than one console wave on a Wave32 target, and the unpinned wave size at a uniform scalar join. With `VICTORY_DXIL` set, the GPU test helper fails if the explicit validator cannot be loaded or rejects the emitted module. - Original #269 VALU suite: 7 passed, 4 failed. - #439 split suite with the new fixtures, before the fix: 30 passed, 4 failed. The fourth failure was the DXIL wave-size assertion. - Patched #439 split suite: 34 passed, 0 failed. The DXIL validator accepted the GPU fixtures and the RTX 2080 SUPER returned the expected values. - Patched workspace suite: 306 passed, 0 failed, 4 ignored. Shader Clippy and formatting checks passed. The asset policy check passed for 154 files. ## Reproduce Use Windows, the repository’s pinned Rust toolchain, the MSVC linker and Windows SDK libraries, and a D3D12 SM 6.6 adapter. Set `VICTORY_ADAPTER` to the adapter's name and `VICTORY_DXIL` to the full path to the x64 validator. To reproduce the before result, apply only the test-file hunk to the exact base. Reset the test file before applying the full patch, or use a second checkout of the base. ```powershell git fetch https://github.com/Marvisak/VIctory.git refs/pull/439/head git checkout --detach 055aef933dc678c68214465007caeab63c12079a $env:VICTORY_ADAPTER = 'RTX 2080 SUPER' $env:VICTORY_DXIL = 'C:\path\to\x64\dxil.dll' git apply --include=crates/victory-shader/src/emit/split_tests.rs wave-scalar-state.patch cargo test --locked -p victory-shader --lib -- split_tests --nocapture --test-threads=1 git restore crates/victory-shader/src/emit/split_tests.rs git apply wave-scalar-state.patch cargo test --locked -p victory-shader --lib -- split_tests --nocapture --test-threads=1 cargo test --locked --workspace --no-fail-fast cargo clippy --locked -p victory-shader --all-targets cargo fmt --check -p victory-shader cargo xtask policy ``` For the original #269 baseline, check out `9356beeae173723585c2aeac91f68c34862c00a4` and run `cargo test --locked -p victory-shader --lib -- emit::valu_tests --nocapture --test-threads=1`. ## Scope and disclosure Tested synthetic compute shaders in a debug build. Wave64-native hardware, title data, release performance, and the #71 world hang were outside this run. The Wave32 host path still uses one console wave per group for this class. The separate `shader/wave-per-group` branch is working on larger groups, and #180 addresses compute implicit-derivative sampling. The patch uses conservative classification when a divergent mask join occurs in a shader that reads masks numerically. [Multi-wave branch](https://github.com/r4tedx/VIctory/tree/shader/wave-per-group), [#180](https://git.gtahub.st/github/Marvisak--VIctory/pulls/180), [#71](https://git.gtahub.st/github/Marvisak--VIctory/issues/71) OpenAI Codex investigated, wrote the patch and adapted four fixtures from TheHoracio’s #269. Codex also wrote the disjoint-path fixture and ran the validation on the contributor’s system. <details> <summary>Patch against 055aef9 (save as wave-scalar-state.patch)</summary> ```diff diff --git a/crates/victory-shader/src/emit/lower.rs b/crates/victory-shader/src/emit/lower.rs index fcf9bc1..84400f2 100644 --- a/crates/victory-shader/src/emit/lower.rs +++ b/crates/victory-shader/src/emit/lower.rs @@ -15,7 +15,7 @@ use super::shader::{Shader, flags}; use crate::ShaderError; use crate::gfx10::{Dpp, Fields, NULL, Operand}; use crate::io::{Barycentric, Export, Input, Interp, Io, Target}; -use crate::ir::{EXEC, Exit, Inst, Program, Reg, Value}; +use crate::ir::{EXEC, Exit, Inst, Program, Reg, VCC, Value}; use crate::native::{HwStage, NativeProgram, ResourceType, RootType, StageIo, Usage, UsedResource}; use crate::resource::{Address, CODE, Resources, Role, Site, Source}; use crate::structure::{Atom, Bool, LaneExit, Structured}; @@ -64,7 +64,7 @@ pub(crate) struct Parts<'a> { /// it: lower it again from [`crate::structure::structure_console`] with /// [`Parts::console_cf`]. Every lane of a console wave then runs every /// block, branches are the console's (taken wave-wide) and EXEC guards the -/// vector instructions. Two kinds of program ask for it: +/// vector instructions. Programs ask for it when: /// /// * a wave64 program whose two 32-lane halves must exchange values on a /// host without 64-lane waves (a group of one console wave): the wave-wide @@ -79,7 +79,11 @@ pub(crate) struct Parts<'a> { /// the scalars set inside. One host wave is the console wave here, so /// nothing is exchanged. If the console flow cannot lower such a program /// it keeps the per-lane form ([`Parts::per_lane_only`]). +/// * live Wave64 scalar state crosses a divergent join +/// ([`SCALAR_CONSOLE_FLOW`]). pub(crate) const CONSOLE_FLOW: &str = "a wave64 program whose halves exchange lanes (console flow)"; +/// A per-lane retry could translate while silently returning the wrong scalars. +pub(crate) const SCALAR_CONSOLE_FLOW: &str = "scalar state crosses divergent wave control flow"; enum Stop { /// A phi whose incoming value has no DXIL form was read: redo with it missing. @@ -218,6 +222,7 @@ struct Lower<'a> { console_cf: bool, /// Split without [`Self::console_cf`] cannot run it, the console flow can. wants_console_flow: bool, + scalar_console_flow: bool, /// Why a wave64 program that needs its whole wave cannot take the /// console flow on a host without 64-lane waves. no_console_flow: Option<Why>, @@ -401,6 +406,7 @@ impl<'a> Lower<'a> { let mut console_lanes = false; let mut split = false; let mut wants_console_flow = false; + let mut scalar_console_flow = false; let mut no_console_flow = None; if let StageIo::Cs(cs) = x.native.io { s.threads = Some(cs.threads); @@ -420,9 +426,32 @@ impl<'a> Lower<'a> { (n.contains("permute") && n != "ds_bpermute_b32") || n.starts_with("v_mbcnt") || matches!(n, "v_readlane_b32" | "v_writelane_b32") - || reads_mask_as_data(x.st, i) }; - let reads_whole = insts().any(whole); + let reads_mask_data = insts().any(|i| reads_mask_as_data(x.st, i)); + let reads_whole = reads_mask_data || insts().any(whole); + // SSA only keeps live, nontrivial phis. SGPR and SCC state at a + // divergent join belongs to the wave. Running both paths per + // lane loses updates from paths a lane skipped, including earlier + // exit iterations. A mask used only for lane bits can still be + // merged per lane. + scalar_console_flow = x.native.wave64 + && p.blocks + .iter() + .zip(&x.st.divergent_joins) + .any(|(b, &divergent)| { + divergent + && b.phis.iter().any(|phi| match phi.reg { + Reg::Scc => true, + Reg::S(r) + if r != EXEC && r != EXEC + 1 && r != VCC && r != VCC + 1 => + { + !(x.st.masks.contains_key(&phi.value) + || x.st.highs.contains_key(&phi.value)) + || reads_mask_data + } + _ => false, + }) + }); let masks_held = { // Masks held as numbers or constant lane sets: the lane // tests its own bit by its console lane. @@ -463,7 +492,8 @@ impl<'a> Lower<'a> { .any(|a| matches!(a, Atom::Opaque(_) | Atom::Constant(_))) }) }; - console_lanes = reads_whole || masks_held || insts().any(in_half); + console_lanes = + scalar_console_flow || reads_whole || masks_held || insts().any(in_half); let wave = if x.native.wave64 { 64 } else { 32 }; let one_wave = cs.threads.iter().product::<u32>() <= wave; // On a host without 64-lane waves, a wave64 program whose lanes @@ -477,6 +507,7 @@ impl<'a> Lower<'a> { // flow below.) split = console_lanes && x.native.wave64 + && !scalar_console_flow && !reads_whole && !insts().any(|i| i.name() == "v_readfirstlane_b32") && !masks_held @@ -537,6 +568,7 @@ impl<'a> Lower<'a> { .iter() .any(|e| matches!(*e, LaneExit::Branch { when, .. } if !uniform(when))) && !insts().any(|i| i.name().contains("permute") && i.name() != "ds_bpermute_b32"); + wants_console_flow |= x.target.runs(wave) && scalar_console_flow; if x.console_cf { console_lanes = true; // In halves only where the host cannot run the console wave. @@ -633,6 +665,7 @@ impl<'a> Lower<'a> { split, console_cf: x.console_cf, wants_console_flow, + scalar_console_flow, no_console_flow, console_flat: None, xchg: None, @@ -1040,7 +1073,14 @@ impl<'a> Lower<'a> { fn run(mut self) -> Result<Lowered, Stop> { if self.wants_console_flow && !self.x.console_cf && !self.x.per_lane_only { - return Err(unsupported(0, CONSOLE_FLOW)); + return Err(unsupported( + 0, + if self.scalar_console_flow { + SCALAR_CONSOLE_FLOW + } else { + CONSOLE_FLOW + }, + )); } if let Some(n) = self.s.wave_size && !self.x.target.runs(n) diff --git a/crates/victory-shader/src/emit/mod.rs b/crates/victory-shader/src/emit/mod.rs index 90a547a..c0ce9d4 100644 --- a/crates/victory-shader/src/emit/mod.rs +++ b/crates/victory-shader/src/emit/mod.rs @@ -339,7 +339,9 @@ pub fn emit( per_lane_only: false, }; let l = match lower::lower(&parts) { - Err(ShaderError::Unsupported { what, .. }) if what == lower::CONSOLE_FLOW => { + Err(ShaderError::Unsupported { what, .. }) + if matches!(what, lower::CONSOLE_FLOW | lower::SCALAR_CONSOLE_FLOW) => + { let console = structure::structure_console(p); let lowered = match &console { Ok(console) => { @@ -357,6 +359,7 @@ pub fn emit( }; match lowered { Ok(l) => l, + Err(e) if what == lower::SCALAR_CONSOLE_FLOW => return Err(e), // What the console flow cannot lower keeps the per-lane form // where that translates; else the console flow's reason. Err(e) => { diff --git a/crates/victory-shader/src/emit/split_tests.rs b/crates/victory-shader/src/emit/split_tests.rs index 3f01e05..3f606a0 100644 --- a/crates/victory-shader/src/emit/split_tests.rs +++ b/crates/victory-shader/src/emit/split_tests.rs @@ -69,13 +69,15 @@ const IN_HALF: &[u32] = &[ fn run(host: &Host, native: &crate::NativeProgram, groups: u32) -> Result<Vec<u32>, String> { let target = host.target(); let cs = emit_for(native, target).map_err(|e| e.to_string())?; - // The validator, where one is installed: drivers take some modules it - // refuses. - if let Ok(mut v) = - super::validator::Validator::load(super::validator::Validator::default_path().as_deref()) - { - v.validate(&mut cs.dxil.clone()) - .map_err(|e| format!("validation: {e}"))?; + // A driver may accept a module the validator refuses. An explicitly + // configured validator must run so a bad path cannot hide a failure. + let path = super::validator::Validator::default_path(); + match super::validator::Validator::load(path.as_deref()) { + Ok(mut v) => v + .validate(&mut cs.dxil.clone()) + .map_err(|e| format!("validation: {e}"))?, + Err(e) if std::env::var_os("VICTORY_DXIL").is_some() => return Err(e), + Err(_) => {} } let (root, pso) = host.compute_pipeline(&cs)?; let data = vec![0; (cs.user_data_dwords() as usize).max(1)]; @@ -1063,3 +1065,162 @@ fn a_mask_copied_dword_by_dword_stops_instead_of_recursing() { assert!(e.contains(why), "{lanes_min}..{lanes_max}: {e}"); } } + +// Scalar-state regressions adapted from the GFX10 fixtures in PR #269. +#[test] +fn loop_exit_mask_counted_after_the_loop() { + let body = [ + 0x4A02_0081, // v_add_nc_u32 v1, 1, v0 (lane i loops i + 1 times) + 0xBE8A_0480, // s_mov_b64 s[10:11], 0 + 0x4E02_0281, // loop: v_subrev_nc_u32 v1, 1, v1 (v1 - 1) + 0x7D84_0280, // v_cmp_eq_u32 vcc, 0, v1 + 0x888A_0A6A, // s_or_b64 s[10:11], vcc, s[10:11] + 0x8AFE_0A7E, // s_andn2_b64 exec, exec, s[10:11] + 0xBF89_FFFB, // s_cbranch_execnz loop + 0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11] + 0xBE89_100A, // s_bcnt1_i32_b64 s9, s[10:11] + 0x7E04_0209, // v_mov_b32 v2, s9 + ]; + console_flow_case("loop_exit_mask_counted_after_the_loop", &body, 64, |_| 64); +} + +#[test] +fn scalar_counted_in_a_divergent_loop_read_after_it() { + let body = [ + 0x4A02_0081, // v_add_nc_u32 v1, 1, v0 (lane i loops i + 1 times) + 0xBE8A_0480, // s_mov_b64 s[10:11], 0 + 0xBE89_0380, // s_mov_b32 s9, 0 + 0x8109_8109, // loop: s_add_u32 s9, s9, 1 + 0x4E02_0281, // v_subrev_nc_u32 v1, 1, v1 (v1 - 1) + 0x7D84_0280, // v_cmp_eq_u32 vcc, 0, v1 + 0x888A_0A6A, // s_or_b64 s[10:11], vcc, s[10:11] + 0x8AFE_0A7E, // s_andn2_b64 exec, exec, s[10:11] + 0xBF89_FFFA, // s_cbranch_execnz loop + 0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11] + 0x7E04_0209, // v_mov_b32 v2, s9 + ]; + console_flow_case( + "scalar_counted_in_a_divergent_loop_read_after_it", + &body, + 64, + |_| 64, + ); +} + +#[test] +fn mask_grown_inside_a_branch_counted_after_it() { + let body = [ + 0x7D88_0090, // v_cmp_gt_u32 vcc, 16, v0 (lanes 0-15) + 0xBE8A_046A, // s_mov_b64 s[10:11], vcc + 0x7D86_00A0, // v_cmp_le_u32 vcc, 32, v0 (lanes 32-63) + 0xBE8C_246A, // s_and_saveexec_b64 s[12:13], vcc + 0xBF88_0002, // s_cbranch_execz -> join + 0x7D88_00B0, // v_cmp_gt_u32 vcc, 48, v0 (of those: 32-47) + 0x888A_0A6A, // s_or_b64 s[10:11], vcc, s[10:11] + 0x88FE_0C7E, // join: s_or_b64 exec, exec, s[12:13] + 0xBE89_100A, // s_bcnt1_i32_b64 s9, s[10:11] + 0x7E04_0209, // v_mov_b32 v2, s9 + ]; + console_flow_case( + "mask_grown_inside_a_branch_counted_after_it", + &body, + 64, + |_| 32, + ); +} + +#[test] +fn scalar_counted_in_nested_divergent_loops() { + let body = [ + 0x3602_0083, // v_and_b32 v1, 3, v0 outer count - 1 + 0x4A02_0281, // v_add_nc_u32 v1, 1, v1 + 0x2C08_0084, // v_lshrrev_b32 v4, 4, v0 inner count - 1 + 0x4A08_0881, // v_add_nc_u32 v4, 1, v4 + 0xBE89_0380, // s_mov_b32 s9, 0 + 0xBE8A_0480, // s_mov_b64 s[10:11], 0 + 0xBE8C_0480, // outer: s_mov_b64 s[12:13], 0 + 0x7E0A_0304, // v_mov_b32 v5, v4 + 0x8109_8109, // inner: s_add_i32 s9, s9, 1 + 0x4E0A_0A81, // v_subrev_nc_u32 v5, 1, v5 + 0x7D84_0A80, // v_cmp_eq_u32 vcc, 0, v5 + 0x888C_0C6A, // s_or_b64 s[12:13], vcc, s[12:13] + 0x8AFE_0C7E, // s_andn2_b64 exec, exec, s[12:13] + 0xBF89_FFFA, // s_cbranch_execnz inner + 0x88FE_0C7E, // s_or_b64 exec, exec, s[12:13] + 0x4E02_0281, // v_subrev_nc_u32 v1, 1, v1 + 0x7D84_0280, // v_cmp_eq_u32 vcc, 0, v1 + 0x888A_0A6A, // s_or_b64 s[10:11], vcc, s[10:11] + 0x8AFE_0A7E, // s_andn2_b64 exec, exec, s[10:11] + 0xBF89_FFF2, // s_cbranch_execnz outer + 0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11] + 0x7E04_0209, // v_mov_b32 v2, s9 + ]; + console_flow_case( + "scalar_counted_in_nested_divergent_loops", + &body, + 64, + |_| 16, + ); +} + +const DISJOINT_SCALAR_UPDATES: &[u32] = &[ + 0xBE89_0381, // s_mov_b32 s9, 1 + 0x7D88_00A0, // v_cmp_gt_u32 vcc, 32, v0 + 0xBE8A_246A, // s_and_saveexec_b64 s[10:11], vcc + 0xBF88_0001, // s_cbranch_execz -> first restore + 0x8109_8409, // s_add_u32 s9, s9, 4 + 0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11] + 0x7D86_00A0, // v_cmp_le_u32 vcc, 32, v0 + 0xBE8A_246A, // s_and_saveexec_b64 s[10:11], vcc + 0xBF88_0001, // s_cbranch_execz -> second restore + 0x9309_8309, // s_mul_i32 s9, s9, 3 + 0x88FE_0A7E, // s_or_b64 exec, exec, s[10:11] + 0x7E04_0209, // v_mov_b32 v2, s9 +]; + +#[test] +fn disjoint_branch_paths_update_the_same_scalar_in_order() { + // When both regions run, the second starts with the first one's scalar. + console_flow_case("both scalar updates", DISJOINT_SCALAR_UPDATES, 64, |_| 15); + console_flow_case("only the first update", DISJOINT_SCALAR_UPDATES, 32, |_| 5); +} + +#[test] +fn divergent_scalar_state_requires_one_console_wave_on_wave32_hosts() { + let wave32 = super::Target { + lanes_min: 32, + lanes_max: 32, + }; + let wave64 = super::Target { + lanes_min: 32, + lanes_max: 64, + }; + let one = program(DISJOINT_SCALAR_UPDATES, 64); + assert_eq!(wave_size(&emit_for(&one, wave32).unwrap().dxil), Some(32)); + assert_eq!(wave_size(&emit_for(&one, wave64).unwrap().dxil), Some(64)); + + let two = program(DISJOINT_SCALAR_UPDATES, 128); + let err = emit_for(&two, wave32).unwrap_err(); + assert!( + err.to_string().contains("a group of more than 64 threads"), + "{err}" + ); + assert_eq!(wave_size(&emit_for(&two, wave64).unwrap().dxil), Some(64)); +} + +#[test] +fn a_uniform_scalar_join_does_not_pin_the_wave_size() { + let body = [ + 0xBE89_0381, // s_mov_b32 s9, 1 + 0xBF06_8001, // s_cmp_eq_u32 s1, 0 (group id x) + 0xBF85_0001, // s_cbranch_scc1 -> join + 0xBE89_0382, // s_mov_b32 s9, 2 + 0x7E04_0209, // join: v_mov_b32 v2, s9 + ]; + let wave32 = super::Target { + lanes_min: 32, + lanes_max: 32, + }; + let shader = emit_for(&program(&body, 128), wave32).unwrap(); + assert_eq!(wave_size(&shader.dxil), None); +} diff --git a/crates/victory-shader/src/structure.rs b/crates/victory-shader/src/structure.rs index 582a0be..c0385ae 100644 --- a/crates/victory-shader/src/structure.rs +++ b/crates/victory-shader/src/structure.rs @@ -301,6 +301,8 @@ pub struct Structured { pub bools: Bools, /// Per block. pub exits: Vec<LaneExit>, + /// Joins with an incoming edge that only part of a wave can take. + pub(crate) divergent_joins: Vec<bool>, /// Per block and instruction: the condition, beyond reaching it, under /// which a lane runs a vector instruction; `None` when reaching it is /// enough (lanes outside EXEC then never get there, so a VGPR write @@ -574,6 +576,25 @@ impl<'a> Lanes<'a> { cond: &[Bool], ) -> Result<Structured, ShaderError> { let blocks = &self.p.blocks; + // Test the incoming edges before the loop-header path calculation + // forgets the atoms defined in the loop. A scalar phi on a divergent + // back edge must carry one value for the wave's next iteration. + let divergent_joins = blocks + .iter() + .enumerate() + .map(|(n, block)| { + !self.console + && block.phis.iter().any(|phi| !matches!(phi.reg, Reg::V(_))) + && (0..self.incoming[n].len()).any(|i| { + let (q, taken) = self.incoming[n][i]; + let edge = self.edge(cond[q], q, taken); + self.b + .support(edge) + .iter() + .any(|a| !matches!(a, Atom::Uniform(_))) + }) + }) + .collect(); let b = &mut self.b; let guards = blocks .iter() @@ -622,6 +643,7 @@ impl<'a> Lanes<'a> { active: self.active, bools: self.b, exits, + divergent_joins, guards, execs: execs.to_vec(), others: self.other.iter().map(|(&(lo, _), &m)| (lo, m)).collect(), ``` </details>
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 08:35 UTC · original

Rebased, and force-pushed once (all four stack branches, with lease): upstream main moved to 2e4e280 with 32 merged PRs, and the stack merged without a textual conflict but no longer built its tests, because two new upstream tests call emit without the wave-range argument #223 adds.

PR head before head now
#223 e0865d2 b2adc37
#233 3098672 cd4677c
#320 a5ba4a4 4a38a75
#439 055aef9 ef14bf3
  • The only change in content is in #223's commit: those two upstream test calls pass Target::ANY. The other 26 commits are replayed unchanged, with their authors.
  • Every commit builds on its own (cargo check --workspace --all-targets after each of the 27).
  • At ef14bf3: the shader crate's tests, 116 passed, 0 failed, 1 ignored; the other crates, 210 passed, 0 failed, 4 ignored. Two runs, because the full cargo test --workspace stalled twice in upstream's valu_tests, the intermittent hang #433 fixes.
  • Not rerun on the new base: the offline translate counts in the description (they are from 055aef9).
  • The descriptions of the four PRs give the old id of each commit, since testers' reports and older comments use them.

The title was not used in these tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 08:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7126322411) **Rebased, and force-pushed once** (all four stack branches, with lease): upstream `main` moved to `2e4e280` with 32 merged PRs, and the stack merged without a textual conflict but no longer built its tests, because two new upstream tests call `emit` without the wave-range argument #223 adds. | PR | head before | head now | |---|---|---| | #223 | `e0865d2` | `b2adc37` | | #233 | `3098672` | `cd4677c` | | #320 | `a5ba4a4` | `4a38a75` | | #439 | `055aef9` | `ef14bf3` | - The only change in content is in #223's commit: those two upstream test calls pass `Target::ANY`. The other 26 commits are replayed unchanged, with their authors. - Every commit builds on its own (`cargo check --workspace --all-targets` after each of the 27). - At `ef14bf3`: the shader crate's tests, 116 passed, 0 failed, 1 ignored; the other crates, 210 passed, 0 failed, 4 ignored. Two runs, because the full `cargo test --workspace` stalled twice in upstream's `valu_tests`, the intermittent hang #433 fixes. - Not rerun on the new base: the offline translate counts in the description (they are from `055aef9`). - The descriptions of the four PRs give the old id of each commit, since testers' reports and older comments use them. The title was not used in these tests. AI-assisted (Claude Code).
Author
Owner

@⁠slint6614-dev on GitHub · 2026-11-24 08:44 UTC · original

Measured on the full retail shader pack (26,503 containers) with victory translate --validate --pipelines (pipelines created on an AMD RX 9070, Adrenalin, Windows 11; dxil.dll from SDK 10.0.26100), against main 1f858b0. Counts are emitted / validated / pipelines.

  • #439: CS 1735 / 1681 / 1735 (main 1693 / 1670): +42 emitted, +11 validated; the other 31 fail the validator ("Entry function performs some operation that is incompatible with the shader stage"). It also adds 40 "an SCC the emitter did not compute" and 7 "a program the console structure cannot hold" refusals. VS/PS and MS unchanged.
  • #320: CS 1715 / 1672 / 1715: +22 emitted, +2 validated; "Entry function performs some operation that is incompatible…" goes 23 → 43. VS/PS and MS unchanged.

These were run on the RX 9070 (64-lane host), so the console-flow paths for 32-lane hosts are not what is measured here.

**@⁠slint6614-dev** on GitHub · 2026-11-24 08:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7126495506) Measured on the full retail shader pack (26,503 containers) with `victory translate --validate --pipelines` (pipelines created on an AMD RX 9070, Adrenalin, Windows 11; dxil.dll from SDK 10.0.26100), against main 1f858b0. Counts are emitted / validated / pipelines. - #439: CS 1735 / 1681 / 1735 (main 1693 / 1670): +42 emitted, +11 validated; the other 31 fail the validator ("Entry function performs some operation that is incompatible with the shader stage"). It also adds 40 "an SCC the emitter did not compute" and 7 "a program the console structure cannot hold" refusals. VS/PS and MS unchanged. - #320: CS 1715 / 1672 / 1715: +22 emitted, +2 validated; "Entry function performs some operation that is incompatible…" goes 23 → 43. VS/PS and MS unchanged. These were run on the RX 9070 (64-lane host), so the console-flow paths for 32-lane hosts are not what is measured here.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 08:46 UTC · original

@⁠walterwallaceson thank you, that closes the one thing I could not check myself: the skip path on a Windows 10 machine without SM 6.6. Both lane-read loop tests skipping with the reason printed is what e6936e3 was meant to do, and it is good to have the other failures there named as main's (#362, #118) and #483's.

For anyone reading later: the head you tested, 055aef9, is the same code as the current head ef14bf3. The stack was rebased onto the new main after your run (see the rebase note above); the only difference is two upstream test call sites in #223's commit.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 08:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7126553905) @⁠walterwallaceson thank you, that closes the one thing I could not check myself: the skip path on a Windows 10 machine without SM 6.6. Both lane-read loop tests skipping with the reason printed is what `e6936e3` was meant to do, and it is good to have the other failures there named as `main`'s (#362, #118) and #483's. For anyone reading later: the head you tested, `055aef9`, is the same code as the current head `ef14bf3`. The stack was rebased onto the new `main` after your run (see the rebase note above); the only difference is two upstream test call sites in #223's commit. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 09:16 UTC · original

Rebased again, onto main 8e79c80 (force-pushed with lease, all four stack branches). Upstream merged another 24 PRs and added CI. New upstream tests build lower::Parts directly, so the three things this stack adds to it are given to those tests in the commits that introduce them.

PR before today after the first rebase now
#223 e0865d2 b2adc37 1b012df
#233 3098672 cd4677c 189d294
#320 a5ba4a4 4a38a75 d07da2b
#439 055aef9 ef14bf3 60a126a

Checked here with the commands the new CI runs: both clippy commands (-D warnings, with and without --all-features) are clean at the head of each of the four PRs, every one of the 27 commits builds, and cargo test --workspace --locked at 60a126a gives 346 passed, 0 failed, 6 ignored (RTX 5070 + Radeon iGPU). The title was not used in these tests. Nothing in the stack's own code changed.

Replies to three reports:

@⁠slint6614-dev thank you for the 64-lane measurement. Two notes on reading it. The 31 new modules that fail validation are the compute sample class (#180), as on 32-lane hosts. And the "40 an SCC the emitter did not compute" and "7 a program the console structure cannot hold" are not 47 programs lost: a program that both forms refuse now reports the console flow's reason where it used to report the per-lane form's, so those are programs main refuses too, under another name. In my own program-by-program comparison (an offline translate over a local copy of the shaders, counts only) no program that translated before stops, on either host kind. I agree the changed reason is less helpful there than the old one; that is a diagnostics defect I will fix after review rather than move this PR again now.

@⁠likecrank-dotcom thank you for the careful run and for saying what it does not show. It matches the others: with this PR alone the 131 driver refusals go to 0 (75 of those exact hashes now accepted), and the device is still lost at world entry, with DRED naming mesh programs both times. This stack does not touch mesh programs. The runs that stay in the world all carry the set from #71 (and #336, now merged, for the descriptor pool), so your next check on current main is the right one.

@⁠mohammadallami75-ops thank you: that is the case I had listed as next but not done (scalars that leave a divergent loop; #269's fixtures were exact here only when forced through the console flow), and your table shows the gap clearly. This PR is closed to new features so it stays reviewable, and upstream is not taking new PRs right now, so the way in is a PR against shader/console-flow-lds on r4tedx/VIctory. I will build it, run it on an RTX 5070 and a Radeon iGPU, measure how many title programs change form with it (that number matters: it decides how much of the title moves to the slower form), and carry it on the fork beside the multi-wave branch until upstream opens again. If a fork PR is not convenient I can take the patch from your comment with your authorship; say which you prefer.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 09:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7127185259) **Rebased again, onto `main` `8e79c80`** (force-pushed with lease, all four stack branches). Upstream merged another 24 PRs and added CI. New upstream tests build `lower::Parts` directly, so the three things this stack adds to it are given to those tests in the commits that introduce them. | PR | before today | after the first rebase | now | |---|---|---|---| | #223 | `e0865d2` | `b2adc37` | `1b012df` | | #233 | `3098672` | `cd4677c` | `189d294` | | #320 | `a5ba4a4` | `4a38a75` | `d07da2b` | | #439 | `055aef9` | `ef14bf3` | `60a126a` | Checked here with the commands the new CI runs: both clippy commands (`-D warnings`, with and without `--all-features`) are clean at the head of each of the four PRs, every one of the 27 commits builds, and `cargo test --workspace --locked` at `60a126a` gives 346 passed, 0 failed, 6 ignored (RTX 5070 + Radeon iGPU). The title was not used in these tests. Nothing in the stack's own code changed. Replies to three reports: **@⁠slint6614-dev** thank you for the 64-lane measurement. Two notes on reading it. The 31 new modules that fail validation are the compute `sample` class (#180), as on 32-lane hosts. And the "40 `an SCC the emitter did not compute`" and "7 `a program the console structure cannot hold`" are not 47 programs lost: a program that both forms refuse now reports the console flow's reason where it used to report the per-lane form's, so those are programs `main` refuses too, under another name. In my own program-by-program comparison (an offline translate over a local copy of the shaders, counts only) no program that translated before stops, on either host kind. I agree the changed reason is less helpful there than the old one; that is a diagnostics defect I will fix after review rather than move this PR again now. **@⁠likecrank-dotcom** thank you for the careful run and for saying what it does not show. It matches the others: with this PR alone the 131 driver refusals go to 0 (75 of those exact hashes now accepted), and the device is still lost at world entry, with DRED naming mesh programs both times. This stack does not touch mesh programs. The runs that stay in the world all carry the set from #71 (and #336, now merged, for the descriptor pool), so your next check on current `main` is the right one. **@⁠mohammadallami75-ops** thank you: that is the case I had listed as next but not done (scalars that leave a divergent loop; #269's fixtures were exact here only when forced through the console flow), and your table shows the gap clearly. This PR is closed to new features so it stays reviewable, and upstream is not taking new PRs right now, so the way in is a PR against `shader/console-flow-lds` on r4tedx/VIctory. I will build it, run it on an RTX 5070 and a Radeon iGPU, measure how many title programs change form with it (that number matters: it decides how much of the title moves to the slower form), and carry it on the fork beside the multi-wave branch until upstream opens again. If a fork PR is not convenient I can take the patch from your comment with your authorship; say which you prefer. AI-assisted (Claude Code).
Author
Owner

@⁠mohammadallami75-ops on GitHub · 2026-11-24 09:25 UTC · original

@⁠r4tedx Thanks! Please feel free to incorporate the patch directly from my comment with my authorship preserved. I'd be interested to see the results on the RTX 5070 and Radeon iGPU, particularly how many title shaders benefit from the change. Happy to help investigate any further issues that arise during testing.

**@⁠mohammadallami75-ops** on GitHub · 2026-11-24 09:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7127387074) @⁠r4tedx Thanks! Please feel free to incorporate the patch directly from my comment with my authorship preserved. I'd be interested to see the results on the RTX 5070 and Radeon iGPU, particularly how many title shaders benefit from the change. Happy to help investigate any further issues that arise during testing.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 09:26 UTC · original

CI failed on the four stack PRs and that was my tests' fault; fixed and force-pushed with lease. Clippy passed in both configurations on all four. The test step failed.

Cause: GitHub's runner has no GPU and lists Windows' software renderer (Microsoft Basic Render Driver, 4-lane waves) as an ordinary adapter, without the software flag. The tests here run "on every hardware adapter" and assumed each one has 32-lane waves, so on the runner they tried to translate wave32 and wave64 programs for a 4-lane host and panicked. One more test takes the default device, which is that renderer there. On a machine with a GPU none of this shows.

Fix, in the commits that introduced the tests (no translator code changed):

  • #233: the hardware-adapter list leaves the Basic Render Driver out by its ids (0x1414 / 0x8c) and its name as well as by the software flag.
  • #223: what_translates_for_the_host_creates_a_pipeline accepts a host without waves of the program's size.
  • #320: the lane-read loop test takes its devices from that list with the SM 6.6 check and skips when there is none. That was the test-only commit at the top of this PR (e6936e3); it is folded down, so this PR has 16 commits of its own now.
PR head now was
#223 1dfb859 1b012df
#233 dd3c08c 189d294
#320 fd8b8fe d07da2b
#439 1ca87f7 60a126a

Checked before pushing this time:

  • The #223 failure reproduces here with VICTORY_WARP=1 (same panic, same line) and passes with the fix, on the software renderer and on the RTX 5070.
  • The runner's conditions emulated at each head (software renderer as the default device, hardware-adapter list forced empty): the shader crate's tests pass, the GPU ones by skipping (92 / 102 / 105 / 123 passed at the four heads).
  • On real hardware (RTX 5070 + Radeon iGPU) at 1ca87f7: cargo test --workspace --locked 346 passed, 0 failed, 6 ignored; both clippy commands clean at each head.

What I could not check here: that the runner's renderer really reports those ids. The name match is the fallback, and the log names it exactly. The new CI runs will say.

The title was not used in these tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 09:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7127413035) **CI failed on the four stack PRs and that was my tests' fault; fixed and force-pushed with lease.** Clippy passed in both configurations on all four. The test step failed. Cause: GitHub's runner has no GPU and lists Windows' software renderer (Microsoft Basic Render Driver, 4-lane waves) as an ordinary adapter, without the software flag. The tests here run "on every hardware adapter" and assumed each one has 32-lane waves, so on the runner they tried to translate wave32 and wave64 programs for a 4-lane host and panicked. One more test takes the default device, which is that renderer there. On a machine with a GPU none of this shows. Fix, in the commits that introduced the tests (no translator code changed): - #233: the hardware-adapter list leaves the Basic Render Driver out by its ids (`0x1414` / `0x8c`) and its name as well as by the software flag. - #223: `what_translates_for_the_host_creates_a_pipeline` accepts a host without waves of the program's size. - #320: the lane-read loop test takes its devices from that list with the SM 6.6 check and skips when there is none. That was the test-only commit at the top of this PR (`e6936e3`); it is folded down, so this PR has 16 commits of its own now. | PR | head now | was | |---|---|---| | #223 | `1dfb859` | `1b012df` | | #233 | `dd3c08c` | `189d294` | | #320 | `fd8b8fe` | `d07da2b` | | #439 | `1ca87f7` | `60a126a` | Checked before pushing this time: - The #223 failure reproduces here with `VICTORY_WARP=1` (same panic, same line) and passes with the fix, on the software renderer and on the RTX 5070. - The runner's conditions emulated at each head (software renderer as the default device, hardware-adapter list forced empty): the shader crate's tests pass, the GPU ones by skipping (92 / 102 / 105 / 123 passed at the four heads). - On real hardware (RTX 5070 + Radeon iGPU) at `1ca87f7`: `cargo test --workspace --locked` 346 passed, 0 failed, 6 ignored; both clippy commands clean at each head. What I could not check here: that the runner's renderer really reports those ids. The name match is the fallback, and the log names it exactly. The new CI runs will say. The title was not used in these tests. AI-assisted (Claude Code).
Author
Owner

@⁠MartinIndra02 on GitHub · 2026-11-24 09:29 UTC · original

Full-corpus victory translate --pipelines measurement on NVIDIA Ampere for the rebased head ef14bf3 (comparing against main c7a5f49):

  • Setup: Windows 11 Pro 26200, NVIDIA GeForce RTX 3080 (10 GB, driver 621.24, host waves 32-32 lanes), Ryzen 7 5800X3D, Rust 1.98.1 (x86_64-pc-windows-msvc), diag build.
  • Unit tests (ef14bf3): cargo test -p victory-shader --lib -- --test-threads=1 → 116 passed, 0 failed, 1 ignored.
  • Full corpus (26,148 programs; no dxil.dll installed so --validate was not run):
Stage main (c7a5f49) emitted / pipelines #439 (ef14bf3) emitted / pipelines Pipeline delta
Vertex + Pixel (of 14,013) 12,236 / 12,236 12,284 / 12,284 +48
Mesh (of 8,506) 8,163 / 8,163 8,191 / 8,191 +28
Compute (of 2,581) 1,440 / 1,121 (319 refused) 1,691 / 1,691 (0 refused) +570
Total 21,520 22,166 +646

Driver-refused compute pipelines (pipeline: The parameter is incorrect.) drop from 319 → 0 on this 32-lane GPU. Remaining wave64-on-32-lane emit stops on ef14bf3:

  • 43: console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves
  • 4: a whole-wave section of a wave64 on a host without 64-lane waves

Counts only; no game data. AI-assisted; all builds, tests, and pipeline runs executed on my machine.

**@⁠MartinIndra02** on GitHub · 2026-11-24 09:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7127487703) Full-corpus `victory translate --pipelines` measurement on NVIDIA Ampere for the rebased head `ef14bf3` (comparing against `main` `c7a5f49`): - **Setup:** Windows 11 Pro 26200, NVIDIA GeForce RTX 3080 (10 GB, driver `621.24`, `host waves 32-32 lanes`), Ryzen 7 5800X3D, Rust 1.98.1 (`x86_64-pc-windows-msvc`), diag build. - **Unit tests (`ef14bf3`):** `cargo test -p victory-shader --lib -- --test-threads=1` → **116 passed, 0 failed, 1 ignored**. - **Full corpus (26,148 programs; no `dxil.dll` installed so `--validate` was not run):** | Stage | `main` (`c7a5f49`) emitted / pipelines | `#439` (`ef14bf3`) emitted / pipelines | Pipeline delta | |---|---|---|---| | Vertex + Pixel (of 14,013) | 12,236 / 12,236 | 12,284 / 12,284 | **+48** | | Mesh (of 8,506) | 8,163 / 8,163 | 8,191 / 8,191 | **+28** | | Compute (of 2,581) | 1,440 / 1,121 (319 refused) | 1,691 / 1,691 (0 refused) | **+570** | | **Total** | **21,520** | **22,166** | **+646** | Driver-refused compute pipelines (`pipeline: The parameter is incorrect.`) drop from **319 → 0** on this 32-lane GPU. Remaining wave64-on-32-lane emit stops on `ef14bf3`: - `43`: `console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves` - `4`: `a whole-wave section of a wave64 on a host without 64-lane waves` *Counts only; no game data. AI-assisted; all builds, tests, and pipeline runs executed on my machine.*
Author
Owner

@⁠MrCloudy2 on GitHub · 2026-11-24 10:14 UTC · original

Tester result for this stack (#223 → #233 → #320 → #439) on a 32-lane NVIDIA host.

Setup: RTX 3060 12 GB, driver 620.73.04 (subgroup size 32..32), Linux, Proton-CachyOS 11.0 wine with vkd3d-proton 3.2.0, diag build cross-compiled with xwin, own 1.0.2.1 copy.

Method: I took the compute programs one world run had refused with host pipeline refused ... E_INVALIDARG (vkd3d-proton: Required WaveSize range [64, 64], but supported range is [32, 32]): 102 distinct programs. Each was matched to its container by BLAKE3, the hash VIctory logs. All 102 went in one folder, and I ran victory translate <folder> --pipelines --jobs 4 twice on the same machine:

build compute programs emitted host pipelines created
main 8e79c80 + #151 #190 #454 #493 #579 + #177's key fix 102 of 102 0
the same + this stack (merged #439 cleanly on top) 81 of 102 81

All 102 translate in both builds. In the stack build 21 are not emitted for the 32-lane host, and none of the 81 created pipelines crashed the driver. The merge onto that base was clean (git merge-tree), and the merged tree builds (cargo build --profile diag; clippy not run).

AI-assisted (Claude Code); measured on the machine above.

**@⁠MrCloudy2** on GitHub · 2026-11-24 10:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7128508207) Tester result for this stack (#223 → #233 → #320 → #439) on a 32-lane NVIDIA host. **Setup:** RTX 3060 12 GB, driver 620.73.04 (subgroup size 32..32), Linux, Proton-CachyOS 11.0 wine with vkd3d-proton 3.2.0, diag build cross-compiled with xwin, own 1.0.2.1 copy. **Method:** I took the compute programs one world run had refused with `host pipeline refused ... E_INVALIDARG` (vkd3d-proton: `Required WaveSize range [64, 64], but supported range is [32, 32]`): **102** distinct programs. Each was matched to its container by BLAKE3, the hash VIctory logs. All 102 went in one folder, and I ran `victory translate <folder> --pipelines --jobs 4` twice on the same machine: | build | compute programs emitted | host pipelines created | |---|---:|---:| | `main` `8e79c80` + #151 #190 #454 #493 #579 + #177's key fix | 102 of 102 | **0** | | the same + this stack (merged #439 cleanly on top) | 81 of 102 | **81** | All 102 translate in both builds. In the stack build 21 are not emitted for the 32-lane host, and none of the 81 created pipelines crashed the driver. The merge onto that base was clean (`git merge-tree`), and the merged tree builds (`cargo build --profile diag`; clippy not run). AI-assisted (Claude Code); measured on the machine above.
Author
Owner

@⁠Sil3ntGam3r on GitHub · 2026-11-24 10:33 UTC · original

Title run on NVIDIA: RTX 3070 8 GB, driver 621.14, Windows 11 (26300); diag build, VICTORY_SHADER_LOOP_LIMIT=32, VICTORY_D3D12_DRED=1, fresh shader cache.

Tree: main 8e79c80 + this PR at 1ca87f7 (with #320, #233, #223) + #180 5ff639e, then #89 #493 #483 #206 #469 #459 #454 #704 #688. Compared with the same PRs with #189 in place of the stack and #180.

  • Unique programs refused in the first 6.5 min: 89 with the stack against 303 with #189; no host pipeline refused in either. The largest remaining reasons with the stack: an address in an SGPR that is no root parameter 31, console wave64 lanes in a group of more than 64 threads 23, an address not from a root parameter 15, image_gather4_l 6.
  • The #189 build ran 11+ minutes in the world without device removal. The stack build was removed twice, at different points:
    1. about 7 min after launch, in the world: 0x887A0001 (DXGI_ERROR_INVALID_CALL), DRED breadcrumbs empty, the last recorded draw [vertex c5310733d58458c8, pixel 5460ce5f3b925eee]. 12 s before, the first pipelines of newly translated compute programs were created (fdd56d97a806bcca among them).
    2. relaunched with VICTORY_D3D12_DEBUG=1 and the cache warm: removed after 1m18s, still in the menus, at the first bind of dispatch 1x1x1 [compute 24317e785c8688e3]. That program had also run in run 1 without trouble. The debug layer reported no error before the removal.
  • No nvgpucomp64.dll exception and no E_OUTOFMEMORY, so this doesn't look like the RTX 3080 report in your notes.

Merging notes: with #180, implicit-derivative samples go in in_half, as in your integration branch. #459's and #704's tests needed Target::ANY and the new Parts fields, and #704's GPU tests need #483's guard dword filled. 368 tests pass on the RTX 3070. The scene behind the credits is still black in both builds. (AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 10:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7128946213) Title run on NVIDIA: RTX 3070 8 GB, driver 621.14, Windows 11 (26300); diag build, `VICTORY_SHADER_LOOP_LIMIT=32`, `VICTORY_D3D12_DRED=1`, fresh shader cache. Tree: main `8e79c80` + this PR at `1ca87f7` (with #320, #233, #223) + #180 `5ff639e`, then #89 #493 #483 #206 #469 #459 #454 #704 #688. Compared with the same PRs with #189 in place of the stack and #180. - Unique programs refused in the first 6.5 min: **89 with the stack against 303 with #189**; no host pipeline refused in either. The largest remaining reasons with the stack: `an address in an SGPR that is no root parameter` 31, `console wave64 lanes in a group of more than 64 threads` 23, `an address not from a root parameter` 15, `image_gather4_l` 6. - The #189 build ran 11+ minutes in the world without device removal. The stack build was removed twice, at different points: 1. about 7 min after launch, in the world: `0x887A0001` (`DXGI_ERROR_INVALID_CALL`), DRED breadcrumbs empty, the last recorded draw `[vertex c5310733d58458c8, pixel 5460ce5f3b925eee]`. 12 s before, the first pipelines of newly translated compute programs were created (`fdd56d97a806bcca` among them). 2. relaunched with `VICTORY_D3D12_DEBUG=1` and the cache warm: removed after 1m18s, still in the menus, at the first bind of `dispatch 1x1x1 [compute 24317e785c8688e3]`. That program had also run in run 1 without trouble. The debug layer reported no error before the removal. - No `nvgpucomp64.dll` exception and no `E_OUTOFMEMORY`, so this doesn't look like the RTX 3080 report in your notes. Merging notes: with #180, implicit-derivative samples go in `in_half`, as in your integration branch. #459's and #704's tests needed `Target::ANY` and the new `Parts` fields, and #704's GPU tests need #483's guard dword filled. 368 tests pass on the RTX 3070. The scene behind the credits is still black in both builds. (AI-assisted test run.)
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 11:27 UTC · original

For the program that reaches v_permlanex16_b32, Daniel tested a focused port of #404 on ac6ab70. The current #439 head c153b21 has the same source tree. The port handles the ordinary all-active form: each lane selects from the opposite row of 16 within the same 32-lane half of the guest wave.

On RTX 4090 under Wine/GE 3.2, the baseline refused the source-built shader before pipeline creation. The port emitted DXV-valid WaveSize=32 code and returned all 128 expected words in each of two cases: a split-wave permutation, and the same permutation in console flow with an additional read from guest lane 40. The test used distinct values across both halves. Comparison branch and regression

The remaining title question is whether a929109552ce1e84 uses the supported form and, if so, what it reaches next in translation and validation. We have no in-game or full-resolution lighting result for this change.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 11:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7130125359) For the program that reaches `v_permlanex16_b32`, Daniel tested a focused port of #404 on `ac6ab70`. The current #439 head `c153b21` has the same source tree. The port handles the ordinary all-active form: each lane selects from the opposite row of 16 within the same 32-lane half of the guest wave. On RTX 4090 under Wine/GE 3.2, the baseline refused the source-built shader before pipeline creation. The port emitted DXV-valid WaveSize=32 code and returned all 128 expected words in each of two cases: a split-wave permutation, and the same permutation in console flow with an additional read from guest lane 40. The test used distinct values across both halves. [Comparison branch and regression](https://github.com/MichaelSmithAI/VIctory/commit/74365b7) The remaining title question is whether `a929109552ce1e84` uses the supported form and, if so, what it reaches next in translation and validation. We have no in-game or full-resolution lighting result for this change.
Author
Owner

@⁠supidooo on GitHub · 2026-11-24 11:36 UTC · original

Tested head c153b21 merged cleanly onto main (ffe310e) + #175 (19aec59, Windows 10 Agility SDK 1.620.2) on Windows 10 Pro 22H2 (Build 19045), NVIDIA GeForce RTX 4060 Ti 16 GB (driver 32.0.16.2124 / 621.24), Intel Core i7-10700K, 32 GB RAM, Rust 1.98.1, release build.

victory translate --pipelines (auto-detected host waves 32-32 lanes)

Baseline (main ffe310e + #175) vs +#439 (c153b21) on the same 26,599 containers (26,148 IR programs):

Stage Baseline emitted / pipelines +#439 emitted / pipelines Delta
Vertex & Pixel (of 14,039) 12243 / 12243 12243 / 12243 0
Compute (of 2,582) 1441 / 1121 1420 / 1420 +299 host pipelines (100% emitted accepted)
Mesh (of 8,713) 8214 / 8214 8214 / 8214 0

Notable failure-reason changes on 32-32 lanes:

  • pipeline: E_INVALIDARG (driver rejection of Wave64 compute PSOs): 320 → 0
  • emit: a select on an untracked mask: 288 → 0
  • emit: a lane mask holding lanes elsewhere read as data: 272 → 3
  • emit: a descriptor read only as data: 394 → 819
  • emit: an SCC the emitter did not compute: 0 → 86
  • emit: console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves: 0 → 43
  • emit: a whole-wave section of a wave64 on a host without 64-lane waves: 0 → 4
  • emit: a program the console structure cannot hold: 0 → 7

cargo test -p victory-shader --lib

  • 140 passed; 15 failed; 1 ignored (every emit::split_tests::* and emit::lane_read_loop_tests::* test passed).
  • All 15 failures (13 in emit::valu_tests + 2 in emit::waterfall_tests) are strictly neither hardware nor WARP SM 6.6 device available, expected on Windows 10 without #362 because the test binary does not carry the Agility SDK exports.
**@⁠supidooo** on GitHub · 2026-11-24 11:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7130310930) Tested head `c153b21` merged cleanly onto `main` (`ffe310e`) + `#175` (`19aec59`, Windows 10 Agility SDK `1.620.2`) on **Windows 10 Pro 22H2 (Build 19045)**, **NVIDIA GeForce RTX 4060 Ti 16 GB** (driver `32.0.16.2124` / `621.24`), Intel Core i7-10700K, 32 GB RAM, Rust `1.98.1`, release build. ### `victory translate --pipelines` (auto-detected `host waves 32-32 lanes`) Baseline (`main` `ffe310e` + `#175`) vs **+#439 (`c153b21`)** on the same 26,599 containers (26,148 IR programs): | Stage | Baseline emitted / pipelines | +#439 emitted / pipelines | Delta | |---|---:|---:|---:| | **Vertex & Pixel** (of 14,039) | `12243` / `12243` | `12243` / `12243` | `0` | | **Compute** (of 2,582) | `1441` / `1121` | `1420` / `1420` | **+299 host pipelines** (100% emitted accepted) | | **Mesh** (of 8,713) | `8214` / `8214` | `8214` / `8214` | `0` | Notable failure-reason changes on `32-32` lanes: - `pipeline: E_INVALIDARG` (driver rejection of Wave64 compute PSOs): **320 → 0** - `emit: a select on an untracked mask`: **288 → 0** - `emit: a lane mask holding lanes elsewhere read as data`: **272 → 3** - `emit: a descriptor read only as data`: **394 → 819** - `emit: an SCC the emitter did not compute`: **0 → 86** - `emit: console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves`: **0 → 43** - `emit: a whole-wave section of a wave64 on a host without 64-lane waves`: **0 → 4** - `emit: a program the console structure cannot hold`: **0 → 7** ### `cargo test -p victory-shader --lib` - **140 passed; 15 failed; 1 ignored** (every `emit::split_tests::*` and `emit::lane_read_loop_tests::*` test passed). - All 15 failures (`13` in `emit::valu_tests` + `2` in `emit::waterfall_tests`) are strictly `neither hardware nor WARP SM 6.6 device available`, expected on Windows 10 without #362 because the test binary does not carry the Agility SDK exports.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 11:40 UTC · original

@⁠supidooo, thanks for testing c153b21 with #175 on both builds. The distinction between emission and pipeline creation matters here: 21 fewer compute programs emitted overall, yet 299 more host pipelines were created, and the RTX 4060 Ti accepted all 1,420 compute modules that emitted. The mask-select refusal falling from 288 to zero also answers part of the earlier question on this thread. The rise in descriptor and SCC refusals gives us the next diagnostics to investigate; matching hashes across builds would show which individual shaders reached each one.

The 15 test failures are consistent with the Windows 10 test-executable issue tracked in #362. #175 supplies Agility exports to victory.exe; the shader tests run in their own executable. If you have time for one follow-up, the most useful check is the same shader test command with #362 applied and -- --nocapture, so the output distinguishes GPU execution from an adapter skip. The offline pipeline counts already stand on their own.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 11:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7130394403) @⁠supidooo, thanks for testing `c153b21` with #175 on both builds. The distinction between emission and pipeline creation matters here: 21 fewer compute programs emitted overall, yet 299 more host pipelines were created, and the RTX 4060 Ti accepted all 1,420 compute modules that emitted. The mask-select refusal falling from 288 to zero also answers part of the earlier question on this thread. The rise in descriptor and SCC refusals gives us the next diagnostics to investigate; matching hashes across builds would show which individual shaders reached each one. The 15 test failures are consistent with the Windows 10 test-executable issue tracked in #362. #175 supplies Agility exports to `victory.exe`; the shader tests run in their own executable. If you have time for one follow-up, the most useful check is the same shader test command with #362 applied and `-- --nocapture`, so the output distinguishes GPU execution from an adapter skip. The offline pipeline counts already stand on their own. AI-assisted (Codex).
Author
Owner

@⁠Ilokaxt on GitHub · 2026-11-24 12:02 UTC · original

Tested on an RTX 3070 Ti Laptop (wave lanes 32..32, NVIDIA driver 610.88 / 32.0.16.1088, Windows 11 build 26300), on main at ffe310e. Each build also had a local fix that creates the device on the high-performance adapter: this laptop's default adapter is the Iris Xe.

Same scripted run for each: diagnostics build, VICTORY_KEYS pressing Enter every 4 s, DRED on, up to 420 s, into the world.

build wave64 compute refused shaders not translated world draws dropped end
main 124 399 41% device hung at 199 s in an ExecuteIndirect
main + #439 0 205 39% device hung at 107 s in a Dispatch
main + #578 refused up front 364 85–98% no removal in 420 s
main + #439 + #578 0 148–247 – device hung at 97–113 s in a Dispatch

The hanging dispatch, named by DRED without the debug layer: compute 42683eebec081520, Dispatch(128, 64, 1), 6 user-data dwords, 1 sampler. On main the driver refuses this pipeline ("wants wave lane count of 64 but maximum wave lane count for device is 32"). #578 refuses it up front. With #439 it translates for 32-lane waves and the device hangs (TDR) the first time it runs in the world. This happened on all three #439 runs.

#439 otherwise brings every wave64 compute program in on this GPU (124 → 0 refused).

**@⁠Ilokaxt** on GitHub · 2026-11-24 12:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7130890870) Tested on an **RTX 3070 Ti Laptop** (wave lanes 32..32, NVIDIA driver 610.88 / 32.0.16.1088, Windows 11 build 26300), on `main` at `ffe310e`. Each build also had a local fix that creates the device on the high-performance adapter: this laptop's default adapter is the Iris Xe. Same scripted run for each: diagnostics build, `VICTORY_KEYS` pressing Enter every 4 s, DRED on, up to 420 s, into the world. | build | wave64 compute refused | shaders not translated | world draws dropped | end | |---|---|---|---|---| | main | 124 | 399 | 41% | device hung at 199 s in an `ExecuteIndirect` | | main + #439 | 0 | 205 | 39% | **device hung at 107 s in a `Dispatch`** | | main + #578 | refused up front | 364 | 85–98% | no removal in 420 s | | main + #439 + #578 | 0 | 148–247 | – | device hung at 97–113 s in a `Dispatch` | The hanging dispatch, named by DRED without the debug layer: **compute `42683eebec081520`**, `Dispatch(128, 64, 1)`, 6 user-data dwords, 1 sampler. On `main` the driver refuses this pipeline ("wants wave lane count of 64 but maximum wave lane count for device is 32"). #578 refuses it up front. With #439 it translates for 32-lane waves and the device hangs (TDR) the first time it runs in the world. This happened on all three #439 runs. #439 otherwise brings every wave64 compute program in on this GPU (124 → 0 refused).
Author
Owner

@⁠supidooo on GitHub · 2026-11-24 12:16 UTC · original

@⁠r4tedx Here is the follow-up run with #362 (1e33e88) merged cleanly onto main (ffe310e) + #175 (19aec59) + #439 (c153b21) on Windows 10 Pro 22H2 (Build 19045), NVIDIA GeForce RTX 4060 Ti 16 GB (driver 32.0.16.2124 / 621.24), Intel Core i7-10700K, 32 GB RAM, Rust 1.98.1 (no game data used):

  • Test executable exports (dumpbin /exports): both D3D12SDKPath and D3D12SDKVersion are present on the victory_shader test binary (target\debug\deps\victory_shader-01150f1076d175ec.exe).
  • cargo test -p victory-shader --lib -- --nocapture: 155 passed; 0 failed; 1 ignored (benchmark) in 42.94 s (up from 140 passed; 15 failed without #362).

Hardware execution vs. skips (--nocapture)

  • Hardware GPU (NVIDIA GeForce RTX 4060 Ti): 0 no SM 6.6 hardware device; skipped — every hardware test executed on the RTX 4060 Ti (110 NVIDIA GeForce RTX 4060 Ti: ... lines):
    • All emit::split_tests GPU cases ran on the RTX 4060 Ti and printed exact (including split true across 32/48/64/128-thread and 3D groups, LDS ordering, DPP/permlane/readlane/writelane, whole-wave reductions/prefixes, and wave32/wave64 constant/built mask selects).
    • Both emit::lane_read_loop_tests passed (NVIDIA GeForce RTX 4060 Ti: joined back edge exact).
    • emit::tests::each_adapter_gets_what_it_runs (waves 32-32), emit::tests::what_translates_for_the_host_creates_a_pipeline (host waves 32-32), emit::tests::stub_pipeline_is_created, all 13 emit::valu_tests, and all 5 emit::waterfall_tests executed on the hardware GPU and passed.
  • Remaining skips:
    • 35 × no SM 6.6 warp device; skipped (expected on Windows 10's in-box WARP)
    • 6 × no dxil.dll; validation skipped and 1 × no dxil.dll; skipped (constant_color_validates; no dxil.dll on this setup)
    • 1 × no console compiler; skipped + 3 × no console or PC compiler; skipped (emit::diff_tests)
**@⁠supidooo** on GitHub · 2026-11-24 12:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7131197035) @⁠r4tedx Here is the follow-up run with **#362** (`1e33e88`) merged cleanly onto `main` (`ffe310e`) + `#175` (`19aec59`) + `#439` (`c153b21`) on **Windows 10 Pro 22H2 (Build 19045)**, **NVIDIA GeForce RTX 4060 Ti 16 GB** (driver `32.0.16.2124` / `621.24`), Intel Core i7-10700K, 32 GB RAM, Rust `1.98.1` (no game data used): - **Test executable exports (`dumpbin /exports`):** both `D3D12SDKPath` and `D3D12SDKVersion` are present on the `victory_shader` test binary (`target\debug\deps\victory_shader-01150f1076d175ec.exe`). - **`cargo test -p victory-shader --lib -- --nocapture`:** **155 passed; 0 failed; 1 ignored** (benchmark) in 42.94 s (up from `140 passed; 15 failed` without #362). ### Hardware execution vs. skips (`--nocapture`) - **Hardware GPU (`NVIDIA GeForce RTX 4060 Ti`):** **0** `no SM 6.6 hardware device; skipped` — every hardware test executed on the RTX 4060 Ti (**110** `NVIDIA GeForce RTX 4060 Ti: ...` lines): - All `emit::split_tests` GPU cases ran on the RTX 4060 Ti and printed `exact` (including `split true` across 32/48/64/128-thread and 3D groups, LDS ordering, DPP/permlane/readlane/writelane, whole-wave reductions/prefixes, and `wave32`/`wave64` constant/built mask selects). - Both `emit::lane_read_loop_tests` passed (`NVIDIA GeForce RTX 4060 Ti: joined back edge exact`). - `emit::tests::each_adapter_gets_what_it_runs` (`waves 32-32`), `emit::tests::what_translates_for_the_host_creates_a_pipeline` (`host waves 32-32`), `emit::tests::stub_pipeline_is_created`, all **13** `emit::valu_tests`, and all **5** `emit::waterfall_tests` executed on the hardware GPU and passed. - **Remaining skips:** - `35` × `no SM 6.6 warp device; skipped` (expected on Windows 10's in-box WARP) - `6` × `no dxil.dll; validation skipped` and `1` × `no dxil.dll; skipped` (`constant_color_validates`; no `dxil.dll` on this setup) - `1` × `no console compiler; skipped` + `3` × `no console or PC compiler; skipped` (`emit::diff_tests`)
Author
Owner

@⁠Sil3ntGam3r on GitHub · 2026-11-24 12:22 UTC · original

RTX 3070 8 GB, driver 621.14, Windows 11 (26300): main 8e79c80 + #439 1ca87f7 (with #320/#233/#223) + #180 + #89 #493 #483 #206 #469 #459 #454 #704 #688; diag build, DRED, loop limit 32. Following @⁠Ilokaxt's result I ran it with VICTORY_SKIP_PIPELINES=42683eebec081520 (the skip covers direct and indirect dispatches). The device was still removed, in the same second as that program's first bind (frame 1880, still in the menus); without the skip, an earlier run was also removed in the same second as its first bind. With the skip, DRED names indirect kind 10 max 1 [mesh 8563c39d693b36d0] with u9=… [heap 568328: null], breadcrumbs empty. So on this card 42683eeb… marks the point where the hang starts rather than being the only cause. (AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 12:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7131345907) RTX 3070 8 GB, driver 621.14, Windows 11 (26300): main `8e79c80` + #439 `1ca87f7` (with #320/#233/#223) + #180 + #89 #493 #483 #206 #469 #459 #454 #704 #688; diag build, DRED, loop limit 32. Following @⁠Ilokaxt's result I ran it with `VICTORY_SKIP_PIPELINES=42683eebec081520` (the skip covers direct and indirect dispatches). The device was still removed, in the same second as that program's first bind (frame 1880, still in the menus); without the skip, an earlier run was also removed in the same second as its first bind. With the skip, DRED names `indirect kind 10 max 1 [mesh 8563c39d693b36d0]` with `u9=… [heap 568328: null]`, breadcrumbs empty. So on this card `42683eeb…` marks the point where the hang starts rather than being the only cause. (AI-assisted test run.)
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 12:25 UTC · original

@⁠supidooo, that closes the Windows 10 follow-up. You verified the Agility exports on the test executable itself, and the same setup went from 15 failures to zero with #362. The exact outputs confirm the split-wave and joined-back-edge cases executed on the RTX 4060 Ti. I’ve recorded the hardware result and the WARP, validator, and compiler skips in the description.

@⁠Sil3ntGam3r, your skip run narrows the RTX 3070 hang: device removal still occurred with both dispatch paths for 42683eebec081520 skipped. Its first bind is a useful timing marker on your stack. With empty breadcrumbs, the indirect mesh operation and null u9 are leads, but there’s no evidence yet that either caused the removal. I’ve linked your report with the tested stack head so it can be compared with other runs.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 12:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7131429380) @⁠supidooo, that closes the Windows 10 follow-up. You verified the Agility exports on the test executable itself, and the same setup went from 15 failures to zero with #362. The `exact` outputs confirm the split-wave and joined-back-edge cases executed on the RTX 4060 Ti. I’ve recorded the hardware result and the WARP, validator, and compiler skips in the description. @⁠Sil3ntGam3r, your skip run narrows the RTX 3070 hang: device removal still occurred with both dispatch paths for `42683eebec081520` skipped. Its first bind is a useful timing marker on your stack. With empty breadcrumbs, the indirect mesh operation and null `u9` are leads, but there’s no evidence yet that either caused the removal. I’ve linked your report with the tested stack head so it can be compared with other runs. AI-assisted (Codex).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 12:27 UTC · original

@⁠Ilokaxt, thanks for comparing all four builds with the same scripted input and adapter selection. On your 3070 Ti Laptop, DRED named 42683eebec081520 at its first world dispatch in all three runs containing #439. That is a reproducible point to investigate. The baseline also hung, later in ExecuteIndirect. The 420 s run with #578 alone dropped 85–98% of world draws, so it exercised substantially less of the workload.

I’ve linked your results alongside the desktop RTX 3070 skip run. That run used a different driver and PR stack and still hung with this hash skipped. The comparison that would distinguish the two results is a skip run on your laptop using the same main + #439 build, driver, loop limit, and input script. If you can run it, the useful observations are whether it gets past the first world dispatch and, if it hangs later, which operation DRED names. Please include the effective loop limit from the original run as well.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 12:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7131472224) @⁠Ilokaxt, thanks for comparing all four builds with the same scripted input and adapter selection. On your 3070 Ti Laptop, DRED named `42683eebec081520` at its first world dispatch in all three runs containing #439. That is a reproducible point to investigate. The baseline also hung, later in `ExecuteIndirect`. The 420 s run with #578 alone dropped 85–98% of world draws, so it exercised substantially less of the workload. I’ve linked your results alongside the [desktop RTX 3070 skip run](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439). That run used a different driver and PR stack and still hung with this hash skipped. The comparison that would distinguish the two results is a skip run on your laptop using the same `main + #439` build, driver, loop limit, and input script. If you can run it, the useful observations are whether it gets past the first world dispatch and, if it hangs later, which operation DRED names. Please include the effective loop limit from the original run as well. AI-assisted (Codex).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 12:41 UTC · original

@⁠Ilokaxt @⁠Sil3ntGam3r, I ran the exact compute container 42683eebec081520 in isolation on #439 c153b21, on an RTX 5070 (driver 616.92). The 32-lane DXIL validated, its compute pipeline was created, and the reported Dispatch(128,64,1) completed at both loop limit 32 and the default 1,048,576. All four output UAVs received nonzero data in both runs. The shader declares 8×8×1 threads per group. Its split-wave DXIL has 86 static group-barrier calls; that is a count in the module, not a measured number of waits per group.

The bindings here were synthetic: valid raw buffers containing zeros, constant-valued texture inputs, and four texture outputs. This isolates the shader and grid size. It does not exercise the title’s descriptor contents, command-list history, or the two Ampere drivers. The same-laptop A/B remains worthwhile. For a run that hangs, the SRV/UAV dimensions, view formats and null status at the dispatch would let us match the inputs more closely. No game data attached.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 12:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7131792344) @⁠Ilokaxt @⁠Sil3ntGam3r, I ran the exact compute container `42683eebec081520` in isolation on #439 `c153b21`, on an RTX 5070 (driver 616.92). The 32-lane DXIL validated, its compute pipeline was created, and the reported `Dispatch(128,64,1)` completed at both loop limit 32 and the default 1,048,576. All four output UAVs received nonzero data in both runs. The shader declares 8×8×1 threads per group. Its split-wave DXIL has 86 static group-barrier calls; that is a count in the module, not a measured number of waits per group. The bindings here were synthetic: valid raw buffers containing zeros, constant-valued texture inputs, and four texture outputs. This isolates the shader and grid size. It does not exercise the title’s descriptor contents, command-list history, or the two Ampere drivers. The same-laptop A/B remains worthwhile. For a run that hangs, the SRV/UAV dimensions, view formats and null status at the dispatch would let us match the inputs more closely. No game data attached. AI-assisted (Codex).
Author
Owner

@⁠erLCoder on GitHub · 2026-11-24 13:07 UTC · original

GTX 1660 Ti hardware rerun on PR stack c153b21 (base ffe310e; #223/#233/#320 included). Windows 10 22H2 build 19045.6466, NVIDIA 581.42, Ryzen 5 3600, Rust 1.98.1 MSVC, Agility SDK 1.620.2. Independent device probe reports SM 6.8 and 32–32 lanes. Local SDK exports were added to the test executable.

cargo test --offline --locked -p victory-shader --features host --lib emit::split_tests -- --nocapture --test-threads=1 — 28 passed, 0 failed, 0 ignored, 128 filtered out (includes CPU checks).

cargo test --offline --locked -p victory-shader --features host --lib emit::lane_read_loop_tests -- --nocapture --test-threads=1 — 2 passed, 0 failed, 0 ignored, 154 filtered out. Hardware paths printed NVIDIA GeForce GTX 1660 Ti and exact per-lane and joined-back-edge results. Previously e6936e3 gave 24 split and 1 lane-loop pass. #189 was not combined with this stack. Title performance and image quality on c153b21 remain untested.

Codex prepared the worktrees, ran the tests and drafted this report.

**@⁠erLCoder** on GitHub · 2026-11-24 13:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7132380467) GTX 1660 Ti hardware rerun on PR stack c153b21 (base ffe310e; #223/#233/#320 included). Windows 10 22H2 build 19045.6466, NVIDIA 581.42, Ryzen 5 3600, Rust 1.98.1 MSVC, Agility SDK 1.620.2. Independent device probe reports SM 6.8 and 32–32 lanes. Local SDK exports were added to the test executable. `cargo test --offline --locked -p victory-shader --features host --lib emit::split_tests -- --nocapture --test-threads=1` — 28 passed, 0 failed, 0 ignored, 128 filtered out (includes CPU checks). `cargo test --offline --locked -p victory-shader --features host --lib emit::lane_read_loop_tests -- --nocapture --test-threads=1` — 2 passed, 0 failed, 0 ignored, 154 filtered out. Hardware paths printed NVIDIA GeForce GTX 1660 Ti and exact per-lane and joined-back-edge results. Previously e6936e3 gave 24 split and 1 lane-loop pass. #189 was not combined with this stack. Title performance and image quality on c153b21 remain untested. Codex prepared the worktrees, ran the tests and drafted this report.
Author
Owner

@⁠mohammadallami75-ops on GitHub · 2026-11-24 13:09 UTC · original

Follow-up for the multi-wave branch. r4tedx/VIctory#11 backports indirect compute scaling to shader/wave-per-group. It reuses the count-aware clamp from #242 and credits the existing split-dispatch work on testers/indirect-wave-dispatch.

On an RTX 2080 SUPER (621.01), two counted dispatches of the same translated Wave64 fixture produced all 384 expected lane values each time, with the guest arguments and count intact. This was a synthetic run.

If you can independently test b3c2052 in-game on Wave32 NVIDIA hardware, please report the GPU and driver, any affected compute passes you can identify, and whether rendering or device-removal behavior changes. Please post results on the follow-up PR.

AI-assisted implementation and testing.

**@⁠mohammadallami75-ops** on GitHub · 2026-11-24 13:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7132440839) Follow-up for the multi-wave branch. [r4tedx/VIctory#11](https://github.com/r4tedx/VIctory/pull/11) backports indirect compute scaling to shader/wave-per-group. It reuses the count-aware clamp from #242 and credits the existing split-dispatch work on testers/indirect-wave-dispatch. On an RTX 2080 SUPER (621.01), two counted dispatches of the same translated Wave64 fixture produced all 384 expected lane values each time, with the guest arguments and count intact. This was a synthetic run. If you can independently test b3c2052 in-game on Wave32 NVIDIA hardware, please report the GPU and driver, any affected compute passes you can identify, and whether rendering or device-removal behavior changes. Please post results on the follow-up PR. AI-assisted implementation and testing.
Author
Owner

@⁠alfycs on GitHub · 2026-11-24 13:21 UTC · original

@⁠aycow saw your ping — on #189 we just rebased onto ffe310e and pushed updates for the community reports (LDS uniform-join fencing, Wave32 divergent v_readfirstlane, empty-EXEC lane 0, DPP bounds). For the saved-EXEC loop back-edge case you asked about, @⁠r4tedx already linked the regression added here via @⁠ifBars's fix (lane_read_loop_with_a_joined_exec_back_edge).

**@⁠alfycs** on GitHub · 2026-11-24 13:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7132707548) @⁠aycow saw your ping — on #189 we just rebased onto `ffe310e` and pushed updates for the community reports (LDS uniform-join fencing, `Wave32` divergent `v_readfirstlane`, empty-`EXEC` lane 0, DPP bounds). For the saved-EXEC loop back-edge case you asked about, @⁠r4tedx already linked the regression added here via @⁠ifBars's fix (`lane_read_loop_with_a_joined_exec_back_edge`).
Author
Owner

@⁠sash2kk on GitHub · 2026-11-24 13:29 UTC · original

Title run of this stack on a 32-lane host: RTX 4090 (driver 32.0.16.1088), Windows 11 Pro 23H2, i7-13700K. Head c153b21 merged onto main ffe310e together with #578, so the world loads instead of hanging in wave64 mesh. One trivial conflict in host.rs: #578's wave_lanes() and this stack's target() both query OPTIONS1, and I kept both. Diagnostics build, VICTORY_D3D12_DRED=1, existing save, same input each run. Control: ffe310e + #578 alone.

main + #578 main + #439 + #578
compute pipelines refused for 64-lane waves 11 1
shaders that do not translate (compute) 419 (402) 460 (443)
drops/report in the world: refused / untranslated 1265 / 920 1388 / 1576
world fps 1.38 0.75
device removal 4.8 min 4.6 min, same command (an unrelated shader, see #578)

So the refusals mostly go away. But on this host the stack fails to translate 49 programs that main translates, and gains 8:

  • 20x console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves is not supported (expected, if main was running them unsound)
  • 17x a descriptor read only as data is not supported
  • 9x a structured buffer of unknown stride is not supported
  • 1x each: an address in an SGPR that is no root parameter, an SCC the emitter did not compute, a whole-wave section of a wave64 on a host without 64-lane waves

The 17 + 9 look like the 32-lane path missing support that main's own path has. Gained: 3x a lane mask holding lanes elsewhere read as data, 3x a lane-mask join of an untracked mask, 1x an LDS operation, 1x LDS the program does not allocate.

Merged tree: cargo test --workspace --locked passes (victory-shader 155 / 1 ignored, including the GPU wave tests on this card), and all-feature clippy with -D warnings is clean. I can send shader hashes for any of the lists above.

AI-assisted (Claude Code).

**@⁠sash2kk** on GitHub · 2026-11-24 13:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7132909294) Title run of this stack on a 32-lane host: RTX 4090 (driver 32.0.16.1088), Windows 11 Pro 23H2, i7-13700K. Head `c153b21` merged onto `main` `ffe310e` together with #578, so the world loads instead of hanging in wave64 mesh. One trivial conflict in `host.rs`: #578's `wave_lanes()` and this stack's `target()` both query `OPTIONS1`, and I kept both. Diagnostics build, `VICTORY_D3D12_DRED=1`, existing save, same input each run. Control: `ffe310e` + #578 alone. | | `main` + #578 | `main` + #439 + #578 | |---|---|---| | compute pipelines refused for 64-lane waves | 11 | **1** | | shaders that do not translate (compute) | 419 (402) | 460 (443) | | drops/report in the world: refused / untranslated | 1265 / 920 | 1388 / 1576 | | world fps | 1.38 | 0.75 | | device removal | 4.8 min | 4.6 min, same command (an unrelated shader, see #578) | So the refusals mostly go away. But on this host the stack **fails to translate 49 programs that `main` translates**, and gains 8: - 20x `console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves is not supported` (expected, if `main` was running them unsound) - **17x `a descriptor read only as data is not supported`** - **9x `a structured buffer of unknown stride is not supported`** - 1x each: `an address in an SGPR that is no root parameter`, `an SCC the emitter did not compute`, `a whole-wave section of a wave64 on a host without 64-lane waves` The 17 + 9 look like the 32-lane path missing support that `main`'s own path has. Gained: 3x `a lane mask holding lanes elsewhere read as data`, 3x `a lane-mask join of an untracked mask`, 1x `an LDS operation`, 1x `LDS the program does not allocate`. Merged tree: `cargo test --workspace --locked` passes (victory-shader 155 / 1 ignored, including the GPU wave tests on this card), and all-feature clippy with `-D warnings` is clean. I can send shader hashes for any of the lists above. AI-assisted (Claude Code).
Author
Owner

@⁠jebaczydow on GitHub · 2026-11-24 13:40 UTC · original

Title run on an NVIDIA RTX 5070 Ti (32-lane waves), Windows 11, head c153b21

Baseline: main at ffe310e. Both builds carried one local change, unrelated to this PR: textures the host refuses with unordered access are retried without it.

Tests: cargo test --workspace --locked on the 5070 Ti: 378 passed, 0 failed, 6 ignored.

Title, same scripted run on both builds (diagnostics build, VICTORY_KEYS=15:Enter,25:Enter,35:Enter,50:Enter, 80 s; it reaches the world):

main ffe310e this PR c153b21
shaders translated 593 817
shaders not translated 81 101
compute pipelines refused by the host 48 0
  • Of the 48 compute programs refused on main, 44 translate and get pipelines here.
  • 3 of the 48 are now refused by the translator: "console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves is not supported". The last one was not reached in this run.
  • No program that translated on main stopped translating here, except those 3. The extra "not translated" are programs this run reached and main's run did not.

World entry with VICTORY_D3D12_DEBUG=1 and VICTORY_D3D12_DRED=1: it still ends in a device removal, but nothing points at this PR.

  • On this PR alone, the debug layer reports the buffer-state bug of #548 / #264. It lists 18 IASetVertexBuffers on a title buffer left in UNORDERED_ACCESS, and 44 barriers whose before state does not match. The removal comes at a compute dispatch whose shaders also translate and run on main.
  • With #334 (head c99e429) applied on top, both counts drop to 0. The run then ends in DXGI_ERROR_DEVICE_HUNG in the world, at 0.4–1.3 fps. This matches #71 and #778 (wave64 mesh programs on NVIDIA); I have not narrowed it further.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠jebaczydow** on GitHub · 2026-11-24 13:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7133172944) **Title run on an NVIDIA RTX 5070 Ti (32-lane waves), Windows 11, head `c153b21`** Baseline: `main` at `ffe310e`. Both builds carried one local change, unrelated to this PR: textures the host refuses with unordered access are retried without it. **Tests:** `cargo test --workspace --locked` on the 5070 Ti: 378 passed, 0 failed, 6 ignored. **Title, same scripted run on both builds** (diagnostics build, `VICTORY_KEYS=15:Enter,25:Enter,35:Enter,50:Enter`, 80 s; it reaches the world): | | `main` `ffe310e` | this PR `c153b21` | |---|---|---| | shaders translated | 593 | 817 | | shaders not translated | 81 | 101 | | compute pipelines refused by the host | 48 | **0** | - Of the 48 compute programs refused on `main`, 44 translate and get pipelines here. - 3 of the 48 are now refused by the translator: "console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves is not supported". The last one was not reached in this run. - No program that translated on `main` stopped translating here, except those 3. The extra "not translated" are programs this run reached and `main`'s run did not. **World entry with `VICTORY_D3D12_DEBUG=1` and `VICTORY_D3D12_DRED=1`:** it still ends in a device removal, but nothing points at this PR. - On this PR alone, the debug layer reports the buffer-state bug of #548 / #264. It lists 18 `IASetVertexBuffers` on a title buffer left in `UNORDERED_ACCESS`, and 44 barriers whose before state does not match. The removal comes at a compute dispatch whose shaders also translate and run on `main`. - With #334 (head `c99e429`) applied on top, both counts drop to 0. The run then ends in `DXGI_ERROR_DEVICE_HUNG` in the world, at 0.4–1.3 fps. This matches #71 and #778 (wave64 mesh programs on NVIDIA); I have not narrowed it further. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 14:02 UTC · original

A console-flow defect found by @⁠MartinIndra02 is fixed in the stack (r4tedx/VIctory#9; their commit is carried with authorship as 2466184 on #233 and merged up).

The defect: s_*_saveexec writes the EXEC it replaces to a scalar and sets SCC from the new EXEC. The console flow took the SCC from the first scalar the instruction writes, which is the saved one. An s_cbranch_scc0/1 after it then branched on the old EXEC.

Reproduced here before taking it, at c153b21 on an RTX 5070 (console flow in two 32-lane waves):

test without the fix with it
their test: a branch that s_and_saveexec empties must be skipped body ran (60 where 42 is expected) exact
mine, added in #320: a loop that leaves on that SCC, lane t staying t + 1 iterations 65 iterations of the wave 64, exact

Both are also exact on a Radeon iGPU (64-lane waves). So in a loop the old code ran one more iteration with no lane in it; that is wrong for scalars set inside, but it is not an endless loop.

PR head now was
#233 1a8a3ed d1fecaa
#320 e4246fd 0fa6af4
#439 1e17e57 c153b21

Pushed as fast-forwards, nothing rewritten. At each head both CI clippy commands are clean and cargo test --workspace --locked passes on the RTX 5070 + Radeon iGPU (357 / 361 / 380 passed, 0 failed, 6 ignored).

What it changes for the title (local title data, one offline CPU-only victory translate --host-lanes 32-32 --validate over the shader pack, before and after; counts only):

  • Emitted and validated counts are identical (compute 1,420 emitted, 1,385 validated; 1,464 / 1,429 for a 32-64 host). No program gained or lost.
  • The 86 compute programs that stopped with an SCC the emitter did not compute now name what actually stopped them: 68 a descriptor's address or format read as data, 17 a scalar memory read as data, 1 a descriptor chosen by control flow. That is the second half of the same commit, and it answers the "0 → 86" in @⁠supidooo's table.
  • A second pass with a temporary marker found no program in the pack whose console flow reads a saveexec SCC. So this fix should change no title program's output, and it does not explain the hang at 42683eebec081520 that @⁠Ilokaxt and @⁠Sil3ntGam3r reported. That stays open.

One note for anyone comparing counts across heads: compute emitted fell from 1,691 at ef14bf3 to 1,420 at c153b21. main lost 253 compute programs over the same interval to #612 (#736). I have not matched the two lists program by program.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 14:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7133730501) **A console-flow defect found by @⁠MartinIndra02 is fixed in the stack** ([r4tedx/VIctory#9](https://github.com/r4tedx/VIctory/pull/9); their commit is carried with authorship as `2466184` on #233 and merged up). The defect: `s_*_saveexec` writes the EXEC it replaces to a scalar and sets SCC from the *new* EXEC. The console flow took the SCC from the first scalar the instruction writes, which is the saved one. An `s_cbranch_scc0/1` after it then branched on the old EXEC. Reproduced here before taking it, at `c153b21` on an RTX 5070 (console flow in two 32-lane waves): | test | without the fix | with it | |---|---|---| | their test: a branch that `s_and_saveexec` empties must be skipped | body ran (60 where 42 is expected) | exact | | mine, added in #320: a loop that leaves on that SCC, lane t staying t + 1 iterations | 65 iterations of the wave | 64, exact | Both are also exact on a Radeon iGPU (64-lane waves). So in a loop the old code ran one more iteration with no lane in it; that is wrong for scalars set inside, but it is not an endless loop. | PR | head now | was | |---|---|---| | #233 | `1a8a3ed` | `d1fecaa` | | #320 | `e4246fd` | `0fa6af4` | | #439 | `1e17e57` | `c153b21` | Pushed as fast-forwards, nothing rewritten. At each head both CI clippy commands are clean and `cargo test --workspace --locked` passes on the RTX 5070 + Radeon iGPU (357 / 361 / 380 passed, 0 failed, 6 ignored). **What it changes for the title** (local title data, one offline CPU-only `victory translate --host-lanes 32-32 --validate` over the shader pack, before and after; counts only): - Emitted and validated counts are identical (compute 1,420 emitted, 1,385 validated; 1,464 / 1,429 for a 32-64 host). No program gained or lost. - The 86 compute programs that stopped with `an SCC the emitter did not compute` now name what actually stopped them: 68 `a descriptor's address or format read as data`, 17 `a scalar memory read as data`, 1 `a descriptor chosen by control flow`. That is the second half of the same commit, and it answers the "0 → 86" in @⁠supidooo's table. - A second pass with a temporary marker found **no** program in the pack whose console flow reads a saveexec SCC. So this fix should change no title program's output, and it does **not** explain the hang at `42683eebec081520` that @⁠Ilokaxt and @⁠Sil3ntGam3r reported. That stays open. One note for anyone comparing counts across heads: compute emitted fell from 1,691 at `ef14bf3` to 1,420 at `c153b21`. `main` lost 253 compute programs over the same interval to #612 (#736). I have not matched the two lists program by program. AI-assisted (Claude Code).
Author
Owner

@⁠timorjay on GitHub · 2026-11-24 13:37 UTC · original · edited 2026-11-24 14:02 UTC

Tested on Windows with an RTX 5090 D v2 (driver 32.0.16.1742, wave range 32–32) and integrated AMD Radeon Graphics (32.0.21036.18, wave range 32–64).

I added a self-contained regression test on top of c153b21. It uses hand-assembled synthetic input. Two nested EXEC masks guard a workgroup minimum and a bitmask recording which halves participated. Every lane reads both values after reconvergence. The eight cases include only lane 8, only lane 40, lanes 31 and 32 together, a full group, and empty masks. Each case dispatches two 64-thread groups with different element IDs. All 1,024 readbacks per GPU matched the CPU reference on the clean PR head plus this test. In a separate instrumented run the translator selected wave32 on NVIDIA and wave64 on AMD, with the same results.

To reproduce on a Windows D3D12 host, apply the linked commit to this PR and run cargo test --offline --locked -p victory-shader --features host --lib nested_exec_masks_keep_shared_visibility_results_across_halves -- --nocapture. The output names the adapters and reports 128 lane results per case.

Separately, I checked the same four 1.0.2.1 instance-culling compute programs on the RTX in three builds based on ffe310e with #160 and #578:

Additional changes Result for the four programs
#704 All four passed the Microsoft DXIL validator with a 64-lane requirement. D3D12 refused all four pipelines on this 32-lane adapter.
#704 + #233 Translation stopped for all four.
#704 + this PR (c153b21, includes #233) All four emitted a 32-lane requirement, passed the validator, and created D3D12 compute pipelines. Three meshlet control pipelines also succeeded.

The prop programs were fdd56d97a806bcca and 17af15c4015cb4b6 (no LDS). The tree programs were 55679a0547649d0b and 89d08e561897d4e5 (512 bytes of LDS, including ds_min_u32, ds_or_b32, ds_read2_b32, and ds_write2_b32). The standalone game-program check ended at pipeline creation. The readback comparison above used the synthetic test only.

Title follow-up on the same RTX: In a separate offline run with #160, #578, #704 and this PR, the title bound all four at world entry (frame 3363), and the runtime logged successful translation for each. The distant-imposter transform e30970f1727063fd also translated. Normal presentation showed the Vice City title card and dialogue subtitles on a black background. The game reported DXGI_ERROR_DEVICE_HUNG roughly 58 seconds after those first binds. I did not observe a controllable character or establish which GPU operation caused the failure. The two native-wave32 BVH programs 3b90165a77d95cdf and f6e47efa50226beb still failed address translation on that build, consistent with the separate work tracked in #293.

Codex assisted with the test, measurements, and write-up.

**@⁠timorjay** on GitHub · 2026-11-24 13:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7133106778) · edited 2026-11-24 14:02 UTC Tested on Windows with an RTX 5090 D v2 (driver 32.0.16.1742, wave range 32–32) and integrated AMD Radeon Graphics (32.0.21036.18, wave range 32–64). I added [a self-contained regression test on top of `c153b21`](https://github.com/timorjay/VIctory/commit/0cf37ac6422b713eaafebda9b9cafc2571246c02). It uses hand-assembled synthetic input. Two nested EXEC masks guard a workgroup minimum and a bitmask recording which halves participated. Every lane reads both values after reconvergence. The eight cases include only lane 8, only lane 40, lanes 31 and 32 together, a full group, and empty masks. Each case dispatches two 64-thread groups with different element IDs. **All 1,024 readbacks per GPU matched the CPU reference** on the clean PR head plus this test. In a separate instrumented run the translator selected wave32 on NVIDIA and wave64 on AMD, with the same results. To reproduce on a Windows D3D12 host, apply the linked commit to this PR and run `cargo test --offline --locked -p victory-shader --features host --lib nested_exec_masks_keep_shared_visibility_results_across_halves -- --nocapture`. The output names the adapters and reports 128 lane results per case. Separately, I checked the same four 1.0.2.1 instance-culling compute programs on the RTX in three builds based on `ffe310e` with #160 and #578: | Additional changes | Result for the four programs | | --- | --- | | #704 | All four passed the Microsoft DXIL validator with a 64-lane requirement. D3D12 refused all four pipelines on this 32-lane adapter. | | #704 + #233 | Translation stopped for all four. | | #704 + this PR (`c153b21`, includes #233) | All four emitted a 32-lane requirement, passed the validator, and created D3D12 compute pipelines. Three meshlet control pipelines also succeeded. | The prop programs were `fdd56d97a806bcca` and `17af15c4015cb4b6` (no LDS). The tree programs were `55679a0547649d0b` and `89d08e561897d4e5` (512 bytes of LDS, including `ds_min_u32`, `ds_or_b32`, `ds_read2_b32`, and `ds_write2_b32`). The standalone game-program check ended at pipeline creation. The readback comparison above used the synthetic test only. **Title follow-up on the same RTX:** In a separate offline run with #160, #578, #704 and this PR, the title bound all four at world entry (frame 3363), and the runtime logged successful translation for each. The distant-imposter transform `e30970f1727063fd` also translated. Normal presentation showed the Vice City title card and dialogue subtitles on a black background. The game reported `DXGI_ERROR_DEVICE_HUNG` roughly 58 seconds after those first binds. I did not observe a controllable character or establish which GPU operation caused the failure. The two native-wave32 BVH programs `3b90165a77d95cdf` and `f6e47efa50226beb` still failed address translation on that build, consistent with the separate work tracked in #293. Codex assisted with the test, measurements, and write-up.
Author
Owner

@⁠Sil3ntGam3r on GitHub · 2026-11-24 14:11 UTC · original

RTX 3070 8 GB, driver 621.14, Windows 11 (26300): this PR at c153b21 + #180 aa69258 on main ffe310e, with #89 #493 #483 #206 #469 #454 #704 #688 #352 #346 #489 #709 (with #294) #650 #571 and #334 c99e429, plus MIN_DYNAMIC = 1 << 18 (#747). Diag build, DRED, loop limit 32. #334's buffer-state tracking also needed adding to #346's rectangle expansion (expand binds the title's argument, count and vertex copies as UAVs) and to #294's root views; all 421 tests pass.

  • No device removal: about 10 min from launch into the world, stopped by me. My earlier runs of this stack on this card ended in 0x887A0001 at about 7 min and at 1m18s, so @⁠jebaczydow's finding that #334 removes the buffer-state errors behind that crash holds here too.
  • 97 unique programs not translated, 0 host pipelines refused. A #189-based build on the same machine and scene: 459 / 0.
  • The four instance-culling programs @⁠timorjay lists all translate and get host pipelines (fdd56d97a806bcca, 17af15c4015cb4b6, 55679a0547649d0b, 89d08e561897d4e5), but the title never binds them in this run: no first bind up to frame 3062. In the #189-based run the title bound all four at frame 2211, just before the world. So something earlier takes a different path here; I haven't found what.
  • Very slow in the world: 14–21 s per frame, 4.5–8.5 s of it copying title memory (about 1–2 s per frame in the #189-based build).
  • On screen it's still the characters only (debug view of the albedo target), with no props or buildings.

(AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 14:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7133993065) RTX 3070 8 GB, driver 621.14, Windows 11 (26300): this PR at `c153b21` + #180 `aa69258` on main `ffe310e`, with #89 #493 #483 #206 #469 #454 #704 #688 #352 #346 #489 #709 (with #294) #650 #571 and **#334** `c99e429`, plus `MIN_DYNAMIC = 1 << 18` (#747). Diag build, DRED, loop limit 32. #334's buffer-state tracking also needed adding to #346's rectangle expansion (`expand` binds the title's argument, count and vertex copies as UAVs) and to #294's root views; all 421 tests pass. - **No device removal:** about 10 min from launch into the world, stopped by me. My earlier runs of this stack on this card ended in `0x887A0001` at about 7 min and at 1m18s, so @⁠jebaczydow's finding that #334 removes the buffer-state errors behind that crash holds here too. - 97 unique programs not translated, 0 host pipelines refused. A #189-based build on the same machine and scene: 459 / 0. - The four instance-culling programs @⁠timorjay lists all translate and get host pipelines (`fdd56d97a806bcca`, `17af15c4015cb4b6`, `55679a0547649d0b`, `89d08e561897d4e5`), **but the title never binds them in this run**: no first bind up to frame 3062. In the #189-based run the title bound all four at frame 2211, just before the world. So something earlier takes a different path here; I haven't found what. - Very slow in the world: 14–21 s per frame, 4.5–8.5 s of it copying title memory (about 1–2 s per frame in the #189-based build). - On screen it's still the characters only (debug view of the albedo target), with no props or buildings. (AI-assisted test run.)
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 14:21 UTC · original

@⁠Sil3ntGam3r, thank you. Ten minutes in the world without a removal on the card that removed twice before is the result to keep, and it agrees with @⁠jebaczydow's run: with #334 the buffer-state errors are gone.

Two things in your report I can narrow from here without a title run (no title launch on this machine):

"The title never binds them". Frame numbers do not compare across stacks. @⁠timorjay's run (#160 + #578 + #704 + this PR on ffe310e) saw the first bind of all four at world entry, frame 3363, which is later than where your run stopped looking (3062). So it may be a cutoff and not a different path. What would tell them apart: the frame of your world entry, and whether any bind of the four shows if the run goes past it by a few hundred frames. If the world was already up well before 3062 and they are still unbound, the next thing to look at is what the title runs just before them in the #189 build that it does not run here.

The copy time (4.5–8.5 s of a 14–21 s frame). That is CPU time copying title memory, and this PR does not touch that path. Outside the shader crate the whole stack changes three files in victory-gpu (host.rs: the adapter's wave range; pipeline.rs: passes it to the translator; shader_cache.rs: keys the cache by it). Checked with git diff main..1e17e57 -- crates/victory-gpu. So the difference from your #189 build is more likely in what this stack has and that one did not: #334 with your additions for #346's expand and #294's root views, #704's raw views, or MIN_DYNAMIC. The copy line per frame with #334's tracking off, or with only your two additions removed, would say which. What this PR can add to a frame is GPU time: more compute programs now run, and the ones in the console flow wait at group barriers.

The title was not used in these tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 14:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7134230528) @⁠Sil3ntGam3r, thank you. Ten minutes in the world without a removal on the card that removed twice before is the result to keep, and it agrees with @⁠jebaczydow's run: with #334 the buffer-state errors are gone. Two things in your report I can narrow from here without a title run (no title launch on this machine): **"The title never binds them".** Frame numbers do not compare across stacks. @⁠timorjay's run (#160 + #578 + #704 + this PR on `ffe310e`) saw the first bind of all four at world entry, frame 3363, which is later than where your run stopped looking (3062). So it may be a cutoff and not a different path. What would tell them apart: the frame of your world entry, and whether any bind of the four shows if the run goes past it by a few hundred frames. If the world was already up well before 3062 and they are still unbound, the next thing to look at is what the title runs just before them in the #189 build that it does not run here. **The copy time (4.5–8.5 s of a 14–21 s frame).** That is CPU time copying title memory, and this PR does not touch that path. Outside the shader crate the whole stack changes three files in `victory-gpu` (`host.rs`: the adapter's wave range; `pipeline.rs`: passes it to the translator; `shader_cache.rs`: keys the cache by it). Checked with `git diff main..1e17e57 -- crates/victory-gpu`. So the difference from your #189 build is more likely in what this stack has and that one did not: #334 with your additions for #346's `expand` and #294's root views, #704's raw views, or `MIN_DYNAMIC`. The copy line per frame with #334's tracking off, or with only your two additions removed, would say which. What this PR can add to a frame is GPU time: more compute programs now run, and the ones in the console flow wait at group barriers. The title was not used in these tests. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 14:54 UTC · original

A second fix in the stack: the console flow no longer lowers a descriptor chosen per lane by control flow.

Since #566 is in main, a descriptor each lane holds by the path it took is lowered as a DXIL phi over the edges into the join. In the console flow every lane reaches a join by the edge the wave took, so that phi gave every lane the same descriptor, without any error. The contribution work on the testers' branch found it, where #566 and the console flow first met.

Reproduced here on the stack before fixing it: #566's joined if/else program (lanes 0-15 load one texture, lanes 16-31 another), lowered in the console flow at 1a8a3ed on an RTX 5070, sampled the second texture in all 32 lanes. The module passes dxil.dll.

The fix (b623fd3, on #233): the console flow stops there with a per-lane descriptor chosen by control flow in the console flow. A program that takes the console flow only for its lane reads keeps the per-lane form (test in #320, cbcef55: it asks for the console flow, is refused there, and emits per lane for any host, a 32-lane host and a 32-64 one, each module validated). A program that needs the console flow for the host's wave size stops with the reason instead of running with the wrong texture or buffer.

PR head now was
#233 b623fd3 1a8a3ed
#320 cbcef55 e4246fd
#439 bf0f951 1e17e57

Fast-forward pushes again. Both CI clippy commands are clean at each head. cargo test --workspace --locked on the RTX 5070 + Radeon iGPU: 363 passed at #320's head; at #233's and #439's heads 357 and 381 passed with one failure, frame::tests::waits_end_on_ticks_and_count_frames, which this stack does not touch and which passes when run alone (this machine was at 100% CPU from other work). CI on the three heads is green.

Not measured yet: how many title programs this moves from emitted to refused on a 32-lane host. Testers' counts at these heads would show it as a new line with that reason; each such program was one that ran with a wrong descriptor before.

The title was not used in these tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 14:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7135154585) **A second fix in the stack: the console flow no longer lowers a descriptor chosen per lane by control flow.** Since #566 is in `main`, a descriptor each lane holds by the path it took is lowered as a DXIL phi over the edges into the join. In the console flow every lane reaches a join by the edge the *wave* took, so that phi gave every lane the same descriptor, without any error. The contribution work on the testers' branch found it, where #566 and the console flow first met. Reproduced here on the stack before fixing it: #566's joined if/else program (lanes 0-15 load one texture, lanes 16-31 another), lowered in the console flow at `1a8a3ed` on an RTX 5070, sampled the second texture in all 32 lanes. The module passes `dxil.dll`. The fix (`b623fd3`, on #233): the console flow stops there with `a per-lane descriptor chosen by control flow in the console flow`. A program that takes the console flow only for its lane reads keeps the per-lane form (test in #320, `cbcef55`: it asks for the console flow, is refused there, and emits per lane for any host, a 32-lane host and a 32-64 one, each module validated). A program that needs the console flow for the host's wave size stops with the reason instead of running with the wrong texture or buffer. | PR | head now | was | |---|---|---| | #233 | `b623fd3` | `1a8a3ed` | | #320 | `cbcef55` | `e4246fd` | | #439 | `bf0f951` | `1e17e57` | Fast-forward pushes again. Both CI clippy commands are clean at each head. `cargo test --workspace --locked` on the RTX 5070 + Radeon iGPU: 363 passed at #320's head; at #233's and #439's heads 357 and 381 passed with one failure, `frame::tests::waits_end_on_ticks_and_count_frames`, which this stack does not touch and which passes when run alone (this machine was at 100% CPU from other work). CI on the three heads is green. Not measured yet: how many title programs this moves from emitted to refused on a 32-lane host. Testers' counts at these heads would show it as a new line with that reason; each such program was one that ran with a wrong descriptor before. The title was not used in these tests. AI-assisted (Claude Code).
Author
Owner

@⁠Sil3ntGam3r on GitHub · 2026-11-24 15:05 UTC · original

RTX 3070 8 GB, driver 621.14, Windows 11 (26300): this PR at bf0f951 + #180 aa69258 on main ffe310e, with #89 #493 #483 #206 #469 #454 #704 #688 #352 #346 #489 #709 (with #294) #650 #571 #334 c99e429, #431 23ced70 and #876's change (b7a0a8c), plus MIN_DYNAMIC = 1 << 18 (#747). Diag build, DRED, loop limit 32. All 429 tests pass.

  • The binds were a cutoff, as you thought. World entry was at frame 2221 in this run, and 2033 in the run before it (same stack, before bf0f951). All four instance-culling programs got their first bind right there in both runs.

  • The new refusal: no program was refused with "a per-lane descriptor chosen by control flow in the console flow", up to frame 2231.

    • 102 unique programs are not translated. The largest groups:
      • a lane mask read as data: 27
      • an address not from a root parameter: 14
      • a scalar memory read as data: 10
      • an address from a root parameter that is no address: 8
      • a 64-bit image atomic: 8
    • 17 of those are mesh shaders: 11 lane mask read as data, 3 a descriptor read from the first lane of computed VGPRs, and 2 scalar memory reads as data.
  • With the culling programs running, scenery reaches the G-buffer for the first time on this card. In the full-screen targets dumped at frame 2224 I can see:

    • picnic tables and benches in the foreground;
    • poles with power lines, lamp posts and a fence or hedge line;
    • people and small props on the horizon.

    More had streamed in eight frames later (2232): a second power line, hanging signs, a fenced area with posts, more lamp posts, a chair and a bin. Terrain, roads and buildings are still missing in both frames, and everything else in those targets is black. In my #189-based build only characters reached these targets. The presented image is still white inside the letterbox.

  • Copy time: your reading holds; it isn't this PR's GPU time. The per-frame copy stats after world entry, compared with my #189-based run without the console flow (frame 1410):

    this stack #189-based
    page faults per frame 2.0–2.2 million 30 thousand
    watches 4.6–6.1 s, 11.8–12.6 GB checked (about 97–98% unchanged) 0.66 s, 5.7 GB checked
    refreshes 9.6–11.3 GB 4.5 GB

    Frames take 10–40 s, with the CPU at 99% and the GPU near idle, and the process grew to about 19 GB (32 GB machine). I haven't separated how much of this comes from #334's tracking and how much from the extra compute that now runs. A run with #334's tracking off is the next thing to try.

  • Stable: about 7 minutes in the world (frames 2221 to 2234) with no device removal and no title int3. I stopped it because memory was at 88%.

(AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 15:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7135451943) RTX 3070 8 GB, driver 621.14, Windows 11 (26300): this PR at `bf0f951` + #180 `aa69258` on main `ffe310e`, with #89 #493 #483 #206 #469 #454 #704 #688 #352 #346 #489 #709 (with #294) #650 #571 #334 `c99e429`, #431 `23ced70` and #876's change (`b7a0a8c`), plus `MIN_DYNAMIC = 1 << 18` (#747). Diag build, DRED, loop limit 32. All 429 tests pass. - **The binds were a cutoff, as you thought.** World entry was at frame 2221 in this run, and 2033 in the run before it (same stack, before `bf0f951`). All four instance-culling programs got their first bind right there in both runs. - **The new refusal:** no program was refused with "a per-lane descriptor chosen by control flow in the console flow", up to frame 2231. - 102 unique programs are not translated. The largest groups: - a lane mask read as data: 27 - an address not from a root parameter: 14 - a scalar memory read as data: 10 - an address from a root parameter that is no address: 8 - a 64-bit image atomic: 8 - 17 of those are mesh shaders: 11 lane mask read as data, 3 a descriptor read from the first lane of computed VGPRs, and 2 scalar memory reads as data. - **With the culling programs running, scenery reaches the G-buffer for the first time on this card.** In the full-screen targets dumped at frame 2224 I can see: - picnic tables and benches in the foreground; - poles with power lines, lamp posts and a fence or hedge line; - people and small props on the horizon. More had streamed in eight frames later (2232): a second power line, hanging signs, a fenced area with posts, more lamp posts, a chair and a bin. Terrain, roads and buildings are still missing in both frames, and everything else in those targets is black. In my #189-based build only characters reached these targets. The presented image is still white inside the letterbox. - **Copy time:** your reading holds; it isn't this PR's GPU time. The per-frame copy stats after world entry, compared with my #189-based run without the console flow (frame 1410): | | this stack | #189-based | |---|---|---| | page faults per frame | 2.0–2.2 million | 30 thousand | | watches | 4.6–6.1 s, 11.8–12.6 GB checked (about 97–98% unchanged) | 0.66 s, 5.7 GB checked | | refreshes | 9.6–11.3 GB | 4.5 GB | Frames take 10–40 s, with the CPU at 99% and the GPU near idle, and the process grew to about 19 GB (32 GB machine). I haven't separated how much of this comes from #334's tracking and how much from the extra compute that now runs. A run with #334's tracking off is the next thing to try. - Stable: about 7 minutes in the world (frames 2221 to 2234) with no device removal and no title int3. I stopped it because memory was at 88%. (AI-assisted test run.)
Author
Owner

@⁠Sil3ntGam3r on GitHub · 2026-11-24 15:30 UTC · original

Follow-up on the copy time, same build as my comment above (RTX 3070). I added a local, diagnostics-only switch that makes #334's buffer_state return early, so no buffer is tracked and no buffer barrier is recorded. It was otherwise the same run. Per frame after world entry:

#334 tracking on #334 tracking off
page faults 2.0–2.2 million 1.85–2.05 million
watches 4.6–6.1 s, 11.8–12.6 GB checked 3.0–5.7 s, 10.3–10.9 GB checked
refreshes 9.6–11.3 GB 8.9–9.4 GB
frame time 10–40 s 12–44 s

So #334's tracking isn't the copy cost; the differences are within frame-to-frame noise. The time goes into the memory watches. In my #189-based run, where the four culling programs are refused, they cost about 30 thousand page faults and 0.66 s per frame, so the cost grows with the work that now runs once those programs do.

With the tracking off, the run went about 5 minutes in the world with no device removal. Before #334, this stack was removed at about 7 minutes on this card, so this run doesn't settle whether #334 is still needed for that. I stopped it when the machine was down to 1.3 GB of free memory (the process was at about 18.6 GB of 32 GB).

(AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 15:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7136145966) Follow-up on the copy time, same build as my comment above (RTX 3070). I added a local, diagnostics-only switch that makes #334's `buffer_state` return early, so no buffer is tracked and no buffer barrier is recorded. It was otherwise the same run. Per frame after world entry: | | #334 tracking on | #334 tracking off | |---|---|---| | page faults | 2.0–2.2 million | 1.85–2.05 million | | watches | 4.6–6.1 s, 11.8–12.6 GB checked | 3.0–5.7 s, 10.3–10.9 GB checked | | refreshes | 9.6–11.3 GB | 8.9–9.4 GB | | frame time | 10–40 s | 12–44 s | So #334's tracking isn't the copy cost; the differences are within frame-to-frame noise. The time goes into the memory watches. In my #189-based run, where the four culling programs are refused, they cost about 30 thousand page faults and 0.66 s per frame, so the cost grows with the work that now runs once those programs do. With the tracking off, the run went about 5 minutes in the world with no device removal. Before #334, this stack was removed at about 7 minutes on this card, so this run doesn't settle whether #334 is still needed for that. I stopped it when the machine was down to 1.3 GB of free memory (the process was at about 18.6 GB of 32 GB). (AI-assisted test run.)
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 15:33 UTC · original

@⁠jebaczydow, @⁠timorjay, thank you both; two short answers, and @⁠sash2kk's report is next (I am reproducing it against the main this head contains before answering).

@⁠jebaczydow (RTX 5070 Ti, c153b21): 48 compute pipelines refused on main, 0 here, and nothing that translated on main lost except the three with console wave64 lanes in a group of more than 64 threads. Those three are the known remainder of this PR. The fork branch shader/wave-per-group runs such a group as one host group per console wave when it has no LDS and no s_barrier (direct dispatches only so far); an offline count over the pack puts it at 23 of the 43 programs with that reason leaving it, 20 of them validating. It is not in this PR, which stays as it is for review. Your debug-layer finding (18 IASetVertexBuffers on a buffer left in UNORDERED_ACCESS, 44 mismatched barriers, both 0 with #334) matches @⁠Sil3ntGam3r's runs on an RTX 3070, where the removal went away with #334. Neither comes from this PR's code: outside the shader crate it changes only how the adapter's wave range reaches the translator and the cache key.

@⁠timorjay (RTX 5090 D and Radeon, c153b21): the nested-mask test is the kind of case the stack has too few of: two nested EXEC masks, a workgroup minimum and a participation bitmask read by every lane after reconvergence, with only lane 8, only lane 40, and lanes 31 and 32 together. I will run your commit 0cf37ac here on the RTX 5070 and the Radeon iGPU at the current head and, if it is exact on both, carry it with your authorship. Your four instance-culling programs (two of them with LDS) getting pipelines only with this PR, and binding at world entry, is the first title result for the LDS path; @⁠Sil3ntGam3r has since seen scenery reach the G-buffer on an RTX 3070 with those programs running.

Heads since your runs: #233 b623fd3, #320 cbcef55, #439 bf0f951 (two fixes, described above in this thread). Offline, over the pack, neither changes any program's outcome for a 32-lane or a 32-64 host (compute 1,420 emitted / 1,385 validated and 1,464 / 1,429), and no program hits the new descriptor-join refusal. That count used local title data, CPU only, counts only.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 15:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7136226740) @⁠jebaczydow, @⁠timorjay, thank you both; two short answers, and @⁠sash2kk's report is next (I am reproducing it against the `main` this head contains before answering). **@⁠jebaczydow** (RTX 5070 Ti, `c153b21`): 48 compute pipelines refused on `main`, 0 here, and nothing that translated on `main` lost except the three with `console wave64 lanes in a group of more than 64 threads`. Those three are the known remainder of this PR. The fork branch [`shader/wave-per-group`](https://github.com/r4tedx/VIctory/tree/shader/wave-per-group) runs such a group as one host group per console wave when it has no LDS and no `s_barrier` (direct dispatches only so far); an offline count over the pack puts it at 23 of the 43 programs with that reason leaving it, 20 of them validating. It is not in this PR, which stays as it is for review. Your debug-layer finding (18 `IASetVertexBuffers` on a buffer left in `UNORDERED_ACCESS`, 44 mismatched barriers, both 0 with #334) matches @⁠Sil3ntGam3r's runs on an RTX 3070, where the removal went away with #334. Neither comes from this PR's code: outside the shader crate it changes only how the adapter's wave range reaches the translator and the cache key. **@⁠timorjay** (RTX 5090 D and Radeon, `c153b21`): the nested-mask test is the kind of case the stack has too few of: two nested EXEC masks, a workgroup minimum and a participation bitmask read by every lane after reconvergence, with only lane 8, only lane 40, and lanes 31 and 32 together. I will run your commit `0cf37ac` here on the RTX 5070 and the Radeon iGPU at the current head and, if it is exact on both, carry it with your authorship. Your four instance-culling programs (two of them with LDS) getting pipelines only with this PR, and binding at world entry, is the first title result for the LDS path; @⁠Sil3ntGam3r has since seen scenery reach the G-buffer on an RTX 3070 with those programs running. Heads since your runs: #233 `b623fd3`, #320 `cbcef55`, #439 `bf0f951` (two fixes, described above in this thread). Offline, over the pack, neither changes any program's outcome for a 32-lane or a 32-64 host (compute 1,420 emitted / 1,385 validated and 1,464 / 1,429), and no program hits the new descriptor-join refusal. That count used local title data, CPU only, counts only. AI-assisted (Claude Code).
Author
Owner

@⁠yuruiwang233 on GitHub · 2026-11-24 15:34 UTC · original

Independent run on a 32-lane laptop and a 64-lane iGPU in one machine, with a DXIL validator loaded

Not the author. I applied the whole stack as one diff on main ffe310e (16 files; applies cleanly), since this PR's diff contains #223, #233 and #320.

Machine: Windows 11 26300, Ryzen 9 7940HX, RTX 4060 Laptop GPU (D3D12 wave range 32..32, driver 32.0.16.1714) plus a Radeon 610M iGPU (32..64, driver 32.0.11002.41). That is the same paired-adapter setup you used with the 5070, so the differential form runs as designed: the NVIDIA takes the split / console flow, the Radeon is the native 64-lane reference.

Results (Rust 1.98.1, x86_64-pc-windows-gnu with MinGW; not MSVC, so this is not CI parity):

  • cargo test -p victory-shader --lib: 159 passed, 0 failed, 1 ignored.
  • cargo test -p victory-gpu --lib: 51 passed, 1 ignored, on a real D3D12 device.
  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • All 30 emit::split_tests pass when run serially: 106 split (NVIDIA) and 53 native (Radeon) lane-by-lane comparisons were exact. The thread relabelling (console_flat) is exact on this driver for groups of 32, 64 and 128 threads and for 4x4x4, 8x8x2, 2x4x8, 16x2x4, 8x8x4 and 4x8x8.

With a real validator loaded. I installed DXC's validator from the Microsoft.Direct3D.DXC NuGet package (dxil.dll 1.8.2505.32, and 1.7.2212.48 as a second check; both export DxcCreateInstance) and pointed VICTORY_DXIL at it. With the validator active, all 30 split tests still pass, so every module these tests emit validates before it is dispatched. None of them emits sample in a compute shader, so this says nothing about the #201 class either way (1.7 accepts them too).

The per-access LDS barrier is required on this driver, not only on the 5070. I disabled the barrier in the LDS path (lower.rs, the console_cf && split && threads > 32 branch) and ran the LDS tests three times: both lds_written_and_read_in_different_masked_blocks and lds_order_holds_when_one_half_is_busy fail every run on the 4060, with exactly the symptom in your note (the lower half reads 0 for lanes 0..31). Your note says only the first of the two needs the barrier on a 5070; on 32.0.16.1714 both catch it, so this driver is at least as strict about the ordering. With the barrier restored both are exact on both adapters.

#189 on the same machine, for comparison. It applies cleanly on ffe310e; cargo test -p victory-shader --lib gives 144 passed, and its 23 wave64_tests pass on the 4060 (both Wave32 and Emulate) and on WARP, with the validator loaded. Both stacks are green here, so this does not choose between them; the choice still rests on coverage and on the multi-wave / multi-console-wave cases.

Not verified by me: no game files, so no run of the title and no victory translate --host-lanes 32-32 census; nothing here says anything about world rendering, and I did not measure how the title's own programs lower. The vertex, pixel and mesh paths are untouched by this PR but are only covered by the existing tests.

**@⁠yuruiwang233** on GitHub · 2026-11-24 15:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7136262685) **Independent run on a 32-lane laptop and a 64-lane iGPU in one machine, with a DXIL validator loaded** Not the author. I applied the whole stack as one diff on `main` `ffe310e` (16 files; applies cleanly), since this PR's diff contains #223, #233 and #320. Machine: Windows 11 26300, Ryzen 9 7940HX, **RTX 4060 Laptop GPU** (D3D12 wave range 32..32, driver 32.0.16.1714) plus a **Radeon 610M** iGPU (32..64, driver 32.0.11002.41). That is the same paired-adapter setup you used with the 5070, so the differential form runs as designed: the NVIDIA takes the split / console flow, the Radeon is the native 64-lane reference. Results (Rust 1.98.1, `x86_64-pc-windows-gnu` with MinGW; **not** MSVC, so this is not CI parity): - `cargo test -p victory-shader --lib`: 159 passed, 0 failed, 1 ignored. - `cargo test -p victory-gpu --lib`: 51 passed, 1 ignored, on a real D3D12 device. - `cargo clippy --workspace --all-targets -- -D warnings`: clean. - All 30 `emit::split_tests` pass when run serially: 106 split (NVIDIA) and 53 native (Radeon) lane-by-lane comparisons were exact. The thread relabelling (`console_flat`) is exact on this driver for groups of 32, 64 and 128 threads and for 4x4x4, 8x8x2, 2x4x8, 16x2x4, 8x8x4 and 4x8x8. **With a real validator loaded.** I installed DXC's validator from the `Microsoft.Direct3D.DXC` NuGet package (dxil.dll 1.8.2505.32, and 1.7.2212.48 as a second check; both export `DxcCreateInstance`) and pointed `VICTORY_DXIL` at it. With the validator active, all 30 split tests still pass, so every module these tests emit validates before it is dispatched. None of them emits `sample` in a compute shader, so this says nothing about the #201 class either way (1.7 accepts them too). **The per-access LDS barrier is required on this driver, not only on the 5070.** I disabled the barrier in the LDS path (`lower.rs`, the `console_cf && split && threads > 32` branch) and ran the LDS tests three times: both `lds_written_and_read_in_different_masked_blocks` and `lds_order_holds_when_one_half_is_busy` fail every run on the 4060, with exactly the symptom in your note (the lower half reads 0 for lanes 0..31). Your note says only the first of the two needs the barrier on a 5070; on 32.0.16.1714 both catch it, so this driver is at least as strict about the ordering. With the barrier restored both are exact on both adapters. **#189 on the same machine, for comparison.** It applies cleanly on `ffe310e`; `cargo test -p victory-shader --lib` gives 144 passed, and its 23 `wave64_tests` pass on the 4060 (both `Wave32` and `Emulate`) and on WARP, with the validator loaded. Both stacks are green here, so this does not choose between them; the choice still rests on coverage and on the multi-wave / multi-console-wave cases. Not verified by me: no game files, so no run of the title and no `victory translate --host-lanes 32-32` census; nothing here says anything about world rendering, and I did not measure how the title's own programs lower. The vertex, pixel and mesh paths are untouched by this PR but are only covered by the existing tests.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 15:36 UTC · original

@⁠Sil3ntGam3r, on the part of your question that is about #704 (I'm #704's author; the rest of this PR's thread stays with its owner): #704 does not add any watching or copying of title memory. I checked its GPU-side code at 1f3c184:

  • The raw view reuses the existing host copy. When HostHeap makes a structured or typed buffer view, #704 also makes a raw view over the same host buffer: the one the existing path already made for the title's view (note_view → alias(index, &buffer, start, len, …) in descriptor/host.rs). The raw view covers that view's own byte range, starting up to 12 bytes early for 16-byte alignment. It allocates no buffer and registers no watch or refresh.
  • The only other runtime addition is the stride table. draw.rs binds one small upload buffer of two dwords per heap slot as a root SRV. Nothing in it is mirrored from title memory.

So the cost you measured is what the ordinary mirroring costs once the four instance-culling programs run. #704 only lets them translate. Their buffers then go through the same watch and refresh path as any other bound buffer. Your #189-based run (30 thousand faults, 0.66 s per frame) didn't run them, so its copies don't include their bindings. If those programs bind large views (whole instance or heap-sized buffers), each one is watched and refreshed at its full size every frame, which would fit the 9–11 GB per frame you see. #951 (mesh shaders reading through root SRVs megabytes past their copy) and the copy cost measured on gpu/run-time-indexed-views point at the same mirroring path.

What would tell us more from a run you already have: the sizes of the views those four programs bind (in a diagnostics build, the device-removed report names each dispatch's views with their title address and length; victory_gpu::draw=debug logs draws only, not dispatches), and whether the watch total drops when only those four are skipped. I haven't measured this here, and the title was not used for this reply.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 15:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7136308590) @⁠Sil3ntGam3r, on the part of your question that is about #704 (I'm #704's author; the rest of this PR's thread stays with its owner): #704 does not add any watching or copying of title memory. I checked its GPU-side code at `1f3c184`: - **The raw view reuses the existing host copy.** When `HostHeap` makes a structured or typed buffer view, #704 also makes a raw view over the **same host buffer**: the one the existing path already made for the title's view (`note_view` → `alias(index, &buffer, start, len, …)` in `descriptor/host.rs`). The raw view covers that view's own byte range, starting up to 12 bytes early for 16-byte alignment. It allocates no buffer and registers no watch or refresh. - **The only other runtime addition is the stride table.** `draw.rs` binds one small upload buffer of two dwords per heap slot as a root SRV. Nothing in it is mirrored from title memory. So the cost you measured is what the ordinary mirroring costs once the four instance-culling programs run. #704 only lets them translate. Their buffers then go through the same watch and refresh path as any other bound buffer. Your #189-based run (30 thousand faults, 0.66 s per frame) didn't run them, so its copies don't include their bindings. If those programs bind large views (whole instance or heap-sized buffers), each one is watched and refreshed at its full size every frame, which would fit the 9–11 GB per frame you see. #951 (mesh shaders reading through root SRVs megabytes past their copy) and the copy cost measured on `gpu/run-time-indexed-views` point at the same mirroring path. What would tell us more from a run you already have: the sizes of the views those four programs bind (in a diagnostics build, the device-removed report names each dispatch's views with their title address and length; `victory_gpu::draw=debug` logs draws only, not dispatches), and whether the watch total drops when only those four are skipped. I haven't measured this here, and the title was not used for this reply. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 15:51 UTC · original

@⁠sash2kk, thank you for the A/B with the same save and input. I tried to reproduce the 17 + 9 and could not, and I think the control explains them. Here is what I measured, then the question that would settle it.

Offline, program by program (local title data, CPU only, counts only): victory translate --validate --list over the shader pack on main ffe310e, and on this PR at bf0f951 with --host-lanes 32-32; 25,889 listed programs matched by container hash.

compute programs reasons
main emits, this PR refuses for a 32-lane host 40 36 console wave64 lanes in a group of more than 64 threads, 4 a whole-wave section of a wave64
main refuses, this PR emits 19 on main: 9 a lane mask holding lanes elsewhere read as data, 4 a lane-mask join of an untracked mask, 4 an LDS operation, 1 LDS the program does not allocate, 1 a select on an untracked mask
other stages, either direction 0

So in the whole pack there is no program that main translates and this PR stops with a descriptor read only as data or a structured buffer of unknown stride. Looking from the other side: of the 730 compute programs that stop at a descriptor read only as data here, main's translator refuses every one too (305 with the same reason, 220 with a lane mask holding lanes elsewhere read as data, 205 with a select on an untracked mask), and likewise all 195 with unknown stride (138 / 32 / 25). For the last two groups this PR gets past the mask and reaches the next blocker; they are not programs that ran before.

The 40 are real and expected: all of them emit for a 32-64 host, so they need the console's 64-lane wave, which main declares and a 32-lane driver then refuses. Your 20 are part of the 36.

What I think the 17 + 9 are. Your control is main + #578, and #578 refuses a pipeline whose compute program is wave64 before it is translated (it tests the native program, in HostPipeline::new). Those programs then count as refused, not as untranslated. With this PR in the build they are translated, and the ones main's translator cannot lower either now appear in the untranslated list with their reason. That would make them new lines in the log without being programs that worked before. I have not run your merged tree, so this is a reading of #578's description and your numbers (refused / untranslated 1265 / 920 against 1388 / 1576), not a measurement.

What would settle it: the 26 hashes, as you offered. I can look each one up in both listings and say what main alone does with it. If any of them does emit on main and stop here, that is a defect in this PR and I will fix it. The same for the single an SCC the emitter did not compute and an address in an SGPR that is no root parameter: neither reason occurs at bf0f951 in the offline count (the SCC one now names its real cause, see above), so those two hashes would be useful as well.

On the fps (1.38 against 0.75): more compute runs with this PR, and the programs in the console flow wait at group barriers, so some cost is expected; @⁠Sil3ntGam3r's numbers above put most of the frame time in the CPU copy path once the culling programs run.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 15:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7136737803) @⁠sash2kk, thank you for the A/B with the same save and input. I tried to reproduce the 17 + 9 and could not, and I think the control explains them. Here is what I measured, then the question that would settle it. **Offline, program by program** (local title data, CPU only, counts only): `victory translate --validate --list` over the shader pack on `main` `ffe310e`, and on this PR at `bf0f951` with `--host-lanes 32-32`; 25,889 listed programs matched by container hash. | | compute programs | reasons | |---|---|---| | `main` emits, this PR refuses for a 32-lane host | **40** | 36 `console wave64 lanes in a group of more than 64 threads`, 4 `a whole-wave section of a wave64` | | `main` refuses, this PR emits | 19 | on `main`: 9 `a lane mask holding lanes elsewhere read as data`, 4 `a lane-mask join of an untracked mask`, 4 `an LDS operation`, 1 `LDS the program does not allocate`, 1 `a select on an untracked mask` | | other stages, either direction | 0 | | So in the whole pack there is no program that `main` translates and this PR stops with `a descriptor read only as data` or `a structured buffer of unknown stride`. Looking from the other side: of the 730 compute programs that stop at `a descriptor read only as data` here, `main`'s translator refuses every one too (305 with the same reason, 220 with `a lane mask holding lanes elsewhere read as data`, 205 with `a select on an untracked mask`), and likewise all 195 with unknown stride (138 / 32 / 25). For the last two groups this PR gets past the mask and reaches the next blocker; they are not programs that ran before. The 40 are real and expected: all of them emit for a 32-64 host, so they need the console's 64-lane wave, which `main` declares and a 32-lane driver then refuses. Your 20 are part of the 36. **What I think the 17 + 9 are.** Your control is `main` + #578, and #578 refuses a pipeline whose compute program is wave64 before it is translated (it tests the native program, in `HostPipeline::new`). Those programs then count as refused, not as untranslated. With this PR in the build they are translated, and the ones `main`'s translator cannot lower either now appear in the untranslated list with their reason. That would make them new lines in the log without being programs that worked before. I have not run your merged tree, so this is a reading of #578's description and your numbers (refused / untranslated 1265 / 920 against 1388 / 1576), not a measurement. **What would settle it:** the 26 hashes, as you offered. I can look each one up in both listings and say what `main` alone does with it. If any of them does emit on `main` and stop here, that is a defect in this PR and I will fix it. The same for the single `an SCC the emitter did not compute` and `an address in an SGPR that is no root parameter`: neither reason occurs at `bf0f951` in the offline count (the SCC one now names its real cause, see above), so those two hashes would be useful as well. On the fps (1.38 against 0.75): more compute runs with this PR, and the programs in the console flow wait at group barriers, so some cost is expected; @⁠Sil3ntGam3r's numbers above put most of the frame time in the CPU copy path once the culling programs run. AI-assisted (Claude Code).
Author
Owner

@⁠Sil3ntGam3r on GitHub · 2026-11-24 15:56 UTC · original

@⁠r4tedx thanks, that explains #704. I ran the second check you suggested, and the four culling programs turn out not to be the main cost.

Same build as above (RTX 3070, #334 tracking on, Series X), with VICTORY_SKIP_PIPELINES set to the four hashes (fdd56d97a806bcca, 17af15c4015cb4b6, 55679a0547649d0b, 89d08e561897d4e5). The copy stats per frame after world entry, over six samples:

four running four skipped #189-based (refused there)
page faults 2.0–2.2 million 1.3–2.1 million 30 thousand
watches 4.6–6.1 s, 11.8–12.6 GB checked 1.6–4.1 s, 8.7–11.3 GB checked 0.66 s, 5.7 GB checked
refreshes 9.6–11.3 GB 7.1–11.3 GB 4.5 GB

Skipping them lowers the numbers somewhat but leaves them far above the #189-based build. So "once the culling programs run" in my earlier comment overstated their part.

The copy stats' per-range list shows where the refreshes go. These are the top ranges by MB per frame in one interval with the four skipped:

title range size (bytes) copies per frame MB per frame
0x1b280000 182,452,224 19 3,467
0xd6b610000 94,371,840 8 755
0xfb2600000 52,428,800 7 367
0x1f180000 108,356,352 3 325
0x1bc73fe0 158,154,080 2 316
five more starting at 0x1b9c3490–0x1bf50ae0 159–163 MB each 1 158–163 each

The top ten come to about 6.0 GB per frame. The first range alone is about a third of all refreshes, and its size is exactly the 182452224x1 buffer that mesh SRVs bind whole in @⁠uWaazy's dump on #619. The five ranges starting just inside it look like views into the same buffer. So most of the cost looks like whole-buffer views of one large buffer, refreshed at full size on each bind, which is the pattern you linked to #951. That the stack pays more than the #189-based build because it translates many more programs (102 unique refusals here against about 470 there), and so binds it more often, is my inference; I haven't measured it.

I haven't run VICTORY_LOG=victory_gpu::draw=debug yet; the range list seemed to answer the same question. If you want the views behind the 182,452,224-byte range named, I can run it.

(AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 15:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7136859218) @⁠r4tedx thanks, that explains #704. I ran the second check you suggested, and the four culling programs turn out not to be the main cost. Same build as above (RTX 3070, #334 tracking on, Series X), with `VICTORY_SKIP_PIPELINES` set to the four hashes (`fdd56d97a806bcca`, `17af15c4015cb4b6`, `55679a0547649d0b`, `89d08e561897d4e5`). The copy stats per frame after world entry, over six samples: | | four running | four skipped | #189-based (refused there) | |---|---|---|---| | page faults | 2.0–2.2 million | 1.3–2.1 million | 30 thousand | | watches | 4.6–6.1 s, 11.8–12.6 GB checked | 1.6–4.1 s, 8.7–11.3 GB checked | 0.66 s, 5.7 GB checked | | refreshes | 9.6–11.3 GB | 7.1–11.3 GB | 4.5 GB | Skipping them lowers the numbers somewhat but leaves them far above the #189-based build. So "once the culling programs run" in my earlier comment overstated their part. The copy stats' per-range list shows where the refreshes go. These are the top ranges by MB per frame in one interval with the four skipped: | title range | size (bytes) | copies per frame | MB per frame | |---|---|---|---| | `0x1b280000` | 182,452,224 | 19 | 3,467 | | `0xd6b610000` | 94,371,840 | 8 | 755 | | `0xfb2600000` | 52,428,800 | 7 | 367 | | `0x1f180000` | 108,356,352 | 3 | 325 | | `0x1bc73fe0` | 158,154,080 | 2 | 316 | | five more starting at `0x1b9c3490`–`0x1bf50ae0` | 159–163 MB each | 1 | 158–163 each | The top ten come to about 6.0 GB per frame. The first range alone is about a third of all refreshes, and its size is exactly the `182452224x1` buffer that mesh SRVs bind whole in @⁠uWaazy's dump on #619. The five ranges starting just inside it look like views into the same buffer. So most of the cost looks like whole-buffer views of one large buffer, refreshed at full size on each bind, which is the pattern you linked to #951. That the stack pays more than the #189-based build because it translates many more programs (102 unique refusals here against about 470 there), and so binds it more often, is my inference; I haven't measured it. I haven't run `VICTORY_LOG=victory_gpu::draw=debug` yet; the range list seemed to answer the same question. If you want the views behind the 182,452,224-byte range named, I can run it. (AI-assisted test run.)
Author
Owner

@⁠N7z on GitHub · 2026-11-24 16:03 UTC · original

Ran this stack's tests (bf0f951, and #233 at b623fd3) next to #189 and #734's branch on an RTX 4060 Laptop: all 159 pass on the NVIDIA GPU. Comparison and coverage table in #1132.

One thing for the harness: emit::host::adapters() keeps every non-software adapter, and the split tests expect each one to run 32- or 64-lane waves. This laptop's Intel UHD (13th gen iGPU) reports 16..16, so 30 tests here fail on it with console wave64 lanes on a host without 64-lane waves is not supported: every split_tests test, both lane_read_loop_tests and each_adapter_gets_what_it_runs. The translator refuses correctly, only the tests expect a pipeline. Filtering adapters() on WaveLaneCountMax >= 32 instead of the WARP name check would cover WARP and these iGPUs alike. Intel Xe-LP iGPUs are common on NVIDIA laptops, so testers with those will otherwise report failures that are not in the translator.

**@⁠N7z** on GitHub · 2026-11-24 16:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7137060580) Ran this stack's tests (`bf0f951`, and #233 at `b623fd3`) next to #189 and #734's branch on an RTX 4060 Laptop: all 159 pass on the NVIDIA GPU. Comparison and coverage table in #1132. One thing for the harness: `emit::host::adapters()` keeps every non-software adapter, and the split tests expect each one to run 32- or 64-lane waves. This laptop's Intel UHD (13th gen iGPU) reports 16..16, so 30 tests here fail on it with `console wave64 lanes on a host without 64-lane waves is not supported`: every `split_tests` test, both `lane_read_loop_tests` and `each_adapter_gets_what_it_runs`. The translator refuses correctly, only the tests expect a pipeline. Filtering `adapters()` on `WaveLaneCountMax >= 32` instead of the WARP name check would cover WARP and these iGPUs alike. Intel Xe-LP iGPUs are common on NVIDIA laptops, so testers with those will otherwise report failures that are not in the translator.
Author
Owner

@⁠supidooo on GitHub · 2026-11-24 16:12 UTC · original

Revalidated updated head bf0f951 (replacing c153b21) stacked cleanly on main (ffe310e) + #175 (19aec59) + #362 (1e33e88) on Windows 10 Pro 22H2 (Build 19045), NVIDIA GeForce RTX 4060 Ti 16 GB (driver 32.0.16.2124 / 621.24), Intel Core i7-10700K, 32 GB RAM, Rust 1.98.1, now with DXIL validation enabled (dxil.dll 1.9.2609.5 via VICTORY_DXIL).

Unit tests (no game data)

  • cargo test -p victory-shader --lib -- --nocapture: 159 passed; 0 failed; 1 ignored in 37.36 s (113 NVIDIA GeForce RTX 4060 Ti: hardware lines, 0 no dxil.dll skips, 35 no SM 6.6 warp device; skipped, 4 no console [or PC] compiler; skipped).
    • Newly added tests at this head pass with hardware execution and DXIL validation: emit::split_tests::loops_leave_on_the_new_exec_of_saveexec, emit::waterfall_tests::the_console_flow_refuses_descriptors_joined_per_lane, and emit::waterfall_tests::joined_descriptors_keep_the_per_lane_form_when_the_console_flow_is_asked_for.
  • cargo test -p victory-shader --lib emit::split_tests -- --test-threads=1 --nocapture: 30 passed; 0 failed in 19.55 s.
  • cargo test -p victory-gpu --lib: 51 passed; 0 failed; 1 ignored in 0.28 s.

victory translate --validate --pipelines (host waves 32-32 lanes)

Answering the open count question for bf0f951:

  • emit: a per-lane descriptor chosen by control flow in the console flow: 0 programs moved from emitted to refused on this 32-32 host.
  • All emitted and host-pipeline counts match the previous c153b21 run across the same 26,148 IR programs (26,741 containers walked, 614 duplicates skipped):
Stage c153b21 emitted / pipelines bf0f951 emitted / validated / pipelines
Vertex & Pixel (of 14,039) 12243 / 12243 12243 / 12167 / 12243
Compute (of 2,582) 1420 / 1420 1420 / 1385 / 1420
Mesh (of 8,713) 8214 / 8214 8214 / 8152 / 8214

Other emit/resource counts (e.g. emit: a lane mask holding lanes elsewhere read as data: 3, emit: console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves: 43, emit: a descriptor chosen by control flow: 41) are unchanged from c153b21.

Summary of the 173 dxil.dll 1.9.2609.5 validation rejections (all of which still built host D3D12 pipelines here):

  • 53 mesh vertex plus primitive output size is greater than 32768
  • 49 signature row interpolation-mode conflicts
  • 36 container Program Input Signature / Program Output Signature mismatches
  • 35 compute stage-incompatible operation errors (matching your offline 1,420 emitted / 1,385 validated)

AI-assisted test run (Antigravity).

**@⁠supidooo** on GitHub · 2026-11-24 16:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7137294186) Revalidated updated head `bf0f951` (replacing `c153b21`) stacked cleanly on `main` (`ffe310e`) + `#175` (`19aec59`) + `#362` (`1e33e88`) on **Windows 10 Pro 22H2 (Build 19045)**, **NVIDIA GeForce RTX 4060 Ti 16 GB** (driver `32.0.16.2124` / `621.24`), Intel Core i7-10700K, 32 GB RAM, Rust `1.98.1`, now with DXIL validation enabled (`dxil.dll 1.9.2609.5` via `VICTORY_DXIL`). ### Unit tests (no game data) - `cargo test -p victory-shader --lib -- --nocapture`: **159 passed; 0 failed; 1 ignored** in 37.36 s (113 `NVIDIA GeForce RTX 4060 Ti:` hardware lines, `0` `no dxil.dll` skips, `35` `no SM 6.6 warp device; skipped`, `4` `no console [or PC] compiler; skipped`). - Newly added tests at this head pass with hardware execution and DXIL validation: `emit::split_tests::loops_leave_on_the_new_exec_of_saveexec`, `emit::waterfall_tests::the_console_flow_refuses_descriptors_joined_per_lane`, and `emit::waterfall_tests::joined_descriptors_keep_the_per_lane_form_when_the_console_flow_is_asked_for`. - `cargo test -p victory-shader --lib emit::split_tests -- --test-threads=1 --nocapture`: **30 passed; 0 failed** in 19.55 s. - `cargo test -p victory-gpu --lib`: **51 passed; 0 failed; 1 ignored** in 0.28 s. ### `victory translate --validate --pipelines` (`host waves 32-32 lanes`) Answering the open count question for `bf0f951`: - **`emit: a per-lane descriptor chosen by control flow in the console flow`:** **`0`** programs moved from emitted to refused on this `32-32` host. - All emitted and host-pipeline counts match the previous `c153b21` run across the same 26,148 IR programs (`26,741` containers walked, `614` duplicates skipped): | Stage | `c153b21` emitted / pipelines | `bf0f951` emitted / validated / pipelines | |---|---:|---:| | **Vertex & Pixel** (of 14,039) | `12243` / `12243` | `12243` / **`12167`** / `12243` | | **Compute** (of 2,582) | `1420` / `1420` | `1420` / **`1385`** / `1420` | | **Mesh** (of 8,713) | `8214` / `8214` | `8214` / **`8152`** / `8214` | Other emit/resource counts (e.g. `emit: a lane mask holding lanes elsewhere read as data: 3`, `emit: console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves: 43`, `emit: a descriptor chosen by control flow: 41`) are unchanged from `c153b21`. Summary of the `173` `dxil.dll 1.9.2609.5` validation rejections (all of which still built `host` D3D12 pipelines here): - `53` mesh `vertex plus primitive output size is greater than 32768` - `49` signature row interpolation-mode conflicts - `36` container `Program Input Signature` / `Program Output Signature` mismatches - `35` compute stage-incompatible operation errors (matching your offline `1,420 emitted / 1,385 validated`) AI-assisted test run (Antigravity).
Author
Owner

@⁠Ctrl-Alt-Haze on GitHub · 2026-11-24 16:51 UTC · original

Independent verification on Windows 11, NVIDIA GeForce RTX 5070 Ti (Blackwell, Wave32, driver 32.0.16.2135) + WARP, Windows SDK 10.0.26100.0 dxil.dll (1.8.2502.11), Rust 1.98.1, against upstream/main (ffe310eb):

  • Clean trial merge with ffe310eb on both #233 (b623fd3) and #439 (bf0f951).
  • #439 (bf0f951):
    • cargo xtask policy: 157 files ok
    • cargo clippy --workspace --all-targets --locked -- -D warnings and --all-features: pass
    • cargo test --workspace --locked: 382 passed, 0 failed, 6 ignored
    • victory-shader --features host (RTX 5070 Ti & VICTORY_WARP=1): 159 passed, 0 failed, 1 ignored (all split_tests and lane_read_loop_tests hardware readbacks pass)
    • victory-gpu --features diagnostics (RTX 5070 Ti & VICTORY_D3D12_WARP=1): 54 passed, 0 failed, 1 ignored
  • (#233 b623fd3 also passes all gates cleanly: 358 workspace, 135 shader host/WARP, 54 GPU RTX/WARP.)
  • New unsafe blocks in host.rs have // SAFETY: comments. Looks ready from a CI + Wave32 Blackwell hardware-test standpoint.

AI-assisted verification on local RTX 5070 Ti + WARP; no game data.

**@⁠Ctrl-Alt-Haze** on GitHub · 2026-11-24 16:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7138302756) Independent verification on **Windows 11**, **NVIDIA GeForce RTX 5070 Ti** (Blackwell, Wave32, driver `32.0.16.2135`) + **WARP**, **Windows SDK `10.0.26100.0` `dxil.dll` (`1.8.2502.11`)**, **Rust `1.98.1`**, against `upstream/main` (`ffe310eb`): - Clean trial merge with `ffe310eb` on both `#233` (`b623fd3`) and `#439` (`bf0f951`). - `#439` (`bf0f951`): - `cargo xtask policy`: `157 files ok` - `cargo clippy --workspace --all-targets --locked -- -D warnings` and `--all-features`: pass - `cargo test --workspace --locked`: **382 passed, 0 failed, 6 ignored** - `victory-shader --features host` (RTX 5070 Ti & `VICTORY_WARP=1`): **159 passed, 0 failed, 1 ignored** (all `split_tests` and `lane_read_loop_tests` hardware readbacks pass) - `victory-gpu --features diagnostics` (RTX 5070 Ti & `VICTORY_D3D12_WARP=1`): **54 passed, 0 failed, 1 ignored** - (`#233` `b623fd3` also passes all gates cleanly: `358` workspace, `135` shader host/WARP, `54` GPU RTX/WARP.) - New `unsafe` blocks in `host.rs` have `// SAFETY:` comments. Looks ready from a CI + Wave32 Blackwell hardware-test standpoint. AI-assisted verification on local RTX 5070 Ti + WARP; no game data.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 17:05 UTC · original

@⁠N7z, thank you for the run and for the harness report; it is fixed. @⁠timorjay, your test is in.

Adapters with narrower waves (the Intel iGPU at 16-16). You were right that the translator refuses correctly and only the tests were wrong: they walk every hardware adapter and expect each to take the console's wave-size-dependent programs in one form or the other. The adapter list (emit::host::adapters()) now keeps only adapters whose device runs 32- or 64-lane waves, by the wave range the device reports, as you suggested; the software renderer was already left out by name and falls under the same rule now. An adapter no SM 6.6 device can be made on stays listed for its user to skip, as before. Commit ededb1b on #233, merged up. I have no 16-lane adapter, so what I could check is that both adapters here (RTX 5070 at 32-32, Radeon iGPU at 32-64) are still listed and pass; whether your UHD now drops out cleanly is something only your machine can show, and a rerun would be welcome.

The nested-mask test (0cf37ac, carried as 1f53745 with @⁠timorjay's authorship, plus a one-line clippy fix of mine, 72eb174): exact here on the RTX 5070 (console flow in two 32-lane waves) and on the Radeon iGPU, all eight cases, 128 lane results each.

PR head now was
#233 ededb1b b623fd3
#320 41369c9 cbcef55
#439 28aca3b bf0f951

Fast-forward pushes. Tests and the test harness only; no translator code changed. Both CI clippy commands are clean at each head, and cargo test --workspace --locked at the #439 head passes on the RTX 5070 + Radeon iGPU: 383 passed, 0 failed, 6 ignored.

The title was not used in these tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 17:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7138666877) @⁠N7z, thank you for the run and for the harness report; it is fixed. @⁠timorjay, your test is in. **Adapters with narrower waves (the Intel iGPU at 16-16).** You were right that the translator refuses correctly and only the tests were wrong: they walk every hardware adapter and expect each to take the console's wave-size-dependent programs in one form or the other. The adapter list (`emit::host::adapters()`) now keeps only adapters whose device runs 32- or 64-lane waves, by the wave range the device reports, as you suggested; the software renderer was already left out by name and falls under the same rule now. An adapter no SM 6.6 device can be made on stays listed for its user to skip, as before. Commit `ededb1b` on #233, merged up. I have no 16-lane adapter, so what I could check is that both adapters here (RTX 5070 at 32-32, Radeon iGPU at 32-64) are still listed and pass; whether your UHD now drops out cleanly is something only your machine can show, and a rerun would be welcome. **The nested-mask test** (`0cf37ac`, carried as `1f53745` with @⁠timorjay's authorship, plus a one-line clippy fix of mine, `72eb174`): exact here on the RTX 5070 (console flow in two 32-lane waves) and on the Radeon iGPU, all eight cases, 128 lane results each. | PR | head now | was | |---|---|---| | #233 | `ededb1b` | `b623fd3` | | #320 | `41369c9` | `cbcef55` | | #439 | `28aca3b` | `bf0f951` | Fast-forward pushes. Tests and the test harness only; no translator code changed. Both CI clippy commands are clean at each head, and `cargo test --workspace --locked` at the #439 head passes on the RTX 5070 + Radeon iGPU: 383 passed, 0 failed, 6 ignored. The title was not used in these tests. AI-assisted (Claude Code).
Author
Owner

@⁠465d6a0eac on GitHub · 2026-11-24 17:02 UTC · original · edited 2026-11-24 17:20 UTC

Thank you for this, @⁠r4tedx! Many pull requests here are still waiting to be merged, so I've ported this one to 465d6a0eac/AgentRecompVI, a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/34. It includes #320, which this pull request builds on. You're credited as the author there. This pull request stays the original.

Test results

  • Windows 11, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088, 32-lane waves): together with #320, #265, #492 and #1019, cargo clippy (both variants) and cargo test --workspace pass (407 passed, 0 failed).
  • victory translate over the 26,148 shader programs in my own copy of the game with --host-lanes 32-32, before → after #320/#439: compute programs emitted 1,221 → 1,422 of 2,582 (+201). "console wave64 lanes on a host without 64-lane waves" 162 → 0, "a wave64 group sharing LDS without barriers" 120 → 0, "a select on an untracked mask" 284 → 0, "a lane mask holding lanes elsewhere read as data" 266 → 3. New first blockers: "console wave64 lanes in a group of more than 64 threads" (43, the open item in your doc) and later steps such as descriptors read as data.
  • With it in, the title boots and runs its menus at 30 fps on that machine, through the intro video, first-boot settings and legal screens up to the terms screen. I haven't reached the world yet.
**@⁠465d6a0eac** on GitHub · 2026-11-24 17:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7138596739) · edited 2026-11-24 17:20 UTC Thank you for this, @⁠r4tedx! Many pull requests here are still waiting to be merged, so I've ported this one to [465d6a0eac/AgentRecompVI](https://github.com/465d6a0eac/AgentRecompVI), a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/34. It includes #320, which this pull request builds on. You're credited as the author there. This pull request stays the original. **Test results** - Windows 11, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088, 32-lane waves): together with #320, #265, #492 and #1019, `cargo clippy` (both variants) and `cargo test --workspace` pass (407 passed, 0 failed). - `victory translate` over the 26,148 shader programs in my own copy of the game with `--host-lanes 32-32`, before → after #320/#439: compute programs emitted 1,221 → 1,422 of 2,582 (+201). "console wave64 lanes on a host without 64-lane waves" 162 → 0, "a wave64 group sharing LDS without barriers" 120 → 0, "a select on an untracked mask" 284 → 0, "a lane mask holding lanes elsewhere read as data" 266 → 3. New first blockers: "console wave64 lanes in a group of more than 64 threads" (43, the open item in your doc) and later steps such as descriptors read as data. - With it in, the title boots and runs its menus at 30 fps on that machine, through the intro video, first-boot settings and legal screens up to the terms screen. I haven't reached the world yet.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 17:24 UTC · original

@⁠r4tedx Our independent divergent scatter control on 28aca3b matched the CPU reference on AMD Wave64, AMD split Wave32 and NVIDIA split Wave32 with full GPU validation. It covers prefix plus per-lane scatter through a table UAV. Root-only producers and title inputs remain separate.

**@⁠aycow** on GitHub · 2026-11-24 17:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7139156086) @⁠r4tedx Our [independent divergent scatter control](https://github.com/aycow/VIctory/commit/e80f4f8b812fce3eb25c7bd3c585b37b3f2ff58d) on `28aca3b` matched the CPU reference on AMD Wave64, AMD split Wave32 and NVIDIA split Wave32 with full GPU validation. It covers prefix plus per-lane scatter through a table UAV. Root-only producers and title inputs remain separate.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 17:32 UTC · original

@⁠mohammadallami75-ops, I owe you the result on your scalar-state patch (the comment with the diff). I applied it to the current head, reviewed it, ran it on both GPUs and measured it over the title's shaders. Short version: the fixtures expose real faults and I want them, but the detection as written costs 75 working programs on NVIDIA, so I am not carrying it as it is.

Applying it. Onto bf0f951 with git apply --3way: the three source files merged cleanly; only the end of split_tests.rs conflicted, and both sides were kept. No logic changed.

The fixtures are right, and two of them show faults on a 64-lane host that are not about scalars. At bf0f951, with only your tests added (run here, RTX 5070 and Radeon iGPU):

fixture RTX 5070 (console flow) Radeon iGPU (64-lane waves, per-lane form)
loop_exit_mask_counted_after_the_loop exact 1 in every lane where 64 is expected
mask_grown_inside_a_branch_counted_after_it exact refused (a lane mask holding lanes elsewhere read as data)

The first is a silent wrong result today on AMD hosts. Your || reads_mask_data clause fixes both by sending such a program to the console flow on every host. With the whole patch, all seven of your tests pass on both adapters; six of the seven fail without it. Both CI clippy commands are clean and the workspace suite passes.

What it does to the title (local title data, offline, CPU only, counts only; translate --validate, bf0f951 against the patched tree, program by program):

host waves compute emitted / validated before after changed
32-32 1,420 / 1,385 1,345 / 1,310 75 validated programs become refused, all with console wave64 lanes in a group of more than 64 threads
32-64 1,464 / 1,429 1,464 / 1,429 none

The 75 ran per lane with no wave size before. The rule marks them as needing the console's lanes because of plain scalar joins, and in a group of more than 64 threads that stops them on a 32-lane host. Nothing went from refused to validated.

Why it fires so widely. It fires for 414 wave64 compute programs:

  • It tests each edge's absolute path condition, so every scalar join inside or after a divergent region counts, even at a branch all lanes take alike (77 programs fire only for that).
  • A scalar join at the header of a loop that lanes leave at different iterations counts (366 programs). That is an ordinary loop counter; in only 7 of the 284 programs that fire through plain scalars is such a value read outside its loop.
  • Exit masks grown from 0 count as plain scalars, not masks (43 programs).

Three probes (an exit-mask loop, a uniform branch inside a divergent region, a uniform counted loop inside one) return identical values per lane and in the console flow on both adapters, yet the patched tree pins all three and refuses them at 128 threads on a 32-lane host.

The fallback. Err(e) if what == lower::SCALAR_CONSOLE_FLOW => return Err(e) in emit removes the per-lane fallback when the console flow cannot lower such a program, on every host. The stack's rule is that a program taking the console flow only for correctness keeps the per-lane form where the console flow declines, so nothing that translated before is refused. On this title that line costs nothing today (0 programs at 32-64), but it is a trap for the next one.

What I would carry, and how

  1. Now, with your authorship: the seven fixtures and the reads_mask_data clause, as one change. That is a correctness fix for 64-lane hosts that costs no program.
  2. The scalar detection, once narrowed: test each edge relative to the join's own reach, skip loop-header joins of scalars not used outside their loop, treat the exit masks as masks, keep the per-lane fallback, and make the flag come out the same in the console-flow pass. A rough version of the first three brings 414 programs down to about 168 and the 75 lost down to 3.
  3. Say why wave32 programs are left out (433 have the same shape), or cover them.

This PR is not taking new behaviour while it waits for review, so both would go on the branch after it (shader/wave-per-group on the fork), where a group of more than 64 threads without LDS runs as one host group per console wave instead of stopping. A fork PR against that branch with part 1 alone is the quickest way in; if you prefer, I will split it out of your diff myself and keep you as the author.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 17:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7139346685) @⁠mohammadallami75-ops, I owe you the result on your scalar-state patch ([the comment with the diff](https://git.gtahub.st/github/Marvisak--VIctory/pulls/439)). I applied it to the current head, reviewed it, ran it on both GPUs and measured it over the title's shaders. Short version: **the fixtures expose real faults and I want them, but the detection as written costs 75 working programs on NVIDIA, so I am not carrying it as it is.** **Applying it.** Onto `bf0f951` with `git apply --3way`: the three source files merged cleanly; only the end of `split_tests.rs` conflicted, and both sides were kept. No logic changed. **The fixtures are right, and two of them show faults on a 64-lane host that are not about scalars.** At `bf0f951`, with only your tests added (run here, RTX 5070 and Radeon iGPU): | fixture | RTX 5070 (console flow) | Radeon iGPU (64-lane waves, per-lane form) | |---|---|---| | `loop_exit_mask_counted_after_the_loop` | exact | **1 in every lane where 64 is expected** | | `mask_grown_inside_a_branch_counted_after_it` | exact | refused (`a lane mask holding lanes elsewhere read as data`) | The first is a silent wrong result today on AMD hosts. Your `|| reads_mask_data` clause fixes both by sending such a program to the console flow on every host. With the whole patch, all seven of your tests pass on both adapters; six of the seven fail without it. Both CI clippy commands are clean and the workspace suite passes. **What it does to the title** (local title data, offline, CPU only, counts only; `translate --validate`, `bf0f951` against the patched tree, program by program): | host waves | compute emitted / validated before | after | changed | |---|---|---|---| | 32-32 | 1,420 / 1,385 | 1,345 / 1,310 | **75 validated programs become refused**, all with `console wave64 lanes in a group of more than 64 threads` | | 32-64 | 1,464 / 1,429 | 1,464 / 1,429 | none | The 75 ran per lane with no wave size before. The rule marks them as needing the console's lanes because of plain scalar joins, and in a group of more than 64 threads that stops them on a 32-lane host. Nothing went from refused to validated. **Why it fires so widely.** It fires for 414 wave64 compute programs: - It tests each edge's absolute path condition, so every scalar join inside or after a divergent region counts, even at a branch all lanes take alike (77 programs fire only for that). - A scalar join at the header of a loop that lanes leave at different iterations counts (366 programs). That is an ordinary loop counter; in only 7 of the 284 programs that fire through plain scalars is such a value read outside its loop. - Exit masks grown from 0 count as plain scalars, not masks (43 programs). Three probes (an exit-mask loop, a uniform branch inside a divergent region, a uniform counted loop inside one) return identical values per lane and in the console flow on both adapters, yet the patched tree pins all three and refuses them at 128 threads on a 32-lane host. **The fallback.** `Err(e) if what == lower::SCALAR_CONSOLE_FLOW => return Err(e)` in `emit` removes the per-lane fallback when the console flow cannot lower such a program, on every host. The stack's rule is that a program taking the console flow only for correctness keeps the per-lane form where the console flow declines, so nothing that translated before is refused. On this title that line costs nothing today (0 programs at 32-64), but it is a trap for the next one. **What I would carry, and how** 1. Now, with your authorship: the seven fixtures and the `reads_mask_data` clause, as one change. That is a correctness fix for 64-lane hosts that costs no program. 2. The scalar detection, once narrowed: test each edge relative to the join's own reach, skip loop-header joins of scalars not used outside their loop, treat the exit masks as masks, keep the per-lane fallback, and make the flag come out the same in the console-flow pass. A rough version of the first three brings 414 programs down to about 168 and the 75 lost down to 3. 3. Say why wave32 programs are left out (433 have the same shape), or cover them. This PR is not taking new behaviour while it waits for review, so both would go on the branch after it ([`shader/wave-per-group`](https://github.com/r4tedx/VIctory/tree/shader/wave-per-group) on the fork), where a group of more than 64 threads without LDS runs as one host group per console wave instead of stopping. A fork PR against that branch with part 1 alone is the quickest way in; if you prefer, I will split it out of your diff myself and keep you as the author. AI-assisted (Claude Code).
Author
Owner

@⁠erLCoder on GitHub · 2026-11-24 17:34 UTC · original · edited 2026-11-24 17:38 UTC

GTX 1660 Ti hardware retest of the saveexec SCC fix on Windows 10 22H2 (19045.6466), NVIDIA 581.42, Rust 1.98.1 MSVC, Agility SDK 1.620.2. Local test-executable exports enabled Agility. An independent D3D12 probe identified NVIDIA LUID 00000000:00017c52, software flag 0, SM 6.8 and 32–32 lanes; the GPU test logs name the GTX 1660 Ti.

At 1e17e572a03013e5d8f3dd7e6b0c28af3f373786, emit::split_tests passed 30/30 and emit::lane_read_loop_tests 2/2, with zero failures or ignored tests. The new saveexec_scc_tests_new_exec_not_saved_exec and the loop leaving on saveexec SCC both produced exact 64-thread results on the GPU; the latter checks 64 wave iterations rather than the erroneous 65. Joined back-edge and wave32/wave64 lane-read results were exact. Split totals include CPU-only checks.

At bf0f9511c5720e08f97026c9a08a2ba5e33a99ba, split tests again passed 30/30 and lane-loop tests 2/2. waterfall_tests passed 7/7, but WARP-dependent paths internally skipped for lack of an SM 6.6 WARP device; the descriptor-join refusal test is translator coverage, not GPU output coverage. Builds were cleaned between different revisions after detecting and discarding a stale shared-target result. No #189 code was combined with this stack.

Update: at 28aca3b718f7b61e3b71e7496bc4d9352b043e8f, the new nested_exec_masks_keep_shared_visibility_results_across_halves test passed 1/1. All eight mask ranges returned 128 exact lane results each on the GTX 1660 Ti. This also confirms the updated adapter filter retained this 32-lane GPU; no 16-lane adapter was available to test exclusion. The previous full suites were not rerun on this head.

Codex prepared the worktrees, ran the tests and drafted this report. Synthetic fixtures do not prove all control-flow cases or title correctness.

**@⁠erLCoder** on GitHub · 2026-11-24 17:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7139385509) · edited 2026-11-24 17:38 UTC GTX 1660 Ti hardware retest of the saveexec SCC fix on Windows 10 22H2 (19045.6466), NVIDIA 581.42, Rust 1.98.1 MSVC, Agility SDK 1.620.2. Local test-executable exports enabled Agility. An independent D3D12 probe identified NVIDIA LUID `00000000:00017c52`, software flag 0, SM 6.8 and 32–32 lanes; the GPU test logs name the GTX 1660 Ti. At `1e17e572a03013e5d8f3dd7e6b0c28af3f373786`, `emit::split_tests` passed 30/30 and `emit::lane_read_loop_tests` 2/2, with zero failures or ignored tests. The new `saveexec_scc_tests_new_exec_not_saved_exec` and the loop leaving on saveexec SCC both produced exact 64-thread results on the GPU; the latter checks 64 wave iterations rather than the erroneous 65. Joined back-edge and wave32/wave64 lane-read results were exact. Split totals include CPU-only checks. At `bf0f9511c5720e08f97026c9a08a2ba5e33a99ba`, split tests again passed 30/30 and lane-loop tests 2/2. `waterfall_tests` passed 7/7, but WARP-dependent paths internally skipped for lack of an SM 6.6 WARP device; the descriptor-join refusal test is translator coverage, not GPU output coverage. Builds were cleaned between different revisions after detecting and discarding a stale shared-target result. No #189 code was combined with this stack. Update: at `28aca3b718f7b61e3b71e7496bc4d9352b043e8f`, the new `nested_exec_masks_keep_shared_visibility_results_across_halves` test passed 1/1. All eight mask ranges returned 128 exact lane results each on the GTX 1660 Ti. This also confirms the updated adapter filter retained this 32-lane GPU; no 16-lane adapter was available to test exclusion. The previous full suites were not rerun on this head. Codex prepared the worktrees, ran the tests and drafted this report. Synthetic fixtures do not prove all control-flow cases or title correctness.
Author
Owner

@⁠sash2kk on GitHub · 2026-11-24 17:43 UTC · original

@⁠r4tedx, thanks for checking. You are right, and my 17 + 9 were an artifact of comparing two title runs, not regressions.

I checked each hash against the control run's log (main ffe310e + #578):

  • 21 were translated on the control run: the 20 console wave64 lanes in a group of more than 64 threads and the one a whole-wave section of a wave64. That is your expected group of 40.
  • The other 28 never appear in the control run's log at all: the 17 a descriptor read only as data, the 9 a structured buffer of unknown stride, and the two singles. The title simply did not request them in that run, which got less far into the world before its removal. So nothing that main translated stops here.

The hashes, in case you want to cross-check them against your listings:

  • a descriptor read only as data (17): 1261271b20a35d1b, 12efa84143ac3f9c, 149cb3508b989d0e, 1a83504bcee28c3b, 254d39dc062ccbd2, 2964f72e06633f7c, 326652d23fe73e99, 503cf21ee3992b39, 511b165e8c6f13f1, 89cc3adb9b3b587e, 9cfd9c092e1d5a97, a7d9b706b3465142, aa221f469520e809, d5c18b9fbcd08f36, e685f0080b144a9c, f0d5c40a8c448a86, ff26243811447aed
  • a structured buffer of unknown stride (9): 1f55c45de66dc2c4, 5e5b5c98afaa1753, 5f970e9e47594541, 8d5d3f97369050bd, ad17f5c4f7acac25, b2433b5b9845e711, cf4ce294accdd428, f0afa89ecfb6944e, fdfd1675ebbd57bc
  • an address in an SGPR that is no root parameter: 5e19e7c728d956df
  • an SCC the emitter did not compute: 5c9d6316a51968c5

Sorry for the noise. Next time I'll compare program by program instead of across runs.

AI-assisted (Claude Code).

**@⁠sash2kk** on GitHub · 2026-11-24 17:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7139622426) @⁠r4tedx, thanks for checking. You are right, and my 17 + 9 were an artifact of comparing two title runs, not regressions. I checked each hash against the control run's log (`main` `ffe310e` + #578): - **21 were translated on the control run:** the 20 `console wave64 lanes in a group of more than 64 threads` and the one `a whole-wave section of a wave64`. That is your expected group of 40. - **The other 28 never appear in the control run's log at all:** the 17 `a descriptor read only as data`, the 9 `a structured buffer of unknown stride`, and the two singles. The title simply did not request them in that run, which got less far into the world before its removal. So nothing that `main` translated stops here. The hashes, in case you want to cross-check them against your listings: - `a descriptor read only as data` (17): `1261271b20a35d1b`, `12efa84143ac3f9c`, `149cb3508b989d0e`, `1a83504bcee28c3b`, `254d39dc062ccbd2`, `2964f72e06633f7c`, `326652d23fe73e99`, `503cf21ee3992b39`, `511b165e8c6f13f1`, `89cc3adb9b3b587e`, `9cfd9c092e1d5a97`, `a7d9b706b3465142`, `aa221f469520e809`, `d5c18b9fbcd08f36`, `e685f0080b144a9c`, `f0d5c40a8c448a86`, `ff26243811447aed` - `a structured buffer of unknown stride` (9): `1f55c45de66dc2c4`, `5e5b5c98afaa1753`, `5f970e9e47594541`, `8d5d3f97369050bd`, `ad17f5c4f7acac25`, `b2433b5b9845e711`, `cf4ce294accdd428`, `f0afa89ecfb6944e`, `fdfd1675ebbd57bc` - `an address in an SGPR that is no root parameter`: `5e19e7c728d956df` - `an SCC the emitter did not compute`: `5c9d6316a51968c5` Sorry for the noise. Next time I'll compare program by program instead of across runs. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 17:46 UTC · original

@⁠sash2kk, no noise at all: the A/B was worth having, and the hashes let me close it from this side too. Looked up in both offline listings (local title data, CPU only; main ffe310e and this PR for a 32-lane host):

your list found in the shader pack what main's translator does with them
17 a descriptor read only as data 17 refuses all 17: 6 with the same reason, 6 with a select on an untracked mask, 5 with a lane mask holding lanes elsewhere read as data
9 a structured buffer of unknown stride 9 refuses all 9: 4 with the same reason, 3 and 2 with the two mask reasons
5c9d6316a51968c5 (an SCC the emitter did not compute) yes refuses it (a descriptor's address or format read as data, which is also what this PR reports for it since the SCC fix)
5e19e7c728d956df no not in shaders.rpf; it must come from another container

So none of the 27 I can see ever translated on main, which agrees with your log check; my guess about why they were missing from the control run (#578 refusing them up front) was wrong, yours (the run did not get far enough to request them) is the measured one. For the 16 that main stops at a mask reason, this PR gets past the mask and reaches the next blocker, a descriptor or stride one; those belong to #704 and the descriptor work, not here.

Your 21 that did translate on the control are the real cost on a 32-lane host and the known remainder: the 20 in groups of more than 64 threads and the one whole-wave section. The branch after this PR (shader/wave-per-group) runs such a group as one host group per console wave when it shares no LDS, and now lowers whole-wave sections in groups of 32 threads or fewer.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 17:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7139687736) @⁠sash2kk, no noise at all: the A/B was worth having, and the hashes let me close it from this side too. Looked up in both offline listings (local title data, CPU only; `main` `ffe310e` and this PR for a 32-lane host): | your list | found in the shader pack | what `main`'s translator does with them | |---|---|---| | 17 `a descriptor read only as data` | 17 | refuses all 17: 6 with the same reason, 6 with `a select on an untracked mask`, 5 with `a lane mask holding lanes elsewhere read as data` | | 9 `a structured buffer of unknown stride` | 9 | refuses all 9: 4 with the same reason, 3 and 2 with the two mask reasons | | `5c9d6316a51968c5` (`an SCC the emitter did not compute`) | yes | refuses it (`a descriptor's address or format read as data`, which is also what this PR reports for it since the SCC fix) | | `5e19e7c728d956df` | no | not in `shaders.rpf`; it must come from another container | So none of the 27 I can see ever translated on `main`, which agrees with your log check; my guess about why they were missing from the control run (#578 refusing them up front) was wrong, yours (the run did not get far enough to request them) is the measured one. For the 16 that `main` stops at a mask reason, this PR gets past the mask and reaches the next blocker, a descriptor or stride one; those belong to #704 and the descriptor work, not here. Your 21 that did translate on the control are the real cost on a 32-lane host and the known remainder: the 20 in groups of more than 64 threads and the one whole-wave section. The branch after this PR ([`shader/wave-per-group`](https://github.com/r4tedx/VIctory/tree/shader/wave-per-group)) runs such a group as one host group per console wave when it shares no LDS, and now lowers whole-wave sections in groups of 32 threads or fewer. AI-assisted (Claude Code).
Author
Owner

@⁠mohammadallami75-ops on GitHub · 2026-11-24 18:07 UTC · original

@⁠r4tedx I split the patch on shader/wave-per-group. Part 1 is the mask-data fix and all seven fixtures in one commit. Part 2 enables the remaining fixtures and narrows scalar detection to join-relative divergence and loop scalars used outside the loop. It recognizes zero-grown exit masks, carries the flag across passes and keeps the per-lane fallback. Native Wave32 stays on the existing path because forcing console flow pins 32 lanes and there is no emulation for narrower hosts.

Both CI Clippy commands passed on each head. Locked workspace results were 387 passed / 10 ignored for Part 1 and 395 passed / 6 ignored for Part 2, with zero failures. The 43 split tests passed on the RTX 2080 SUPER, and all four portable per-lane regressions had exact WARP readback.

Could you compare 05c7cbb, 8a4d40b and fb45f7f shader by shader with offline translate --validate at 32-32 and 32-64? I’d like to know any new refusals and what happens to the original 75. I don’t have the title corpus, so their recovery is unverified.

AI.

**@⁠mohammadallami75-ops** on GitHub · 2026-11-24 18:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7140185932) @⁠r4tedx I split the patch on `shader/wave-per-group`. [Part 1](https://github.com/r4tedx/VIctory/pull/13) is the mask-data fix and all seven fixtures in one commit. [Part 2](https://github.com/r4tedx/VIctory/pull/14) enables the remaining fixtures and narrows scalar detection to join-relative divergence and loop scalars used outside the loop. It recognizes zero-grown exit masks, carries the flag across passes and keeps the per-lane fallback. Native Wave32 stays on the existing path because forcing console flow pins 32 lanes and there is no emulation for narrower hosts. Both CI Clippy commands passed on each head. Locked workspace results were 387 passed / 10 ignored for Part 1 and 395 passed / 6 ignored for Part 2, with zero failures. The 43 split tests passed on the RTX 2080 SUPER, and all four portable per-lane regressions had exact WARP readback. Could you compare `05c7cbb`, `8a4d40b` and `fb45f7f` shader by shader with offline `translate --validate` at `32-32` and `32-64`? I’d like to know any new refusals and what happens to the original 75. I don’t have the title corpus, so their recovery is unverified. AI.
Author
Owner

@⁠Ahmet-Dedeler on GitHub · 2026-11-24 18:08 UTC · original

A data point from a third GPU vendor: this ran on an Apple GPU through D3DMetal (macOS, CrossOver 26.3, Rosetta 2), which reports WaveLaneCountMin/Max = 32/32 and turns a WaveSize(64) compute pipeline into a silent no-op.

Tree: BeachesOfViceCity/VIctory-Linux f1e94ce plus my Mac host commits, with this PR at c153b21 (the head before the current 28aca3b). It was not applied alone: the fork's LDS-barrier plan decides first and this PR's console flow takes what is left needing 64 lanes, plus one local commit that joins the two mask-join loops. So read the numbers as "this PR beside the fork's plan", not this PR on its own. Two 295 s runs from boot into the opening of the world.

  • Of the 74 distinct compute pipelines that were refused for the wave size in one world frame, this takes 70. Distinct compute pipelines dropped per world frame go from 149-151 to 80-90. #189 in its Wave32 mode took 19 of the 74 on the same tree.
  • No hang, no GPU error, no artifacts in the targets I captured.
  • What starts running: InstanceCulling:CS_Prop_BatchCull / CS_Tree_BatchCull, depth_pyramid:*, tiled_lighting:CS_GenerateMaterialMasks / CS_MaterialTilesInitial / CS_ClusterLightsWorldSpace, shader_binning_utils:*. Before, about 89% of the mesh indirect draws had zero group counts because their culling pass was refused. After, the G-buffer holds props, a fence, signs and a low-detail character, and depth varies on up to 29% of the pixels in a captured frame (1 to 3% before).
  • Offline over the shader archive with --host-lanes 32-32: compute programs usable on a 32-lane host go from 2,180 to 2,434 (+254, none lost), and all 254 pass Apple's Metal shader converter.
  • The 4 of the 74 still refused are groups of more than 64 threads (console wave64 lanes in a group of more than 64 threads) and whole-wave sections.

The presented frame did not change on this host, but that's a later stage (the tiled lighting draws), not this PR. Details in #1128.

Not tested: Windows, this PR on plain main without the Linux fork's commits, and the test suite.

**@⁠Ahmet-Dedeler** on GitHub · 2026-11-24 18:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7140212210) A data point from a third GPU vendor: this ran on an Apple GPU through D3DMetal (macOS, CrossOver 26.3, Rosetta 2), which reports `WaveLaneCountMin/Max = 32/32` and turns a `WaveSize(64)` compute pipeline into a silent no-op. Tree: `BeachesOfViceCity/VIctory-Linux` f1e94ce plus my Mac host commits, with this PR at `c153b21` (the head before the current `28aca3b`). It was not applied alone: the fork's LDS-barrier plan decides first and this PR's console flow takes what is left needing 64 lanes, plus one local commit that joins the two mask-join loops. So read the numbers as "this PR beside the fork's plan", not this PR on its own. Two 295 s runs from boot into the opening of the world. - Of the 74 distinct compute pipelines that were refused for the wave size in one world frame, this takes 70. Distinct compute pipelines dropped per world frame go from 149-151 to 80-90. #189 in its Wave32 mode took 19 of the 74 on the same tree. - No hang, no GPU error, no artifacts in the targets I captured. - What starts running: `InstanceCulling:CS_Prop_BatchCull` / `CS_Tree_BatchCull`, `depth_pyramid:*`, `tiled_lighting:CS_GenerateMaterialMasks` / `CS_MaterialTilesInitial` / `CS_ClusterLightsWorldSpace`, `shader_binning_utils:*`. Before, about 89% of the mesh indirect draws had zero group counts because their culling pass was refused. After, the G-buffer holds props, a fence, signs and a low-detail character, and depth varies on up to 29% of the pixels in a captured frame (1 to 3% before). - Offline over the shader archive with `--host-lanes 32-32`: compute programs usable on a 32-lane host go from 2,180 to 2,434 (+254, none lost), and all 254 pass Apple's Metal shader converter. - The 4 of the 74 still refused are groups of more than 64 threads (`console wave64 lanes in a group of more than 64 threads`) and whole-wave sections. The presented frame did not change on this host, but that's a later stage (the tiled lighting draws), not this PR. Details in #1128. Not tested: Windows, this PR on plain `main` without the Linux fork's commits, and the test suite.
Author
Owner

@⁠SantannaCarlos on GitHub · 2026-11-24 18:10 UTC · original

@⁠r4tedx in-game data on the cascade-shadow chain with your wave-per-group branch (05c7cbb), RTX 4070, on the 4070 stack from #841 (main + #493 + #876 + this PR with #223/#233/#320 + #116 + #984 + #949 + #1020 + #1198 + #1019), 10-minute world runs, a local writer trace:

  • With the branch, the 18 CS_ShadowRenderTiled* programs and CS_ComputeInfiniteRRIntensity translate and validate (offline, 32 lanes), and the run has no pipeline refused and no device removal.
  • The title dispatches every cascade-shadow pass through ExecuteIndirect: 343 of 343 CS_ShadowRenderTiled* commands in the trace were indirect kind 2, and all were dropped as "not prepared on the host" (the indirect limit the branch states). So the indirect path is not optional for this title.
  • With a local patch equivalent to the split dispatch on your testers/indirect-wave-dispatch branch (the record's X times the group's waves in the argument clamp, put back after), those passes are recorded (54 recorded; 8 dropped for dynamic slots, 4 "not prepared", 15 other) and CS_ShadowTileClassify too. The 20x12 reveal mask and the 2560x1440 lighting target still show nothing in the three captured frames.
  • What the chain still lacks here: the three classification programs with LDS and a group barrier (CS_ShadowUnifiedClearRaster, CS_CalcRasterClassificationListCounts, CS_WriteRasterClassificationResults), outside the branch's scope; #1433 targets that case, not tested here.

One run per configuration. Context for the lighting chain is on #841.

**@⁠SantannaCarlos** on GitHub · 2026-11-24 18:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7140273927) @⁠r4tedx in-game data on the cascade-shadow chain with your wave-per-group branch (`05c7cbb`), RTX 4070, on the 4070 stack from #841 (`main` + #493 + #876 + this PR with #223/#233/#320 + #116 + #984 + #949 + #1020 + #1198 + #1019), 10-minute world runs, a local writer trace: - With the branch, the 18 `CS_ShadowRenderTiled*` programs and `CS_ComputeInfiniteRRIntensity` translate and validate (offline, 32 lanes), and the run has no pipeline refused and no device removal. - The title dispatches every cascade-shadow pass through `ExecuteIndirect`: 343 of 343 `CS_ShadowRenderTiled*` commands in the trace were `indirect kind 2`, and all were dropped as "not prepared on the host" (the indirect limit the branch states). So the indirect path is not optional for this title. - With a local patch equivalent to the split dispatch on your `testers/indirect-wave-dispatch` branch (the record's X times the group's waves in the argument clamp, put back after), those passes are recorded (54 recorded; 8 dropped for dynamic slots, 4 "not prepared", 15 other) and `CS_ShadowTileClassify` too. The 20x12 reveal mask and the 2560x1440 lighting target still show nothing in the three captured frames. - What the chain still lacks here: the three classification programs with LDS and a group barrier (`CS_ShadowUnifiedClearRaster`, `CS_CalcRasterClassificationListCounts`, `CS_WriteRasterClassificationResults`), outside the branch's scope; #1433 targets that case, not tested here. One run per configuration. Context for the lighting chain is on #841.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 18:13 UTC · original

@⁠SantannaCarlos, thank you; that is the measurement the branch needed, and it reorders my list.

  • The indirect path first. 343 of 343 cascade-shadow commands going through ExecuteIndirect settles that the branch's "indirect dispatches of multi-wave shaders are dropped" is not a detail for this title. The rewrite for it is in review on the fork (r4tedx/VIctory#11): the record's X scaled by the group's waves into a list-owned buffer, the title's arguments and count left untouched. One caution about the version on testers/indirect-wave-dispatch (831cdb3), in case your local patch copies its shader: its budget step is a compare-and-swap retry loop, and a pass with thousands of records aborted on an RTX 5070 here with nvlddmkm errors; the form in review replaces it with one atomic add and a refund, and that ran the same workload once with correct values and no driver event. With one record per dispatch, as in your trace, the loop is unlikely to bite, but I would not keep it. I will post here when the pass is merged into the branch.
  • The three classification programs. They are in the group that is left: offline, all 20 programs the branch still stops for their group size share LDS between their console waves and meet at s_barrier (10 in groups of 1024 threads, 6 of 256, 2 of 512, 2 of 128), so "one host group per console wave" cannot take them; their waves have to stay one host group. That is the next design step in docs/wave64-on-wave32.md. I have not looked at #1433 yet and will, since it aims at exactly that.
  • CS_ComputeInfiniteRRIntensity translating is the section change at 05c7cbb (whole-wave sections in a group of 32 threads or fewer); good to see it confirmed outside this machine.

That the reveal mask and the lighting target still show nothing with the shadow passes recorded is worth keeping separate from this PR; #841 is the right place for it.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 18:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7140331631) @⁠SantannaCarlos, thank you; that is the measurement the branch needed, and it reorders my list. - **The indirect path first.** 343 of 343 cascade-shadow commands going through `ExecuteIndirect` settles that the branch's "indirect dispatches of multi-wave shaders are dropped" is not a detail for this title. The rewrite for it is in review on the fork ([r4tedx/VIctory#11](https://github.com/r4tedx/VIctory/pull/11)): the record's X scaled by the group's waves into a list-owned buffer, the title's arguments and count left untouched. One caution about the version on `testers/indirect-wave-dispatch` (`831cdb3`), in case your local patch copies its shader: its budget step is a compare-and-swap retry loop, and a pass with thousands of records aborted on an RTX 5070 here with `nvlddmkm` errors; the form in review replaces it with one atomic add and a refund, and that ran the same workload once with correct values and no driver event. With one record per dispatch, as in your trace, the loop is unlikely to bite, but I would not keep it. I will post here when the pass is merged into the branch. - **The three classification programs.** They are in the group that is left: offline, all 20 programs the branch still stops for their group size share LDS between their console waves and meet at `s_barrier` (10 in groups of 1024 threads, 6 of 256, 2 of 512, 2 of 128), so "one host group per console wave" cannot take them; their waves have to stay one host group. That is the next design step in `docs/wave64-on-wave32.md`. I have not looked at #1433 yet and will, since it aims at exactly that. - **`CS_ComputeInfiniteRRIntensity` translating** is the section change at `05c7cbb` (whole-wave sections in a group of 32 threads or fewer); good to see it confirmed outside this machine. That the reveal mask and the lighting target still show nothing with the shadow passes recorded is worth keeping separate from this PR; #841 is the right place for it. AI-assisted (Claude Code).
Author
Owner

@⁠JFIREonFIRE on GitHub · 2026-11-24 18:18 UTC · original

I compared the open wave64-on-32-lane approaches on one set of shaders: the 320 compute programs from a retail 1.0.2.1 world run that an RTX 3090 (driver 621.01, Windows 11, lanes 32..32) refuses on main ffe310e. Every one of them declares WaveSize(64). Each branch was built in its own target dir. I ran victory translate --pipelines --list over the same 320 containers, so a pipeline here means the driver created it. Output was not checked, and none of this comes from a title run.

branch (head) pipelines created what is still refused
main ffe310e 0 / 320 320 driver E_INVALIDARG
#223 714b818 0 refused at translation instead (214 lane layout, 106 one-wave LDS)
#189 54b333f 94 110 LDS without a uniform fence, 66 ballot in divergent flow, 42 readfirstlane in divergent flow, 3 cross-lane read, 3 reduction, 2 LDS > 32 KiB
#233 ededb1b 98 116 lane layout, 106 one-wave LDS (the same 98 another tester reported)
#439 28aca3b (on #320, #233, #223) 280 36 groups of more than 64 threads, 4 whole-wave sections
#734's wave64-emulation 61b04f7 71 * 212 step across lanes in lane-dependent code, 36 several waves

* That branch only learns the host's lanes in victory-gpu at device creation. translate --pipelines never calls emit::set_host_wave64, so the tool emits WaveSize(64) and the driver refuses all 319 it emits. The 71 is with one local line added after Host::new in translate.rs: set_host_wave64(32, 32).

#189 and #734's branch get nothing #439 doesn't, except 4 programs:

  • 53c21e950d143cc7, d5f011b145497918 and e18931c72af42e46. #439 refuses them as a whole-wave section. #189 and #734 both create pipelines for them.
  • 4b57ec4af6de25fe. #439 refuses it as a group of more than 64 threads. #189 creates a pipeline for it.

Across all branches, 284 of the 320 get a pipeline. That leaves 36 that no open branch handles: 35 groups of several 64-lane waves (#439 says that is the next step, on a fork branch), plus one whole-wave section, 25328ea424d08c00.

On this card, #439 is the stack that turns most of the NVIDIA refusals into working pipelines.

AI-assisted (Claude Code); the numbers are from the runs above.

**@⁠JFIREonFIRE** on GitHub · 2026-11-24 18:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7140465446) I compared the open wave64-on-32-lane approaches on one set of shaders: the 320 compute programs from a retail 1.0.2.1 world run that an RTX 3090 (driver 621.01, Windows 11, lanes 32..32) refuses on `main` `ffe310e`. Every one of them declares `WaveSize(64)`. Each branch was built in its own target dir. I ran `victory translate --pipelines --list` over the same 320 containers, so a pipeline here means the driver created it. Output was not checked, and none of this comes from a title run. | branch (head) | pipelines created | what is still refused | |---|---:|---| | `main` `ffe310e` | 0 / 320 | 320 driver `E_INVALIDARG` | | #223 `714b818` | 0 | refused at translation instead (214 lane layout, 106 one-wave LDS) | | #189 `54b333f` | 94 | 110 LDS without a uniform fence, 66 ballot in divergent flow, 42 readfirstlane in divergent flow, 3 cross-lane read, 3 reduction, 2 LDS > 32 KiB | | #233 `ededb1b` | 98 | 116 lane layout, 106 one-wave LDS (the same 98 another tester reported) | | **#439 `28aca3b`** (on #320, #233, #223) | **280** | 36 groups of more than 64 threads, 4 whole-wave sections | | #734's `wave64-emulation` `61b04f7` | 71 * | 212 step across lanes in lane-dependent code, 36 several waves | \* That branch only learns the host's lanes in `victory-gpu` at device creation. `translate --pipelines` never calls `emit::set_host_wave64`, so the tool emits `WaveSize(64)` and the driver refuses all 319 it emits. The 71 is with one local line added after `Host::new` in `translate.rs`: `set_host_wave64(32, 32)`. #189 and #734's branch get nothing #439 doesn't, except 4 programs: - `53c21e950d143cc7`, `d5f011b145497918` and `e18931c72af42e46`. #439 refuses them as a whole-wave section. #189 and #734 both create pipelines for them. - `4b57ec4af6de25fe`. #439 refuses it as a group of more than 64 threads. #189 creates a pipeline for it. Across all branches, 284 of the 320 get a pipeline. That leaves 36 that no open branch handles: 35 groups of several 64-lane waves (#439 says that is the next step, on a fork branch), plus one whole-wave section, `25328ea424d08c00`. On this card, #439 is the stack that turns most of the NVIDIA refusals into working pipelines. AI-assisted (Claude Code); the numbers are from the runs above.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 18:20 UTC · original

@⁠JFIREonFIRE, thank you; the same 320 containers through every branch, each built in its own target dir and counted by pipelines the driver really created, is the comparison this needed. Your 280 with 36 + 4 left matches what I count offline for this head (36 groups of more than 64 threads, 4 whole-wave sections).

On the five programs you name, looked up by hash in my offline listings (local title data, CPU only) for this PR and for the branch after it (shader/wave-per-group, 05c7cbb), 32-lane host:

program this PR the branch
53c21e950d143cc7 a whole-wave section validated
e18931c72af42e46 a whole-wave section validated
25328ea424d08c00 a whole-wave section validated
d5f011b145497918 a whole-wave section still refused
4b57ec4af6de25fe a group of more than 64 threads still refused

The first three are wave64 programs in groups of 32 threads or fewer: the lower half alone, so their sections need nothing exchanged; that went into the branch today, and it covers the one you list as handled by no open branch (25328ea424d08c00). d5f011b145497918 is a section in another group shape and stays open. 4b57ec4af6de25fe shares LDS across its console waves, as do all 20 programs the branch still stops for their group size; "one host group per console wave" takes the other 16 or so of your 36 (offline: 23 of the 43 in the pack leave that reason there, 20 of them validating).

Pipelines created is the right first measure and, as you say, it is not output. For that the stack has the per-lane readback tests, and for the title the runs above.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 18:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7140500110) @⁠JFIREonFIRE, thank you; the same 320 containers through every branch, each built in its own target dir and counted by pipelines the driver really created, is the comparison this needed. Your 280 with 36 + 4 left matches what I count offline for this head (36 groups of more than 64 threads, 4 whole-wave sections). On the five programs you name, looked up by hash in my offline listings (local title data, CPU only) for this PR and for the branch after it ([`shader/wave-per-group`](https://github.com/r4tedx/VIctory/tree/shader/wave-per-group), `05c7cbb`), 32-lane host: | program | this PR | the branch | |---|---|---| | `53c21e950d143cc7` | `a whole-wave section` | validated | | `e18931c72af42e46` | `a whole-wave section` | validated | | `25328ea424d08c00` | `a whole-wave section` | validated | | `d5f011b145497918` | `a whole-wave section` | still refused | | `4b57ec4af6de25fe` | `a group of more than 64 threads` | still refused | The first three are wave64 programs in groups of 32 threads or fewer: the lower half alone, so their sections need nothing exchanged; that went into the branch today, and it covers the one you list as handled by no open branch (`25328ea424d08c00`). `d5f011b145497918` is a section in another group shape and stays open. `4b57ec4af6de25fe` shares LDS across its console waves, as do all 20 programs the branch still stops for their group size; "one host group per console wave" takes the other 16 or so of your 36 (offline: 23 of the 43 in the pack leave that reason there, 20 of them validating). Pipelines created is the right first measure and, as you say, it is not output. For that the stack has the per-lane readback tests, and for the title the runs above. AI-assisted (Claude Code).
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 18:36 UTC · original

On Windows 11 with a physical RTX 5070, this head created pipelines for 8/8 compute shaders that the renderer actually reported dropping near mission loading. On the same head, translating the same eight with Target::ANY gave 0/8. The only change between these two columns was passing the detected device target to translate_for.

Check at 28aca3b7 Target::ANY host.target()
Passed SDK DXIL validation 8/8 8/8
Created compute PSO on the RTX 5070 0/8 8/8

The baseline reported 32..32 wave lanes through D3D12 OPTIONS1. All eight baseline shaders declared WaveSize=64. Their root signatures were created successfully before compute PSO creation returned an invalid-parameter error. A two-case, no-resource SM 6.6 compute fixture with a 64-thread group reproduced the device boundary when changing only [WaveSize(32)] to [WaveSize(64)].

The eight identities came from the renderer’s missing-pipeline reports surrounding a fence-confirmed texture readback. In the later reporting interval their rates were 30, 24, 17, 15, 15, 11, 11 and 6 dropped attempts per frame. Identical inputs on #192 at 4a365e3a created 3/8, #189 at 54b333fc in the device-recommended mode created 4/8, and #233 at ededb1ba in the device-targeted mode created 1/8. Those are independent PR heads.

The same #439 test still refused translation of 24 other compute shaders named by those drop reports, in both target modes. The check ends at pipeline creation. Actual shader dispatch, output values and visible gameplay on this revision remain unverified.

Tested locally with SDK validator 10.0.26100.0 and adapter identity checked by D3D12 device LUID. AI-assisted investigation.

**@⁠jeremygold02** on GitHub · 2026-11-24 18:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7140892231) On Windows 11 with a physical RTX 5070, this head created pipelines for **8/8 compute shaders that the renderer actually reported dropping near mission loading**. On the same head, translating the same eight with `Target::ANY` gave 0/8. The only change between these two columns was passing the detected device target to `translate_for`. | Check at `28aca3b7` | `Target::ANY` | `host.target()` | |---|---:|---:| | Passed SDK DXIL validation | 8/8 | 8/8 | | Created compute PSO on the RTX 5070 | 0/8 | 8/8 | The baseline reported 32..32 wave lanes through D3D12 OPTIONS1. All eight baseline shaders declared `WaveSize=64`. Their root signatures were created successfully before compute PSO creation returned an invalid-parameter error. A two-case, no-resource SM 6.6 compute fixture with a 64-thread group reproduced the device boundary when changing only `[WaveSize(32)]` to `[WaveSize(64)]`. The eight identities came from the renderer’s missing-pipeline reports surrounding a fence-confirmed texture readback. In the later reporting interval their rates were 30, 24, 17, 15, 15, 11, 11 and 6 dropped attempts per frame. Identical inputs on #192 at `4a365e3a` created 3/8, #189 at `54b333fc` in the device-recommended mode created 4/8, and #233 at `ededb1ba` in the device-targeted mode created 1/8. Those are independent PR heads. The same #439 test still refused translation of 24 other compute shaders named by those drop reports, in both target modes. The check ends at pipeline creation. Actual shader dispatch, output values and visible gameplay on this revision remain unverified. Tested locally with SDK validator 10.0.26100.0 and adapter identity checked by D3D12 device LUID. AI-assisted investigation.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 18:57 UTC · original

I independently ran exact 28aca3b's nested shared-atomic/mask and masked LDS fixtures on AMD 32–64 and NVIDIA 32–32 with DXIL validation. The 2,048 lane-word checks and six masked LDS cases passed. WARP passed only the 4-lane capability case; this upstream harness did not enable GBV.

A current RTX 5080 title capture reports 128 refusals of caa78b8ca62bc3d6 and 76 admitted calls of 3b90165a77d95cdf on older #189-derived rgarage. Its LDS-fence diagnostic is specific to that planner; we still need #439's outcome for the same two hashes. I've requested aggregate-only results on the same adapter and runtime stack, including effective wave mode, native thread-group shape and first resource-matched consumer. Your existing nested-mask fixture and multi-wave branch are useful controls; no new lowering is proposed here.

**@⁠aycow** on GitHub · 2026-11-24 18:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7141383772) I independently ran exact 28aca3b's nested shared-atomic/mask and masked LDS fixtures on AMD 32–64 and NVIDIA 32–32 with DXIL validation. The 2,048 lane-word checks and six masked LDS cases passed. WARP passed only the 4-lane capability case; this upstream harness did not enable GBV. A [current RTX 5080 title capture](https://git.gtahub.st/github/Marvisak--VIctory/issues/71) reports 128 refusals of caa78b8ca62bc3d6 and 76 admitted calls of 3b90165a77d95cdf on older #189-derived rgarage. Its LDS-fence diagnostic is specific to that planner; we still need #439's outcome for the same two hashes. I've requested aggregate-only results on the same adapter and runtime stack, including effective wave mode, native thread-group shape and first resource-matched consumer. Your existing nested-mask fixture and multi-wave branch are useful controls; no new lowering is proposed here.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 18:59 UTC · original

@⁠aycow, thank you for the independent run of both fixtures on a 32-64 and a 32-32 host.

On the two hashes: I looked for caa78b8ca62bc3d6 and 3b90165a77d95cdf in my offline listings and neither is there. Those listings cover the programs in shaders.rpf only (local title data, CPU only, 25,889 programs by container hash), so both must come from another container, and I cannot give this PR's outcome for them from here. 3b90165a77d95cdf was named earlier in this thread by @⁠timorjay as one of two native wave32 ray-tracing (BVH) programs that fail address translation; if that is right it is not a wave-size case and this PR would neither help nor hurt it.

What would answer it on the tester's side, without a title run: victory translate <the file that holds them> --host-lanes 32-32 --validate --list on this PR's head prints one line per program with its outcome and reason. The two lines for those hashes are all that is needed (hash, stage, outcome); nothing in them is game data beyond the shader's name, which can be left out.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 18:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7141428369) @⁠aycow, thank you for the independent run of both fixtures on a 32-64 and a 32-32 host. On the two hashes: I looked for `caa78b8ca62bc3d6` and `3b90165a77d95cdf` in my offline listings and neither is there. Those listings cover the programs in `shaders.rpf` only (local title data, CPU only, 25,889 programs by container hash), so both must come from another container, and I cannot give this PR's outcome for them from here. `3b90165a77d95cdf` was named earlier in this thread by @⁠timorjay as one of two native wave32 ray-tracing (BVH) programs that fail address translation; if that is right it is not a wave-size case and this PR would neither help nor hurt it. What would answer it on the tester's side, without a title run: `victory translate <the file that holds them> --host-lanes 32-32 --validate --list` on this PR's head prints one line per program with its outcome and reason. The two lines for those hashes are all that is needed (hash, stage, outcome); nothing in them is game data beyond the shader's name, which can be left out. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 19:40 UTC · original

@⁠SantannaCarlos, as promised: the indirect path is in the branch. shader/wave-per-group is now c734600.

  • Indirect dispatches of multi-wave shaders run (r4tedx/VIctory#11, by @⁠mohammadallami75-ops): for a shader emitted as one console wave per host group, a compute pass rewrites the title's dispatch records into a list-owned buffer with X scaled by the group's waves, honouring the count buffer; the title's argument and count buffers are left untouched, and ordinary shaders keep the in-place clamp. So CS_ShadowRenderTiled* should no longer be dropped as "not prepared on the host" for being indirect. The budget step is one atomic add with a refund, not the retry loop of the older testers/indirect-wave-dispatch version.
  • Also new on the branch since 05c7cbb: a program that counts a lane mask after a loop its lanes leave at different iterations now takes the console flow (Marvisak/VIctory#1498: the per-lane form gave 1 where the console counts 32, on every host, silently). Offline that moves about 300 wave32 compute programs to the console flow on a 32-lane host and changes no program's outcome. It is a behaviour change worth an A/B if you have the time: counts feeding culling and compaction are the candidates.

Checked here with synthetic programs only: both CI clippy commands clean; the suite passes on an RTX 5070 and a Radeon iGPU; a 6,000-record rewrite ran on the software renderer, the Radeon and once on the RTX 5070 without a driver event. I have no title run of it. If you rerun the cascade-shadow trace on c734600, the recorded / dropped counts for the shadow passes and whether the reveal mask changes are what I would most like to know. The three classification programs with LDS and a group barrier are still outside it.

The title was not used in these tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 19:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7142437150) @⁠SantannaCarlos, as promised: the indirect path is in the branch. [`shader/wave-per-group`](https://github.com/r4tedx/VIctory/tree/shader/wave-per-group) is now `c734600`. - **Indirect dispatches of multi-wave shaders run** ([r4tedx/VIctory#11](https://github.com/r4tedx/VIctory/pull/11), by @⁠mohammadallami75-ops): for a shader emitted as one console wave per host group, a compute pass rewrites the title's dispatch records into a list-owned buffer with X scaled by the group's waves, honouring the count buffer; the title's argument and count buffers are left untouched, and ordinary shaders keep the in-place clamp. So `CS_ShadowRenderTiled*` should no longer be dropped as "not prepared on the host" for being indirect. The budget step is one atomic add with a refund, not the retry loop of the older `testers/indirect-wave-dispatch` version. - **Also new on the branch since `05c7cbb`:** a program that counts a lane mask after a loop its lanes leave at different iterations now takes the console flow (Marvisak/VIctory#1498: the per-lane form gave 1 where the console counts 32, on every host, silently). Offline that moves about 300 wave32 compute programs to the console flow on a 32-lane host and changes no program's outcome. It is a behaviour change worth an A/B if you have the time: counts feeding culling and compaction are the candidates. Checked here with synthetic programs only: both CI clippy commands clean; the suite passes on an RTX 5070 and a Radeon iGPU; a 6,000-record rewrite ran on the software renderer, the Radeon and once on the RTX 5070 without a driver event. I have no title run of it. If you rerun the cascade-shadow trace on `c734600`, the recorded / dropped counts for the shadow passes and whether the reveal mask changes are what I would most like to know. The three classification programs with LDS and a group barrier are still outside it. The title was not used in these tests. AI-assisted (Claude Code).
Author
Owner

@⁠x3ero0 on GitHub · 2026-11-24 19:57 UTC · original

Before/after on a 32-lane NVIDIA card under Wine, offline and in the title.

Setup: RTX 5080, driver 620.70, CachyOS (kernel 7.3.5), GE-Proton11-6's Wine, d3d12.dll/d3d12core.dll built from vkd3d-proton 30b0eb9 beside the executable, diagnostics builds cross-built with cargo xwin, Series X 1.0.2.1, network off.

  • Before: main ffe310e + #177 + #259 (this card needs those two and the newer vkd3d-proton to get through pipeline creation at all).
  • After: this PR at 28aca3b with the same two on top (they apply cleanly).

The device reports host waves 32-32 lanes.

Offline: translate <pack> --pipelines, every pipeline created on the host

Before After (--host-lanes 32-32)
Compute programs emitted 1,441 of 2,582 1,420 of 2,582
Compute pipelines the host made 1,121 1,420
Compute pipelines refused (Invalid parameter.) 320 0
Vertex and pixel: emitted / pipelines 12,231 / 12,231 12,231 / 12,231
Mesh: emitted / pipelines 8,214 / 8,214 8,214 / 8,214

So 299 more compute pipelines exist on this card, nothing that was made before is lost, and the 21 programs no longer emitted are ones that were refused by the host before anyway.

One oddity, not reproduced: the first translate --pipelines run of the after build without --host-lanes ended one second in with glibc's double free or corruption (!prev), right after the second device was created (the first is the wave probe). Two repeats of the same command ran normally. I can't say whether that is this PR, Wine or the driver.

In the title: one 210 s run each, same scripted input

Before After
Compute pipelines refused 76 0
Host pipelines made 362 437
Shaders that do not translate 84 90
Last frame presented 1552 1561
How it ended title stop at +0x23cf683 (#1118) the same

Both runs reach their first 3D frame at frame 1550, so VICTORY_DUMP_TARGETS=1 at that frame gives a like-for-like look inside it:

Frame 1550 Before After
Render targets dumped, 320x180 and larger 121 144
Of those, with content (over 2% of texels not black) 25 44
The frame as presented black black

The clearest single difference: after, one 2560x1440 R8G8B8A8 target holds the scene's geometry, drawn in what looks like a per-primitive id colouring (large surfaces in the foreground, thin structures behind). Before, no target of that frame holds geometry; the nearest one is uniform noise. Several half- and full-resolution targets that were empty before also have content after.

Per the asset policy I am not attaching the captures; the numbers above are from them.

Limits: one run per build, one GPU, Wine only, and about a minute of world time before the +0x23cf683 stop in both builds. I did not run the PR's GPU tests on this machine.

**@⁠x3ero0** on GitHub · 2026-11-24 19:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7142853101) Before/after on a 32-lane NVIDIA card under Wine, offline and in the title. **Setup:** RTX 5080, driver 620.70, CachyOS (kernel 7.3.5), GE-Proton11-6's Wine, `d3d12.dll`/`d3d12core.dll` built from vkd3d-proton `30b0eb9` beside the executable, diagnostics builds cross-built with `cargo xwin`, Series X 1.0.2.1, network off. - **Before:** `main` `ffe310e` + #177 + #259 (this card needs those two and the newer vkd3d-proton to get through pipeline creation at all). - **After:** this PR at `28aca3b` with the same two on top (they apply cleanly). The device reports `host waves 32-32 lanes`. ### Offline: `translate <pack> --pipelines`, every pipeline created on the host | | Before | After (`--host-lanes 32-32`) | |---|---|---| | Compute programs emitted | 1,441 of 2,582 | 1,420 of 2,582 | | Compute pipelines the host made | 1,121 | 1,420 | | Compute pipelines refused (`Invalid parameter.`) | 320 | 0 | | Vertex and pixel: emitted / pipelines | 12,231 / 12,231 | 12,231 / 12,231 | | Mesh: emitted / pipelines | 8,214 / 8,214 | 8,214 / 8,214 | So 299 more compute pipelines exist on this card, nothing that was made before is lost, and the 21 programs no longer emitted are ones that were refused by the host before anyway. One oddity, not reproduced: the first `translate --pipelines` run of the after build without `--host-lanes` ended one second in with glibc's `double free or corruption (!prev)`, right after the second device was created (the first is the wave probe). Two repeats of the same command ran normally. I can't say whether that is this PR, Wine or the driver. ### In the title: one 210 s run each, same scripted input | | Before | After | |---|---|---| | Compute pipelines refused | 76 | 0 | | Host pipelines made | 362 | 437 | | Shaders that do not translate | 84 | 90 | | Last frame presented | 1552 | 1561 | | How it ended | title stop at `+0x23cf683` (#1118) | the same | Both runs reach their first 3D frame at frame 1550, so `VICTORY_DUMP_TARGETS=1` at that frame gives a like-for-like look inside it: | Frame 1550 | Before | After | |---|---|---| | Render targets dumped, 320x180 and larger | 121 | 144 | | Of those, with content (over 2% of texels not black) | 25 | 44 | | The frame as presented | black | black | The clearest single difference: after, one 2560x1440 `R8G8B8A8` target holds the scene's geometry, drawn in what looks like a per-primitive id colouring (large surfaces in the foreground, thin structures behind). Before, no target of that frame holds geometry; the nearest one is uniform noise. Several half- and full-resolution targets that were empty before also have content after. Per the asset policy I am not attaching the captures; the numbers above are from them. **Limits:** one run per build, one GPU, Wine only, and about a minute of world time before the `+0x23cf683` stop in both builds. I did not run the PR's GPU tests on this machine.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 06:51 UTC · original · reviewed

Verified locally on macOS 26 arm64, rustc 1.98.1, head 901eef9:

  • cargo test -p victory-shader --locked: 58 passed, 0 failed (+2 vs main's 56).

Semantic conflict with #235 (non-Windows build): this PR adds Host::target() (victory-gpu) and calls it from translate.rs:182, but #235's #[cfg(not(windows))] mod offhost stub Host has no target method. Merging both breaks the macOS/Linux build of the app crate:

error[E0599]: no method named `target` found for struct `offhost::Host`
   --> apps/victory/src/translate.rs:182:64

(Reproduced locally: #439 head + #235 head 16704a5 merged, no textual conflicts.)

Whichever PR lands second needs the stub updated, e.g. in offhost:

pub fn target(&self) -> victory_shader::emit::Target {
    victory_shader::emit::Target::ANY
}

(Host::new already returns Err there, so the method is unreachable at runtime — Target::ANY is the neutral value.)

The core wave64/LDS change itself is Windows-only runtime behavior I can't exercise here; the shader-crate side is green.

**@⁠catminou4** on GitHub · 2026-11-24 06:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#pullrequestreview-6034881283) · **reviewed** Verified locally on macOS 26 arm64, rustc 1.98.1, head `901eef9`: - `cargo test -p victory-shader --locked`: **58 passed, 0 failed** (+2 vs main's 56). **Semantic conflict with #235 (non-Windows build):** this PR adds `Host::target()` (victory-gpu) and calls it from translate.rs:182, but #235's `#[cfg(not(windows))] mod offhost` stub `Host` has no `target` method. Merging both breaks the macOS/Linux build of the app crate: ``` error[E0599]: no method named `target` found for struct `offhost::Host` --> apps/victory/src/translate.rs:182:64 ``` (Reproduced locally: #439 head + #235 head `16704a5` merged, no textual conflicts.) Whichever PR lands second needs the stub updated, e.g. in `offhost`: ```rust pub fn target(&self) -> victory_shader::emit::Target { victory_shader::emit::Target::ANY } ``` (`Host::new` already returns `Err` there, so the method is unreachable at runtime — `Target::ANY` is the neutral value.) The core wave64/LDS change itself is Windows-only runtime behavior I can't exercise here; the shader-crate side is green.
Author
Owner

@⁠Sil3ntGam3r on GitHub · 2026-11-24 21:07 UTC · original

@⁠r4tedx a follow-up on the mesh side of the stack, and one correction.

Same stack as my last two comments (#180 aa69258 + bf0f951 + #431 + #876 + #334), now with #298 (54f97db) and #660 (19b02ec) on top. RTX 3070, driver 621.14, Series X, diag build, cold cache. Translation caught up in the world this time. The head is now 28aca3b, but since bf0f951 it only adds tests and the adapter filter, so the translator results below should be the same on it.

  • Scenery still reaches the G-buffer, and ground, roads and buildings are still missing. I checked the dumped full-screen targets.

  • 16 mesh programs are still refused. 9 of them stop at "a lane mask read as data":

    program offset
    093c64546c55554e 0x1b74
    0bd4d80ad23b106b 0x1288
    235e56869c1ea883 0x1ccc
    41b1fbed3ee9b8ff 0x1f0c
    4ee6e34d8e008c63 0x1ea4
    63083c777948927a 0x1cb4
    c0b56ee903fc6dfb 0x1ccc
    ef5409053e14aa82 0x1a54
    fc2e14d6971785dd 0x1edc

    The other 7 are "a descriptor read from the first lane of computed VGPRs" (4) and "a scalar memory read as data" (3).

    Offline over the whole shaders.rpf (victory translate --validate --host-lanes 32-32, same build), 160 mesh programs stop at "a lane mask read as data", the same number as before #298 and #660. So the 9 above are the ones this scene reached.

  • This refusal comes from main's lowering, not from this PR. On a #189 tree without #180, 5 of the 9 stop at the same offsets. The other 4 (235e…, 41b1…, 4ee6…, c0b5…) stop earlier there, at "a scalar memory read as data", and get past that on this stack, probably because of #180.

  • #298 and #660 don't change them. The 8 that the run before the merge reached stop at the same offsets in both runs (0bd4… was only reached this time). #298 targets a different refusal, "a lane mask holding lanes elsewhere read as data".

One more thing from the same offline run: with #298, 27 CS_RaytracingResolve variants get past main's "a lane mask read as data". They now stop at this PR's "a program the console structure cannot hold" (at 0x0, from 36e05dc). In the title run, 11 compute programs now stop there.

Is the mask-data fix in mohammadallami75-ops's Part 1 (r4tedx/VIctory#13), or the lane-mask count change now on shader/wave-per-group c734600, meant for this refusal? If either is, which commit should I test? Whether these mesh programs draw the ground and buildings is only my guess; that run would tell.

Correction to my scenery comment: 102 was a count taken partway through the run. The full log of that run has 154 unique programs not translated (13 mesh). No other number in that comment changes.

(AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 21:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7144508898) @⁠r4tedx a follow-up on the mesh side of the stack, and one correction. Same stack as my last two comments (#180 `aa69258` + `bf0f951` + #431 + #876 + #334), now with #298 (`54f97db`) and #660 (`19b02ec`) on top. RTX 3070, driver 621.14, Series X, diag build, cold cache. Translation caught up in the world this time. The head is now `28aca3b`, but since `bf0f951` it only adds tests and the adapter filter, so the translator results below should be the same on it. - **Scenery still reaches the G-buffer, and ground, roads and buildings are still missing.** I checked the dumped full-screen targets. - **16 mesh programs are still refused.** 9 of them stop at "a lane mask read as data": | program | offset | |---|---| | `093c64546c55554e` | `0x1b74` | | `0bd4d80ad23b106b` | `0x1288` | | `235e56869c1ea883` | `0x1ccc` | | `41b1fbed3ee9b8ff` | `0x1f0c` | | `4ee6e34d8e008c63` | `0x1ea4` | | `63083c777948927a` | `0x1cb4` | | `c0b56ee903fc6dfb` | `0x1ccc` | | `ef5409053e14aa82` | `0x1a54` | | `fc2e14d6971785dd` | `0x1edc` | The other 7 are "a descriptor read from the first lane of computed VGPRs" (4) and "a scalar memory read as data" (3). Offline over the whole `shaders.rpf` (`victory translate --validate --host-lanes 32-32`, same build), 160 mesh programs stop at "a lane mask read as data", the same number as before #298 and #660. So the 9 above are the ones this scene reached. - **This refusal comes from `main`'s lowering, not from this PR.** On a #189 tree without #180, 5 of the 9 stop at the same offsets. The other 4 (`235e…`, `41b1…`, `4ee6…`, `c0b5…`) stop earlier there, at "a scalar memory read as data", and get past that on this stack, probably because of #180. - **#298 and #660 don't change them.** The 8 that the run before the merge reached stop at the same offsets in both runs (`0bd4…` was only reached this time). #298 targets a different refusal, "a lane mask holding lanes elsewhere read as data". One more thing from the same offline run: with #298, 27 `CS_RaytracingResolve` variants get past `main`'s "a lane mask read as data". They now stop at this PR's "a program the console structure cannot hold" (at `0x0`, from `36e05dc`). In the title run, 11 compute programs now stop there. Is the mask-data fix in mohammadallami75-ops's Part 1 (r4tedx/VIctory#13), or the lane-mask count change now on `shader/wave-per-group` `c734600`, meant for this refusal? If either is, which commit should I test? Whether these mesh programs draw the ground and buildings is only my guess; that run would tell. Correction to my scenery comment: 102 was a count taken partway through the run. The full log of that run has 154 unique programs not translated (13 mesh). No other number in that comment changes. (AI-assisted test run.)
Author
Owner

@⁠mohammadallami75-ops on GitHub · 2026-11-25 00:12 UTC · original

@⁠Sil3ntGam3r Thanks for the hashes and the offline comparison. For a compute-only A/B, use 05c7cbb as the baseline and 88b38e8 as the test. That revision includes the broader joined-mask rule (eaf0d36) and the Wave32 regression. c734600 already contains both if you also need the indirect-dispatch changes. The branch rule supersedes my Part 1 for this test and also catches masks built from a scalar zero.

The rule is in compute lowering, so I wouldn’t expect it to clear the nine mesh refusals. For the CS_RaytracingResolve variants that already reach a program the console structure cannot hold, the rule can select console flow, but the same control-flow limits still apply. If you run the A/B, please compare the first refusal for the same hashes at 32-32. That will show whether any of those variants make it further before another title run.

AI-assisted.

**@⁠mohammadallami75-ops** on GitHub · 2026-11-25 00:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7148272715) @⁠Sil3ntGam3r Thanks for the hashes and the offline comparison. For a compute-only A/B, use `05c7cbb` as the baseline and [`88b38e8`](https://github.com/r4tedx/VIctory/commit/88b38e8262c4b0242d84d640990e1e10565b78f9) as the test. That revision includes the broader joined-mask rule (`eaf0d36`) and the Wave32 regression. `c734600` already contains both if you also need the indirect-dispatch changes. The branch rule supersedes my Part 1 for this test and also catches masks built from a scalar zero. The rule is in compute lowering, so I wouldn’t expect it to clear the nine mesh refusals. For the `CS_RaytracingResolve` variants that already reach `a program the console structure cannot hold`, the rule can select console flow, but the same control-flow limits still apply. If you run the A/B, please compare the first refusal for the same hashes at `32-32`. That will show whether any of those variants make it further before another title run. AI-assisted.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:18 UTC · original · edited 2026-11-26 08:25 UTC

Automated triage for the maintainers.

Needs work. I reviewed the two commits new since 2658128.

  • e2d3cfd reads right. console::leaves_title_memory_out in the new emit/lower/console.rs keeps a wave64 program out of the console flow in halves when it reaches title memory by address (root_memory) and also shares LDS, has whole-wave sections or permutes lanes. The refusal goes in at the same place as the other split refusals in Lower. lds_in_halves_keeps_out_of_programs_reaching_title_memory checks both sides.
  • 7587052 breaks the asset policy (docs/asset-policy.md: no "decompiled or disassembled code" from the game, in any form, fixtures included). In emit/split_tests.rs, SECTION_SUM and SECTION_PREFIX are described as the console compiler's sequences "as the tile classifier bad01f53f53248e5 has it". The tests whole_wave_sums_of_one_lane and whole_wave_prefixes_of_one_lane also follow "the classifier's" append and offsets. That makes these encodings words copied from one of the title's programs, not synthetic data we wrote. Please drop 7587052 from the branch by rewriting it (force-push), not with a follow-up commit. Then, if you want, add tests whose sequences are written from the ISA alone and that do not refer to a title program. A DPP/v_permlanex16/v_readlane reduction built from the RDNA2 ISA guide is fine.

Still blocking from the last triage:

  • The PR is the top of an open stack (#223, #233, #320) and waits on the maintainer's choice in #233.
  • Your note says it needs #2118 (still open) or an equivalent BVH builder gate first.
  • crissuper20's GTX 1650 hang is not explained yet.

What would change the verdict: 7587052 removed from the branch history, then the stack question and the builder gate settled.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7148365471) · edited 2026-11-26 08:25 UTC <!-- victory-triage v1 head=75870526ba6c237bee02f365b0e528d2637babec verdict=needs-work at=2026-11-26T08:20:18Z --> Automated triage for the maintainers. **Needs work.** I reviewed the two commits new since `2658128`. - `e2d3cfd` reads right. `console::leaves_title_memory_out` in the new `emit/lower/console.rs` keeps a wave64 program out of the console flow in halves when it reaches title memory by address (`root_memory`) and also shares LDS, has whole-wave sections or permutes lanes. The refusal goes in at the same place as the other split refusals in `Lower`. `lds_in_halves_keeps_out_of_programs_reaching_title_memory` checks both sides. - `7587052` breaks the asset policy (`docs/asset-policy.md`: no "decompiled or disassembled code" from the game, in any form, fixtures included). In `emit/split_tests.rs`, `SECTION_SUM` and `SECTION_PREFIX` are described as the console compiler's sequences "as the tile classifier `bad01f53f53248e5` has it". The tests `whole_wave_sums_of_one_lane` and `whole_wave_prefixes_of_one_lane` also follow "the classifier's" append and offsets. That makes these encodings words copied from one of the title's programs, not synthetic data we wrote. Please drop `7587052` from the branch by rewriting it (force-push), not with a follow-up commit. Then, if you want, add tests whose sequences are written from the ISA alone and that do not refer to a title program. A DPP/`v_permlanex16`/`v_readlane` reduction built from the RDNA2 ISA guide is fine. Still blocking from the last triage: - The PR is the top of an open stack (#223, #233, #320) and waits on the maintainer's choice in #233. - Your note says it needs #2118 (still open) or an equivalent BVH builder gate first. - crissuper20's GTX 1650 hang is not explained yet. What would change the verdict: `7587052` removed from the branch history, then the stack question and the builder gate settled. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 07:08 UTC · original

Updated for the needs-rebase triage: main (940d32f) is merged in through #320 and #233, head 5a11cf4 (merge commits, no rebase). It carries #233's implicit-sample guard; its recursion guard was here already.

Two auto-merged regions were semantically wrong and are rewritten:

  • ds_bpermute_b32: both lowerings survived the merge. One arm is kept, in main's style (16-bit offset, lane_bit_of), gathering within the reader's 32-lane half as this stack does for wave64: GFX10's backward permute in wave64 does not cross the halves (AMD's RDNA 2 ISA reference). For wave32 it equals main's.
  • v_cndmask_b32: uniform selectors lower as on main; numeric ones test the console lane's bit where console lanes exist outside the in-half form, and are otherwise deferred in compute.

Checks: both CI clippy commands clean. The victory-shader suite passed on an AMD Radeon iGPU only (287 passed, 3 ignored, float_whole_wave_reductions_join_both_host_waves skipped while the machine's GPUs are on a hold) before the last merge, whose only change here is covered by a CPU-only test (passed). Not run on a 32-lane card today (see #233). A differential of every test program's module before and after the merge: 122 of 136 identical apart from main's heap clamp, the other 14 the bpermute programs, re-expressed equivalently.

Offline counts of this head against main (local title data, CPU only) are running; I will add them here.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-25 07:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7155540668) Updated for the needs-rebase triage: `main` (`940d32f`) is merged in through #320 and #233, head **`5a11cf4`** (merge commits, no rebase). It carries #233's implicit-sample guard; its recursion guard was here already. Two auto-merged regions were semantically wrong and are rewritten: - `ds_bpermute_b32`: both lowerings survived the merge. One arm is kept, in `main`'s style (16-bit offset, `lane_bit_of`), gathering within the reader's 32-lane half as this stack does for wave64: GFX10's backward permute in wave64 does not cross the halves (AMD's RDNA 2 ISA reference). For wave32 it equals `main`'s. - `v_cndmask_b32`: uniform selectors lower as on `main`; numeric ones test the console lane's bit where console lanes exist outside the in-half form, and are otherwise deferred in compute. Checks: both CI clippy commands clean. The `victory-shader` suite passed on an AMD Radeon iGPU only (287 passed, 3 ignored, `float_whole_wave_reductions_join_both_host_waves` skipped while the machine's GPUs are on a hold) before the last merge, whose only change here is covered by a CPU-only test (passed). Not run on a 32-lane card today (see #233). A differential of every test program's module before and after the merge: 122 of 136 identical apart from `main`'s heap clamp, the other 14 the bpermute programs, re-expressed equivalently. Offline counts of this head against `main` (local title data, CPU only) are running; I will add them here. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 07:13 UTC · original

The offline counts for 5a11cf4, as promised (local title data, CPU only, counts only; victory translate shaders.rpf --host-lanes 32-32 --validate --list, compared program by program with main 940d32f's own listing, 25,889 programs):

vertex + pixel emitted / validated compute mesh
5a11cf4, 32-lane host 14,205 / 13,338 2,588 / 1,860 8,765 / 8,694
  • Validated here, not on main: 21 compute programs (16 that main stops at a register joining a lane mask and data, read as data, 5 at a lane-mask join of an untracked mask).
  • Validated on main, refused here: 47 compute programs: 43 console wave64 lanes in a group of more than 64 threads and 4 a whole-wave section of a wave64, each on a host without 64-lane waves. main emits all 47 with WaveSize(64), which a 32-lane driver refuses at pipeline creation, so on such a card none of them ran before either. They are the known remainder of this stack.
  • Nothing else differs from main: no vertex, pixel or mesh outcome changes. (867 vertex shaders fail validation with "Flags must match usage" on main and equally here; that is main's own, #1973 / #1987.)

Upstream CI passed on all four heads (02b955f, 7147671, eb12838, 5a11cf4), and each now merges cleanly into main.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-25 07:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7155620731) The offline counts for `5a11cf4`, as promised (local title data, CPU only, counts only; `victory translate shaders.rpf --host-lanes 32-32 --validate --list`, compared program by program with `main` `940d32f`'s own listing, 25,889 programs): | | vertex + pixel emitted / validated | compute | mesh | |---|---|---|---| | `5a11cf4`, 32-lane host | 14,205 / 13,338 | 2,588 / 1,860 | 8,765 / 8,694 | - **Validated here, not on `main`:** 21 compute programs (16 that `main` stops at `a register joining a lane mask and data, read as data`, 5 at `a lane-mask join of an untracked mask`). - **Validated on `main`, refused here:** 47 compute programs: 43 `console wave64 lanes in a group of more than 64 threads` and 4 `a whole-wave section of a wave64`, each `on a host without 64-lane waves`. `main` emits all 47 with `WaveSize(64)`, which a 32-lane driver refuses at pipeline creation, so on such a card none of them ran before either. They are the known remainder of this stack. - **Nothing else differs** from `main`: no vertex, pixel or mesh outcome changes. (867 vertex shaders fail validation with "Flags must match usage" on `main` and equally here; that is `main`'s own, #1973 / #1987.) Upstream CI passed on all four heads (`02b955f`, `7147671`, `eb12838`, `5a11cf4`), and each now merges cleanly into `main`. AI-assisted (Claude Code).
Author
Owner

@⁠desplmfao on GitHub · 2026-11-25 10:20 UTC · original

@⁠r4tedx thanks for this. On an RTX 5080 under Linux/Proton (vkd3d-proton 3.2.0) it's what stops the title's wave64 compute from hanging the GPU in the intro.

One thing came up under vkd3d-proton. Some console-flow programs (InstanceCulling:CS_Prop_BatchNoCull, deferred_tiled:CS_LaserLightShadowRaytracing, and the big *:CS_RaytracingResolve ones) end up with a block that branches back to two loop headers, or with a header that has three back edges. dxil-spirv's structurizer recurses on that until the stack runs out, so the process dies or the pipeline workers stall while those pipelines are created. main has the same shapes, but without lane reads, and dxil-spirv only walks the graph when there are lane reads.

#2309 fixes it in the bitcode writer, stacked on this PR: one back edge per loop header (powplusplus's commit from #1885) and one per block. It doesn't touch lower.rs or wave.rs, and only the 8 programs with those shapes change. The shader suite gives 178 passed, 0 failed under Proton. If you'd rather take it into #439 directly, that's fine with me.

**@⁠desplmfao** on GitHub · 2026-11-25 10:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7159553825) @⁠r4tedx thanks for this. On an RTX 5080 under Linux/Proton (vkd3d-proton 3.2.0) it's what stops the title's wave64 compute from hanging the GPU in the intro. One thing came up under vkd3d-proton. Some console-flow programs (`InstanceCulling:CS_Prop_BatchNoCull`, `deferred_tiled:CS_LaserLightShadowRaytracing`, and the big `*:CS_RaytracingResolve` ones) end up with a block that branches back to two loop headers, or with a header that has three back edges. dxil-spirv's structurizer recurses on that until the stack runs out, so the process dies or the pipeline workers stall while those pipelines are created. `main` has the same shapes, but without lane reads, and dxil-spirv only walks the graph when there are lane reads. #2309 fixes it in the bitcode writer, stacked on this PR: one back edge per loop header (powplusplus's commit from #1885) and one per block. It doesn't touch `lower.rs` or `wave.rs`, and only the 8 programs with those shapes change. The shader suite gives 178 passed, 0 failed under Proton. If you'd rather take it into #439 directly, that's fine with me.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 10:39 UTC · original

@⁠desplmfao thanks. I reviewed #2309 at 91e3bdf. These are the checks I ran:

  • 364c1bc has the same patch ID as powplusplus's d48ec76 from #1885. The only difference is the cherry-pick trailer.
  • The writer change keeps branch conditions, arm order and PHI values for valid input. In both cases (several back edges into one header, and one block branching back to two headers) the latch PHI takes the original incoming value on each redirected edge. The empty-latch fold remaps the branch target and the PHI predecessor together, so a second fold cannot bring the old shape back.
  • On Windows I ran the single-threaded victory-shader suite on WARP, on 5a11cf48 plus the two commits: 290 passed, 2 failed, 3 ignored. All three latch tests passed. The two failures (gathers_at_a_level_match_the_hardware, permutes_read_the_lane_named_and_zero_from_lanes_left_out) also fail without your commits. This test used no title data and no hardware GPU. I did not reproduce the Proton run or the eight-program census; those are your results.
  • One issue is already in the code without your change. When both arms of a branch are back edges, branch_term increments only the taken header's loop counter, so the other header's counter PHI can be missing an input. The writer copies that incomplete list into the latch PHI. #1540 proposes per-edge counter guards for it.

I'll take both commits into #439 after the update that is in progress there, with authorship preserved, and post the new head here.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 10:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7159998690) @⁠desplmfao thanks. I reviewed #2309 at `91e3bdf`. These are the checks I ran: - `364c1bc` has the same patch ID as powplusplus's `d48ec76` from #1885. The only difference is the cherry-pick trailer. - The writer change keeps branch conditions, arm order and PHI values for valid input. In both cases (several back edges into one header, and one block branching back to two headers) the latch PHI takes the original incoming value on each redirected edge. The empty-latch fold remaps the branch target and the PHI predecessor together, so a second fold cannot bring the old shape back. - On Windows I ran the single-threaded `victory-shader` suite on WARP, on `5a11cf48` plus the two commits: 290 passed, 2 failed, 3 ignored. All three latch tests passed. The two failures (`gathers_at_a_level_match_the_hardware`, `permutes_read_the_lane_named_and_zero_from_lanes_left_out`) also fail without your commits. This test used no title data and no hardware GPU. I did not reproduce the Proton run or the eight-program census; those are your results. - One issue is already in the code without your change. When both arms of a branch are back edges, `branch_term` increments only the taken header's loop counter, so the other header's counter PHI can be missing an input. The writer copies that incomplete list into the latch PHI. #1540 proposes per-edge counter guards for it. I'll take both commits into #439 after the update that is in progress there, with authorship preserved, and post the new head here. AI-assisted
Author
Owner

@⁠desplmfao on GitHub · 2026-11-25 10:54 UTC · original

@⁠r4tedx thanks for the careful review, and yes, please take both into #439. Once the new head is up I'll check it here (Proton, RTX 5080, the same eight programs) and close #2309 as included. Noted on the pre-existing both-back-edges counter PHI; I'll leave that to #1540.

**@⁠desplmfao** on GitHub · 2026-11-25 10:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7160324713) @⁠r4tedx thanks for the careful review, and yes, please take both into #439. Once the new head is up I'll check it here (Proton, RTX 5080, the same eight programs) and close #2309 as included. Noted on the pre-existing both-back-edges counter PHI; I'll leave that to #1540.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 10:55 UTC · original

Pushed 3fab5a19: #320's d5f8f2ce merged up (no conflicts; whole keeps both #320's named-lane rule and this PR's ds_bpermute_b32 exception), and docs/architecture.md now names ds_permute_b32, which is not translated yet, as what still stops splitting. The description now cites RDNA 2 ISA §10.4.4 (pp. 96–97) for ds_bpermute_b32 working per 32-lane half, and notes that §12.13's pseudocode says mod 64.

Verified locally at 64a5be92 (the commit after it changes one doc sentence): clippy -D warnings clean (default and --all-features); victory-shader --lib on WARP, one test thread: 288 passed, 2 failed, 3 ignored, the 2 being the known hardware-only checks. No hardware adapter and no title data used.

The #2309 commits come next, as said above.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 10:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7160345526) Pushed `3fab5a19`: #320's `d5f8f2ce` merged up (no conflicts; `whole` keeps both #320's named-lane rule and this PR's `ds_bpermute_b32` exception), and `docs/architecture.md` now names `ds_permute_b32`, which is not translated yet, as what still stops splitting. The description now cites RDNA 2 ISA §10.4.4 (pp. 96–97) for `ds_bpermute_b32` working per 32-lane half, and notes that §12.13's pseudocode says `mod 64`. Verified locally at `64a5be92` (the commit after it changes one doc sentence): clippy `-D warnings` clean (default and `--all-features`); `victory-shader --lib` on WARP, one test thread: 288 passed, 2 failed, 3 ignored, the 2 being the known hardware-only checks. No hardware adapter and no title data used. The #2309 commits come next, as said above. AI-assisted
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 11:29 UTC · original

Following triage's scope point: #2309's bitcode-writer commits stay out of this PR. I am not pushing the local merge of them, and #439 stays at 3fab5a1.

@⁠desplmfao, that reverses what I said under #2309, sorry. Please keep #2309 open as its own PR. #439 passes CI at 3fab5a1 without them.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 11:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7161115503) Following triage's scope point: #2309's bitcode-writer commits stay out of this PR. I am not pushing the local merge of them, and #439 stays at `3fab5a1`. @⁠desplmfao, that reverses what I said under #2309, sorry. Please keep #2309 open as its own PR. #439 passes CI at `3fab5a1` without them. AI-assisted
Author
Owner

@⁠desplmfao on GitHub · 2026-11-25 11:37 UTC · original

@⁠r4tedx no problem, that makes sense. #2309 stays its own PR, now merged up to your 3fab5a1 with no conflicts. Its change is still only the two bitcode.rs commits.

**@⁠desplmfao** on GitHub · 2026-11-25 11:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7161291106) @⁠r4tedx no problem, that makes sense. #2309 stays its own PR, now merged up to your `3fab5a1` with no conflicts. Its change is still only the two `bitcode.rs` commits.
Author
Owner

@⁠hah346 on GitHub · 2026-11-25 12:38 UTC · original

Independent Windows / NVIDIA Turing validation of VIctory PR #439 at 3fab5a19f586c690fedf4578c1fb7b4c2de298dd.

  • Windows 11 build 26300, RTX 2060 (6 GiB), NVIDIA 616.64, Rust 1.98.1 x86_64-pc-windows-msvc, MSVC 14.51, DXIL validator 1.9.2602.17 from Windows SDK 10.0.26100.
  • Clean PR checkout: cargo +1.98.1 test -j 4 -p victory-shader --lib --locked split_tests -- --nocapture --test-threads=1 returned 33 passed, 0 failed, 0 ignored (26.60 s). Hardware readback explicitly reported the RTX 2060 with split true for LDS ordering (including the busy-half and masked-block cases), cross-half lane reads, integer and float reductions and prefixes, and 3D thread groups.
  • A/B for one_wave_shares_lds_in_instruction_order: I copied only that synthetic fixture and its two test helpers into a separate checkout of #320 at d5f8f2ce7615897baf6340991b4202f5a550eca0, leaving the translator unchanged. On that base the translator refused wave64 shared LDS without barriers on a host without 64-lane waves. On the unmodified #439 head the same fixture dispatched two 64-thread groups and matched all 128 lane outputs.

Synthetic fixtures only. AI-assisted with Codex.

**@⁠hah346** on GitHub · 2026-11-25 12:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7162643567) Independent Windows / NVIDIA Turing validation of VIctory PR #439 at `3fab5a19f586c690fedf4578c1fb7b4c2de298dd`. - Windows 11 build 26300, RTX 2060 (6 GiB), NVIDIA 616.64, Rust 1.98.1 x86_64-pc-windows-msvc, MSVC 14.51, DXIL validator 1.9.2602.17 from Windows SDK 10.0.26100. - Clean PR checkout: `cargo +1.98.1 test -j 4 -p victory-shader --lib --locked split_tests -- --nocapture --test-threads=1` returned **33 passed, 0 failed, 0 ignored** (26.60 s). Hardware readback explicitly reported the RTX 2060 with `split true` for LDS ordering (including the busy-half and masked-block cases), cross-half lane reads, integer and float reductions and prefixes, and 3D thread groups. - A/B for `one_wave_shares_lds_in_instruction_order`: I copied only that synthetic fixture and its two test helpers into a separate checkout of #320 at `d5f8f2ce7615897baf6340991b4202f5a550eca0`, leaving the translator unchanged. On that base the translator refused wave64 shared LDS without barriers on a host without 64-lane waves. On the unmodified #439 head the same fixture dispatched two 64-thread groups and matched all 128 lane outputs. Synthetic fixtures only. AI-assisted with Codex.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 12:41 UTC · original

@⁠hah346 thank you. It's the first run of the current head on Turing, and the A/B is the useful part.

I checked what I could from here. 3fab5a19 is the PR head, and d5f8f2ce is #320's head, which #439 sits on. emit/split_tests.rs at 3fab5a19 holds 33 tests, so 33 passed is all of them. one_wave_shares_lds_in_instruction_order exists only on #439, so copying it onto #320 isolates this PR's LDS change. The refusal you saw on #320 is the expected one: without this PR, a wave64 program that shares LDS has no form on a 32-lane host.

Your run covers what triage asked for at this level: the LDS ordering of the console flow on 32-lane NVIDIA hardware, with split true reported. Earlier 32-lane runs were upipibi's RTX 3070 at #233's head, and now yours on an RTX 2060 at #439's.

Checked here by reading the two heads only; no title data was used.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 12:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7162719598) @⁠hah346 thank you. It's the first run of the current head on Turing, and the A/B is the useful part. I checked what I could from here. `3fab5a19` is the PR head, and `d5f8f2ce` is #320's head, which #439 sits on. `emit/split_tests.rs` at `3fab5a19` holds 33 tests, so 33 passed is all of them. `one_wave_shares_lds_in_instruction_order` exists only on #439, so copying it onto #320 isolates this PR's LDS change. The refusal you saw on #320 is the expected one: without this PR, a wave64 program that shares LDS has no form on a 32-lane host. Your run covers what triage asked for at this level: the LDS ordering of the console flow on 32-lane NVIDIA hardware, with `split true` reported. Earlier 32-lane runs were upipibi's RTX 3070 at #233's head, and now yours on an RTX 2060 at #439's. Checked here by reading the two heads only; no title data was used. AI-assisted
Author
Owner

@⁠hah346 on GitHub · 2026-11-25 12:52 UTC · original

Thanks, @⁠r4tedx. I can run another Windows hardware test on the RTX 2060. Is there an open PR or synthetic regression test where another Turing result would help most? If you have a commit or test command in mind, I can run it and post the results.

**@⁠hah346** on GitHub · 2026-11-25 12:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7162969775) Thanks, @⁠r4tedx. I can run another Windows hardware test on the RTX 2060. Is there an open PR or synthetic regression test where another Turing result would help most? If you have a commit or test command in mind, I can run it and post the results.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 12:53 UTC · original

@⁠hah346 thanks for offering. The one that would help most is #2366 (rectangle lists get their fourth corner across the diagonal from the right-angle corner). Its tests have only run on WARP and macOS so far, never on a hardware D3D12 adapter.

At head 1853bce5:

git fetch origin pull/2366/head:pr-2366
git checkout pr-2366
cargo test -p victory-shader --lib --locked emit::rect -- --test-threads=1

Leave VICTORY_WARP unset. Each of the three tests (rectangles_get_their_fourth_corner, rectangles_with_the_corner_first_complete_across_their_diagonal, rectangles_with_the_corner_third_complete_across_their_diagonal) draws one square through the generated geometry shader on the default adapter first and then on WARP, and checks every pixel of the 32x32 target. If the RTX 2060 draws it differently, the failure begins warp false pixel (x, y). If everything passes, 3 passed is the full set. The PR description has the WARP comparison with main (the two new tests fail there).

I checked the test code and the adapter choice (Host::new in emit/host.rs) at that head here; I ran nothing on hardware. No title data used.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 12:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7163007922) @⁠hah346 thanks for offering. The one that would help most is #2366 (rectangle lists get their fourth corner across the diagonal from the right-angle corner). Its tests have only run on WARP and macOS so far, never on a hardware D3D12 adapter. At head `1853bce5`: ``` git fetch origin pull/2366/head:pr-2366 git checkout pr-2366 cargo test -p victory-shader --lib --locked emit::rect -- --test-threads=1 ``` Leave `VICTORY_WARP` unset. Each of the three tests (`rectangles_get_their_fourth_corner`, `rectangles_with_the_corner_first_complete_across_their_diagonal`, `rectangles_with_the_corner_third_complete_across_their_diagonal`) draws one square through the generated geometry shader on the default adapter first and then on WARP, and checks every pixel of the 32x32 target. If the RTX 2060 draws it differently, the failure begins `warp false pixel (x, y)`. If everything passes, 3 passed is the full set. The PR description has the WARP comparison with `main` (the two new tests fail there). I checked the test code and the adapter choice (`Host::new` in `emit/host.rs`) at that head here; I ran nothing on hardware. No title data used. AI-assisted
Author
Owner

@⁠crissuper20 on GitHub · 2026-11-25 15:16 UTC · original

In-game A/B on a GTX 1650 (Turing, 4 GB, 32-lane waves, driver 32.0.16.2124), diag build, --console series-s, same save and input, 18 min each, as asked on #233. Base: 940d32f + #2016 #1775 #454 #1731 #1997.

+ #233 (691ff20) + this PR (3fab5a19)
shaders that don't translate 61 11
pipelines refused by the driver 0 2 (1 mesh, 1 after the removal)
device removed no yes, ~4 min into the world

The 11 left: 6 × "console wave64 lanes in a group of more than 64 threads", 3 × "an implicit-derivative sample in the console flow", 2 others.

The removal hits mid-list on a small compute dispatch (7×1×1). With #233 alone, the same program is bound and runs, and nothing is removed in 18 min. So one of the programs this PR now translates looks like the likely cause on Turing. One run each.

AI-assisted (Claude Code); measured on my own machine.

**@⁠crissuper20** on GitHub · 2026-11-25 15:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7166575700) In-game A/B on a GTX 1650 (Turing, 4 GB, 32-lane waves, driver 32.0.16.2124), diag build, `--console series-s`, same save and input, 18 min each, as asked on #233. Base: `940d32f` + #2016 #1775 #454 #1731 #1997. | | + #233 (`691ff20`) | + this PR (`3fab5a19`) | |---|---:|---:| | shaders that don't translate | 61 | **11** | | pipelines refused by the driver | 0 | 2 (1 mesh, 1 after the removal) | | device removed | no | **yes**, ~4 min into the world | The 11 left: 6 × "console wave64 lanes in a group of more than 64 threads", 3 × "an implicit-derivative sample in the console flow", 2 others. The removal hits mid-list on a small compute dispatch (7×1×1). With #233 alone, the same program is bound and runs, and nothing is removed in 18 min. So one of the programs this PR now translates looks like the likely cause on Turing. One run each. AI-assisted (Claude Code); measured on my own machine.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 15:18 UTC · original

@⁠crissuper20 thank you. This is the first device removal reported on 3fab5a19, and the A/B against #233 narrows it to the programs this PR newly translates.

To find which program it is, could you send the log of the removal run? These are the lines that would help most:

  • the host GPU device removed after a submission of N lists ... line, in full. In a diag build it names the pipeline that each noted command runs. If you can run it once more with VICTORY_D3D12_DRED=1, the same line also gives the faulting address, the allocations it hit and the breadcrumbs, with the command that was running when the GPU stopped.
  • the name or hash of the 7×1×1 compute program you saw bound at the removal, and the two refused pipelines (their log lines).
  • the 6 + 3 + 2 programs that still don't translate are expected on this head: the group-size and implicit-sample guards stop them on purpose. Their names aren't needed.

With the program's name I can translate it here from both heads offline and compare what changes on a 32-lane host. Until then, #439 shouldn't be used on Turing for play. #233 alone ran 18 minutes on your card without a removal.

AI-assisted (Claude Code). No game run on my side for this reply; I checked the log lines against the code at 3fab5a19.

**@⁠r4tedx** on GitHub · 2026-11-25 15:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7166630833) @⁠crissuper20 thank you. This is the first device removal reported on `3fab5a19`, and the A/B against #233 narrows it to the programs this PR newly translates. To find which program it is, could you send the log of the removal run? These are the lines that would help most: - the `host GPU device removed after a submission of N lists ...` line, in full. In a diag build it names the pipeline that each noted command runs. If you can run it once more with `VICTORY_D3D12_DRED=1`, the same line also gives the faulting address, the allocations it hit and the breadcrumbs, with the command that was running when the GPU stopped. - the name or hash of the 7×1×1 compute program you saw bound at the removal, and the two refused pipelines (their log lines). - the 6 + 3 + 2 programs that still don't translate are expected on this head: the group-size and implicit-sample guards stop them on purpose. Their names aren't needed. With the program's name I can translate it here from both heads offline and compare what changes on a 32-lane host. Until then, #439 shouldn't be used on Turing for play. #233 alone ran 18 minutes on your card without a removal. AI-assisted (Claude Code). No game run on my side for this reply; I checked the log lines against the code at `3fab5a19`.
Author
Owner

@⁠crissuper20 on GitHub · 2026-11-25 15:38 UTC · original

@⁠r4tedx from the removal run's log (VICTORY_D3D12_DRED=1 was already on). No program hashes, per #1633's rule.

  • Reason: 0x887A0006 (device hung). No page fault is reported.
  • a list stopped at command 1026 of 1920 (op 6), commands 1003..1043 between its barriers, a submission of 1 list. Every earlier list in the breadcrumbs is complete.
  • Commands 1004–1026 are 12 compute dispatches (3–18 × 1 × 1). 11 of them, including the one that stopped (1026, 18×1×1) and the 7×1×1 at 1004, run one program; 1024 runs another.
  • Correction to my guess above: both programs were already translated and bound with #233 alone, with the same DXIL size (11,840 and 11,052 bytes) on both heads. So the hang isn't in a program this PR newly translates. It may be in what an earlier, newly translated program feeds them.
  • Refused pipelines: one mesh + pixel pipeline (E_INVALIDARG) at 1m20s before the removal. The other was refused after the removal, at device-suspended time.

AI-assisted (Claude Code); from my own run's log.

**@⁠crissuper20** on GitHub · 2026-11-25 15:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7167152896) @⁠r4tedx from the removal run's log (`VICTORY_D3D12_DRED=1` was already on). No program hashes, per #1633's rule. - Reason: `0x887A0006` (device **hung**). No page fault is reported. - `a list stopped at command 1026 of 1920 (op 6), commands 1003..1043 between its barriers`, a submission of 1 list. Every earlier list in the breadcrumbs is complete. - Commands 1004–1026 are 12 compute dispatches (3–18 × 1 × 1). 11 of them, including the one that stopped (1026, 18×1×1) and the 7×1×1 at 1004, run **one program**; 1024 runs another. - **Correction to my guess above:** both programs were already translated and bound with #233 alone, with the same DXIL size (11,840 and 11,052 bytes) on both heads. So the hang isn't in a program this PR newly translates. It may be in what an earlier, newly translated program feeds them. - Refused pipelines: one mesh + pixel pipeline (`E_INVALIDARG`) at 1m20s before the removal. The other was refused after the removal, at device-suspended time. AI-assisted (Claude Code); from my own run's log.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 15:39 UTC · original

@⁠crissuper20 thank you, that narrows it a lot. A hang (0x887A0006) with no page fault, stopped inside a run of small dispatches of a program that #233 alone already ran, points to something feeding that program, not to the program itself. For example, a newly translated program earlier in the frame could leave a count or an index that makes a loop run far longer than it should.

Two runs would tell those apart. Both use switches that exist at 3fab5a19 in a diag build, and you can keep the hashes on your machine.

  1. VICTORY_SHADER_LOOP_LIMIT=4096, everything else the same. Translated loops then stop after 4096 iterations instead of 2^20 (it's part of the translation, so the shader cache retranslates). If the removal goes away, a loop running far too long is the likely cause, and the picture may be wrong but the device survives.
  2. VICTORY_SKIP_PIPELINES=<hash>,<hash>,... (16-digit hashes, comma separated), to bisect. Pipelines using any listed shader are skipped. Take the programs this head translates that #233 refused, which is the difference between your two runs' "doesn't translate" lists. Skip half of them and see whether the hang stays, then halve again. Posting only the refusal reason and the stage of the one that matters is enough here.

One thing to check, if it's easy: equal DXIL sizes on both heads don't quite prove the two programs are identical. If the shader cache keeps both heads' entries, comparing their bytes (for example by sha256) would settle it.

Until this is found, #439 stays not for play on Turing, as above.

AI-assisted (Claude Code). I ran nothing on my side for this reply; I checked the two switches in the code at 3fab5a19.

**@⁠r4tedx** on GitHub · 2026-11-25 15:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7167183656) @⁠crissuper20 thank you, that narrows it a lot. A hang (`0x887A0006`) with no page fault, stopped inside a run of small dispatches of a program that #233 alone already ran, points to something feeding that program, not to the program itself. For example, a newly translated program earlier in the frame could leave a count or an index that makes a loop run far longer than it should. Two runs would tell those apart. Both use switches that exist at `3fab5a19` in a diag build, and you can keep the hashes on your machine. 1. **`VICTORY_SHADER_LOOP_LIMIT=4096`**, everything else the same. Translated loops then stop after 4096 iterations instead of 2^20 (it's part of the translation, so the shader cache retranslates). If the removal goes away, a loop running far too long is the likely cause, and the picture may be wrong but the device survives. 2. **`VICTORY_SKIP_PIPELINES=<hash>,<hash>,...`** (16-digit hashes, comma separated), to bisect. Pipelines using any listed shader are skipped. Take the programs this head translates that #233 refused, which is the difference between your two runs' "doesn't translate" lists. Skip half of them and see whether the hang stays, then halve again. Posting only the refusal reason and the stage of the one that matters is enough here. One thing to check, if it's easy: equal DXIL sizes on both heads don't quite prove the two programs are identical. If the shader cache keeps both heads' entries, comparing their bytes (for example by sha256) would settle it. Until this is found, #439 stays not for play on Turing, as above. AI-assisted (Claude Code). I ran nothing on my side for this reply; I checked the two switches in the code at `3fab5a19`.
Author
Owner

@⁠Capi360 on GitHub · 2026-11-25 16:01 UTC · original

Offline test on RTX 3060 Ti (8 GiB, NVIDIA 616.56), Ryzen 7 5700X3D, 32 GiB RAM, Windows 11 Pro build 26200. I tested this stack with the NVIDIA raw structured-buffer and packed-target changes.

In a prior Series X run the debug layer rejected 119 distinct compute programs because they requested 64 lanes on a 32-lane device. This build created 81 of those exact programs and logged zero such driver rejections. Of the other 38, the translator explicitly refused 12 during the run. The run still ended in device removal near the start of world rendering, so the other 26 were unobserved.

All 33 split-wave tests and the four shader-cache tests passed. AI-assisted integration and test. Code-only integration: https://github.com/Capi360/VIctory/tree/codex/rtx-3060-ti-wave64-split

**@⁠Capi360** on GitHub · 2026-11-25 16:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7167532271) Offline test on RTX 3060 Ti (8 GiB, NVIDIA 616.56), Ryzen 7 5700X3D, 32 GiB RAM, Windows 11 Pro build 26200. I tested this stack with the NVIDIA raw structured-buffer and packed-target changes. In a prior Series X run the debug layer rejected 119 distinct compute programs because they requested 64 lanes on a 32-lane device. This build created 81 of those exact programs and logged zero such driver rejections. Of the other 38, the translator explicitly refused 12 during the run. The run still ended in device removal near the start of world rendering, so the other 26 were unobserved. All 33 split-wave tests and the four shader-cache tests passed. AI-assisted integration and test. Code-only integration: https://github.com/Capi360/VIctory/tree/codex/rtx-3060-ti-wave64-split
Author
Owner

@⁠Machad3x on GitHub · 2026-11-25 21:33 UTC · original

A related report with two small fixes to this console flow (whole-wave sections in partial groups; 16-bit sums in split halves) is here: #2214 (see the latest comment). Written with Claude Code.

**@⁠Machad3x** on GitHub · 2026-11-25 21:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7175246485) A related report with two small fixes to this console flow (whole-wave sections in partial groups; 16-bit sums in split halves) is here: https://git.gtahub.st/github/Marvisak--VIctory/pulls/2214 (see the latest comment). Written with Claude Code.
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-26 01:09 UTC · original

Tester report for this stack (#223 → #233 → #320 → #439), whole-title corpus on a 32-lane host. RTX 5070 Ti, NVIDIA 617.42, Windows 11.

Method: translate --cache --pipelines over shaders.rpf (26,503 containers) plus the executable, XboxBvhBuilder.dll and the FidelityFX DLL. Each column is a fresh cache. Counts only, no game data.

compute pipelines that do not run main + #2825 #2885 #2848 #2821 #2870 same + #2633 same + this stack
refused by the driver (WaveSize(64)) 359 2 1
compute shader does not translate 26 379 85
total 385 381 86

With #2633, the refusal mostly moves from the driver into the translator. This stack is the one that makes about 300 of these programs run. All 52 of the BVH builder's programs translate here, so I also merged #2311 (with #2118): the builder now runs whole on NVIDIA, and the walks wait for it.

Still refused (translate --host-lanes 32-32, compute):

reason programs
console wave64 lanes in a group of more than 64 threads (#2214's ground) 44
an implicit-derivative sample in the console flow 13
a descriptor's address or format read as data 10
a lane mask read as data 6
a whole-wave section step the simulation does not follow (with #2348) 5
a whole-wave section of a wave64 4
other (1 each) 3

Merging onto current main: these conflicts weren't mechanical, in case they help the rebase.

  • lower.rs, lane-mask phi joins. main's uniform_join / number path (masks popped from memory by the BVH walks) has to sit beside console_cf's st.other masks. no_mask_lane_on_edge must stay out of the console flow. lane_bit now returns Result, so that arm needs ?.
  • host.rs. main's process-wide WARP device (SharedDevice / WARP_LOCK) and this stack's VICTORY_ADAPTER / Host::on both change device creation. I kept the shared WARP device and gave create_device an optional adapter.
  • ds_bpermute_b32: main's test ds_bpermute_wave64_preserves_32_lane_half expects no waveGetLaneIndex for wave32, so the half base stays wave64-only.
  • main's a_scalar_result_needs_no_exec calls lower() directly and now gets CONSOLE_FLOW. Its helper has to retry the way emit_with does.

With those resolutions, victory-shader's lib tests pass. The ones that fail also fail on main on this machine: the heap-cap tests and one access violation in heap_direct_texture_reads_mark_their_heap_index.

I haven't done a title run on this head yet.

**@⁠kawaii-shakal** on GitHub · 2026-11-26 01:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7179489935) Tester report for this stack (#223 → #233 → #320 → #439), whole-title corpus on a 32-lane host. RTX 5070 Ti, NVIDIA 617.42, Windows 11. **Method:** `translate --cache --pipelines` over `shaders.rpf` (26,503 containers) plus the executable, `XboxBvhBuilder.dll` and the FidelityFX DLL. Each column is a fresh cache. Counts only, no game data. | compute pipelines that do not run | main + #2825 #2885 #2848 #2821 #2870 | same + #2633 | same + this stack | |---|---:|---:|---:| | refused by the driver (`WaveSize(64)`) | 359 | 2 | **1** | | compute shader does not translate | 26 | 379 | **85** | | **total** | 385 | 381 | **86** | With #2633, the refusal mostly moves from the driver into the translator. This stack is the one that makes about 300 of these programs run. All 52 of the BVH builder's programs translate here, so I also merged #2311 (with #2118): the builder now runs whole on NVIDIA, and the walks wait for it. **Still refused** (`translate --host-lanes 32-32`, compute): | reason | programs | |---|---:| | console wave64 lanes in a group of more than 64 threads (#2214's ground) | 44 | | an implicit-derivative sample in the console flow | 13 | | a descriptor's address or format read as data | 10 | | a lane mask read as data | 6 | | a whole-wave section step the simulation does not follow (with #2348) | 5 | | a whole-wave section of a wave64 | 4 | | other (1 each) | 3 | **Merging onto current `main`:** these conflicts weren't mechanical, in case they help the rebase. - `lower.rs`, lane-mask phi joins. `main`'s `uniform_join` / `number` path (masks popped from memory by the BVH walks) has to sit beside `console_cf`'s `st.other` masks. `no_mask_lane_on_edge` must stay out of the console flow. `lane_bit` now returns `Result`, so that arm needs `?`. - `host.rs`. `main`'s process-wide WARP device (`SharedDevice` / `WARP_LOCK`) and this stack's `VICTORY_ADAPTER` / `Host::on` both change device creation. I kept the shared WARP device and gave `create_device` an optional adapter. - `ds_bpermute_b32`: `main`'s test `ds_bpermute_wave64_preserves_32_lane_half` expects no `waveGetLaneIndex` for wave32, so the half base stays `wave64`-only. - `main`'s `a_scalar_result_needs_no_exec` calls `lower()` directly and now gets `CONSOLE_FLOW`. Its helper has to retry the way `emit_with` does. With those resolutions, `victory-shader`'s lib tests pass. The ones that fail also fail on `main` on this machine: the heap-cap tests and one access violation in `heap_direct_texture_reads_mark_their_heap_index`. I haven't done a title run on this head yet.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 01:10 UTC · original

@⁠kawaii-shakal thank you. The middle column is the useful part: with #2633 alone the refusal moves from the driver into the translator, and with this stack about 300 of those programs run. That's the first whole-corpus measurement of the stack on current-era main.

The merge notes come at the right time, since the stack is due a merge of current main (merged upward from #223, never rebased). I'll take them as a checklist and credit them in the merge commits:

  • keep main's uniform_join/number path beside the console flow's masks, with no_mask_lane_on_edge kept out of the console flow and a ? on the now-fallible lane_bit;
  • keep main's shared WARP device and give create_device an optional adapter;
  • keep the ds_bpermute_b32 half base for wave64 only;
  • give a_scalar_result_needs_no_exec's helper the retry emit_with uses.

The still-refused list matches what we expect at this level: the 44 multi-wave groups are #2214's ground, and the 13 implicit-derivative samples are stopped on purpose by the guard. I'll post the merged heads with test results.

This reply is based on reading your report and the stack's code only; no title data used.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 01:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7179500462) @⁠kawaii-shakal thank you. The middle column is the useful part: with #2633 alone the refusal moves from the driver into the translator, and with this stack about 300 of those programs run. That's the first whole-corpus measurement of the stack on current-era main. The merge notes come at the right time, since the stack is due a merge of current `main` (merged upward from #223, never rebased). I'll take them as a checklist and credit them in the merge commits: - keep `main`'s `uniform_join`/`number` path beside the console flow's masks, with `no_mask_lane_on_edge` kept out of the console flow and a `?` on the now-fallible `lane_bit`; - keep `main`'s shared WARP device and give `create_device` an optional adapter; - keep the `ds_bpermute_b32` half base for wave64 only; - give `a_scalar_result_needs_no_exec`'s helper the retry `emit_with` uses. The still-refused list matches what we expect at this level: the 44 multi-wave groups are #2214's ground, and the 13 implicit-derivative samples are stopped on purpose by the guard. I'll post the merged heads with test results. This reply is based on reading your report and the stack's code only; no title data used. AI-assisted
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 01:30 UTC · original

@⁠neonbyte1, thank you for the bisect on #2118 (#2118). It shows a real interaction with this PR.

In your stack (main 219878a + #2723, #1129, #1548 + #233, #320 and this PR), this PR makes BVH builder program 28918b7150a7aad5 translate. Its sibling 14394a322f6dd5c2 stays refused ("console wave64 lanes in a group of more than 64 threads"). The builder then runs only some of its stages, and the title crashes while loading (a write to 0, in 2 of 2 runs). Skipping 28918b71, or adding #2118, avoids it, and gameplay ran for 10 minutes.

So when this PR changes which builder programs translate, it needs a builder gate that runs the builder all-or-none, such as #2118. I've added a note saying so at the top of the description. We'd rather keep that all-or-none rule in one place (#2118) than duplicate it here. If you'd prefer this PR to be safe on its own, say so and we'll look at holding back a newly translated builder stage while a sibling stays refused.

The finding and the runs are neonbyte1's, made with their local title data; we haven't run the title for this comment.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 01:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7179834997) @⁠neonbyte1, thank you for the bisect on #2118 (https://git.gtahub.st/github/Marvisak--VIctory/pulls/2118). It shows a real interaction with this PR. In your stack (main 219878a + #2723, #1129, #1548 + #233, #320 and this PR), this PR makes BVH builder program `28918b7150a7aad5` translate. Its sibling `14394a322f6dd5c2` stays refused ("console wave64 lanes in a group of more than 64 threads"). The builder then runs only some of its stages, and the title crashes while loading (a write to 0, in 2 of 2 runs). Skipping `28918b71`, or adding #2118, avoids it, and gameplay ran for 10 minutes. So when this PR changes which builder programs translate, it needs a builder gate that runs the builder all-or-none, such as #2118. I've added a note saying so at the top of the description. We'd rather keep that all-or-none rule in one place (#2118) than duplicate it here. If you'd prefer this PR to be safe on its own, say so and we'll look at holding back a newly translated builder stage while a sibling stays refused. The finding and the runs are neonbyte1's, made with their local title data; we haven't run the title for this comment. AI-assisted
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 01:30 UTC · original

Results on an RTX 5090 (driver 620.73.04, 32-lane waves) under Linux: Wine 11.22, vkd3d-proton 3.1-83 (GE-Proton11-14), DXVK dxgi, diagnostics build. I merged #439 with #320 onto main 219878a, which also carried #2723, #1129, #1548, #233 and a Wine-compilable argument clamp (#1279's approach). The only conflict was the test helper lowers in lower.rs, which now takes the console flow as emit does.

Translation (whole shader pack, from the port's census): compute emitted goes from 2,410 to 2,644 of 2,734, with no program lost on any stage. The instrumented translation found 0 group barriers placed inside per-lane branches across about 35,800 barriers, which is the pattern that hung NVIDIA here before (Xid 109).

In game, same base without and with #439, both warm, frame summaries at the end of the run:

Per frame without with #439
Dropped, no host pipeline 558 263
Indirect drops 90 49
GPU time 586 ms 816 ms
  • Both material-tile classifiers (CS_MaterialTilesInitial, CS_MaterialTiles) now translate and run, so tiled deferred lighting gets instances. Before, all 180 of its indirect draws had an instance count of 0.
  • One side effect: the BVH builder program 28918b7150a7aad5 now translates while a sibling stage stays refused. The half-run build crashed the title during loading in 2 of 2 runs; #2118 fixes that (details there).
  • 4 instance-culling programs also needed a dxil-spirv workaround to build pipelines in Proton's vkd3d-proton (HansKristian-Work/dxil-spirv#380). That's independent of this PR.

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

**@⁠neonbyte1** on GitHub · 2026-11-26 01:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7179835976) Results on an RTX 5090 (driver 620.73.04, 32-lane waves) under Linux: Wine 11.22, vkd3d-proton 3.1-83 (GE-Proton11-14), DXVK `dxgi`, diagnostics build. I merged #439 with #320 onto `main` `219878a`, which also carried #2723, #1129, #1548, #233 and a Wine-compilable argument clamp (#1279's approach). The only conflict was the test helper `lowers` in `lower.rs`, which now takes the console flow as `emit` does. **Translation** (whole shader pack, from the port's census): compute emitted goes from 2,410 to 2,644 of 2,734, with no program lost on any stage. The instrumented translation found 0 group barriers placed inside per-lane branches across about 35,800 barriers, which is the pattern that hung NVIDIA here before (Xid 109). **In game**, same base without and with #439, both warm, frame summaries at the end of the run: | Per frame | without | with #439 | |---|---|---| | Dropped, no host pipeline | 558 | 263 | | Indirect drops | 90 | 49 | | GPU time | 586 ms | 816 ms | - Both material-tile classifiers (`CS_MaterialTilesInitial`, `CS_MaterialTiles`) now translate and run, so tiled deferred lighting gets instances. Before, all 180 of its indirect draws had an instance count of 0. - One side effect: the BVH builder program `28918b7150a7aad5` now translates while a sibling stage stays refused. The half-run build crashed the title during loading in 2 of 2 runs; #2118 fixes that (details there). - 4 instance-culling programs also needed a dxil-spirv workaround to build pipelines in Proton's vkd3d-proton (HansKristian-Work/dxil-spirv#380). That's independent of this PR. _AI-assisted (Claude); measured on my machine, no game data shared._
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 01:56 UTC · original

@⁠r4tedx I checked Machad3x's partial-group reduction report on #2214 directly on this stack at 3fab5a1. I put their proposed upper-half check and a new regression in a one-commit candidate. The test covers integer sum/min/max of groupThreadID + 7 at 1, 6, 31, 32, 33, 36, 48, 63 and 64 threads, two groups per dispatch. Choosing 7 as the smallest input exposes the zero from an absent half.

Lowering on RTX 5080 (Wave32) Dispatches Wrong / returned dwords
Current head 3, with 24 translation refusals 0/384
Lift the partial-group refusal only 27 140/1,884
Also skip the exchange when no upper half exists 27 0/1,884

All 140 differences in the middle row were minima of zero instead of seven, at 1, 6, 31 and 32 threads. Built-in WARP (Wave4) cannot run either required fixed wave width.

Portable Microsoft.Warp 1.0.22 still has a separate partial-group failure. With the candidate it had 652/1,884 wrong at fixed Wave32 and fixed Wave64, for sums/maxima at 31, 33, 36 and 63 threads. The unmodified PR head also got the same 652 wrong with the Native Wave64 target. A direct DXC cs_6_6 shader reproduced the 31-thread case outside the translator, at both fixed wave sizes. Thread 30 reported all of these in the same dispatch:

31-thread group Lane index Active count Wave max thread ID Wave sum of ID + 7 Group-shared atomic sum
RTX 5080, Wave32 30 31 30 682 682
WARP 1.0.22, Wave32 or Wave64 30 16 15 232 682

So the missing-upper-half guard fixes a real RTX error and the portable WARP case remains open. A native AMD readback on the 31- and 33-thread groups would help decide how broadly to enable this. No title run on my side.

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr439-partial-wave-reductions
git cherry-pick 9cc76b82f99f8141eafc5ca7a449d65ed4417460
cargo test -p victory-shader --lib whole_wave_reductions_in_partial_groups -- --nocapture
**@⁠steven-seagull27** on GitHub · 2026-11-26 01:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7180301482) @⁠r4tedx I checked [Machad3x's partial-group reduction report on #2214](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2214) directly on this stack at `3fab5a1`. I put their proposed upper-half check and a new regression in a [one-commit candidate](https://github.com/steven-seagull27/VIctory/commit/9cc76b82f99f8141eafc5ca7a449d65ed4417460). The test covers integer sum/min/max of `groupThreadID + 7` at 1, 6, 31, 32, 33, 36, 48, 63 and 64 threads, two groups per dispatch. Choosing 7 as the smallest input exposes the zero from an absent half. | Lowering on RTX 5080 (Wave32) | Dispatches | Wrong / returned dwords | |---|---:|---:| | Current head | 3, with 24 translation refusals | 0/384 | | Lift the partial-group refusal only | 27 | 140/1,884 | | Also skip the exchange when no upper half exists | 27 | 0/1,884 | All 140 differences in the middle row were minima of zero instead of seven, at 1, 6, 31 and 32 threads. Built-in WARP (Wave4) cannot run either required fixed wave width. **Portable Microsoft.Warp 1.0.22 still has a separate partial-group failure.** With the candidate it had 652/1,884 wrong at fixed Wave32 and fixed Wave64, for sums/maxima at 31, 33, 36 and 63 threads. The unmodified PR head also got the same 652 wrong with the Native Wave64 target. A direct DXC `cs_6_6` shader reproduced the 31-thread case outside the translator, at both fixed wave sizes. Thread 30 reported all of these in the same dispatch: | 31-thread group | Lane index | Active count | Wave max thread ID | Wave sum of ID + 7 | Group-shared atomic sum | |---|---:|---:|---:|---:|---:| | RTX 5080, Wave32 | 30 | 31 | 30 | 682 | 682 | | WARP 1.0.22, Wave32 or Wave64 | 30 | 16 | 15 | 232 | 682 | So the missing-upper-half guard fixes a real RTX error and the portable WARP case remains open. A native AMD readback on the 31- and 33-thread groups would help decide how broadly to enable this. No title run on my side. ```sh git fetch https://github.com/steven-seagull27/VIctory.git codex/pr439-partial-wave-reductions git cherry-pick 9cc76b82f99f8141eafc5ca7a449d65ed4417460 cargo test -p victory-shader --lib whole_wave_reductions_in_partial_groups -- --nocapture ```
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 01:58 UTC · original

@⁠steven-seagull27 Thank you for checking this and for the candidate (9cc76b8). I have not tested it yet. #439 conflicts with main 63bcca4 at the moment. I'll review your commit when I bring the stack onto main and report the result here. On this PC, synthetic tests run on WARP only, and built-in WARP can't run the fixed wave widths, as you noted. So I can't reproduce the RTX 5080 counts myself. That leaves a static review plus the existing suites. A native AMD readback on the 31- and 33-thread groups would still be welcome from anyone who has the hardware.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 01:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7180331648) @⁠steven-seagull27 Thank you for checking this and for the candidate (9cc76b8). I have not tested it yet. #439 conflicts with main `63bcca4` at the moment. I'll review your commit when I bring the stack onto main and report the result here. On this PC, synthetic tests run on WARP only, and built-in WARP can't run the fixed wave widths, as you noted. So I can't reproduce the RTX 5080 counts myself. That leaves a static review plus the existing suites. A native AMD readback on the 31- and 33-thread groups would still be welcome from anyone who has the hardware. AI-assisted
On a host without 64-lane waves, a wave64 program that reaches title
memory by address (root_memory) no longer takes the console flow in
halves when it also shares LDS, has whole-wave sections or permutes
lanes; it stops with a reason instead. Programs that only exchange
lanes or read masks whole keep the console flow, and hosts with
64-lane waves are unchanged.

latentdev found the limit (patch on #439 against 87d1f42): without it
the ray-tracing structure builder stages caa78b8ca62bc3d6 and
28918b7150a7aad5 translated, part of the builder ran and the GPU hung
on an RTX 4090. Offline at 32-32 the XboxBvhBuilder.dll programs at
0x25c40 and 0x28770 (those two) validated before and are refused now;
the other 50 programs are unchanged.

The check lives in emit/lower/console.rs (lower.rs is near the file
size limit). The test builds an LDS program with and without a load
from an address it makes: refused at 32-32 only with the load, both
translate with 64-lane waves.

Co-authored-by: latentdev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Five split_tests hand-assembled by latentdev from the tile classifier
bad01f53f53248e5's own code (patch on #439 against 87d1f42): a
whole-wave sum over every lane and over lane 0 alone, an exclusive
prefix over every lane and over lane 0 alone, and an LDS counter both
halves add to before either reads it.

Adapted to the stack's helpers: the LDS case uses program_lds and
program_case. Each test also checks, without an adapter, that the
program translates for a 32-lane host in halves (wave size 32) and
validates where a validator is installed; the values are checked on
hardware adapters only. latentdev ran them exact on an RTX 4090 (in
halves) and a Radeon 7950X3D iGPU (native wave64) with their patch.

Co-authored-by: latentdev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠latentdev on GitHub · 2026-11-26 03:35 UTC · original

This PR on an RTX 4090 in the opening cutscene, and a heads-up on lower.rs's size

Size, for the rebase onto current main. cargo xtask policy allows 512 KiB per file (MAX_FILE_SIZE in xtask/src/policy.rs). crates/victory-shader/src/emit/lower.rs is already 520,563 bytes on main 63bcca4. This PR adds 38,546 bytes to it (451,690 at 940d32f, 490,236 at 3fab5a1). A trial merge onto 63bcca4 leaves it at about 559 KB, so part of it will need to move to another file. The trial merge conflicts in apps/victory/src/main.rs, emit/host.rs and emit/lower.rs.

Setup. RTX 4090, driver 621.24, Windows 11, title 1.0.2.1, diag build, opening cutscene. Tree: main 63bcca4 + #1630 + #1832 + #2332 + #2178 + #2121, this PR at 3fab5a1, #2118 (af8b9ad) and #2703 (7bb3eba).

Translation. bad01f53f53248e5 translates with this PR for a 32-lane target, passes the validator, and the 4090 makes its pipeline. It's the tiled lighting's tile classifier. Without it, the three tiled lighting passes run no groups on NVIDIA (details in #1835). In a run, 51 programs the title uses still don't translate, 33 of them console wave64 lanes in a group of more than 64 threads (#2214's case).

In game, two runs with #2118 and #2703:

  • The tiled lighting passes 2dc364df5d3278b8, 63381c3250b287fa and dce085c07b9414b6 get work once the classifier's pipeline is made. In the first run they got 0 groups for the first 29 world frames, while pipelines were still being made. After that they got work in almost every frame, with 2dc364df5d3278b8 at the 65,535 clamp (#2256). Without this stack they get 0 groups in every frame.
  • #2118 held the builder back for the whole run: pipelines=53 made=48 refused=5, so no frame ran part of it. With this PR but without #2118 (only the two builder stages caa78b8ca62bc3d6 and 28918b7150a7aad5 skipped), the title exited without a log line while the world was loading, 88 s in, as your note at the top says.
  • The second run ended at 6.5 minutes in a device removal with empty breadcrumbs. I can't tie that to this PR.

I don't have a clean picture from this PR yet. In the first run, frame 80 of the cutscene was still dark; the lighting had started 51 frames earlier. The second run ended before frame 80. A local change of mine does the same for this program (a barrier after each LDS access, sections combined across the halves). With it, the cutscene is lit by frame 80.

**@⁠latentdev** on GitHub · 2026-11-26 03:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7181849183) ### This PR on an RTX 4090 in the opening cutscene, and a heads-up on `lower.rs`'s size **Size, for the rebase onto current `main`.** `cargo xtask policy` allows 512 KiB per file (`MAX_FILE_SIZE` in `xtask/src/policy.rs`). `crates/victory-shader/src/emit/lower.rs` is already 520,563 bytes on `main` 63bcca4. This PR adds 38,546 bytes to it (451,690 at `940d32f`, 490,236 at `3fab5a1`). A trial merge onto 63bcca4 leaves it at about 559 KB, so part of it will need to move to another file. The trial merge conflicts in `apps/victory/src/main.rs`, `emit/host.rs` and `emit/lower.rs`. **Setup.** RTX 4090, driver 621.24, Windows 11, title 1.0.2.1, diag build, opening cutscene. Tree: `main` 63bcca4 + #1630 + #1832 + #2332 + #2178 + #2121, this PR at `3fab5a1`, #2118 (`af8b9ad`) and #2703 (`7bb3eba`). **Translation.** `bad01f53f53248e5` translates with this PR for a 32-lane target, passes the validator, and the 4090 makes its pipeline. It's the tiled lighting's tile classifier. Without it, the three tiled lighting passes run no groups on NVIDIA (details in [#1835](https://git.gtahub.st/github/Marvisak--VIctory/issues/1835)). In a run, 51 programs the title uses still don't translate, 33 of them `console wave64 lanes in a group of more than 64 threads` (#2214's case). **In game, two runs with #2118 and #2703:** - The tiled lighting passes `2dc364df5d3278b8`, `63381c3250b287fa` and `dce085c07b9414b6` get work once the classifier's pipeline is made. In the first run they got 0 groups for the first 29 world frames, while pipelines were still being made. After that they got work in almost every frame, with `2dc364df5d3278b8` at the 65,535 clamp (#2256). Without this stack they get 0 groups in every frame. - #2118 held the builder back for the whole run: `pipelines=53 made=48 refused=5`, so no frame ran part of it. With this PR but without #2118 (only the two builder stages `caa78b8ca62bc3d6` and `28918b7150a7aad5` skipped), the title exited without a log line while the world was loading, 88 s in, as your note at the top says. - The second run ended at 6.5 minutes in a device removal with empty breadcrumbs. I can't tie that to this PR. I don't have a clean picture from this PR yet. In the first run, frame 80 of the cutscene was still dark; the lighting had started 51 frames earlier. The second run ended before frame 80. A local change of mine does the same for this program (a barrier after each LDS access, sections combined across the halves). With it, the cutscene is lit by frame 80.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 03:37 UTC · original

@⁠latentdev thanks, and the size figures match ours. Our trial merge of main 63bcca4 upward through the stack gives lower.rs at 521,541 bytes at #223 (under the limit), 541,045 at #233, 547,008 at #320 and 559,844 at #439, so the policy check would refuse the merge from #233 up. The plan is to move the stack's console-flow lowering (console_read_lane, the half exchange and the console-flow refusals) into emit/lower/console.rs, next to main's emit/lower/bvh.rs. That goes on #233 as its own commit and is then merged up through #320 and #439. The conflicts we hit match yours: apps/victory/src/main.rs, emit/host.rs and emit/lower.rs. The rebase starts after our current game-run window, and this PR will show the new head.

Your frame-80 result is useful. Is the local change (a barrier after each LDS access, sections combined across the halves) on a branch you could share, or could you post it as a patch? We would test it on top of the rebased head.

No title data was used for this reply; the sizes come from our trial merges in git. AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 03:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7181882180) @⁠latentdev thanks, and the size figures match ours. Our trial merge of `main` 63bcca4 upward through the stack gives `lower.rs` at 521,541 bytes at #223 (under the limit), 541,045 at #233, 547,008 at #320 and 559,844 at #439, so the policy check would refuse the merge from #233 up. The plan is to move the stack's console-flow lowering (`console_read_lane`, the half exchange and the console-flow refusals) into `emit/lower/console.rs`, next to main's `emit/lower/bvh.rs`. That goes on #233 as its own commit and is then merged up through #320 and #439. The conflicts we hit match yours: `apps/victory/src/main.rs`, `emit/host.rs` and `emit/lower.rs`. The rebase starts after our current game-run window, and this PR will show the new head. Your frame-80 result is useful. Is the local change (a barrier after each LDS access, sections combined across the halves) on a branch you could share, or could you post it as a patch? We would test it on top of the rebased head. No title data was used for this reply; the sizes come from our trial merges in git. AI-assisted
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 05:07 UTC · original

Merged current main (63bcca4) into the whole stack. Merges only, no rebase or force-push: main into #223, then each PR's new head into the one above it. New heads: #223 91aa056, #233 1c74ab4, #320 db85706, this PR e9f18c9. Each merges cleanly with main.

  • File-size policy: with main's growth, emit/lower.rs would pass the 512 KiB limit from #233 up. So #233 first moves lower.rs's inline tests, unchanged, into emit/lower/tests.rs, beside main's emit/lower/bvh.rs. Here lower.rs is 506,583 bytes; at #233 it's 488,121.
  • Conflicts: they follow @⁠kawaii-shakal's notes above, and the merge commits credit them.
    • main's uniform_join/number path sits beside the console flow's masks;
    • no_mask_lane_on_edge stays out of the console flow;
    • lane_bit takes ?;
    • main's shared WARP device is kept, and create_device takes an optional adapter;
    • ds_bpermute_b32's half base is wave64-only;
    • the lowers test helper retries in the console flow, as emit_with does.
  • Checks at each of the four heads, Windows 11, WARP only:
    • cargo xtask policy: ok;
    • clippy -D warnings: clean;
    • VICTORY_WARP=1 cargo test -p victory-shader --lib -- --test-threads=1: 341 passed, 4 failed here; at the PRs below, 301, 316 and 322 passed, each with the same 4 failures. Every level gains main's 53 tests and loses none of the stack's. The 4 failures are main's own: on 63bcca4 the same command gives 298 passed and the same 4 failed (synthetic_tests whose hardware pass runs on WARP under VICTORY_WARP=1).
  • The description is updated, with older heads marked as history. The note at the top about merging with a BVH builder gate such as #2118 stands.

Still open on this head, as triage noted: crissuper20's GTX 1650 hang, and steven-seagull27's partial-group reduction fix. That fix is next, reviewed against this head.

Synthetic tests only for this update; no title data used.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 05:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7183204711) Merged current `main` (`63bcca4`) into the whole stack. Merges only, no rebase or force-push: `main` into #223, then each PR's new head into the one above it. New heads: #223 `91aa056`, #233 `1c74ab4`, #320 `db85706`, this PR **`e9f18c9`**. Each merges cleanly with `main`. - **File-size policy:** with `main`'s growth, `emit/lower.rs` would pass the 512 KiB limit from #233 up. So #233 first moves lower.rs's inline tests, unchanged, into `emit/lower/tests.rs`, beside `main`'s `emit/lower/bvh.rs`. Here lower.rs is 506,583 bytes; at #233 it's 488,121. - **Conflicts:** they follow @⁠kawaii-shakal's notes above, and the merge commits credit them. - `main`'s `uniform_join`/number path sits beside the console flow's masks; - `no_mask_lane_on_edge` stays out of the console flow; - `lane_bit` takes `?`; - `main`'s shared WARP device is kept, and `create_device` takes an optional adapter; - `ds_bpermute_b32`'s half base is wave64-only; - the `lowers` test helper retries in the console flow, as `emit_with` does. - **Checks at each of the four heads,** Windows 11, WARP only: - `cargo xtask policy`: ok; - clippy `-D warnings`: clean; - `VICTORY_WARP=1 cargo test -p victory-shader --lib -- --test-threads=1`: 341 passed, 4 failed here; at the PRs below, 301, 316 and 322 passed, each with the same 4 failures. Every level gains `main`'s 53 tests and loses none of the stack's. The 4 failures are `main`'s own: on `63bcca4` the same command gives 298 passed and the same 4 failed (`synthetic_tests` whose hardware pass runs on WARP under `VICTORY_WARP=1`). - **The description** is updated, with older heads marked as history. The note at the top about merging with a BVH builder gate such as #2118 stands. Still open on this head, as triage noted: crissuper20's GTX 1650 hang, and steven-seagull27's partial-group reduction fix. That fix is next, reviewed against this head. Synthetic tests only for this update; no title data used. AI-assisted
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 05:14 UTC · original

Correction to my last comment: CI's clippy failed on the previous head. Main's view-mark draw test (crates/victory-gpu/src/draw.rs) builds emit::Options { view_marks: true } by hand, and this stack adds a target field to Options. My local clippy run left out the test targets, so I missed it. New head 8a320556 has the fix merged up from #320: the test fills the remaining fields with ..Options::default(). Nothing else changed.

Verified on #223 0f6dec04 and #439 8a320556: cargo clippy --workspace --all-targets --locked -- -D warnings is clean, and cargo xtask policy passes. No title data was used.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 05:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7183302665) Correction to my last comment: CI's clippy failed on the previous head. Main's view-mark draw test (`crates/victory-gpu/src/draw.rs`) builds `emit::Options { view_marks: true }` by hand, and this stack adds a `target` field to `Options`. My local clippy run left out the test targets, so I missed it. New head `8a320556` has the fix merged up from #320: the test fills the remaining fields with `..Options::default()`. Nothing else changed. Verified on #223 `0f6dec04` and #439 `8a320556`: `cargo clippy --workspace --all-targets --locked -- -D warnings` is clean, and `cargo xtask policy` passes. No title data was used. AI-assisted
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 05:18 UTC · original

Second follow-up: CI's diagnostics clippy (--all-features) found one more call from main that this stack's Target argument breaks. In crates/victory-gpu/src/pipeline/placed_uav_tests.rs:77, emit::emit was called with six arguments. New head 13be4c2c has the fix merged up from #320: the call passes emit::Target::ANY, the same default the other callers use.

Verified on #223 fbfd3c67 and #439 13be4c2c: both CI clippy commands are clean, cargo clippy --workspace --all-targets --locked -- -D warnings and the same command with --all-features. I didn't run the CI cargo test --workspace step on this PC, so CI will be the first to run it on this head. No title data was used.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 05:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7183374265) Second follow-up: CI's diagnostics clippy (`--all-features`) found one more call from main that this stack's `Target` argument breaks. In `crates/victory-gpu/src/pipeline/placed_uav_tests.rs:77`, `emit::emit` was called with six arguments. New head `13be4c2c` has the fix merged up from #320: the call passes `emit::Target::ANY`, the same default the other callers use. Verified on #223 `fbfd3c67` and #439 `13be4c2c`: both CI clippy commands are clean, `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same command with `--all-features`. I didn't run the CI `cargo test --workspace` step on this PC, so CI will be the first to run it on this head. No title data was used. AI-assisted
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 05:41 UTC · original

Thanks to Machad3x for finding both problems in #2214 and proposing the fixes, and to @⁠steven-seagull27 for the two branches (9cc76b82, and the f16 sums in fork PR r4tedx/VIctory#19).

Both are taken as they are, with their authorship, plus one small test of ours. The head is now 2658128c:

  • 611184ee (9cc76b82): whole-wave reductions in partial groups now run in the console flow. A group of 32 threads or fewer skips the exchange between the two halves, so a min, max or And no longer reads the missing half's 0. Groups over 64 threads are still refused.
  • f968c54c (591c51c4): for f16 sums, the two halves' f32 sums are exchanged and added before the single rounding to f16. The packed high half now comes from the right lane, through the ballot and lane read across both halves.
  • 2658128c: checks the high-half lane from the section simulation, and that f16 sums translate at 32, 48 and 64 threads.

What we could check here (WARP only):

  • VICTORY_WARP=1 cargo test -p victory-shader --lib -- --test-threads=1: 343 passed, 4 failed, 3 ignored. The 4 failures are the synthetic_tests that also fail on main. The two added tests make up the difference from 341 before.
  • clippy with -D warnings, both default and --all-features: clean. cargo xtask policy: 194 files ok.

With VICTORY_WARP=1 no adapter is listed, so the program cases only translate and validate, and nothing is dispatched. The results on 32-lane hardware are steven-seagull27's alone: RTX 5080, 0 of 1,884 wrong over 1-64 threads. A split_tests run on a 32-lane card at 2658128c would still help, especially for an f16 sum in a partial group with a mask, which no test covers on hardware yet.

No title data was used.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 05:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7183709614) Thanks to Machad3x for finding both problems in #2214 and proposing the fixes, and to @⁠steven-seagull27 for the two branches (9cc76b82, and the f16 sums in fork PR r4tedx/VIctory#19). Both are taken as they are, with their authorship, plus one small test of ours. The head is now `2658128c`: - `611184ee` (9cc76b82): whole-wave reductions in partial groups now run in the console flow. A group of 32 threads or fewer skips the exchange between the two halves, so a min, max or And no longer reads the missing half's 0. Groups over 64 threads are still refused. - `f968c54c` (591c51c4): for f16 sums, the two halves' f32 sums are exchanged and added before the single rounding to f16. The packed high half now comes from the right lane, through the ballot and lane read across both halves. - `2658128c`: checks the high-half lane from the section simulation, and that f16 sums translate at 32, 48 and 64 threads. What we could check here (WARP only): - `VICTORY_WARP=1 cargo test -p victory-shader --lib -- --test-threads=1`: 343 passed, 4 failed, 3 ignored. The 4 failures are the `synthetic_tests` that also fail on main. The two added tests make up the difference from 341 before. - clippy with `-D warnings`, both default and `--all-features`: clean. `cargo xtask policy`: 194 files ok. With `VICTORY_WARP=1` no adapter is listed, so the program cases only translate and validate, and nothing is dispatched. The results on 32-lane hardware are steven-seagull27's alone: RTX 5080, 0 of 1,884 wrong over 1-64 threads. A `split_tests` run on a 32-lane card at `2658128c` would still help, especially for an f16 sum in a partial group with a mask, which no test covers on hardware yet. No title data was used. AI-assisted
Author
Owner

@⁠latentdev on GitHub · 2026-11-26 07:27 UTC · original

@⁠r4tedx here it is, as a patch against #233's head 87d1f42. It only touches emit/lower.rs and emit/split_tests.rs, and applies with git apply.

What it does in the console flow, one console wave per group:

  • LDS: after each LDS instruction other than ds_swizzle and the permutes, it adds a group barrier (in Lower::inst). Both halves reach every block, so one half's access finishes before the other half's next.
  • Whole-wave sections: each half reduces its own lanes with a wave op over the masked inputs, then the halves trade results through exchange. A reduction combines the two. A prefix adds the lower half's total in the upper half (Lower::console_shape). It covers integer and float sums, min, max, and/or/xor; f16 is refused.
  • Eligibility: LDS and sections are allowed, and permutes only inside sections. A group of one console wave that shares LDS without lane reads also takes the console flow.
  • Title memory: the extension applies only to programs that don't reach title memory by address (root_memory). Without that limit, the builder stages caa78b8ca62bc3d6 and 28918b7150a7aad5 translated, part of the builder ran, and the GPU hung.

#320 and #439 cover the same ground. Your LDS barrier comes before each access, and your sections now handle partial groups and f16. So this is more for comparison than to merge as it is.

Tests: five new ones in split_tests, hand-assembled from the tile classifier bad01f53f53248e5's own sections:

  • a whole-wave sum over all lanes;
  • a whole-wave sum over lane 0 alone;
  • an exclusive prefix over all lanes;
  • an exclusive prefix over lane 0 alone;
  • an LDS counter shared by both halves.

On an RTX 4090 (split) and the Radeon iGPU of a Ryzen 9 7950X3D (native wave64), all 17 split_tests are exact on both.

The whole victory-shader lib on this machine: 321 passed, 3 failed. The three are a_heap_buffer_read_by_element_takes_the_views_stride, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros and gathers_at_a_level_match_the_hardware, and they fail the same way at 87d1f42 without the patch. I skipped heap_direct_texture_reads_mark_their_heap_index, which crashes on this card on main too.

The frame-80 result in my earlier comment came from this change on a 63bcca4 stack.

Patch against 87d1f42
diff --git a/crates/victory-shader/src/emit/lower.rs b/crates/victory-shader/src/emit/lower.rs
index 4b7e321..53e16d9 100644
--- a/crates/victory-shader/src/emit/lower.rs
+++ b/crates/victory-shader/src/emit/lower.rs
@@ -668,16 +668,38 @@ impl<'a> Lower<'a> {
                 && (0..p.blocks.len()).all(|b| super::wave::sections(p, b).is_empty());
             // The rest of such programs need the halves to exchange values
             // (masks read whole, lanes of the other half): the console flow,
-            // for a group of one console wave without LDS.
-            wants_console_flow = console_lanes
+            // for a group of one console wave.
+            // LDS: a group barrier follows each access (`Lower::inst`); whole-wave
+            // sections: each half reduces its lanes and the halves exchange
+            // (`Lower::console_shape`), so a permute inside one is the
+            // simulation's; one outside reads lanes the halves do not exchange.
+            let permute_outside = (0..p.blocks.len()).any(|b| {
+                let secs = super::wave::sections(p, b);
+                p.blocks[b].insts.iter().enumerate().any(|(i, inst)| {
+                    inst.name().contains("permute")
+                        && !secs.iter().any(|(&start, sec)| i > start && i < sec.end)
+                })
+            });
+            // (A group of one console wave sharing LDS needs the halves ordered
+            // too, even without lane reads.)
+            let one_console_wave = cs.threads.iter().product::<u32>() <= 64;
+            let has_sections = (0..p.blocks.len()).any(|b| !super::wave::sections(p, b).is_empty());
+            let any_permute = insts().any(|i| i.name().contains("permute"));
+            // LDS and whole-wave sections only in programs that do not reach title
+            // memory by address: in the console flow every lane runs every block,
+            // and a lane the console wave had left out would load from whatever
+            // address it holds (the ray-tracing structure builder's stages, which
+            // also run all or none: run them partly and their stores land on
+            // garbage offsets).
+            let plain = s.lds_dwords == 0 && !has_sections && !any_permute;
+            let extended = !root_memory && !permute_outside;
+            wants_console_flow = (console_lanes || !root_memory && one_console_wave && s.lds_dwords > 0)
                 && !split
                 && x.native.wave64
                 && !x.target.runs(64)
                 && x.target.runs(32)
-                && s.lds_dwords == 0
-                && cs.threads.iter().product::<u32>() <= 64
-                && !insts().any(|i| i.name().contains("permute"))
-                && (0..p.blocks.len()).all(|b| super::wave::sections(p, b).is_empty());
+                && one_console_wave
+                && (plain || extended);
             if x.console_cf {
                 console_lanes = true;
                 split = true;
@@ -1319,7 +1341,10 @@ impl<'a> Lower<'a> {
         {
             return Err("a wave reduction in a mesh shader");
         }
-        if self.split {
+        // In the console flow both halves run the section (every lane runs
+        // every block): each half's result over its own lanes, then the two
+        // combined through the halves' exchange (below).
+        if self.split && !self.console_cf {
             return Err("a wave reduction in a wave64 program split in halves");
         }
         let c = self.cur;
@@ -1334,6 +1359,9 @@ impl<'a> Lower<'a> {
         let id = self.s.m.i32(ident);
         let x = self.s.m.select(c, on, x, id);
         self.s.flags |= flags::WAVE_OPS;
+        if self.console_cf {
+            return self.console_shape(op, prefix, x);
+        }
         let float = matches!(op, Op::AddF | Op::MinF | Op::MaxF);
         let (i32t, f32t) = (self.s.t.i32, self.s.t.f32);
         let arg = if float { self.as_float(x) } else { x };
@@ -1389,6 +1417,108 @@ impl<'a> Lower<'a> {
         Ok(if float { self.as_int(r) } else { r })
     }
 
+    /// Console flow: a whole-wave section's reduction or prefix of `x` (each
+    /// lane's input, the identity where the section's mask leaves it out)
+    /// over the console wave's 64 lanes, which are two host waves of 32.
+    /// Each half reduces its own lanes; the halves exchange those results
+    /// ([`Self::exchange`]): a reduction combines both, a prefix adds the
+    /// lower half's total in the upper half.
+    fn console_shape(&mut self, op: super::wave::Op, prefix: Option<bool>, x: V) -> Result<V, Why> {
+        use super::wave::Op;
+        let c = self.cur;
+        let float = matches!(op, Op::AddF | Op::MinF | Op::MaxF);
+        let (i32t, f32t) = (self.s.t.i32, self.s.t.f32);
+        let arg = if float { self.as_float(x) } else { x };
+        let ty = if float { f32t } else { i32t };
+        let sfx = if float { "f32" } else { "i32" };
+        let reduce = |me: &mut Self, arg: V| -> V {
+            match op {
+                Op::Or | Op::And | Op::Xor => {
+                    let k = me.s.m.i8(match op {
+                        Op::And => 0,
+                        Op::Or => 1,
+                        _ => 2,
+                    });
+                    me.s.op(c, "waveActiveBit.i32", Attr::NoUnwind, i32t, 120, &[arg, k])
+                }
+                _ => {
+                    let (code, unsigned) = match op {
+                        Op::AddU => (0, 1),
+                        Op::AddF => (0, 0),
+                        Op::MinU => (2, 1),
+                        Op::MaxU => (3, 1),
+                        Op::MinI | Op::MinF => (2, 0),
+                        _ => (3, 0),
+                    };
+                    let (k, u) = (me.s.m.i8(code), me.s.m.i8(unsigned));
+                    me.s.op(c, &format!("waveActiveOp.{sfx}"), Attr::NoUnwind, ty, 119, &[arg, k, u])
+                }
+            }
+        };
+        let bits = |me: &mut Self, v: V| if float { me.as_int(v) } else { v };
+        let value = |me: &mut Self, v: V| if float { me.as_float(v) } else { v };
+        match prefix {
+            Some(inclusive) => {
+                if !matches!(op, Op::AddU | Op::AddF) {
+                    return Err("a wave prefix of an operation other than a sum");
+                }
+                let (k0, k1) = (self.s.m.i8(0), self.s.m.i8(1));
+                let mut r =
+                    self.s.op(c, &format!("wavePrefixOp.{sfx}"), Attr::NoUnwind, ty, 121, &[arg, k0, k1]);
+                if inclusive {
+                    r = self.s.m.bin(c, Bin::Add, r, arg);
+                }
+                // The upper half's lanes follow the lower half's.
+                let total = reduce(self, arg);
+                let total = bits(self, total);
+                let (lo, _) = self.exchange(c, total);
+                let lo = value(self, lo);
+                let (_, half) = self.console_lane();
+                let z = self.s.m.i32(0);
+                let upper = self.s.m.cmp(c, pred::NE, half, z);
+                let zero = if float { self.as_float(z) } else { z };
+                let add = self.s.m.select(c, upper, lo, zero);
+                let r = self.s.m.bin(c, Bin::Add, r, add);
+                Ok(bits(self, r))
+            }
+            None => {
+                let mine = reduce(self, arg);
+                let mine = bits(self, mine);
+                let (lo, hi) = self.exchange(c, mine);
+                let r = match op {
+                    Op::AddU => self.s.m.bin(c, Bin::Add, lo, hi),
+                    Op::Or => self.s.m.bin(c, Bin::Or, lo, hi),
+                    Op::And => self.s.m.bin(c, Bin::And, lo, hi),
+                    Op::Xor => self.s.m.bin(c, Bin::Xor, lo, hi),
+                    Op::AddF => {
+                        let (a, b) = (self.as_float(lo), self.as_float(hi));
+                        let s = self.s.m.bin(c, Bin::Add, a, b);
+                        self.as_int(s)
+                    }
+                    Op::MinF | Op::MaxF => {
+                        let (a, b) = (self.as_float(lo), self.as_float(hi));
+                        // dx.op FMax 35, FMin 36.
+                        let code = if op == Op::MaxF { 35 } else { 36 };
+                        let m = self.binary(code, a, b);
+                        self.as_int(m)
+                    }
+                    Op::MinU | Op::MaxU | Op::MinI | Op::MaxI => {
+                        let p = match op {
+                            Op::MinU => pred::IULT,
+                            Op::MaxU => pred::IUGT,
+                            Op::MinI => pred::SLT,
+                            _ => pred::SGT,
+                        };
+                        let take_lo = self.s.m.cmp(c, p, lo, hi);
+                        self.s.m.select(c, take_lo, lo, hi)
+                    }
+                    Op::AddH => return Err("a 16-bit wave reduction in the console flow"),
+                };
+                Ok(r)
+            }
+        }
+    }
+
     fn run(mut self) -> Result<Lowered, Stop> {
         if self.wants_console_flow && !self.x.console_cf {
             return Err(unsupported(0, CONSOLE_FLOW));
@@ -3730,7 +3860,26 @@ impl<'a> Lower<'a> {
             Fields::Image { .. } => self.image(inst, b, i),
             Fields::Buffer { .. } => self.buffer(inst, b, i),
             Fields::Exp { .. } => self.export(b, i),
-            Fields::Ds { .. } => self.ds(inst, b, i),
+            Fields::Ds { .. } => {
+                let r = self.ds(inst, b, i);
+                // Console flow: the console wave runs an LDS instruction in all
+                // its lanes before the next, and its compiler leaves out the
+                // barriers between lanes of one wave. Here its two halves are
+                // two host waves: each LDS access is followed by a group
+                // barrier, which both halves reach (every lane runs every block,
+                // `CONSOLE_FLOW`), so one half's accesses are done before the
+                // other's next.
+                if self.console_cf
+                    && r.is_ok()
+                    && !(name.starts_with("ds_swizzle") || name.contains("permute"))
+                {
+                    let mode = self.s.m.i32(1 | 8);
+                    let void = self.s.t.void;
+                    self.s
+                        .op(self.cur, "barrier", Attr::NoDuplicate, void, 80, &[mode]);
+                }
+                r
+            }
             Fields::Flat { .. } if name.starts_with("global_") => self.flat(inst, b, i),
             Fields::Flat { .. } => Err("flat memory"),
         };
diff --git a/crates/victory-shader/src/emit/split_tests.rs b/crates/victory-shader/src/emit/split_tests.rs
index 2f096fa..8e95530 100644
--- a/crates/victory-shader/src/emit/split_tests.rs
+++ b/crates/victory-shader/src/emit/split_tests.rs
@@ -433,3 +433,170 @@ fn a_mask_copied_dword_by_dword_stops_instead_of_recursing() {
         assert!(e.contains(why), "{lanes_min}..{lanes_max}: {e}");
     }
 }
+
+/// The console compiler's whole-wave sum (HLSL `WaveActiveSum` on wave64:
+/// DPP within rows, `v_permlanex16` across rows, `v_readlane` 32 across
+/// the halves), as the tile classifier `bad01f53f53248e5` has it: each
+/// half sums its own lanes and the halves exchange.
+const SECTION_SUM: &[u32] = &[
+    0xBE80_25C1, // s_or_saveexec_b64 s[0:1], -1
+    0xD501_0002,
+    0x0002_2080, // v_cndmask_b32 v2, 0, v16, s[0:1]
+    0x4A04_04E9,
+    0xDE54_C102, // v_add_nc_u32 v2, v2, v2 dpp8:[1,0,3,2,5,4,7,6]
+    0x4A04_04E9,
+    0x9360_1202, // v_add_nc_u32 v2, v2, v2 dpp8:[2,2,0,0,6,6,4,4]
+    0x4A04_04E9,
+    0x0009_2402, // v_add_nc_u32 v2, v2, v2 dpp8:[4,4,4,4,0,0,0,0]
+    0x4A04_04FA,
+    0xFF09_4002, // v_add_nc_u32 v2, v2, v2 row_mirror bound_ctrl:1
+    0xD778_0003,
+    0x0201_0102, // v_permlanex16_b32 v3, v2, 0, 0
+    0x4A04_0503, // v_add_nc_u32 v2, v3, v2
+    0xD760_0002,
+    0x0001_4102, // v_readlane_b32 s2, v2, 32
+    0x4A04_0402, // v_add_nc_u32 v2, s2, v2
+    0xD760_000C,
+    0x0001_0102, // v_readlane_b32 s12, v2, 0
+    0xBEFE_0400, // s_mov_b64 exec, s[0:1]
+];
+
+/// The console compiler's whole-wave exclusive prefix sum of v16 into v3
+/// (rows by DPP shifts, rows of 16 by `v_permlanex16`, the upper half
+/// after lane 31 of the lower), as `bad01f53f53248e5` has it.
+const SECTION_PREFIX: &[u32] = &[
+    0xBE8A_25C1, // s_or_saveexec_b64 s[10:11], -1
+    0xD501_0002,
+    0x002A_2080, // v_cndmask_b32 v2, 0, v16, s[10:11]
+    0x7E06_0302, // v_mov_b32 v3, v2
+    0x4A06_06FA,
+    0xFF09_1103, // v_add_nc_u32 v3, v3, v3 row_shr:1 bound_ctrl:1
+    0x4A06_06FA,
+    0xFF01_1203, // v_add_nc_u32 v3, v3, v3 row_shr:2
+    0x4A06_06FA,
+    0xFF01_1403, // v_add_nc_u32 v3, v3, v3 row_shr:4
+    0x4A06_06FA,
+    0xFF01_1803, // v_add_nc_u32 v3, v3, v3 row_shr:8
+    0xBEFE_03FF,
+    0xFFFF_0000, // s_mov_b32 exec_lo, 0xffff0000
+    0xBEFF_03FF,
+    0xFFFF_0000, // s_mov_b32 exec_hi, 0xffff0000
+    0xD778_4804,
+    0x0305_8303, // v_permlanex16_b32 v4, v3, -1, -1 fi:1
+    0x4A06_0704, // v_add_nc_u32 v3, v4, v3
+    0xD760_000D,
+    0x0001_3F03, // v_readlane_b32 s13, v3, 31
+    0xBEFE_0380, // s_mov_b32 exec_lo, 0
+    0xBEFF_03C1, // s_mov_b32 exec_hi, -1
+    0x4A06_060D, // v_add_nc_u32 v3, s13, v3
+    0xBEFE_03C1, // s_mov_b32 exec_lo, -1
+    0xBEFF_03C1, // s_mov_b32 exec_hi, -1
+    0x4C06_0503, // v_sub_nc_u32 v3, v3, v2
+    0xBEFE_040A, // s_mov_b64 exec, s[10:11]
+];
+
+/// Lane 0 alone in EXEC (s[14:15] keeps the whole wave's).
+const LANE_0_ONLY: &[u32] = &[
+    0x7D84_0080, // v_cmp_eq_u32 vcc, 0, v0
+    0xBE8E_246A, // s_and_saveexec_b64 s[14:15], vcc
+];
+const WHOLE_AGAIN: u32 = 0xBEFE_040E; // s_mov_b64 exec, s[14:15]
+
+fn joined(parts: &[&[u32]]) -> Vec<u32> {
+    parts.iter().flat_map(|p| p.iter().copied()).collect()
+}
+
+/// A whole-wave sum over every lane of the console wave: both halves'.
+#[test]
+fn whole_wave_sums_add_both_halves() {
+    let body = joined(&[
+        &[0x7E20_0300], // v_mov_b32 v16, v0
+        SECTION_SUM,
+        &[0x7E04_020C], // v_mov_b32 v2, s12
+    ]);
+    console_flow_case("whole-wave sum of lane ids", &body, 64, |_| (0..64).sum());
+}
+
+/// The classifier's append: lane 0 alone in EXEC, the sum of its 8.
+#[test]
+fn whole_wave_sums_of_one_lane() {
+    let body = joined(&[
+        &[0x7E20_0288], // v_mov_b32 v16, 8
+        LANE_0_ONLY,
+        SECTION_SUM,
+        &[WHOLE_AGAIN, 0x7E04_020C], // s_mov_b64 exec, s[14:15]; v_mov_b32 v2, s12
+    ]);
+    console_flow_case("whole-wave sum of lane 0's 8", &body, 64, |_| 8);
+}
+
+/// An exclusive prefix over the console wave: lanes of the upper half
+/// count every lane of the lower one.
+#[test]
+fn whole_wave_prefixes_run_on_from_the_lower_half() {
+    let body = joined(&[
+        &[0x7E20_0281], // v_mov_b32 v16, 1
+        SECTION_PREFIX,
+        &[0x7E04_0303], // v_mov_b32 v2, v3
+    ]);
+    console_flow_case("exclusive prefix of ones", &body, 64, |t| t);
+}
+
+/// The classifier's offsets: lane 0 alone gives 8; the section writes every
+/// lane, past lane 0 the prefix is 8.
+#[test]
+fn whole_wave_prefixes_of_one_lane() {
+    let body = joined(&[
+        &[0x7E20_0288], // v_mov_b32 v16, 8
+        LANE_0_ONLY,
+        SECTION_PREFIX,
+        &[WHOLE_AGAIN, 0x7E04_0303], // s_mov_b64 exec, s[14:15]; v_mov_b32 v2, v3
+    ]);
+    console_flow_case("exclusive prefix of lane 0's 8", &body, 64, |t| if t == 0 { 0 } else { 8 });
+}
+
+/// [`console_flow_case`] for a program with 512 bytes of LDS.
+fn lds_flow_case(label: &str, body: &[u32], threads: u32, want: impl Fn(u32) -> u32) {
+    let Ok(names) = adapters() else {
+        eprintln!("no DXGI; skipped");
+        return;
+    };
+    for name in names {
+        let Ok(host) = Host::on(&name) else {
+            continue;
+        };
+        let mut p = program(body, threads);
+        if let StageIo::Cs(cs) = &mut p.io {
+            cs.rsrc2 |= 1 << 15;
+        }
+        let split = !host.target().runs(64);
+        let groups = 2;
+        let out = run(&host, &p, groups).unwrap_or_else(|e| panic!("{name}: {label}: {e}"));
+        let expect: Vec<u32> = (0..groups).flat_map(|_| (0..threads).map(&want)).collect();
+        assert_eq!(out, expect, "{name}: {label}, {threads} threads (split {split})");
+        eprintln!("{name}: {label}, {threads} threads exact (split {split})");
+    }
+}
+
+/// LDS the console wave shares without barriers (its compiler leaves them
+/// out within one wave): lane 0 clears a counter, every lane adds 1, every
+/// lane reads it. Both halves' adds land before either half reads.
+#[test]
+fn lds_shared_within_the_console_wave_orders_both_halves() {
+    let body = joined(&[
+        &[0x7E02_0280, 0x7E08_0281], // v_mov_b32 v1, 0; v_mov_b32 v4, 1
+        LANE_0_ONLY,
+        &[
+            0xD834_0000,
+            0x0000_0101, // ds_write_b32 v1, v1
+            0xBF8C_C07F, // s_waitcnt lgkmcnt(0)
+            WHOLE_AGAIN,
+            0xD800_0000,
+            0x0000_0401, // ds_add_u32 v1, v4
+            0xBF8C_C07F, // s_waitcnt lgkmcnt(0)
+            0xD8D8_0000,
+            0x0200_0001, // ds_read_b32 v2, v1
+            0xBF8C_C07F, // s_waitcnt lgkmcnt(0)
+        ],
+    ]);
+    lds_flow_case("LDS counter of the whole wave", &body, 64, |_| 64);
+}
**@⁠latentdev** on GitHub · 2026-11-26 07:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7185485744) @⁠r4tedx here it is, as a patch against #233's head `87d1f42`. It only touches `emit/lower.rs` and `emit/split_tests.rs`, and applies with `git apply`. **What it does in the console flow, one console wave per group:** - **LDS:** after each LDS instruction other than `ds_swizzle` and the permutes, it adds a group barrier (in `Lower::inst`). Both halves reach every block, so one half's access finishes before the other half's next. - **Whole-wave sections:** each half reduces its own lanes with a wave op over the masked inputs, then the halves trade results through `exchange`. A reduction combines the two. A prefix adds the lower half's total in the upper half (`Lower::console_shape`). It covers integer and float sums, min, max, and/or/xor; f16 is refused. - **Eligibility:** LDS and sections are allowed, and permutes only inside sections. A group of one console wave that shares LDS without lane reads also takes the console flow. - **Title memory:** the extension applies only to programs that don't reach title memory by address (`root_memory`). Without that limit, the builder stages `caa78b8ca62bc3d6` and `28918b7150a7aad5` translated, part of the builder ran, and the GPU hung. #320 and #439 cover the same ground. Your LDS barrier comes before each access, and your sections now handle partial groups and f16. So this is more for comparison than to merge as it is. **Tests:** five new ones in `split_tests`, hand-assembled from the tile classifier `bad01f53f53248e5`'s own sections: - a whole-wave sum over all lanes; - a whole-wave sum over lane 0 alone; - an exclusive prefix over all lanes; - an exclusive prefix over lane 0 alone; - an LDS counter shared by both halves. On an RTX 4090 (split) and the Radeon iGPU of a Ryzen 9 7950X3D (native wave64), all 17 `split_tests` are exact on both. The whole `victory-shader` lib on this machine: 321 passed, 3 failed. The three are `a_heap_buffer_read_by_element_takes_the_views_stride`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` and `gathers_at_a_level_match_the_hardware`, and they fail the same way at `87d1f42` without the patch. I skipped `heap_direct_texture_reads_mark_their_heap_index`, which crashes on this card on `main` too. The frame-80 result in my earlier comment came from this change on a 63bcca4 stack. <details><summary>Patch against 87d1f42</summary> ```diff diff --git a/crates/victory-shader/src/emit/lower.rs b/crates/victory-shader/src/emit/lower.rs index 4b7e321..53e16d9 100644 --- a/crates/victory-shader/src/emit/lower.rs +++ b/crates/victory-shader/src/emit/lower.rs @@ -668,16 +668,38 @@ impl<'a> Lower<'a> { && (0..p.blocks.len()).all(|b| super::wave::sections(p, b).is_empty()); // The rest of such programs need the halves to exchange values // (masks read whole, lanes of the other half): the console flow, - // for a group of one console wave without LDS. - wants_console_flow = console_lanes + // for a group of one console wave. + // LDS: a group barrier follows each access (`Lower::inst`); whole-wave + // sections: each half reduces its lanes and the halves exchange + // (`Lower::console_shape`), so a permute inside one is the + // simulation's; one outside reads lanes the halves do not exchange. + let permute_outside = (0..p.blocks.len()).any(|b| { + let secs = super::wave::sections(p, b); + p.blocks[b].insts.iter().enumerate().any(|(i, inst)| { + inst.name().contains("permute") + && !secs.iter().any(|(&start, sec)| i > start && i < sec.end) + }) + }); + // (A group of one console wave sharing LDS needs the halves ordered + // too, even without lane reads.) + let one_console_wave = cs.threads.iter().product::<u32>() <= 64; + let has_sections = (0..p.blocks.len()).any(|b| !super::wave::sections(p, b).is_empty()); + let any_permute = insts().any(|i| i.name().contains("permute")); + // LDS and whole-wave sections only in programs that do not reach title + // memory by address: in the console flow every lane runs every block, + // and a lane the console wave had left out would load from whatever + // address it holds (the ray-tracing structure builder's stages, which + // also run all or none: run them partly and their stores land on + // garbage offsets). + let plain = s.lds_dwords == 0 && !has_sections && !any_permute; + let extended = !root_memory && !permute_outside; + wants_console_flow = (console_lanes || !root_memory && one_console_wave && s.lds_dwords > 0) && !split && x.native.wave64 && !x.target.runs(64) && x.target.runs(32) - && s.lds_dwords == 0 - && cs.threads.iter().product::<u32>() <= 64 - && !insts().any(|i| i.name().contains("permute")) - && (0..p.blocks.len()).all(|b| super::wave::sections(p, b).is_empty()); + && one_console_wave + && (plain || extended); if x.console_cf { console_lanes = true; split = true; @@ -1319,7 +1341,10 @@ impl<'a> Lower<'a> { { return Err("a wave reduction in a mesh shader"); } - if self.split { + // In the console flow both halves run the section (every lane runs + // every block): each half's result over its own lanes, then the two + // combined through the halves' exchange (below). + if self.split && !self.console_cf { return Err("a wave reduction in a wave64 program split in halves"); } let c = self.cur; @@ -1334,6 +1359,9 @@ impl<'a> Lower<'a> { let id = self.s.m.i32(ident); let x = self.s.m.select(c, on, x, id); self.s.flags |= flags::WAVE_OPS; + if self.console_cf { + return self.console_shape(op, prefix, x); + } let float = matches!(op, Op::AddF | Op::MinF | Op::MaxF); let (i32t, f32t) = (self.s.t.i32, self.s.t.f32); let arg = if float { self.as_float(x) } else { x }; @@ -1389,6 +1417,108 @@ impl<'a> Lower<'a> { Ok(if float { self.as_int(r) } else { r }) } + /// Console flow: a whole-wave section's reduction or prefix of `x` (each + /// lane's input, the identity where the section's mask leaves it out) + /// over the console wave's 64 lanes, which are two host waves of 32. + /// Each half reduces its own lanes; the halves exchange those results + /// ([`Self::exchange`]): a reduction combines both, a prefix adds the + /// lower half's total in the upper half. + fn console_shape(&mut self, op: super::wave::Op, prefix: Option<bool>, x: V) -> Result<V, Why> { + use super::wave::Op; + let c = self.cur; + let float = matches!(op, Op::AddF | Op::MinF | Op::MaxF); + let (i32t, f32t) = (self.s.t.i32, self.s.t.f32); + let arg = if float { self.as_float(x) } else { x }; + let ty = if float { f32t } else { i32t }; + let sfx = if float { "f32" } else { "i32" }; + let reduce = |me: &mut Self, arg: V| -> V { + match op { + Op::Or | Op::And | Op::Xor => { + let k = me.s.m.i8(match op { + Op::And => 0, + Op::Or => 1, + _ => 2, + }); + me.s.op(c, "waveActiveBit.i32", Attr::NoUnwind, i32t, 120, &[arg, k]) + } + _ => { + let (code, unsigned) = match op { + Op::AddU => (0, 1), + Op::AddF => (0, 0), + Op::MinU => (2, 1), + Op::MaxU => (3, 1), + Op::MinI | Op::MinF => (2, 0), + _ => (3, 0), + }; + let (k, u) = (me.s.m.i8(code), me.s.m.i8(unsigned)); + me.s.op(c, &format!("waveActiveOp.{sfx}"), Attr::NoUnwind, ty, 119, &[arg, k, u]) + } + } + }; + let bits = |me: &mut Self, v: V| if float { me.as_int(v) } else { v }; + let value = |me: &mut Self, v: V| if float { me.as_float(v) } else { v }; + match prefix { + Some(inclusive) => { + if !matches!(op, Op::AddU | Op::AddF) { + return Err("a wave prefix of an operation other than a sum"); + } + let (k0, k1) = (self.s.m.i8(0), self.s.m.i8(1)); + let mut r = + self.s.op(c, &format!("wavePrefixOp.{sfx}"), Attr::NoUnwind, ty, 121, &[arg, k0, k1]); + if inclusive { + r = self.s.m.bin(c, Bin::Add, r, arg); + } + // The upper half's lanes follow the lower half's. + let total = reduce(self, arg); + let total = bits(self, total); + let (lo, _) = self.exchange(c, total); + let lo = value(self, lo); + let (_, half) = self.console_lane(); + let z = self.s.m.i32(0); + let upper = self.s.m.cmp(c, pred::NE, half, z); + let zero = if float { self.as_float(z) } else { z }; + let add = self.s.m.select(c, upper, lo, zero); + let r = self.s.m.bin(c, Bin::Add, r, add); + Ok(bits(self, r)) + } + None => { + let mine = reduce(self, arg); + let mine = bits(self, mine); + let (lo, hi) = self.exchange(c, mine); + let r = match op { + Op::AddU => self.s.m.bin(c, Bin::Add, lo, hi), + Op::Or => self.s.m.bin(c, Bin::Or, lo, hi), + Op::And => self.s.m.bin(c, Bin::And, lo, hi), + Op::Xor => self.s.m.bin(c, Bin::Xor, lo, hi), + Op::AddF => { + let (a, b) = (self.as_float(lo), self.as_float(hi)); + let s = self.s.m.bin(c, Bin::Add, a, b); + self.as_int(s) + } + Op::MinF | Op::MaxF => { + let (a, b) = (self.as_float(lo), self.as_float(hi)); + // dx.op FMax 35, FMin 36. + let code = if op == Op::MaxF { 35 } else { 36 }; + let m = self.binary(code, a, b); + self.as_int(m) + } + Op::MinU | Op::MaxU | Op::MinI | Op::MaxI => { + let p = match op { + Op::MinU => pred::IULT, + Op::MaxU => pred::IUGT, + Op::MinI => pred::SLT, + _ => pred::SGT, + }; + let take_lo = self.s.m.cmp(c, p, lo, hi); + self.s.m.select(c, take_lo, lo, hi) + } + Op::AddH => return Err("a 16-bit wave reduction in the console flow"), + }; + Ok(r) + } + } + } + fn run(mut self) -> Result<Lowered, Stop> { if self.wants_console_flow && !self.x.console_cf { return Err(unsupported(0, CONSOLE_FLOW)); @@ -3730,7 +3860,26 @@ impl<'a> Lower<'a> { Fields::Image { .. } => self.image(inst, b, i), Fields::Buffer { .. } => self.buffer(inst, b, i), Fields::Exp { .. } => self.export(b, i), - Fields::Ds { .. } => self.ds(inst, b, i), + Fields::Ds { .. } => { + let r = self.ds(inst, b, i); + // Console flow: the console wave runs an LDS instruction in all + // its lanes before the next, and its compiler leaves out the + // barriers between lanes of one wave. Here its two halves are + // two host waves: each LDS access is followed by a group + // barrier, which both halves reach (every lane runs every block, + // `CONSOLE_FLOW`), so one half's accesses are done before the + // other's next. + if self.console_cf + && r.is_ok() + && !(name.starts_with("ds_swizzle") || name.contains("permute")) + { + let mode = self.s.m.i32(1 | 8); + let void = self.s.t.void; + self.s + .op(self.cur, "barrier", Attr::NoDuplicate, void, 80, &[mode]); + } + r + } Fields::Flat { .. } if name.starts_with("global_") => self.flat(inst, b, i), Fields::Flat { .. } => Err("flat memory"), }; diff --git a/crates/victory-shader/src/emit/split_tests.rs b/crates/victory-shader/src/emit/split_tests.rs index 2f096fa..8e95530 100644 --- a/crates/victory-shader/src/emit/split_tests.rs +++ b/crates/victory-shader/src/emit/split_tests.rs @@ -433,3 +433,170 @@ fn a_mask_copied_dword_by_dword_stops_instead_of_recursing() { assert!(e.contains(why), "{lanes_min}..{lanes_max}: {e}"); } } + +/// The console compiler's whole-wave sum (HLSL `WaveActiveSum` on wave64: +/// DPP within rows, `v_permlanex16` across rows, `v_readlane` 32 across +/// the halves), as the tile classifier `bad01f53f53248e5` has it: each +/// half sums its own lanes and the halves exchange. +const SECTION_SUM: &[u32] = &[ + 0xBE80_25C1, // s_or_saveexec_b64 s[0:1], -1 + 0xD501_0002, + 0x0002_2080, // v_cndmask_b32 v2, 0, v16, s[0:1] + 0x4A04_04E9, + 0xDE54_C102, // v_add_nc_u32 v2, v2, v2 dpp8:[1,0,3,2,5,4,7,6] + 0x4A04_04E9, + 0x9360_1202, // v_add_nc_u32 v2, v2, v2 dpp8:[2,2,0,0,6,6,4,4] + 0x4A04_04E9, + 0x0009_2402, // v_add_nc_u32 v2, v2, v2 dpp8:[4,4,4,4,0,0,0,0] + 0x4A04_04FA, + 0xFF09_4002, // v_add_nc_u32 v2, v2, v2 row_mirror bound_ctrl:1 + 0xD778_0003, + 0x0201_0102, // v_permlanex16_b32 v3, v2, 0, 0 + 0x4A04_0503, // v_add_nc_u32 v2, v3, v2 + 0xD760_0002, + 0x0001_4102, // v_readlane_b32 s2, v2, 32 + 0x4A04_0402, // v_add_nc_u32 v2, s2, v2 + 0xD760_000C, + 0x0001_0102, // v_readlane_b32 s12, v2, 0 + 0xBEFE_0400, // s_mov_b64 exec, s[0:1] +]; + +/// The console compiler's whole-wave exclusive prefix sum of v16 into v3 +/// (rows by DPP shifts, rows of 16 by `v_permlanex16`, the upper half +/// after lane 31 of the lower), as `bad01f53f53248e5` has it. +const SECTION_PREFIX: &[u32] = &[ + 0xBE8A_25C1, // s_or_saveexec_b64 s[10:11], -1 + 0xD501_0002, + 0x002A_2080, // v_cndmask_b32 v2, 0, v16, s[10:11] + 0x7E06_0302, // v_mov_b32 v3, v2 + 0x4A06_06FA, + 0xFF09_1103, // v_add_nc_u32 v3, v3, v3 row_shr:1 bound_ctrl:1 + 0x4A06_06FA, + 0xFF01_1203, // v_add_nc_u32 v3, v3, v3 row_shr:2 + 0x4A06_06FA, + 0xFF01_1403, // v_add_nc_u32 v3, v3, v3 row_shr:4 + 0x4A06_06FA, + 0xFF01_1803, // v_add_nc_u32 v3, v3, v3 row_shr:8 + 0xBEFE_03FF, + 0xFFFF_0000, // s_mov_b32 exec_lo, 0xffff0000 + 0xBEFF_03FF, + 0xFFFF_0000, // s_mov_b32 exec_hi, 0xffff0000 + 0xD778_4804, + 0x0305_8303, // v_permlanex16_b32 v4, v3, -1, -1 fi:1 + 0x4A06_0704, // v_add_nc_u32 v3, v4, v3 + 0xD760_000D, + 0x0001_3F03, // v_readlane_b32 s13, v3, 31 + 0xBEFE_0380, // s_mov_b32 exec_lo, 0 + 0xBEFF_03C1, // s_mov_b32 exec_hi, -1 + 0x4A06_060D, // v_add_nc_u32 v3, s13, v3 + 0xBEFE_03C1, // s_mov_b32 exec_lo, -1 + 0xBEFF_03C1, // s_mov_b32 exec_hi, -1 + 0x4C06_0503, // v_sub_nc_u32 v3, v3, v2 + 0xBEFE_040A, // s_mov_b64 exec, s[10:11] +]; + +/// Lane 0 alone in EXEC (s[14:15] keeps the whole wave's). +const LANE_0_ONLY: &[u32] = &[ + 0x7D84_0080, // v_cmp_eq_u32 vcc, 0, v0 + 0xBE8E_246A, // s_and_saveexec_b64 s[14:15], vcc +]; +const WHOLE_AGAIN: u32 = 0xBEFE_040E; // s_mov_b64 exec, s[14:15] + +fn joined(parts: &[&[u32]]) -> Vec<u32> { + parts.iter().flat_map(|p| p.iter().copied()).collect() +} + +/// A whole-wave sum over every lane of the console wave: both halves'. +#[test] +fn whole_wave_sums_add_both_halves() { + let body = joined(&[ + &[0x7E20_0300], // v_mov_b32 v16, v0 + SECTION_SUM, + &[0x7E04_020C], // v_mov_b32 v2, s12 + ]); + console_flow_case("whole-wave sum of lane ids", &body, 64, |_| (0..64).sum()); +} + +/// The classifier's append: lane 0 alone in EXEC, the sum of its 8. +#[test] +fn whole_wave_sums_of_one_lane() { + let body = joined(&[ + &[0x7E20_0288], // v_mov_b32 v16, 8 + LANE_0_ONLY, + SECTION_SUM, + &[WHOLE_AGAIN, 0x7E04_020C], // s_mov_b64 exec, s[14:15]; v_mov_b32 v2, s12 + ]); + console_flow_case("whole-wave sum of lane 0's 8", &body, 64, |_| 8); +} + +/// An exclusive prefix over the console wave: lanes of the upper half +/// count every lane of the lower one. +#[test] +fn whole_wave_prefixes_run_on_from_the_lower_half() { + let body = joined(&[ + &[0x7E20_0281], // v_mov_b32 v16, 1 + SECTION_PREFIX, + &[0x7E04_0303], // v_mov_b32 v2, v3 + ]); + console_flow_case("exclusive prefix of ones", &body, 64, |t| t); +} + +/// The classifier's offsets: lane 0 alone gives 8; the section writes every +/// lane, past lane 0 the prefix is 8. +#[test] +fn whole_wave_prefixes_of_one_lane() { + let body = joined(&[ + &[0x7E20_0288], // v_mov_b32 v16, 8 + LANE_0_ONLY, + SECTION_PREFIX, + &[WHOLE_AGAIN, 0x7E04_0303], // s_mov_b64 exec, s[14:15]; v_mov_b32 v2, v3 + ]); + console_flow_case("exclusive prefix of lane 0's 8", &body, 64, |t| if t == 0 { 0 } else { 8 }); +} + +/// [`console_flow_case`] for a program with 512 bytes of LDS. +fn lds_flow_case(label: &str, body: &[u32], threads: u32, want: impl Fn(u32) -> u32) { + let Ok(names) = adapters() else { + eprintln!("no DXGI; skipped"); + return; + }; + for name in names { + let Ok(host) = Host::on(&name) else { + continue; + }; + let mut p = program(body, threads); + if let StageIo::Cs(cs) = &mut p.io { + cs.rsrc2 |= 1 << 15; + } + let split = !host.target().runs(64); + let groups = 2; + let out = run(&host, &p, groups).unwrap_or_else(|e| panic!("{name}: {label}: {e}")); + let expect: Vec<u32> = (0..groups).flat_map(|_| (0..threads).map(&want)).collect(); + assert_eq!(out, expect, "{name}: {label}, {threads} threads (split {split})"); + eprintln!("{name}: {label}, {threads} threads exact (split {split})"); + } +} + +/// LDS the console wave shares without barriers (its compiler leaves them +/// out within one wave): lane 0 clears a counter, every lane adds 1, every +/// lane reads it. Both halves' adds land before either half reads. +#[test] +fn lds_shared_within_the_console_wave_orders_both_halves() { + let body = joined(&[ + &[0x7E02_0280, 0x7E08_0281], // v_mov_b32 v1, 0; v_mov_b32 v4, 1 + LANE_0_ONLY, + &[ + 0xD834_0000, + 0x0000_0101, // ds_write_b32 v1, v1 + 0xBF8C_C07F, // s_waitcnt lgkmcnt(0) + WHOLE_AGAIN, + 0xD800_0000, + 0x0000_0401, // ds_add_u32 v1, v4 + 0xBF8C_C07F, // s_waitcnt lgkmcnt(0) + 0xD8D8_0000, + 0x0200_0001, // ds_read_b32 v2, v1 + 0xBF8C_C07F, // s_waitcnt lgkmcnt(0) + ], + ]); + lds_flow_case("LDS counter of the whole wave", &body, 64, |_| 64); +} ``` </details>
Author
Owner

@⁠latentdev on GitHub · 2026-11-26 07:41 UTC · original

split_tests at 2658128 on an RTX 4090 and a Radeon iGPU

I ran cargo test -p victory-shader --lib split_tests -- --test-threads=1 at 2658128c on Windows 11, on one machine with two adapters:

  • an RTX 4090 (driver 621.24, 32-lane waves, so split);
  • the Radeon iGPU of a Ryzen 9 7950X3D (64-lane waves, not split).

All 35 passed, and every hardware case printed exact on both adapters: 87 cases on the 4090 and 88 on the Radeon. That covers:

  • whole_wave_reductions_in_partial_groups: sum, min and max at 1, 6, 31, 32, 33, 36, 48, 63 and 64 threads;
  • the f16 tests (half_sum_and_packed_lane_cross_host_halves with all six masks, and half_sum_takes_the_high_half_of_the_lane_it_ends_in);
  • the float sums, both masked and inclusive prefix.

As you said, none of them is an f16 sum in a partial group with a mask, so that case still has no hardware run.

**@⁠latentdev** on GitHub · 2026-11-26 07:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7185729947) ### `split_tests` at 2658128 on an RTX 4090 and a Radeon iGPU I ran `cargo test -p victory-shader --lib split_tests -- --test-threads=1` at `2658128c` on Windows 11, on one machine with two adapters: - an RTX 4090 (driver 621.24, 32-lane waves, so split); - the Radeon iGPU of a Ryzen 9 7950X3D (64-lane waves, not split). All 35 passed, and every hardware case printed `exact` on both adapters: 87 cases on the 4090 and 88 on the Radeon. That covers: - `whole_wave_reductions_in_partial_groups`: sum, min and max at 1, 6, 31, 32, 33, 36, 48, 63 and 64 threads; - the f16 tests (`half_sum_and_packed_lane_cross_host_halves` with all six masks, and `half_sum_takes_the_high_half_of_the_lane_it_ends_in`); - the float sums, both masked and inclusive prefix. As you said, none of them is an f16 sum in a partial group with a mask, so that case still has no hardware run.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 07:45 UTC · original

Thanks @⁠latentdev. The root_memory limit is the part #439 was missing, and thanks for the split_tests run at 2658128c on the RTX 4090 and the 7950X3D iGPU.

I compared your patch (against 87d1f42) with 2658128c:

  • LDS: you put a group barrier after each LDS access, and #439 puts one before each access. Either way there is one barrier between any two accesses and both halves reach it, so a write in one half followed by a read in the other is ordered.
  • Sections: #439 differs in three places:
    • it skips combining the halves in groups of 32 threads or fewer, since otherwise min and and would be combined with the missing half's 0;
    • it keeps -0.0 in a float prefix;
    • it lowers f16 sums.
  • Permutes: these differ in both directions. Your patch allows forward permutes inside sections, which #439 refuses. #439 allows ds_bpermute within each half outside sections.
  • root_memory: #439 had no such limit.

Offline only, I translated XboxBvhBuilder.dll from my local copy of the title data for a 32-lane host, to see whether your two stages take the console flow. Nothing was dispatched or run.

  • At 2658128c, 28918b7150a7aad5 (@⁠0x25c40) and caa78b8ca62bc3d6 (@⁠0x28770) both validate in the console flow in halves.
  • With the limit they are refused, with the new reason.
  • The other 50 builder programs are unchanged.

Pushed as a fast-forward to 75870526, two commits crediting you as co-author:

  • e2d3cfd5 adds your limit in emit/lower/console.rs. A program that reaches title memory by address and also shares LDS, has whole-wave sections or permutes lanes no longer takes the console flow in halves on a host without 64-lane waves. A synthetic test (lds_in_halves_keeps_out_of_programs_reaching_title_memory) fails with the check switched off.
  • 75870526 adds your five tile-classifier tests, adapted to the stack's program_lds/program_case helpers. Each also checks, without a GPU, that the program translates for a 32-lane host.

Checks on the software adapter (WARP), one test thread:

  • The shader lib gives 349 passed, 4 failed and 3 ignored at 75870526, against 343/4/3 at 2658128c. The four failures are the same at both heads, all in main's synthetic_tests.
  • cargo xtask policy and clippy (plain and --all-features) are clean.

I can't run tests on hardware here, so the five tests' values have only been checked on your two adapters, and only with your patch. A run of split_tests at 75870526 would cover them on #439's own code. Your note also stands: an f16 sum in a partial group with a mask still has no hardware run.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 07:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7185809294) Thanks @⁠latentdev. The `root_memory` limit is the part #439 was missing, and thanks for the `split_tests` run at `2658128c` on the RTX 4090 and the 7950X3D iGPU. I compared your patch (against `87d1f42`) with `2658128c`: - **LDS:** you put a group barrier after each LDS access, and #439 puts one before each access. Either way there is one barrier between any two accesses and both halves reach it, so a write in one half followed by a read in the other is ordered. - **Sections:** #439 differs in three places: - it skips combining the halves in groups of 32 threads or fewer, since otherwise min and `and` would be combined with the missing half's 0; - it keeps -0.0 in a float prefix; - it lowers f16 sums. - **Permutes:** these differ in both directions. Your patch allows forward permutes inside sections, which #439 refuses. #439 allows `ds_bpermute` within each half outside sections. - **`root_memory`:** #439 had no such limit. Offline only, I translated `XboxBvhBuilder.dll` from my local copy of the title data for a 32-lane host, to see whether your two stages take the console flow. Nothing was dispatched or run. - At `2658128c`, `28918b7150a7aad5` (@⁠0x25c40) and `caa78b8ca62bc3d6` (@⁠0x28770) both validate in the console flow in halves. - With the limit they are refused, with the new reason. - The other 50 builder programs are unchanged. Pushed as a fast-forward to `75870526`, two commits crediting you as co-author: - `e2d3cfd5` adds your limit in `emit/lower/console.rs`. A program that reaches title memory by address and also shares LDS, has whole-wave sections or permutes lanes no longer takes the console flow in halves on a host without 64-lane waves. A synthetic test (`lds_in_halves_keeps_out_of_programs_reaching_title_memory`) fails with the check switched off. - `75870526` adds your five tile-classifier tests, adapted to the stack's `program_lds`/`program_case` helpers. Each also checks, without a GPU, that the program translates for a 32-lane host. Checks on the software adapter (WARP), one test thread: - The shader lib gives 349 passed, 4 failed and 3 ignored at `75870526`, against 343/4/3 at `2658128c`. The four failures are the same at both heads, all in main's `synthetic_tests`. - `cargo xtask policy` and clippy (plain and `--all-features`) are clean. I can't run tests on hardware here, so the five tests' values have only been checked on your two adapters, and only with your patch. A run of `split_tests` at `75870526` would cover them on #439's own code. Your note also stands: an f16 sum in a partial group with a mask still has no hardware run. AI-assisted
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-26 07:53 UTC · original · reviewed

Reviewed updated 7587052 (through e2d3cfd + 7587052 vs main 63bcca4) on Windows 11 with AMD Radeon RX 7600 (native Wave64) and WARP:

  • git merge-tree against main (63bcca4): clean (4dbc0d507237c0e5b5dba90fdc87083c2f859839), crates/victory-shader/src/emit/lower.rs is 506,876 bytes.
  • cargo run -p xtask --locked -- policy: asset policy: 195 files ok.
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings (default & --all-features): clean.
  • cargo test -p victory-shader --lib --locked split_tests -- --nocapture --test-threads=1 (RX 7600): 41 passed; 0 failed (32.68s) — includes the 6 newly added tests (lds_in_halves_keeps_out_of_programs_reaching_title_memory, whole_wave_sums_*, whole_wave_prefixes_*, lds_shared_within_the_console_wave_orders_both_halves); RX 7600 executions logged split false (zero native Wave64 regression).
  • VICTORY_WARP=1 cargo test -p victory-shader --lib --locked split_tests -- --nocapture --test-threads=1: 41 passed; 0 failed (0.18s) — translates_in_halves (32-lane Wave32 DXIL lowering + DXIL validator) and sgpr_spills_across_a_divergent_branch_stay_per_lane (Host::new(true)) ran cleanly, while adapters() tests skip WARP (host.rs:105-107).
  • cargo test -p victory-shader --lib --locked -- --test-threads=1 (RX 7600): 353 passed; 0 failed; 3 ignored (153.89s).

Notes:

  • e2d3cfd's crates/victory-shader/src/emit/lower/console.rs (leaves_title_memory_out) cleanly gates one_wave LDS, whole-wave sections, and *permute* (including ds_bpermute_b32) out of console-flow halves when root_memory is true (lower.rs:829-830), and 7587052's unit/validator tests cover both the gate and the whole-wave sum/prefix/LDS patterns on Wave32 targets.
  • Minor doc note: the PR description body still cites e9f18c9 before e2d3cfd / 7587052.
  • Hardware scope note: no hardware 32-lane GPU (e.g., NVIDIA) was available on this host, so runtime execution of the split 32-lane LDS barrier / section tests is verified via Wave32 DXIL lowering + validator and RX 7600 native Wave64 (split false), not hardware 32-lane silicon.

AI-assisted; synthetic tests only, no game files.

**@⁠nathanbzrr** on GitHub · 2026-11-26 07:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#pullrequestreview-6070298616) · **reviewed** Reviewed updated `7587052` (through `e2d3cfd` + `7587052` vs `main` `63bcca4`) on Windows 11 with **AMD Radeon RX 7600** (native Wave64) and **WARP**: - `git merge-tree` against `main` (`63bcca4`): clean (`4dbc0d507237c0e5b5dba90fdc87083c2f859839`), `crates/victory-shader/src/emit/lower.rs` is `506,876` bytes. - `cargo run -p xtask --locked -- policy`: `asset policy: 195 files ok`. - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings` (default & `--all-features`): clean. - `cargo test -p victory-shader --lib --locked split_tests -- --nocapture --test-threads=1` (RX 7600): `41 passed; 0 failed` (`32.68s`) — includes the 6 newly added tests (`lds_in_halves_keeps_out_of_programs_reaching_title_memory`, `whole_wave_sums_*`, `whole_wave_prefixes_*`, `lds_shared_within_the_console_wave_orders_both_halves`); RX 7600 executions logged `split false` (zero native Wave64 regression). - `VICTORY_WARP=1 cargo test -p victory-shader --lib --locked split_tests -- --nocapture --test-threads=1`: `41 passed; 0 failed` (`0.18s`) — `translates_in_halves` (32-lane Wave32 DXIL lowering + DXIL validator) and `sgpr_spills_across_a_divergent_branch_stay_per_lane` (`Host::new(true)`) ran cleanly, while `adapters()` tests skip WARP (`host.rs:105-107`). - `cargo test -p victory-shader --lib --locked -- --test-threads=1` (RX 7600): `353 passed; 0 failed; 3 ignored` (`153.89s`). Notes: - `e2d3cfd`'s `crates/victory-shader/src/emit/lower/console.rs` (`leaves_title_memory_out`) cleanly gates `one_wave` LDS, whole-wave sections, and `*permute*` (including `ds_bpermute_b32`) out of console-flow halves when `root_memory` is true (`lower.rs:829-830`), and `7587052`'s unit/validator tests cover both the gate and the whole-wave sum/prefix/LDS patterns on Wave32 targets. - Minor doc note: the PR description body still cites `e9f18c9` before `e2d3cfd` / `7587052`. - Hardware scope note: no hardware 32-lane GPU (e.g., NVIDIA) was available on this host, so runtime execution of the split 32-lane LDS barrier / section tests is verified via Wave32 DXIL lowering + validator and RX 7600 native Wave64 (`split false`), not hardware 32-lane silicon. AI-assisted; synthetic tests only, no game files.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 07:55 UTC · original

Thanks @⁠nathanbzrr. The description now names head 7587052 and lists what is new since e9f18c9, with your RX 7600 run (353 passed, 0 failed). AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-26 07:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7185981445) Thanks @⁠nathanbzrr. The description now names head `7587052` and lists what is new since `e9f18c9`, with your RX 7600 run (353 passed, 0 failed). AI-assisted.
github-bot force-pushed github-bot/gh-439 from 75870526ba to e2d3cfd507 2026-11-26 08:34:37 +00:00 Compare
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 08:28 UTC · original

Done: 7587052 is removed from the branch history. The branch was force-pushed back to e2d3cfd, its parent, with a lease. You're right that its SECTION_SUM/SECTION_PREFIX sequences and the two one-lane tests followed one of the title's programs, which the asset policy doesn't allow. No other branch on the fork carries that commit, and I've reset our local copy too. The description now names e2d3cfd as the head, and says why the earlier top commit is gone. @⁠latentdev, your root_memory refusal (e2d3cfd) stays. If we add section tests again, they'll be written from the RDNA2 ISA guide alone and won't refer to any title program.

The other blockers stand as you list them: the stack order (#223, #233, #320 first), the BVH builder gate (#2118), and crissuper20's GTX 1650 hang.

No title data was used for this change.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 08:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7186642826) Done: `7587052` is removed from the branch history. The branch was force-pushed back to `e2d3cfd`, its parent, with a lease. You're right that its `SECTION_SUM`/`SECTION_PREFIX` sequences and the two one-lane tests followed one of the title's programs, which the asset policy doesn't allow. No other branch on the fork carries that commit, and I've reset our local copy too. The description now names `e2d3cfd` as the head, and says why the earlier top commit is gone. @⁠latentdev, your `root_memory` refusal (`e2d3cfd`) stays. If we add section tests again, they'll be written from the RDNA2 ISA guide alone and won't refer to any title program. The other blockers stand as you list them: the stack order (#223, #233, #320 first), the BVH builder gate (#2118), and crissuper20's GTX 1650 hang. No title data was used for this change. AI-assisted
Author
Owner

@⁠evan-kolberg on GitHub · 2026-11-26 13:33 UTC · original

I ran the generated masked-LDS test at exact head e2d3cfd50715954fb89ff462edb37a0c4395ecd0 on an Apple M4 Pro using CrossOver 26.3.0.39832 and D3DMetal 4.0 beta 3. The AMD64 test PE was built from the clean head, and the test process mapped D3DMetal.

emit::split_tests::lds_written_and_read_in_different_masked_blocks passed. All three cases logged split true and matched all 128 readback words each (two 64-thread groups). This covered the all-lanes write followed by lower-half reads, the delayed upper-half writer, and upper-half writes followed by lower-half reads without branches. The test exercises the generated non-root-memory LDS path.

**@⁠evan-kolberg** on GitHub · 2026-11-26 13:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7193519016) I ran the generated masked-LDS test at exact head `e2d3cfd50715954fb89ff462edb37a0c4395ecd0` on an Apple M4 Pro using CrossOver 26.3.0.39832 and D3DMetal 4.0 beta 3. The AMD64 test PE was built from the clean head, and the test process mapped D3DMetal. `emit::split_tests::lds_written_and_read_in_different_masked_blocks` passed. All three cases logged `split true` and matched all 128 readback words each (two 64-thread groups). This covered the all-lanes write followed by lower-half reads, the delayed upper-half writer, and upper-half writes followed by lower-half reads without branches. The test exercises the generated non-root-memory LDS path.
Author
Owner

@⁠chippy01 on GitHub · 2026-11-26 14:01 UTC · original

@⁠r4tedx I ran this stack's split tests on 32-lane hardware at e2d3cfd: an RTX 3070 Ti (driver 621.24, 32-lane waves only) and the Radeon iGPU of a Ryzen 9 7900X, on Windows 11.

Tests

  • cargo test --locked -p victory-shader --lib -- --test-threads=1: 344 passed, 3 failed, 3 ignored. The 3 failures are a_heap_buffer_read_by_element_takes_the_views_stride, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros and gathers_at_a_level_match_the_hardware, and they fail on main on this machine too. I skipped heap_direct_texture_reads_mark_their_heap_index, which crashes the test process here on main as well.
  • split_tests and lane_read_loop_tests (38 tests): all pass. On the 3070 Ti all 81 split cases are exact (split true), and so are the 9 other cases and the 8 nested-EXEC ranges. The Radeon runs the same 81 cases natively (split false), also exact.

Translate (translate --list --validate --host-lanes 32-32 over shaders.rpf, the executable, XboxBvhBuilder.dll and the FidelityFX DLL): 2,661 of 2,763 compute programs emitted, 1,926 of them validated.

One finding: groups whose rows a 32-lane wave may tile. The split forms keep the console's [numthreads]. The relabelling assumes each host wave holds a 32-aligned run of flat ids, but NVIDIA fills the waves of a 32 x 2 group with 16 x 2 tiles (#2126 measured the same). I added a local probe to split_tests that runs your program_3d in other shapes:

group RTX 3070 Ti (split) Radeon (native wave64)
32 x 2 x 1 32 of 64 lanes differ exact
32 x 1 x 2 exact exact
16 x 4 x 1 exact exact

In the title this concerns CS_AmbientMapSky32, CS_AmbientMapSkyLocal32 and CS_AmbientMapSkyClassified32, all 32 x 2 x 1 and all emitted here. CS_ComputeTerrainVisibility (6 x 6 x 1, a width that is not a power of two) is in the class #2126 measured too, but I didn't probe it here. #2633 refuses these groups. #2126 hands each wave its ids by ticket instead, which would fix them here as well.

Next to the halves stack. Locally I have #2633 plus four follow-ups. They keep the per-lane form and trade through group-shared memory only at blocks every thread of the group reaches. That covers lane reads, first lanes, ballots and wave reductions, plus barriers for one wave's LDS. Everywhere else they refuse. Over the 415 wave64 programs that need their console lanes:

programs
translate on both 128
only on this stack 205
only on the halves stack 7
on neither 75
  • The 205 are all one-wave groups. They're what the console flow is for: LDS written and read in lane branches (125), masks (47), first lanes (17) and reductions (11) inside branches, the 4 tiled groups above, and 1 lane read.
  • The 7 are groups of 128 or more threads sharing LDS, whose reads across the halves all happen where every thread meets.
  • Of the 75, this stack refuses 43 as groups of more than 64 threads, 12 as implicit-derivative samples, 11 as programs reaching title memory, and 9 for other reasons.

The two seem to fit as tiers. The halves trades cost a group barrier pair per read, and they work in groups of any size where every thread meets. The console flow takes the divergent rest of one-wave groups.

The multi-wave branch. I also ran shader/wave64-lds-groups-2 at f7a85cf on the same machine.

  • split_tests: 43 passed, 1 failed. groups_whose_waves_part_match_the_console_on_every_adapter fails its case "both sides in the first wave's region" (128 threads) on the 3070 Ti (split). In the first console wave, lanes 20-63 store 2 where the console stores 3, so the side of the two-sided branch those lanes should take isn't taken. The rest is right: lanes 0-19 store 2 and the second wave stores 7, as on the console. It fails the same way when run alone.
  • The test's earlier cases are exact on both adapters: a loop the waves leave apart (128 and 256 threads), two exits, nested loops. So are groups_sharing_lds_match_the_console_on_every_adapter and groups_of_several_console_waves_run_as_one_host_group_each.
  • translate --list --validate --host-lanes 32-32 there: 2,722 of 2,760 compute programs emitted, all of them validated.

Logs on request. AI-assisted (Claude Code).

**@⁠chippy01** on GitHub · 2026-11-26 14:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7194161330) @⁠r4tedx I ran this stack's split tests on 32-lane hardware at `e2d3cfd`: an RTX 3070 Ti (driver 621.24, 32-lane waves only) and the Radeon iGPU of a Ryzen 9 7900X, on Windows 11. **Tests** - `cargo test --locked -p victory-shader --lib -- --test-threads=1`: 344 passed, 3 failed, 3 ignored. The 3 failures are `a_heap_buffer_read_by_element_takes_the_views_stride`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` and `gathers_at_a_level_match_the_hardware`, and they fail on `main` on this machine too. I skipped `heap_direct_texture_reads_mark_their_heap_index`, which crashes the test process here on `main` as well. - `split_tests` and `lane_read_loop_tests` (38 tests): all pass. On the 3070 Ti all 81 split cases are exact (`split true`), and so are the 9 other cases and the 8 nested-EXEC ranges. The Radeon runs the same 81 cases natively (`split false`), also exact. **Translate** (`translate --list --validate --host-lanes 32-32` over `shaders.rpf`, the executable, `XboxBvhBuilder.dll` and the FidelityFX DLL): 2,661 of 2,763 compute programs emitted, 1,926 of them validated. **One finding: groups whose rows a 32-lane wave may tile.** The split forms keep the console's `[numthreads]`. The relabelling assumes each host wave holds a 32-aligned run of flat ids, but NVIDIA fills the waves of a 32 x 2 group with 16 x 2 tiles (#2126 measured the same). I added a local probe to `split_tests` that runs your `program_3d` in other shapes: | group | RTX 3070 Ti (split) | Radeon (native wave64) | |---|---|---| | 32 x 2 x 1 | 32 of 64 lanes differ | exact | | 32 x 1 x 2 | exact | exact | | 16 x 4 x 1 | exact | exact | In the title this concerns `CS_AmbientMapSky32`, `CS_AmbientMapSkyLocal32` and `CS_AmbientMapSkyClassified32`, all 32 x 2 x 1 and all emitted here. `CS_ComputeTerrainVisibility` (6 x 6 x 1, a width that is not a power of two) is in the class #2126 measured too, but I didn't probe it here. #2633 refuses these groups. #2126 hands each wave its ids by ticket instead, which would fix them here as well. **Next to the halves stack.** Locally I have #2633 plus four follow-ups. They keep the per-lane form and trade through group-shared memory only at blocks every thread of the group reaches. That covers lane reads, first lanes, ballots and wave reductions, plus barriers for one wave's LDS. Everywhere else they refuse. Over the 415 wave64 programs that need their console lanes: | | programs | |---|---:| | translate on both | 128 | | only on this stack | 205 | | only on the halves stack | 7 | | on neither | 75 | - The 205 are all one-wave groups. They're what the console flow is for: LDS written and read in lane branches (125), masks (47), first lanes (17) and reductions (11) inside branches, the 4 tiled groups above, and 1 lane read. - The 7 are groups of 128 or more threads sharing LDS, whose reads across the halves all happen where every thread meets. - Of the 75, this stack refuses 43 as groups of more than 64 threads, 12 as implicit-derivative samples, 11 as programs reaching title memory, and 9 for other reasons. The two seem to fit as tiers. The halves trades cost a group barrier pair per read, and they work in groups of any size where every thread meets. The console flow takes the divergent rest of one-wave groups. **The multi-wave branch.** I also ran `shader/wave64-lds-groups-2` at `f7a85cf` on the same machine. - `split_tests`: 43 passed, 1 failed. `groups_whose_waves_part_match_the_console_on_every_adapter` fails its case "both sides in the first wave's region" (128 threads) on the 3070 Ti (split). In the first console wave, lanes 20-63 store 2 where the console stores 3, so the side of the two-sided branch those lanes should take isn't taken. The rest is right: lanes 0-19 store 2 and the second wave stores 7, as on the console. It fails the same way when run alone. - The test's earlier cases are exact on both adapters: a loop the waves leave apart (128 and 256 threads), two exits, nested loops. So are `groups_sharing_lds_match_the_console_on_every_adapter` and `groups_of_several_console_waves_run_as_one_host_group_each`. - `translate --list --validate --host-lanes 32-32` there: 2,722 of 2,760 compute programs emitted, all of them validated. Logs on request. AI-assisted (Claude Code).
Author
Owner

@⁠latentdev on GitHub · 2026-11-26 16:43 UTC · original

IMPLICIT_SAMPLE_IN_HALVES: with #180's quad gradients, the programs it stops run in halves on a 4090

The comment above that refusal says a title run lost its device twice with these samples in the console flow in halves. I tried #180's lowering in exactly that place, on an RTX 4090 at e2d3cfd. The lowering is sampleGrad with coarse gradients from the console quad's lanes: lane 1 minus lane 0 across, lane 2 minus lane 0 down, read with waveReadLaneAt, and a bias scales them by 2^bias. Because the halves are split at 32, a console quad (lanes 4k..4k+3) is always within one host wave, at host lanes lane & ~3 and the three after it. The refusal becomes let quad_grad = matches!(op, 60 | 61) && !self.s.pixel && self.console_cf && self.split;. When that's set, the 60/61 arms emit sampleGrad.f32 (op 63) with those gradients and an undefined clamp.

The programs it brings back. They were the largest class of dropped work left in the prologue world here, mostly indirect dispatches:

program dropped per frame
ptfx_prerender:ptfx_CS_lightAtlas_Sprite (2561af9577c47289) 19
ptfx_CS_lightAtlas_Trail / _NonLocalLights_Sprite / _NonLocalLights_Trail (c06aa621, cabb8759, e8f6ae05) 4.5 / 4.5 / 1
indirect_light_probes:CS_IrradianceCache_Shade (a53a7977fe762268) 2
scattering_transmittance_system:CS_DensityShadowMapMips (5b2ce592c3a5dd09) 1
vfx_proj_decal_vbuffer:CS_ProjDecalResolve_Scalarized / _Vectorized (e4a9f58e, c4183d3c) 1 each

What I checked:

  • implicit_sample(true) translates for the 32-lane target and the module passes dxil.dll.
  • The full warm-up refuses 247 programs instead of 259.
  • In the title, all eight programs bind and run, and indirect kind 2: no host pipeline drops go from 26.6 to 1.3 per frame.
  • One run went 7.5 minutes with no hang. It ended in a 0x887A0005 removal with empty breadcrumbs, which on this 31 GB PC has been the machine running out of memory, with or without this change.

So the device losses behind the refusal may have come from the invalid sample in compute rather than from sampling in halves.

Not checked:

  • Pixel-exact agreement with the console.
  • Partial quads: waveReadLaneAt of an inactive host lane is undefined in DXIL, while the console reads the register.
**@⁠latentdev** on GitHub · 2026-11-26 16:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7198018982) ### `IMPLICIT_SAMPLE_IN_HALVES`: with #180's quad gradients, the programs it stops run in halves on a 4090 The comment above that refusal says a title run lost its device twice with these samples in the console flow in halves. I tried #180's lowering in exactly that place, on an RTX 4090 at e2d3cfd. The lowering is `sampleGrad` with coarse gradients from the console quad's lanes: lane 1 minus lane 0 across, lane 2 minus lane 0 down, read with `waveReadLaneAt`, and a bias scales them by 2^bias. Because the halves are split at 32, a console quad (lanes 4k..4k+3) is always within one host wave, at host lanes `lane & ~3` and the three after it. The refusal becomes `let quad_grad = matches!(op, 60 | 61) && !self.s.pixel && self.console_cf && self.split;`. When that's set, the `60`/`61` arms emit `sampleGrad.f32` (op 63) with those gradients and an undefined clamp. **The programs it brings back.** They were the largest class of dropped work left in the prologue world here, mostly indirect dispatches: | program | dropped per frame | |---|---:| | `ptfx_prerender:ptfx_CS_lightAtlas_Sprite` (`2561af9577c47289`) | 19 | | `ptfx_CS_lightAtlas_Trail` / `_NonLocalLights_Sprite` / `_NonLocalLights_Trail` (`c06aa621`, `cabb8759`, `e8f6ae05`) | 4.5 / 4.5 / 1 | | `indirect_light_probes:CS_IrradianceCache_Shade` (`a53a7977fe762268`) | 2 | | `scattering_transmittance_system:CS_DensityShadowMapMips` (`5b2ce592c3a5dd09`) | 1 | | `vfx_proj_decal_vbuffer:CS_ProjDecalResolve_Scalarized` / `_Vectorized` (`e4a9f58e`, `c4183d3c`) | 1 each | **What I checked:** - `implicit_sample(true)` translates for the 32-lane target and the module passes `dxil.dll`. - The full warm-up refuses 247 programs instead of 259. - In the title, all eight programs bind and run, and `indirect kind 2: no host pipeline` drops go from 26.6 to 1.3 per frame. - One run went 7.5 minutes with no hang. It ended in a `0x887A0005` removal with empty breadcrumbs, which on this 31 GB PC has been the machine running out of memory, with or without this change. So the device losses behind the refusal may have come from the invalid `sample` in compute rather than from sampling in halves. **Not checked:** - Pixel-exact agreement with the console. - Partial quads: `waveReadLaneAt` of an inactive host lane is undefined in DXIL, while the console reads the register.
Author
Owner

@⁠JurajSimicevic on GitHub · 2026-11-26 17:20 UTC · original

RTX 5080 (Blackwell), Windows, in the title at e2d3cfd: the whole prison cell renders. It's the most complete picture this card has given me, and I compared it on the same card and scene with the halves stack (#2176 / #2711 / #2925).

Setup: RTX 5080, driver 617.42, Windows 11 26200.

  • Tree: main 63bcca4 + #2098, #2626, #2628, #2464, #2118 and this PR at e2d3cfd. #2118 is there per the note at the top. The conflicts with #2628 (emit::Options, shader_cache, lower) were resolved by keeping both the view limit and this PR's host target.
  • Diag build, VICTORY_D3D12_DRED=1, warm caches, one run of 12 minutes in the world, camera turned around the cell.

Tests on this card: cargo test -p victory-shader --lib --locked -- --test-threads=1 split_tests console: 44 passed.

same card, same scene this PR halves: #2176 + #2711 (VICTORY_WAVE32_APPROX=1) + #2925
compute pipelines skipped, shader does not translate (translate --cache --pipelines) 89 166
pipelines the host refuses 0 1
device removed no (12 min in the world) no
the cell all of it lit and textured: beds, shelves, door, corridor, walls parts dark or missing
green/red cast on the walls yes yes
  • In the world: about 2.9 s per frame and about 4,900 draws per frame, 640 of them dropped. They are mostly compute programs that don't translate:
    • 31 console wave64 lanes in a group of more than 64 threads;
    • 9 an implicit-derivative sample in the console flow.
  • The colour cast is not specific to either path. It follows the tile classifier running, which both trees translate. Details and numbers are on #2711 (#2711). Since the walls are green by the window and red on the far side, while the bed sheets look right, it looks like a wrong per-tile indirect lighting term rather than this PR's lowering, but that isn't pinned yet.

Not tested: more than one run; this PR without #2118; other scenes.

Local diagnostics only. No game data: counts and pixel statistics.

AI-assisted.

**@⁠JurajSimicevic** on GitHub · 2026-11-26 17:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7198858571) **RTX 5080 (Blackwell), Windows, in the title at `e2d3cfd`: the whole prison cell renders. It's the most complete picture this card has given me, and I compared it on the same card and scene with the halves stack (#2176 / #2711 / #2925).** **Setup:** RTX 5080, driver 617.42, Windows 11 26200. - Tree: `main` `63bcca4` + #2098, #2626, #2628, #2464, #2118 and this PR at `e2d3cfd`. #2118 is there per the note at the top. The conflicts with #2628 (`emit::Options`, `shader_cache`, `lower`) were resolved by keeping both the view limit and this PR's host target. - Diag build, `VICTORY_D3D12_DRED=1`, warm caches, one run of 12 minutes in the world, camera turned around the cell. **Tests on this card:** `cargo test -p victory-shader --lib --locked -- --test-threads=1 split_tests console`: 44 passed. | same card, same scene | this PR | halves: #2176 + #2711 (`VICTORY_WAVE32_APPROX=1`) + #2925 | |---|---:|---:| | compute pipelines skipped, shader does not translate (`translate --cache --pipelines`) | **89** | 166 | | pipelines the host refuses | **0** | 1 | | device removed | no (12 min in the world) | no | | the cell | **all of it lit and textured**: beds, shelves, door, corridor, walls | parts dark or missing | | green/red cast on the walls | yes | yes | - **In the world:** about 2.9 s per frame and about 4,900 draws per frame, 640 of them dropped. They are mostly compute programs that don't translate: - 31 `console wave64 lanes in a group of more than 64 threads`; - 9 `an implicit-derivative sample in the console flow`. - **The colour cast is not specific to either path.** It follows the tile classifier running, which both trees translate. Details and numbers are on #2711 (https://git.gtahub.st/github/Marvisak--VIctory/pulls/2711). Since the walls are green by the window and red on the far side, while the bed sheets look right, it looks like a wrong per-tile indirect lighting term rather than this PR's lowering, but that isn't pinned yet. **Not tested:** more than one run; this PR without #2118; other scenes. Local diagnostics only. No game data: counts and pixel statistics. AI-assisted.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/439/head:github-bot/gh-439'
git switch 'github-bot/gh-439'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-439'
git switch 'github-bot/gh-439'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-439'
git switch 'github-bot/gh-439'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-439'
git switch 'main'
git merge --squash 'github-bot/gh-439'
git switch 'main'
git merge --ff-only 'github-bot/gh-439'
git switch 'main'
git merge 'github-bot/gh-439'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!439
No description provided.