GPU+shader: translate wave64 programs for 32-lane host waves when WaveLaneCountMax < 64 #2176

Open
github-bot wants to merge 3 commits from github-bot/gh-2176 into main AGit
Owner

@⁠n-romanovich on GitHub · 2026-11-25 07:06 UTC · original
n-romanovich:pr/wave32-translation → main · +203 −13 · 15 files · 3 commits · open

Summary

NVIDIA and Intel GPUs only execute 32-lane compute waves (WaveLaneCountMax < 64) and reject pipelines declaring WaveSize(64).

This adds Wave32 host translation mode so wave64 console programs run as two 32-lane host waves instead of failing pipeline creation:

  • Query D3D12_FEATURE_DATA_D3D12_OPTIONS1 in victory-gpu (host_wave32(), overridable via VICTORY_HOST_WAVE32).
  • Add set_host_wave32 / host_wave32 in victory_shader::emit and emit WaveSize(32) when enabled, masking wave lane indices in read_lane, ds_bpermute, and cross_lane via host_wave() / host_lane().
  • Include the Wave32 setting in victory-gpu::shader_cache::key so Wave32 and Wave64 shader caches stay isolated.

Verification

Tested on NVIDIA GeForce RTX 5060 Ti:

  • cargo test --release -p victory-shader --lib -- diff_tests valu_tests: 33 passed; 0 failed
  • cargo test --release -p victory-gpu --lib -- shader_cache: 3 passed; 0 failed
**@⁠n-romanovich** on GitHub · 2026-11-25 07:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176) `n-romanovich:pr/wave32-translation` → `main` · +203 −13 · 15 files · 3 commits · open ## Summary NVIDIA and Intel GPUs only execute 32-lane compute waves (`WaveLaneCountMax < 64`) and reject pipelines declaring `WaveSize(64)`. This adds Wave32 host translation mode so wave64 console programs run as two 32-lane host waves instead of failing pipeline creation: - Query `D3D12_FEATURE_DATA_D3D12_OPTIONS1` in `victory-gpu` (`host_wave32()`, overridable via `VICTORY_HOST_WAVE32`). - Add `set_host_wave32` / `host_wave32` in `victory_shader::emit` and emit `WaveSize(32)` when enabled, masking wave lane indices in `read_lane`, `ds_bpermute`, and `cross_lane` via `host_wave()` / `host_lane()`. - Include the Wave32 setting in `victory-gpu::shader_cache::key` so Wave32 and Wave64 shader caches stay isolated. ## Verification Tested on NVIDIA GeForce RTX 5060 Ti: - `cargo test --release -p victory-shader --lib -- diff_tests valu_tests`: `33 passed; 0 failed` - `cargo test --release -p victory-gpu --lib -- shader_cache`: `3 passed; 0 failed`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:57:27 +00:00
Author
Owner

@⁠iGoldenNinja on GitHub · 2026-11-25 07:14 UTC · original · edited 2026-11-25 07:35 UTC

Correction. My original ds_bpermute_b32 fixture used the wrong expected result. On RDNA2 the permute stays within each 32-lane half of a Wave64. The observed values, 1000 in lanes 0–31 and 1032 in lanes 32–63, match that rule. I withdraw the claim that the fixture found a ds_bpermute_b32 regression. Thank you @⁠upipibi for pointing out the distinction. AMD RDNA2 ISA, section 10.4.4 · XCL native hardware checks

The original PSO result stands. RTX 5080, driver 617.14, Windows 11 Pro build 26200.9974, PR head 3feadc6. Three of four matched compute inputs translated and validated with host Wave32 off and with it on. Those PSOs went from 0/3 created to 3/3. The fourth input reached a separate descriptor translation refusal in both modes. Successful PSO creation does not establish shader output parity.

I also independently reproduced @⁠Dathinel's actual v_readlane_b32 issue on this RTX 5080. Selecting guest lane 5 produced 5 in the lower half and 37 in the upper half. Selecting guest lane 32 produced 0 and 32, respectively. Every lane should receive the selected guest lane's value. Both synthetic DXIL pipelines validated, ran, and failed their readback assertions. The corrected permute fixture passed.

Corrected test report · Synthetic fixtures

OpenAI Codex (GPT-6) ran the RTX 5080 tests and drafted this correction.

**@⁠iGoldenNinja** on GitHub · 2026-11-25 07:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7155634300) · edited 2026-11-25 07:35 UTC **Correction.** My original `ds_bpermute_b32` fixture used the wrong expected result. On RDNA2 the permute stays within each 32-lane half of a Wave64. The observed values, 1000 in lanes 0–31 and 1032 in lanes 32–63, match that rule. I withdraw the claim that the fixture found a `ds_bpermute_b32` regression. Thank you @⁠upipibi for pointing out the distinction. [AMD RDNA2 ISA, section 10.4.4](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf) · [XCL native hardware checks](https://github.com/xcl-dev/xcl/pull/1022) The original PSO result stands. RTX 5080, driver 617.14, Windows 11 Pro build 26200.9974, PR head `3feadc6`. Three of four matched compute inputs translated and validated with host Wave32 off and with it on. Those PSOs went from 0/3 created to 3/3. The fourth input reached a separate descriptor translation refusal in both modes. Successful PSO creation does not establish shader output parity. I also independently reproduced @⁠Dathinel's actual `v_readlane_b32` issue on this RTX 5080. Selecting guest lane 5 produced 5 in the lower half and 37 in the upper half. Selecting guest lane 32 produced 0 and 32, respectively. Every lane should receive the selected guest lane's value. Both synthetic DXIL pipelines validated, ran, and failed their readback assertions. The corrected permute fixture passed. [Corrected test report](https://github.com/iGoldenNinja/victory-fork/blob/2ded0cdd1b50a7f2019022de1e304328d44a1e76/docs/victory-pr2176-wave32-5080.md) · [Synthetic fixtures](https://github.com/iGoldenNinja/victory-fork/blob/3e01f314dda0e96fbf4b09472b585e185a06eb9f/docs/victory-pr2176-synthetic-cross-half.patch) OpenAI Codex (GPT-6) ran the RTX 5080 tests and drafted this correction.
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 07:14 UTC · original · edited 2026-11-25 07:36 UTC

The cross-half issue also affects scalar v_readlane_b32. I ran the same ten synthetic GFX10 words on an RTX 3050 Laptop with host Wave32 explicitly enabled on the revisions below. One 64-thread group starts with v0 = tid.x, executes v_readlane_b32 s12, v0, 32, and stores the result to out[tid.x].

Revision Threads 0–31 Threads 32–63
This PR, 3feadc6 0 32
#189, 9580571, Wave32 mode 32 32
#439, 5a11cf4, 32-lane target 32 32
Expected 32 32

All three pipelines dispatched successfully. This tests scalar v_readlane_b32 specifically. Until the two waves exchange values, it would be safer to reject this cross-half read than return the wrong scalar.

Fixture words (hex), raw UAV at heap index 0: d760000c 00014100 7e06020c be810380 f4080200 fa000000 341e0082 e0701000 8002030f bf810000.

Control with lane 5: changing only the source lane from 32 to 5 produced 5 for threads 0–31 and 37 for threads 32–63 on this PR. On #189 and #439 all 64 threads returned 5. A guard that only rejects indices above 31 would miss this case.

AI-assisted; synthetic inputs only.

**@⁠Dathinel** on GitHub · 2026-11-25 07:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7155645168) · edited 2026-11-25 07:36 UTC The cross-half issue also affects scalar `v_readlane_b32`. I ran the same ten synthetic GFX10 words on an RTX 3050 Laptop with host Wave32 explicitly enabled on the revisions below. One 64-thread group starts with `v0 = tid.x`, executes `v_readlane_b32 s12, v0, 32`, and stores the result to `out[tid.x]`. | Revision | Threads 0–31 | Threads 32–63 | |---|---:|---:| | This PR, 3feadc6 | 0 | 32 | | #189, 9580571, Wave32 mode | 32 | 32 | | #439, 5a11cf4, 32-lane target | 32 | 32 | | Expected | 32 | 32 | All three pipelines dispatched successfully. This tests scalar `v_readlane_b32` specifically. Until the two waves exchange values, it would be safer to reject this cross-half read than return the wrong scalar. Fixture words (hex), raw UAV at heap index 0: `d760000c 00014100 7e06020c be810380 f4080200 fa000000 341e0082 e0701000 8002030f bf810000`. Control with lane 5: changing only the source lane from 32 to 5 produced 5 for threads 0–31 and 37 for threads 32–63 on this PR. On #189 and #439 all 64 threads returned 5. A guard that only rejects indices above 31 would miss this case. AI-assisted; synthetic inputs only.
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 07:25 UTC · original · edited 2026-11-26 00:22 UTC

