Shaders: console flow for groups of several console waves on 32-lane hosts #2212

Open
shawshanker18 wants to merge 47 commits from upstream-pr/2214 into main
shawshanker18 commented 2026-11-25 08:04:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by shawshanker18 on 2026-11-25T08:04:25Z.


Moved from #1433 (same commit, b3efa1c), which I'm closing because I've moved to this account. Draft: the review on #1433 by r4tedx is right that count-paired barriers can be reached from different call sites within one host group, and D3D12 doesn't define that. I'm reworking it into a group-uniform form (plan in my reply on #1433), with readback tests, and then I'll rebase onto current main.

Stacked on #439 (and so #320 and #233): one commit on top of it, in emit/lower.rs, with tests.

What

On a host without 64-lane waves, a wave64 program that needs its whole wave runs in the console flow only in groups of one console wave. Bigger groups stop with console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves. This lifts that for groups of whole console waves (64 to 1024 threads).

Why it was refused, and how it is done

The halves of a console wave meet at group barriers (the exchange). In a group of several console waves, those waves branch and loop differently, so they reach different barriers, and a group barrier that pairs them by place would hang or pair the wrong halves.

Here group barriers are paired by count, not by place:

  • Each thread counts the group barriers it has passed (group-shared, one dword per thread). The two halves of a console wave run the same instruction stream, so they reach each exchange at the same count; the exchange slots are per half.
  • The program's own s_barrier becomes a wait: the half stamps its arrival (barrier count mod 4, and the phase it arrived in), then keeps passing group barriers until every half has arrived at this barrier (or the next one) or ended.
  • A thread that ends stamps its half as ended and keeps passing group barriers until every half has ended, so the others' exchanges and waits are never left one thread short. The LOOP_LIMIT abort path does the same.
  • What has to agree across threads is decided only from stamps written before a barrier and read after it: a stamp written in phase p is stored as p + 1 and counts once a thread has passed that barrier, so every thread deciding after the same barrier sees the same thing. Each check is one wave operation (host lane i tests half i, at most 32 halves).

Groups that are not a whole number of console waves, or whose LDS plus this state (threads + 3 × halves dwords) would pass 32 KiB, keep the old refusal.

Tests

New GPU tests in split_tests.rs, run on an RTX 4050 Laptop (split, two 32-lane waves per console wave) and an AMD Radeon 680M iGPU (native wave64), all exact:

  • console_flow_runs_groups_of_several_console_waves: v_readlane lane 40 in groups of 128 and 256 (each console wave reads its own lane 40).
  • console_waves_of_a_group_branch_differently: only console wave 0 enters a branch with a lane read inside; 256 threads.
  • console_waves_of_a_group_loop_differently: lane t loops t times reading lane 40, so wave 1 loops twice as long as wave 0; 128 threads.
  • program_barriers_order_lds_between_console_waves: waves take different branches, write LDS, s_barrier, then read the other console wave's dwords; 128 threads.

The tests that expected the refusal now expect a translation (console_lanes_translate_only_for_hosts_with_that_wave_size keeps a refusal check for a 96-thread group; each_adapter_gets_what_it_runs makes the 128-thread pipeline on every adapter).

  • cargo test -p victory-shader: 163 passed, 0 failed.
  • cargo clippy -p victory-shader --all-targets -- -D warnings, with and without --all-features: clean.

In the title

RTX 4050 Laptop (6 GB), Series S, on r4tedx's integration/testers update 9 (94e0ea5) with this change: compute programs refused in the world went from 112 to 1 (against the same tree at update 8 without it, so part of the drop is update 9's own changes), and none are refused for this reason. I have not checked the four InstanceCulling hashes from #71 by name. The world picture is still black on this machine; whether this is enough for the scene is open (pipelines were still being compiled when the runs were stopped).

