Shaders: lane reads and writes where lanes branch differently run in the console flow #320

Open
github-bot wants to merge 46 commits from github-bot/gh-320 into main AGit
Owner

@⁠r4tedx on GitHub · 2026-11-24 02:16 UTC · original
r4tedx:shader/console-flow-lane-reads → main · +3565 −1440 · 25 files · 46 commits · open

Current head 0fa6af4, integrated with main at ffe310e. The lane-read tests use structured resource tracking. The translator retains both the mask information used by console flow and the reach conditions used by the descriptor tracker. Local Windows verification: cargo test --workspace --locked (359 passed, 6 ignored) and all-target, all-feature Clippy with warnings denied. No title run for this update. AI-assisted (Codex).

Validation, resolved as not from this PR. A whole-title run on this head found that 20 of the 21 compute programs this PR newly translates fail dxil.dll validation, and I marked it a draft until the cause was known. It is: 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 already emits 23 such modules. Diagnosis with a hand-assembled reproduction; #180 replaces these samples and #201 tracks the class. A census rerun by another tester measured it: with #180 (and #459) on main, the 23 compute failures of this class go to 0 and nothing that validated before fails. The console flow emits nothing different for them; this PR only lets 20 more such programs translate. Merging #180 first, or together, keeps those modules from reaching a driver unvalidated.

Fixes #225. Stacked on #233 (which is stacked on #223); the last three commits are new here (36e05dc, c223206, fd8b8fe; before the rebases onto main (now 8e79c80) on 2026-11-24 they were 6ec772f, 4c197a0, a5ba4a4, the ids testers' reports use; replayed unchanged, except that a new upstream test gets the field this PR adds to lower::Parts; CI's two clippy commands are clean at this head; the lane-read loop test now takes its devices from the SM 6.6 hardware-adapter list and skips when there is none, a fix first made at the top of the stack and folded in here).

What

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. Two measured cases on main:

  • A loop lane t runs t times, reading lane L in each iteration, then stores t + s9: 12 of 32 lanes wrong in waves of 32 (RTX 5070 and Radeon iGPU), 24 of 64 in waves of 64 (Radeon). This is the #225 repro.
  • v_writelane to lane 40 inside a branch only lanes below 20 take: lane 40 is never written (Radeon).

A compute program with v_readlane or v_writelane and at least one branch that is not uniform now runs in the console flow from #233 on every host: every lane of a wave runs every block, EXEC guards the vector instructions, and branches are the console's s_cbranch_*, taken wave-wide.

  • 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 there are no group-shared slots or barriers, and any group size and LDS are fine.
  • Where it does not (wave64 on a 32..32 host), #233's exchange applies as before.
  • A program the console flow cannot lower keeps the per-lane form (Parts::per_lane_only), so nothing that translated before is refused.
  • Not chosen for programs with whole-wave sections (their reductions are lowered as wave operations already) or ds_(b)permute.

SGPR spills (v_writelane to stash an SGPR, v_readlane restoring it) stay on main's per-lane form, since each restore is proven to be its SGPR: with the console's wave size on a host that runs it (as main), and with no wave size on a 32..32 host, where each restore is lowered as its SGPR. Spill-only wave64 programs therefore now translate on 32-lane hosts instead of being dropped, and spill + DPP programs run split rather than in the console flow. Test: sgpr_spills_across_a_divergent_branch_stay_per_lane.

docs/wave64-on-wave32.md shows as deleted in this diff: #233 folded that plan into docs/architecture.md, and the merge carries that up.

Small generalisations of #233's helpers: console_lane masks with the console wave size (waves of 32 too), console_ballot returns the host wave's ballot when nothing is split, and v_readfirstlane reads no high EXEC word in waves of 32.

The second commit closes a gap in the console flow itself, found through the test report on #233: the loop form compilers emit keeps finished lanes in an exit mask that starts as a constant 0, and the console flow's mask joins took only masks derived from EXEC or a VALU result, so such a loop stopped with a lane-mask join of an untracked mask. Structured::others now gives the lane's bit of constant and scalar-built masks for those joins. The per-lane form is unchanged.

How this relates to other open PRs

#269 makes scalars leave divergent loops and branches as the wave left them, with maxima over the host wave. In the console flow scalars are the wave's own by construction: with a local switch sending #269's four test programs through it, all four are exact on both adapters here, where #269's two scalar tests give per-half values on hosts that form 32-lane waves (details). This PR does not select the console flow for those programs.

In compiled shaders, the usual source of v_writelane / v_readlane outside whole-wave sections is SGPR spill slots: a scalar parked in a lane of a VGPR and read back later, whatever EXEC holds. #54 and #189 resolve spills at constant lanes in SSA, so the lane accesses disappear and the control flow stays per lane. Where that applies it is cheaper than this PR, and the two compose: with spills resolved first, fewer programs would ask for the console flow. This PR covers what is left: lanes computed at run time, and reads of another lane's own data.

Not verified

No game files and no console hardware were used: the expected values follow the ISA's EXEC and lane-access semantics. I did not measure how many of the title's programs take this path, or its cost on them. A tester's whole-title translate found 21 more compute pipelines than #233, 20 of them in the validation class above. The console flow guards instructions where the per-lane form branches around them, so a divergent program does more work per lane.

The fallback to the per-lane form has no test of its own; I found no hand-assembled program that the console flow refuses and the per-lane form takes.

Vertex, pixel and mesh programs are unchanged.

Tested