Update for fb99078: this note was on an earlier head. fb99078 refuses cross-half v_readlane_b32 / v_writelane_b32 in compute and ballots or s_bcnt1 / s_ff1 that read EXEC or VCC as numbers. A constant 64-bit EXEC is still taken from the low word in both halves (measured: #2176). (Edited: I removed a sentence claiming s_cbranch_execz / vccz can send the halves different ways. That was wrong: here each lane branches on its own bit.)


Overlap note: #189 (alfycs) and #233 / #320 / #439 (r4tedx) also run wave64 programs on 32-lane hosts, and they emulate the operations that cross the halves. This PR runs each half as its own 32-lane wave, and host_lane maps a console lane to lane & 31, so anything that needs the other half or the whole 64-bit mask comes out per-half:

  • v_readlane_b32 / v_writelane_b32 with lanes 32–63 read or write the reader's own half (Dathinel's v_readlane_b32 s12, v0, 32 above), and v_readfirstlane_b32 in the high half returns a high-half lane.
  • 64-bit masks: v_cmp into VCC and s_*_saveexec are per-lane booleans here and are fine. Reading EXEC or VCC as a number (ballots, s_bcnt1 / s_ff1) sees 32 bits; fb99078 refuses those. A constant or SGPR-pair EXEC still takes the low word in both halves (measured, linked above). (Edited: the first version said v_cmp and s_*_saveexec see 32 bits; they don't.)
  • ds_bpermute_b32 is fine with the mask: in wave64 it stays inside each 32-lane half. XCL #1022's test of that passes on native wave64 AMD hardware (RX 7600 XT, RDNA3); I know of no RDNA2 measurement.

Programs without cross-half operations run correctly this way, which matches iGoldenNinja's 3/3 PSOs. For the rest, #233 refuses by name what it can't emulate yet. Taking this as a fallback only for programs with no cross-half operation, or building on #233's split, would avoid silently wrong lanes.

AI-assisted (Claude Code); source read only.

**@⁠upipibi** on GitHub · 2026-11-25 07:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7155839037) · edited 2026-11-26 00:22 UTC **Update for `fb99078`:** this note was on an earlier head. `fb99078` refuses cross-half `v_readlane_b32` / `v_writelane_b32` in compute and ballots or `s_bcnt1` / `s_ff1` that read EXEC or VCC as numbers. A constant 64-bit EXEC is still taken from the low word in both halves (measured: https://git.gtahub.st/github/Marvisak--VIctory/pulls/2176). (Edited: I removed a sentence claiming `s_cbranch_execz` / `vccz` can send the halves different ways. That was wrong: here each lane branches on its own bit.) --- Overlap note: #189 (alfycs) and #233 / #320 / #439 (r4tedx) also run wave64 programs on 32-lane hosts, and they emulate the operations that cross the halves. This PR runs each half as its own 32-lane wave, and `host_lane` maps a console lane to `lane & 31`, so anything that needs the other half or the whole 64-bit mask comes out per-half: - `v_readlane_b32` / `v_writelane_b32` with lanes 32–63 read or write the reader's own half (Dathinel's `v_readlane_b32 s12, v0, 32` above), and `v_readfirstlane_b32` in the high half returns a high-half lane. - 64-bit masks: `v_cmp` into VCC and `s_*_saveexec` are per-lane booleans here and are fine. Reading EXEC or VCC as a number (ballots, `s_bcnt1` / `s_ff1`) sees 32 bits; `fb99078` refuses those. A constant or SGPR-pair EXEC still takes the low word in both halves (measured, linked above). (Edited: the first version said `v_cmp` and `s_*_saveexec` see 32 bits; they don't.) - `ds_bpermute_b32` is fine with the mask: in wave64 it stays inside each 32-lane half. XCL #1022's test of that passes on native wave64 AMD hardware (RX 7600 XT, RDNA3); I know of no RDNA2 measurement. Programs without cross-half operations run correctly this way, which matches iGoldenNinja's 3/3 PSOs. For the rest, #233 refuses by name what it can't emulate yet. Taking this as a fallback only for programs with no cross-half operation, or building on #233's split, would avoid silently wrong lanes. AI-assisted (Claude Code); source read only.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 07:59 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 3feadc6f onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 07:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7156471124) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 3feadc6f onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

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

RTX 4060 Laptop: the PR takes compute PSO refusals from 115 to 0, and the world still fails on the descriptor heap

Independent check on a card not yet reported: RTX 4060 Laptop (Ada), driver 32.0.15.6607, Windows 11 build 26200, i7-13620H, 16 GB. Ran main 940d32f and this PR's head 3feadc6 through the same scenario, in separate worktrees, same package, same cache cleared between.

The detection works here: INFO victory_gpu::host: host wave lanes min=32 max=32 wave32=true.

The PR does what it says for pipeline creation

Counted from a --features diagnostics run over the prologue into the world:

main 940d32f this PR 3feadc6
host pipeline refused (0x80070057, all compute) 115 0
host wave lanes ... wave32= (not present) true, min=32 max=32
highest frame= seen 151 159

So on this machine every one of the 115 wave64 compute pipelines that main refuses now creates. That is a clean result and consistent with @⁠iGoldenNinja's 3/4 → 3/3 on the 5080 (mine is a wider count because it goes through the whole prologue, not a four-input fixture).

What it does not change: the world still dies on the capped descriptor heap

Same two runs, the counters that matter for reaching the world:

main 940d32f this PR 3feadc6
title slot past the host heap 310,720 310,720
host view heap capped at 1000000 ... count=1245184 1 1
device removed 4 4
run length 38.5 s 29.3 s

310,720 is exactly 1,245,184 − 934,464, the unmirrored-slot count in #1760. It does not move at all with this PR, because it is not a wave problem.

So on this card the two failures are independent, and fixing the wave side does not get the world up. That may be worth stating plainly in the PR body: this PR removes the host pipeline refused error class entirely, but a run that had only the wave problem fixed still dies at the same place for an unrelated reason.

Agreement with @⁠sinan-cmyk's offline result

Their translate --validate comparison found the same validated count on both sides (23,918). Mine is the runtime half of the same picture: the offline pass count does not move and the runtime PSO refusals go to zero, because the wave64 programs previously failed at CreateComputePipelineState, not at translation. Both measurements are consistent with "the change rejects nothing and unblocks pipeline creation".

Not tested / not claimed

  • I did not check shader output for the newly created pipelines, so nothing here speaks to @⁠Dathinel's v_readlane_b32 cross-half result or @⁠upipibi's list of per-half operations. iGoldenNinja's 5080 readback failures are the relevant evidence and I have not repeated them.
  • I did not try #189 / #233 / #439 for comparison.
  • Two lib tests fail on this machine (emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products, emit::valu_tests::image_atomics_of_64_bits) — but they fail identically on main 940d32f with no PR applied, so they are pre-existing here and not caused by this change. The PR body's "33 passed; 0 failed" is on a 5060 Ti; on the 4060 Laptop I get 31 passed, 2 failed, both pre-existing.

Logs and the failing-test detail available if useful.

**@⁠imrealynailong** on GitHub · 2026-11-25 08:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7157095785) ## RTX 4060 Laptop: the PR takes compute PSO refusals from 115 to 0, and the world still fails on the descriptor heap Independent check on a card not yet reported: **RTX 4060 Laptop (Ada)**, driver `32.0.15.6607`, Windows 11 build 26200, i7-13620H, 16 GB. Ran `main` `940d32f` and this PR's head `3feadc6` through the same scenario, in separate worktrees, same package, same cache cleared between. The detection works here: `INFO victory_gpu::host: host wave lanes min=32 max=32 wave32=true`. ### The PR does what it says for pipeline creation Counted from a `--features diagnostics` run over the prologue into the world: | | `main` `940d32f` | this PR `3feadc6` | |---|---:|---:| | `host pipeline refused` (`0x80070057`, all `compute`) | **115** | **0** | | `host wave lanes ... wave32=` | (not present) | `true`, `min=32 max=32` | | highest `frame=` seen | 151 | 159 | So on this machine every one of the 115 wave64 compute pipelines that `main` refuses now creates. That is a clean result and consistent with @⁠iGoldenNinja's 3/4 → 3/3 on the 5080 (mine is a wider count because it goes through the whole prologue, not a four-input fixture). ### What it does not change: the world still dies on the capped descriptor heap Same two runs, the counters that matter for reaching the world: | | `main` `940d32f` | this PR `3feadc6` | |---|---:|---:| | `title slot past the host heap` | **310,720** | **310,720** | | `host view heap capped at 1000000 ... count=1245184` | 1 | 1 | | `device removed` | 4 | 4 | | run length | 38.5 s | 29.3 s | `310,720` is exactly `1,245,184 − 934,464`, the unmirrored-slot count in #1760. It does not move at all with this PR, because it is not a wave problem. **So on this card the two failures are independent, and fixing the wave side does not get the world up.** That may be worth stating plainly in the PR body: this PR removes the `host pipeline refused` error class entirely, but a run that had only the wave problem fixed still dies at the same place for an unrelated reason. ### Agreement with @⁠sinan-cmyk's offline result Their `translate --validate` comparison found the same validated count on both sides (23,918). Mine is the runtime half of the same picture: the offline pass count does not move *and* the runtime PSO refusals go to zero, because the wave64 programs previously failed at `CreateComputePipelineState`, not at translation. Both measurements are consistent with "the change rejects nothing and unblocks pipeline creation". ### Not tested / not claimed - I did not check shader **output** for the newly created pipelines, so nothing here speaks to @⁠Dathinel's `v_readlane_b32` cross-half result or @⁠upipibi's list of per-half operations. iGoldenNinja's 5080 readback failures are the relevant evidence and I have not repeated them. - I did not try #189 / #233 / #439 for comparison. - Two lib tests fail on this machine (`emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products`, `emit::valu_tests::image_atomics_of_64_bits`) — but they fail identically on `main` `940d32f` with no PR applied, so they are pre-existing here and not caused by this change. The PR body's "33 passed; 0 failed" is on a 5060 Ti; on the 4060 Laptop I get 31 passed, 2 failed, both pre-existing. Logs and the failing-test detail available if useful.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:28 UTC · original · edited 2026-11-26 00:22 UTC

Automated triage for the maintainers.

Needs work. The rebased head fb99078 moves host_wave32 into emit::Options / lower::Parts (no global state any more), fixes the earlier CI error, and adds a refusal for one-wave LDS sharing (Lower::run) with tests. CI check passes and it merges cleanly.

Two points still hold it back:

  1. The 32-lane refusals still reach pixel and mesh programs. Lower::host_wave() (crates/victory-shader/src/emit/lower.rs) returns 32 whenever x.host_wave32 is set, whatever the stage, so the new host_wave() < wave() checks in cross_lane, the ballot-as-data path and the wave scan also refuse wave64 pixel and mesh programs, which never get WaveSize(32). A tester measured this on an RTX 5080 (pixel programs not translating 3 -> 330, mesh 0 -> 67). This was the open point from the earlier note. Please make host_wave() return 32 only for the compute programs that are given WaveSize(32), and add a test showing a wave64 pixel program with a cross-lane op still translates with host_wave32: true.
  2. Constant/SGPR-pair EXEC masks are wrong on a 32-lane host (reported with a measured case at this head). lane_bit picks the low or high mask word with lane < 32, but the lane comes from waveGetLaneIndex, which is 0..31 in each host wave, so the high word is never used: s_mov_b64 exec, 1 stores in lanes 0 and 32, and exec = 1 << 32 stores nothing. Either select the word by the half the host wave stands for, or refuse such masks on a 32-lane host, with a test.