No game data in this PR.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5487507045 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214). Originally posted by [shawshanker18](https://github.com/shawshanker18) on 2026-11-25T08:04:25Z. --- Moved from #1433 (same commit, `b3efa1c`), which I'm closing because I've moved to this account. **Draft:** the review on #1433 by r4tedx is right that count-paired barriers can be reached from different call sites within one host group, and D3D12 doesn't define that. I'm reworking it into a group-uniform form (plan in my reply on #1433), with readback tests, and then I'll rebase onto current `main`. Stacked on #439 (and so #320 and #233): one commit on top of it, in `emit/lower.rs`, with tests. ## What On a host without 64-lane waves, a wave64 program that needs its whole wave runs in the console flow only in groups of **one** console wave. Bigger groups stop with `console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves`. This lifts that for groups of whole console waves (64 to 1024 threads). ## Why it was refused, and how it is done The halves of a console wave meet at group barriers (the exchange). In a group of several console waves, those waves branch and loop differently, so they reach different barriers, and a group barrier that pairs them by place would hang or pair the wrong halves. Here group barriers are paired by **count**, not by place: - Each thread counts the group barriers it has passed (group-shared, one dword per thread). The two halves of a console wave run the same instruction stream, so they reach each exchange at the same count; the exchange slots are per half. - The program's own `s_barrier` becomes a wait: the half stamps its arrival (barrier count mod 4, and the phase it arrived in), then keeps passing group barriers until every half has arrived at this barrier (or the next one) or ended. - A thread that ends stamps its half as ended and keeps passing group barriers until every half has ended, so the others' exchanges and waits are never left one thread short. The `LOOP_LIMIT` abort path does the same. - What has to agree across threads is decided only from stamps written before a barrier and read after it: a stamp written in phase `p` is stored as `p + 1` and counts once a thread has passed that barrier, so every thread deciding after the same barrier sees the same thing. Each check is one wave operation (host lane `i` tests half `i`, at most 32 halves). Groups that are not a whole number of console waves, or whose LDS plus this state (`threads + 3 × halves` dwords) would pass 32 KiB, keep the old refusal. ## Tests New GPU tests in `split_tests.rs`, run on an RTX 4050 Laptop (split, two 32-lane waves per console wave) and an AMD Radeon 680M iGPU (native wave64), all exact: - `console_flow_runs_groups_of_several_console_waves`: `v_readlane` lane 40 in groups of 128 and 256 (each console wave reads its own lane 40). - `console_waves_of_a_group_branch_differently`: only console wave 0 enters a branch with a lane read inside; 256 threads. - `console_waves_of_a_group_loop_differently`: lane `t` loops `t` times reading lane 40, so wave 1 loops twice as long as wave 0; 128 threads. - `program_barriers_order_lds_between_console_waves`: waves take different branches, write LDS, `s_barrier`, then read the other console wave's dwords; 128 threads. The tests that expected the refusal now expect a translation (`console_lanes_translate_only_for_hosts_with_that_wave_size` keeps a refusal check for a 96-thread group; `each_adapter_gets_what_it_runs` makes the 128-thread pipeline on every adapter). - `cargo test -p victory-shader`: 163 passed, 0 failed. - `cargo clippy -p victory-shader --all-targets -- -D warnings`, with and without `--all-features`: clean. ## In the title RTX 4050 Laptop (6 GB), Series S, on r4tedx's `integration/testers` update 9 (`94e0ea5`) with this change: compute programs refused in the world went from 112 to 1 (against the same tree at update 8 without it, so part of the drop is update 9's own changes), and none are refused for this reason. I have not checked the four `InstanceCulling` hashes from #71 by name. The world picture is still black on this machine; whether this is enough for the scene is open (pipelines were still being compiled when the runs were stopped). No game data in this PR.
catminou4 commented 2026-11-25 08:48:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:48:20Z.

Review: COMMENTED


Mixed apps/docs/gpu/shader PR (+3544) adding translate --host-lanes MIN-MAX and console flow grouping. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Too large to approve as one unit; suggest splitting the shader lowering from the CLI/docs plumbing. The shader side would benefit from the macOS lowering tests once split.

<!-- greyfinch-sync:Marvisak/VIctory:review:6054378470 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#pullrequestreview-6054378470). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T08:48:20Z. **Review:** COMMENTED --- Mixed apps/docs/gpu/shader PR (+3544) adding `translate --host-lanes MIN-MAX` and console flow grouping. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Too large to approve as one unit; suggest splitting the shader lowering from the CLI/docs plumbing. The shader side would benefit from the macOS lowering tests once split.
Marvisak commented 2026-11-25 09:06:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T08:14:19Z.


Automated triage for the maintainers.

This branch conflicts with main in 11 files, among them crates/victory-shader/src/emit/lower.rs, crates/victory-shader/src/emit/host.rs, crates/victory-gpu/src/pipeline.rs and apps/victory/src/translate.rs. It will be reviewed once it is rebased and merges cleanly.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7156780360 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7156780360). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T08:14:19Z. --- <!-- victory-triage v1 head=b3efa1c0e3b7848cdc45d071972c4bfde83627aa verdict=needs-rebase at=2026-11-25T08:14:21Z --> Automated triage for the maintainers. This branch conflicts with `main` in 11 files, among them `crates/victory-shader/src/emit/lower.rs`, `crates/victory-shader/src/emit/host.rs`, `crates/victory-gpu/src/pipeline.rs` and `apps/victory/src/translate.rs`. It will be reviewed once it is rebased and merges cleanly. --- _Generated by [Claude Code](https://claude.ai/code)_
steven-seagull27 commented 2026-11-25 09:06:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-25T08:38:29Z.


Ran the four multi-wave control-flow tests at b3efa1c0e3b7848cdc45d071972c4bfde83627aa on Windows 11 build 26300.10075. The RTX 5080 exercised the split-wave implementation. Standalone WARP 1.0.22 produced the same expected lane values using native Wave64.

Adapter Path Test outcome Dispatch readbacks Exact lane values
RTX 5080, driver 621.40 split true 4/4 passed 5 1,792/1,792
Windows built-in WARP, 10.0.26100.10068 Compiler rejected wave capabilities 4/4 stopped before dispatch 0 —
Microsoft WARP 1.0.22, app-local split false 4/4 passed 5 1,792/1,792

The lane-40 reads checked 768 values across the 128- and 256-thread cases. The divergent branch checked 512, the loop checked 256, and the shared-memory barrier checked 256.

The stock tests enumerate hardware adapters. For the WARP runs I selected the software device explicitly with Host::new(true) in the test harness and kept the PR's shaders and assertions. Built-in WARP opened successfully, then each test reported console wave64 lanes on a host without 64-lane waves is not supported. For 1.0.22 I verified the loaded DLL path in-process and matched its hash to the x64 package binary. It reported supported wave sizes from 4 to 128.

The barrier count above is the observed result on these adapters. The separate concern about barriers reached at different call sites still applies. Author's explanation at this commit

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157288934 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7157288934). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-25T08:38:29Z. --- Ran the four multi-wave control-flow tests at `b3efa1c0e3b7848cdc45d071972c4bfde83627aa` on Windows 11 build 26300.10075. The RTX 5080 exercised the split-wave implementation. Standalone WARP 1.0.22 produced the same expected lane values using native Wave64. | Adapter | Path | Test outcome | Dispatch readbacks | Exact lane values | | --- | --- | --- | ---: | ---: | | RTX 5080, driver 621.40 | `split true` | 4/4 passed | 5 | 1,792/1,792 | | Windows built-in WARP, 10.0.26100.10068 | Compiler rejected wave capabilities | 4/4 stopped before dispatch | 0 | — | | Microsoft WARP 1.0.22, app-local | `split false` | 4/4 passed | 5 | 1,792/1,792 | The lane-40 reads checked 768 values across the 128- and 256-thread cases. The divergent branch checked 512, the loop checked 256, and the shared-memory barrier checked 256. The stock tests enumerate hardware adapters. For the WARP runs I selected the software device explicitly with `Host::new(true)` in the test harness and kept the PR's shaders and assertions. Built-in WARP opened successfully, then each test reported `console wave64 lanes on a host without 64-lane waves is not supported`. For 1.0.22 I verified the loaded DLL path in-process and matched its hash to the x64 package binary. It reported supported wave sizes from 4 to 128. The barrier count above is the observed result on these adapters. The separate concern about barriers reached at different call sites still applies. [Author's explanation at this commit](https://github.com/Marvisak/VIctory/pull/1433#issuecomment-7156330778)
desplmfao commented 2026-11-25 15:04:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T14:24:56Z.


In-title result for this draft, on Linux, in case it helps.

Setup: Grand Theft Auto VI Series X, the first mission's prison yard. RTX 5080 on Linux, Proton with vkd3d-proton 3.2.0. Our working branch carries #439 at 3fab5a1 and #2309, and I merged this PR at b3efa1c into it. The only conflicts were two struct-field blocks in lower.rs (multi/multi_sync next to pops/root_memory); I kept both. emit::split_tests gives 35 passed on the RTX 5080 under vkd3d-proton.

What it fixes: the four cascadeshadows_rendering:CS_ShadowRenderTiledMiscHair* programs (240cb516c1af0bc3, 1d44a723bdebbf27, b4b0427232707598, abd7a22106898c66), whose groups hold several console waves. Without this PR they don't translate (console wave64 lanes in a group of more than 64 threads), and each dispatch is dropped at 0.5–1 per frame. With it, all four translate and are made, with no faults, no drops, and no device loss or Xid.

What breaks: the picture. Large triangles stretch across the room, and the yard behind the window is washed out and sparse. Draws per frame fall from about 4,900 to 2,400–3,300 in the same scene, and the user compared it by eye with runs of the same branch without this PR. My guess is that other programs with groups of several console waves now translate too, and one of them (possibly a culling or skinning pass) produces wrong output. I haven't isolated which one yet. Since our base has #439's current head rather than this PR's own, the two approaches interacting is also possible.

image

How it was found: headless runs comparing translation and pipeline lines for those four hashes, then a captured frame (VICTORY_CAPTURE_WORLD), because the draw count had dropped.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7165242246 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7165242246). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T14:24:56Z. --- In-title result for this draft, on Linux, in case it helps. **Setup:** Grand Theft Auto VI Series X, the first mission's prison yard. RTX 5080 on Linux, Proton with vkd3d-proton 3.2.0. Our working branch carries #439 at `3fab5a1` and #2309, and I merged this PR at `b3efa1c` into it. The only conflicts were two struct-field blocks in `lower.rs` (`multi`/`multi_sync` next to `pops`/`root_memory`); I kept both. `emit::split_tests` gives 35 passed on the RTX 5080 under vkd3d-proton. **What it fixes:** the four `cascadeshadows_rendering:CS_ShadowRenderTiledMiscHair*` programs (`240cb516c1af0bc3`, `1d44a723bdebbf27`, `b4b0427232707598`, `abd7a22106898c66`), whose groups hold several console waves. Without this PR they don't translate (`console wave64 lanes in a group of more than 64 threads`), and each dispatch is dropped at 0.5–1 per frame. With it, all four translate and are made, with no faults, no drops, and no device loss or Xid. **What breaks:** the picture. Large triangles stretch across the room, and the yard behind the window is washed out and sparse. Draws per frame fall from about 4,900 to 2,400–3,300 in the same scene, and the user compared it by eye with runs of the same branch without this PR. My guess is that other programs with groups of several console waves now translate too, and one of them (possibly a culling or skinning pass) produces wrong output. I haven't isolated which one yet. Since our base has #439's current head rather than this PR's own, the two approaches interacting is also possible. <img width="1920" height="1080" alt="image" src="https://github.com/user-attachments/assets/9f76fcb3-a8fc-4f56-9634-cd6af75c3a61" /> **How it was found:** headless runs comparing translation and pipeline lines for those four hashes, then a captured frame (`VICTORY_CAPTURE_WORLD`), because the draw count had dropped.
desplmfao commented 2026-11-25 15:04:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T14:53:07Z.