Windows 11, an NVIDIA RTX 5070 (32..32) and an AMD Radeon iGPU (RDNA2, 32..64) in one machine, hand-assembled GFX10, every lane checked:

  • emit/lane_read_loop_tests.rs (the #225 repro, no longer ignored): exact on both adapters in waves of 32 and of 64 (on the RTX 5070 the wave64 program runs in two halves).
  • split_tests::lane_writes_reach_lanes_outside_the_branch: exact on both. With the new condition switched off it fails on the Radeon (lane 40 keeps 1).
  • split_tests::loops_run_while_any_lane_of_the_console_wave_does now checks 64-lane hosts too.
  • split_tests::loops_with_an_exit_mask_grown_from_zero (the compilers' loop form, a lane read in each iteration, the exit mask counted afterwards): refused on the RTX 5070 before the second commit, exact on both adapters now.
  • cargo test --workspace: 281 passed, 0 failed, 4 ignored at a5ba4a4 (two testers report the same count; 280 was the head before it). cargo clippy --workspace --all-targets: nothing new. cargo xtask policy: ok.

AI-assisted; no game assets were used.

🤖 Generated with Claude Code

**@⁠r4tedx** on GitHub · 2026-11-24 02:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/320) `r4tedx:shader/console-flow-lane-reads` → `main` · +3565 −1440 · 25 files · 46 commits · open **Current head `0fa6af4`, integrated with `main` at `ffe310e`.** The lane-read tests use structured resource tracking. The translator retains both the mask information used by console flow and the reach conditions used by the descriptor tracker. Local Windows verification: `cargo test --workspace --locked` (359 passed, 6 ignored) and all-target, all-feature Clippy with warnings denied. No title run for this update. AI-assisted (Codex). > **Validation, resolved as not from this PR.** A [whole-title run on this head](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233) found that 20 of the 21 compute programs this PR newly translates fail `dxil.dll` validation, and I marked it a draft until the cause was known. It is: 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` already emits 23 such modules. [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) by another tester measured it: with #180 (and #459) on `main`, the 23 compute failures of this class go to 0 and nothing that validated before fails. The console flow emits nothing different for them; this PR only lets 20 more such programs translate. Merging #180 first, or together, keeps those modules from reaching a driver unvalidated. Fixes #225. Stacked on #233 (which is stacked on #223); the last three commits are new here (`36e05dc`, `c223206`, `fd8b8fe`; before the rebases onto `main` (now `8e79c80`) on 2026-11-24 they were `6ec772f`, `4c197a0`, `a5ba4a4`, the ids testers' reports use; replayed unchanged, except that a new upstream test gets the field this PR adds to `lower::Parts`; CI's two clippy commands are clean at this head; the lane-read loop test now takes its devices from the SM 6.6 hardware-adapter list and skips when there is none, a fix first made at the top of the stack and folded in here). ## What 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. Two measured cases on `main`: - A loop lane t runs t times, reading lane L in each iteration, then stores t + s9: 12 of 32 lanes wrong in waves of 32 (RTX 5070 and Radeon iGPU), 24 of 64 in waves of 64 (Radeon). This is the #225 repro. - `v_writelane` to lane 40 inside a branch only lanes below 20 take: lane 40 is never written (Radeon). A compute program with `v_readlane` or `v_writelane` and at least one branch that is not uniform now runs in the console flow from #233 on every host: every lane of a wave runs every block, EXEC guards the vector instructions, and branches are the console's `s_cbranch_*`, taken wave-wide. - 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 there are no group-shared slots or barriers, and any group size and LDS are fine. - Where it does not (wave64 on a 32..32 host), #233's exchange applies as before. - A program the console flow cannot lower keeps the per-lane form (`Parts::per_lane_only`), so nothing that translated before is refused. - Not chosen for programs with whole-wave sections (their reductions are lowered as wave operations already) or `ds_(b)permute`. SGPR spills (`v_writelane` to stash an SGPR, `v_readlane` restoring it) stay on main's per-lane form, since each restore is proven to be its SGPR: with the console's wave size on a host that runs it (as `main`), and with no wave size on a 32..32 host, where each restore is lowered as its SGPR. Spill-only wave64 programs therefore now translate on 32-lane hosts instead of being dropped, and spill + DPP programs run split rather than in the console flow. Test: `sgpr_spills_across_a_divergent_branch_stay_per_lane`. `docs/wave64-on-wave32.md` shows as deleted in this diff: #233 folded that plan into `docs/architecture.md`, and the merge carries that up. Small generalisations of #233's helpers: `console_lane` masks with the console wave size (waves of 32 too), `console_ballot` returns the host wave's ballot when nothing is split, and `v_readfirstlane` reads no high EXEC word in waves of 32. The second commit closes a gap in the console flow itself, found through the [test report on #233](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233): the loop form compilers emit keeps finished lanes in an exit mask that starts as a constant 0, and the console flow's mask joins took only masks derived from EXEC or a VALU result, so such a loop stopped with `a lane-mask join of an untracked mask`. `Structured::others` now gives the lane's bit of constant and scalar-built masks for those joins. The per-lane form is unchanged. ### How this relates to other open PRs #269 makes scalars leave divergent loops and branches as the wave left them, with maxima over the host wave. In the console flow scalars are the wave's own by construction: with a local switch sending #269's four test programs through it, all four are exact on both adapters here, where #269's two scalar tests give per-half values on hosts that form 32-lane waves ([details](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233)). This PR does not select the console flow for those programs. In compiled shaders, the usual source of `v_writelane` / `v_readlane` outside whole-wave sections is SGPR spill slots: a scalar parked in a lane of a VGPR and read back later, whatever EXEC holds. #54 and #189 resolve spills at constant lanes in SSA, so the lane accesses disappear and the control flow stays per lane. Where that applies it is cheaper than this PR, and the two compose: with spills resolved first, fewer programs would ask for the console flow. This PR covers what is left: lanes computed at run time, and reads of another lane's own data. ## Not verified No game files and no console hardware were used: the expected values follow the ISA's EXEC and lane-access semantics. I did not measure how many of the title's programs take this path, or its cost on them. A tester's whole-title translate found [21 more compute pipelines than #233, 20 of them in the validation class above](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233). The console flow guards instructions where the per-lane form branches around them, so a divergent program does more work per lane. The fallback to the per-lane form has no test of its own; I found no hand-assembled program that the console flow refuses and the per-lane form takes. Vertex, pixel and mesh programs are unchanged. ## Tested Windows 11, an NVIDIA RTX 5070 (32..32) and an AMD Radeon iGPU (RDNA2, 32..64) in one machine, hand-assembled GFX10, every lane checked: - `emit/lane_read_loop_tests.rs` (the #225 repro, no longer ignored): exact on both adapters in waves of 32 and of 64 (on the RTX 5070 the wave64 program runs in two halves). - `split_tests::lane_writes_reach_lanes_outside_the_branch`: exact on both. With the new condition switched off it fails on the Radeon (lane 40 keeps 1). - `split_tests::loops_run_while_any_lane_of_the_console_wave_does` now checks 64-lane hosts too. - `split_tests::loops_with_an_exit_mask_grown_from_zero` (the compilers' loop form, a lane read in each iteration, the exit mask counted afterwards): refused on the RTX 5070 before the second commit, exact on both adapters now. - `cargo test --workspace`: 281 passed, 0 failed, 4 ignored at `a5ba4a4` (two testers report the same count; 280 was the head before it). `cargo clippy --workspace --all-targets`: nothing new. `cargo xtask policy`: ok. AI-assisted; no game assets were used. 🤖 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]>
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]>
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]>
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]>
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]>
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]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:59:09 +00:00
Author
Owner

@⁠SpaghettiMaster545 on GitHub · 2026-11-24 02:34 UTC · original · edited 2026-11-24 02:36 UTC

Update: the head is now fabe8bc, which adds only test validation in split_tests.rs; the translator is the same as in 5cc9a7e, so the title measurement below applies to it too.

Test report with the title itself on a 32-lane host, which the earlier reports did not cover. This PR's head 5cc9a7e (with #223 and #233 under it) against main d2a4bae.

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124), 32-lane waves only; AMD Ryzen 7 9800X3D, 31 GB; Windows 11 10.0.26100; Rust 1.98.1 (pinned).
  • cargo test --workspace --no-fail-fast on 5cc9a7e (debug): 280 passed, 0 failed, 4 ignored.
  • The title (Xbox Series 1.0.2.1, build unknown (b99f876b…) as in #5), diag build (--profile diag --features diagnostics) of each commit, each with its own empty VICTORY_CACHE_DIR, the same VICTORY_KEYS (Enter every 3 s from 8 s to 47 s: through the first-boot screens into story mode, which opens at 24 s in both runs), until the host GPU failure:
main d2a4bae this PR 5cc9a7e
shaders that do not translate 382 (compute 311, pixel 43, mesh 24, vertex 4) 465 (compute 401, pixel 39, mesh 21, vertex 4)
host pipelines refused by the driver (E_INVALIDARG) 119, all compute 0
fps before story mode / in the world 30 / ~1.2 30 / ~1.15
host GPU failure device removed at 111 s device removed at 115 s
  • Per program: of the 119 compute programs the driver refused on main, 26 translate and run with this PR, 90 now stop in translation with a reason (console wave64 lanes on a host without 64-lane waves: 67, a wave64 group sharing LDS without barriers on a host without 64-lane waves: 38, counted over all programs), and 3 were not reached in this run. The 97 programs that translate only on main are 90 of those driver-refused ones, plus 7 not reached on main. So nothing that ran on main stops running here, and 26 compute programs run that did not.
  • The world hang on this card (#71) is unchanged: the device is removed at the same point, and world fps is the same.

Not tested

  • A 64-lane adapter (the Ryzen's RDNA2 iGPU has no mesh shaders, so it cannot run the world), VICTORY_ADAPTER, a release build of the PR.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the title and the tests, compared the two logs program by program and wrote this report.
**@⁠SpaghettiMaster545** on GitHub · 2026-11-24 02:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7120271524) · edited 2026-11-24 02:36 UTC _Update: the head is now `fabe8bc`, which adds only test validation in `split_tests.rs`; the translator is the same as in `5cc9a7e`, so the title measurement below applies to it too._ Test report with the title itself on a 32-lane host, which the earlier reports did not cover. This PR's head `5cc9a7e` (with #223 and #233 under it) against `main` `d2a4bae`. **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124), 32-lane waves only; AMD Ryzen 7 9800X3D, 31 GB; Windows 11 10.0.26100; Rust 1.98.1 (pinned). - `cargo test --workspace --no-fail-fast` on `5cc9a7e` (debug): 280 passed, 0 failed, 4 ignored. - The title (Xbox Series 1.0.2.1, `build unknown (b99f876b…)` as in #5), diag build (`--profile diag --features diagnostics`) of each commit, each with its own empty `VICTORY_CACHE_DIR`, the same `VICTORY_KEYS` (Enter every 3 s from 8 s to 47 s: through the first-boot screens into story mode, which opens at 24 s in both runs), until the host GPU failure: | | `main` `d2a4bae` | this PR `5cc9a7e` | |---|---|---| | shaders that do not translate | 382 (compute 311, pixel 43, mesh 24, vertex 4) | 465 (compute 401, pixel 39, mesh 21, vertex 4) | | host pipelines refused by the driver (E_INVALIDARG) | 119, all compute | 0 | | fps before story mode / in the world | 30 / ~1.2 | 30 / ~1.15 | | host GPU failure | device removed at 111 s | device removed at 115 s | - Per program: of the 119 compute programs the driver refused on `main`, 26 translate and run with this PR, 90 now stop in translation with a reason (`console wave64 lanes on a host without 64-lane waves`: 67, `a wave64 group sharing LDS without barriers on a host without 64-lane waves`: 38, counted over all programs), and 3 were not reached in this run. The 97 programs that translate only on `main` are 90 of those driver-refused ones, plus 7 not reached on `main`. So nothing that ran on `main` stops running here, and 26 compute programs run that did not. - The world hang on this card (#71) is unchanged: the device is removed at the same point, and world fps is the same. **Not tested** - A 64-lane adapter (the Ryzen's RDNA2 iGPU has no mesh shaders, so it cannot run the world), `VICTORY_ADAPTER`, a release build of the PR. **AI use** - Claude Code (Claude Opus 5.5) built both commits, ran the title and the tests, compared the two logs program by program and wrote this report.
Author
Owner

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

Thank you for running the title, and for the per-program comparison: "nothing that ran on main stops, 26 run that did not" is exactly what I could not check.

Two things changed since 5cc9a7e that touch your numbers:

  • The head is now a5ba4a4, rebased onto a fix in #233 (3098672): a program with DPP or ds_swizzle and a v_readfirstlane is no longer split in halves, because the upper half read lane 32 where the console reads the wave's first lane (found with a hand-assembled case, wrong on an RTX 5070 before). Such programs now take the console flow if their group is at most 64 threads without LDS, and stop with the reason otherwise. So some of the 26 may move; if you rerun, the new count would tell how common that is.
  • A whole-title translate run on #233 gives the same picture over all programs: 98 gained, 0 lost, the rest stopped by the same two reasons.

Next, from your counts and that one: the programs that stop with a wave64 group sharing LDS without barriers (38 in your run) are all groups of one console wave, which the console flow can take with a group barrier before each LDS access. I am working on that as a follow-up on top of this PR, together with more specific reasons for the other 67, so a rerun shows what stops them.

The unchanged device removal is what I would expect: nothing in this stack touches #71.

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

**@⁠r4tedx** on GitHub · 2026-11-24 02:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7120625085) Thank you for running the title, and for the per-program comparison: "nothing that ran on `main` stops, 26 run that did not" is exactly what I could not check. Two things changed since `5cc9a7e` that touch your numbers: - The head is now `a5ba4a4`, rebased onto a fix in #233 (`3098672`): a program with DPP or `ds_swizzle` and a `v_readfirstlane` is no longer split in halves, because the upper half read lane 32 where the console reads the wave's first lane (found with a hand-assembled case, wrong on an RTX 5070 before). Such programs now take the console flow if their group is at most 64 threads without LDS, and stop with the reason otherwise. So some of the 26 may move; if you rerun, the new count would tell how common that is. - A [whole-title translate run on #233](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233) gives the same picture over all programs: 98 gained, 0 lost, the rest stopped by the same two reasons. Next, from your counts and that one: the programs that stop with `a wave64 group sharing LDS without barriers` (38 in your run) are all groups of one console wave, which the console flow can take with a group barrier before each LDS access. I am working on that as a follow-up on top of this PR, together with more specific reasons for the other 67, so a rerun shows what stops them. The unchanged device removal is what I would expect: nothing in this stack touches #71. No game data used on my side. AI-assisted.
Author
Owner

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

Rerun on a5ba4a4, the same way as before (diag build on main d2a4bae, its own empty cache, the same VICTORY_KEYS, RTX 5070 Ti, driver 621.24):

  • Against main (the same main run as in my first report): of the 119 compute programs the driver refused there, 26 translate and run, 90 stop in translation, and 3 were not reached. 0 programs that ran on main stop. This is the same split as on 5cc9a7e.
  • Against 5cc9a7e, program by program: 0 lost and 0 gained. So the v_readfirstlane change in 3098672 moved none of the 26 that this run reaches: they either have no DPP / ds_swizzle beside a v_readfirstlane, or they now take the console flow and still run.
  • Reasons that appear only with the stack, over every program the run reached: console wave64 lanes on a host without 64-lane waves 53, a wave64 group sharing LDS without barriers on a host without 64-lane waves 37. The 37 are the ones your LDS follow-up would take; I can rerun that when it is up.
  • 472 untranslated in this run against 465 on 5cc9a7e. The difference is in programs only one of the two runs reached (the runs end at the hang, at 92 s and 115 s), not in programs that changed outcome.
  • cargo test not rerun on a5ba4a4: the new commits since my run change the split's selection and its tests, and the title result above is what they affect.

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

**@⁠SpaghettiMaster545** on GitHub · 2026-11-24 03:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7120726331) Rerun on `a5ba4a4`, the same way as before (diag build on `main` `d2a4bae`, its own empty cache, the same `VICTORY_KEYS`, RTX 5070 Ti, driver 621.24): - Against `main` (the same `main` run as in my first report): of the 119 compute programs the driver refused there, 26 translate and run, 90 stop in translation, and 3 were not reached. 0 programs that ran on `main` stop. This is the same split as on `5cc9a7e`. - Against `5cc9a7e`, program by program: 0 lost and 0 gained. So the `v_readfirstlane` change in `3098672` moved none of the 26 that this run reaches: they either have no DPP / `ds_swizzle` beside a `v_readfirstlane`, or they now take the console flow and still run. - Reasons that appear only with the stack, over every program the run reached: `console wave64 lanes on a host without 64-lane waves` 53, `a wave64 group sharing LDS without barriers on a host without 64-lane waves` 37. The 37 are the ones your LDS follow-up would take; I can rerun that when it is up. - 472 untranslated in this run against 465 on `5cc9a7e`. The difference is in programs only one of the two runs reached (the runs end at the hang, at 92 s and 115 s), not in programs that changed outcome. - `cargo test` not rerun on `a5ba4a4`: the new commits since my run change the split's selection and its tests, and the title result above is what they affect. (Claude Code, Claude Opus 5.5: ran the build and the title, compared the two logs program by program.)
Author
Owner

@⁠MisaXz on GitHub · 2026-11-24 02:25 UTC · original · edited 2026-11-24 03:16 UTC

Test report for 5cc9a7e on a second machine with a 32-lane and a 64-lane adapter (following up on the #233 thread).

Tested

  • NVIDIA GeForce RTX 5080, driver 621.14 (32.0.16.2114), and the Ryzen 7 9800X3D's integrated AMD Radeon(TM) Graphics, driver 32.0.13018.6, in one machine; Windows 11 Pro 26300; Rust 1.98.1; debug
  • This PR at 5cc9a7e (base d2a4bae): cargo test --workspace --no-fail-fast: 280 passed, 0 failed, 4 ignored.
  • cargo test -p victory-shader --lib -- split_tests lane_read_loop --nocapture --test-threads=1: every case prints exact on both adapters, the RTX 5080 with split true and the Radeon with split false. That includes:
    • lane_reads_in_a_loop_lanes_leave_at_different_iterations (the #225 repro): wave32 and wave64 exact on both
    • loops_with_an_exit_mask_grown_from_zero (the new test for the untracked-mask join): exact on both
    • lane_writes_reach_lanes_outside_the_branch, loops_run_while_any_lane_of_the_console_wave_does, masks_read_whole_count_both_halves (64, 48 and 32 threads), lane_reads_cross_halves, dpp_row_masks_name_console_rows, in_half_lane_reads_match_the_console_on_every_adapter (32, 64, 128 threads), the 3-D groups

Not tested

  • #269's four programs on this head (I did not redo the merge), release build, the title itself (no game files used).

Re-run on the new head a5ba4a4 (same machine, both adapters): cargo test --workspace --no-fail-fast: 281 passed, 0 failed, 4 ignored. cargo test -p victory-shader --lib -- split_tests lane_read_loop --nocapture --test-threads=1: 12 passed, every case prints exact on the RTX 5080 (split) and on the AMD Radeon(TM) Graphics iGPU (native).

AI use

  • Claude Code (Claude Fable 5.2) ran the tests and wrote this report from their output.
**@⁠MisaXz** on GitHub · 2026-11-24 02:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7120119656) · edited 2026-11-24 03:16 UTC Test report for `5cc9a7e` on a second machine with a 32-lane and a 64-lane adapter (following up on [the #233 thread](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233)). **Tested** - NVIDIA GeForce RTX 5080, driver 621.14 (32.0.16.2114), and the Ryzen 7 9800X3D's integrated AMD Radeon(TM) Graphics, driver 32.0.13018.6, in one machine; Windows 11 Pro 26300; Rust 1.98.1; debug - This PR at `5cc9a7e` (base `d2a4bae`): `cargo test --workspace --no-fail-fast`: 280 passed, 0 failed, 4 ignored. - `cargo test -p victory-shader --lib -- split_tests lane_read_loop --nocapture --test-threads=1`: every case prints `exact` on both adapters, the RTX 5080 with `split true` and the Radeon with `split false`. That includes: - `lane_reads_in_a_loop_lanes_leave_at_different_iterations` (the #225 repro): wave32 and wave64 exact on both - `loops_with_an_exit_mask_grown_from_zero` (the new test for the untracked-mask join): exact on both - `lane_writes_reach_lanes_outside_the_branch`, `loops_run_while_any_lane_of_the_console_wave_does`, `masks_read_whole_count_both_halves` (64, 48 and 32 threads), `lane_reads_cross_halves`, `dpp_row_masks_name_console_rows`, `in_half_lane_reads_match_the_console_on_every_adapter` (32, 64, 128 threads), the 3-D groups **Not tested** - #269's four programs on this head (I did not redo the merge), release build, the title itself (no game files used). **Re-run on the new head `a5ba4a4`** (same machine, both adapters): `cargo test --workspace --no-fail-fast`: 281 passed, 0 failed, 4 ignored. `cargo test -p victory-shader --lib -- split_tests lane_read_loop --nocapture --test-threads=1`: 12 passed, every case prints `exact` on the RTX 5080 (split) and on the AMD Radeon(TM) Graphics iGPU (native). **AI use** - Claude Code (Claude Fable 5.2) ran the tests and wrote this report from their output.
Author
Owner

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

The follow-up I mentioned is up as #439 (head 88cb024, on top of #320): programs of one console wave per group that share LDS now take the console flow on 32-lane hosts, with a group barrier before each LDS access, and what still stops says why (a group of more than 64 threads, ds_permute across the halves, a whole-wave section).

If you rerun, the numbers that would tell the most are the count per reason on 88cb024 and, for the whole-title run, whether the validator accepts every emitted compute module. I could only check hand-assembled programs: they validate and are exact on an RTX 5070 and a Radeon iGPU, and I say in the PR that the LDS tests there do not prove the barrier is needed.

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

**@⁠r4tedx** on GitHub · 2026-11-24 03:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7121073465) The follow-up I mentioned is up as #439 (head `88cb024`, on top of #320): programs of one console wave per group that share LDS now take the console flow on 32-lane hosts, with a group barrier before each LDS access, and what still stops says why (`a group of more than 64 threads`, `ds_permute across the halves`, `a whole-wave section`). If you rerun, the numbers that would tell the most are the count per reason on `88cb024` and, for the whole-title run, whether the validator accepts every emitted compute module. I could only check hand-assembled programs: they validate and are exact on an RTX 5070 and a Radeon iGPU, and I say in the PR that the LDS tests there do not prove the barrier is needed. No game data used on my side. AI-assisted.
Author
Owner

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

Tested a5ba4a4 on an RTX 5080, driver 621.24, Windows 11 26300, with a local Xbox Series 1.0.2.1 copy.

cargo test --workspace: 281 passed, 0 failed, 4 ignored. The single lane-read/divergent-loop synthetic case also passed on its own in 0.53 s.

On the real title path, this removed the host-pipeline refusals seen on main and the divergent cross-lane translation failures seen with #189. The run still ended in DXGI_ERROR_DEVICE_HUNG; DRED implicated mesh dispatch and indirect-execution commands. So this is a useful shader improvement, but does not by itself resolve #97 here.

Only aggregate counts and error classes shared, no game data or raw game logs. AI-assisted (Kimi Code).

**@⁠miniongk** on GitHub · 2026-11-24 03:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7121211421) Tested `a5ba4a4` on an RTX 5080, driver 621.24, Windows 11 26300, with a local Xbox Series 1.0.2.1 copy. `cargo test --workspace`: 281 passed, 0 failed, 4 ignored. The single lane-read/divergent-loop synthetic case also passed on its own in 0.53 s. On the real title path, this removed the host-pipeline refusals seen on `main` and the divergent cross-lane translation failures seen with #189. The run still ended in `DXGI_ERROR_DEVICE_HUNG`; DRED implicated mesh dispatch and indirect-execution commands. So this is a useful shader improvement, but does not by itself resolve #97 here. Only aggregate counts and error classes shared, no game data or raw game logs. AI-assisted (Kimi Code).
Author
Owner

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

@⁠miniongk thank you for the run on the title. Two counts would make it usable as evidence, if you still have the logs:

  • how many host pipelines main refused in that run and how many this head refuses (host pipeline refused lines), and
  • how many programs stopped with #189's a cross-lane read in divergent control flow and how many of those translate here.

Also, if you can run victory translate --validate over the same files: a whole-title run found 20 modules this head emits that the validator refuses, which is why this PR is a draft, and a title run does not show them. #439's head 9745f35 prints what each refused module declares and calls.

Counts and messages only, please. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 03:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7121316379) @⁠miniongk thank you for the run on the title. Two counts would make it usable as evidence, if you still have the logs: - how many host pipelines `main` refused in that run and how many this head refuses (`host pipeline refused` lines), and - how many programs stopped with #189's `a cross-lane read in divergent control flow` and how many of those translate here. Also, if you can run `victory translate --validate` over the same files: a [whole-title run](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233) found 20 modules this head emits that the validator refuses, which is why this PR is a draft, and a title run does not show them. #439's head `9745f35` prints what each refused module declares and calls. Counts and messages only, please. AI-assisted.
Author
Owner

@⁠EduAzevedo on GitHub · 2026-11-24 03:58 UTC · original

Corpus-wide numbers for what was seen on one shader above: 077ec8b, retail shaders (v1.0.2.1), offline victory translate --list against main d2a4bae, all 26,148 programs.

  • a descriptor neither loaded nor built: 298 → 3.
  • 294 of those (259 mesh, 35 vertex) now stop at a descriptor read from the first lane of a phi, so only one more program translates on this branch alone.
  • No program that translated on main stops translating.

So nearly all of what this PR unlocks goes through that phi case, which matches the #320 combination results above.

AI-assisted.

**@⁠EduAzevedo** on GitHub · 2026-11-24 03:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7121590211) Corpus-wide numbers for what was seen on one shader above: `077ec8b`, retail shaders (v1.0.2.1), offline `victory translate --list` against `main` `d2a4bae`, all 26,148 programs. - `a descriptor neither loaded nor built`: 298 → 3. - **294 of those (259 mesh, 35 vertex) now stop at `a descriptor read from the first lane of a phi`**, so only one more program translates on this branch alone. - No program that translated on `main` stops translating. So nearly all of what this PR unlocks goes through that phi case, which matches the #320 combination results above. AI-assisted.
Author
Owner

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

@⁠EduAzevedo thank you. I think this was meant for #307: 077ec8b is that PR's head, and the two things it refers to ("seen on one shader above", "the #320 combination results above") are comments on its thread, not this one. It is worth reposting there so @⁠AntoninMichelq sees it, since "294 of the 298 now stop at a descriptor read from the first lane of a phi" tells them what to do next. Nothing in this PR touches descriptor tracing.

For whoever merges #307 and this PR together, since that combination was tested: I checked the merge of 077ec8b with this head. There is one textual conflict, in emit/lower.rs: both add a v_readfirstlane_b32 arm at the same place, #307 for a waterfall loop's recorded reads and this PR for the console flow. Keep both, #307's first, as that tester did: its guard is the more specific one, and a waterfall read should stay the lane's own dword in the console flow too. #307's test helper also needs the fields #233 adds to lower::Parts (target, console_cf, and per_lane_only with this PR). I will do that on my side if #307 lands first.

From reading the merge only; I did not build or run the combination. No game data used. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 04:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7121625305) @⁠EduAzevedo thank you. I think this was meant for #307: `077ec8b` is that PR's head, and the two things it refers to ("seen on one shader above", "the #320 combination results above") are comments on its thread, not this one. It is worth reposting there so @⁠AntoninMichelq sees it, since "294 of the 298 now stop at `a descriptor read from the first lane of a phi`" tells them what to do next. Nothing in this PR touches descriptor tracing. For whoever merges #307 and this PR together, since [that combination was tested](https://git.gtahub.st/github/Marvisak--VIctory/pulls/307): I checked the merge of `077ec8b` with this head. There is one textual conflict, in `emit/lower.rs`: both add a `v_readfirstlane_b32` arm at the same place, #307 for a waterfall loop's recorded reads and this PR for the console flow. Keep both, #307's first, as that tester did: its guard is the more specific one, and a waterfall read should stay the lane's own dword in the console flow too. #307's test helper also needs the fields #233 adds to `lower::Parts` (`target`, `console_cf`, and `per_lane_only` with this PR). I will do that on my side if #307 lands first. From reading the merge only; I did not build or run the combination. No game data used. AI-assisted.
Author
Owner

@⁠EduAzevedo on GitHub · 2026-11-24 04:03 UTC · original

@⁠EduAzevedo thank you. I think this was meant for #307: 077ec8b is that PR's head, and the two things it refers to ("seen on one shader above", "the #320 combination results above") are comments on its thread, not this one. It is worth reposting there so @⁠AntoninMichelq sees it, since "294 of the 298 now stop at a descriptor read from the first lane of a phi" tells them what to do next. Nothing in this PR touches descriptor tracing.

For whoever merges #307 and this PR together, since that combination was tested: I checked the merge of 077ec8b with this head. There is one textual conflict, in emit/lower.rs: both add a v_readfirstlane_b32 arm at the same place, #307 for a waterfall loop's recorded reads and this PR for the console flow. Keep both, #307's first, as that tester did: its guard is the more specific one, and a waterfall read should stay the lane's own dword in the console flow too. #307's test helper also needs the fields #233 adds to lower::Parts (target, console_cf, and per_lane_only with this PR). I will do that on my side if #307 lands first.

From reading the merge only; I did not build or run the combination. No game data used. AI-assisted.

Im sorry, getting a little crazy here 😂

**@⁠EduAzevedo** on GitHub · 2026-11-24 04:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7121662235) > @⁠EduAzevedo thank you. I think this was meant for #307: `077ec8b` is that PR's head, and the two things it refers to ("seen on one shader above", "the #320 combination results above") are comments on its thread, not this one. It is worth reposting there so @⁠AntoninMichelq sees it, since "294 of the 298 now stop at `a descriptor read from the first lane of a phi`" tells them what to do next. Nothing in this PR touches descriptor tracing. > > For whoever merges #307 and this PR together, since [that combination was tested](https://git.gtahub.st/github/Marvisak--VIctory/pulls/307): I checked the merge of `077ec8b` with this head. There is one textual conflict, in `emit/lower.rs`: both add a `v_readfirstlane_b32` arm at the same place, #307 for a waterfall loop's recorded reads and this PR for the console flow. Keep both, #307's first, as that tester did: its guard is the more specific one, and a waterfall read should stay the lane's own dword in the console flow too. #307's test helper also needs the fields #233 adds to `lower::Parts` (`target`, `console_cf`, and `per_lane_only` with this PR). I will do that on my side if #307 lands first. > > From reading the merge only; I did not build or run the combination. No game data used. AI-assisted. Im sorry, getting a little crazy here 😂
Author
Owner

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

Housekeeping, so the thread and the description agree:

  • This PR is not a draft any more. My earlier comment still says it is; the reason for the draft (20 newly translated compute modules failing validation) turned out to be the compute image_sample class that main has too and #180 fixes, as the note at the top of the description says.
  • Corrected in the description: main emits 23 modules of that class, not 22 (22 is #233's count, per the tester's table); three commits are new here, not two; the test count at a5ba4a4 is 281, as @⁠MisaXz and @⁠miniongk reported, not 280.
  • A census rerun on #201 measured #180 taking that class from 23 to 0 on main with nothing regressing.

Head unchanged (a5ba4a4). AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 05:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7123396273) Housekeeping, so the thread and the description agree: - This PR is **not a draft** any more. [My earlier comment](https://git.gtahub.st/github/Marvisak--VIctory/pulls/320) still says it is; the reason for the draft (20 newly translated compute modules failing validation) turned out to be the compute `image_sample` class that `main` has too and #180 fixes, as the note at the top of the description says. - Corrected in the description: `main` emits 23 modules of that class, not 22 (22 is #233's count, [per the tester's table](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233)); three commits are new here, not two; the test count at `a5ba4a4` is 281, as @⁠MisaXz and @⁠miniongk reported, not 280. - A [census rerun on #201](https://git.gtahub.st/github/Marvisak--VIctory/issues/201) measured #180 taking that class from 23 to 0 on `main` with nothing regressing. Head unchanged (`a5ba4a4`). AI-assisted (Claude Code).
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]>
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]>
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]>
Author
Owner

@⁠AKA0GHOST on GitHub · 2026-11-24 07:52 UTC · original

Tested this PR on an RTX 5070 (Blackwell, 32..32, driver 621.14), and extended the console flow to LDS. Diff below in case it is useful.

Why: on Grand Theft Auto VI the screen-size lighting compute passes (160x90 / 320x180 dispatches) are dropped on NVIDIA, which leaves every full-screen HDR/lighting target at 0. Six of them still fail with this PR. All six are 8x8x1 = 64 threads, one console wave. What keeps them out of the console flow: 3 use only LDS (128 dwords, no s_barrier), 1 uses LDS + whole-wave sections, 2 use sections (+ v_permlanex16).

Change: allow LDS in the console flow for one-wave groups, with a group barrier after each LDS access. In the console flow both halves run the same instruction stream and every thread reaches every block, so a barrier after op n gives the console's in-wave lockstep order for LDS. It can't hang, for the same reason the exchanges can't.

@@ Lower::new
             wants_console_flow = console_lanes
                 && !split
                 && x.native.wave64
                 && !x.target.runs(64)
                 && x.target.runs(32)
-                && s.lds_dwords == 0
                 && cs.threads.iter().product::<u32>() <= 64
@@ instruction loop
+            Fields::Ds { .. } if self.console_cf && !name.starts_with("ds_swizzle") => {
+                // Console flow (one console wave per group, every thread in
+                // every block): a group barrier after each LDS access keeps
+                // the console's lockstep order between the two halves.
+                let r = self.ds(inst, b, i);
+                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::Ds { .. } => self.ds(inst, b, i),

Test (split_tests.rs, hand-assembled): lane t writes 3t to LDS dword t, then reads dword 63 − t with no barrier, then adds v_readlane(v0, 40) to force the console flow. It expects 3(63 − t) + 40. Exact on the RTX 5070, and all 11 split tests pass.

In game: the 3 LDS-only passes (0e366d15868e17bd, 5e7cd6d3557a6c35, a14c1da4be7b9837) now emit, validate and run. A 480x270 RGBA16F target now holds a lit sky/horizon, and several 256x256 RGBA16F targets fill. The full-screen lighting targets are still 0. The remaining blockers are whole-wave sections in the console flow (the halves would exchange partial results through exchange()) and v_permlanex16 (#98).

Not done: the full test suite with this change; only the split tests ran.

AI-assisted (Claude Code); no game files attached.

**@⁠AKA0GHOST** on GitHub · 2026-11-24 07:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7125466290) Tested this PR on an RTX 5070 (Blackwell, 32..32, driver 621.14), and extended the console flow to LDS. Diff below in case it is useful. **Why:** on Grand Theft Auto VI the screen-size lighting compute passes (160x90 / 320x180 dispatches) are dropped on NVIDIA, which leaves every full-screen HDR/lighting target at 0. Six of them still fail with this PR. All six are 8x8x1 = 64 threads, one console wave. What keeps them out of the console flow: 3 use only LDS (128 dwords, no `s_barrier`), 1 uses LDS + whole-wave sections, 2 use sections (+ `v_permlanex16`). **Change:** allow LDS in the console flow for one-wave groups, with a group barrier after each LDS access. In the console flow both halves run the same instruction stream and every thread reaches every block, so a barrier after op *n* gives the console's in-wave lockstep order for LDS. It can't hang, for the same reason the exchanges can't. ```diff @@ Lower::new wants_console_flow = console_lanes && !split && x.native.wave64 && !x.target.runs(64) && x.target.runs(32) - && s.lds_dwords == 0 && cs.threads.iter().product::<u32>() <= 64 @@ instruction loop + Fields::Ds { .. } if self.console_cf && !name.starts_with("ds_swizzle") => { + // Console flow (one console wave per group, every thread in + // every block): a group barrier after each LDS access keeps + // the console's lockstep order between the two halves. + let r = self.ds(inst, b, i); + 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::Ds { .. } => self.ds(inst, b, i), ``` **Test** (`split_tests.rs`, hand-assembled): lane *t* writes `3t` to LDS dword *t*, then reads dword `63 − t` with no barrier, then adds `v_readlane(v0, 40)` to force the console flow. It expects `3(63 − t) + 40`. Exact on the RTX 5070, and all 11 split tests pass. **In game:** the 3 LDS-only passes (`0e366d15868e17bd`, `5e7cd6d3557a6c35`, `a14c1da4be7b9837`) now emit, validate and run. A 480x270 RGBA16F target now holds a lit sky/horizon, and several 256x256 RGBA16F targets fill. The full-screen lighting targets are still 0. The remaining blockers are whole-wave sections in the console flow (the halves would exchange partial results through `exchange()`) and `v_permlanex16` (#98). Not done: the full test suite with this change; only the split tests ran. AI-assisted (Claude Code); no game files attached.
Author
Owner

@⁠AKA0GHOST on GitHub · 2026-11-24 07:58 UTC · original

Follow-up to my comment above: I missed that #439, stacked on this PR, already does the LDS part (a barrier before each access, same effect as the one after in my diff). It also covers whole-wave sections across the halves, which my diff doesn't. Please disregard the diff here.

Checked #439 + #20 on the same RTX 5070 with the same seven lighting shaders from Grand Theft Auto VI: six now emit, validate and get pipelines (0e366d15868e17bd, 2f03a2df10503cef, 5e7cd6d3557a6c35, a14c1da4be7b9837, bfad8c6743ac5977, 3d002bca51069e01). Only a929109552ce1e84 still stops (v_permlanex16, #98). I'll put in-game results on #439.

AI-assisted (Claude Code); no game files attached.

**@⁠AKA0GHOST** on GitHub · 2026-11-24 07:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7125577633) Follow-up to my comment above: I missed that #439, stacked on this PR, already does the LDS part (a barrier before each access, same effect as the one after in my diff). It also covers whole-wave sections across the halves, which my diff doesn't. Please disregard the diff here. Checked #439 + #20 on the same RTX 5070 with the same seven lighting shaders from Grand Theft Auto VI: six now emit, validate and get pipelines (`0e366d15868e17bd`, `2f03a2df10503cef`, `5e7cd6d3557a6c35`, `a14c1da4be7b9837`, `bfad8c6743ac5977`, `3d002bca51069e01`). Only `a929109552ce1e84` still stops (`v_permlanex16`, #98). I'll put in-game results on #439. AI-assisted (Claude Code); no game files attached.
Author
Owner

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

@⁠AKA0GHOST thank you, and no harm done with the diff: arriving at the same barrier independently is a useful check on the idea. Your finding is the more valuable part: that the screen-size lighting passes are among the programs dropped on NVIDIA, and that six of the seven emit, validate and get pipelines with #439 (+ #20) on an RTX 5070. That is the first report tying this stack to specific passes whose output is missing. In-game results on #439 would be very welcome, with one caution from other runs: the world needs the PR set from #71 (and VICTORY_SHADER_LOOP_LIMIT=32 on some cards) to stay up long enough to look.

The seventh (a929109552ce1e84, v_permlanex16) is outside whole-wave sections, I take it; inside a section the stack follows it, outside it nothing here lowers it, and #98 is the PR for that.

Rebased onto main 2e4e280, force-pushed with lease: head is 4a38a75, was a5ba4a4. Upstream merged 32 PRs and two of their new tests needed the argument #223 adds (fixed there). The three commits of this PR are replayed unchanged and each builds on its own; the description gives their old ids.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 08:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7126326867) @⁠AKA0GHOST thank you, and no harm done with the diff: arriving at the same barrier independently is a useful check on the idea. Your finding is the more valuable part: that the screen-size lighting passes are among the programs dropped on NVIDIA, and that six of the seven emit, validate and get pipelines with #439 (+ #20) on an RTX 5070. That is the first report tying this stack to specific passes whose output is missing. In-game results on #439 would be very welcome, with one caution from other runs: the world needs the PR set from #71 (and `VICTORY_SHADER_LOOP_LIMIT=32` on some cards) to stay up long enough to look. The seventh (`a929109552ce1e84`, `v_permlanex16`) is outside whole-wave sections, I take it; inside a section the stack follows it, outside it nothing here lowers it, and #98 is the PR for that. **Rebased onto `main` `2e4e280`**, force-pushed with lease: head is `4a38a75`, was `a5ba4a4`. Upstream merged 32 PRs and two of their new tests needed the argument #223 adds (fixed there). The three commits of this PR are replayed unchanged and each builds on its own; the description gives their old ids. 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/320#issuecomment-7126496329) 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 11:02 UTC · original

@⁠slint6614-dev, the RX 9070 results give us a wave64 comparison for the RTX measurements. On #320, 22 more compute programs emit and two more validate. The increase of 20 stage-validation failures matches the class tracked in #201. The RTX opcode census on #233 found sample in every failing module. Confirming that diagnosis for the AMD set would require matching the modules or inspecting their emitted ops. #180 covers the implicit-derivative compute lowering.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 11:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7129577222) @⁠slint6614-dev, the RX 9070 results give us a wave64 comparison for the RTX measurements. On #320, 22 more compute programs emit and two more validate. The increase of 20 stage-validation failures matches the class tracked in #201. The RTX opcode census on #233 found `sample` in every failing module. Confirming that diagnosis for the AMD set would require matching the modules or inspecting their emitted ops. #180 covers the implicit-derivative compute lowering. AI-assisted (Codex).
Author
Owner

@⁠AKA0GHOST on GitHub · 2026-11-24 15:55 UTC · original

@⁠r4tedx thanks. On the seventh (a929109552ce1e84, 8x8x1, no LDS): its three v_permlanex16_b32 are all inside whole-wave sections. Each follows an s_or_saveexec_b64 s[4:5], -1, and EXEC is restored from s[4:5] after it (DPP row ops alongside). Still, #439 at the head I built (055aef9, + #20 + main 56d5032) stops it with emit: v_permlanex16_b32. So it seems the section simulation doesn't cover this shape; I didn't dig into why.

The in-game results on #439 are still pending. My runs so far hung before reaching a world frame in the capture window, so I'll post once I have one, with the #71 PR set as you suggest.

AI-assisted (Claude Code); no game files attached.

**@⁠AKA0GHOST** on GitHub · 2026-11-24 15:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7136845949) @⁠r4tedx thanks. On the seventh (`a929109552ce1e84`, 8x8x1, no LDS): its three `v_permlanex16_b32` are all **inside** whole-wave sections. Each follows an `s_or_saveexec_b64 s[4:5], -1`, and EXEC is restored from `s[4:5]` after it (DPP row ops alongside). Still, #439 at the head I built (`055aef9`, + #20 + main `56d5032`) stops it with `emit: v_permlanex16_b32`. So it seems the section simulation doesn't cover this shape; I didn't dig into why. The in-game results on #439 are still pending. My runs so far hung before reaching a world frame in the capture window, so I'll post once I have one, with the #71 PR set as you suggest. AI-assisted (Claude Code); no game files attached.
Author
Owner

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