On your reply: the move to Options and the LDS refusal address those points; the pixel/mesh scope above is the part still open. Note also that #2177 changes the same Options and shader_cache::key, so one of the two will need a rebase.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7163830407) · edited 2026-11-26 00:22 UTC <!-- victory-triage v1 head=fb99078f9b26c6594ab593b3053980d11b8a70f4 verdict=needs-work at=2026-11-26T00:22:36Z --> Automated triage for the maintainers. **Needs work.** The rebased head `fb99078` moves `host_wave32` into `emit::Options` / `lower::Parts` (no global state any more), fixes the earlier CI error, and adds a refusal for one-wave LDS sharing (`Lower::run`) with tests. CI `check` passes and it merges cleanly. Two points still hold it back: 1. **The 32-lane refusals still reach pixel and mesh programs.** `Lower::host_wave()` (`crates/victory-shader/src/emit/lower.rs`) returns 32 whenever `x.host_wave32` is set, whatever the stage, so the new `host_wave() < wave()` checks in `cross_lane`, the ballot-as-data path and the wave scan also refuse wave64 pixel and mesh programs, which never get `WaveSize(32)`. A tester measured this on an RTX 5080 (pixel programs not translating 3 -> 330, mesh 0 -> 67). This was the open point from the earlier note. Please make `host_wave()` return 32 only for the compute programs that are given `WaveSize(32)`, and add a test showing a wave64 pixel program with a cross-lane op still translates with `host_wave32: true`. 2. **Constant/SGPR-pair EXEC masks are wrong on a 32-lane host** (reported with a measured case at this head). `lane_bit` picks the low or high mask word with `lane < 32`, but the lane comes from `waveGetLaneIndex`, which is 0..31 in each host wave, so the high word is never used: `s_mov_b64 exec, 1` stores in lanes 0 and 32, and `exec = 1 << 32` stores nothing. Either select the word by the half the host wave stands for, or refuse such masks on a 32-lane host, with a test. On your reply: the move to `Options` and the LDS refusal address those points; the pixel/mesh scope above is the part still open. Note also that #2177 changes the same `Options` and `shader_cache::key`, so one of the two will need a rebase. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠n-romanovich on GitHub · 2026-11-25 14:09 UTC · original

@⁠Marvisak, updated pr/wave32-translation (b2ea86a) to address the triage points:

  1. Refuse cross-half operations by name when host_wave() < wave() (crates/victory-shader/src/emit/lower.rs):
    • Lower::cross_lane(false) now returns Err("a cross-half operation on a 32-lane host") (covering v_readlane_b32, v_writelane_b32, v_readfirstlane_b32, ds_bpermute_b32, v_mbcnt, and wave-wide DPP; 4-lane quad == true ops remain allowed).
    • Lower::mask_dword and the wave-scan waveActiveBallot path return Err("a 64-bit wave mask read as data on a 32-lane host") / Err("a cross-half wave scan on a 32-lane host").
    • The WaveSize(32) split now applies only to wave64 compute shaders without cross-half operations.
  2. Test: added emit::tests::wave64_cross_half_readlane_is_refused_on_wave32_host verifying that a wave64 compute shader using v_readlane_b32 is refused on a 32-lane host.
**@⁠n-romanovich** on GitHub · 2026-11-25 14:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7164854481) @⁠Marvisak, updated `pr/wave32-translation` (`b2ea86a`) to address the triage points: 1. **Refuse cross-half operations by name when `host_wave() < wave()`** (`crates/victory-shader/src/emit/lower.rs`): - `Lower::cross_lane(false)` now returns `Err("a cross-half operation on a 32-lane host")` (covering `v_readlane_b32`, `v_writelane_b32`, `v_readfirstlane_b32`, `ds_bpermute_b32`, `v_mbcnt`, and wave-wide DPP; 4-lane `quad == true` ops remain allowed). - `Lower::mask_dword` and the wave-scan `waveActiveBallot` path return `Err("a 64-bit wave mask read as data on a 32-lane host")` / `Err("a cross-half wave scan on a 32-lane host")`. - The `WaveSize(32)` split now applies only to wave64 compute shaders without cross-half operations. 2. **Test**: added `emit::tests::wave64_cross_half_readlane_is_refused_on_wave32_host` verifying that a wave64 compute shader using `v_readlane_b32` is refused on a 32-lane host.
Author
Owner

@⁠Bladureau on GitHub · 2026-11-25 16:20 UTC · original · edited 2026-11-25 17:06 UTC

RTX 4060 Laptop, in the world: wave64 mesh draws without a hang; BVH-builder programs hang; other wave64 compute makes GPU frames ~80× longer (both heads)

Machine: RTX 4060 Laptop 8 GB (driver 617.14), i7-13650HX, 32 GB RAM, Windows 11 26300. The log shows host wave lanes min=32 max=32 wave32=true. Series X mode, title 1.0.2.1. Diagnostics build with VICTORY_D3D12_DEBUG=1 and VICTORY_D3D12_DRED=1. No input once in the world.

Tree: main 940d32f + #2121 (40bd210) + #1763 (50d91b1) + #1630 (3c036f7) + this PR + #579 (rebased, patch from its thread) + #2332 (0e350ab, without it this card loses the device on the format-115 render target before or just after world entry, #1952). The only conflict was shader_cache.rs: I kept both #2121's view_pages and this PR's wave32 in the cache key. Each translator was warmed with translate --cache before its runs.

Offline, whole retail set (25,985 containers): 3feadc6 refuses 307; b2ea86a refuses 1,021, so 714 more.

Run Head Skipped World GPU per world frame End
4 3feadc6 nothing 6,754 draws in the first world frame — DXGI_ERROR_DEVICE_HUNG 33 s after world entry. DRED: the list stopped at command 1799 of 6978, dispatch 229x1x1 [compute 28918b7150a7aad5], in a stretch alternating with caa78b8ca62bc3d6
5 3feadc6 VICTORY_SKIP_WAVE64=compute 950–9,800 draws/frame 0.1–0.4 s (1.6–2.3 s in the frames I captured) none in 6 min, stopped by hand
6 3feadc6 the 52 XboxBvhBuilder.dll programs + f607780aa8e502d0 (VICTORY_SKIP_PIPELINES) 1,070–5,800 draws/frame 18–22 s the title's watchdog, +0x23cf683 write 0x0 (#1118), 2 min 10 s in, 10 s after a 42 s capture frame (see the edit)
7 b2ea86a same as run 6 760–1,850 draws/frame 9–20 s same watchdog, 1 min 50 s in, 1 s after a 38 s capture frame
8 b2ea86a same as run 6, plus VICTORY_SHADER_LOOP_LIMIT=1024 200–1,850 draws/frame 0.1–0.7 s (2.1–3.0 s in captured frames) same watchdog, 2 min 47 s in, right after a 41 s capture frame
9 b2ea86a same as run 8, every pack pipeline prebuilt (translate --cache --pipelines) 480–5,900 draws/frame 0.05–0.8 s (2.1–2.6 s in captured frames) none in 6 min 40 s, stopped by hand

What I read from it:

  1. Wave64 mesh runs here without a hang. In run 5, mesh programs run through this PR and compute wave64 is skipped. For the first time on this card, the dumped depth target and G-buffer of the first world frames hold the scene's geometry. Before, with wave64 mesh refused or skipped, they were empty. The presented frame is still black.
  2. The BVH builder hangs the GPU through this PR (run 4). Neither head refuses 28918b7150a7aad5 / caa78b8ca62bc3d6. These are the LDS-sharing builder programs #2311 names, so b2ea86a's guard does not cover what they need: both halves in one flow.
  3. Something in the remaining wave64 compute makes GPU frames ~80× longer (runs 5 vs 6). In run 7, b2ea86a refused 95 programs at run time (90 compute, 3 pixel, 2 mesh; 70 for "a 64-bit wave mask read as data", 25 for "a cross-half operation"), and the frames stayed as long. So the slow programs are not the ones the new guard catches.
  4. The extra GPU time is loops that run to the limit (runs 7 vs 8). With VICTORY_SHADER_LOOP_LIMIT=1024, the GPU part of a world frame falls from 9–20 s to 0.1–0.7 s outside captured frames. Why they run that long is my reading, not a measurement: I think they wait on values the other half writes. A console wave64 runs both halves in lockstep, so a value written by lanes 32–63 is already there when lanes 0–31 read it. As two host waves, one half can spin until the limit. Such programs use no cross-lane instruction, so the new guard cannot see them.

Edit (after a ninth run): I first wrote that run 8's long frames were pipeline compilation. They were my own captures. VICTORY_DUMP_TARGETS wrote 550–780 targets for each captured frame, which took 22–42 s. Every frame over 20 s in runs 8 and 9 is one of them, and so are the 2–3 s GPU values. The watchdog in runs 6, 7 and 8 fired 1–10 s after a 38–42 s capture frame, and capture frames of 22–30 s never set it off. So those three stops say more about my captures than about this PR (runs 6 and 7 still spend 9–22 s of GPU time per frame). Run 9 repeats run 8 with every pack pipeline prebuilt, none made during the run. It ran 6 min 40 s in the world with five capture frames of 22–28 s, no watchdog, no device removal and 0 ERROR lines, until I stopped it. Its G-buffer holds the outdoor scene's geometry, and the presented frame is still black.

If it helps, I can name the programs that hit the limit: VICTORY_GPU_TIMING=1 on run 6's settings, then their hashes here.

One run per row. Counts, hashes and messages only, no game data. AI-assisted (Claude Code).