A correction to my comment above: the broken picture is not this PR's translation.

With this PR, the 5 XboxBvhBuilder programs that were refused (14394a322f6dd5c2, 39321a95223001ed, 77360df21e12ea43, 9fc111d3be79364f, e63d22c4def9ba6a, all console wave64 lanes in a group of more than 64 threads) translate and are made too. So the BVH builder runs whole for the first time on this card (BVH builder runs … pipelines=53 made=53 refused=0). Every program that walks its structures (the CS_RaytracingResolve passes and the hair's BVH path) then runs, and that is where the picture breaks.

Check: the same build, with only those 5 builder pipelines refused through the pipeline journal (#491), so the builder stays held back as without this PR (made=48 refused=5). Same scene and frame: the picture is clean (the user compared it with our branch without this PR), at 4,879 draws per frame (median, range 4,438–5,742), the same as without this PR. The four CS_ShadowRenderTiledMiscHair* programs are still made in that run.

So this PR does what it says on a 32-lane NVIDIA card in the title, and it's what unblocks the BVH builder. What goes wrong once the builder runs is downstream (the built structures or the walks), and I'll follow that up separately. Sorry for the earlier misattribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7165966620 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7165966620). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T14:53:07Z. --- A correction to my comment above: the broken picture is **not** this PR's translation. With this PR, the 5 `XboxBvhBuilder` programs that were refused (`14394a322f6dd5c2`, `39321a95223001ed`, `77360df21e12ea43`, `9fc111d3be79364f`, `e63d22c4def9ba6a`, all `console wave64 lanes in a group of more than 64 threads`) translate and are made too. So the BVH builder runs whole for the first time on this card (`BVH builder runs … pipelines=53 made=53 refused=0`). Every program that walks its structures (the `CS_RaytracingResolve` passes and the hair's BVH path) then runs, and that is where the picture breaks. **Check:** the same build, with only those 5 builder pipelines refused through the pipeline journal (#491), so the builder stays held back as without this PR (`made=48 refused=5`). Same scene and frame: the picture is clean (the user compared it with our branch without this PR), at 4,879 draws per frame (median, range 4,438–5,742), the same as without this PR. The four `CS_ShadowRenderTiledMiscHair*` programs are still made in that run. So this PR does what it says on a 32-lane NVIDIA card in the title, and it's what unblocks the BVH builder. What goes wrong once the builder runs is downstream (the built structures or the walks), and I'll follow that up separately. Sorry for the earlier misattribution.
ruvenesh commented 2026-11-25 16:09:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ruvenesh on 2026-11-25T15:53:56Z.


Adds a whole-archive offline number to what desplmfao reported above (the five builder programs translate and the builder runs whole): with this PR cherry-picked at b3efa1c onto a local stack of main 940d32f plus other open PRs (two conflicts in lower.rs, both resolved by keeping both sides), victory translate <shaders.rpf> --list --host-lanes 32-32 over the whole retail archive gives 26,084 of 26,084 programs translated and 2,646 of 2,679 compute programs emitted. Only 2 refusals of "console wave64 lanes in a group of more than 64 threads" remain. On main plus the other PRs, the five acceleration-structure builder pipelines were all refused with that reason (about 390 builder dispatches per frame dropped, walkers held back), on an RTX 3060 under Linux + Proton.

I have not run it in the title yet; I'll add that result here if it is different from desplmfao's. Given their report that the picture breaks once the builder runs, I'm curious whether the break is in the walker passes' inputs or in how the builder's output is consumed. No game data attached. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167410887 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7167410887). Originally posted by [ruvenesh](https://github.com/ruvenesh) on 2026-11-25T15:53:56Z. --- Adds a whole-archive offline number to what desplmfao reported above (the five builder programs translate and the builder runs whole): with this PR cherry-picked at `b3efa1c` onto a local stack of `main` 940d32f plus other open PRs (two conflicts in `lower.rs`, both resolved by keeping both sides), `victory translate <shaders.rpf> --list --host-lanes 32-32` over the whole retail archive gives 26,084 of 26,084 programs translated and 2,646 of 2,679 compute programs emitted. Only 2 refusals of "console wave64 lanes in a group of more than 64 threads" remain. On `main` plus the other PRs, the five acceleration-structure builder pipelines were all refused with that reason (about 390 builder dispatches per frame dropped, walkers held back), on an RTX 3060 under Linux + Proton. I have not run it in the title yet; I'll add that result here if it is different from desplmfao's. Given their report that the picture breaks once the builder runs, I'm curious whether the break is in the walker passes' inputs or in how the builder's output is consumed. No game data attached. AI-assisted (Claude Code).
desplmfao commented 2026-11-25 16:09:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T16:02:37Z.


Follow-up to my correction above, answering @ruvenesh's question too. Once the builder runs whole, there are two separate problems.

1. The BVH path runs the capped view heap out of dynamic slots (verified). NVIDIA caps the shader-visible view heap at 1,000,000 (host view heap capped ... count=1245184), which leaves 65,536 dynamic slots. With the builder running, every host copy of title memory takes a view pair from that pool, and the builder's thousands of dispatches take tables and root-view runs. About a minute after BVH builder ran whole:

  • no free dynamic descriptor slots, then no dynamic slots for root views
  • 1,500–2,400 indirect calls dropped per frame, against about 40 with the builder held back; draws fall from about 4,900 to 2,400–3,300
  • no descriptor slots for a title memory copy's views: it reads as missing, so walks also read zeros for some title memory

With 2^18 dynamic slots (the split of #2475 / #1349) the same build logs 0 slot errors, about 40 dropped indirect calls a frame, and about 5,000 draws, with the builder still running whole. So that part of the break is slot exhaustion, and #2475 is what fixes it alongside this PR.

2. With the slots fixed, the picture is still wrong. Spikes come out of the characters, geometry is stretched, and green and magenta reflections show up. It gets worse over the minutes of a run, which points at something in the walks or the BVH skinning writing into title memory that ordinary draws also read, rather than at wrong walk results alone. I'm narrowing it down next by skipping the walks, then the bvh_skinning* programs.

Setup for both: Grand Theft Auto VI on Linux, RTX 5080, vkd3d-proton 3.2.0, our branch plus this PR at b3efa1c.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167542131 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7167542131). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T16:02:37Z. --- Follow-up to my correction above, answering @ruvenesh's question too. Once the builder runs whole, there are two separate problems. **1. The BVH path runs the capped view heap out of dynamic slots (verified).** NVIDIA caps the shader-visible view heap at 1,000,000 (`host view heap capped ... count=1245184`), which leaves 65,536 dynamic slots. With the builder running, every host copy of title memory takes a view pair from that pool, and the builder's thousands of dispatches take tables and root-view runs. About a minute after `BVH builder ran whole`: - `no free dynamic descriptor slots`, then `no dynamic slots for root views` - 1,500–2,400 indirect calls dropped per frame, against about 40 with the builder held back; draws fall from about 4,900 to 2,400–3,300 - `no descriptor slots for a title memory copy's views: it reads as missing`, so walks also read zeros for some title memory With 2^18 dynamic slots (the split of #2475 / #1349) the same build logs **0** slot errors, about 40 dropped indirect calls a frame, and about 5,000 draws, with the builder still running whole. So that part of the break is slot exhaustion, and #2475 is what fixes it alongside this PR. **2. With the slots fixed, the picture is still wrong.** Spikes come out of the characters, geometry is stretched, and green and magenta reflections show up. It gets worse over the minutes of a run, which points at something in the walks or the BVH skinning writing into title memory that ordinary draws also read, rather than at wrong walk results alone. I'm narrowing it down next by skipping the walks, then the `bvh_skinning*` programs. Setup for both: Grand Theft Auto VI on Linux, RTX 5080, vkd3d-proton 3.2.0, our branch plus this PR at `b3efa1c`.
shawshanker18 commented 2026-11-25 19:06:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by shawshanker18 on 2026-11-25T18:49:51Z.


@desplmfao @ruvenesh thank you both, this is the most useful feedback this PR has had. To sum up what you found:

  • Translation: 26,084 of 26,084 programs translate; 2 refusals remain for the group-size reason, the two groups whose LDS alone is already 32 KiB.
  • In the title (RTX 5080): the four tiled hair-shadow programs and the five acceleration-structure builder programs translate and are created. The builder runs whole (made=53 refused=0) with no faults or device loss.
  • What breaks after that is downstream:
    1. Dynamic slots run out on the 1,000,000-slot heap; #2475's 2^18 split fixes it.
    2. The picture still degrades over minutes: spikes, stretched geometry, green and magenta reflections.

On (2), the fact that it gets worse over time points at state that accumulates, not at one wrong walk. Two things I'd check besides skipping the walks and bvh_skinning*:

  • Builder output going back to title memory through the marked copy-back path. The builder writes into title memory that other passes read. Several open copy-back bugs can put stale bytes back or drop shader writes on pages shared with other buffers (#2436 / #2437, #2375 / #2377, #2473 / #2474, #2454). Running with those PRs stacked, or with the builder's output buffers kept GPU-only, would show whether it is a copy-back problem rather than a walk problem.
  • Refit versus rebuild. If refits read the previous frame's nodes, one bad frame compounds. A frame where only full rebuilds run would separate that.

Status of this PR: per @r4tedx's review on #1433, the barrier scheme is being reworked into a group-uniform form, so every dx.op.barrier sits on a path the whole group takes. Your runs give a real-title check for that rework: the same five builder programs, plus the four hair-shadow ones. I'll post here when it's up, rebased on current main.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171458447 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7171458447). Originally posted by [shawshanker18](https://github.com/shawshanker18) on 2026-11-25T18:49:51Z. --- @desplmfao @ruvenesh thank you both, this is the most useful feedback this PR has had. To sum up what you found: - **Translation:** 26,084 of 26,084 programs translate; 2 refusals remain for the group-size reason, the two groups whose LDS alone is already 32 KiB. - **In the title (RTX 5080):** the four tiled hair-shadow programs and the five acceleration-structure builder programs translate and are created. The builder runs whole (`made=53 refused=0`) with no faults or device loss. - **What breaks after that is downstream:** 1. Dynamic slots run out on the 1,000,000-slot heap; #2475's 2^18 split fixes it. 2. The picture still degrades over minutes: spikes, stretched geometry, green and magenta reflections. On (2), the fact that it gets worse over time points at state that accumulates, not at one wrong walk. Two things I'd check besides skipping the walks and `bvh_skinning*`: - **Builder output going back to title memory through the marked copy-back path.** The builder writes into title memory that other passes read. Several open copy-back bugs can put stale bytes back or drop shader writes on pages shared with other buffers (#2436 / #2437, #2375 / #2377, #2473 / #2474, #2454). Running with those PRs stacked, or with the builder's output buffers kept GPU-only, would show whether it is a copy-back problem rather than a walk problem. - **Refit versus rebuild.** If refits read the previous frame's nodes, one bad frame compounds. A frame where only full rebuilds run would separate that. Status of this PR: per @r4tedx's review on #1433, the barrier scheme is being reworked into a group-uniform form, so every `dx.op.barrier` sits on a path the whole group takes. Your runs give a real-title check for that rework: the same five builder programs, plus the four hair-shadow ones. I'll post here when it's up, rebased on current `main`.
Machad3x commented 2026-11-25 22:04:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Machad3x on 2026-11-25T21:33:57Z.


Two things this console flow stops short of on a 32-lane host, seen in a title run (RTX 3080 Ti, driver 621.24, Windows 11, this change stacked with #439, #2214 and other open pull requests on main 67e8ae1; not tried on this branch alone).

1. Whole-wave sections in groups that are not whole console waves are refused (a whole-wave section of a wave64 on a host without 64-lane waves). The run had groups of 1, 32 and 36 threads. The reductions are over the lanes there are, so removing that refusal works, with one more change: a group of 32 threads or fewer has no upper half, so the reduction must keep the host wave's result instead of joining it with the 0 exchange returns (a minimum would read 0):

let upper_half = self.s.threads.is_some_and(|t| t.iter().product::<u32>() > 32);
if self.console_cf && self.split && upper_half {
    // exchange and join as now
}

A test running sum, max and min of the lane ids in groups of 1, 6, 32, 36 and 48 threads passes on the GPU. Offline over the title's containers, refused ones went from 218 to 214.

github.com/Machad3x/VIctory-nvidia-3080ti@a40cbc0

2. Whole-wave 16-bit float sums (Shape::Half) return a wave reduction in a wave64 program split in halves even in the console flow. Each half can sum its lanes, exchange the two f32 sums as other reductions do, and read the high-half lane (and its ballot bit) from the half it is in. Test: 64 lanes of 1.0h give 64.0h. This is in the second half of github.com/Machad3x/VIctory-nvidia-3080ti@1924c1e4 (the first half is #1737).

In the game runs, draws and dispatches dropped at the measured scene went from 15 a frame to 0 in most reports (together with #1737); no device removal.

Written with Claude Code; tested locally.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175246000 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7175246000). Originally posted by [Machad3x](https://github.com/Machad3x) on 2026-11-25T21:33:57Z. --- Two things this console flow stops short of on a 32-lane host, seen in a title run (RTX 3080 Ti, driver 621.24, Windows 11, this change stacked with #439, #2214 and other open pull requests on main 67e8ae1; not tried on this branch alone). **1. Whole-wave sections in groups that are not whole console waves** are refused (`a whole-wave section of a wave64 on a host without 64-lane waves`). The run had groups of 1, 32 and 36 threads. The reductions are over the lanes there are, so removing that refusal works, with one more change: a group of 32 threads or fewer has no upper half, so the reduction must keep the host wave's result instead of joining it with the 0 `exchange` returns (a minimum would read 0): ```rust let upper_half = self.s.threads.is_some_and(|t| t.iter().product::<u32>() > 32); if self.console_cf && self.split && upper_half { // exchange and join as now } ``` A test running sum, max and min of the lane ids in groups of 1, 6, 32, 36 and 48 threads passes on the GPU. Offline over the title's containers, refused ones went from 218 to 214. https://github.com/Machad3x/VIctory-nvidia-3080ti/commit/a40cbc0 **2. Whole-wave 16-bit float sums** (`Shape::Half`) return `a wave reduction in a wave64 program split in halves` even in the console flow. Each half can sum its lanes, exchange the two f32 sums as other reductions do, and read the high-half lane (and its ballot bit) from the half it is in. Test: 64 lanes of 1.0h give 64.0h. This is in the second half of https://github.com/Machad3x/VIctory-nvidia-3080ti/commit/1924c1e4 (the first half is #1737). In the game runs, draws and dispatches dropped at the measured scene went from 15 a frame to 0 in most reports (together with #1737); no device removal. Written with Claude Code; tested locally.
shawshanker18 commented 2026-11-25 22:04:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by shawshanker18 on 2026-11-25T21:43:23Z.


@Machad3x thanks, both look right. Each one also stands on its own:

  1. The upper_half guard for groups of 32 threads or fewer is a real bug fix: a minimum joined with exchange's 0 reads 0.
  2. f16 whole-wave sums can go through the same f32 exchange as the other reductions.

Both live in the whole-wave reduction code of #439's split stack rather than in this PR's multi-wave change. They'd land soonest as their own small PR on #439 or r4tedx's branch, with the GPU tests you describe. This PR's rework (group-uniform barriers) doesn't touch that path, so they won't conflict.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175454635 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7175454635). Originally posted by [shawshanker18](https://github.com/shawshanker18) on 2026-11-25T21:43:23Z. --- @Machad3x thanks, both look right. Each one also stands on its own: 1. The `upper_half` guard for groups of 32 threads or fewer is a real bug fix: a minimum joined with `exchange`'s 0 reads 0. 2. f16 whole-wave sums can go through the same f32 exchange as the other reductions. Both live in the whole-wave reduction code of #439's split stack rather than in this PR's multi-wave change. They'd land soonest as their own small PR on #439 or r4tedx's branch, with the GPU tests you describe. This PR's rework (group-uniform barriers) doesn't touch that path, so they won't conflict.
steven-seagull27 commented 2026-11-26 02:07:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T01:56:40Z.


@Machad3x @shawshanker18 I tested the first of the two follow-ups on the current #439 branch and credited the proposed upper-half check in the candidate. On RTX 5080, lifting the refusal alone produced 140 wrong minimum dwords. With the guard, sum/min/max matched all 1,884 dwords across nine group sizes. Portable WARP has a second issue with some partial groups that also reproduces in independently compiled HLSL. Candidate, before/after counts, DXC control and rerun command on #439.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180304831 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7180304831). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T01:56:40Z. --- @Machad3x @shawshanker18 I tested the first of the two follow-ups on the current #439 branch and credited the proposed upper-half check in the candidate. On RTX 5080, lifting the refusal alone produced 140 wrong minimum dwords. With the guard, sum/min/max matched all 1,884 dwords across nine group sizes. Portable WARP has a second issue with some partial groups that also reproduces in independently compiled HLSL. [Candidate, before/after counts, DXC control and rerun command on #439](https://github.com/Marvisak/VIctory/pull/439#issuecomment-7180301482).
steven-seagull27 commented 2026-11-26 02:07:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T02:03:03Z.


@Machad3x @shawshanker18 The second follow-up now has its own f16 sum PR against the #439 branch. The old split path refused all six test cases before dispatch. RTX 5080 Wave32 and Microsoft.Warp 1.0.22 Wave32 each returned 0/768 wrong with the patch. Native Wave64 on portable WARP matched all 768 on both revisions. Built-in Wave4 WARP skipped both fixed widths.

The regression checks the sum and the high 16 bits from lane 31 or 63. With the first 40 lanes active, lane 31 retains its tag and gives 0x001f5100, while inactive lane 63 gives 0x00005100. The branch leaves your multi-wave rework and r4tedx's planned rebase independent.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180408866 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7180408866). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T02:03:03Z. --- @Machad3x @shawshanker18 The second follow-up now has its own [f16 sum PR against the #439 branch](https://github.com/r4tedx/VIctory/pull/19). The old split path refused all six test cases before dispatch. RTX 5080 Wave32 and Microsoft.Warp 1.0.22 Wave32 each returned **0/768 wrong** with the patch. Native Wave64 on portable WARP matched all 768 on both revisions. Built-in Wave4 WARP skipped both fixed widths. The regression checks the sum and the high 16 bits from lane 31 or 63. With the first 40 lanes active, lane 31 retains its tag and gives `0x001f5100`, while inactive lane 63 gives `0x00005100`. The branch leaves your multi-wave rework and r4tedx's planned rebase independent.
latentdev commented 2026-11-26 09:06:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by latentdev on 2026-11-26T08:26:51Z.


This PR fixes the black hair in the opening cutscene on an RTX 4090

RTX 4090, driver 621.24, Windows 11, title 1.0.2.1, diag build, opening cutscene. Tree: main 63bcca4 + #1630 + #1832 + #2332 + #2178 + #2121, #439 at 3fab5a1, #2118 (af8b9ad), and this PR's commit b3efa1c applied on top. The only conflict was the new Lower fields beside #439's, and I kept both.

Which programs the hair needs. On NVIDIA, hair in this cutscene renders as black blocks, and the character loses the sun on her. fxceless/victory-fork draws it correctly on the same card, so I skipped programs there (VICTORY_SKIP_PIPELINES) and looked at the window shot:

  • Skipping the five that fail with a lane-mask join of an untracked mask (0a5ecfee6b79e13b, 17af15c4015cb4b6, 55679a0547649d0b, 89d08e561897d4e5, fdd56d97a806bcca) turns the lower ponytail into black blocks. #439 translates all five.
  • Skipping those five plus four that need more than one console wave per group turns the whole head of hair black and removes the sun on her. The four are 02384a60fda6f2d0 (128 threads), 0c028454b58543f0 (16x16), 14394a322f6dd5c2 (512) and 191ecaed66eea3b1 (16x16).

With this PR, 16 of the 18 candidates I tested in the fork that main refuses here translate, including all four above. They pass the validator, and the 4090 makes their pipelines. Two are still refused:

  • 6b82bc7d22016cb5 (1024 threads): console wave64 lanes in a group of more than 64 threads.
  • b22a16a178976e1b: a wave reduction in a wave64 program split in halves.

In game, the hair renders with its shape and strands, with no black blocks, 180 and 260 frames into the cutscene. A 21-minute run had no device removal.

Still different from the fork: in the window shot, the sun on her hair and shoulders and the sunlit strips on the walls are missing. In the fork, skipping the four programs above also takes the sun off her, so one of them may compute the hair right but not her sunlight here. I haven't narrowed it down further:

  • Skipping this PR's other 27 newly translated programs didn't bring the sun back.
  • Applying #439's partial-group fixes (611184e, f968c54) on top didn't bring it back either. The hair stays correct with them.

The structure builder. With this PR, all 53 of the builder's pipelines are made on this card, so #2118 lets the builder run: BVH builder runs ... pipelines=53 made=53 refused=0. With #2703 also applied, the GPU hung (0x887A0006) as the world started, and the list stopped in builder dispatch 3b90165a77d95cdf. For the hair runs above I held the builder back with a local switch.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7186603703 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7186603703). Originally posted by [latentdev](https://github.com/latentdev) on 2026-11-26T08:26:51Z. --- ### This PR fixes the black hair in the opening cutscene on an RTX 4090 RTX 4090, driver 621.24, Windows 11, title 1.0.2.1, diag build, opening cutscene. Tree: `main` 63bcca4 + #1630 + #1832 + #2332 + #2178 + #2121, #439 at `3fab5a1`, #2118 (`af8b9ad`), and this PR's commit `b3efa1c` applied on top. The only conflict was the new `Lower` fields beside #439's, and I kept both. **Which programs the hair needs.** On NVIDIA, hair in this cutscene renders as black blocks, and the character loses the sun on her. fxceless/victory-fork draws it correctly on the same card, so I skipped programs there (`VICTORY_SKIP_PIPELINES`) and looked at the window shot: - Skipping the five that fail with `a lane-mask join of an untracked mask` (`0a5ecfee6b79e13b`, `17af15c4015cb4b6`, `55679a0547649d0b`, `89d08e561897d4e5`, `fdd56d97a806bcca`) turns the lower ponytail into black blocks. #439 translates all five. - Skipping those five plus four that need more than one console wave per group turns the whole head of hair black and removes the sun on her. The four are `02384a60fda6f2d0` (128 threads), `0c028454b58543f0` (16x16), `14394a322f6dd5c2` (512) and `191ecaed66eea3b1` (16x16). **With this PR,** 16 of the 18 candidates I tested in the fork that `main` refuses here translate, including all four above. They pass the validator, and the 4090 makes their pipelines. Two are still refused: - `6b82bc7d22016cb5` (1024 threads): `console wave64 lanes in a group of more than 64 threads`. - `b22a16a178976e1b`: `a wave reduction in a wave64 program split in halves`. **In game,** the hair renders with its shape and strands, with no black blocks, 180 and 260 frames into the cutscene. A 21-minute run had no device removal. **Still different from the fork:** in the window shot, the sun on her hair and shoulders and the sunlit strips on the walls are missing. In the fork, skipping the four programs above also takes the sun off her, so one of them may compute the hair right but not her sunlight here. I haven't narrowed it down further: - Skipping this PR's other 27 newly translated programs didn't bring the sun back. - Applying #439's partial-group fixes (`611184e`, `f968c54`) on top didn't bring it back either. The hair stays correct with them. **The structure builder.** With this PR, all 53 of the builder's pipelines are made on this card, so #2118 lets the builder run: `BVH builder runs ... pipelines=53 made=53 refused=0`. With #2703 also applied, the GPU hung (`0x887A0006`) as the world started, and the list stopped in builder dispatch `3b90165a77d95cdf`. For the hair runs above I held the builder back with a local switch.
latentdev commented 2026-11-26 10:05:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by latentdev on 2026-11-26T09:35:01Z.


Update: the missing sun wasn't this PR

Same tree and cutscene as in my last comment. The sun was missing because I held the structure builder back, not because of the four programs.

Cause. With the builder held back, the title's ray-tracing structures are never built. The traced-shadow pass d2f4f8e0e2610d8c still walks them. Its output was one flat value over everything near the camera, and the sun mask that 0c028454b58543f0 writes afterwards was black on her, lit only on a far building.

Check. Skipping the traced-shadow programs (VICTORY_SKIP_PIPELINES) brings the sun back. In the same shot, 0c028454's mask then has sun on her hair and shoulder, the window frame and the yard outside, where the fork has it. Skipping only d2f4f8e0 is enough: the frame, the sill and the yard are lit again.

So with this PR the four programs compute the sun correctly. The fork runs d2f4f8e0 too and has the sun. Its node reads return zeros for a page of title memory the host has no copy of, which is probably why its walks find nothing there.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188184615 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7188184615). Originally posted by [latentdev](https://github.com/latentdev) on 2026-11-26T09:35:01Z. --- ### Update: the missing sun wasn't this PR Same tree and cutscene as in my last comment. The sun was missing because I held the structure builder back, not because of the four programs. **Cause.** With the builder held back, the title's ray-tracing structures are never built. The traced-shadow pass `d2f4f8e0e2610d8c` still walks them. Its output was one flat value over everything near the camera, and the sun mask that `0c028454b58543f0` writes afterwards was black on her, lit only on a far building. **Check.** Skipping the traced-shadow programs (`VICTORY_SKIP_PIPELINES`) brings the sun back. In the same shot, `0c028454`'s mask then has sun on her hair and shoulder, the window frame and the yard outside, where the fork has it. Skipping only `d2f4f8e0` is enough: the frame, the sill and the yard are lit again. So with this PR the four programs compute the sun correctly. The fork runs `d2f4f8e0` too and has the sun. Its node reads return zeros for a page of title memory the host has no copy of, which is probably why its walks find nothing there.
Lyrnc commented 2026-11-27 00:46:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Lyrnc on 2026-11-27T00:46:06Z.


Wave64 hardware check of b3efa1c on a 32-lane host (RTX 5080), on top of #439's current head.

Setup. As in my comment on #439: Windows 11, an RTX 5080 (32..32) and the Radeon iGPU of a Ryzen 7 9800X3D (gfx1036, RDNA 2) in one machine. Hand-written GFX10 wave64 compute programs, our own code, with expected values from the same code run natively in wave64 on the gfx1036. An independent Python model agrees with the hardware on every case. Each program goes through emit with Target { lanes_min: 32, lanes_max: 32 }, dxil.dll validation and a D3D12 dispatch, and every output of every thread is compared.

  • 65 programs in 128-thread groups (two console waves). Each wave runs one of the one-wave programs below. Wave 1 sees the case's lane mask with its halves swapped, so the two waves take different branches, and in the loop cases wave 1 loops longer (its counts come from thread ids 64-127). The waves share no LDS. Each wave was run separately on the hardware (wave 1 with v0 += 64 first), which is exact here because the waves never talk.
  • The 151 one-wave programs and 15 f32 sums from the #439 comment, to check that nothing changes for groups of one console wave.

Build. b3efa1c is based on an older #439, so I cherry-picked it onto #439's head e2d3cfd (main 63bcca4). That gave 3 conflicts in emit/lower.rs. In the Lower struct and its initialiser I kept both sides: pops and root_memory, plus multi and multi_sync. In the no_console_flow chain I kept #439's leaves_title_memory_out arm and dropped this PR's "whole-wave section in a group that is not a multiple of 64" arm, because #439 removed that refusal (611184e, reductions over partial groups). Everything else applied cleanly.

Results on the 5080 (exact / differ / refused):

case kind (128 threads) n #439 #439 + #2214
wave reduction in a branch 12 0 / 0 / 12 12 / 0 / 0
v_readfirstlane in a branch 7 1 / 6 / 0 1 / 6 / 0
v_readlane in a branch 12 0 / 0 / 12 12 / 0 / 0
v_writelane in a branch 12 0 / 0 / 12 12 / 0 / 0
reduction in two nested branches 4 0 / 0 / 4 4 / 0 / 0
reduction in a loop (wave 1 loops longer) 3 0 / 0 / 3 3 / 0 / 0
reduction after an early-out 4 0 / 0 / 4 4 / 0 / 0
vote loop + reduction in a branch 4 0 / 0 / 4 4 / 0 / 0
vote loop (s_cbranch_vccz) alone 3 0 / 3 / 0 0 / 3 / 0
break loop (s_cbranch_scc0) 4 0 / 0 / 4 4 / 0 / 0
all 128-thread 65 1 / 9 / 55 56 / 9 / 0
one console wave (151 integer cases) 151 139 / 12 / 0 139 / 12 / 0
f32 wave sums, one console wave 15 7 / 8 / 0 7 / 8 / 0

The same translations dispatched on the Radeon give the same counts, apart from the f32 sums, which are 15 of 15 exact there.

What it means.

  • The counted barriers work for these shapes. Every 128-thread program that #439 refused now translates, and all 55 of them are exact, including waves that branch differently and loops of different lengths per wave. No case hung or removed the device.
  • One-wave groups are unchanged: same 139 / 12 / 0, same values.
  • The 9 that differ are not caused by this PR. They differ the same way in one-wave groups on #439. 6 are a first-lane read as the program's only lane operation: no wave size, so it runs per host wave of 32. With the change I proposed on #439 (a first-lane read wants the console flow on a host without 64-lane waves), all 7 first-lane cases are exact here too, 62 of 65 in all. The other 3 are a vote loop with no lane operation, which runs per lane (structure.rs, s_cbranch_vccz taken by the lane's own bit), as on main.

Not tested: the title; groups of more than 128 threads; programs whose console waves share LDS across an s_barrier (the hardware reference runs one wave at a time); the D3D12 question from the #1433 review (barriers paired by count from different call sites), which this measurement does not settle.

AI use: Claude Code (Claude Opus 5.5) wrote the cases, the harness and this report, resolved the cherry-pick and ran it on the GPUs named here; the numbers come from those runs.


Float wave sums on the same branch

Setup. Same as my note on #439. Hand-written console wave64 programs, one 64-thread group, translated with Target { lanes_min: 32, lanes_max: 32 }, validated by dxil.dll and run on an RTX 5080. The reference is the same instructions run natively in wave64 on the gfx1036 iGPU of the same PC. The cases are 34 whole-wave f32 sums and 20 f64 sums in the compiler's WaveActiveSum shape (DPP8 x3, row_mirror bound_ctrl:1, v_permlanex16_b32, v_readlane_b32 32 / 0), inside per-lane branches or after an early-out.

54 cases, RTX 5080 exact differ refused
#2214 20 14 20

The per-case results are identical to #439's. The 20 f64 sums are refused (a whole-wave section step the simulation does not follow). All 14 differences are f32 sums equal to adding lanes 16 apart first in each half (NVIDIA's WaveActiveSum order). Example, every lane in, +-2^24 terms: hardware 86.0 (0x42ac0000), 5080 86.1632 (0x42ac5390).
5 more sums in uniform control flow give 1 exact, 2 differ in the same order, 2 f64 refused.

Meaning. These cases are all one console wave per group, so the several-console-wave handling is not what they test. The order inside a host wave is the same open point as in #439. A tree of partner-lane reads from bit 0 (lane ^ 1, 2, 4, 8, 16) made these cases exact in the fork's version.

AI use: Claude Code (Claude Opus 5.5) wrote the cases and the harness and ran them on this PC. The numbers come from those runs.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7206736387 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2214#issuecomment-7206736387). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-27T00:46:06Z. --- Wave64 hardware check of `b3efa1c` on a 32-lane host (RTX 5080), on top of #439's current head. **Setup.** As in my comment on #439: Windows 11, an RTX 5080 (32..32) and the Radeon iGPU of a Ryzen 7 9800X3D (gfx1036, RDNA 2) in one machine. Hand-written GFX10 wave64 compute programs, our own code, with expected values from the same code run natively in wave64 on the gfx1036. An independent Python model agrees with the hardware on every case. Each program goes through `emit` with `Target { lanes_min: 32, lanes_max: 32 }`, `dxil.dll` validation and a D3D12 dispatch, and every output of every thread is compared. - 65 programs in **128-thread groups** (two console waves). Each wave runs one of the one-wave programs below. Wave 1 sees the case's lane mask with its halves swapped, so the two waves take different branches, and in the loop cases wave 1 loops longer (its counts come from thread ids 64-127). The waves share no LDS. Each wave was run separately on the hardware (wave 1 with `v0 += 64` first), which is exact here because the waves never talk. - The 151 one-wave programs and 15 f32 sums from the #439 comment, to check that nothing changes for groups of one console wave. **Build.** `b3efa1c` is based on an older #439, so I cherry-picked it onto #439's head `e2d3cfd` (main `63bcca4`). That gave 3 conflicts in `emit/lower.rs`. In the `Lower` struct and its initialiser I kept both sides: `pops` and `root_memory`, plus `multi` and `multi_sync`. In the `no_console_flow` chain I kept #439's `leaves_title_memory_out` arm and dropped this PR's "whole-wave section in a group that is not a multiple of 64" arm, because #439 removed that refusal (`611184e`, reductions over partial groups). Everything else applied cleanly. **Results** on the 5080 (exact / differ / refused): | case kind (128 threads) | n | #439 | #439 + #2214 | |---|---|---|---| | wave reduction in a branch | 12 | 0 / 0 / 12 | 12 / 0 / 0 | | `v_readfirstlane` in a branch | 7 | 1 / 6 / 0 | **1 / 6 / 0** | | `v_readlane` in a branch | 12 | 0 / 0 / 12 | 12 / 0 / 0 | | `v_writelane` in a branch | 12 | 0 / 0 / 12 | 12 / 0 / 0 | | reduction in two nested branches | 4 | 0 / 0 / 4 | 4 / 0 / 0 | | reduction in a loop (wave 1 loops longer) | 3 | 0 / 0 / 3 | 3 / 0 / 0 | | reduction after an early-out | 4 | 0 / 0 / 4 | 4 / 0 / 0 | | vote loop + reduction in a branch | 4 | 0 / 0 / 4 | 4 / 0 / 0 | | vote loop (`s_cbranch_vccz`) alone | 3 | 0 / 3 / 0 | **0 / 3 / 0** | | break loop (`s_cbranch_scc0`) | 4 | 0 / 0 / 4 | 4 / 0 / 0 | | **all 128-thread** | 65 | 1 / 9 / 55 | **56 / 9 / 0** | | one console wave (151 integer cases) | 151 | 139 / 12 / 0 | 139 / 12 / 0 | | f32 wave sums, one console wave | 15 | 7 / 8 / 0 | 7 / 8 / 0 | The same translations dispatched on the Radeon give the same counts, apart from the f32 sums, which are 15 of 15 exact there. **What it means.** - The counted barriers work for these shapes. Every 128-thread program that #439 refused now translates, and all 55 of them are exact, including waves that branch differently and loops of different lengths per wave. No case hung or removed the device. - One-wave groups are unchanged: same 139 / 12 / 0, same values. - The 9 that differ are not caused by this PR. They differ the same way in one-wave groups on #439. 6 are a first-lane read as the program's only lane operation: no wave size, so it runs per host wave of 32. With the change I proposed on #439 (a first-lane read wants the console flow on a host without 64-lane waves), all 7 first-lane cases are exact here too, 62 of 65 in all. The other 3 are a vote loop with no lane operation, which runs per lane (structure.rs, `s_cbranch_vccz` taken by the lane's own bit), as on main. **Not tested:** the title; groups of more than 128 threads; programs whose console waves share LDS across an `s_barrier` (the hardware reference runs one wave at a time); the D3D12 question from the #1433 review (barriers paired by count from different call sites), which this measurement does not settle. **AI use:** Claude Code (Claude Opus 5.5) wrote the cases, the harness and this report, resolved the cherry-pick and ran it on the GPUs named here; the numbers come from those runs. --- **Float wave sums on the same branch** **Setup.** Same as my note on #439. Hand-written console wave64 programs, one 64-thread group, translated with `Target { lanes_min: 32, lanes_max: 32 }`, validated by dxil.dll and run on an RTX 5080. The reference is the same instructions run natively in wave64 on the gfx1036 iGPU of the same PC. The cases are 34 whole-wave f32 sums and 20 f64 sums in the compiler's `WaveActiveSum` shape (DPP8 x3, `row_mirror bound_ctrl:1`, `v_permlanex16_b32`, `v_readlane_b32` 32 / 0), inside per-lane branches or after an early-out. | 54 cases, RTX 5080 | exact | differ | refused | |---|---|---|---| | #2214 | 20 | 14 | 20 | The per-case results are identical to #439's. The 20 f64 sums are refused (`a whole-wave section step the simulation does not follow`). All 14 differences are f32 sums equal to adding lanes 16 apart first in each half (NVIDIA's `WaveActiveSum` order). Example, every lane in, +-2^24 terms: hardware 86.0 (0x42ac0000), 5080 86.1632 (0x42ac5390). 5 more sums in uniform control flow give 1 exact, 2 differ in the same order, 2 f64 refused. **Meaning.** These cases are all one console wave per group, so the several-console-wave handling is not what they test. The order inside a host wave is the same open point as in #439. A tree of partner-lane reads from bit 0 (lane ^ 1, 2, 4, 8, 16) made these cases exact in the fork's version. AI use: Claude Code (Claude Opus 5.5) wrote the cases and the harness and ran them on this PC. The numbers come from those runs.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.

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

git switch 'main'
git merge --no-ff 'upstream-pr/2214'
git switch 'upstream-pr/2214'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2214'
git switch 'upstream-pr/2214'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2214'
git switch 'main'
git merge --squash 'upstream-pr/2214'
git switch 'main'
git merge --ff-only 'upstream-pr/2214'
git switch 'main'
git merge 'upstream-pr/2214'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2212
No description provided.