@⁠AKA0GHOST, thank you, that is the detail I was missing. Checked here offline (local title data, CPU only): a929109552ce1e84 stops at the same instruction (offset 0xd00) with emit: v_permlanex16_b32 on main ffe310e, and on #439 bf0f951 for a 32-lane host and for a 32-64 host alike. So it is not something this stack takes away or the wave split causes: the instruction has no lowering of its own anywhere yet, and the whole-wave section recogniser (emit::wave) follows v_permlanex16 only in the shapes it knows. Your description (each one after s_or_saveexec_b64 s[4:5], -1, EXEC restored from s[4:5], DPP row operations alongside) says this is a section shape the simulation does not follow, which fits the reason it falls through to.

Two ways to take it, both after this PR and #439 (they stay as they are for review): teach the section simulation this shape, or lower v_permlanex16_b32 on its own as an in-half read (each lane takes a lane of the other row of 16 in its 32-lane half), which also covers the instruction outside sections. @⁠MichaelSmithAI's port of #404 on #439 does the second for the all-active form, with a test in both the split and the console flow; I will look at that first.

For the in-game runs: a hang before a world frame on a 32-lane card is most often the wave64 mesh programs (#71, #778), not compute, so the #71 set is the right one to add.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 15:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7136899211) @⁠AKA0GHOST, thank you, that is the detail I was missing. Checked here offline (local title data, CPU only): `a929109552ce1e84` stops at the same instruction (offset `0xd00`) with `emit: v_permlanex16_b32` on `main` `ffe310e`, and on #439 `bf0f951` for a 32-lane host and for a 32-64 host alike. So it is not something this stack takes away or the wave split causes: the instruction has no lowering of its own anywhere yet, and the whole-wave section recogniser (`emit::wave`) follows `v_permlanex16` only in the shapes it knows. Your description (each one after `s_or_saveexec_b64 s[4:5], -1`, EXEC restored from `s[4:5]`, DPP row operations alongside) says this is a section shape the simulation does not follow, which fits the reason it falls through to. Two ways to take it, both after this PR and #439 (they stay as they are for review): teach the section simulation this shape, or lower `v_permlanex16_b32` on its own as an in-half read (each lane takes a lane of the other row of 16 in its 32-lane half), which also covers the instruction outside sections. @⁠MichaelSmithAI's port of #404 on #439 does the second for the all-active form, with a test in both the split and the console flow; I will look at that first. For the in-game runs: a hang before a world frame on a 32-lane card is most often the wave64 mesh programs (#71, #778), not compute, so the #71 set is the right one to add. AI-assisted (Claude Code).
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-24 16:37 UTC · original

From a tester working with Claude (AI-assisted); measured on my own machine (i7-13700KF, RTX 4070 Super). No game data involved.

Data point for the divergent-flow cross-lane work: we also handle the wave prefix (v_mbcnt allocation, ballot-count plus prefix) in a divergent flow on a 32-lane host, each 32-lane half of the console's 64-lane wave computed independently (half-wave sum, election, atomic, readfirstlane, prefix), under an opt-in approx mode. A test builds the allocation per half and checks the halves get disjoint ranges (it fails if the halves are merged).

Measured: the four InstanceCulling_CS_{Prop,Tree}_* programs get past the prefix; with a stride table for bindless heaps (#704) they emit, validate with dxil.dll and create their PSO on the RTX 4070 Super. Without that table they stop at "unknown stride".

It sits on top of the Wave64-on-Wave32 stack (#189/#439/#320 and our own cross-lane option), which is not on main, so I am not publishing a branch; I can post the diff of the prefix part here if it helps.

**@⁠LooperSalty** on GitHub · 2026-11-24 16:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7137960363) From a tester working with Claude (AI-assisted); measured on my own machine (i7-13700KF, RTX 4070 Super). No game data involved. Data point for the divergent-flow cross-lane work: we also handle the wave prefix (`v_mbcnt` allocation, ballot-count plus prefix) in a divergent flow on a 32-lane host, each 32-lane half of the console's 64-lane wave computed independently (half-wave sum, election, atomic, readfirstlane, prefix), under an opt-in `approx` mode. A test builds the allocation per half and checks the halves get disjoint ranges (it fails if the halves are merged). Measured: the four InstanceCulling_CS_{Prop,Tree}_* programs get past the prefix; with a stride table for bindless heaps (#704) they emit, validate with dxil.dll and create their PSO on the RTX 4070 Super. Without that table they stop at "unknown stride". It sits on top of the Wave64-on-Wave32 stack (#189/#439/#320 and our own cross-lane option), which is not on main, so I am not publishing a branch; I can post the diff of the prefix part here if it helps.
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 went in together with #439, which builds on it. 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 #439, #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; "a select on an untracked mask" 284 → 0, "a lane mask holding lanes elsewhere read as data" 266 → 3, "console wave64 lanes on a host without 64-lane waves" 162 → 0.
  • 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/320#issuecomment-7138597468) · 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 went in together with #439, which builds on it. 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 #439, #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; "a select on an untracked mask" 284 → 0, "a lane mask holding lanes elsewhere read as data" 266 → 3, "console wave64 lanes on a host without 64-lane waves" 162 → 0. - 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

@⁠Marvisak on GitHub · 2026-11-25 00:27 UTC · original · edited 2026-11-26 07:21 UTC

Automated triage for the maintainers.

Needs work: needs the maintainer's decision. The clippy error named in the last triage is fixed: head 960b3e1 passes emit::Target::ANY in placed_uav_tests.rs (merged up from #223), and CI check passes. Nothing else changed since 85362ac.

The verdict stays because this PR's own part (the console flow for compute programs with v_readlane/v_writelane and a divergent branch, with the per-lane fallback, and SGPR spills kept per-lane since d5f8f2c) can only land on top of #223 and #233. #233 is waiting on a maintainer's choice between this stack and #2176/#2925. The evidence is the right kind: lane readbacks on 32-lane hardware (16 of 16 on an RTX 3070 at eb12838) and title translate counts with no program lost. Once #233 is decided, this needs a maintainer read in stack order.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7148524701) · edited 2026-11-26 07:21 UTC <!-- victory-triage v1 head=960b3e198eca2a1e618e50915943858fd5272567 verdict=needs-work at=2026-11-26T07:21:15Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision.** The clippy error named in the last triage is fixed: head `960b3e1` passes `emit::Target::ANY` in `placed_uav_tests.rs` (merged up from #223), and CI `check` passes. Nothing else changed since `85362ac`. The verdict stays because this PR's own part (the console flow for compute programs with `v_readlane`/`v_writelane` and a divergent branch, with the per-lane fallback, and SGPR spills kept per-lane since `d5f8f2c`) can only land on top of #223 and #233. #233 is waiting on a maintainer's choice between this stack and #2176/#2925. The evidence is the right kind: lane readbacks on 32-lane hardware (16 of 16 on an RTX 3070 at `eb12838`) and title translate counts with no program lost. Once #233 is decided, this needs a maintainer read in stack order. 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 #233, head eb12838 (merge commits, no rebase). It carries #233's three fixes (see there). Conflicts were in lower.rs, mod.rs, structure.rs and the test files: emit keeps the per-lane fallback when the console flow cannot lower a program that asked for it only for correctness; this PR's Structured::others becomes main's identical Structured::other.

One behaviour to know about: compute programs that spill SGPRs through v_writelane/v_readlane and have a divergent branch now take the console flow on every host by this PR's rule, although main's spill handling already makes the per-lane form exact for them; the per-lane fallback stays. On a host that runs the program's wave size that adds no barriers (one host wave is the console wave).

Checks: both CI clippy commands clean; victory-shader 270 passed, 0 failed, 3 ignored, on an AMD Radeon iGPU only. Not run on a 32-lane card today (see #233).

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-25 07:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7155540214) Updated for the needs-rebase triage: `main` (`940d32f`) is merged in through #233, head **`eb12838`** (merge commits, no rebase). It carries #233's three fixes (see there). Conflicts were in `lower.rs`, `mod.rs`, `structure.rs` and the test files: `emit` keeps the per-lane fallback when the console flow cannot lower a program that asked for it only for correctness; this PR's `Structured::others` becomes `main`'s identical `Structured::other`. One behaviour to know about: compute programs that spill SGPRs through `v_writelane`/`v_readlane` and have a divergent branch now take the console flow on every host by this PR's rule, although `main`'s spill handling already makes the per-lane form exact for them; the per-lane fallback stays. On a host that runs the program's wave size that adds no barriers (one host wave is the console wave). Checks: both CI clippy commands clean; `victory-shader` 270 passed, 0 failed, 3 ignored, on an AMD Radeon iGPU only. Not run on a 32-lane card today (see #233). AI-assisted (Claude Code).
Author
Owner

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

Pushed d5f8f2ce for the triage note on SGPR spills: spill v_readlane/v_writelane keep main's per-lane form, with the console's wave size where the host runs it and none on a 32..32 host (each restore lowered as its SGPR). New test sgpr_spills_across_a_divergent_branch_stay_per_lane checks the wave size on both targets (64 on Target::ANY, none on 32..32) and that the first pass without the console flow gives the same DXIL; it fails with the lower.rs change reverted. Description updated.

Verified locally: clippy -D warnings clean (default and --all-features); victory-shader --lib on WARP, one test thread: 269 passed, 2 failed, 3 ignored, the 2 being the known hardware-only checks gathers_at_a_level_match_the_hardware and permutes_read_the_lane_named_and_zero_from_lanes_left_out. No hardware adapter and no title data used.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 10:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7160344982) Pushed `d5f8f2ce` for the triage note on SGPR spills: spill `v_readlane`/`v_writelane` keep main's per-lane form, with the console's wave size where the host runs it and none on a 32..32 host (each restore lowered as its SGPR). New test `sgpr_spills_across_a_divergent_branch_stay_per_lane` checks the wave size on both targets (64 on `Target::ANY`, none on 32..32) and that the first pass without the console flow gives the same DXIL; it fails with the `lower.rs` change reverted. Description updated. Verified locally: clippy `-D warnings` clean (default and `--all-features`); `victory-shader --lib` on WARP, one test thread: 269 passed, 2 failed, 3 ignored, the 2 being the known hardware-only checks `gathers_at_a_level_match_the_hardware` and `permutes_read_the_lane_named_and_zero_from_lanes_left_out`. No hardware adapter and no title data used. AI-assisted
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 05:07 UTC · original

Merged current main (63bcca4) in, with no rebase or force-push. Head now db85706, and it merges cleanly with main. The PRs above (#439) are merged from this head in turn. Details, conflict notes and the per-level checks are on #439 (policy ok, clippy clean, the WARP shader suite has only main's own 4 failures).

Synthetic tests only; no title data used.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 05:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7183205835) Merged current `main` (`63bcca4`) in, with no rebase or force-push. Head now **`db85706`**, and it merges cleanly with `main`. The PRs above (#439) are merged from this head in turn. Details, conflict notes and the per-level checks are on #439 (policy ok, clippy clean, the WARP shader suite has only `main`'s own 4 failures). Synthetic tests only; 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 85362ace has the fix merged up from #233: 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/320#issuecomment-7183302344) 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 `85362ace` has the fix merged up from #233: 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 960b3e19 has the fix merged up from #233: 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/320#issuecomment-7183373958) 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 `960b3e19` has the fix merged up from #233: 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:23 UTC · original

This triage reviewed 85362ace. The placed_uav_tests.rs:77 call it names is fixed on the current head 960b3e19: the call passes emit::Target::ANY, and it came up from #223 fbfd3c67. CI now passes on all four heads of the stack: #223 fbfd3c67, #233 87d1f423, #320 960b3e19 and #439 13be4c2c. Merge order is unchanged: #223, then #233, #320, #439.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 05:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/320#issuecomment-7183437043) This triage reviewed `85362ace`. The `placed_uav_tests.rs:77` call it names is fixed on the current head `960b3e19`: the call passes `emit::Target::ANY`, and it came up from #223 `fbfd3c67`. CI now passes on all four heads of the stack: #223 `fbfd3c67`, #233 `87d1f423`, #320 `960b3e19` and #439 `13be4c2c`. Merge order is unchanged: #223, then #233, #320, #439. 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/320/head:github-bot/gh-320'
git switch 'github-bot/gh-320'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-320'
git switch 'github-bot/gh-320'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-320'
git switch 'github-bot/gh-320'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-320'
git switch 'main'
git merge --squash 'github-bot/gh-320'
git switch 'main'
git merge --ff-only 'github-bot/gh-320'
git switch 'main'
git merge 'github-bot/gh-320'
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!320
No description provided.