**@⁠Bladureau** on GitHub · 2026-11-25 16:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7167809872) · edited 2026-11-25 17:06 UTC ## RTX 4060 Laptop, in the world: wave64 mesh draws without a hang; BVH-builder programs hang; other wave64 compute makes GPU frames ~80× longer (both heads) **Machine:** RTX 4060 Laptop 8 GB (driver 617.14), i7-13650HX, 32 GB RAM, Windows 11 26300. The log shows `host wave lanes min=32 max=32 wave32=true`. Series X mode, title 1.0.2.1. Diagnostics build with `VICTORY_D3D12_DEBUG=1` and `VICTORY_D3D12_DRED=1`. No input once in the world. **Tree:** `main` `940d32f` + #2121 (`40bd210`) + #1763 (`50d91b1`) + #1630 (`3c036f7`) + this PR + #579 (rebased, patch from its thread) + #2332 (`0e350ab`, without it this card loses the device on the format-115 render target before or just after world entry, #1952). The only conflict was `shader_cache.rs`: I kept both #2121's `view_pages` and this PR's `wave32` in the cache key. Each translator was warmed with `translate --cache` before its runs. **Offline, whole retail set (25,985 containers):** `3feadc6` refuses 307; `b2ea86a` refuses 1,021, so 714 more. | Run | Head | Skipped | World | GPU per world frame | End | |---|---|---|---|---|---| | 4 | `3feadc6` | nothing | 6,754 draws in the first world frame | — | `DXGI_ERROR_DEVICE_HUNG` 33 s after world entry. DRED: the list stopped at command 1799 of 6978, `dispatch 229x1x1 [compute 28918b7150a7aad5]`, in a stretch alternating with `caa78b8ca62bc3d6` | | 5 | `3feadc6` | `VICTORY_SKIP_WAVE64=compute` | 950–9,800 draws/frame | **0.1–0.4 s** (1.6–2.3 s in the frames I captured) | none in 6 min, stopped by hand | | 6 | `3feadc6` | the 52 `XboxBvhBuilder.dll` programs + `f607780aa8e502d0` (`VICTORY_SKIP_PIPELINES`) | 1,070–5,800 draws/frame | **18–22 s** | the title's watchdog, `+0x23cf683` write 0x0 (#1118), 2 min 10 s in, 10 s after a 42 s capture frame (see the edit) | | 7 | `b2ea86a` | same as run 6 | 760–1,850 draws/frame | **9–20 s** | same watchdog, 1 min 50 s in, 1 s after a 38 s capture frame | | 8 | `b2ea86a` | same as run 6, plus `VICTORY_SHADER_LOOP_LIMIT=1024` | 200–1,850 draws/frame | **0.1–0.7 s** (2.1–3.0 s in captured frames) | same watchdog, 2 min 47 s in, right after a 41 s capture frame | | 9 | `b2ea86a` | same as run 8, every pack pipeline prebuilt (`translate --cache --pipelines`) | 480–5,900 draws/frame | **0.05–0.8 s** (2.1–2.6 s in captured frames) | none in 6 min 40 s, stopped by hand | What I read from it: 1. **Wave64 mesh runs here without a hang.** In run 5, mesh programs run through this PR and compute wave64 is skipped. For the first time on this card, the dumped depth target and G-buffer of the first world frames hold the scene's geometry. Before, with wave64 mesh refused or skipped, they were empty. The presented frame is still black. 2. **The BVH builder hangs the GPU through this PR** (run 4). Neither head refuses `28918b7150a7aad5` / `caa78b8ca62bc3d6`. These are the LDS-sharing builder programs #2311 names, so `b2ea86a`'s guard does not cover what they need: both halves in one flow. 3. **Something in the remaining wave64 compute makes GPU frames ~80× longer** (runs 5 vs 6). In run 7, `b2ea86a` refused 95 programs at run time (90 compute, 3 pixel, 2 mesh; 70 for "a 64-bit wave mask read as data", 25 for "a cross-half operation"), and the frames stayed as long. So the slow programs are not the ones the new guard catches. 4. **The extra GPU time is loops that run to the limit** (runs 7 vs 8). With `VICTORY_SHADER_LOOP_LIMIT=1024`, the GPU part of a world frame falls from 9–20 s to 0.1–0.7 s outside captured frames. Why they run that long is my reading, not a measurement: I think they wait on values the other half writes. A console wave64 runs both halves in lockstep, so a value written by lanes 32–63 is already there when lanes 0–31 read it. As two host waves, one half can spin until the limit. Such programs use no cross-lane instruction, so the new guard cannot see them. **Edit (after a ninth run):** I first wrote that run 8's long frames were pipeline compilation. They were my own captures. `VICTORY_DUMP_TARGETS` wrote 550–780 targets for each captured frame, which took 22–42 s. Every frame over 20 s in runs 8 and 9 is one of them, and so are the 2–3 s GPU values. The watchdog in runs 6, 7 and 8 fired 1–10 s after a 38–42 s capture frame, and capture frames of 22–30 s never set it off. So those three stops say more about my captures than about this PR (runs 6 and 7 still spend 9–22 s of GPU time per frame). Run 9 repeats run 8 with every pack pipeline prebuilt, none made during the run. It ran 6 min 40 s in the world with five capture frames of 22–28 s, no watchdog, no device removal and 0 `ERROR` lines, until I stopped it. Its G-buffer holds the outdoor scene's geometry, and the presented frame is still black. If it helps, I can name the programs that hit the limit: `VICTORY_GPU_TIMING=1` on run 6's settings, then their hashes here. One run per row. Counts, hashes and messages only, no game data. AI-assisted (Claude Code).
Author
Owner

@⁠moe-miau on GitHub · 2026-11-25 18:30 UTC · original

Tested on an RTX 4070 SUPER (driver 32.0.16.1742, Windows 11 26300), title 1.0.2.1, Series X profile, diag build, 6-minute runs with scripted Enter presses. Base stack: main 67e8ae1 + #1906 + #2098 + #2626 + #2628 + #2464 (with #2464 the world draws on NVIDIA).

refused pipelines not translated device removed picture at 6 min
base 166 (WaveSize(64)) 7 no world draws, heavily overexposed and blocky
base + #189 (auto: Emulate) 98 2 no similar
base + this PR 0 118 no credits artwork correct, world still partly missing
base + this PR, the 3 refusals below lifted 0 0 yes, at 110 s (0x887A0006)
same + #2118 + builder held back on 32-lane hosts 0 4 no credits complete over a lit city skyline, exposure normal

Of the 118 programs this PR leaves untranslated here, 80 fail with a 64-bit wave mask read as data on a 32-lane host and 32 with a cross-half operation on a 32-lane host (plus the cross-half scan). Each host wave already stands for one half (ballot high dword 0, host_lane masks to 31), so I tried letting those three cases through with exactly those semantics, the way Zettrox/ztrx's default wave-local fallback does:

-                if self.host_wave() < self.wave() {
+                if self.host_wave() < self.wave() && !super::wave32_approx() {
                     return Err("a cross-half wave scan on a 32-lane host");
...
-                if self.host_wave() < self.wave() {
+                if self.host_wave() < self.wave() && !super::wave32_approx() {
                     return Err("a 64-bit wave mask read as data on a 32-lane host");
...
-        if !quad && self.host_wave() < self.wave() {
+        if !quad && self.host_wave() < self.wave() && !super::wave32_approx() {
             return Err("a cross-half operation on a 32-lane host");

Everything translates then, but the BVH builder (XboxBvhBuilder.dll; the hung submission held 14394a32 and 28918b71) really needs 64 lanes and hangs the GPU. With #2118 merged as well, plus one line holding the builder back on such hosts, the run went 6 minutes without a removal and the picture improved a lot:

-    let open = all_made(&states);
+    let open = all_made(&states) && !victory_shader::emit::host_wave32();

The builder then stays off on NVIDIA, as it does on main today, where its programs are refused. The approximation is exact for programs whose waves only work within themselves (compaction, reductions, one atomic per wave), and approximate for real cross-half exchanges. If you'd like it in this PR, I can send the change on top of it. Otherwise I can open it as a follow-up once this and #2118 are in.

AI-assisted (Claude Code); runs done on my machine.

**@⁠moe-miau** on GitHub · 2026-11-25 18:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7170994191) Tested on an RTX 4070 SUPER (driver 32.0.16.1742, Windows 11 26300), title 1.0.2.1, Series X profile, diag build, 6-minute runs with scripted Enter presses. Base stack: `main` `67e8ae1` + #1906 + #2098 + #2626 + #2628 + #2464 (with #2464 the world draws on NVIDIA). | | refused pipelines | not translated | device removed | picture at 6 min | |---|---|---|---|---| | base | 166 (`WaveSize(64)`) | 7 | no | world draws, heavily overexposed and blocky | | base + #189 (auto: Emulate) | 98 | 2 | no | similar | | base + this PR | **0** | 118 | no | credits artwork correct, world still partly missing | | base + this PR, the 3 refusals below lifted | 0 | 0 | **yes, at 110 s** (`0x887A0006`) | | | same + #2118 + builder held back on 32-lane hosts | **0** | **4** | no | credits complete over a lit city skyline, exposure normal | Of the 118 programs this PR leaves untranslated here, 80 fail with `a 64-bit wave mask read as data on a 32-lane host` and 32 with `a cross-half operation on a 32-lane host` (plus the cross-half scan). Each host wave already stands for one half (`ballot` high dword 0, `host_lane` masks to 31), so I tried letting those three cases through with exactly those semantics, the way Zettrox/ztrx's default wave-local fallback does: ```diff - if self.host_wave() < self.wave() { + if self.host_wave() < self.wave() && !super::wave32_approx() { return Err("a cross-half wave scan on a 32-lane host"); ... - if self.host_wave() < self.wave() { + if self.host_wave() < self.wave() && !super::wave32_approx() { return Err("a 64-bit wave mask read as data on a 32-lane host"); ... - if !quad && self.host_wave() < self.wave() { + if !quad && self.host_wave() < self.wave() && !super::wave32_approx() { return Err("a cross-half operation on a 32-lane host"); ``` Everything translates then, but the BVH builder (`XboxBvhBuilder.dll`; the hung submission held 14394a32 and 28918b71) really needs 64 lanes and hangs the GPU. With #2118 merged as well, plus one line holding the builder back on such hosts, the run went 6 minutes without a removal and the picture improved a lot: ```diff - let open = all_made(&states); + let open = all_made(&states) && !victory_shader::emit::host_wave32(); ``` The builder then stays off on NVIDIA, as it does on `main` today, where its programs are refused. The approximation is exact for programs whose waves only work within themselves (compaction, reductions, one atomic per wave), and approximate for real cross-half exchanges. If you'd like it in this PR, I can send the change on top of it. Otherwise I can open it as a follow-up once this and #2118 are in. AI-assisted (Claude Code); runs done on my machine.
Author
Owner

@⁠frenziedcoder on GitHub · 2026-11-25 19:23 UTC · original

RTX 5080 (Blackwell), driver 621.40, this PR (9857ed1) on top of the stack from #2464: no compute pipeline is refused any more (171 → 0), but on this 32-lane host it also stops pixel and mesh programs from translating that translate without it (pipelines skipped for that reason: pixel 3 → 330, mesh 0 → 67). The world still draws and the run had no device removal in 10 minutes.

Setup: NVIDIA GeForce RTX 5080 16 GB (driver 621.40), Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 26200. Title 1.0.2.1, Series X profile, diag build with diagnostics, VICTORY_D3D12_DRED=1, scripted Enter. The log says host wave lanes min=32 max=32 wave32=true.

Trees: "stack" = main 13f91ca + #1906 + #2098 + #2626 + #2628 + #2464, as reported on #2464. "+ this PR" merges 9857ed1 on top. Two conflicts with #2628, resolved by keeping both settings: emit::Options gets both portable_views and host_wave32, and the shader cache key in shader_cache.rs hashes both the view heap limit and the wave32 flag. One test initializer #2628 adds (memory_tests.rs, lower::Parts) needed host_wave32: false. Workspace tests build; shader_cache and wave tests pass.

translate --cache --pipelines (whole pack, --jobs 12):

stack stack + this PR
programs translated / refused 25,752 / 233 24,906 / 1,079
pipelines refused by the host 397 1
skipped: compute shader does not translate 24 391
skipped: pixel shader does not translate 3 330
skipped: mesh shader does not translate 0 67

In the title (one 600 s run each):

stack stack + this PR
host pipelines refused 171 0
shader does not translate; its pipelines' draws are dropped 8 (7 compute, 1 pixel) 173 (166 compute, 5 pixel, 2 mesh)
first world frame frame 1,191, 1,002 draws frame 1,322, 8,231 draws
world frame rate ~1.5–2.5 fps ~1.3 fps (726 frames in 548 s)
slow host submissions 72 (median 334 ms) 203 (median 280 ms)
device removed no no
picture blocky, over-bright patches about the same; more geometry, still large patches

Reasons for the 166 compute programs: 80 wave64 compute shader sharing LDS within one wave on a 32-lane host, the rest a 64-bit wave mask read as data on a 32-lane host and a cross-half operation on a 32-lane host. So in the run most of the 171 refusals became translation refusals, and their dispatches are still skipped, as @⁠moe-miau found (118 on the 4070 SUPER).

The pixel and mesh refusals carry the same two messages. Without this PR those programs translate and the host takes them, so it looks like the new host_wave() < wave() refusals in Lower also reach pixel and mesh stages, which the PR doesn't split. Limiting them to the compute programs that get WaveSize(32) would keep those draws.

Not tested: more than one run per tree; @⁠moe-miau's wave32_approx change, #2118 and the builder hold-back on top; Series S profile.

AI use: Claude Code (Claude Opus 5.5) merged the trees, resolved the conflicts, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report.

**@⁠frenziedcoder** on GitHub · 2026-11-25 19:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7172228603) **RTX 5080 (Blackwell), driver 621.40, this PR (`9857ed1`) on top of the stack from #2464: no compute pipeline is refused any more (171 → 0), but on this 32-lane host it also stops pixel and mesh programs from translating that translate without it (pipelines skipped for that reason: pixel 3 → 330, mesh 0 → 67).** The world still draws and the run had no device removal in 10 minutes. **Setup:** NVIDIA GeForce RTX 5080 16 GB (driver 621.40), Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 26200. Title 1.0.2.1, Series X profile, `diag` build with diagnostics, `VICTORY_D3D12_DRED=1`, scripted `Enter`. The log says `host wave lanes min=32 max=32 wave32=true`. **Trees:** "stack" = `main` `13f91ca` + #1906 + #2098 + #2626 + #2628 + #2464, [as reported on #2464](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2464). "+ this PR" merges `9857ed1` on top. Two conflicts with #2628, resolved by keeping both settings: `emit::Options` gets both `portable_views` and `host_wave32`, and the shader cache key in `shader_cache.rs` hashes both the view heap limit and the wave32 flag. One test initializer #2628 adds (`memory_tests.rs`, `lower::Parts`) needed `host_wave32: false`. Workspace tests build; `shader_cache` and `wave` tests pass. **`translate --cache --pipelines` (whole pack, `--jobs 12`):** | | stack | stack + this PR | |---|---|---| | programs translated / refused | 25,752 / 233 | 24,906 / **1,079** | | pipelines refused by the host | 397 | **1** | | skipped: compute shader does not translate | 24 | 391 | | skipped: pixel shader does not translate | 3 | **330** | | skipped: mesh shader does not translate | 0 | **67** | **In the title (one 600 s run each):** | | stack | stack + this PR | |---|---|---| | host pipelines refused | 171 | 0 | | `shader does not translate; its pipelines' draws are dropped` | 8 (7 compute, 1 pixel) | 173 (166 compute, **5 pixel, 2 mesh**) | | first world frame | frame 1,191, 1,002 draws | frame 1,322, 8,231 draws | | world frame rate | ~1.5–2.5 fps | ~1.3 fps (726 frames in 548 s) | | slow host submissions | 72 (median 334 ms) | 203 (median 280 ms) | | device removed | no | no | | picture | blocky, over-bright patches | about the same; more geometry, still large patches | Reasons for the 166 compute programs: 80 `wave64 compute shader sharing LDS within one wave on a 32-lane host`, the rest `a 64-bit wave mask read as data on a 32-lane host` and `a cross-half operation on a 32-lane host`. So in the run most of the 171 refusals became translation refusals, and their dispatches are still skipped, as @⁠moe-miau found (118 on the 4070 SUPER). The pixel and mesh refusals carry the same two messages. Without this PR those programs translate and the host takes them, so it looks like the new `host_wave() < wave()` refusals in `Lower` also reach pixel and mesh stages, which the PR doesn't split. Limiting them to the compute programs that get `WaveSize(32)` would keep those draws. **Not tested:** more than one run per tree; @⁠moe-miau's `wave32_approx` change, #2118 and the builder hold-back on top; Series S profile. *AI use: Claude Code (Claude Opus 5.5) merged the trees, resolved the conflicts, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report.*
Author
Owner

@⁠frenziedcoder on GitHub · 2026-11-25 20:41 UTC · original

Follow-up on the RTX 5080 (621.40): @⁠moe-miau's wave32_approx change plus #2118 and the builder hold-back, on top of this PR and the #2464 stack, removes the pixel / mesh regression I reported above, and the run is the best on this card so far: exposure normal, ~1.8 fps, no device removal in 600 s.

Tree: the stack from #2464 + this PR (9857ed1) + #2118 (60632d3, clean merge) + the two local changes from @⁠moe-miau's comment, applied as written: && !super::wave32_approx() on the three host_wave() < wave() refusals in lower.rs (with wave32_approx() returning true), and let open = all_made(&states) && !crate::host::host_wave32(); in pipeline/builder.rs (victory_shader::emit::host_wave32() is not on this head; victory-gpu's own host::host_wave32() stands in). Same machine, switches and scripted Enter as before.

translate --cache --pipelines (on the triage's minor point: --cache translates through victory_gpu::shader_cache::host_shader, which fills host_wave32 from the host, so these offline counts do include the 32-lane refusals; only plain translate without --cache passes ..Default::default()):

stack + this PR + this PR, #2118, the two changes
programs refused 233 1,079 430
skipped: pixel shader does not translate 3 330 3
skipped: mesh shader does not translate 0 67 0
skipped: compute shader does not translate 24 391 219
refused by the host 397 1 1

In the title (one 600 s run each):

stack + this PR + this PR, #2118, the two changes
host pipelines refused 171 0 0
draws dropped: programs that don't translate 8 173 85 (84 compute, 1 pixel)
frame reached by ~590 s 2,151 2,048 2,311
world frame rate ~1.5–2.5 fps ~1.3 fps ~1.8 fps (960 frames in 530 s; 263 in the last 88 s)
slow host submissions 72 203 83
picture blocky, over-bright about the same exposure normal; geometry still mostly flat
device removed no no no

80 of the 84 compute programs still dropped are wave64 compute shader sharing LDS within one wave on a 32-lane host, which the two changes don't touch (this head refuses that case; @⁠moe-miau's run may have been on an earlier head, with 4 left).

Not tested: more than one run; the changes one at a time; Series S profile.

AI use: Claude Code (Claude Opus 5.5) merged the tree, applied the changes from the comment, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report.

**@⁠frenziedcoder** on GitHub · 2026-11-25 20:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7174044102) **Follow-up on the RTX 5080 (621.40): @⁠moe-miau's `wave32_approx` change plus #2118 and the builder hold-back, on top of this PR and the #2464 stack, removes the pixel / mesh regression I [reported above](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2176), and the run is the best on this card so far: exposure normal, ~1.8 fps, no device removal in 600 s.** **Tree:** the stack from #2464 + this PR (`9857ed1`) + #2118 (`60632d3`, clean merge) + the two local changes from @⁠moe-miau's comment, applied as written: `&& !super::wave32_approx()` on the three `host_wave() < wave()` refusals in `lower.rs` (with `wave32_approx()` returning `true`), and `let open = all_made(&states) && !crate::host::host_wave32();` in `pipeline/builder.rs` (`victory_shader::emit::host_wave32()` is not on this head; `victory-gpu`'s own `host::host_wave32()` stands in). Same machine, switches and scripted `Enter` as before. **`translate --cache --pipelines`** (on the triage's minor point: `--cache` translates through `victory_gpu::shader_cache::host_shader`, which fills `host_wave32` from the host, so these offline counts do include the 32-lane refusals; only plain `translate` without `--cache` passes `..Default::default()`): | | stack | + this PR | + this PR, #2118, the two changes | |---|---|---|---| | programs refused | 233 | 1,079 | 430 | | skipped: pixel shader does not translate | 3 | 330 | **3** | | skipped: mesh shader does not translate | 0 | 67 | **0** | | skipped: compute shader does not translate | 24 | 391 | 219 | | refused by the host | 397 | 1 | 1 | **In the title (one 600 s run each):** | | stack | + this PR | + this PR, #2118, the two changes | |---|---|---|---| | host pipelines refused | 171 | 0 | 0 | | draws dropped: programs that don't translate | 8 | 173 | 85 (84 compute, 1 pixel) | | frame reached by ~590 s | 2,151 | 2,048 | **2,311** | | world frame rate | ~1.5–2.5 fps | ~1.3 fps | ~1.8 fps (960 frames in 530 s; 263 in the last 88 s) | | slow host submissions | 72 | 203 | 83 | | picture | blocky, over-bright | about the same | **exposure normal**; geometry still mostly flat | | device removed | no | no | no | 80 of the 84 compute programs still dropped are `wave64 compute shader sharing LDS within one wave on a 32-lane host`, which the two changes don't touch (this head refuses that case; @⁠moe-miau's run may have been on an earlier head, with 4 left). **Not tested:** more than one run; the changes one at a time; Series S profile. *AI use: Claude Code (Claude Opus 5.5) merged the tree, applied the changes from the comment, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report.*
Author
Owner

@⁠n-romanovich on GitHub · 2026-11-25 22:57 UTC · original

@⁠Marvisak Updated pr/wave32-translation (fb99078):

  • Moved host_wave32 into emit::Options and lower::Parts (no global state).
  • Added refusal on wave64 && host_wave32 when one_wave && lds_dwords > 0 (single-wave LDS without barriers), alongside the existing cross-lane refusal.
  • Added wave64_one_wave_lds_is_refused_on_wave32_host and verified wave64_cross_half_readlane_is_refused_on_wave32_host.
  • Merged main; CI check passes.
**@⁠n-romanovich** on GitHub · 2026-11-25 22:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7176983017) @⁠Marvisak Updated `pr/wave32-translation` (`fb99078`): - Moved `host_wave32` into `emit::Options` and `lower::Parts` (no global state). - Added refusal on `wave64 && host_wave32` when `one_wave && lds_dwords > 0` (single-wave LDS without barriers), alongside the existing cross-lane refusal. - Added `wave64_one_wave_lds_is_refused_on_wave32_host` and verified `wave64_cross_half_readlane_is_refused_on_wave32_host`. - Merged `main`; CI `check` passes.
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 23:54 UTC · original · edited 2026-11-26 00:22 UTC

@⁠n-romanovich a measured case at fb99078 that is neither refused nor right: a constant 64-bit EXEC in a wave64 compute program on a 32-lane host.

RTX 3070 (driver 616.56, 32-lane waves, host_wave32: true), a 64-thread wave64 CS: every lane writes 0xFFFFFFFF to out[tid], then EXEC is set, then each active lane stores tid. Two runs, identical:

EXEC console fb99078
s_mov_b64 exec, 1 only out[0] out[0] and out[32]
1 << 32 (via s_mov_b64 exec, s[14:15]) only out[32] nothing stored
0x1_00000001 out[0], out[32] out[0], out[32] (right only because both words are equal)

lane_bit builds both words for a constant or SGPR-pair mask (emit/lower.rs ~2615-2633) but picks between them with lane < 32, and lane comes from waveGetLaneIndex, which is 0..31 in each 32-lane host wave, so the high word is never used. Selecting by the half the host wave stands for (console lane = host lane + 32 · half) would likely fix it (untested). Writing EXEC as s_mov_b32 exec_lo, 0 ; s_mov_b32 exec_hi, 1 is refused (a lane mask holding lanes elsewhere read as data is not supported). The probe is an ignored test on top of fb99078: github.com/upipibi/VIctory@8beefc4f63 (cargo test -p victory-shader --lib probe_2176 -- --ignored --nocapture).

AI-assisted (Claude Code, Claude Opus 5.5). Synthetic instruction words only.

**@⁠upipibi** on GitHub · 2026-11-25 23:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7178196885) · edited 2026-11-26 00:22 UTC @⁠n-romanovich a measured case at `fb99078` that is neither refused nor right: a constant 64-bit EXEC in a wave64 compute program on a 32-lane host. RTX 3070 (driver 616.56, 32-lane waves, `host_wave32: true`), a 64-thread wave64 CS: every lane writes `0xFFFFFFFF` to `out[tid]`, then EXEC is set, then each active lane stores `tid`. Two runs, identical: | EXEC | console | `fb99078` | |---|---|---| | `s_mov_b64 exec, 1` | only `out[0]` | `out[0]` **and** `out[32]` | | `1 << 32` (via `s_mov_b64 exec, s[14:15]`) | only `out[32]` | nothing stored | | `0x1_00000001` | `out[0]`, `out[32]` | `out[0]`, `out[32]` (right only because both words are equal) | `lane_bit` builds both words for a constant or SGPR-pair mask (`emit/lower.rs` ~2615-2633) but picks between them with `lane < 32`, and `lane` comes from `waveGetLaneIndex`, which is 0..31 in each 32-lane host wave, so the high word is never used. Selecting by the half the host wave stands for (console lane = host lane + 32 · half) would likely fix it (untested). Writing EXEC as `s_mov_b32 exec_lo, 0 ; s_mov_b32 exec_hi, 1` is refused (`a lane mask holding lanes elsewhere read as data is not supported`). The probe is an ignored test on top of `fb99078`: https://github.com/upipibi/VIctory/commit/8beefc4f631d08ecb5fb143d8a6c9f16aee87b3e (`cargo test -p victory-shader --lib probe_2176 -- --ignored --nocapture`). AI-assisted (Claude Code, Claude Opus 5.5). Synthetic instruction words only.
Author
Owner

@⁠moe-miau on GitHub · 2026-11-26 00:13 UTC · original

@⁠n-romanovich #2925 builds on your one-wave LDS refusal: instead of refusing, it plans a group barrier between the program's LDS phases at a point every thread reaches once, and keeps your refusal wherever no such point exists. On an RTX 4070 SUPER it lets the program that writes the ray-march step volume (34d88edf583f3778) translate; the lighting passes that read it go from ~95-147 ms to under 3 ms per dispatch. Happy to fold it into this PR instead if you prefer.

**@⁠moe-miau** on GitHub · 2026-11-26 00:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7178537852) @⁠n-romanovich #2925 builds on your one-wave LDS refusal: instead of refusing, it plans a group barrier between the program's LDS phases at a point every thread reaches once, and keeps your refusal wherever no such point exists. On an RTX 4070 SUPER it lets the program that writes the ray-march step volume (`34d88edf583f3778`) translate; the lighting passes that read it go from ~95-147 ms to under 3 ms per dispatch. Happy to fold it into this PR instead if you prefer.
Author
Owner

@⁠walterwallaceson on GitHub · 2026-11-26 02:04 UTC · original

RTX 3070 on Windows 10: 3feadc6 hung the card during loading in 2 of 2 runs; fb99078 runs the same program and goes 15 minutes with no removal.

Setup: RTX 3070 8 GB, driver 621.14, Windows 10 22H2 (19045), host wave lanes min=32 max=32 wave32=true. Diag build, a scripted Enter at the start screen, nothing skipped.

  • 3feadc6: main 940d32f + #463 + #1763 + #1906 + #385 + #688 + this PR (in place of #189). Run 1 plain, run 2 with the debug layer and DRED.
  • fb99078: main 63bcca4 + #463 + #2626 + this PR, debug layer and DRED on. 15-minute run.
3feadc6 (2 runs) fb99078
end 0x887A0006 at ~1:37 and ~1:42, during loading 15 min, no removal
the submission before it 2 lists, 8.3-8.4 s (no submission over 1.3 s)
D3D12 refusals 2 0
not translated 13 168 (77 one-wave LDS, 59 64-bit mask as data, 28 cross-half, 4 other)

Where 3feadc6 stopped (DRED, run 2): list 2 of the submission at command 4,673 of 15,360; the command it names is a dispatch 1x1x1 of a wave64 compute program with 6 user-data words, first bound around frame 1,660. The same program runs with #189's wave32 mode on the old stack, and with fb99078 it is translated (not among the refusals) and bound at frame 1,769 and the run goes on. So one of the refusals added since 3feadc6 (cross-half operations, 64-bit masks as data, one-wave LDS) most likely covers what hung here; I haven't narrowed it to which one.

For comparison on the same new base: with #189 (3e39e34, wave32) instead of this PR, 117 programs don't translate and none are refused. With this PR, 168 don't translate (the debug layer makes this run's frame rate, about 1 fps, not comparable).

On the stack where the world draws on NVIDIA (main 63bcca4 + #463 + #2626 + #2098 + #2464 + #2628), one 15-minute run each:

that stack + #2118 + #2118 + this PR
end 15 min, no removal 15 min, no removal 15 min, no removal
D3D12 refusals / not translated 168 / 7 171 / 7 0 / 171
world speed, last 40 readings 0.7 fps 1.2 fps 1.2 fps
picture at 10 min (same spot) mostly white haze fence, buildings, sky readable the same

So on this card the clearer picture and the speed come from #2118; adding this PR changes which programs don't run (refused by D3D12 before, refused by the translator now) without changing the picture or the frame rate, and with no removal.

Merging with #2628: both add a field to emit::Options and an input to shader_cache's key, so they conflict in shader_cache.rs and emit/mod.rs. Keeping both (portable_views and host_wave32 in Options, options() setting both, key() taking the view heap limit and the wave32 flag) builds, and the tests compile.

Not tested: a second run of any of these; fb99078 on the old base; which refusal covers the hang.

No game data attached. I'm testing with Claude's help, and Claude drafted this comment.

**@⁠walterwallaceson** on GitHub · 2026-11-26 02:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7180439917) **RTX 3070 on Windows 10: `3feadc6` hung the card during loading in 2 of 2 runs; `fb99078` runs the same program and goes 15 minutes with no removal.** **Setup:** RTX 3070 8 GB, driver 621.14, Windows 10 22H2 (19045), `host wave lanes min=32 max=32 wave32=true`. Diag build, a scripted Enter at the start screen, nothing skipped. - `3feadc6`: `main` `940d32f` + #463 + #1763 + #1906 + #385 + #688 + this PR (in place of #189). Run 1 plain, run 2 with the debug layer and DRED. - `fb99078`: `main` `63bcca4` + #463 + #2626 + this PR, debug layer and DRED on. 15-minute run. | | `3feadc6` (2 runs) | `fb99078` | |---|---|---| | end | `0x887A0006` at ~1:37 and ~1:42, during loading | 15 min, no removal | | the submission before it | 2 lists, 8.3-8.4 s | (no submission over 1.3 s) | | D3D12 refusals | 2 | 0 | | not translated | 13 | 168 (77 one-wave LDS, 59 64-bit mask as data, 28 cross-half, 4 other) | **Where `3feadc6` stopped (DRED, run 2):** list 2 of the submission at command 4,673 of 15,360; the command it names is a `dispatch 1x1x1` of a wave64 compute program with 6 user-data words, first bound around frame 1,660. The same program runs with #189's wave32 mode on the old stack, and with `fb99078` it is translated (not among the refusals) and bound at frame 1,769 and the run goes on. So one of the refusals added since `3feadc6` (cross-half operations, 64-bit masks as data, one-wave LDS) most likely covers what hung here; I haven't narrowed it to which one. For comparison on the same new base: with #189 (`3e39e34`, wave32) instead of this PR, 117 programs don't translate and none are refused. With this PR, 168 don't translate (the debug layer makes this run's frame rate, about 1 fps, not comparable). **On the stack where the world draws on NVIDIA** (`main` `63bcca4` + #463 + #2626 + #2098 + #2464 + #2628), one 15-minute run each: | | that stack | + #2118 | + #2118 + this PR | |---|---|---|---| | end | 15 min, no removal | 15 min, no removal | 15 min, no removal | | D3D12 refusals / not translated | 168 / 7 | 171 / 7 | 0 / 171 | | world speed, last 40 readings | 0.7 fps | 1.2 fps | 1.2 fps | | picture at 10 min (same spot) | mostly white haze | fence, buildings, sky readable | the same | So on this card the clearer picture and the speed come from #2118; adding this PR changes which programs don't run (refused by D3D12 before, refused by the translator now) without changing the picture or the frame rate, and with no removal. **Merging with #2628:** both add a field to `emit::Options` and an input to `shader_cache`'s key, so they conflict in `shader_cache.rs` and `emit/mod.rs`. Keeping both (`portable_views` and `host_wave32` in `Options`, `options()` setting both, `key()` taking the view heap limit and the wave32 flag) builds, and the tests compile. Not tested: a second run of any of these; `fb99078` on the old base; which refusal covers the hang. No game data attached. I'm testing with Claude's help, and Claude drafted this comment.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 07:24 UTC · original · approved these changes

Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu --lib shader_cache:: — 3 passed, 0 failed
  • cargo test -p victory-shader --lib emit::lower::tests:: — 21 passed, 0 failed
  • cargo clippy -p victory-gpu -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean host-wave32 translation path and cache-key inclusion for wave64 programs on hosts with WaveLaneCountMax < 64. Looks good.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 07:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#pullrequestreview-6053418662) · **approved these changes** Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC): - `cargo test -p victory-gpu --lib shader_cache::` — 3 passed, 0 failed - `cargo test -p victory-shader --lib emit::lower::tests::` — 21 passed, 0 failed - `cargo clippy -p victory-gpu -p victory-shader --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean host-wave32 translation path and cache-key inclusion for wave64 programs on hosts with `WaveLaneCountMax < 64`. Looks good. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 07:30 UTC · original · approved these changes

Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked (shader half; the GPU half is Windows-only).

144 passed / 0 failed / 2 ignored. Wave64 programs translated for 32-lane host waves — wave64→wave32 translation; relates to #189/#233/#1960's wave64 cluster. Shader side green; GPU execution path needs Windows hardware validation.

**@⁠catminou4** on GitHub · 2026-11-25 07:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#pullrequestreview-6053477022) · **approved these changes** Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked` (shader half; the GPU half is Windows-only). 144 passed / 0 failed / 2 ignored. Wave64 programs translated for 32-lane host waves — wave64→wave32 translation; relates to #189/#233/#1960's wave64 cluster. Shader side green; GPU execution path needs Windows hardware validation.
Author
Owner

@⁠frenziedcoder on GitHub · 2026-11-26 07:45 UTC · original

For the test the triage asks for (a wave64 pixel program that should still translate with host_wave32: true): a fixture, run on fb99078. It puts one 64-bit wave mask read as data (v_cmp_lt_f32 vcc, 0.5, v1; s_bcnt1_i32_b64 s12, vcc) into a wave64 compute, pixel and mesh program, keeps the result live (LDS store / exp mrt0 / folded into the position), and runs each through emit_with with host_wave32 off and on. CPU-only translation, synthetic instruction words only.

wave64 program host_wave32: false host_wave32: true
compute translates refused: a 64-bit wave mask read as data on a 32-lane host (intended)
pixel translates refused: same message
mesh translates refused: same message

Once host_wave() is scoped to the programs that get WaveSize(32), the pixel and mesh rows should read "translates" in both columns. The cross-lane forms I tried first (v_readlane_b32 of lane 1 or 33, exec_hi as data) don't work for this: pixel and mesh refuse them already without host_wave32 (a cross-lane operation outside compute is not supported, a hardware SGPR input is not supported), so the mask-as-data form is the one that isolates the stage scope. The four forms are all in the file; it prints a row per case rather than asserting, so it can be turned into asserts once the scope is decided.

crates/victory-shader/src/emit/stage_scope_fixture_tests.rs (plus #[cfg(test)] mod stage_scope_fixture_tests; in emit/mod.rs)
//! LOCAL FIXTURE (not for upstream as is): one cross-lane operation
//! (readlane of lane 1 or 33, or exec_hi read as data, into v8, which is then
//! stored / exported so it is not dead code) in a wave64 compute,
//! pixel and mesh program, translated with `host_wave32` off and on. Prints
//! whether each translates, to show which stages #2176's 32-lane refusals
//! reach. Only compute programs get `WaveSize(32)` and are split.

use super::container::SigElement;
use super::{Options, container, emit_with};
use crate::dxbc::{Container, FourCC};
use crate::native::{ComputeIo, HwStage, MeshIo, NativeProgram, StageIo};
use crate::{io, ir, resource, structure};

const SET_V5: u32 = 0x7E0A_02F2; // v_mov_b32 v5, 1.0
/// The operations tried: (name, words).
const OPS: [(&str, &[u32]); 4] = [
    ("vcc popcount", &[0x7E02_02F2, 0x7C02_02F0, 0xBE8C_106A, 0x7E10_020C]), // v_mov_b32 v1, 1.0; v_cmp_lt_f32 vcc, 0.5, v1; s_bcnt1_i32_b64 s12, vcc; v_mov_b32 v8, s12
    ("readlane lane 1", &[SET_V5, 0xD760_000C, 0x0001_0305, 0x7E10_020C]), // v_readlane_b32 s12, v5, 1; v_mov_b32 v8, s12
    ("readlane lane 33", &[SET_V5, 0xD760_000C, 0x0001_4305, 0x7E10_020C]), // v_readlane_b32 s12, v5, 33; v_mov_b32 v8, s12
    ("exec_hi as data", &[0x7E10_027F]), // v_mov_b32 v8, exec_hi
];
const ENDPGM: u32 = 0xBF81_0000;

fn sig(name: &str, kind: u8) -> Vec<u8> {
    container::signature(
        &[SigElement {
            name: name.into(),
            index: 0,
            kind,
            comp: 9,
            interp: 0,
            row: Some(0),
            col: 0,
            cols: 4,
            usage: 0xF,
            half: false,
        }],
        false,
    )
}

fn outcome(native: &NativeProgram, bytes: &[u8], host_wave32: bool) -> String {
    let c = Container::parse(bytes).unwrap();
    let p = ir::build(&native.patched_code(), native.wave64, native.vgprs).unwrap();
    let st = structure::structure(&p).unwrap();
    let res = resource::track(&p, &native.layout, native.stage, Some(&st)).unwrap();
    let io = match io::raise(&p, native) {
        Ok(io) => io,
        Err(e) => return format!("(fixture input not accepted: {e})"),
    };
    let opts = Options { host_wave32, ..Default::default() };
    match emit_with(&c, native, &p, &st, &io, &res, opts) {
        Ok(_) => "translates".into(),
        Err(e) => format!("refused: {e}"),
    }
}

fn compute(op: &[u32]) -> (NativeProgram, Vec<u8>) {
    let mut w = op.to_vec();
    w.extend_from_slice(&[0xD834_0000, 0x0000_0800]); // ds_write_b32 v0, v8
    w.push(ENDPGM);
    let native = NativeProgram {
        stage: HwStage::Cs,
        wave64: true,
        vgprs: 9,
        layout: vec![],
        used: vec![],
        io: StageIo::Cs(ComputeIo { rsrc2: 1 << 15, threads: [128, 1, 1] }), // 64 LDS dwords, two waves
        code: w.iter().flat_map(|x| x.to_le_bytes()).collect(),
    };
    (native, crate::dxbc::build(&[]))
}

fn pixel(op: &[u32]) -> (NativeProgram, Vec<u8>) {
    let mut w = vec![0x7E02_02FF, 0x3F80_0000, 0x7E04_02FF, 0x3F00_0000]; // v1 = 1.0, v2 = 0.5
    w.extend_from_slice(op);
    w.extend_from_slice(&[0xF800_180F, 0x0102_0208]); // exp mrt0 v8, v2, v2, v1 done vm
    w.push(ENDPGM);
    let native = NativeProgram {
        stage: HwStage::Ps,
        wave64: true,
        vgprs: 9,
        layout: vec![],
        used: vec![],
        io: StageIo::Ps { inputs: vec![], input_addr: 0, db_shader_control: 0, patches: vec![] },
        code: w.iter().flat_map(|x| x.to_le_bytes()).collect(),
    };
    let osg1 = sig("SV_Target", 16);
    (native, crate::dxbc::build(&[(FourCC::OSG1, &osg1)]))
}

fn mesh(op: &[u32]) -> (NativeProgram, Vec<u8>) {
    // `triangle_mesh` from emit/mod.rs's tests (TRIANGLE-style prim word 0),
    // with the cross-lane operation after v_mbcnt.
    let mut w = vec![0xD765_0001u32, 0x0001_00C1];
    w.extend_from_slice(op);
    w.extend_from_slice(&[
        0x3604_0281, 0x3606_0282, 0x7E04_0D02, 0x7E06_0D03, 0x1008_04F6, 0x0608_08F3,
        0x100A_06F4, 0x060A_0AF3, 0x7E0C_02F0, 0x7E0E_02F2, 0x7E12_02FF, 0x0000_0000,
        0xF800_0941, 0x0000_0009, 0x0608_0908, 0xF800_08CF, 0x0706_0504, ENDPGM, // v_add_f32 v4, v8, v4 before exp pos0
    ]);
    let native = NativeProgram {
        stage: HwStage::Ms,
        wave64: true,
        vgprs: 10,
        layout: vec![],
        used: vec![],
        io: StageIo::Ms(MeshIo {
            outputs: vec![],
            clip_cntl: 0,
            threads: 64,
            max_vertices: 32,
            max_primitives: 32,
            topology: 2,
            lds_bytes: 0,
        }),
        code: w.iter().flat_map(|x| x.to_le_bytes()).collect(),
    };
    let osg1 = sig("SV_Position", 3);
    (native, crate::dxbc::build(&[(FourCC::OSG1, &osg1)]))
}

#[test]
fn stage_scope_of_32_lane_refusals() {
    for (op_name, op) in OPS {
        for (name, (native, bytes)) in [("compute", compute(op)), ("pixel", pixel(op)), ("mesh", mesh(op))] {
            for host_wave32 in [false, true] {
                println!("FIXTURE {op_name:16} {name:8} wave64 host_wave32={host_wave32:5}: {}", outcome(&native, &bytes, host_wave32));
            }
        }
    }
}

AI use: Claude Code (Claude Opus 5.5) wrote the fixture, ran it on my machine (RTX 5080 box; this check needs no GPU) and wrote this comment.

**@⁠frenziedcoder** on GitHub · 2026-11-26 07:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7185794650) **For the test the triage asks for (a wave64 pixel program that should still translate with `host_wave32: true`): a fixture, run on `fb99078`.** It puts one 64-bit wave mask read as data (`v_cmp_lt_f32 vcc, 0.5, v1; s_bcnt1_i32_b64 s12, vcc`) into a wave64 compute, pixel and mesh program, keeps the result live (LDS store / `exp mrt0` / folded into the position), and runs each through `emit_with` with `host_wave32` off and on. CPU-only translation, synthetic instruction words only. | wave64 program | `host_wave32: false` | `host_wave32: true` | |---|---|---| | compute | translates | refused: `a 64-bit wave mask read as data on a 32-lane host` (intended) | | pixel | translates | **refused**: same message | | mesh | translates | **refused**: same message | Once `host_wave()` is scoped to the programs that get `WaveSize(32)`, the pixel and mesh rows should read "translates" in both columns. The cross-lane forms I tried first (`v_readlane_b32` of lane 1 or 33, `exec_hi` as data) don't work for this: pixel and mesh refuse them already without `host_wave32` (`a cross-lane operation outside compute is not supported`, `a hardware SGPR input is not supported`), so the mask-as-data form is the one that isolates the stage scope. The four forms are all in the file; it prints a row per case rather than asserting, so it can be turned into asserts once the scope is decided. <details><summary><code>crates/victory-shader/src/emit/stage_scope_fixture_tests.rs</code> (plus <code>#[cfg(test)] mod stage_scope_fixture_tests;</code> in <code>emit/mod.rs</code>)</summary> ```rust //! LOCAL FIXTURE (not for upstream as is): one cross-lane operation //! (readlane of lane 1 or 33, or exec_hi read as data, into v8, which is then //! stored / exported so it is not dead code) in a wave64 compute, //! pixel and mesh program, translated with `host_wave32` off and on. Prints //! whether each translates, to show which stages #2176's 32-lane refusals //! reach. Only compute programs get `WaveSize(32)` and are split. use super::container::SigElement; use super::{Options, container, emit_with}; use crate::dxbc::{Container, FourCC}; use crate::native::{ComputeIo, HwStage, MeshIo, NativeProgram, StageIo}; use crate::{io, ir, resource, structure}; const SET_V5: u32 = 0x7E0A_02F2; // v_mov_b32 v5, 1.0 /// The operations tried: (name, words). const OPS: [(&str, &[u32]); 4] = [ ("vcc popcount", &[0x7E02_02F2, 0x7C02_02F0, 0xBE8C_106A, 0x7E10_020C]), // v_mov_b32 v1, 1.0; v_cmp_lt_f32 vcc, 0.5, v1; s_bcnt1_i32_b64 s12, vcc; v_mov_b32 v8, s12 ("readlane lane 1", &[SET_V5, 0xD760_000C, 0x0001_0305, 0x7E10_020C]), // v_readlane_b32 s12, v5, 1; v_mov_b32 v8, s12 ("readlane lane 33", &[SET_V5, 0xD760_000C, 0x0001_4305, 0x7E10_020C]), // v_readlane_b32 s12, v5, 33; v_mov_b32 v8, s12 ("exec_hi as data", &[0x7E10_027F]), // v_mov_b32 v8, exec_hi ]; const ENDPGM: u32 = 0xBF81_0000; fn sig(name: &str, kind: u8) -> Vec<u8> { container::signature( &[SigElement { name: name.into(), index: 0, kind, comp: 9, interp: 0, row: Some(0), col: 0, cols: 4, usage: 0xF, half: false, }], false, ) } fn outcome(native: &NativeProgram, bytes: &[u8], host_wave32: bool) -> String { let c = Container::parse(bytes).unwrap(); let p = ir::build(&native.patched_code(), native.wave64, native.vgprs).unwrap(); let st = structure::structure(&p).unwrap(); let res = resource::track(&p, &native.layout, native.stage, Some(&st)).unwrap(); let io = match io::raise(&p, native) { Ok(io) => io, Err(e) => return format!("(fixture input not accepted: {e})"), }; let opts = Options { host_wave32, ..Default::default() }; match emit_with(&c, native, &p, &st, &io, &res, opts) { Ok(_) => "translates".into(), Err(e) => format!("refused: {e}"), } } fn compute(op: &[u32]) -> (NativeProgram, Vec<u8>) { let mut w = op.to_vec(); w.extend_from_slice(&[0xD834_0000, 0x0000_0800]); // ds_write_b32 v0, v8 w.push(ENDPGM); let native = NativeProgram { stage: HwStage::Cs, wave64: true, vgprs: 9, layout: vec![], used: vec![], io: StageIo::Cs(ComputeIo { rsrc2: 1 << 15, threads: [128, 1, 1] }), // 64 LDS dwords, two waves code: w.iter().flat_map(|x| x.to_le_bytes()).collect(), }; (native, crate::dxbc::build(&[])) } fn pixel(op: &[u32]) -> (NativeProgram, Vec<u8>) { let mut w = vec![0x7E02_02FF, 0x3F80_0000, 0x7E04_02FF, 0x3F00_0000]; // v1 = 1.0, v2 = 0.5 w.extend_from_slice(op); w.extend_from_slice(&[0xF800_180F, 0x0102_0208]); // exp mrt0 v8, v2, v2, v1 done vm w.push(ENDPGM); let native = NativeProgram { stage: HwStage::Ps, wave64: true, vgprs: 9, layout: vec![], used: vec![], io: StageIo::Ps { inputs: vec![], input_addr: 0, db_shader_control: 0, patches: vec![] }, code: w.iter().flat_map(|x| x.to_le_bytes()).collect(), }; let osg1 = sig("SV_Target", 16); (native, crate::dxbc::build(&[(FourCC::OSG1, &osg1)])) } fn mesh(op: &[u32]) -> (NativeProgram, Vec<u8>) { // `triangle_mesh` from emit/mod.rs's tests (TRIANGLE-style prim word 0), // with the cross-lane operation after v_mbcnt. let mut w = vec![0xD765_0001u32, 0x0001_00C1]; w.extend_from_slice(op); w.extend_from_slice(&[ 0x3604_0281, 0x3606_0282, 0x7E04_0D02, 0x7E06_0D03, 0x1008_04F6, 0x0608_08F3, 0x100A_06F4, 0x060A_0AF3, 0x7E0C_02F0, 0x7E0E_02F2, 0x7E12_02FF, 0x0000_0000, 0xF800_0941, 0x0000_0009, 0x0608_0908, 0xF800_08CF, 0x0706_0504, ENDPGM, // v_add_f32 v4, v8, v4 before exp pos0 ]); let native = NativeProgram { stage: HwStage::Ms, wave64: true, vgprs: 10, layout: vec![], used: vec![], io: StageIo::Ms(MeshIo { outputs: vec![], clip_cntl: 0, threads: 64, max_vertices: 32, max_primitives: 32, topology: 2, lds_bytes: 0, }), code: w.iter().flat_map(|x| x.to_le_bytes()).collect(), }; let osg1 = sig("SV_Position", 3); (native, crate::dxbc::build(&[(FourCC::OSG1, &osg1)])) } #[test] fn stage_scope_of_32_lane_refusals() { for (op_name, op) in OPS { for (name, (native, bytes)) in [("compute", compute(op)), ("pixel", pixel(op)), ("mesh", mesh(op))] { for host_wave32 in [false, true] { println!("FIXTURE {op_name:16} {name:8} wave64 host_wave32={host_wave32:5}: {}", outcome(&native, &bytes, host_wave32)); } } } } ``` </details> *AI use: Claude Code (Claude Opus 5.5) wrote the fixture, ran it on my machine (RTX 5080 box; this check needs no GPU) and wrote this comment.*
Author
Owner

@⁠Creaa on GitHub · 2026-11-26 08:38 UTC · original

@⁠n-romanovich a small follow-up on this PR's 32-lane path, as #3115 (stacked on fb99078, one commit): DPP rows/DPP8, ds_swizzle_b32 (group-of-32 mode) and ds_bpermute_b32 only read lanes of their own half, so cross_lane no longer refuses them as cross-half (DPP rows only when the row mask is the same for both halves). On an RTX 4070 a GPU test checks all 64 lanes of a wave64 program against RDNA2; offline the refusal falls from 69 to 51 programs of the title's pack. Happy for you to fold it into this PR instead if you prefer.

AI use: Claude Code (Claude Opus 5.5) wrote the change and this note.

**@⁠Creaa** on GitHub · 2026-11-26 08:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2176#issuecomment-7186841725) @⁠n-romanovich a small follow-up on this PR's 32-lane path, as #3115 (stacked on `fb99078`, one commit): DPP rows/DPP8, `ds_swizzle_b32` (group-of-32 mode) and `ds_bpermute_b32` only read lanes of their own half, so `cross_lane` no longer refuses them as cross-half (DPP rows only when the row mask is the same for both halves). On an RTX 4070 a GPU test checks all 64 lanes of a wave64 program against RDNA2; offline the refusal falls from 69 to 51 programs of the title's pack. Happy for you to fold it into this PR instead if you prefer. AI use: Claude Code (Claude Opus 5.5) wrote the change and this note.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/2176/head:github-bot/gh-2176'
git switch 'github-bot/gh-2176'

Merge

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