Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189

Open
github-bot wants to merge 19 commits from github-bot/gh-189 into main AGit
Owner

@⁠alfycs on GitHub · 2026-11-24 01:16 UTC · original
alfycs:feat/wave64-compute-emulation → main · +5067 −609 · 19 files · 19 commits · open

Problem

Wave64 compute shaders that rely on lane layout (console_lanes or single-wave LDS) currently emit WaveSize(64) (PSV0 min/max = 64). On 32-lane GPUs (NVIDIA/Intel) and narrower hosts such as WARP (WaveLaneCountMin = 4), D3D12 rejects these PSOs in CreateComputePipelineState with E_INVALIDARG (0x80070057).

Related to #71, #85, #97, #3.

Summary of Changes

  • Translation modes (victory-shader::emit):
    • Added Wave64Mode (Native, Wave32, Emulate), TranslateOptions, translate_with, and emit_with. Default translate/emit keep Wave64Mode::Native.
    • Added Host::supports_wave32 and Host::recommended_wave64_mode in emit::host, and checked DXGI_ADAPTER_FLAG_SOFTWARE in Host::new(true) for WARP environments.
  • Constant-lane SGPR spill resolution (victory-shader::resource):
    • Extracted index_values and added spilled_sgprs so constant-lane v_readlane_b32 reads from v_writelane_b32 (including spills to lanes >= 32 in <= 32-thread groups) resolve directly to their scalar values or constants.
  • Wave64 lowering (victory-shader::emit::lower):
    • Wave64Mode::Wave32:
      • <= 32 threads: runs inside one native 32-lane wave with zero scratch LDS or cross-half barriers, resolving SGPR spills, zeroing the high ballot dword, and supporting <= 32-thread LDS accesses directly.
      • > 32 threads: emits WaveSize(32) when wave emulation is needed and maps each virtual 64-lane wave onto two aligned 32-lane host waves ((waveReadLaneFirst(flattenedThreadIdInGroup) & !31) + waveGetLaneIndex()). ds_swizzle_b32, DPP (with out-of-range lane indices clamped via inside and row_mask indexed by 64-lane console_lane), v_mbcnt_*, v_writelane_b32, and lane_bit execute without cross-half barriers; 64-lane ballots, Shape::Active/Shape::Prefix, uniform-block non-uniform v_readfirstlane_b32 (with empty-EXEC fallback to lane 0), and unresolved v_readlane_b32 exchange through disjoint scratch LDS slots (handling partial virtual waves and enforcing the 32 KiB / 8192-dword TGSM limit).
    • Wave64Mode::Emulate:
      • Emits wave_size = None without setting flags::WAVE_OPS, using flattenedThreadIdInGroup + TGSM + barrier(1 | 8) for ballots (atomicOr), tree reductions (Shape::Active), Hillis-Steele scans (Shape::Prefix), v_readlane_b32, v_readfirstlane_b32 (atomicMin, with lane 0 fallback when empty), ds_swizzle_b32, and DPP.
    • Deadlock / divergence & LDS fence safety:
      • Post-dominator (compute_postdoms) + group-uniformity analysis (compute_uniformity, preserving val_uniform across unguarded v_mov_b32) ensures barriers are never emitted inside divergent control flow or inside begin_guarded blocks; unsafe divergent cross-half operations fail cleanly with ShaderError::Unsupported.
      • Cross-block ballots are pre-emitted in defining uniform blocks (preemit_masks), and per-instruction ballots/guards are materialized before operand evaluation (materialize_masks).
      • For 32 < threads <= 64 (Wave32) or 1 < threads <= 64 (Emulate) accessing LDS (has_lds_mem), plan_lds_fences inserts group-uniform barrier(1 | 8) checkpoints at uniform joins/exits (lds_fences.enter / lds_fences.leave), permits multiple divergent pure LDS reads, and refuses unfenceable divergent LDS write/read or write/write conflicts cleanly (LDS accesses without a uniform LDS fence in split wave64).
  • Host integration & cache (victory-gpu, apps/victory):
    • victory-gpu::Host queries D3D12 wave capabilities on open (recommended_wave64_mode) and updates shader_cache: native 64-lane hosts use Wave64Mode::Native, while < 64-lane hosts (including 32-lane NVIDIA/Intel GPUs and WARP) default to Wave64Mode::Emulate (which still leaves non-lane-dependent shaders native without scratch LDS, while avoiding Wave32 divergent/cross-half miscompilations). VICTORY_WAVE64_EMULATE=auto|wave32|1|0 remains available as an override (with the mode byte included in cache keys).
    • victory translate --pipelines passes the host's recommended Wave64Mode via emit_with.
  • Tests (crates/victory-shader/src/emit/wave64_tests.rs):
    • Added synthetic RDNA2 translation, validator, and live D3D12/WARP GPU readback tests (running under Wave32 and Emulate, plus host capability and Native PSO rejection checks).

Trade-offs & Known Limitations

  • Translator refusal count delta vs Wave64Mode::Native: Because Native emits WaveSize(64) DXIL that passes translation even when a Wave32 host rejects it in CreateComputePipelineState (E_INVALIDARG), enabling Wave32/Emulate replaces unsafe split-wave barriers/hazards with explicit ShaderError::Unsupported refusals. On the 26,084-program corpus tested by @bittertea0323, host CreateComputePipelineState compute rejections dropped from 97 to 0, while offline translation reported +26 refusals (14× "LDS accesses without a uniform LDS fence in split wave64" and 12× "a cross-lane wave operation in divergent control flow"). Translator refusal totals before and after this PR are therefore not directly comparable without accounting for PSO rejections.
  • v_readfirstlane_b32 in divergent control flow (Wave32): Because separate 32-lane hardware warps cannot enter a group barrier inside divergent control flow without risking a GPU deadlock, emulated_readfirstlane in Wave32 returns each half's own first active lane when divergent (Emulate refuses). This is exact when the value is uniform across active lanes or in half-local waterfall iteration, but if both halves are active in divergent control flow with differing first active lane values, the upper half (32..63) observes its own first active lane rather than the lower half's (0..31) as on Wave64.

Verification

On Windows (feat/wave64-compute-emulation @ 54b333f):

  • cargo xtask policy: 155 files ok
  • cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated: 0 errors, 0 warnings
  • cargo test -p victory-shader --locked -- wave64 --test-threads=1: 26 passed, 0 failed (including live GPU execution tests)
  • cargo test -p victory-gpu --locked -- --test-threads=1: 50 passed, 0 failed, 1 ignored
  • VICTORY_WARP=1 cargo test -p victory-shader --locked -- wave64 --test-threads=1: 26 passed, 0 failed
**@⁠alfycs** on GitHub · 2026-11-24 01:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/189) `alfycs:feat/wave64-compute-emulation` → `main` · +5067 −609 · 19 files · 19 commits · open ### Problem Wave64 compute shaders that rely on lane layout (`console_lanes` or single-wave LDS) currently emit `WaveSize(64)` (`PSV0` min/max = 64). On 32-lane GPUs (NVIDIA/Intel) and narrower hosts such as WARP (`WaveLaneCountMin = 4`), D3D12 rejects these PSOs in `CreateComputePipelineState` with `E_INVALIDARG` (`0x80070057`). Related to #71, #85, #97, #3. ### Summary of Changes - **Translation modes (`victory-shader::emit`)**: - Added `Wave64Mode` (`Native`, `Wave32`, `Emulate`), `TranslateOptions`, `translate_with`, and `emit_with`. Default `translate`/`emit` keep `Wave64Mode::Native`. - Added `Host::supports_wave32` and `Host::recommended_wave64_mode` in `emit::host`, and checked `DXGI_ADAPTER_FLAG_SOFTWARE` in `Host::new(true)` for WARP environments. - **Constant-lane SGPR spill resolution (`victory-shader::resource`)**: - Extracted `index_values` and added `spilled_sgprs` so constant-lane `v_readlane_b32` reads from `v_writelane_b32` (including spills to lanes `>= 32` in `<= 32`-thread groups) resolve directly to their scalar values or constants. - **Wave64 lowering (`victory-shader::emit::lower`)**: - **`Wave64Mode::Wave32`**: - `<= 32` threads: runs inside one native 32-lane wave with zero scratch LDS or cross-half barriers, resolving SGPR spills, zeroing the high ballot dword, and supporting `<= 32`-thread LDS accesses directly. - `> 32` threads: emits `WaveSize(32)` when wave emulation is needed and maps each virtual 64-lane wave onto two aligned 32-lane host waves (`(waveReadLaneFirst(flattenedThreadIdInGroup) & !31) + waveGetLaneIndex()`). `ds_swizzle_b32`, `DPP` (with out-of-range lane indices clamped via `inside` and `row_mask` indexed by 64-lane `console_lane`), `v_mbcnt_*`, `v_writelane_b32`, and `lane_bit` execute without cross-half barriers; 64-lane ballots, `Shape::Active`/`Shape::Prefix`, uniform-block non-uniform `v_readfirstlane_b32` (with empty-`EXEC` fallback to lane `0`), and unresolved `v_readlane_b32` exchange through disjoint scratch LDS slots (handling partial virtual waves and enforcing the 32 KiB / 8192-dword TGSM limit). - **`Wave64Mode::Emulate`**: - Emits `wave_size = None` without setting `flags::WAVE_OPS`, using `flattenedThreadIdInGroup` + TGSM + `barrier(1 | 8)` for ballots (`atomicOr`), tree reductions (`Shape::Active`), Hillis-Steele scans (`Shape::Prefix`), `v_readlane_b32`, `v_readfirstlane_b32` (`atomicMin`, with lane `0` fallback when empty), `ds_swizzle_b32`, and `DPP`. - **Deadlock / divergence & LDS fence safety**: - Post-dominator (`compute_postdoms`) + group-uniformity analysis (`compute_uniformity`, preserving `val_uniform` across unguarded `v_mov_b32`) ensures barriers are never emitted inside divergent control flow or inside `begin_guarded` blocks; unsafe divergent cross-half operations fail cleanly with `ShaderError::Unsupported`. - Cross-block ballots are pre-emitted in defining uniform blocks (`preemit_masks`), and per-instruction ballots/guards are materialized before operand evaluation (`materialize_masks`). - For `32 < threads <= 64` (`Wave32`) or `1 < threads <= 64` (`Emulate`) accessing LDS (`has_lds_mem`), `plan_lds_fences` inserts group-uniform `barrier(1 | 8)` checkpoints at uniform joins/exits (`lds_fences.enter` / `lds_fences.leave`), permits multiple divergent pure LDS reads, and refuses unfenceable divergent LDS write/read or write/write conflicts cleanly (`LDS accesses without a uniform LDS fence in split wave64`). - **Host integration & cache (`victory-gpu`, `apps/victory`)**: - `victory-gpu::Host` queries D3D12 wave capabilities on open (`recommended_wave64_mode`) and updates `shader_cache`: native 64-lane hosts use `Wave64Mode::Native`, while `< 64`-lane hosts (including 32-lane NVIDIA/Intel GPUs and WARP) default to `Wave64Mode::Emulate` (which still leaves non-lane-dependent shaders native without scratch LDS, while avoiding `Wave32` divergent/cross-half miscompilations). `VICTORY_WAVE64_EMULATE=auto|wave32|1|0` remains available as an override (with the mode byte included in cache keys). - `victory translate --pipelines` passes the host's recommended `Wave64Mode` via `emit_with`. - **Tests (`crates/victory-shader/src/emit/wave64_tests.rs`)**: - Added synthetic RDNA2 translation, validator, and live D3D12/WARP GPU readback tests (running under `Wave32` and `Emulate`, plus host capability and `Native` PSO rejection checks). ### Trade-offs & Known Limitations - **Translator refusal count delta vs `Wave64Mode::Native`:** Because `Native` emits `WaveSize(64)` DXIL that passes translation even when a Wave32 host rejects it in `CreateComputePipelineState` (`E_INVALIDARG`), enabling `Wave32`/`Emulate` replaces unsafe split-wave barriers/hazards with explicit `ShaderError::Unsupported` refusals. On the 26,084-program corpus tested by `@bittertea0323`, host `CreateComputePipelineState` compute rejections dropped from `97` to `0`, while offline translation reported `+26` refusals (`14`× `"LDS accesses without a uniform LDS fence in split wave64"` and `12`× `"a cross-lane wave operation in divergent control flow"`). Translator refusal totals before and after this PR are therefore not directly comparable without accounting for PSO rejections. - **`v_readfirstlane_b32` in divergent control flow (`Wave32`):** Because separate 32-lane hardware warps cannot enter a group barrier inside divergent control flow without risking a GPU deadlock, `emulated_readfirstlane` in `Wave32` returns each half's own first active lane when `divergent` (`Emulate` refuses). This is exact when the value is uniform across active lanes or in half-local waterfall iteration, but if both halves are active in divergent control flow with differing first active lane values, the upper half (`32..63`) observes its own first active lane rather than the lower half's (`0..31`) as on Wave64. ### Verification On Windows (`feat/wave64-compute-emulation` @ `54b333f`): - `cargo xtask policy`: `155 files ok` - `cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated`: 0 errors, 0 warnings - `cargo test -p victory-shader --locked -- wave64 --test-threads=1`: 26 passed, 0 failed (including live GPU execution tests) - `cargo test -p victory-gpu --locked -- --test-threads=1`: 50 passed, 0 failed, 1 ignored - `VICTORY_WARP=1 cargo test -p victory-shader --locked -- wave64 --test-threads=1`: 26 passed, 0 failed
Add Wave64Mode (Native, Wave32, Emulate) and TranslateOptions so Wave64 compute shaders lower and run on 32-lane GPUs (NVIDIA/Intel) and narrower hosts such as WARP instead of failing CreateComputePipelineState with E_INVALIDARG on WaveSize(64).

- Add Wave64Mode, TranslateOptions, translate_with, and emit_with while keeping translate/emit defaulting to Wave64Mode::Native.
- Resolve constant-lane SGPR spills across v_writelane_b32/v_readlane_b32 via resource::spilled_sgprs.
- Implement virtual 64-lane mapping for Wave32 (two aligned 32-lane waves) and portable LDS emulation without WAVE_OPS for narrower hosts, with post-dominator uniformity checks to reject cross-half barriers in divergent control flow rather than hanging.
- Auto-detect host wave capabilities in victory-gpu::Host (with VICTORY_WAVE64_EMULATE override and mode byte in shader_cache keys) and in victory translate --pipelines.
- Add synthetic RDNA2 compute tests (PSO validation + execution on hardware GPU and WARP).
Incorporate verified follow-up fixes from PR #189 reviewers and contributors:

- Fence single-console-wave LDS accesses at group-uniform joins/exits and reject unfenceable divergent regions (fixes marquezinii's split-block stale LDS readback; from alfycs/VIctory#1 by @erickbobd).
- Allow Wave32 divergent v_readfirstlane per half without LDS barriers (fixes waterfall loops / common divergent refusals reported by @AKA0GHOST and @NuraadGit), preserve ValUniform propagation across unguarded v_mov_b32 copies for uniform v_readfirstlane in divergent branches (@marquezinii), and return lane 0 when EXEC == 0 in emulated_readfirstlane.
- Clamp DPP row_shr/row_shl lane indices using inside before read_lane/exchange_64 to avoid out-of-range waveReadLaneAt on WARP 1.0.22 (@ifBars).
- Verify DXGI_ADAPTER_FLAG_SOFTWARE in shader::emit::host::Host::new(true) for Wine/DXVK (@dpalacios69, @tanishq-dubey), base recommended_wave64_mode_matches_device_capabilities on queried capabilities (@ifBars), and serialize wave64 GPU tests under valu_tests::ONE_AT_A_TIME (@r4tedx).

Co-authored-by: erickbobd <[email protected]>
Avoid false positives in plan_lds_fences on Wave32:

- Skip need_lds_barriers in Wave32 when total_threads <= 32 (single native host wave).
- Track reads vs writes/atomics separately in plan_lds_fences so multiple pure ds_read* instructions inside a divergent region or loop are allowed while RAW/WAW/WAR hazards remain rejected.
Log every rejected adapter and WARP in Host::all_adapters(), and print SKIPPED <test>: no SM 6.6 adapter instead of panicking on an empty host list. This makes Turing/SM 6.5 machines diagnosable instead of producing identical failures.
The two 64-lane emulations refuse different programs: Wave32 those with a
cross-lane operation in divergent control flow, Emulate those with a
non-uniform v_readfirstlane there. A program the asked-for lowering refuses
now tries the other one, then the native lowering; the refusal reported is
the asked-for one's. On an RTX 4050 Laptop (32 lanes) this takes the shader
pack's pipelines the host refuses from 395 (native) to 257, with the same
307 container refusals as native.

AI-assisted (Claude Code).

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

@⁠ifBars on GitHub · 2026-11-24 01:24 UTC · original

Tested d0fd9bf on Windows 10, RTX 3060 Ti, driver 610.88, with Agility SDK 620 exports added to the probe executable for this OS. I used four locally held compute shaders from first-story loading, including three large-group programs previously rejected by CreateComputePipelineState. On the build with #54 only the small-group program created a pipeline.

With this change, three of the four passed the Windows SDK DXIL validator and created native D3D12 compute pipelines. Two previously refused large-group shaders now work at pipeline creation. The remaining program (02384a60fda6f2d0) returned the translator diagnostic v_readfirstlane in divergent control flow at 0x1d0. This probe measured pipeline creation only.

**@⁠ifBars** on GitHub · 2026-11-24 01:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7119069414) Tested d0fd9bf on Windows 10, RTX 3060 Ti, driver 610.88, with Agility SDK 620 exports added to the probe executable for this OS. I used four locally held compute shaders from first-story loading, including three large-group programs previously rejected by CreateComputePipelineState. On the build with #54 only the small-group program created a pipeline. With this change, three of the four passed the Windows SDK DXIL validator and created native D3D12 compute pipelines. Two previously refused large-group shaders now work at pipeline creation. The remaining program (02384a60fda6f2d0) returned the translator diagnostic `v_readfirstlane in divergent control flow` at 0x1d0. This probe measured pipeline creation only.
Author
Owner

@⁠AKA0GHOST on GitHub · 2026-11-24 01:29 UTC · original

Tested on an RTX 5070 (Blackwell, 12 GB, driver 621.14, 32-lane waves only), Windows 11, diag build of d0fd9bf (main d2a4bae + this PR), own 1.0.2.1 copy.

Synthetic tests: all 14 wave64_tests pass on the hardware. I also added two lane-order probes: one console wave in 64×1×1, 8×8×1 and 4×4×4 groups, and four console waves in 256×1×1, 16×16×1 and 8×8×4 groups. The ballot count across halves and v_readlane of lane 50 come out right in both Wave32 and Emulate modes. So the (waveReadLaneFirst(flat) & !31) + lane mapping holds on Blackwell, 3-D groups included.

World run (VICTORY_D3D12_DRED=1), compared with an earlier run of main + #20 + #55 (a slightly older main, plus a local render-target view guard):

before this PR
compute pipelines refused (E_INVALIDARG) 88 0
compute shaders that do not translate 121 239
ended DEVICE_HUNG, frame 2967, 7.2 s submission DEVICE_HUNG, frame 2846, 7.7 s submission

Matching by hash: of the 88 refused before, 35 now build and 53 no longer translate. 107 shaders that translated and built before now fail with v_readfirstlane in divergent control flow (about 50) or a cross-lane wave operation in divergent control flow (about 38). That makes more dropped dispatches than before.

Likely cause: in Wave32 mode, need_emu = console_lanes || !sections.is_empty() || has_non_uniform_firstlane. On main, wave64 programs whose only lane use is a whole-wave section or a v_readfirstlane of a non-uniform value get no WaveSize and run on host waves. A waterfall loop's readfirstlane is likely still correct per 32-lane wave. This PR pulls those programs into the split form, and where the ops sit in divergent flow the check refuses the whole shader. Suggestion: refuse in divergent flow only when console_lanes is set. For programs split only because of sections or a non-uniform firstlane, fall back to the host-wave lowering (or retry without the split) instead of failing.

The world hang itself is unchanged with or without this PR.

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

**@⁠AKA0GHOST** on GitHub · 2026-11-24 01:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7119155882) Tested on an RTX 5070 (Blackwell, 12 GB, driver 621.14, 32-lane waves only), Windows 11, diag build of d0fd9bf (main d2a4bae + this PR), own 1.0.2.1 copy. **Synthetic tests:** all 14 `wave64_tests` pass on the hardware. I also added two lane-order probes: one console wave in 64×1×1, 8×8×1 and 4×4×4 groups, and four console waves in 256×1×1, 16×16×1 and 8×8×4 groups. The ballot count across halves and `v_readlane` of lane 50 come out right in both Wave32 and Emulate modes. So the `(waveReadLaneFirst(flat) & !31) + lane` mapping holds on Blackwell, 3-D groups included. **World run** (`VICTORY_D3D12_DRED=1`), compared with an earlier run of main + #20 + #55 (a slightly older main, plus a local render-target view guard): | | before | this PR | |---|---|---| | compute pipelines refused (`E_INVALIDARG`) | 88 | 0 | | compute shaders that do not translate | 121 | 239 | | ended | DEVICE_HUNG, frame 2967, 7.2 s submission | DEVICE_HUNG, frame 2846, 7.7 s submission | Matching by hash: of the 88 refused before, 35 now build and 53 no longer translate. 107 shaders that translated and built before now fail with `v_readfirstlane in divergent control flow` (about 50) or `a cross-lane wave operation in divergent control flow` (about 38). That makes more dropped dispatches than before. **Likely cause:** in `Wave32` mode, `need_emu = console_lanes || !sections.is_empty() || has_non_uniform_firstlane`. On main, wave64 programs whose only lane use is a whole-wave section or a `v_readfirstlane` of a non-uniform value get no `WaveSize` and run on host waves. A waterfall loop's `readfirstlane` is likely still correct per 32-lane wave. This PR pulls those programs into the split form, and where the ops sit in divergent flow the check refuses the whole shader. Suggestion: refuse in divergent flow only when `console_lanes` is set. For programs split only because of sections or a non-uniform firstlane, fall back to the host-wave lowering (or retry without the split) instead of failing. The world hang itself is unchanged with or without this PR. AI-assisted (Claude Code); no game files attached.
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 01:30 UTC · original

Tested d0fd9bf on Arch Linux x86_64, rustc 1.98.1: pass.

  • cargo test -p victory-shader: 61 passed, 0 failed (2 test binaries), including the {adds} test{'s' if adds != 1 else ''} this PR adds.
  • Scope note: #192 also rewrites Wave64 emulation (LDS lockstep/DPP at WaveSize(32)); confirm whether it builds on this or conflicts with it.
  • The full workspace still needs #112 for the victory-gpu E0425.

No game data used.

**@⁠DaviTostes** on GitHub · 2026-11-24 01:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7119174152) Tested `d0fd9bf` on **Arch Linux x86_64, rustc 1.98.1**: **pass**. - `cargo test -p victory-shader`: **61 passed, 0 failed** (2 test binaries), including the {adds} test{'s' if adds != 1 else ''} this PR adds. - Scope note: **#192** also rewrites Wave64 emulation (LDS lockstep/DPP at WaveSize(32)); confirm whether it builds on this or conflicts with it. - The full workspace still needs #112 for the `victory-gpu` E0425. No game data used.
Author
Owner

@⁠dpalacios69 on GitHub · 2026-11-24 01:41 UTC · original

Validated PR #189 (d0fd9bf, clean mergeable against main d2a4bae) on a 32-lane NVIDIA Turing GPU under Linux + Wine + vkd3d-proton (AI-assisted).

Environment

  • GPU / Driver: NVIDIA GeForce GTX 1660 SUPER (Turing, 32-lane waves) / NVIDIA 620.70.06
  • Runtime: wine-11.21 (Staging) + vkd3d-proton 3.1.0 (4522cc1a8b1347f) + DXVK DXGI 2.7.1
  • Target: x86_64-pc-windows-msvc (--release)

Results

  • cargo test --release -p victory-shader --target x86_64-pc-windows-msvc: 82 passed, 2 failed, 0 ignored
    • All 14/14 emit::wave64_tests::* tests PASS on real 32-lane hardware, including all 9 emit::wave64_tests::gpu::* GPU execution tests (gpu_128_threads_cross_block_ballot_and_constant_mask, gpu_128_threads_ds_swizzle_and_dpp_row_mask, gpu_128_threads_readlane_writelane_spills_and_firstlane, gpu_64_threads_lockstep_lds_without_s_barrier, gpu_32_threads_wave32_fast_path_with_high_lane_spills, gpu_96_threads_partial_virtual_wave, gpu_128_threads_whole_wave_active_and_prefix, gpu_128_threads_uniform_loop_cross_half_ballot, gpu_64_threads_mbcnt_ballot_and_high_ff1).
    • Failures (2):
      1. emit::tests::stub_pipeline_is_created — baseline vkd3d-proton behavior (zero digest accepted).
      2. emit::host::tests::recommended_wave64_mode_matches_device_capabilities — panicked at crates/victory-shader/src/emit/host.rs:1465 (left: Wave32, right: Emulate). Under Wine + DXVK, EnumWarpAdapter is not supported and falls back to returning the first hardware adapter (DxgiFactory::EnumWarpAdapter: WARP not supported, returning first hardware adapter), so Host::new(true) opens the hardware GTX 1660 SUPER (Wave32) instead of a software WARP adapter. Checking DXGI_ADAPTER_FLAG_SOFTWARE in Host::new(true) (as victory-gpu/src/host.rs does) would avoid this false failure on Wine/DXVK.
  • cargo test --release -p victory-gpu --target x86_64-pc-windows-msvc: 40 passed, 3 failed, 1 ignored (matches main d2a4bae baseline: indirect::tests::argument_clamp_builds, pipeline::library::tests::a_rejected_blob_gives_an_empty_library, resource::tests::buffer_data_reaches_the_host_texture)
  • cargo xtask policy: PASS (asset policy: 152 files ok)

Summary

All 14 Wave64 translation and GPU execution tests pass on NVIDIA GTX 1660 SUPER (Wave32) under Wine 11.21 + vkd3d-proton 3.1.0. One minor test-harness issue: recommended_wave64_mode_matches_device_capabilities assumes EnumWarpAdapter only returns a software adapter, which fails under Wine/DXVK's hardware fallback.

No game data used.

**@⁠dpalacios69** on GitHub · 2026-11-24 01:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7119353540) Validated PR #189 (`d0fd9bf`, clean mergeable against `main` `d2a4bae`) on a 32-lane NVIDIA Turing GPU under Linux + Wine + vkd3d-proton (AI-assisted). ### Environment - **GPU / Driver:** NVIDIA GeForce GTX 1660 SUPER (Turing, 32-lane waves) / NVIDIA 620.70.06 - **Runtime:** `wine-11.21 (Staging)` + `vkd3d-proton 3.1.0` (`4522cc1a8b1347f`) + DXVK DXGI `2.7.1` - **Target:** `x86_64-pc-windows-msvc` (`--release`) ### Results - **`cargo test --release -p victory-shader --target x86_64-pc-windows-msvc`**: **82 passed, 2 failed, 0 ignored** - All **14/14** `emit::wave64_tests::*` tests **PASS** on real 32-lane hardware, including all 9 `emit::wave64_tests::gpu::*` GPU execution tests (`gpu_128_threads_cross_block_ballot_and_constant_mask`, `gpu_128_threads_ds_swizzle_and_dpp_row_mask`, `gpu_128_threads_readlane_writelane_spills_and_firstlane`, `gpu_64_threads_lockstep_lds_without_s_barrier`, `gpu_32_threads_wave32_fast_path_with_high_lane_spills`, `gpu_96_threads_partial_virtual_wave`, `gpu_128_threads_whole_wave_active_and_prefix`, `gpu_128_threads_uniform_loop_cross_half_ballot`, `gpu_64_threads_mbcnt_ballot_and_high_ff1`). - Failures (2): 1. `emit::tests::stub_pipeline_is_created` — baseline vkd3d-proton behavior (zero digest accepted). 2. `emit::host::tests::recommended_wave64_mode_matches_device_capabilities` — panicked at `crates/victory-shader/src/emit/host.rs:1465` (`left: Wave32`, `right: Emulate`). Under Wine + DXVK, `EnumWarpAdapter` is not supported and falls back to returning the first hardware adapter (`DxgiFactory::EnumWarpAdapter: WARP not supported, returning first hardware adapter`), so `Host::new(true)` opens the hardware GTX 1660 SUPER (`Wave32`) instead of a software WARP adapter. Checking `DXGI_ADAPTER_FLAG_SOFTWARE` in `Host::new(true)` (as `victory-gpu/src/host.rs` does) would avoid this false failure on Wine/DXVK. - **`cargo test --release -p victory-gpu --target x86_64-pc-windows-msvc`**: **40 passed, 3 failed, 1 ignored** (matches `main` `d2a4bae` baseline: `indirect::tests::argument_clamp_builds`, `pipeline::library::tests::a_rejected_blob_gives_an_empty_library`, `resource::tests::buffer_data_reaches_the_host_texture`) - **`cargo xtask policy`**: **PASS** (`asset policy: 152 files ok`) ### Summary All 14 Wave64 translation and GPU execution tests pass on NVIDIA GTX 1660 SUPER (Wave32) under Wine 11.21 + vkd3d-proton 3.1.0. One minor test-harness issue: `recommended_wave64_mode_matches_device_capabilities` assumes `EnumWarpAdapter` only returns a software adapter, which fails under Wine/DXVK's hardware fallback. No game data used.
Author
Owner

@⁠Vyral1978 on GitHub · 2026-11-24 01:56 UTC · original

Tested d0fd9bf on Ampere, in the title up to the world. Pipeline refusals go away; the world hang stays, as in #71.

Setup: RTX 3070 8 GB (Ampere, 32-lane waves only), driver 610.88, i7-12700, 32 GB, Windows 11 26300. Release build of main d2a4bae + this PR, plus #40, #55, #74 and a local render-target-view guard (the one described in #71). #54 is not included: it conflicts with this PR in lower.rs and mod.rs, and this PR covers the same small-group case. Own 1.0.2.1 copy, two runs (cold, then warm shader cache).

Tests: cargo test --release -p victory-gpu -p victory-shader passes on this card, including all GPU wave64_tests (64, 96 and 128 threads, cross-half ballots, readlane/writelane, DPP row masks, the 32-thread fast path).

In the title:

d2a4bae + #40/#54/#55/#74 + this PR (no #54)
mode logged n/a wave64_mode=Wave32
compute pipelines refused (unique) 111 (0x80070057) 1 (0x8007000E, out of memory)
compute programs that do not translate (unique) 297 404
menus 30 fps 30 fps
world ~1 fps, ~64 s, then 0x887A0006 0.4–2.6 fps, ~40 s and ~44 s, then 0x887A0006
last slow host submission 5332 ms / 19 lists 5330 ms / 32 lists, 4938 ms / 31 lists

World time varies between 40 s and 2 min 20 s from run to run on this machine without any change, so I read the difference in world time as noise.

Where the refusals went: of the 111 programs refused on d2a4bae, 69 are now rejected at translation instead and about 41 build. The new translation failures (unique programs) are mostly this PR's own guards:

  • v_readfirstlane in divergent control flow is not supported: 77 (0 before)
  • a cross-lane wave operation in divergent control flow is not supported: 51 (0 before)
  • a lane mask holding lanes elsewhere read as data is not supported: +37

So on this title a large share of the wave64 compute programs still does not run on a 32-lane host, now as dropped dispatches instead of refused pipelines. That matches what others reported in #71: refusals are not what hangs the world.

No game files, captures or logs attached. AI-assisted (Claude Code).

**@⁠Vyral1978** on GitHub · 2026-11-24 01:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7119599388) Tested `d0fd9bf` on Ampere, in the title up to the world. Pipeline refusals go away; the world hang stays, as in #71. **Setup:** RTX 3070 8 GB (Ampere, 32-lane waves only), driver 610.88, i7-12700, 32 GB, Windows 11 26300. Release build of `main` `d2a4bae` + this PR, plus #40, #55, #74 and a local render-target-view guard (the one described in #71). #54 is not included: it conflicts with this PR in `lower.rs` and `mod.rs`, and this PR covers the same small-group case. Own 1.0.2.1 copy, two runs (cold, then warm shader cache). **Tests:** `cargo test --release -p victory-gpu -p victory-shader` passes on this card, including all GPU `wave64_tests` (64, 96 and 128 threads, cross-half ballots, readlane/writelane, DPP row masks, the 32-thread fast path). **In the title:** | | `d2a4bae` + #40/#54/#55/#74 | + this PR (no #54) | |---|---|---| | mode logged | n/a | `wave64_mode=Wave32` | | compute pipelines refused (unique) | 111 (`0x80070057`) | 1 (`0x8007000E`, out of memory) | | compute programs that do not translate (unique) | 297 | 404 | | menus | 30 fps | 30 fps | | world | ~1 fps, ~64 s, then `0x887A0006` | 0.4–2.6 fps, ~40 s and ~44 s, then `0x887A0006` | | last `slow host submission` | 5332 ms / 19 lists | 5330 ms / 32 lists, 4938 ms / 31 lists | World time varies between 40 s and 2 min 20 s from run to run on this machine without any change, so I read the difference in world time as noise. **Where the refusals went:** of the 111 programs refused on `d2a4bae`, 69 are now rejected at translation instead and about 41 build. The new translation failures (unique programs) are mostly this PR's own guards: - `v_readfirstlane in divergent control flow is not supported`: 77 (0 before) - `a cross-lane wave operation in divergent control flow is not supported`: 51 (0 before) - `a lane mask holding lanes elsewhere read as data is not supported`: +37 So on this title a large share of the wave64 compute programs still does not run on a 32-lane host, now as dropped dispatches instead of refused pipelines. That matches what others reported in #71: refusals are not what hangs the world. No game files, captures or logs attached. AI-assisted (Claude Code).
Author
Owner

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

I ran the 128-thread gpu_128_threads_ds_swizzle_and_dpp_row_mask test from this branch on Windows 10 using Agility SDK 620 and app-local Microsoft WARP 1.0.22. In the Wave32 path, WARP removed its software device. The test passes with a small change in DPP row shifts.

For the first lane of a row, row_shr:1 subtracts one before the inside predicate gets applied. The lowerer still issues the lane read for that edge. Selecting the lane's own index when inside is false before the shuffle avoids passing an out-of-range source and preserves the existing bound_ctrl and write-mask behavior. All 128 outputs matched the synthetic reference afterward. WARP also reports support for native Wave64 on this version, so the test expectation that every software adapter selects Emulate needs to follow the advertised capabilities.

Causeway change. This was software-only. Gameplay and hardware-driver effects remain unmeasured. AI-assisted testing.

**@⁠ifBars** on GitHub · 2026-11-24 02:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7119800249) I ran the 128-thread `gpu_128_threads_ds_swizzle_and_dpp_row_mask` test from this branch on Windows 10 using Agility SDK 620 and app-local Microsoft WARP 1.0.22. In the Wave32 path, WARP removed its software device. The test passes with a small change in DPP row shifts. For the first lane of a row, `row_shr:1` subtracts one before the `inside` predicate gets applied. The lowerer still issues the lane read for that edge. Selecting the lane's own index when `inside` is false before the shuffle avoids passing an out-of-range source and preserves the existing `bound_ctrl` and write-mask behavior. All 128 outputs matched the synthetic reference afterward. WARP also reports support for native Wave64 on this version, so the test expectation that every software adapter selects Emulate needs to follow the advertised capabilities. [Causeway change](https://github.com/ifBars/VICauseway/commit/3099fa5bda68f2830a598d342b66b3780cfb5a09). This was software-only. Gameplay and hardware-driver effects remain unmeasured. AI-assisted testing.
Author
Owner

@⁠Kam471 on GitHub · 2026-11-24 02:10 UTC · original

Data point from an RTX 5070 Ti (D3D12 wave range 32..32), diag build, retail title:

  • With #189 applied, compute pipeline refusals go from ~111 to 0; 425 compute programs translate and the title gets past the intro.
  • The remaining device removal is not compute. Every DRED stop is a mesh dispatch. The console mesh programs have FSSM flags 0x110000 (bit 5 clear = wave64); their ISA derives lane numbers with v_mbcnt_lo/hi and 64-bit EXEC. On a 32-lane host wave, lanes 32..63 get the wrong numbers, mesh output is corrupted and the device eventually hangs.
  • Mesh PSOs cannot declare WaveSize(64), so today those pipelines are refused instead of run. That avoids the hang but drops the terrain/mesh geometry.

So #189 fixes the compute half of the wave64 problem; mesh needs the same two-halves-per-console-wave emulation through groupshared memory. No game data attached, only the header flag, instruction names and counts.

**@⁠Kam471** on GitHub · 2026-11-24 02:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7119830303) Data point from an RTX 5070 Ti (D3D12 wave range 32..32), diag build, retail title: - With #189 applied, compute pipeline refusals go from ~111 to 0; 425 compute programs translate and the title gets past the intro. - The remaining device removal is not compute. Every DRED stop is a mesh dispatch. The console mesh programs have FSSM flags 0x110000 (bit 5 clear = wave64); their ISA derives lane numbers with v_mbcnt_lo/hi and 64-bit EXEC. On a 32-lane host wave, lanes 32..63 get the wrong numbers, mesh output is corrupted and the device eventually hangs. - Mesh PSOs cannot declare WaveSize(64), so today those pipelines are refused instead of run. That avoids the hang but drops the terrain/mesh geometry. So #189 fixes the compute half of the wave64 problem; mesh needs the same two-halves-per-console-wave emulation through groupshared memory. No game data attached, only the header flag, instruction names and counts.
Author
Owner

@⁠tanishq-dubey on GitHub · 2026-11-24 02:10 UTC · original

Independent synthetic test of head d0fd9bf4b9a2b63d303e692c82c9fc8669642cc2 on Linux x86_64 with an RTX 5090 (NVIDIA 620.70.06), Wine 11.22, vkd3d-proton 3.2.0 and DXVK 3.1.1. Cross-built the Windows victory-shader test binary and ran wave64_tests --nocapture --test-threads=1: 14 passed, 0 failed. The native-wave64 rejection messages on the 32-wide adapter were expected by the tests.

Wine/DXVK reported that EnumWarpAdapter returned a hardware adapter, so this is not an independent WARP result. DXIL validator use was not separately confirmed. No game files used in these tests. AI-assisted.

**@⁠tanishq-dubey** on GitHub · 2026-11-24 02:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7119833286) Independent synthetic test of head `d0fd9bf4b9a2b63d303e692c82c9fc8669642cc2` on Linux x86_64 with an RTX 5090 (NVIDIA 620.70.06), Wine 11.22, vkd3d-proton 3.2.0 and DXVK 3.1.1. Cross-built the Windows `victory-shader` test binary and ran `wave64_tests --nocapture --test-threads=1`: **14 passed, 0 failed**. The native-wave64 rejection messages on the 32-wide adapter were expected by the tests. Wine/DXVK reported that `EnumWarpAdapter` returned a hardware adapter, so this is not an independent WARP result. DXIL validator use was not separately confirmed. No game files used in these tests. AI-assisted.
Author
Owner

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

Tested head d0fd9bf on Windows 11 26300, RTX 5080 (32-lane), driver 621.24, with a local 1.0.2.1 copy.

  • cargo test --workspace: 279 passed, 0 failed, 4 ignored.
  • The title selected wave64_mode=Wave32.
  • It reached the world with no host-pipeline refusal in the run, versus refusals on current main.
  • The host device was still removed with DXGI_ERROR_DEVICE_HUNG after a compute submission; 450 shader translation attempts remained unsupported, many reported as cross-lane wave operations in divergent control flow.

So this improves the Wave64 path here but does not by itself close #97. Menus and first-boot rendering remained stable. Only counts and error classes are shared. AI-assisted (Kimi Code).

**@⁠miniongk** on GitHub · 2026-11-24 02:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7119858928) Tested head `d0fd9bf` on Windows 11 26300, RTX 5080 (32-lane), driver 621.24, with a local 1.0.2.1 copy. - `cargo test --workspace`: 279 passed, 0 failed, 4 ignored. - The title selected `wave64_mode=Wave32`. - It reached the world with no host-pipeline refusal in the run, versus refusals on current `main`. - The host device was still removed with `DXGI_ERROR_DEVICE_HUNG` after a compute submission; 450 shader translation attempts remained unsupported, many reported as cross-lane wave operations in divergent control flow. So this improves the Wave64 path here but does not by itself close #97. Menus and first-boot rendering remained stable. Only counts and error classes are shared. AI-assisted (Kimi Code).
Author
Owner

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

Tested the PR head at d0fd9bf with 96 distinct compute shaders whose DXIL validated but whose D3D12 compute pipelines were refused on an RTX 3080 Ti. On this PR alone, 33/96 passed both validation and pipeline creation, including all three depth-pyramid shaders. Five more created a pipeline but failed DXIL validation. Of the 58 that did not emit, 30 reported a cross-lane operation in divergent control flow, 26 reported read-first-lane in divergent control flow, and two reported byte/half LDS writes. This was an offline test of pipeline creation.

**@⁠Raxstreams** on GitHub · 2026-11-24 02:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7120170278) Tested the PR head at `d0fd9bf` with 96 distinct compute shaders whose DXIL validated but whose D3D12 compute pipelines were refused on an RTX 3080 Ti. On this PR alone, 33/96 passed both validation and pipeline creation, including all three depth-pyramid shaders. Five more created a pipeline but failed DXIL validation. Of the 58 that did not emit, 30 reported a cross-lane operation in divergent control flow, 26 reported read-first-lane in divergent control flow, and two reported byte/half LDS writes. This was an offline test of pipeline creation.
Author
Owner

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

Test report on a machine with a 32-lane and a 64-lane adapter.

Tested

  • NVIDIA RTX 5070 (D3D12 wave range 32..32) and an AMD Radeon iGPU (RDNA2, 32..64); Windows 11; Rust 1.98.1; debug.
  • This PR at d0fd9bf, translating with TranslateOptions { wave64: host.recommended_wave64_mode() }: Wave32 on the RTX 5070, Native on the Radeon.
  • Hand-assembled wave64 GFX10 compute programs (the ones in #233's split_tests.rs plus two more), each lane's output checked against the console's result, five runs each with identical results:
Program (64 threads unless noted) RTX 5070 (Wave32) Radeon (Native)
ds_swizzle xor 16 + DPP row_mirror, 64 and 128 threads exact exact
s_bcnt1 of lanes below 40, 64, 48 and 32 threads exact exact
v_readlane 40 exact exact
DPP row_mask:0x3 exact exact
DPP + v_readfirstlane (all lanes active) exact exact
LDS without s_barrier: every lane writes dword t, lanes below 20 then read dword t + 40 exact exact
v_readlane 10 inside a branch only lanes below 20 take refused exact
a loop lane t runs t times with v_readlane 40 in each iteration refused wrong, as on main (#225)

The two refusals are a cross-lane read in divergent control flow, as the description says. On main the RTX 5070 creates no pipeline for any of these programs, so every exact cell in its column is new. Forcing Wave32 and Emulate on the Radeon gives the RTX 5070 column there too.

  • cargo test -p victory-shader: 84 passed, 0 failed. One caveat: the first of 15 runs of the suite hung (the wave64_tests::gpu and valu_tests GPU tests still running after 10 minutes) and was killed. Other GPU tests were running on the same machine at the time, it did not happen again in 14 further runs, and I have no cause, so treat it as an observation, not a finding.

The two refused programs are the kind #233 / #320 run in their console flow (both halves take every branch together, so an exchange inside a divergent branch or loop is reached by both). The approaches fit together: this PR's exchanges for what the whole group reaches, including groups of several console waves, LDS and reductions, which #233 does not do; the console flow for exchanges in divergent code.

Not tested: the LDS case is exact in five runs with two groups, which does not rule out a race; release build; the title (no game files used).

AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 02:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7120455950) Test report on a machine with a 32-lane and a 64-lane adapter. **Tested** - NVIDIA RTX 5070 (D3D12 wave range 32..32) and an AMD Radeon iGPU (RDNA2, 32..64); Windows 11; Rust 1.98.1; debug. - This PR at `d0fd9bf`, translating with `TranslateOptions { wave64: host.recommended_wave64_mode() }`: `Wave32` on the RTX 5070, `Native` on the Radeon. - Hand-assembled wave64 GFX10 compute programs (the ones in #233's `split_tests.rs` plus two more), each lane's output checked against the console's result, five runs each with identical results: | Program (64 threads unless noted) | RTX 5070 (`Wave32`) | Radeon (`Native`) | |---|---|---| | `ds_swizzle` xor 16 + DPP `row_mirror`, 64 and 128 threads | exact | exact | | `s_bcnt1` of lanes below 40, 64, 48 and 32 threads | exact | exact | | `v_readlane 40` | exact | exact | | DPP `row_mask:0x3` | exact | exact | | DPP + `v_readfirstlane` (all lanes active) | exact | exact | | LDS without `s_barrier`: every lane writes dword t, lanes below 20 then read dword t + 40 | exact | exact | | `v_readlane 10` inside a branch only lanes below 20 take | refused | exact | | a loop lane t runs t times with `v_readlane 40` in each iteration | refused | wrong, as on `main` (#225) | The two refusals are `a cross-lane read in divergent control flow`, as the description says. On `main` the RTX 5070 creates no pipeline for any of these programs, so every exact cell in its column is new. Forcing `Wave32` and `Emulate` on the Radeon gives the RTX 5070 column there too. - `cargo test -p victory-shader`: 84 passed, 0 failed. One caveat: the first of 15 runs of the suite hung (the `wave64_tests::gpu` and `valu_tests` GPU tests still running after 10 minutes) and was killed. Other GPU tests were running on the same machine at the time, it did not happen again in 14 further runs, and I have no cause, so treat it as an observation, not a finding. The two refused programs are the kind #233 / #320 run in their console flow (both halves take every branch together, so an exchange inside a divergent branch or loop is reached by both). The approaches fit together: this PR's exchanges for what the whole group reaches, including groups of several console waves, LDS and reductions, which #233 does not do; the console flow for exchanges in divergent code. **Not tested**: the LDS case is exact in five runs with two groups, which does not rule out a race; release build; the title (no game files used). AI-assisted.
Author
Owner

@⁠noxite-four-life on GitHub · 2026-11-24 02:59 UTC · original

Tested on a real RTX 5070 Laptop GPU (32-lane) with a GTA VI dump. With this PR applied (on main + #205 + #334), the host logs Wave64 compute lowering mode selected wave64_mode=Wave32 and the CreateComputeShader: wave lane count of 64 … maximum … is 32 rejections drop from 112 to 0 — every previously-refused compute PSO now creates (the "compute pipelines refused" from #71). The title progresses further into the world.

The world still doesn't render yet, but for a different reason now: ~395 compute shaders still fail translation on divergent lane ops (v_readfirstlane / cross-lane wave op / select on an untracked mask in divergent control flow — looks like #320's territory), plus some vertex/pixel/mesh gaps. The Wave64 size rejection this PR fixes is fully resolved on real NVIDIA hardware. Thanks!

**@⁠noxite-four-life** on GitHub · 2026-11-24 02:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7120664696) Tested on a real **RTX 5070 Laptop GPU** (32-lane) with a GTA VI dump. With this PR applied (on `main` + #205 + #334), the host logs `Wave64 compute lowering mode selected wave64_mode=Wave32` and the **`CreateComputeShader: wave lane count of 64 … maximum … is 32` rejections drop from 112 to 0** — every previously-refused compute PSO now creates (the "compute pipelines refused" from #71). The title progresses further into the world. The world still doesn't render yet, but for a *different* reason now: ~395 compute shaders still fail translation on **divergent** lane ops (`v_readfirstlane` / cross-lane wave op / `select on an untracked mask` *in divergent control flow* — looks like #320's territory), plus some vertex/pixel/mesh gaps. The Wave64 *size* rejection this PR fixes is fully resolved on real NVIDIA hardware. Thanks!
Author
Owner

@⁠marquezinii on GitHub · 2026-11-24 04:33 UTC · original

Reviewed d0fd9bf and ran it on an NVIDIA RTX 5070 (32..32, driver 621.24), Windows 11, with the SDK's dxil.dll validating: cargo test -p victory-shader passes (84, all 14 wave64_tests). A synthetic case with only lanes 32..63 active (s_bcnt1/s_ff1 over 64 lanes, emulated v_readfirstlane picking lane 32, v_readlane of lane 40) is exact on the GPU and on WARP in both Wave32 and Emulate.

One case now runs and gives wrong results where main refused the pipeline: a single console wave (group of 64, no s_barrier) whose LDS write and read sit in different exec-masked blocks. Lanes 32..63 write lds[tid] in one block, lanes 0..31 read lds[tid + 32] in the next. On the console that is one wave in lockstep, so the read sees the write. Here the two host waves are not ordered: need_lds_barriers only puts a barrier before an LDS instruction in a block every thread reaches and outside a guard, so neither LDS access in this pattern gets one, and the join blocks between them have no LDS instruction.

20 dispatches per cell, lanes 0..31 compared with the expected values:

variant RTX 5070 Wave32 RTX 5070 Emulate WARP Wave32 / Emulate Native (as on main)
upper half runs a loop, then writes; lower half reads 20/20 wrong (reads 0) 20/20 wrong 20/20 wrong pipeline refused
everyone writes, then tid < 32 reads lds[tid + 32] 0/20 wrong 0/20 wrong 19-20/20 wrong pipeline refused

The second row only passes on the hardware by timing. gpu_64_threads_lockstep_lds_without_s_barrier covers the case where the accesses are in blocks every thread reaches, not this one. Either refusing such a program when its LDS cannot be fenced, or placing the barrier at the join after a divergent region that writes LDS, would keep it from silently returning stale data.

The synthetic program (hand-assembled GFX10, uses the helpers in wave64_tests.rs)
fn race_prog(delay: bool) -> NativeProgram {
    let mut code = vec![
        v_mov_b32(3, inline_u(7)),
        v_lshlrev_b32(2, inline_u(2), 0), // v2 = tid * 4
        v_add_nc_u32(4, inline_u(7), 0),  // v4 = tid + 7
    ];
    if delay {
        code.push(v_cmp_lt_u32(inline_u(31), 0)); // tid > 31
        code.push(s_and_saveexec_b64(6, VCC));
        let br = code.len();
        code.push(0);
        code.push(s_mov_b32(10, inline_u(0)));
        let top = code.len();
        code.push(vop2(0x0B, 4, LIT, 4)); // v_mul_u32_u24 v4, 40503, v4
        code.push(40503);
        code.push(v_add_nc_u32(4, inline_u(1), 4));
        code.push(s_add_i32(10, 10, inline_u(1)));
        code.push(s_cmp_lt_u32(10, LIT));
        code.push(4096);
        let b2 = code.len();
        code.push(s_cbranch_scc1((top as isize - (b2 + 1) as isize) as i16));
        code.extend_from_slice(&ds_op(0x0D, 0, 0, 2, 4, 0)); // ds_write_b32 v2, v4
        let l1 = code.len();
        code[br] = s_cbranch_execz((l1 - (br + 1)) as i16);
        code.push(s_or_b64(EXEC_LO, EXEC_LO, 6));
    } else {
        code.extend_from_slice(&ds_op(0x0D, 0, 0, 2, 4, 0));
    }
    code.push(v_cmp_gt_u32(inline_u(32), 0)); // tid < 32
    code.push(s_and_saveexec_b64(6, VCC));
    let br = code.len();
    code.push(0);
    code.extend_from_slice(&ds_op(0x36, 128, 0, 2, 0, 3)); // ds_read_b32 v3, v2 offset:128
    let l2 = code.len();
    code[br] = s_cbranch_execz((l2 - (br + 1)) as i16);
    code.push(s_or_b64(EXEC_LO, EXEC_LO, 6));
    emit_uav_store(&mut code, 3, 0);
    code.push(S_ENDPGM);
    make_cs_program(&code, [64, 1, 1], 512, false)
}

Expected for lane t < 32: t + 39 (plain) or the loop's value for t + 32 (v = t + 39; 4096 times v = mul_u24(40503, v) + 1); lanes 32..63 store 7.

Two smaller points:

  • A v_readfirstlane of a value that is uniform across the group still goes through the LDS exchange when the program reads other lanes anywhere (self.console_lanes || non_uniform), so inside a branch it refuses the whole shader ("v_readfirstlane in divergent control flow"), e.g. if (tid < 40) s = readfirstlane(sgpr_copy) in a 64-thread group.
  • emulated_readfirstlane with no active lane in either half returns the upper host wave's pick or stale scratch, where the ISA returns lane 0.

Not covered: the title (no game data here).

**@⁠marquezinii** on GitHub · 2026-11-24 04:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7122125903) Reviewed `d0fd9bf` and ran it on an NVIDIA RTX 5070 (32..32, driver 621.24), Windows 11, with the SDK's `dxil.dll` validating: `cargo test -p victory-shader` passes (84, all 14 `wave64_tests`). A synthetic case with only lanes 32..63 active (`s_bcnt1`/`s_ff1` over 64 lanes, emulated `v_readfirstlane` picking lane 32, `v_readlane` of lane 40) is exact on the GPU and on WARP in both `Wave32` and `Emulate`. One case now runs and gives wrong results where `main` refused the pipeline: a single console wave (group of 64, no `s_barrier`) whose LDS write and read sit in different exec-masked blocks. Lanes 32..63 write `lds[tid]` in one block, lanes 0..31 read `lds[tid + 32]` in the next. On the console that is one wave in lockstep, so the read sees the write. Here the two host waves are not ordered: `need_lds_barriers` only puts a barrier before an LDS instruction in a block every thread reaches and outside a guard, so neither LDS access in this pattern gets one, and the join blocks between them have no LDS instruction. 20 dispatches per cell, lanes 0..31 compared with the expected values: | variant | RTX 5070 `Wave32` | RTX 5070 `Emulate` | WARP `Wave32` / `Emulate` | `Native` (as on `main`) | |---|---|---|---|---| | upper half runs a loop, then writes; lower half reads | 20/20 wrong (reads 0) | 20/20 wrong | 20/20 wrong | pipeline refused | | everyone writes, then `tid < 32` reads `lds[tid + 32]` | 0/20 wrong | 0/20 wrong | 19-20/20 wrong | pipeline refused | The second row only passes on the hardware by timing. `gpu_64_threads_lockstep_lds_without_s_barrier` covers the case where the accesses are in blocks every thread reaches, not this one. Either refusing such a program when its LDS cannot be fenced, or placing the barrier at the join after a divergent region that writes LDS, would keep it from silently returning stale data. <details><summary>The synthetic program (hand-assembled GFX10, uses the helpers in <code>wave64_tests.rs</code>)</summary> ```rust fn race_prog(delay: bool) -> NativeProgram { let mut code = vec![ v_mov_b32(3, inline_u(7)), v_lshlrev_b32(2, inline_u(2), 0), // v2 = tid * 4 v_add_nc_u32(4, inline_u(7), 0), // v4 = tid + 7 ]; if delay { code.push(v_cmp_lt_u32(inline_u(31), 0)); // tid > 31 code.push(s_and_saveexec_b64(6, VCC)); let br = code.len(); code.push(0); code.push(s_mov_b32(10, inline_u(0))); let top = code.len(); code.push(vop2(0x0B, 4, LIT, 4)); // v_mul_u32_u24 v4, 40503, v4 code.push(40503); code.push(v_add_nc_u32(4, inline_u(1), 4)); code.push(s_add_i32(10, 10, inline_u(1))); code.push(s_cmp_lt_u32(10, LIT)); code.push(4096); let b2 = code.len(); code.push(s_cbranch_scc1((top as isize - (b2 + 1) as isize) as i16)); code.extend_from_slice(&ds_op(0x0D, 0, 0, 2, 4, 0)); // ds_write_b32 v2, v4 let l1 = code.len(); code[br] = s_cbranch_execz((l1 - (br + 1)) as i16); code.push(s_or_b64(EXEC_LO, EXEC_LO, 6)); } else { code.extend_from_slice(&ds_op(0x0D, 0, 0, 2, 4, 0)); } code.push(v_cmp_gt_u32(inline_u(32), 0)); // tid < 32 code.push(s_and_saveexec_b64(6, VCC)); let br = code.len(); code.push(0); code.extend_from_slice(&ds_op(0x36, 128, 0, 2, 0, 3)); // ds_read_b32 v3, v2 offset:128 let l2 = code.len(); code[br] = s_cbranch_execz((l2 - (br + 1)) as i16); code.push(s_or_b64(EXEC_LO, EXEC_LO, 6)); emit_uav_store(&mut code, 3, 0); code.push(S_ENDPGM); make_cs_program(&code, [64, 1, 1], 512, false) } ``` Expected for lane `t < 32`: `t + 39` (plain) or the loop's value for `t + 32` (`v = t + 39; 4096 times v = mul_u24(40503, v) + 1`); lanes 32..63 store 7. </details> Two smaller points: - A `v_readfirstlane` of a value that is uniform across the group still goes through the LDS exchange when the program reads other lanes anywhere (`self.console_lanes || non_uniform`), so inside a branch it refuses the whole shader ("v_readfirstlane in divergent control flow"), e.g. `if (tid < 40) s = readfirstlane(sgpr_copy)` in a 64-thread group. - `emulated_readfirstlane` with no active lane in either half returns the upper host wave's pick or stale scratch, where the ISA returns lane 0. Not covered: the title (no game data here).
Author
Owner

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

A data point on @⁠marquezinii's masked-block LDS pattern from the other form (#439's console flow), since it says something about where the barrier has to go. Not a claim on this PR.

I assembled the same two programs for #439's test harness, plus a third with the same masks and no branch around either access (s_and_saveexec / ds_write / s_or exec, then the same around the read). They are lds_written_and_read_in_different_masked_blocks at a32c177. RTX 5070 (32..32, driver 621.24, a group of 64 as two 32-lane waves) and a Radeon iGPU (32..64, one wave), Windows 11, each module through dxil.dll first, 2 groups per dispatch, 20 runs per cell on the RTX:

variant RTX 5070 RTX 5070, barrier before each LDS access left out Radeon, one 64-lane wave
upper half runs a 4096-iteration loop, then writes; lower half reads 0/20 wrong 0/20 wrong exact
everyone writes, then tid < 32 reads lds[tid + 32] 0/20 wrong 0/20 wrong exact
upper half writes, lower half reads, masks only, no branch 0/20 wrong 20/20 wrong (lower half reads 0) exact

What I take from it:

  • The first two rows do not depend on a barrier at the LDS access in that form, because a branch on EXEC is decided for the whole console wave there (the two halves exchange their ballots between group barriers), so the halves are already in step at the join. That agrees with your second suggestion: a barrier at the join after a divergent region is enough for the branched shape.
  • The third row has no join to put one at. If #189 or @⁠erickbobd's leaf treat "same block, different EXEC masks" as fenced because the accesses share a block, this shape may be worth a case: on this card the lower wave reads before the upper wave writes every time once nothing orders them.

Synthetic programs only, hand-assembled; no title data. I have not run this PR's or the leaf's code on these programs. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 05:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7123254560) A data point on @⁠marquezinii's [masked-block LDS pattern](https://git.gtahub.st/github/Marvisak--VIctory/pulls/189) from the other form (#439's console flow), since it says something about where the barrier has to go. Not a claim on this PR. I assembled the same two programs for #439's test harness, plus a third with the same masks and no branch around either access (`s_and_saveexec` / `ds_write` / `s_or exec`, then the same around the read). They are [`lds_written_and_read_in_different_masked_blocks`](https://github.com/r4tedx/VIctory/blob/a32c177/crates/victory-shader/src/emit/split_tests.rs) at `a32c177`. RTX 5070 (32..32, driver 621.24, a group of 64 as two 32-lane waves) and a Radeon iGPU (32..64, one wave), Windows 11, each module through `dxil.dll` first, 2 groups per dispatch, 20 runs per cell on the RTX: | variant | RTX 5070 | RTX 5070, barrier before each LDS access left out | Radeon, one 64-lane wave | |---|---|---|---| | upper half runs a 4096-iteration loop, then writes; lower half reads | 0/20 wrong | 0/20 wrong | exact | | everyone writes, then `tid < 32` reads `lds[tid + 32]` | 0/20 wrong | 0/20 wrong | exact | | upper half writes, lower half reads, masks only, no branch | 0/20 wrong | **20/20 wrong** (lower half reads 0) | exact | What I take from it: - The first two rows do not depend on a barrier at the LDS access in that form, because a branch on EXEC is decided for the whole console wave there (the two halves exchange their ballots between group barriers), so the halves are already in step at the join. That agrees with your second suggestion: a barrier at the join after a divergent region is enough for the branched shape. - The third row has no join to put one at. If #189 or @⁠erickbobd's leaf treat "same block, different EXEC masks" as fenced because the accesses share a block, this shape may be worth a case: on this card the lower wave reads before the upper wave writes every time once nothing orders them. Synthetic programs only, hand-assembled; no title data. I have not run this PR's or the leaf's code on these programs. AI-assisted (Claude Code).
Author
Owner

@⁠oeirughrepuiohg on GitHub · 2026-11-24 06:48 UTC · original

Linux/NVIDIA A/B for the wave64 PRs, same scripted route into the world, 240 s each.

Setup: RTX 4070 Ti 12 GB (driver 620.70.06), Fedora 45 (kernel 7.3), Proton Experimental wine-11.0 with a copy of Proton's default_pfx, vkd3d-proton from GE-Proton11-14 (cae8353e), Series X mode. Base = d2a4bae + #177 + #454 + #151 + #222 + #542, diag build, VICTORY_NO_WATCHDOG=1.

base + #189 + #233
pipelines refused (WaveSize 64 vs 32) 71 0 0
shaders not translated 62 158 139
median draws/frame in world 12 520 315
median fps in world n/a (crashed during world load) 0.5 0.5
crash vkAllocateMemory 0xc0000005 in a Unix call at ~11.9/12.3 GB VRAM none in 240 s none in 240 s
  • Both PRs remove every WaveSize refusal on this card; neither crashed in these runs.
  • With #189 the mission-1 title card and the opening credits render (a later 600 s run: no crash, 0 refused).
  • In-world frame time is dominated by the CPU copies of title memory (up to ~4.5 s of a ~5 s frame); the GPU part is 0.1-0.6 s, so #407/#501 look like the next big lever here.
  • "Not translated" goes up with both PRs, likely because more of the world now gets far enough to request those programs.

Linux note for #222 / #340: Fedora 45's wine-alsa / wine-pulseaudio 11.21 packages ship only the unix .so halves, no PE winealsa.drv / winepulse.drv, so the audio assert fires even with them installed. Proton's wine with a copy of its default_pfx plus an ALSA device (a hinted type null default works when no host audio is wanted) avoids it.

AI-assisted (Claude Code). No game data attached.

**@⁠oeirughrepuiohg** on GitHub · 2026-11-24 06:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7124314322) Linux/NVIDIA A/B for the wave64 PRs, same scripted route into the world, 240 s each. **Setup:** RTX 4070 Ti 12 GB (driver 620.70.06), Fedora 45 (kernel 7.3), Proton Experimental wine-11.0 with a copy of Proton's `default_pfx`, vkd3d-proton from GE-Proton11-14 (`cae8353e`), Series X mode. Base = `d2a4bae` + #177 + #454 + #151 + #222 + #542, diag build, `VICTORY_NO_WATCHDOG=1`. | | base | + #189 | + #233 | |---|---|---|---| | pipelines refused (WaveSize 64 vs 32) | 71 | 0 | 0 | | shaders not translated | 62 | 158 | 139 | | median draws/frame in world | 12 | 520 | 315 | | median fps in world | n/a (crashed during world load) | 0.5 | 0.5 | | crash | `vkAllocateMemory` 0xc0000005 in a Unix call at ~11.9/12.3 GB VRAM | none in 240 s | none in 240 s | - Both PRs remove every WaveSize refusal on this card; neither crashed in these runs. - With #189 the mission-1 title card and the opening credits render (a later 600 s run: no crash, 0 refused). - In-world frame time is dominated by the CPU copies of title memory (up to ~4.5 s of a ~5 s frame); the GPU part is 0.1-0.6 s, so #407/#501 look like the next big lever here. - "Not translated" goes up with both PRs, likely because more of the world now gets far enough to request those programs. Linux note for #222 / #340: Fedora 45's `wine-alsa` / `wine-pulseaudio` 11.21 packages ship only the unix `.so` halves, no PE `winealsa.drv` / `winepulse.drv`, so the audio assert fires even with them installed. Proton's wine with a copy of its `default_pfx` plus an ALSA device (a hinted `type null` default works when no host audio is wanted) avoids it. *AI-assisted (Claude Code). No game data attached.*
Author
Owner

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

AMD hardware check, Windows 11, Adrenalin driver: RX 9070 (RDNA4, 32-64 lane waves) and Ryzen 9600X iGPU (RDNA2, gfx1036).

  • cargo test -p victory-shader --release with each GPU as the hardware device: 84 passed, 0 failed on both. All nine wave64_tests::gpu::* ran on the AMD device in both Emulate and forced Wave32 modes and matched the expected output, so the 32-lane path is checked on real RDNA2/RDNA4 hardware too, not only on NVIDIA/WARP.
  • Full retail shader pack (26,503 containers), victory translate --validate --pipelines on the RX 9070 against main 1f858b0: identical to main (VS/PS 12272 emitted / 12172 validated / 12272 pipelines, CS 1693/1670/1693, MS 8191/8129/8191), as expected on a host with native 64-lane waves.
**@⁠slint6614-dev** on GitHub · 2026-11-24 08:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7125665254) AMD hardware check, Windows 11, Adrenalin driver: RX 9070 (RDNA4, 32-64 lane waves) and Ryzen 9600X iGPU (RDNA2, gfx1036). - `cargo test -p victory-shader --release` with each GPU as the hardware device: 84 passed, 0 failed on both. All nine `wave64_tests::gpu::*` ran on the AMD device in both `Emulate` and forced `Wave32` modes and matched the expected output, so the 32-lane path is checked on real RDNA2/RDNA4 hardware too, not only on NVIDIA/WARP. - Full retail shader pack (26,503 containers), `victory translate --validate --pipelines` on the RX 9070 against main 1f858b0: identical to main (VS/PS 12272 emitted / 12172 validated / 12272 pipelines, CS 1693/1670/1693, MS 8191/8129/8191), as expected on a host with native 64-lane waves.
Author
Owner

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

A WARP-specific follow-up to this stack: this machine reports four host lanes, so native console wave32 programs also need the portable path. They previously kept WaveSize(32) and were refused by WARP even after wave64 programs were handled.

The extension at github.com/Hiiva/VIctory@6aa72a6 uses the source wave width (32 or 64) for shared-memory exchange, ballot indexing, lane wrapping, spills and LDS ordering. Four focused readback tests pass on the verified Microsoft software adapter (min=max4), with CPU lowering/resource checks and all-target clippy. The existing wave64 tests still pass. This is in the current integration branch; no game assets are included.

Related fixes in that branch retain the source EXEC mask for firstlane, including the small Wave32 fast path and empty-EXEC lane-zero behavior. A separate portable console-flow follow-up is being tested for the remaining divergent single-wave cases. These tests establish the covered operations, not playable world rendering.

**@⁠Hiiva** on GitHub · 2026-11-24 10:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7128811190) A WARP-specific follow-up to this stack: this machine reports four host lanes, so native console wave32 programs also need the portable path. They previously kept WaveSize(32) and were refused by WARP even after wave64 programs were handled. The extension at https://github.com/Hiiva/VIctory/commit/6aa72a6 uses the source wave width (32 or 64) for shared-memory exchange, ballot indexing, lane wrapping, spills and LDS ordering. Four focused readback tests pass on the verified Microsoft software adapter (min=max4), with CPU lowering/resource checks and all-target clippy. The existing wave64 tests still pass. This is in the current integration branch; no game assets are included. Related fixes in that branch retain the source EXEC mask for firstlane, including the small Wave32 fast path and empty-EXEC lane-zero behavior. A separate portable console-flow follow-up is being tested for the remaining divergent single-wave cases. These tests establish the covered operations, not playable world rendering.
Author
Owner

@⁠elamriz on GitHub · 2026-11-24 11:22 UTC · original · edited 2026-11-24 11:41 UTC

Independent Windows WARP test on ffe310e with d0fd9bf applied locally. WARP reports min/max wave lanes 4/4. The diagnostics runs used WARP, D3D12 Debug and DRED, with a fresh cache per run and the same scripted input in an offline AppContainer.

Build D3D12 64→4 messages D3D12 32→4 messages Exit
ffe310e 52 12 0x887A0005
With d0fd9bf, run 1 0 70 0xC0000005
With d0fd9bf, run 2 0 30 0x887A0005

These are message counts, which vary with how far the run gets. Compute shader 13dfdd3b1136e407, the first wave64 refusal on the baseline, appeared in submitted work in both patched runs. Device removal still reproduced once with no 64→4 messages.

The remaining wave32 refusal agrees with Hiiva’s follow-up. I also isolated it without title files using the helpers in wave64_tests.rs: emit v_mbcnt_lo_u32_b32(1, NEG_ONE, inline_u(0)), emit_uav_store(&mut code, 1, 0) and S_ENDPGM in a [32, 1, 1] group, set program.wave64 = false, and use emit_cs in Emulate mode. With d0fd9bf, PSV still declares (32, 32). The root signature succeeds and CreateComputePipelineState rejects the shader. Successful pipeline creation and exact readback of 0..31 would give this case a simple check on the portable wave32 path. I have yet to run the follow-up commit.

AI-assisted testing and reporting. No raw logs or title files attached.

Follow-up on 6aa72a6 — I ran the synthetic v_mbcnt_lo case with 64 threads. In Emulate mode on 4-lane WARP it created the PSO and read back 0..31 twice, as expected for two independent guest wave32s. To exercise both adapters, I locally changed the test helper’s expected native failure to check supports_wave32() for wave32 guests and supports_wave64() for wave64 guests. The helper otherwise incorrectly expects native wave32 creation to fail on a 32-lane hardware adapter. With the harness corrected, the existing gpu_native_wave32_lane_semantics passes on WARP in Emulate mode but shows a separate readback mismatch on the 32-lane hardware adapter in Wave32 mode. This follow-up was synthetic only.

In-title A/B for 6aa72a6 — I ran the exact commit and its immediate parent a2e1a1e in the same offline Windows WARP setup, with a fresh cache per run. The parent logged 69 wave32→4 messages and exited with 0x887A0005. Both 6aa72a6 runs had zero wave-size messages and zero host pipeline refusals. Both stopped at the same title-side null write (0xC0000005). This confirms the wave32 pipeline fix in-title. The cause of the null write is still open.

Crash follow-up — The faulting instruction in both patched runs writes to literal address zero. This is an explicit trap in the title code. The failing condition upstream is still unknown.

Watchdog and sampled stacks — The two title fault sites match #454. Across three earlier watchdog exits the saved register state is consistent with the 30-tick no-progress branch. In a separate 6aa72a6 run with the watchdog still enabled, three scheduled samples (105, 115 and 125 s) found title-main in the same polling routine, in the 1 ms sleep or the next call, with the same title caller in all samples. WARP workers were active in the stack dump. That run had zero wave-size messages and ended through D3D12 device removal after a seven-list submission, with empty DRED breadcrumbs. The sampled wait is repeatable within this run, but the data does not identify a particular stalled dispatch.

**@⁠elamriz** on GitHub · 2026-11-24 11:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7130014690) · edited 2026-11-24 11:41 UTC Independent Windows WARP test on `ffe310e` with `d0fd9bf` applied locally. WARP reports min/max wave lanes `4/4`. The diagnostics runs used WARP, D3D12 Debug and DRED, with a fresh cache per run and the same scripted input in an offline AppContainer. | Build | D3D12 64→4 messages | D3D12 32→4 messages | Exit | | --- | ---: | ---: | --- | | `ffe310e` | 52 | 12 | `0x887A0005` | | With `d0fd9bf`, run 1 | 0 | 70 | `0xC0000005` | | With `d0fd9bf`, run 2 | 0 | 30 | `0x887A0005` | These are message counts, which vary with how far the run gets. Compute shader `13dfdd3b1136e407`, the first wave64 refusal on the baseline, appeared in submitted work in both patched runs. Device removal still reproduced once with no 64→4 messages. The remaining wave32 refusal agrees with [Hiiva’s follow-up](https://git.gtahub.st/github/Marvisak--VIctory/pulls/189). I also isolated it without title files using the helpers in `wave64_tests.rs`: emit `v_mbcnt_lo_u32_b32(1, NEG_ONE, inline_u(0))`, `emit_uav_store(&mut code, 1, 0)` and `S_ENDPGM` in a `[32, 1, 1]` group, set `program.wave64 = false`, and use `emit_cs` in `Emulate` mode. With `d0fd9bf`, PSV still declares `(32, 32)`. The root signature succeeds and `CreateComputePipelineState` rejects the shader. Successful pipeline creation and exact readback of `0..31` would give this case a simple check on the portable wave32 path. I have yet to run the follow-up commit. AI-assisted testing and reporting. No raw logs or title files attached. **Follow-up on `6aa72a6`** — I ran the synthetic `v_mbcnt_lo` case with 64 threads. In `Emulate` mode on 4-lane WARP it created the PSO and read back `0..31` twice, as expected for two independent guest wave32s. To exercise both adapters, I locally changed the test helper’s expected native failure to check `supports_wave32()` for wave32 guests and `supports_wave64()` for wave64 guests. The helper otherwise incorrectly expects native wave32 creation to fail on a 32-lane hardware adapter. With the harness corrected, the existing `gpu_native_wave32_lane_semantics` passes on WARP in `Emulate` mode but shows a separate readback mismatch on the 32-lane hardware adapter in `Wave32` mode. This follow-up was synthetic only. **In-title A/B for `6aa72a6`** — I ran the exact commit and its immediate parent `a2e1a1e` in the same offline Windows WARP setup, with a fresh cache per run. The parent logged 69 wave32→4 messages and exited with `0x887A0005`. Both `6aa72a6` runs had zero wave-size messages and zero host pipeline refusals. Both stopped at the same title-side null write (`0xC0000005`). This confirms the wave32 pipeline fix in-title. The cause of the null write is still open. **Crash follow-up** — The faulting instruction in both patched runs writes to literal address zero. This is an explicit trap in the title code. The failing condition upstream is still unknown. **Watchdog and sampled stacks** — The two title fault sites match [#454](https://git.gtahub.st/github/Marvisak--VIctory/pulls/454). Across three earlier watchdog exits the saved register state is consistent with the 30-tick no-progress branch. In a separate `6aa72a6` run with the watchdog still enabled, three scheduled samples (105, 115 and 125 s) found `title-main` in the same polling routine, in the 1 ms sleep or the next call, with the same title caller in all samples. WARP workers were active in the stack dump. That run had zero wave-size messages and ended through D3D12 device removal after a seven-list submission, with empty DRED breadcrumbs. The sampled wait is repeatable within this run, but the data does not identify a particular stalled dispatch.
Author
Owner

@⁠NuraadGit on GitHub · 2026-11-24 12:21 UTC · original

A follow-up on d0fd9bf that removes the most common Wave32 refusal in the world: v_readfirstlane in divergent control flow.

Branch: NuraadGit:shaders/wave32-divergent-readfirstlane, one commit (7425674) on this PR's head, +48/-4 with a test.

What it changes. Inside divergent control flow the two 32-lane halves can't meet at a barrier, so emulated_readfirstlane refuses. In Wave64Mode::Wave32, each half now reads its own first active lane instead: waveActiveBallot of the active lanes, first bit, waveReadLaneAt. That's the same code the uniform path already uses for picked, minus the LDS exchange, so no barrier is emitted inside the branch and nothing can hang. Emulate still refuses.

Why it's sound in practice:

  • It's exact when the value is uniform over the active lanes, which is what the console compiler emits v_readfirstlane for.
  • A waterfall loop over a varying value still visits every value, half by half: each half's v_cmp_eq matches its own lanes, and the loop runs until both halves are empty.
  • It is not exact if a program relies on all 64 lanes agreeing on one varying value in divergent code. It's marked shortcut:.

Test: divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32 (in wave64_tests.rs, modelled on divergent_cross_half_ballot_is_rejected_instead_of_hanging). It translates on Wave32 and still errors on Emulate, and it fails without the change. All 16 wave64 tests pass.

Measured in the world (RTX 2080, 8-minute runs, no DRED):

before with the commit
compute programs refused with v_readfirstlane in divergent control flow 98 0
draws and dispatches dropped without a host pipeline, per frame ~1,450 ~850
draws run per frame ~2,430 ~2,470
device removal / hang none none
frame time (median) 0.91 s 0.90 s

The build was JMAN730's fork + #493 + this PR + #206 + #667 + MIN_DYNAMIC = 1 << 18 (#747) + the render-target guard from my comment on #55, at VICTORY_SHADER_LOOP_LIMIT=32. The 3D scene is still black on this card: the G-buffer and its packed attribute targets now hold most of the first playable area, but the lighting chain doesn't show yet. So I can't yet claim the fallback gives correct pixels, only that those programs now translate and run without hanging.

The next Wave32 reasons in the same world run, by count of programs: a lane mask holding lanes elsewhere read as data (93), a cross-lane wave operation in divergent control flow (75, from exchange_two_halves), and a lane-mask join of an untracked mask (13).

AI-assisted (Claude Code): the change, test, builds and runs were automated. The hardware, title copy and runs are the user's.

**@⁠NuraadGit** on GitHub · 2026-11-24 12:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7131320233) **A follow-up on `d0fd9bf` that removes the most common Wave32 refusal in the world: `v_readfirstlane in divergent control flow`.** Branch: [NuraadGit:shaders/wave32-divergent-readfirstlane](https://github.com/NuraadGit/VIctory/tree/shaders/wave32-divergent-readfirstlane), one commit (`7425674`) on this PR's head, +48/-4 with a test. **What it changes.** Inside divergent control flow the two 32-lane halves can't meet at a barrier, so `emulated_readfirstlane` refuses. In `Wave64Mode::Wave32`, each half now reads its own first active lane instead: `waveActiveBallot` of the active lanes, first bit, `waveReadLaneAt`. That's the same code the uniform path already uses for `picked`, minus the LDS exchange, so no barrier is emitted inside the branch and nothing can hang. `Emulate` still refuses. **Why it's sound in practice:** - It's exact when the value is uniform over the active lanes, which is what the console compiler emits `v_readfirstlane` for. - A waterfall loop over a varying value still visits every value, half by half: each half's `v_cmp_eq` matches its own lanes, and the loop runs until both halves are empty. - It is not exact if a program relies on all 64 lanes agreeing on one varying value in divergent code. It's marked `shortcut:`. **Test:** `divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32` (in `wave64_tests.rs`, modelled on `divergent_cross_half_ballot_is_rejected_instead_of_hanging`). It translates on Wave32 and still errors on Emulate, and it fails without the change. All 16 `wave64` tests pass. **Measured in the world (RTX 2080, 8-minute runs, no DRED):** | | before | with the commit | |---|---:|---:| | compute programs refused with `v_readfirstlane in divergent control flow` | 98 | **0** | | draws and dispatches dropped without a host pipeline, per frame | ~1,450 | **~850** | | draws run per frame | ~2,430 | ~2,470 | | device removal / hang | none | none | | frame time (median) | 0.91 s | 0.90 s | The build was JMAN730's fork + #493 + this PR + #206 + #667 + `MIN_DYNAMIC = 1 << 18` (#747) + the render-target guard from my comment on #55, at `VICTORY_SHADER_LOOP_LIMIT=32`. The 3D scene is still black on this card: the G-buffer and its packed attribute targets now hold most of the first playable area, but the lighting chain doesn't show yet. So I can't yet claim the fallback gives correct pixels, only that those programs now translate and run without hanging. The next Wave32 reasons in the same world run, by count of programs: `a lane mask holding lanes elsewhere read as data` (93), `a cross-lane wave operation in divergent control flow` (75, from `exchange_two_halves`), and `a lane-mask join of an untracked mask` (13). *AI-assisted (Claude Code): the change, test, builds and runs were automated. The hardware, title copy and runs are the user's.*
Author
Owner

@⁠erickbobd on GitHub · 2026-11-24 05:12 UTC · original · edited 2026-11-24 12:49 UTC

Following marquezinii's synthetic LDS report, I reproduced stale readbacks on exact d0fd9bf and prepared a cooperative leaf: c60f2b4 (parent is this PR's head).

It fences single-console-wave LDS regions at proven group-uniform joins/exits. Regions with multiple LDS accesses and no safe checkpoint are refused conservatively, including accesses in sibling arms. The native path remains as before. Related alternatives on other stacks: #192 and #439.

Identical synthetic fixtures and readback harness, 20 dispatches per case and mode:

Adapter / mode Wrong readbacks on d0fd9bf Wrong with leaf
RTX 5070 Ti / Wave32 40/80 0/80
RTX 5070 Ti / Emulate 40/80 0/80
WARP (4..4 lanes) / Emulate 8/80 0/80

The two separated writer cases account for all 80/80 wrong RTX readbacks before the fix. Cases also cover a uniform writer, same-block EXEC guards, and a delayed writer. WARP does not support Wave32 here. DXIL inspection confirms 0→2 group-sync LDS barriers in the separated-write cases; the same-block case already had a fence between its store and load.

Permanent LDS tests: 7 passed (including hardware/WARP readbacks); other CPU tests: 46 passed. SDK DXIL validation, cargo clippy -p victory-shader --all-targets -- -D warnings, formatting and asset policy pass. Single-wave synthetic coverage only; gameplay and multi-wave groups remain unverified. No game data or performance measurements.

AI-assisted (Codex). Windows 11 25H2 26200.9974, RTX 5070 Ti / NVIDIA 617.14, Rust 1.98.1, Windows SDK 10.0.26100.0 validator.

A focused follow-up PR is now open directly against @⁠alfycs's branch: https://github.com/alfycs/VIctory/pull/1 (one new commit, two files).

**@⁠erickbobd** on GitHub · 2026-11-24 05:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7122721085) · edited 2026-11-24 12:49 UTC Following [marquezinii's synthetic LDS report](https://git.gtahub.st/github/Marvisak--VIctory/pulls/189), I reproduced stale readbacks on exact `d0fd9bf` and prepared a cooperative leaf: [c60f2b4](https://github.com/erickbobd/VIctory/commit/c60f2b4bf4399e5416169ebf7980148330d48566) (parent is this PR's head). It fences single-console-wave LDS regions at proven group-uniform joins/exits. Regions with multiple LDS accesses and no safe checkpoint are refused conservatively, including accesses in sibling arms. The native path remains as before. Related alternatives on other stacks: #192 and #439. Identical synthetic fixtures and readback harness, 20 dispatches per case and mode: | Adapter / mode | Wrong readbacks on `d0fd9bf` | Wrong with leaf | |---|---:|---:| | RTX 5070 Ti / Wave32 | 40/80 | 0/80 | | RTX 5070 Ti / Emulate | 40/80 | 0/80 | | WARP (4..4 lanes) / Emulate | 8/80 | 0/80 | The two separated writer cases account for all 80/80 wrong RTX readbacks before the fix. Cases also cover a uniform writer, same-block EXEC guards, and a delayed writer. WARP does not support Wave32 here. DXIL inspection confirms 0→2 group-sync LDS barriers in the separated-write cases; the same-block case already had a fence between its store and load. Permanent LDS tests: 7 passed (including hardware/WARP readbacks); other CPU tests: 46 passed. SDK DXIL validation, `cargo clippy -p victory-shader --all-targets -- -D warnings`, formatting and asset policy pass. Single-wave synthetic coverage only; gameplay and multi-wave groups remain unverified. No game data or performance measurements. AI-assisted (Codex). Windows 11 25H2 26200.9974, RTX 5070 Ti / NVIDIA 617.14, Rust 1.98.1, Windows SDK 10.0.26100.0 validator. A focused follow-up PR is now open directly against @⁠alfycs's branch: https://github.com/alfycs/VIctory/pull/1 (one new commit, two files).
Author
Owner

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

Rebased onto origin/main (ffe310e) and updated to b472733 addressing the test reports and follow-up fixes from everyone here:

  • Single-wave split LDS ordering (incorporating alfycs/VIctory#1 from @⁠erickbobd, following @⁠marquezinii's report and checking @⁠r4tedx's same-block EXEC guard pattern): fence single-console-wave LDS regions at proven group-uniform joins/exits and reject unfenceable divergent regions conservatively; uniform blocks already place barriers before guarded LDS accesses. Verified on RTX 3070 Ti + WARP (gpu_single_wave_lds_regions_are_ordered).
  • v_readfirstlane_b32 in divergent flow & empty EXEC (@⁠AKA0GHOST, @⁠NuraadGit, @⁠marquezinii):
    • On Wave32, divergent non-uniform v_readfirstlane now reads each 32-lane half's first active lane without an LDS barrier (covering waterfall loops and removing the main divergent refusal; Emulate still rejects it).
    • Fixed compute_uniformity so unguarded v_mov_b32 copies from uniform sources propagate val_uniform; v_readfirstlane of group-uniform values now passes directly in divergent branches on both Wave32 and Emulate.
    • Fixed emulated_readfirstlane when EXEC == 0 so both Wave32 and Emulate return lane 0's value rather than half 1's lane 0 or 0 (gpu_64_threads_empty_exec_readfirstlane_returns_lane0).
  • DPP shift bounds (@⁠ifBars): clamp src with inside before read_lane/exchange_64 in dpp so out-of-row lanes (0 - 1 on row_shr:1) never pass invalid lane indices to waveReadLaneAt.
  • Test & WARP harness (@⁠dpalacios69, @⁠tanishq-dubey, @⁠ifBars, @⁠r4tedx): shader::emit::host::Host::new(true) now verifies DXGI_ADAPTER_FLAG_SOFTWARE (matching victory-gpu) for Wine/DXVK, recommended_wave64_mode_matches_device_capabilities checks queried adapter capabilities instead of hardcoding Emulate for WARP, and wave64_tests::gpu takes valu_tests::ONE_AT_A_TIME.

Re-verified after rebase + edits (cargo test --workspace --locked: 365 passed, 0 failed, 6 ignored; VICTORY_WARP=1 cargo test -p victory-shader wave64_tests: 22 passed; cargo xtask policy: 155 files ok). Thank you all for the thorough hardware/Wine/WARP reports and PRs!

**@⁠alfycs** on GitHub · 2026-11-24 13:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7132706197) Rebased onto `origin/main` (`ffe310e`) and updated to `b472733` addressing the test reports and follow-up fixes from everyone here: - **Single-wave split LDS ordering** (incorporating `alfycs/VIctory#1` from @⁠erickbobd, following @⁠marquezinii's report and checking @⁠r4tedx's same-block EXEC guard pattern): fence single-console-wave LDS regions at proven group-uniform joins/exits and reject unfenceable divergent regions conservatively; uniform blocks already place barriers before guarded LDS accesses. Verified on RTX 3070 Ti + WARP (`gpu_single_wave_lds_regions_are_ordered`). - **`v_readfirstlane_b32` in divergent flow & empty `EXEC`** (@⁠AKA0GHOST, @⁠NuraadGit, @⁠marquezinii): - On `Wave32`, divergent non-uniform `v_readfirstlane` now reads each 32-lane half's first active lane without an LDS barrier (covering waterfall loops and removing the main divergent refusal; `Emulate` still rejects it). - Fixed `compute_uniformity` so unguarded `v_mov_b32` copies from uniform sources propagate `val_uniform`; `v_readfirstlane` of group-uniform values now passes directly in divergent branches on both `Wave32` and `Emulate`. - Fixed `emulated_readfirstlane` when `EXEC == 0` so both `Wave32` and `Emulate` return lane 0's value rather than half 1's lane 0 or `0` (`gpu_64_threads_empty_exec_readfirstlane_returns_lane0`). - **DPP shift bounds** (@⁠ifBars): clamp `src` with `inside` before `read_lane`/`exchange_64` in `dpp` so out-of-row lanes (`0 - 1` on `row_shr:1`) never pass invalid lane indices to `waveReadLaneAt`. - **Test & WARP harness** (@⁠dpalacios69, @⁠tanishq-dubey, @⁠ifBars, @⁠r4tedx): `shader::emit::host::Host::new(true)` now verifies `DXGI_ADAPTER_FLAG_SOFTWARE` (matching `victory-gpu`) for Wine/DXVK, `recommended_wave64_mode_matches_device_capabilities` checks queried adapter capabilities instead of hardcoding `Emulate` for WARP, and `wave64_tests::gpu` takes `valu_tests::ONE_AT_A_TIME`. Re-verified after rebase + edits (`cargo test --workspace --locked`: 365 passed, 0 failed, 6 ignored; `VICTORY_WARP=1 cargo test -p victory-shader wave64_tests`: 22 passed; `cargo xtask policy`: 155 files ok). Thank you all for the thorough hardware/Wine/WARP reports and PRs!
Author
Owner

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

Title run on an RTX 3070 8 GB (driver 621.14, Windows 11 26300) with b472733 applied on top of my test build: main ffe310e + #89 #493 #483 #189 (d0fd9bf) #206 #469 #454 #704 #688 #352 #346 #489 #709 #650 #571, and MIN_DYNAMIC = 1 << 18 as in #747. Diag build, DRED, loop limit 32; same cache and input as the run just before it without b472733.

  • v_readfirstlane in divergent control flow: 91 programs refused before, 0 with b472733. Six of the programs dropped most in the world now translate and run: 269b802f878c24e1, 4a05640ec16718ad, da1656ad2910e4c7, d3d595d35a4ee7bb, 9b885ee6fdda77f5, d3e44e754b3eb6aa. (b6df66af105d8b2d now stops at a 64-bit image atomic.)
  • New: 49 compute programs refused with LDS accesses without a uniform LDS fence in split wave64. They include the two dropped most often in the world, caa78b8ca62bc3d6 (about 178/frame) and 28918b7150a7aad5 (about 82/frame), which before stopped at buffer_load_ushort; the fence check now comes first for them.
  • Unique untranslated programs over the same stretch: 459 before and after. Part of the readfirstlane group moved to the new LDS-fence refusal.
  • No device removal so far, 2+ minutes in the world.

(AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 13:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7133136545) Title run on an RTX 3070 8 GB (driver 621.14, Windows 11 26300) with `b472733` applied on top of my test build: main `ffe310e` + #89 #493 #483 #189 (`d0fd9bf`) #206 #469 #454 #704 #688 #352 #346 #489 #709 #650 #571, and `MIN_DYNAMIC = 1 << 18` as in #747. Diag build, DRED, loop limit 32; same cache and input as the run just before it without `b472733`. - `v_readfirstlane in divergent control flow`: **91 programs refused before, 0 with `b472733`.** Six of the programs dropped most in the world now translate and run: `269b802f878c24e1`, `4a05640ec16718ad`, `da1656ad2910e4c7`, `d3d595d35a4ee7bb`, `9b885ee6fdda77f5`, `d3e44e754b3eb6aa`. (`b6df66af105d8b2d` now stops at a 64-bit image atomic.) - New: **49 compute programs refused with `LDS accesses without a uniform LDS fence in split wave64`.** They include the two dropped most often in the world, `caa78b8ca62bc3d6` (about 178/frame) and `28918b7150a7aad5` (about 82/frame), which before stopped at `buffer_load_ushort`; the fence check now comes first for them. - Unique untranslated programs over the same stretch: 459 before and after. Part of the readfirstlane group moved to the new LDS-fence refusal. - No device removal so far, 2+ minutes in the world. (AI-assisted test run.)
Author
Owner

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

Follow-up to my run above (same build, b472733 applied, RTX 3070): the four instance-culling compute programs @⁠timorjay checks on #439 are all refused here.

program refusal with #189 b472733
fdd56d97a806bcca (props) a cross-lane wave operation in divergent control flow (at 0x724)
17af15c4015cb4b6 (props) a cross-lane wave operation in divergent control flow (at 0x2ab4)
55679a0547649d0b (trees, 512 B LDS) LDS accesses without a uniform LDS fence in split wave64 (at 0x2e80)
89d08e561897d4e5 (trees, 512 B LDS) LDS accesses without a uniform LDS fence in split wave64 (at 0x2a18)

On #439 (c153b21, which includes #233) with #704, timorjay reports all four emitting a 32-lane module that validates and gets a D3D12 compute pipeline on an RTX 5090 D. In my runs with this PR, character geometry reaches the G-buffer while props and buildings don't, which would fit these four being refused. That's an inference, not something I've measured directly. Since they're the programs that pick which world instances get drawn, they may be worth prioritising for the split path.

(AI-assisted.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 13:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7133197528) Follow-up to my run above (same build, `b472733` applied, RTX 3070): the four instance-culling compute programs @⁠timorjay checks on #439 are all refused here. | program | refusal with #189 `b472733` | |---|---| | `fdd56d97a806bcca` (props) | `a cross-lane wave operation in divergent control flow` (at `0x724`) | | `17af15c4015cb4b6` (props) | `a cross-lane wave operation in divergent control flow` (at `0x2ab4`) | | `55679a0547649d0b` (trees, 512 B LDS) | `LDS accesses without a uniform LDS fence in split wave64` (at `0x2e80`) | | `89d08e561897d4e5` (trees, 512 B LDS) | `LDS accesses without a uniform LDS fence in split wave64` (at `0x2a18`) | On #439 (`c153b21`, which includes #233) with #704, timorjay reports all four emitting a 32-lane module that validates and gets a D3D12 compute pipeline on an RTX 5090 D. In my runs with this PR, character geometry reaches the G-buffer while props and buildings don't, which would fit these four being refused. That's an inference, not something I've measured directly. Since they're the programs that pick which world instances get drawn, they may be worth prioritising for the split path. (AI-assisted.)
Author
Owner

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

@⁠Sil3ntGam3r Thanks for testing b472733 right away! The v_readfirstlane drop (91 -> 0) is great to see.

Just pushed c047885 on top of b472733 to fix two false positives in plan_lds_fences:

  1. total_threads <= 32 in Wave32: groups of <= 32 threads run inside a single native 32-lane wave, so they no longer enter need_lds_barriers / plan_lds_fences.
  2. Pure ds_read* chains/loops in divergent code: plan_lds_fences previously treated every Fields::Ds op identically, rejecting multiple pure ds_read* instructions in a divergent branch or loop even when no ds_write / atomic exists in that region. Separating ds_is_write lets divergent read-only regions pass while still rejecting RAW/WAW/WAR pairs (divergent_multiple_lds_reads_without_writes_succeed).

For the 4 instance-culling shaders (fdd56d97, 17af15c4 hitting divergent exchange_two_halves, and 55679a05, 89d08e56 if they perform divergent LDS writes/atomics + reads): true cross-half execution inside divergent branches requires lockstep/console-flow execution (as in #233 / #439), which stays outside the split-barrier model here.

**@⁠alfycs** on GitHub · 2026-11-24 13:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7133344585) @⁠Sil3ntGam3r Thanks for testing `b472733` right away! The `v_readfirstlane` drop (`91 -> 0`) is great to see. Just pushed `c047885` on top of `b472733` to fix two false positives in `plan_lds_fences`: 1. **`total_threads <= 32` in `Wave32`:** groups of `<= 32` threads run inside a single native 32-lane wave, so they no longer enter `need_lds_barriers` / `plan_lds_fences`. 2. **Pure `ds_read*` chains/loops in divergent code:** `plan_lds_fences` previously treated every `Fields::Ds` op identically, rejecting multiple pure `ds_read*` instructions in a divergent branch or loop even when no `ds_write` / atomic exists in that region. Separating `ds_is_write` lets divergent read-only regions pass while still rejecting RAW/WAW/WAR pairs (`divergent_multiple_lds_reads_without_writes_succeed`). For the 4 instance-culling shaders (`fdd56d97`, `17af15c4` hitting divergent `exchange_two_halves`, and `55679a05`, `89d08e56` if they perform divergent LDS writes/atomics + reads): true cross-half execution inside divergent branches requires lockstep/console-flow execution (as in `#233` / `#439`), which stays outside the split-barrier model here.
Author
Owner

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

For @⁠Kam471 and anyone testing Wave64 mesh shaders alongside this PR (see #778): pushed a stacked follow-up branch alfycs/VIctory@feat/wave64-mesh-emulation (b3671c8 on top of c047885).

It extends portable 64-lane LDS emulation (Wave64Mode::Emulate + MaskData::Console, no WaveSize) to StageIo::Ms Wave64 mesh programs when they use masks read as data (s_bcnt1/s_ff1/v_mbcnt), v_readlane/v_writelane, non-quad swizzles/DPP, wave reductions, or non-uniform v_readfirstlane (with per-half fallback in divergent Wave32), verified with Windows SDK dxil.dll and live 128-thread DispatchMesh GPU tests on RTX 3070 Ti and WARP (27/27 wave64_tests, 370 workspace tests passing).

**@⁠alfycs** on GitHub · 2026-11-24 14:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7133702369) For @⁠Kam471 and anyone testing Wave64 mesh shaders alongside this PR (see #778): pushed a stacked follow-up branch [`alfycs/VIctory@feat/wave64-mesh-emulation`](https://github.com/alfycs/VIctory/tree/feat/wave64-mesh-emulation) (`b3671c8` on top of `c047885`). It extends portable 64-lane LDS emulation (`Wave64Mode::Emulate` + `MaskData::Console`, no `WaveSize`) to `StageIo::Ms` Wave64 mesh programs when they use masks read as data (`s_bcnt1`/`s_ff1`/`v_mbcnt`), `v_readlane`/`v_writelane`, non-quad swizzles/DPP, wave reductions, or non-uniform `v_readfirstlane` (with per-half fallback in divergent `Wave32`), verified with Windows SDK `dxil.dll` and live 128-thread `DispatchMesh` GPU tests on RTX 3070 Ti and WARP (27/27 `wave64_tests`, 370 workspace tests passing).
Author
Owner

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

@⁠alfycs Wave64 rebase check on GTX 1660 Ti.

I reproduced the old conflict with git merge-tree on #189 d0fd9bf and main ffe310e; Git reports conflicts in emit/mod.rs and resource.rs. Current #189 head c047885 descends from ffe310e via 64dee8b, b472733, and c047885, so it fast-forwards. I used the updated head as-is. In emit/mod.rs, main still structures the program before per-lane descriptor tracking and passes the Wave64 option to emit_with. In resource.rs, structured control flow remains available to the descriptor tracer and the spill resolver is reused. The waterfall test module remains registered.

On Windows 10 22H2, GTX 1660 Ti, NVIDIA 581.42 and Agility SDK 1.620.2, the test required physical NVIDIA LUID 00000000:00017c52 and 32–32 wave lanes. A module sample confirmed the local D3D12Core.dll. All 23 Wave64 tests passed, including 11 hardware tests comparing exact per-lane readbacks in both Wave32 and Emulate modes. These cover cross-half ballot and lane reads, partial waves, SGPR spills, DPP, empty EXEC and LDS ordering. All five upstream waterfall tests passed with the hardware path active. Their WARP subcases skipped because SM 6.6 WARP was unavailable.

One semantic limitation remains in emulated_readfirstlane. In divergent control flow on Wave32, a non-uniform v_readfirstlane can select the first active lane of each half. If both halves are active and their first values differ, the upper half can observe a different value from the Wave64 first active lane. Divergent cross-half operations and LDS hazards without a safe uniform fence can also be refused. Exact support for the general divergent case needs a separate algorithm change and a two-active-halves regression case.

The prologue reproduces the four instance-culling refusals discussed earlier on c047885 with #493, #206 and #638 head 99b6afc. fdd56d97 and 17af15c4 stop on divergent cross-lane operations. 55679a05 and 89d08e56 stop on LDS access without a uniform fence. Character geometry appeared in the diagnostic target. That visual result alone cannot identify which missing draws these refusals caused.

Testing and report were assisted by OpenAI Codex (GPT-6).

**@⁠erLCoder** on GitHub · 2026-11-24 14:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7134697253) @⁠alfycs Wave64 rebase check on GTX 1660 Ti. I reproduced the old conflict with `git merge-tree` on #189 `d0fd9bf` and main `ffe310e`; Git reports conflicts in `emit/mod.rs` and `resource.rs`. Current #189 head `c047885` descends from `ffe310e` via `64dee8b`, `b472733`, and `c047885`, so it fast-forwards. I used the updated head as-is. In `emit/mod.rs`, main still structures the program before per-lane descriptor tracking and passes the Wave64 option to `emit_with`. In `resource.rs`, structured control flow remains available to the descriptor tracer and the spill resolver is reused. The waterfall test module remains registered. On Windows 10 22H2, GTX 1660 Ti, NVIDIA 581.42 and Agility SDK 1.620.2, the test required physical NVIDIA LUID `00000000:00017c52` and 32–32 wave lanes. A module sample confirmed the local D3D12Core.dll. All 23 Wave64 tests passed, including 11 hardware tests comparing exact per-lane readbacks in both Wave32 and Emulate modes. These cover cross-half ballot and lane reads, partial waves, SGPR spills, DPP, empty EXEC and LDS ordering. All five upstream waterfall tests passed with the hardware path active. Their WARP subcases skipped because SM 6.6 WARP was unavailable. One semantic limitation remains in `emulated_readfirstlane`. In divergent control flow on Wave32, a non-uniform `v_readfirstlane` can select the first active lane of each half. If both halves are active and their first values differ, the upper half can observe a different value from the Wave64 first active lane. Divergent cross-half operations and LDS hazards without a safe uniform fence can also be refused. Exact support for the general divergent case needs a separate algorithm change and a two-active-halves regression case. The prologue reproduces the four instance-culling refusals discussed earlier on `c047885` with #493, #206 and #638 head `99b6afc`. `fdd56d97` and `17af15c4` stop on divergent cross-lane operations. `55679a05` and `89d08e56` stop on LDS access without a uniform fence. Character geometry appeared in the diagnostic target. That visual result alone cannot identify which missing draws these refusals caused. Testing and report were assisted by OpenAI Codex (GPT-6).
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-24 15:06 UTC · original

Real-title feedback: it clears the pipeline refusals outright, with two costs worth knowing

Measured on a 4070 SUPER / Windows 10 build that carries #729 (Agility) + #89 core + this branch, Series X,
diag profile, same host for both trees.

The gain is exactly what the PR promises. Every compute pipeline the title asked for was being refused:

counter without #189 with #189
host pipeline refused (E_INVALIDARG) 97 (all compute) 0
host root signature refused — 0

So CreateComputePipelineState no longer rejects wave64 compute on this 32-lane host. That part is clean.

Cost 1 — 26 new translator failures on the offline corpus (26,084 programs): 14 × "LDS accesses without a
uniform LDS fence in split wave64" and 12 × "a cross-lane wave operation in divergent control flow". Those
programs used to translate (to code that would have been refused at PSO creation, so this may be a fair trade)
— but it means emission counts measured with #189 are not comparable with counts measured without it, and it
would help if the PR body said so.

Cost 2 — and this is the one that matters here: the world stops drawing. Comparing 2560×1440 world draws
(the title's six-target world pass) at the same load stage:

tree 2560×1440 world draws total traced draws
ffe310e + #729 + #89 232 997
+ #189 (then #940, then mip-drop) 0 94

With #189 the run reaches far more presented frames (1500–3200 vs ~1400) and no pipeline is refused any more,
but the world pass never executes again — the title appears to stall earlier in its load, before the first world
draw. Our best guess is a fence/barrier semantic difference from the emulation (the title waiting on something
that never completes), but we have not proven it, and it could equally be an interaction with the other
branches on our tree.

Not measured: which of the four changes on our tree is responsible — we have not bisected #189 alone against the
rest. If you can run the same 232-vs-0 comparison on a tree with #189 only, that would settle it quickly.

**@⁠bittertea0323** on GitHub · 2026-11-24 15:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7135463913) ## Real-title feedback: it clears the pipeline refusals outright, with two costs worth knowing Measured on a 4070 SUPER / Windows 10 build that carries `#729` (Agility) + `#89` core + this branch, Series X, diag profile, same host for both trees. **The gain is exactly what the PR promises.** Every compute pipeline the title asked for was being refused: | counter | without #189 | with #189 | |---|---|---| | `host pipeline refused (E_INVALIDARG)` | 97 (all compute) | **0** | | `host root signature refused` | — | 0 | So `CreateComputePipelineState` no longer rejects wave64 compute on this 32-lane host. That part is clean. **Cost 1 — 26 new translator failures** on the offline corpus (26,084 programs): 14 × "LDS accesses without a uniform LDS fence in split wave64" and 12 × "a cross-lane wave operation in divergent control flow". Those programs used to translate (to code that would have been refused at PSO creation, so this may be a fair trade) — but it means emission counts measured with #189 are not comparable with counts measured without it, and it would help if the PR body said so. **Cost 2 — and this is the one that matters here: the world stops drawing.** Comparing 2560×1440 world draws (the title's six-target world pass) at the same load stage: | tree | 2560×1440 world draws | total traced draws | |---|---|---| | `ffe310e` + #729 + #89 | **232** | 997 | | + #189 (then #940, then mip-drop) | **0** | 94 | With #189 the run reaches far more presented frames (1500–3200 vs ~1400) and no pipeline is refused any more, but the world pass never executes again — the title appears to stall earlier in its load, before the first world draw. Our best guess is a fence/barrier semantic difference from the emulation (the title waiting on something that never completes), but we have not proven it, and it could equally be an interaction with the other branches on our tree. Not measured: which of the four changes on our tree is responsible — we have not bisected #189 alone against the rest. If you can run the same 232-vs-0 comparison on a tree with #189 only, that would settle it quickly.
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-24 15:22 UTC · original

Wave32 is chosen on NVIDIA and does not renumber lanes: the world never draws. Emulate does.

Measured on a 4070 SUPER (32-lane only) with #729 + our diag build, Series X, three runs of the same
binary, differing only in VICTORY_WAVE64_EMULATE:

mode world draws/frame presented frames result
Wave32 (what recommended_wave64_mode picks on NVIDIA) 10 1731 world never starts
Emulate (forced) 1600–1863, of which 1200–1738 indirect 1962 world renders, 0.8 fps

#189 removes the E_INVALIDARG on CreateComputePipelineState in both modes — 97 refusals → 0.
The PSO half of the problem is solved either way. What differs is behaviour:

  • Wave32: a wave64 program is emitted with WaveSize(32) and runs as two host waves, but lane
    numbering is not remapped. Anything crossing lanes (ballot, readfirstlane, LDS exchange, DPP)
    computes on the wrong lanes. GTA VI's world load is almost entirely such compute (meshlet culling,
    light and shadow passes), so the title's own gating never passes and the world pass is never
    submitted: a steady 10 draws/frame for the whole run, with no error to explain it.
  • Emulate: the same programs run with the emulation scratch and lane remapping, and the world
    pass executes — 1600–1863 draws/frame at 0.8 fps (1066–1281 ms/frame), with 196–203 pipelines still
    being compiled at any moment, which is what the dropped … (N being made) counters show.

Two suggestions, in order of expected value:

  1. recommended_wave64_mode prefers Wave32 whenever the device reports wave32 support. For a wave64
    title that is the wrong default: it makes PSOs legal while producing wrong results, which is the
    most expensive failure mode to debug — we lost hours chasing descriptor and mesh bugs that were
    this. Prefer Emulate for wave64 programs, or at minimum log loudly that the cheap mode is in use.
  2. Wave32 may still be right for programs that provably never cross lanes; detecting that would
    recover much of Emulate's cost for the rest.

Not measured: whether the 196–203 in-flight pipelines are a throughput limit or a per-program cost;
and whether the remaining dropped draws are purely "pipeline not ready" or partly the indirect path
(#255's rectangle/indirect gap), since 1200–1738 indirect draws are also counted as dropped.

**@⁠bittertea0323** on GitHub · 2026-11-24 15:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7135911547) ## Wave32 is chosen on NVIDIA and does not renumber lanes: the world never draws. Emulate does. Measured on a 4070 SUPER (32-lane only) with `#729` + our diag build, Series X, three runs of the same binary, differing only in `VICTORY_WAVE64_EMULATE`: | mode | world draws/frame | presented frames | result | |---|---|---|---| | `Wave32` (what `recommended_wave64_mode` picks on NVIDIA) | **10** | 1731 | world never starts | | `Emulate` (forced) | **1600–1863**, of which 1200–1738 indirect | 1962 | world renders, 0.8 fps | `#189` removes the `E_INVALIDARG` on `CreateComputePipelineState` in **both** modes — 97 refusals → 0. The PSO half of the problem is solved either way. What differs is behaviour: - **`Wave32`**: a wave64 program is emitted with `WaveSize(32)` and runs as two host waves, but lane numbering is not remapped. Anything crossing lanes (ballot, `readfirstlane`, LDS exchange, DPP) computes on the wrong lanes. GTA VI's world load is almost entirely such compute (meshlet culling, light and shadow passes), so the title's own gating never passes and the world pass is never submitted: a steady 10 draws/frame for the whole run, with no error to explain it. - **`Emulate`**: the same programs run with the emulation scratch and lane remapping, and the world pass executes — 1600–1863 draws/frame at 0.8 fps (1066–1281 ms/frame), with 196–203 pipelines still being compiled at any moment, which is what the `dropped … (N being made)` counters show. Two suggestions, in order of expected value: 1. `recommended_wave64_mode` prefers `Wave32` whenever the device reports wave32 support. For a wave64 title that is the wrong default: it makes PSOs legal while producing wrong results, which is the most expensive failure mode to debug — we lost hours chasing descriptor and mesh bugs that were this. Prefer `Emulate` for wave64 programs, or at minimum log loudly that the cheap mode is in use. 2. `Wave32` may still be right for programs that provably never cross lanes; detecting that would recover much of Emulate's cost for the rest. Not measured: whether the 196–203 in-flight pipelines are a throughput limit or a per-program cost; and whether the remaining `dropped` draws are purely "pipeline not ready" or partly the indirect path (#255's rectangle/indirect gap), since 1200–1738 indirect draws are also counted as dropped.
Author
Owner

@⁠alfycs on GitHub · 2026-11-24 15:23 UTC · original · edited 2026-11-24 15:26 UTC

Thanks @erLCoder and @bittertea0323 for the hardware tests, corpus deltas, and the Wave32 vs Emulate comparison on c047885.

On emulated_readfirstlane in divergent control flow (@erLCoder)

We audited emulated_readfirstlane in crates/victory-shader/src/emit/lower.rs: your analysis is right for the case where both 32-lane halves are active in divergent control flow with differing first active lane values. In Wave32, independent hardware warps cannot meet at barrier(1 | 8) inside divergent flow without deadlocking, so commit b472733 used the per-half fallback in Wave32 (covered by divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32) while keeping ShaderError::Unsupported in Emulate.

On Cost 1 (+26 refusals) and Wave32 vs Emulate (@bittertea0323)

  1. PR body updated (Cost 1): We updated the PR description with a Trade-offs & Known Limitations section documenting that clearing 97 -> 0 CreateComputePipelineState E_INVALIDARG rejections came with +26 offline translator refusals on the 26,084-program corpus (14× "LDS accesses without a uniform LDS fence in split wave64" and 12× "a cross-lane wave operation in divergent control flow").
  2. Wave32 (10 draws) vs Emulate (1600–1863 draws): Saw your follow-up measurement confirming it is specifically Wave32 vs Emulate on the same binary rather than #940 / mip-drop. Looking at every branch where Wave32 diverges from Emulate in lower.rs:
    • emulated_readfirstlane (Wave32 allows divergent per-half reads, whereas Emulate refuses)
    • ds_swizzle_b32 / DPP (Wave32 uses waveReadLaneAt without checking divergence, whereas Emulate uses exchange_64 and refuses divergent cross-lane reads)
    • <= 32-thread shaders (Wave32 runs natively without emulating_wave64(), where waveReadLaneFirst does not apply an instruction guard)
    • Note that Emulate already leaves shaders with !need_emu (!console_lanes && sections.is_empty() && !has_non_uniform_firstlane) as native (wave_size = None without scratch LDS exchange). We are reviewing whether to default recommended_wave64_mode on < 64-lane hosts to Emulate (keeping Wave32 opt-in via VICTORY_WAVE64_EMULATE=wave32) and tighten Wave32's divergent checks.
**@⁠alfycs** on GitHub · 2026-11-24 15:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7135945997) · edited 2026-11-24 15:26 UTC Thanks `@erLCoder` and `@bittertea0323` for the hardware tests, corpus deltas, and the `Wave32` vs `Emulate` comparison on `c047885`. ### On `emulated_readfirstlane` in divergent control flow (`@erLCoder`) We audited `emulated_readfirstlane` in [`crates/victory-shader/src/emit/lower.rs`](https://github.com/alfycs/VIctory/blob/c047885/crates/victory-shader/src/emit/lower.rs#L1478-L1507): your analysis is right for the case where both 32-lane halves are active in divergent control flow with differing first active lane values. In `Wave32`, independent hardware warps cannot meet at `barrier(1 | 8)` inside divergent flow without deadlocking, so commit `b472733` used the per-half fallback in `Wave32` (covered by `divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32`) while keeping `ShaderError::Unsupported` in `Emulate`. ### On `Cost 1` (+26 refusals) and `Wave32` vs `Emulate` (`@bittertea0323`) 1. **PR body updated (`Cost 1`)**: We updated the PR description with a **Trade-offs & Known Limitations** section documenting that clearing `97 -> 0` `CreateComputePipelineState` `E_INVALIDARG` rejections came with `+26` offline translator refusals on the 26,084-program corpus (`14`× `"LDS accesses without a uniform LDS fence in split wave64"` and `12`× `"a cross-lane wave operation in divergent control flow"`). 2. **`Wave32` (10 draws) vs `Emulate` (1600–1863 draws)**: Saw your follow-up measurement confirming it is specifically `Wave32` vs `Emulate` on the same binary rather than `#940` / `mip-drop`. Looking at every branch where `Wave32` diverges from `Emulate` in `lower.rs`: - `emulated_readfirstlane` (`Wave32` allows divergent per-half reads, whereas `Emulate` refuses) - `ds_swizzle_b32` / `DPP` (`Wave32` uses `waveReadLaneAt` without checking divergence, whereas `Emulate` uses `exchange_64` and refuses divergent cross-lane reads) - `<= 32`-thread shaders (`Wave32` runs natively without `emulating_wave64()`, where `waveReadLaneFirst` does not apply an instruction `guard`) - Note that `Emulate` already leaves shaders with `!need_emu` (`!console_lanes && sections.is_empty() && !has_non_uniform_firstlane`) as native (`wave_size = None` without scratch LDS exchange). We are reviewing whether to default `recommended_wave64_mode` on `< 64`-lane hosts to `Emulate` (keeping `Wave32` opt-in via `VICTORY_WAVE64_EMULATE=wave32`) and tighten `Wave32`'s divergent checks.
Author
Owner

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

Pushed 54b333f to switch recommended_wave64_mode (in both victory-shader::emit::host and victory-gpu::host) to default < 64-lane hosts to Wave64Mode::Emulate instead of Wave64Mode::Wave32, addressing @bittertea0323's Wave32 (10 draws) vs Emulate (1600–1863 draws) finding and @erLCoder's divergent emulated_readfirstlane concern on the default path.

  • Non-lane-dependent shaders (!need_emu) still remain native (wave_size = None, zero scratch LDS) under Emulate.
  • Wave32 remains opt-in via VICTORY_WAVE64_EMULATE=wave32 (and tested in wave64_tests).
  • Verified on 54b333f: cargo xtask policy (155 files ok), cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated (0 errors/warnings), victory-shader wave64 tests (26/26 on hardware and 26/26 with VICTORY_WARP=1), and victory-gpu (50 passed, 0 failed, 1 ignored).
**@⁠alfycs** on GitHub · 2026-11-24 15:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7136145417) Pushed `54b333f` to switch `recommended_wave64_mode` (in both `victory-shader::emit::host` and `victory-gpu::host`) to default `< 64`-lane hosts to `Wave64Mode::Emulate` instead of `Wave64Mode::Wave32`, addressing `@bittertea0323`'s `Wave32` (10 draws) vs `Emulate` (1600–1863 draws) finding and `@erLCoder`'s divergent `emulated_readfirstlane` concern on the default path. - Non-lane-dependent shaders (`!need_emu`) still remain native (`wave_size = None`, zero scratch LDS) under `Emulate`. - `Wave32` remains opt-in via `VICTORY_WAVE64_EMULATE=wave32` (and tested in `wave64_tests`). - Verified on `54b333f`: `cargo xtask policy` (`155 files ok`), `cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated` (0 errors/warnings), `victory-shader` `wave64` tests (`26/26` on hardware and `26/26` with `VICTORY_WARP=1`), and `victory-gpu` (`50 passed, 0 failed, 1 ignored`).
Author
Owner

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

@⁠bittertea0323 A data point for your 232-vs-0 question: on my tree, the world pass runs with #189.

Tree: RTX 3070 8 GB, driver 621.14, Windows 11 (26300), Series X mode, diag build. Main ffe310e + #89 #493 #483 #189 (d0fd9bf with b472733 applied) #206 #469 #454 #704 #688 #352 #346 #489 #709 (with #294) #650 #571, and in the second run also #431 and #876's change. No #729 and no #940.

What I measured: a local diagnostics view that presents the render target most draws went to since the last present, limited to 8-bit RGBA targets at least 1280 wide. In two runs it switched to a 2560×1440 target as the title entered the world, with 2042 and 2088 draws into that one target in that frame.

  • Characters render into it with their textures, so the world pass executes and writes its G-buffer.
  • The window reported about 3,600 draws per frame in the world.
  • 0 host pipelines refused.
  • The four instance-culling programs were bound at world entry (frame 2211 and 1400), but they are among the programs #189 refuses (divergent cross-lane and the LDS fence), so props and buildings are missing.

This isn't the same count as yours: it's draws into one target, not your six-target pass. But it does show that #189 on its own doesn't keep the title from reaching the world pass here. The difference from your tree is #729 and #940 (plus mip-drop), which mine doesn't have, so those would be the first to bisect.

(AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 15:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7136146864) @⁠bittertea0323 A data point for your 232-vs-0 question: on my tree, the world pass runs with #189. **Tree:** RTX 3070 8 GB, driver 621.14, Windows 11 (26300), Series X mode, diag build. Main `ffe310e` + #89 #493 #483 #189 (`d0fd9bf` with `b472733` applied) #206 #469 #454 #704 #688 #352 #346 #489 #709 (with #294) #650 #571, and in the second run also #431 and #876's change. No #729 and no #940. **What I measured:** a local diagnostics view that presents the render target most draws went to since the last present, limited to 8-bit RGBA targets at least 1280 wide. In two runs it switched to a 2560×1440 target as the title entered the world, with 2042 and 2088 draws into that one target in that frame. - Characters render into it with their textures, so the world pass executes and writes its G-buffer. - The window reported about 3,600 draws per frame in the world. - 0 host pipelines refused. - The four instance-culling programs were bound at world entry (frame 2211 and 1400), but they are among the programs #189 refuses (divergent cross-lane and the LDS fence), so props and buildings are missing. This isn't the same count as yours: it's draws into one target, not your six-target pass. But it does show that #189 on its own doesn't keep the title from reaching the world pass here. The difference from your tree is #729 and #940 (plus mip-drop), which mine doesn't have, so those would be the first to bisect. (AI-assisted test run.)
Author
Owner

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

Independent run: 144 passed, with a DXIL validator loaded

Not the author. Applied this PR's diff on main ffe310e; it applies cleanly. Machine: Windows 11 26300, Ryzen 9 7940HX, RTX 4060 Laptop GPU (D3D12 wave range 32..32, driver 32.0.16.1714) with a Radeon 610M iGPU (32..64) also present. Rust 1.98.1, x86_64-pc-windows-gnu (MinGW, not MSVC), so this is not CI parity.

  • cargo test -p victory-shader --lib: 144 passed, 0 failed, 1 ignored, run serially.
  • The 23 wave64_tests pass: the gpu::* ones dispatch on the default device (the 4060) in both Wave32 and Emulate, and on WARP, and the lane results are as expected.
  • Validator: I installed DXC's validator from the Microsoft.Direct3D.DXC NuGet package (dxil.dll 1.8.2505.32; its DxcCreateInstance export loads) and set VICTORY_DXIL. With it active the same 144 pass, so every module these tests emit validates before it is dispatched.

Not verified: no game files, so no title run and no --host-lanes census; the Radeon was not used as a 64-lane reference here, since these tests take the default device and WARP; nothing about world rendering.

**@⁠yuruiwang233** on GitHub · 2026-11-24 15:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7136333293) **Independent run: 144 passed, with a DXIL validator loaded** Not the author. Applied this PR's diff on `main` `ffe310e`; it applies cleanly. Machine: Windows 11 26300, Ryzen 9 7940HX, **RTX 4060 Laptop GPU** (D3D12 wave range 32..32, driver 32.0.16.1714) with a **Radeon 610M** iGPU (32..64) also present. Rust 1.98.1, `x86_64-pc-windows-gnu` (MinGW, not MSVC), so this is not CI parity. - `cargo test -p victory-shader --lib`: 144 passed, 0 failed, 1 ignored, run serially. - The 23 `wave64_tests` pass: the `gpu::*` ones dispatch on the default device (the 4060) in both `Wave32` and `Emulate`, and on WARP, and the lane results are as expected. - Validator: I installed DXC's validator from the `Microsoft.Direct3D.DXC` NuGet package (dxil.dll 1.8.2505.32; its `DxcCreateInstance` export loads) and set `VICTORY_DXIL`. With it active the same 144 pass, so every module these tests emit validates before it is dispatched. Not verified: no game files, so no title run and no `--host-lanes` census; the Radeon was not used as a 64-lane reference here, since these tests take the default device and WARP; nothing about world rendering.
Author
Owner

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

@⁠alfycs a title run with 54b333f, and a correction to my comment above: those two runs were in Wave32 mode (the log says wave64_mode=Wave32), the default on NVIDIA before 54b333f.

Same tree as in that comment, now with c047885 and 54b333f on top (cherry-picked after b472733); all 410 tests pass. RTX 3070, driver 621.14, Series X. The log confirms wave64_mode=Emulate.

Wave32 (b472733) Emulate (54b333f)
unique programs not translated 471 522
v_readfirstlane in divergent control flow 0 73
a cross-lane wave operation in divergent control flow 54 0
a 64-lane wave ballot in divergent control flow 0 39
LDS accesses without a uniform LDS fence in split wave64 46 39
world entry (first bind of the four culling programs) frame 1400 frame 1634
frame time in the world about 6.5 s 6.4–7 s
  • The four instance-culling programs are still refused in Emulate, at the same offsets as in Wave32:
    • fdd56d97a806bcca (at 0x724) and 17af15c4015cb4b6 (at 0x2ab4): "a 64-lane wave ballot in divergent control flow" (in Wave32, "a cross-lane wave operation in divergent control flow").
    • 55679a0547649d0b (at 0x2e80) and 89d08e561897d4e5 (at 0x2a18): the LDS fence, in both modes.
  • On screen it's the same as Wave32: characters reach the G-buffer, and props and buildings don't. I checked the dumped full-screen targets, not only the debug view.
  • The 73 divergent v_readfirstlane refusals are the ones you describe keeping as Unsupported in Emulate. So on this title Emulate trades Wave32's per-half first lane for a refusal, and the net count goes up by 51.

This doesn't contradict @⁠bittertea0323's 10 vs 1600–1863 draws: my Wave32 runs reached the world pass too, so whatever stalls their Wave32 run doesn't happen on my tree. On the #439 stack the same four programs translate and scenery reaches the G-buffer, so for this title the divergent ballot and LDS-fence cases in those four look like what keeps the world empty on this path.

(AI-assisted test run.)

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 15:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7136931571) @⁠alfycs a title run with `54b333f`, and a correction to my comment above: those two runs were in Wave32 mode (the log says `wave64_mode=Wave32`), the default on NVIDIA before `54b333f`. Same tree as in that comment, now with `c047885` and `54b333f` on top (cherry-picked after `b472733`); all 410 tests pass. RTX 3070, driver 621.14, Series X. The log confirms `wave64_mode=Emulate`. | | Wave32 (`b472733`) | Emulate (`54b333f`) | |---|---|---| | unique programs not translated | 471 | 522 | | v_readfirstlane in divergent control flow | 0 | 73 | | a cross-lane wave operation in divergent control flow | 54 | 0 | | a 64-lane wave ballot in divergent control flow | 0 | 39 | | LDS accesses without a uniform LDS fence in split wave64 | 46 | 39 | | world entry (first bind of the four culling programs) | frame 1400 | frame 1634 | | frame time in the world | about 6.5 s | 6.4–7 s | - **The four instance-culling programs are still refused in Emulate, at the same offsets as in Wave32:** - `fdd56d97a806bcca` (at `0x724`) and `17af15c4015cb4b6` (at `0x2ab4`): "a 64-lane wave ballot in divergent control flow" (in Wave32, "a cross-lane wave operation in divergent control flow"). - `55679a0547649d0b` (at `0x2e80`) and `89d08e561897d4e5` (at `0x2a18`): the LDS fence, in both modes. - **On screen it's the same as Wave32:** characters reach the G-buffer, and props and buildings don't. I checked the dumped full-screen targets, not only the debug view. - The 73 divergent `v_readfirstlane` refusals are the ones you describe keeping as Unsupported in Emulate. So on this title Emulate trades Wave32's per-half first lane for a refusal, and the net count goes up by 51. This doesn't contradict @⁠bittertea0323's 10 vs 1600–1863 draws: my Wave32 runs reached the world pass too, so whatever stalls their Wave32 run doesn't happen on my tree. On the #439 stack the same four programs translate and scenery reaches the G-buffer, so for this title the divergent ballot and LDS-fence cases in those four look like what keeps the world empty on this path. (AI-assisted test run.)
Author
Owner

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

Ran this PR's tests (54b333f) next to #439 and #734's branch on an RTX 4060 Laptop: all 144 pass on the NVIDIA GPU, the 26 wave64_tests included. Comparison and coverage table in #1132.

Two things about the harness:

  • Host::new(false) creates the device on adapter 0. On a hybrid laptop that is the iGPU, so without a local change these tests ran on the Intel UHD here, not the RTX 4060. Choosing the adapter with IDXGIFactory6::EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE) would default to the discrete GPU. This is on main too, so not this PR's doing, but it matters for anyone reporting results for a 32-lane GPU from a laptop.
  • wave64_tests::with_hosts keeps Host::new(..).ok() and run_on_hosts skips None with continue. Where device creation fails, the GPU tests pass without running anything and print nothing. A line on stderr, or a failure when neither host exists, would make that visible.
**@⁠N7z** on GitHub · 2026-11-24 16:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7137061668) Ran this PR's tests (`54b333f`) next to #439 and #734's branch on an RTX 4060 Laptop: all 144 pass on the NVIDIA GPU, the 26 `wave64_tests` included. Comparison and coverage table in #1132. Two things about the harness: - `Host::new(false)` creates the device on adapter 0. On a hybrid laptop that is the iGPU, so without a local change these tests ran on the Intel UHD here, not the RTX 4060. Choosing the adapter with `IDXGIFactory6::EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE)` would default to the discrete GPU. This is on `main` too, so not this PR's doing, but it matters for anyone reporting results for a 32-lane GPU from a laptop. - `wave64_tests::with_hosts` keeps `Host::new(..).ok()` and `run_on_hosts` skips `None` with `continue`. Where device creation fails, the GPU tests pass without running anything and print nothing. A line on stderr, or a failure when neither host exists, would make that visible.
Author
Owner

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

@⁠alfycs @⁠bittertea0323 On the new Emulate default: on an RTX 2080 the world pass runs in Wave32, in every world run I have with it. That matches @⁠Sil3ntGam3r's 3070.

RTX 2080, driver 616.56, Series X. The log says wave64_mode=Wave32. Head d0fd9bf; from the third row on also my divergent v_readfirstlane fallback (7425674, the one you took) and a similar local one for reductions. Medians over the second half of each world run:

stack draws/frame dropped, no host pipeline dropped indirect programs refused
d2a4bae + #493 + #189 + #206 (21-min run) 1,889 1,647 1,699 536
JMAN730's fork + the same, 2^18 slots (#747) 2,262 1,814 1,007 430
+ #667, divergent fallbacks (3 runs) 2,386–2,408 845–891 922–953 383–390
+ #704 2,436 704 876 343
+ #878 2,830 706 483 325

No device removal in any of these runs, and from the second row on the G-buffer gets scene geometry. I haven't run Emulate.

On "Wave32 doesn't renumber lanes": it does, also at 54b333f. In ensure_wave_ids the thread id is (waveReadLaneFirst(flattenedThreadIdInGroup) & !31) + waveGetLaneIndex(), and the console lane is that & 63. This assumes that the first lanes of a group's two waves come from different blocks of 32 flattened ids. Emulate doesn't need that, because it uses flattenedThreadIdInGroup directly. If a driver packs the threads of a group another way, both waves can get the same base and collide. XCL measured exactly that on an RTX 5070 Ti for an 8x8x4 group, and it would explain why Wave32 works on Turing and Ampere but not on @⁠bittertea0323's 4070 SUPER.

To test it, here's a branch on this PR's head 54b333f: NuraadGit:shaders/wave32-claim-lanes (27e9259, +70/-8).

  • The fix: in Wave32, each host wave claims the next run of console threads from an LDS counter. Its first lane adds the wave's lane count, and lane k takes the old value plus the active lanes below it, with group barriers around the claim. This removes the dependence on how the driver packs threads.
  • The test: gpu_8x8x4_threads_each_console_lane_once stores each thread's console lane (v_mbcnt over all lanes) at its flattened id from v0..v2. It passes on my 2080 with or without the change.

On a card that packs 3-D groups differently, the test's Wave32 case should fail with only the test file applied (without the lower.rs change) and pass with the whole branch. If it does, a title run with the branch and VICTORY_WAVE64_EMULATE=wave32 should get the world drawing in Wave32 there too. All 27 wave64 tests pass, and clippy is clean.

On "10 draws/frame for the whole run": a run still in the menus looks like that too. On a fresh profile, Enter alone can stay on the legal screen (@⁠Peppacodes reports this in #841). The log tells them apart: here the first bind of 17af15c4015cb4b6 and of pixel 4f4ec7b16673362f comes at world entry.

What the default costs here: before 7425674, 98 compute programs were refused for divergent v_readfirstlane, and ~1,450 draws and dispatches were dropped per frame. After it, 0 and ~850. Emulate still refuses that case, and Sil3ntGam3r's new numbers go the same way (0 → 73, and 471 → 522 programs in total). I'd decide the default on the lane check above rather than on the draw count alone.

AI-assisted (Claude Code): the runs and log analysis were automated. The hardware, title copy and runs are the user's.

**@⁠NuraadGit** on GitHub · 2026-11-24 16:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7137393531) @⁠alfycs @⁠bittertea0323 On the new `Emulate` default: **on an RTX 2080 the world pass runs in `Wave32`, in every world run I have with it.** That matches @⁠Sil3ntGam3r's 3070. RTX 2080, driver 616.56, Series X. The log says `wave64_mode=Wave32`. Head `d0fd9bf`; from the third row on also my divergent `v_readfirstlane` fallback (`7425674`, the one you took) and a similar local one for reductions. Medians over the second half of each world run: | stack | draws/frame | dropped, no host pipeline | dropped indirect | programs refused | |---|---:|---:|---:|---:| | `d2a4bae` + #493 + #189 + #206 (21-min run) | 1,889 | 1,647 | 1,699 | 536 | | JMAN730's fork + the same, 2^18 slots (#747) | 2,262 | 1,814 | 1,007 | 430 | | + #667, divergent fallbacks (3 runs) | 2,386–2,408 | 845–891 | 922–953 | 383–390 | | + #704 | 2,436 | 704 | 876 | 343 | | + #878 | 2,830 | 706 | 483 | 325 | No device removal in any of these runs, and from the second row on the G-buffer gets scene geometry. I haven't run `Emulate`. **On "Wave32 doesn't renumber lanes":** it does, also at `54b333f`. In `ensure_wave_ids` the thread id is `(waveReadLaneFirst(flattenedThreadIdInGroup) & !31) + waveGetLaneIndex()`, and the console lane is that `& 63`. This assumes that the first lanes of a group's two waves come from different blocks of 32 flattened ids. `Emulate` doesn't need that, because it uses `flattenedThreadIdInGroup` directly. If a driver packs the threads of a group another way, both waves can get the same base and collide. XCL measured exactly that on an RTX 5070 Ti for an 8x8x4 group, and it would explain why Wave32 works on Turing and Ampere but not on @⁠bittertea0323's 4070 SUPER. To test it, here's a branch on this PR's head `54b333f`: [NuraadGit:shaders/wave32-claim-lanes](https://github.com/NuraadGit/VIctory/tree/shaders/wave32-claim-lanes) (`27e9259`, +70/-8). - **The fix:** in Wave32, each host wave claims the next run of console threads from an LDS counter. Its first lane adds the wave's lane count, and lane k takes the old value plus the active lanes below it, with group barriers around the claim. This removes the dependence on how the driver packs threads. - **The test:** `gpu_8x8x4_threads_each_console_lane_once` stores each thread's console lane (`v_mbcnt` over all lanes) at its flattened id from v0..v2. It passes on my 2080 with or without the change. On a card that packs 3-D groups differently, the test's Wave32 case should fail with only the test file applied (without the `lower.rs` change) and pass with the whole branch. If it does, a title run with the branch and `VICTORY_WAVE64_EMULATE=wave32` should get the world drawing in Wave32 there too. All 27 `wave64` tests pass, and clippy is clean. **On "10 draws/frame for the whole run":** a run still in the menus looks like that too. On a fresh profile, Enter alone can stay on the legal screen (@⁠Peppacodes reports this in #841). The log tells them apart: here the `first bind` of `17af15c4015cb4b6` and of pixel `4f4ec7b16673362f` comes at world entry. **What the default costs here:** before `7425674`, 98 compute programs were refused for divergent `v_readfirstlane`, and ~1,450 draws and dispatches were dropped per frame. After it, 0 and ~850. `Emulate` still refuses that case, and Sil3ntGam3r's new numbers go the same way (0 → 73, and 471 → 522 programs in total). I'd decide the default on the lane check above rather than on the draw count alone. *AI-assisted (Claude Code): the runs and log analysis were automated. The hardware, title copy and runs are the user's.*
Author
Owner

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

Independent verification on Windows 11 + NVIDIA RTX 3070 (Ampere, Wave32, Rust 1.98.1) at head 54b333f:

  • cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests: 126 passed, 0 failed.
  • cargo clippy -p victory-shader -- -D warnings: 0 warnings.
  • Live GTA VI (1.0.2.1, --console series-s): WaveSize(64) host pipeline refused (0x80070057) errors dropped from dozens to 0, and the world stayed stable for 19+ minutes with no regressions. Huge win for Wave32 NVIDIA GPUs!
**@⁠Yaekai** on GitHub · 2026-11-24 16:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7137702438) Independent verification on Windows 11 + NVIDIA RTX 3070 (Ampere, Wave32, Rust 1.98.1) at head `54b333f`: - `cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests`: 126 passed, 0 failed. - `cargo clippy -p victory-shader -- -D warnings`: 0 warnings. - Live GTA VI (`1.0.2.1`, `--console series-s`): `WaveSize(64)` `host pipeline refused (0x80070057)` errors dropped from dozens to **0**, and the world stayed stable for 19+ minutes with no regressions. Huge win for Wave32 NVIDIA GPUs!
Author
Owner

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

Re-verified updated head 54b333f on Windows 11, RTX 5070 Ti (Blackwell Wave32, driver 32.0.16.2135) + WARP (VICTORY_D3D12_DEBUG=1), dxil.dll 1.8.2502.11, Rust 1.98.1, against upstream/main (ffe310eb):

  • Clean trial merge with ffe310eb.
  • cargo xtask policy: 155 files ok; both clippy checks (--all-targets default and --all-features) pass.
  • cargo test --workspace --locked: 366 passed, 0 failed, 6 ignored.
  • victory-shader --features host (VICTORY_D3D12_DEBUG=1, RTX 5070 Ti & VICTORY_WARP=1): 144 passed, 0 failed, 1 ignored (0 D3D12 debug errors/warnings; all wave64_tests hardware tests pass under default Emulate).
  • victory-gpu --features diagnostics (VICTORY_D3D12_DEBUG=1, RTX 5070 Ti & VICTORY_D3D12_WARP=1): 53 passed, 0 failed, 1 ignored (0 D3D12 debug errors/warnings).
  • Note: while all synthetic Wave64 emulation tests pass cleanly on Blackwell, title-run reports on 54b333f still show the 4 culling compute shaders blocked by divergent ballot / non-uniform LDS fence checks that #439/#233 handle.

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

**@⁠Ctrl-Alt-Haze** on GitHub · 2026-11-24 16:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7138304378) Re-verified updated head `54b333f` on **Windows 11**, **RTX 5070 Ti** (Blackwell Wave32, driver `32.0.16.2135`) + **WARP** (`VICTORY_D3D12_DEBUG=1`), **dxil.dll `1.8.2502.11`**, **Rust `1.98.1`**, against `upstream/main` (`ffe310eb`): - Clean trial merge with `ffe310eb`. - `cargo xtask policy`: `155 files ok`; both `clippy` checks (`--all-targets` default and `--all-features`) pass. - `cargo test --workspace --locked`: **366 passed, 0 failed, 6 ignored**. - `victory-shader --features host` (`VICTORY_D3D12_DEBUG=1`, RTX 5070 Ti & `VICTORY_WARP=1`): **144 passed, 0 failed, 1 ignored** (0 D3D12 debug errors/warnings; all `wave64_tests` hardware tests pass under default `Emulate`). - `victory-gpu --features diagnostics` (`VICTORY_D3D12_DEBUG=1`, RTX 5070 Ti & `VICTORY_D3D12_WARP=1`): **53 passed, 0 failed, 1 ignored** (0 D3D12 debug errors/warnings). - Note: while all synthetic Wave64 emulation tests pass cleanly on Blackwell, title-run reports on `54b333f` still show the 4 culling compute shaders blocked by divergent ballot / non-uniform LDS fence checks that `#439`/`#233` handle. AI-assisted verification on local RTX 5070 Ti + WARP; no game data.
Author
Owner

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

@⁠alfycs, a regression to check at 54b333f in Emulate, from a 30-minute title run on an RTX 2070 SUPER (Turing, 32..32). Full A/B against #439 is in #1132.

  • eeed82b877b44b5f no longer translates: LDS exceeding 32 KiB with wave64 emulation is not supported. It is a 1024-thread compute program that already uses the whole 32 KiB: per-thread slots at LDS 0x2008, 0x5000, 0x6000 and 0x7000 for a tree reduction with s_barrier. On the base without this PR it translates, and with #984 and fix/unaligned-buffer-srv it runs cleanly. It is the pass from the cross-vendor world hang in #71/#778, so dropping it changes the world's compute results. Its wave-level lane ops are v_readfirstlane and s_*_b64 exec masks around a per-lane loop. It might not need the emulation scratch at all if programs whose lane ops are only first-lane reads of uniform values bypassed it.
  • 57 programs that translated on the base are refused with v_readfirstlane in divergent control flow. All 57 are usable with #439 at bf0f951 on the same base. I haven't run Wave32 mode.

Base for both runs: main ffe310e + #493 #587 #282 #876 #67 #490 #464 #984 + fix/unaligned-buffer-srv + #840/#916 fork branches. Diag build, Series X, DRED, no device removal in either run.

AI-assisted (Claude Code). No game data attached.

**@⁠alessiodeia** on GitHub · 2026-11-24 17:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7138909435) @⁠alfycs, a regression to check at `54b333f` in `Emulate`, from a 30-minute title run on an RTX 2070 SUPER (Turing, 32..32). Full A/B against #439 is in #1132. - **`eeed82b877b44b5f` no longer translates:** `LDS exceeding 32 KiB with wave64 emulation is not supported`. It is a 1024-thread compute program that already uses the whole 32 KiB: per-thread slots at LDS `0x2008`, `0x5000`, `0x6000` and `0x7000` for a tree reduction with `s_barrier`. On the base without this PR it translates, and with #984 and `fix/unaligned-buffer-srv` it runs cleanly. It is the pass from the cross-vendor world hang in #71/#778, so dropping it changes the world's compute results. Its wave-level lane ops are `v_readfirstlane` and `s_*_b64` exec masks around a per-lane loop. It might not need the emulation scratch at all if programs whose lane ops are only first-lane reads of uniform values bypassed it. - **57 programs that translated on the base are refused** with `v_readfirstlane in divergent control flow`. All 57 are usable with #439 at `bf0f951` on the same base. I haven't run `Wave32` mode. Base for both runs: `main` `ffe310e` + #493 #587 #282 #876 #67 #490 #464 #984 + `fix/unaligned-buffer-srv` + #840/#916 fork branches. Diag build, Series X, DRED, no device removal in either run. AI-assisted (Claude Code). No game data attached.
Author
Owner

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

AMD check at 54b333f (base ffe310e), on an RDNA3 and an RDNA2 GPU:

  • Windows 11, Rust 1.98.1. Radeon RX 7900 XTX (RDNA3, driver 32.0.32029.2010) and the Ryzen 7 7800X3D's iGPU (RDNA2, gfx1036, driver 32.0.21045.29003). I picked each as the hardware device of run_cases with a local adapter-selection patch that is not part of this PR. WARP runs in each pass as well.
  • cargo test -p victory-shader -p victory-gpu --locked: 194 passed, 0 failed, 2 ignored, on both GPUs. That includes its 24 new tests (divergent_cross_half_ballot_is_rejected_instead_of_hanging, divergent_early_return_taints_subsequent_blocks, divergent_lds_without_a_uniform_fence_is_rejected, divergent_multiple_lds_reads_without_writes_succeed, divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32, divergent_uniform_readfirstlane_succeeds_without_barrier, ...).

Synthetic tests only, no game files. Tested with AI assistance (Claude Code).

**@⁠bvtterbroot** on GitHub · 2026-11-24 17:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7139878807) AMD check at `54b333f` (base `ffe310e`), on an RDNA3 and an RDNA2 GPU: - Windows 11, Rust 1.98.1. Radeon RX 7900 XTX (RDNA3, driver 32.0.32029.2010) and the Ryzen 7 7800X3D's iGPU (RDNA2, gfx1036, driver 32.0.21045.29003). I picked each as the hardware device of `run_cases` with a local adapter-selection patch that is not part of this PR. WARP runs in each pass as well. - `cargo test -p victory-shader -p victory-gpu --locked`: **194 passed, 0 failed**, 2 ignored, on both GPUs. That includes its 24 new tests (`divergent_cross_half_ballot_is_rejected_instead_of_hanging`, `divergent_early_return_taints_subsequent_blocks`, `divergent_lds_without_a_uniform_fence_is_rejected`, `divergent_multiple_lds_reads_without_writes_succeed`, `divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32`, `divergent_uniform_readfirstlane_succeeds_without_barrier`, ...). Synthetic tests only, no game files. _Tested with AI assistance (Claude Code)._
Author
Owner

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

Verified on RTX 3080 10 GB / Windows 10 21H2 (19044.7846) / driver 621.24 (32.0.16.2124).

Stacked on main ffe310e + #175 (Agility) + #994 + #747 + #302/#193/#704/#309/#953/#1067 + #986/#1260/#1267 (copy-storm) + #1254 + #1276.

Translation: with VICTORY_WAVE64_EMULATE=emulate (also the mode auto-selected on this wave32 host), the wave64 compute refusals go 119 → 0 ("console wave64 lanes on a host without 64-lane waves"). Re-census of the captured runtime containers: 490/558 computes emit (88%), up from ~313/381 before emulation.

Stability (the headline): the world ran ~9 minutes with 0 device removals, user-controlled, killed while still running. Without #189 the same stack TDRs at ~3.5 min (DXGI_ERROR_DEVICE_HUNG, 28-list submission, no breadcrumbs). This supports the theory that the dropped wave64 computes leave culling/indirect data unproduced, so a later compute runs on garbage and loops until the GPU resets.

Cost: emulation overhead — ~91 MB copies/frame, 1700–2500 ms/frame (vs ~1300–1800 ms without). G-buffer geometry renders (textureless flat debug colours via VICTORY_SHOW_TARGET/VICTORY_DEBUG_PS); the final lit image is still black (the XboxBvhBuilder "address in an SGPR that is no root parameter" computes are still refused).

Contrast with #233: the lane-split hung early on this hardware (pre-cutscene TDR ~96 s + an nvgpucomp64 AV); emulation is stable. Emulation looks like the safer wave64 path on NVIDIA.

AI use: Qwen Code. All measurements from local runs; visual confirmations by the user. No game data posted.

**@⁠justlovett0** on GitHub · 2026-11-24 18:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7140322016) **Verified on RTX 3080 10 GB / Windows 10 21H2 (19044.7846) / driver 621.24 (32.0.16.2124).** Stacked on main `ffe310e` + #175 (Agility) + #994 + #747 + #302/#193/#704/#309/#953/#1067 + #986/#1260/#1267 (copy-storm) + #1254 + #1276. **Translation:** with `VICTORY_WAVE64_EMULATE=emulate` (also the mode auto-selected on this wave32 host), the wave64 compute refusals go **119 → 0** ("console wave64 lanes on a host without 64-lane waves"). Re-census of the captured runtime containers: **490/558 computes emit (88%)**, up from ~313/381 before emulation. **Stability (the headline):** the world ran **~9 minutes with 0 device removals**, user-controlled, killed while still running. Without #189 the same stack TDRs at **~3.5 min** (`DXGI_ERROR_DEVICE_HUNG`, 28-list submission, no breadcrumbs). This supports the theory that the dropped wave64 computes leave culling/indirect data unproduced, so a later compute runs on garbage and loops until the GPU resets. **Cost:** emulation overhead — ~91 MB copies/frame, 1700–2500 ms/frame (vs ~1300–1800 ms without). G-buffer geometry renders (textureless flat debug colours via `VICTORY_SHOW_TARGET`/`VICTORY_DEBUG_PS`); the final lit image is still black (the XboxBvhBuilder "address in an SGPR that is no root parameter" computes are still refused). **Contrast with #233:** the lane-split hung *early* on this hardware (pre-cutscene TDR ~96 s + an nvgpucomp64 AV); emulation is stable. Emulation looks like the safer wave64 path on NVIDIA. AI use: Qwen Code. All measurements from local runs; visual confirmations by the user. No game data posted.
Author
Owner

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

In-game A/B on an RTX 5060 Ti (32-lane, 16 GB): #189 takes the refused compute pipelines from 117 to 0, but 36 compute shaders that main translates are now refused. No game data in this comment: counts, shader hashes and offsets only.

Setup

  • Windows 11 Pro (build 26300), NVIDIA GeForce RTX 5060 Ti, driver 32.0.16.1742, 31 GB RAM, retail 1.0.2.1
  • Two release builds with --features diagnostics: main at ffe310e, and this PR's head 54b333f (based directly on ffe310e)
  • Identical runs: a copy of the same save (it goes straight to the story load), an empty VICTORY_CACHE_DIR for each build, VICTORY_KEYS=60:Enter,90:Enter to pass the account picker, 7-minute cap

Results

main ffe310e #189 54b333f
host pipelines refused (0x80070057) 117 0
shaders that do not translate 433 411
unusable shaders (either of the above) 550 411
world reached (first report over 150 draws/frame) +1:51 +3:30
device removed (0x887A0006) +3:28, after 1 list +4:43, after 11 lists

Restricted to the 1,976 shaders seen in both runs:

  • 142 unusable on main become usable with #189: 31 of the 117 refused pipelines' shaders, plus 111 that main did not translate.

  • The other 84 refused shaders are now refused at translation instead of at PSO creation:

    count translation error
    34 LDS accesses without a uniform LDS fence in split wave64
    31 a 64-lane wave ballot in divergent control flow
    14 v_readfirstlane in divergent control flow
    3 a cross-lane read in divergent control flow
    2 a wave reduction in divergent control flow
  • 36 regress (usable on main, unusable with #189):

    • 35 × v_readfirstlane in divergent control flow is not supported, from emulated_readfirstlane (lower.rs:1482), which refuses whenever the block is divergent and the mode is not Wave32
    • 1 × a lane mask from a carry is not supported

    They are all compute shaders. On main, they built a PSO without WaveSize(64). So they ran on the host's 32-lane wave, possibly with the wrong first lane for lanes 32-63, but they ran.

The 36 regressing shaders (hash, offset)
03c01507703d7449 0xacc    09a73f5bcb3ee2e8 0x288    0e45e59e93b736e4 0x1b4 (carry)
185f68f27ec763d6 0x5e8    1b665832ef2a0ca6 0x238    269b802f878c24e1 0x374
3506a565e0d3a428 0x14c    5d113aa6830760b6 0x3a4    5fae02b711504eee 0xc98
63381c3250b287fa 0xc40    731a39171b568298 0xc44    76c35de1c2444e67 0x250
7d165f4398252728 0x65c    7ddd1b511732d145 0x598    81e79f687ae84943 0x414
8bb272e763f76148 0x1d8    93fb87bdc7295d2b 0x14c    970c4fbb3b017c0e 0x178
9991e29feaa26e3e 0x2a28   9b885ee6fdda77f5 0x5f8    ab619d0b7b7684d2 0x93c
af1bc518abc76643 0x5ec    b538852f58c99307 0x358    b585907117661f1b 0x294
c18ab7816c206926 0x604    c47e03e0e3946741 0x9d0    cc7b23cc0b6a8eba 0x7dc
d3e44e754b3eb6aa 0xaf4    da1656ad2910e4c7 0x804    dce085c07b9414b6 0x558
e3730d3d043e0d90 0x12c    e4a7e088c7780ce8 0x104    e622b718b6d9b057 0x16c
f1eff11f31566a6e 0xf4     fb9c7f430da14c4c 0xcd8    ff6fdf23ce0b9048 0x2e60

World

Neither build survives the world. Both reach it and are removed with 0x887A0006 (no breadcrumbs). #189 lasts 1:13 in the world, against 1:37 on main, and enters it later. The later entry is likely because it translates more programs on a cold cache. One run each, so I would not read anything into the timing.

Suggestion

In Emulate mode, emulated_readfirstlane refuses every divergent block. When the source is uniform, the value is its own answer and no cross-lane read is needed, so that case could pass through. That may cover some of these 35 shaders; I have not checked which. If not, keeping main's lowering for them would at least avoid the regression.

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

**@⁠dragoso** on GitHub · 2026-11-24 18:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7140585944) **In-game A/B on an RTX 5060 Ti (32-lane, 16 GB): #189 takes the refused compute pipelines from 117 to 0, but 36 compute shaders that `main` translates are now refused.** No game data in this comment: counts, shader hashes and offsets only. ## Setup - Windows 11 Pro (build 26300), **NVIDIA GeForce RTX 5060 Ti**, driver 32.0.16.1742, 31 GB RAM, retail 1.0.2.1 - Two release builds with `--features diagnostics`: `main` at `ffe310e`, and this PR's head `54b333f` (based directly on `ffe310e`) - Identical runs: a copy of the same save (it goes straight to the story load), an **empty** `VICTORY_CACHE_DIR` for each build, `VICTORY_KEYS=60:Enter,90:Enter` to pass the account picker, 7-minute cap ## Results | | `main` `ffe310e` | #189 `54b333f` | |---|---|---| | host pipelines refused (`0x80070057`) | **117** | **0** | | shaders that do not translate | 433 | 411 | | unusable shaders (either of the above) | 550 | 411 | | world reached (first report over 150 draws/frame) | +1:51 | +3:30 | | device removed (`0x887A0006`) | +3:28, after 1 list | +4:43, after 11 lists | Restricted to the 1,976 shaders seen in both runs: - **142 unusable on `main` become usable** with #189: 31 of the 117 refused pipelines' shaders, plus 111 that `main` did not translate. - The other 84 refused shaders are now refused at translation instead of at PSO creation: | count | translation error | |---|---| | 34 | LDS accesses without a uniform LDS fence in split wave64 | | 31 | a 64-lane wave ballot in divergent control flow | | 14 | v_readfirstlane in divergent control flow | | 3 | a cross-lane read in divergent control flow | | 2 | a wave reduction in divergent control flow | - **36 regress** (usable on `main`, unusable with #189): - 35 × `v_readfirstlane in divergent control flow is not supported`, from `emulated_readfirstlane` (`lower.rs:1482`), which refuses whenever the block is divergent and the mode is not `Wave32` - 1 × `a lane mask from a carry is not supported` They are all compute shaders. On `main`, they built a PSO without `WaveSize(64)`. So they ran on the host's 32-lane wave, possibly with the wrong first lane for lanes 32-63, but they ran. <details><summary>The 36 regressing shaders (hash, offset)</summary> ``` 03c01507703d7449 0xacc 09a73f5bcb3ee2e8 0x288 0e45e59e93b736e4 0x1b4 (carry) 185f68f27ec763d6 0x5e8 1b665832ef2a0ca6 0x238 269b802f878c24e1 0x374 3506a565e0d3a428 0x14c 5d113aa6830760b6 0x3a4 5fae02b711504eee 0xc98 63381c3250b287fa 0xc40 731a39171b568298 0xc44 76c35de1c2444e67 0x250 7d165f4398252728 0x65c 7ddd1b511732d145 0x598 81e79f687ae84943 0x414 8bb272e763f76148 0x1d8 93fb87bdc7295d2b 0x14c 970c4fbb3b017c0e 0x178 9991e29feaa26e3e 0x2a28 9b885ee6fdda77f5 0x5f8 ab619d0b7b7684d2 0x93c af1bc518abc76643 0x5ec b538852f58c99307 0x358 b585907117661f1b 0x294 c18ab7816c206926 0x604 c47e03e0e3946741 0x9d0 cc7b23cc0b6a8eba 0x7dc d3e44e754b3eb6aa 0xaf4 da1656ad2910e4c7 0x804 dce085c07b9414b6 0x558 e3730d3d043e0d90 0x12c e4a7e088c7780ce8 0x104 e622b718b6d9b057 0x16c f1eff11f31566a6e 0xf4 fb9c7f430da14c4c 0xcd8 ff6fdf23ce0b9048 0x2e60 ``` </details> ## World Neither build survives the world. Both reach it and are removed with `0x887A0006` (no breadcrumbs). #189 lasts 1:13 in the world, against 1:37 on `main`, and enters it later. The later entry is likely because it translates more programs on a cold cache. One run each, so I would not read anything into the timing. ## Suggestion In `Emulate` mode, `emulated_readfirstlane` refuses every divergent block. When the source is uniform, the value is its own answer and no cross-lane read is needed, so that case could pass through. That may cover some of these 35 shaders; I have not checked which. If not, keeping `main`'s lowering for them would at least avoid the regression. *AI-assisted (Claude Code); everything was run on our machine.*
Author
Owner

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

First test on NVIDIA (RTX 3060 Ti): reaches the world, PR #189 works on 32-lane waves

Machine: Windows 11 (build 26200), NVIDIA GeForce RTX 3060 Ti (driver 621.24), Intel i5-12600KF, 16 GB RAM.
Tested: main at ffe310e, then PR #189 (54b333f) with the NVIDIA patch below on top. Release builds, VICTORY_LOG=info.

Summary

main PR #189 + NVIDIA patch
Boot, first-boot screens, intro, start screen works, 30 fps works, 30 fps
World load (from SATA SSD) – ~30 s
World title card, dark scene, ~1 fps title card and non-gameplay image, dark scene, 0.3-1.6 fps
Host pipelines refused (compute) 112 0
Driver reset / crashes.log none none

No TDR on entering the world on this GPU, unlike the README's warning for real GPUs.

1. PR #189 on a 32-lane host

On main, 112 compute pipelines are refused (host pipeline refused error=E_INVALIDARG). They carry WaveSize(64), which NVIDIA does not support. With PR #189 none are refused. The shader GPU tests (cargo test -p victory-shader, including wave64_tests) pass on this GPU: 144 passed, 0 failed.

What still does not translate in the first world scene (571 shaders: 500 compute, 36 pixel, 31 mesh, 4 vertex), by converter error:

Error Shaders
a select on an untracked mask 90
v_readfirstlane in divergent control flow 70
a lane mask holding lanes elsewhere read as data 73
a descriptor read only as data 58
a structured buffer of unknown stride 41
an address in an SGPR that is no root parameter 35
a scalar memory read as data 33
LDS accesses without a uniform LDS fence in split wave64 28
a 64-lane wave ballot in divergent control flow 37
an address not from a root parameter 17

The two Wave64-emulation rows (65 shaders) are specific to 32-lane hosts.

2. NVIDIA-specific host refusals (patch: #1523)

  • Shader-visible CBV/SRV/UAV heap: the title asks for 1,245,184 slots. The RTX 3060 Ti takes exactly 1,000,000, found by binary search (resource binding tier 3 does not give more on NVIDIA). So 310,720 slots are left out, including the 65,536 dynamic ones. title slot past the host heap never fired, up to and including the first world scene.
  • 16-bit packed formats: two 2560x1440 targets were refused (no host texture): B5G5R5A1 (86) with RT|UAV and B4G4R4A4 (115) with RT. CheckFeatureSupport on this GPU reports:
    • 85 and 86: render target yes, typed UAV store no.
    • 115: render target no, typed UAV store no.
  • The format-53 depth+UAV view refusal is the known shortcut and also happens here.

3. World loading from a hard disk looks like a hang

With the game on a 7200 rpm HDD, the world loading screen sat for more than 5 minutes after story000/data/ttdb/vfx/ttdb_vfx.ttpf with no new file opened lines. That looked like a hang.

A stack dump showed all 16 DirectStorage workers inside seek_read. The disk did ~1 MB/s, at 140 reads/s and 500% busy, while sequential reads of the same disk run at ~110 MB/s. Moving the game to a SATA SSD brought the load to ~30 s.

It might help to mention SSD in the README requirements. Fewer workers on rotational media would also help, as would logging read progress during long loads (only opens are logged today).

**@⁠cyudev** on GitHub · 2026-11-24 18:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7141107366) ## First test on NVIDIA (RTX 3060 Ti): reaches the world, PR #189 works on 32-lane waves **Machine:** Windows 11 (build 26200), NVIDIA GeForce RTX 3060 Ti (driver 621.24), Intel i5-12600KF, 16 GB RAM. **Tested:** `main` at ffe310e, then PR #189 (54b333f) with the NVIDIA patch below on top. Release builds, `VICTORY_LOG=info`. ### Summary | | `main` | PR #189 + NVIDIA patch | |---|---|---| | Boot, first-boot screens, intro, start screen | works, 30 fps | works, 30 fps | | World load (from SATA SSD) | – | ~30 s | | World | title card, dark scene, ~1 fps | title card and non-gameplay image, dark scene, 0.3-1.6 fps | | Host pipelines refused (compute) | **112** | **0** | | Driver reset / `crashes.log` | none | none | No TDR on entering the world on this GPU, unlike the README's warning for real GPUs. ### 1. PR #189 on a 32-lane host On `main`, 112 compute pipelines are refused (`host pipeline refused error=E_INVALIDARG`). They carry WaveSize(64), which NVIDIA does not support. With PR #189 none are refused. The shader GPU tests (`cargo test -p victory-shader`, including `wave64_tests`) pass on this GPU: 144 passed, 0 failed. What still does not translate in the first world scene (571 shaders: 500 compute, 36 pixel, 31 mesh, 4 vertex), by converter error: | Error | Shaders | |---|---| | a select on an untracked mask | 90 | | v_readfirstlane in divergent control flow | 70 | | a lane mask holding lanes elsewhere read as data | 73 | | a descriptor read only as data | 58 | | a structured buffer of unknown stride | 41 | | an address in an SGPR that is no root parameter | 35 | | a scalar memory read as data | 33 | | LDS accesses without a uniform LDS fence in split wave64 | 28 | | a 64-lane wave ballot in divergent control flow | 37 | | an address not from a root parameter | 17 | The two Wave64-emulation rows (65 shaders) are specific to 32-lane hosts. ### 2. NVIDIA-specific host refusals (patch: #1523) - **Shader-visible CBV/SRV/UAV heap:** the title asks for 1,245,184 slots. The RTX 3060 Ti takes **exactly 1,000,000**, found by binary search (resource binding tier 3 does not give more on NVIDIA). So 310,720 slots are left out, including the 65,536 dynamic ones. `title slot past the host heap` never fired, up to and including the first world scene. - **16-bit packed formats:** two 2560x1440 targets were refused (`no host texture`): B5G5R5A1 (86) with RT|UAV and B4G4R4A4 (115) with RT. `CheckFeatureSupport` on this GPU reports: - 85 and 86: render target yes, typed UAV store no. - 115: render target no, typed UAV store no. - The format-53 depth+UAV view refusal is the known shortcut and also happens here. ### 3. World loading from a hard disk looks like a hang With the game on a 7200 rpm HDD, the world loading screen sat for more than 5 minutes after `story000/data/ttdb/vfx/ttdb_vfx.ttpf` with no new `file opened` lines. That looked like a hang. A stack dump showed all 16 DirectStorage workers inside `seek_read`. The disk did ~1 MB/s, at 140 reads/s and 500% busy, while sequential reads of the same disk run at ~110 MB/s. Moving the game to a SATA SSD brought the load to ~30 s. It might help to mention SSD in the README requirements. Fewer workers on rotational media would also help, as would logging read progress during long loads (only opens are logged today).
Author
Owner

@⁠0xcheems on GitHub · 2026-11-24 19:05 UTC · original

AMD RDNA 3.5 under Proton: with this PR the world freezes in the auto-selected Native mode; wave32 and emulate run through. In-title, bisected.

AI use: runs driven and logs summarised with Claude Code (Claude Fable 5.2, then Claude Opus 5.5) on my machine. Own copy of 1.0.2.1. No game data here: counts and hashes only.

Setup: Ryzen AI MAX+ 395, Radeon 8060S (Strix Halo, RDNA 3.5, unified memory, 32 GB); NixOS, kernel 7.1.5, Mesa 26.1.5 RADV; Proton Experimental experimental-11.0-20261112, vkd3d-proton 3.2.0. Diag builds cross-built with cargo-xwin, Series X, VICTORY_NO_WATCHDOG=1, VICTORY_KEYS into the world, 8 to 10 minute runs. The tree is LooperSalty/victory anyxboxx/stable (9a9eab0), which carries this PR as merged at about 09:43 UTC today. This GPU reports 32..64 lanes, so the PR logs wave64_mode=Native.

Bisect (first-parent merges of that branch, one PR each):

Tree Runs Result
fork base + #89 + #493 2 both run the full time (8 and 10 min)
same + this PR 1 stops about 3 min after world entry
every later merge on the branch, stable, essai 7 all stop 1.5 to 3 min after world entry, at frames 2 000 to 2 180

"Stop" is either a freeze (log ends, one title thread spins at 100 % of a core, every other thread sleeps, memory steady with 4 to 6 GB free, no kernel GPU line) or, twice, the title's null write at +0x2215c35 once its own hang check fires (builds without #454).

Mode switch, full stable build, one 10-minute run each:

VICTORY_WAVE64_EMULATE Result World frame (median) Compute: translated / refused
unset (Native) freeze at 4 min 29 s, frame 2 074 1 517 ms 633 / 71
emulate ran 9 min 49 s, frame 2 626; then ring gfx_0.0.0 timeout, device removed 1 100 ms 489 / 227
wave32 full 10 min, frame 2 658, no fault 883 ms 503 / 220
  • The tree without this PR translates 634 compute shaders and does not freeze. wave32 refuses 143 of them, mostly v_readfirstlane in divergent control flow (102 warning lines) and a cross-lane wave operation in divergent control flow (53).
  • VICTORY_SKIP_WAVE64=compute,mesh,vertex,pixel with Native (121 distinct Wave64 shaders skipped) still froze, at frame 2 078. So in Native mode the hang does not seem to come from the Wave64 programs themselves, but from something else this PR changes on that path. I could not isolate further: reverting only resource.rs does not build against the new lower.rs.

So on this AMD/Linux host, Native is the one mode that hangs, while the tree without this PR (also native Wave64 on this GPU) does not. I can run a specific branch, switch or skip list if that helps narrow it.

**@⁠0xcheems** on GitHub · 2026-11-24 19:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7141575454) **AMD RDNA 3.5 under Proton: with this PR the world freezes in the auto-selected `Native` mode; `wave32` and `emulate` run through.** In-title, bisected. *AI use: runs driven and logs summarised with Claude Code (Claude Fable 5.2, then Claude Opus 5.5) on my machine. Own copy of 1.0.2.1. No game data here: counts and hashes only.* **Setup:** Ryzen AI MAX+ 395, Radeon 8060S (Strix Halo, RDNA 3.5, unified memory, 32 GB); NixOS, kernel 7.1.5, Mesa 26.1.5 RADV; Proton Experimental `experimental-11.0-20261112`, vkd3d-proton 3.2.0. Diag builds cross-built with cargo-xwin, Series X, `VICTORY_NO_WATCHDOG=1`, `VICTORY_KEYS` into the world, 8 to 10 minute runs. The tree is LooperSalty/victory `anyxboxx/stable` (`9a9eab0`), which carries this PR as merged at about 09:43 UTC today. This GPU reports 32..64 lanes, so the PR logs `wave64_mode=Native`. **Bisect** (first-parent merges of that branch, one PR each): | Tree | Runs | Result | |---|---:|---| | fork base + #89 + #493 | 2 | both run the full time (8 and 10 min) | | same + this PR | 1 | stops about 3 min after world entry | | every later merge on the branch, `stable`, `essai` | 7 | all stop 1.5 to 3 min after world entry, at frames 2 000 to 2 180 | "Stop" is either a freeze (log ends, one title thread spins at 100 % of a core, every other thread sleeps, memory steady with 4 to 6 GB free, no kernel GPU line) or, twice, the title's null write at `+0x2215c35` once its own hang check fires (builds without #454). **Mode switch, full `stable` build, one 10-minute run each:** | `VICTORY_WAVE64_EMULATE` | Result | World frame (median) | Compute: translated / refused | |---|---|---:|---:| | unset (`Native`) | freeze at 4 min 29 s, frame 2 074 | 1 517 ms | 633 / 71 | | `emulate` | ran 9 min 49 s, frame 2 626; then `ring gfx_0.0.0 timeout`, device removed | 1 100 ms | 489 / 227 | | `wave32` | **full 10 min, frame 2 658, no fault** | **883 ms** | 503 / 220 | - The tree without this PR translates 634 compute shaders and does not freeze. `wave32` refuses 143 of them, mostly `v_readfirstlane in divergent control flow` (102 warning lines) and `a cross-lane wave operation in divergent control flow` (53). - `VICTORY_SKIP_WAVE64=compute,mesh,vertex,pixel` with `Native` (121 distinct Wave64 shaders skipped) **still froze**, at frame 2 078. So in `Native` mode the hang does not seem to come from the Wave64 programs themselves, but from something else this PR changes on that path. I could not isolate further: reverting only `resource.rs` does not build against the new `lower.rs`. So on this AMD/Linux host, `Native` is the one mode that hangs, while the tree without this PR (also native Wave64 on this GPU) does not. I can run a specific branch, switch or skip list if that helps narrow it.
Author
Owner

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

Correction to my comment above: on an RTX 5060 Ti, #189 nets −43 host pipelines (+94, −137), not +142. Counts only; no shader names or dumps.

My in-game comparison counted a shader as fixed when it simply didn't fail in the #189 run. That includes shaders whose pipeline was never requested before the device was removed. With positive evidence on both sides (a host pipeline actually created), the in-game numbers are:

  • 28 shaders go from refused to built, not 142;
  • the 36 regressions stand: each was built on main and fails with #189.

The deterministic version: victory translate --validate --pipelines --list over shaders.rpf (retail 1.0.2.1, 26,084 programs). A program counts only when its D3D12 pipeline is created on this GPU (32-lane, driver 32.0.16.1742).

pipelines created
main ffe310e 21,566
#189 54b333f 21,523 (−43)
  • Gained 94 compute programs, all refused by main at PSO creation with 0x80070057.
  • Lost 137 compute programs that main builds:
    • 132 × "v_readfirstlane in divergent control flow"
    • 3 × "a lane mask from a carry"
    • 2 × "LDS exceeding 32 KiB with wave64 emulation"
  • Of the remaining refused-at-PSO programs, 212 now stop at translation instead:
    • 109 × "LDS accesses without a uniform LDS fence in split wave64"
    • 63 × "a 64-lane wave ballot in divergent control flow"
    • 40 × "v_readfirstlane in divergent control flow"

So the divergent v_readfirstlane refusal in emulated_readfirstlane costs more than the PR gains on this host: 132 lost plus 40 blocked. Fixing it would turn the net positive.

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

**@⁠dragoso** on GitHub · 2026-11-24 19:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7141922055) **Correction to my comment above: on an RTX 5060 Ti, #189 nets −43 host pipelines (+94, −137), not +142.** Counts only; no shader names or dumps. My in-game comparison counted a shader as fixed when it simply didn't fail in the #189 run. That includes shaders whose pipeline was never requested before the device was removed. With positive evidence on both sides (a host pipeline actually created), the in-game numbers are: - **28** shaders go from refused to built, not 142; - the **36 regressions stand**: each was built on `main` and fails with #189. The deterministic version: `victory translate --validate --pipelines --list` over `shaders.rpf` (retail 1.0.2.1, 26,084 programs). A program counts only when its D3D12 pipeline is created on this GPU (32-lane, driver 32.0.16.1742). | | pipelines created | |---|---| | `main` `ffe310e` | 21,566 | | #189 `54b333f` | 21,523 (**−43**) | - **Gained 94** compute programs, all refused by `main` at PSO creation with `0x80070057`. - **Lost 137** compute programs that `main` builds: - 132 × "v_readfirstlane in divergent control flow" - 3 × "a lane mask from a carry" - 2 × "LDS exceeding 32 KiB with wave64 emulation" - Of the remaining refused-at-PSO programs, 212 now stop at translation instead: - 109 × "LDS accesses without a uniform LDS fence in split wave64" - 63 × "a 64-lane wave ballot in divergent control flow" - 40 × "v_readfirstlane in divergent control flow" So the divergent `v_readfirstlane` refusal in `emulated_readfirstlane` costs more than the PR gains on this host: 132 lost plus 40 blocked. Fixing it would turn the net positive. *AI-assisted (Claude Code); everything was run on our machine.*
Author
Owner

@⁠EduBertozzi on GitHub · 2026-11-24 19:51 UTC · original

Hardware data point for the case this PR targets, a 32-lane host: GTX 1060 6 GB (Pascal, WaveLaneCountMin/Max 32/32), Windows 10 22H2 19045, driver 32.0.15.8266, Agility 1.620.2 via #486. I merged 54b333f onto main ffe310e and ran cargo test -p victory-shader --lib: 144 passed, 0 failed (main alone: 120), so all 24 tests this PR adds pass on hardware that has no native 64-lane waves.

For comparison, #587 and #578 on the same machine: 120 / 0 each, the same as main. Neither adds victory-shader tests of its own.

AI-assisted (Claude Code).

**@⁠EduBertozzi** on GitHub · 2026-11-24 19:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7142685222) Hardware data point for the case this PR targets, a 32-lane host: **GTX 1060 6 GB** (Pascal, `WaveLaneCountMin`/`Max` 32/32), Windows 10 22H2 19045, driver 32.0.15.8266, Agility 1.620.2 via #486. I merged `54b333f` onto `main` `ffe310e` and ran `cargo test -p victory-shader --lib`: **144 passed, 0 failed** (`main` alone: 120), so all 24 tests this PR adds pass on hardware that has no native 64-lane waves. For comparison, #587 and #578 on the same machine: 120 / 0 each, the same as `main`. Neither adds `victory-shader` tests of its own. AI-assisted (Claude Code).
Author
Owner

@⁠wildheathen on GitHub · 2026-11-24 18:46 UTC · original · edited 2026-11-24 20:56 UTC

Whole-dump offline count on an RTX 5080 (32..32): at 54b333f, Wave32 keeps every compute program Emulate keeps, plus 158 more. This extends @⁠dragoso's in-game A/B above: that covered the shaders one 7-minute run met, this covers every compute program in the dump.

Setup

  • Windows 11, RTX 5080 (driver 32.0.16.2124, 32..32 lanes), dxil.dll 10.0.26100, Rust 1.98.1 MSVC.
  • victory translate --validate --pipelines --list over the retail dump's shaders (2,682 compute programs), on main ffe310e and on this PR's head 54b333f. Release builds, each in its own target dir.
  • translate uses Host::recommended_wave64_mode(), which picks Emulate on this GPU. To get the Wave32 row I patched translate.rs locally to take the mode from an environment variable. That patch isn't part of the PR, and the lowering is unchanged.

Compute programs that end up with a host pipeline

pipelines vs main: gained lost
main ffe310e 1,121 (320 refused, 0x80070057)
#189, Emulate (default here) 1,078 94 137
#189, Wave32 1,236 117 2
  • Emulate ⊂ Wave32: no program gets a pipeline in Emulate and not in Wave32. 158 do the reverse.
  • What Emulate loses against main:
    • 132 × v_readfirstlane in divergent control flow, from emulated_readfirstlane (lower.rs:1482). This is the same family as dragoso's 35. In Emulate, need_emu turns on when the only reason is a non-uniform v_readfirstlane (has_non_uniform_firstlane), even when console_lanes is false and there are no sections. The same function then refuses that v_readfirstlane when it sits in a divergent block. Main gave all 132 a pipeline without WaveSize(64).
    • 3 × a lane mask from a carry.
    • 2 × LDS exceeding 32 KiB with wave64 emulation.
  • The 32 KiB regression @⁠alessiodeia reported shows up in both modes. 4 programs hit it. 2 of them have a pipeline on main and lose it with #189 in Emulate and in Wave32 alike. Wave32 also refuses with the "wave64 emulation" message, because it adds ballot dwords on top of an LDS that is already full.

What this suggests

  1. On 32-lane hosts, default to Wave32 instead of Emulate. (Edited: a world run says no, see the update below.) At this head Wave32 is strictly better on this dump: +115 programs against main and −2, where Emulate is −43 net. If Emulate is kept for correctness reasons I'm not seeing, then for programs whose only trigger is has_non_uniform_firstlane (no console_lanes, no sections), falling back to main's lowering would avoid the 132 (see the follow-up below: this exact version breaks a correctness test, and main's lowering of d3e44e754b3eb6aa hangs on a 4090).
  2. For the 32 KiB case: when the title's LDS plus the emulation's dwords don't fit, keep main's lowering (no emulation) instead of refusing. That's what main does today, and alessiodeia's run shows the program working that way with #984.

Caveats

  • "Pipeline created" doesn't mean "correct". This counts what the host accepts, not results. Wave32 lowering's own tests (wave64_tests) pass on this machine. Clippy is clean; cargo test -p victory-shader -p victory-gpu: 194 passed, 0 failed.
  • No title run with this PR yet. The runtime mode can be forced with VICTORY_WAVE64_EMULATE=wave32, so a world A/B of Emulate against Wave32 is the next thing I can run on the 5080 if it helps.

No game data, shader bytes or shader names here; counts come from a local dump.

Update: Wave32 in the world hangs on one of the programs it recovers

Edited after posting. @⁠dragoso has since got the same offline numbers on a 5060 Ti (+94 / −137). In-game runs on the same RTX 5080, unattended (diag build, VICTORY_D3D12_DRED=1, fresh copy of one save, VICTORY_KEYS, 480 s cap). #189 is merged onto #578 fb7facd so the wave64 mesh hang (#778) doesn't end the run first:

Tree Device removed fps (median) draws/frame "does not translate" lines
#578 alone none in 393 s of world 4.7 197 536
#578 + #189, Emulate (auto) none in 369 s 4.4 210 698 (91 × divergent v_readfirstlane)
#578 + #189, VICTORY_WAVE64_EMULATE=wave32 +41 s in world 1.7 239 451 (0 × divergent v_readfirstlane)

DRED for the Wave32 run stops at a compute Dispatch, command 97 of 293, dispatch 44x1x1 [compute d3e44e754b3eb6aa], in a run of dispatches of that one program. d3e44e754b3eb6aa is in @⁠dragoso's list of 36: Emulate refuses it for the divergent v_readfirstlane, and Wave32 translates it. Its pipeline is created, and then it hangs the GPU.

So the offline "Wave32 ⊇ Emulate" above only counts pipelines that get created. At least one of the programs Wave32 adds doesn't terminate on this GPU. One run, so I'm not claiming more than that. The divergent-v_readfirstlane refusal looks like it's protecting against a real hang, at least for d3e44e754b3eb6aa. Fixing it properly, as dragoso suggests, beats switching modes.

Follow-up run: the same Wave32 tree with VICTORY_SHADER_LOOP_LIMIT=4096 ran 396 s in the world with no removal and no slow submission at all. d3e44e754b3eb6aa was bound and ran under the cap. So the Wave32 hang is a translated loop that doesn't end. Structure only, from shader-info --disasm: the program is 64 threads per group with no LDS and no barrier. It has two v_readfirstlane_b32, one at 0x104 under v_cmpx_lt_u32 exec, v0, v1, and two loops whose exits test 64-bit exec masks (back edges at 0x47c and 0xe94). In Wave32, the divergent one takes the shortcut in emulated_readfirstlane where each 32-lane half reads its own first active lane. The code's own comment says that's exact only for uniform values or inside a waterfall loop. My guess is that this program is neither case, but I haven't traced which loop runs away.

Main's lowering of the same program: card-dependent. On this 5080, in the plain-main runs (no #578), d3e44e754b3eb6aa gets a host pipeline and runs ~90 s, until the unrelated mesh hang ends the run. It never shows up in a slow submission, in two runs. But @⁠Yorivel's 4090 run (in the comment after this one) shows main's lowering of it not terminating (device removed 18 s after its pipeline, even with a 1024 loop cap). So main's per-host-wave first lane isn't safe for this program either. It only happened not to hang here.

Two local prototypes (not pushed), measured the same way:

  1. Don't emulate when the only trigger is has_non_uniform_firstlane (if console_lanes || !sections.is_empty() in the Emulate branch). Offline it's +98 / −0 against main. But it fails gpu_64_threads_empty_exec_readfirstlane_returns_lane0: the upper half gets 39 where the console gives 7, because main's lowering reads the host wave's first lane, not the 64-lane wave's. So that one is wrong, and it's main's bug too.
  2. Keep the emulation decision, but in emulated_readfirstlane in Emulate, use the host wave's first active lane (waveReadLaneFirst) for a divergent non-uniform v_readfirstlane instead of refusing. That's 8 lines:
if divergent && self.wave64 == Wave64Mode::Emulate {
    let c = self.cur;
    self.s.flags |= flags::WAVE_OPS;
    let i32t = self.s.t.i32;
    return Ok(self.s.op(c, "waveReadLaneFirst.i32", Attr::NoUnwind, i32t, 118, &[val]));
}
pipelines vs main: gained lost
main 1,121
#189 Emulate 1,078 94 137
#189 Wave32 1,236 117 2
#189 Emulate + prototype 2 1,229 110 2 (the 32 KiB ones)
  • cargo test -p victory-shader -p victory-gpu: 196 passed. The one failure is divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32, which asserts that Emulate refuses this case, so it fails by design. The empty-EXEC GPU test passes.
  • In the world on #578 + #189 + prototype 2: no removal in 367 s, 0 divergent-readfirstlane refusals (91 before), 4.7 fps.
  • Without #578, #189 + prototype 2: d3e44e754b3eb6aa gets a pipeline and runs for 23 s, with no slow submission. Then the run ends on the known wave64 mesh hang (DispatchMesh, mesh 51ff151f75cd5759), not on d3e44e754b3eb6aa. In Wave32 it hung on that program 43 s after its pipeline, so 23 s is suggestive and not proof.
  • Not a fix, given @⁠Yorivel's 4090 result. For a divergent non-uniform value it gives the host wave's first lane, as main does, and main's lowering of d3e44e754b3eb6aa hangs on a 4090. So prototype 2 recovers 110 programs, but at least one of them can hang depending on the card. Refusing it, as Emulate does today, is the safer default. I'm posting the numbers so the trade-off is visible, not as a recommendation. Exact 64-lane semantics would need the LDS exchange, which can't run in divergent flow.

AI-assisted (Claude Code).

**@⁠wildheathen** on GitHub · 2026-11-24 18:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7141122282) · edited 2026-11-24 20:56 UTC **Whole-dump offline count on an RTX 5080 (32..32): at `54b333f`, `Wave32` keeps every compute program `Emulate` keeps, plus 158 more.** This extends @⁠dragoso's in-game A/B above: that covered the shaders one 7-minute run met, this covers every compute program in the dump. ### Setup - Windows 11, RTX 5080 (driver 32.0.16.2124, 32..32 lanes), dxil.dll 10.0.26100, Rust 1.98.1 MSVC. - `victory translate --validate --pipelines --list` over the retail dump's shaders (2,682 compute programs), on main `ffe310e` and on this PR's head `54b333f`. Release builds, each in its own target dir. - `translate` uses `Host::recommended_wave64_mode()`, which picks `Emulate` on this GPU. To get the `Wave32` row I patched `translate.rs` locally to take the mode from an environment variable. That patch isn't part of the PR, and the lowering is unchanged. ### Compute programs that end up with a host pipeline | | pipelines | vs main: gained | lost | |---|---:|---:|---:| | main `ffe310e` | 1,121 (320 refused, `0x80070057`) | | | | #189, `Emulate` (default here) | 1,078 | 94 | **137** | | #189, `Wave32` | **1,236** | 117 | 2 | - **`Emulate` ⊂ `Wave32`:** no program gets a pipeline in `Emulate` and not in `Wave32`. 158 do the reverse. - What `Emulate` loses against main: - **132** × `v_readfirstlane in divergent control flow`, from `emulated_readfirstlane` (`lower.rs:1482`). This is the same family as dragoso's 35. In `Emulate`, `need_emu` turns on when the only reason is a non-uniform `v_readfirstlane` (`has_non_uniform_firstlane`), even when `console_lanes` is false and there are no sections. The same function then refuses that `v_readfirstlane` when it sits in a divergent block. Main gave all 132 a pipeline without `WaveSize(64)`. - 3 × `a lane mask from a carry`. - 2 × `LDS exceeding 32 KiB with wave64 emulation`. - **The 32 KiB regression @⁠alessiodeia reported shows up in both modes.** 4 programs hit it. 2 of them have a pipeline on main and lose it with #189 in `Emulate` and in `Wave32` alike. `Wave32` also refuses with the "wave64 emulation" message, because it adds ballot dwords on top of an LDS that is already full. ### What this suggests 1. ~~**On 32-lane hosts, default to `Wave32` instead of `Emulate`.**~~ *(Edited: a world run says no, see the update below.)* At this head `Wave32` is strictly better on this dump: +115 programs against main and −2, where `Emulate` is −43 net. If `Emulate` is kept for correctness reasons I'm not seeing, then for programs whose only trigger is `has_non_uniform_firstlane` (no `console_lanes`, no sections), falling back to main's lowering would avoid the 132 *(see the follow-up below: this exact version breaks a correctness test, and main's lowering of `d3e44e754b3eb6aa` hangs on a 4090)*. 2. **For the 32 KiB case:** when the title's LDS plus the emulation's dwords don't fit, keep main's lowering (no emulation) instead of refusing. That's what main does today, and alessiodeia's run shows the program working that way with #984. ### Caveats - "Pipeline created" doesn't mean "correct". This counts what the host accepts, not results. `Wave32` lowering's own tests (`wave64_tests`) pass on this machine. Clippy is clean; `cargo test -p victory-shader -p victory-gpu`: 194 passed, 0 failed. - No title run with this PR yet. The runtime mode can be forced with `VICTORY_WAVE64_EMULATE=wave32`, so a world A/B of `Emulate` against `Wave32` is the next thing I can run on the 5080 if it helps. No game data, shader bytes or shader names here; counts come from a local dump. ### Update: `Wave32` in the world hangs on one of the programs it recovers Edited after posting. @⁠dragoso has since got the same offline numbers on a 5060 Ti (+94 / −137). In-game runs on the same RTX 5080, unattended (diag build, `VICTORY_D3D12_DRED=1`, fresh copy of one save, `VICTORY_KEYS`, 480 s cap). #189 is merged onto #578 `fb7facd` so the wave64 **mesh** hang (#778) doesn't end the run first: | Tree | Device removed | fps (median) | draws/frame | "does not translate" lines | |---|---|---|---|---| | #578 alone | none in 393 s of world | 4.7 | 197 | 536 | | #578 + #189, `Emulate` (auto) | none in 369 s | 4.4 | 210 | 698 (91 × divergent `v_readfirstlane`) | | #578 + #189, `VICTORY_WAVE64_EMULATE=wave32` | **+41 s in world** | 1.7 | 239 | 451 (0 × divergent `v_readfirstlane`) | DRED for the `Wave32` run stops at a compute `Dispatch`, command 97 of 293, `dispatch 44x1x1 [compute d3e44e754b3eb6aa]`, in a run of dispatches of that one program. `d3e44e754b3eb6aa` is in @⁠dragoso's list of 36: `Emulate` refuses it for the divergent `v_readfirstlane`, and `Wave32` translates it. Its pipeline is created, and then it hangs the GPU. So the offline "`Wave32` ⊇ `Emulate`" above only counts pipelines that get created. At least one of the programs `Wave32` adds doesn't terminate on this GPU. One run, so I'm not claiming more than that. The divergent-`v_readfirstlane` refusal looks like it's protecting against a real hang, at least for `d3e44e754b3eb6aa`. Fixing it properly, as dragoso suggests, beats switching modes. **Follow-up run:** the same `Wave32` tree with `VICTORY_SHADER_LOOP_LIMIT=4096` ran **396 s in the world with no removal** and no slow submission at all. `d3e44e754b3eb6aa` was bound and ran under the cap. So the `Wave32` hang is a translated loop that doesn't end. Structure only, from `shader-info --disasm`: the program is 64 threads per group with no LDS and no barrier. It has two `v_readfirstlane_b32`, one at `0x104` under `v_cmpx_lt_u32 exec, v0, v1`, and two loops whose exits test 64-bit `exec` masks (back edges at `0x47c` and `0xe94`). In `Wave32`, the divergent one takes the shortcut in `emulated_readfirstlane` where each 32-lane half reads its own first active lane. The code's own comment says that's exact only for uniform values or inside a waterfall loop. My guess is that this program is neither case, but I haven't traced which loop runs away. **Main's lowering of the same program: card-dependent.** On this 5080, in the plain-main runs (no #578), `d3e44e754b3eb6aa` gets a host pipeline and runs ~90 s, until the unrelated mesh hang ends the run. It never shows up in a slow submission, in two runs. But @⁠Yorivel's 4090 run (in the comment after this one) shows main's lowering of it **not** terminating (device removed 18 s after its pipeline, even with a 1024 loop cap). So main's per-host-wave first lane isn't safe for this program either. It only happened not to hang here. **Two local prototypes** (not pushed), measured the same way: 1. *Don't emulate when the only trigger is `has_non_uniform_firstlane`* (`if console_lanes || !sections.is_empty()` in the `Emulate` branch). Offline it's +98 / −0 against main. But it **fails** `gpu_64_threads_empty_exec_readfirstlane_returns_lane0`: the upper half gets 39 where the console gives 7, because main's lowering reads the host wave's first lane, not the 64-lane wave's. So that one is wrong, and it's main's bug too. 2. *Keep the emulation decision, but in `emulated_readfirstlane` in `Emulate`, use the host wave's first active lane (`waveReadLaneFirst`) for a divergent non-uniform `v_readfirstlane` instead of refusing.* That's 8 lines: ```rust if divergent && self.wave64 == Wave64Mode::Emulate { let c = self.cur; self.s.flags |= flags::WAVE_OPS; let i32t = self.s.t.i32; return Ok(self.s.op(c, "waveReadLaneFirst.i32", Attr::NoUnwind, i32t, 118, &[val])); } ``` | | pipelines | vs main: gained | lost | |---|---:|---:|---:| | main | 1,121 | | | | #189 `Emulate` | 1,078 | 94 | 137 | | #189 `Wave32` | 1,236 | 117 | 2 | | **#189 `Emulate` + prototype 2** | **1,229** | **110** | **2** (the 32 KiB ones) | - `cargo test -p victory-shader -p victory-gpu`: 196 passed. The one failure is `divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32`, which asserts that `Emulate` refuses this case, so it fails by design. The empty-EXEC GPU test passes. - In the world on #578 + #189 + prototype 2: no removal in 367 s, 0 divergent-`readfirstlane` refusals (91 before), 4.7 fps. - **Without #578**, #189 + prototype 2: `d3e44e754b3eb6aa` gets a pipeline and runs for **23 s**, with no slow submission. Then the run ends on the known wave64 **mesh** hang (`DispatchMesh`, mesh `51ff151f75cd5759`), not on `d3e44e754b3eb6aa`. In `Wave32` it hung on that program 43 s after its pipeline, so 23 s is suggestive and not proof. - **Not a fix, given @⁠Yorivel's 4090 result.** For a divergent non-uniform value it gives the host wave's first lane, as main does, and main's lowering of `d3e44e754b3eb6aa` hangs on a 4090. So prototype 2 recovers 110 programs, but at least one of them can hang depending on the card. Refusing it, as `Emulate` does today, is the safer default. I'm posting the numbers so the trade-off is visible, not as a recommendation. Exact 64-lane semantics would need the LDS exchange, which can't run in divergent flow. AI-assisted (Claude Code).
Author
Owner

@⁠Bullet18x on GitHub · 2026-11-24 20:06 UTC · original

RTX 5090 (32-lane waves), driver 621.40, Windows 11 Pro 10.0.28000, head 54b333f on ffe310e.

Tests: cargo test -p victory-shader --locked: 143 passed, 1 failed, 1 ignored:

  • emit::wave64_tests::gpu::gpu_128_threads_ds_swizzle_and_dpp_row_mask (wave64_tests.rs:831): ds_swizzle_dpp_rowmask (Wave32, warp=true) output mismatch. The first 20 outputs match; from index 20 on, values differ (e.g. got 2818070 / 2424855 where 2555926 / 2686999 was expected).
  • This case runs on WARP (warp=true), so it may depend on this Windows Insider build's WARP (10.0.28000); the GTX 1060 / Windows 10 19045 run above passes all 144.

In the title (diag build, warm cache, default adapter): with Emulate as the default on this 32-lane GPU, host pipeline refused ... 0x80070057 drops from 114–138 per run on main to 0. shader does not translate rises from 424 to 535 (476 compute; most common errors: a select on an untracked lane mask, a lane mask holding lanes …, v_readfirstlane in divergent code, a descriptor read only …). The world is still reached and the run still ends in DXGI_ERROR_DEVICE_HUNG, here after ~15 s in the world instead of 35–100 s on main; one run, so not conclusive. Other experiments on this machine: #1586.

AI use: Claude Code (Claude Opus 5.5) built, ran and summarised; I checked it.

**@⁠Bullet18x** on GitHub · 2026-11-24 20:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7143059450) RTX 5090 (32-lane waves), driver 621.40, Windows 11 Pro 10.0.28000, head `54b333f` on `ffe310e`. **Tests**: `cargo test -p victory-shader --locked`: 143 passed, **1 failed**, 1 ignored: - `emit::wave64_tests::gpu::gpu_128_threads_ds_swizzle_and_dpp_row_mask` (wave64_tests.rs:831): `ds_swizzle_dpp_rowmask (Wave32, warp=true) output mismatch`. The first 20 outputs match; from index 20 on, values differ (e.g. got 2818070 / 2424855 where 2555926 / 2686999 was expected). - This case runs on WARP (`warp=true`), so it may depend on this Windows Insider build's WARP (10.0.28000); the GTX 1060 / Windows 10 19045 run above passes all 144. **In the title** (diag build, warm cache, default adapter): with Emulate as the default on this 32-lane GPU, `host pipeline refused ... 0x80070057` drops from 114–138 per run on `main` to **0**. `shader does not translate` rises from 424 to 535 (476 compute; most common errors: a select on an untracked lane mask, a lane mask holding lanes …, `v_readfirstlane` in divergent code, a descriptor read only …). The world is still reached and the run still ends in `DXGI_ERROR_DEVICE_HUNG`, here after ~15 s in the world instead of 35–100 s on `main`; one run, so not conclusive. Other experiments on this machine: #1586. AI use: Claude Code (Claude Opus 5.5) built, ran and summarised; I checked it.
Author
Owner

@⁠omeyasawant on GitHub · 2026-11-24 20:39 UTC · original

Independent Windows test run of PR head 54b333fc5c2793bd5b7cd539f11fa4e326c5fb0d, on main ffe310e.

Hardware installed: Intel i7-14700K, 192 GiB RAM, RTX 5090 (driver 32.0.16.1088), Intel UHD 770 (32.0.101.7088). Windows 11 Pro 10.0.26200, Rust 1.98.1 MSVC, DXC x64 validator 1.9.2609.5 via VICTORY_DXIL.

  • cargo test -p victory-shader --locked -- wave64 --test-threads=1: 26 passed, 0 failed, 0 ignored.
  • cargo test --workspace --locked -- --test-threads=1: 366 passed, 0 failed, 6 ignored.
  • cargo build --profile diag -p victory --features diagnostics --locked: passed.

The test host chooses its default D3D12 adapter and WARP. I did not independently record the hardware adapter chosen by those synthetic tests, so the hardware inventory above must not be read as proof that every GPU test executed on the RTX 5090. Optional tests can return early without their sample/compiler inputs.

A local diagnostic title run selected wave64_mode=Emulate; this is not a verified gameplay result. Further runtime experiments add #967 for explicit RTX 5090 selection and the texture-resource commit from #1630. Those integrations are not an isolated end-to-end evaluation of this PR, and I am not attributing their rendering results to wave64 emulation alone.

No game data, captures or shader dumps attached.

AI assistance: OpenAI Codex ran tests and drafted this report at the account owner's request. Exact runtime model identifier unavailable.

**@⁠omeyasawant** on GitHub · 2026-11-24 20:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7143890626) Independent Windows test run of PR head `54b333fc5c2793bd5b7cd539f11fa4e326c5fb0d`, on main `ffe310e`. Hardware installed: Intel i7-14700K, 192 GiB RAM, RTX 5090 (driver 32.0.16.1088), Intel UHD 770 (32.0.101.7088). Windows 11 Pro 10.0.26200, Rust 1.98.1 MSVC, DXC x64 validator 1.9.2609.5 via `VICTORY_DXIL`. - `cargo test -p victory-shader --locked -- wave64 --test-threads=1`: **26 passed, 0 failed, 0 ignored**. - `cargo test --workspace --locked -- --test-threads=1`: **366 passed, 0 failed, 6 ignored**. - `cargo build --profile diag -p victory --features diagnostics --locked`: passed. The test host chooses its default D3D12 adapter and WARP. I did not independently record the hardware adapter chosen by those synthetic tests, so the hardware inventory above must not be read as proof that every GPU test executed on the RTX 5090. Optional tests can return early without their sample/compiler inputs. A local diagnostic title run selected `wave64_mode=Emulate`; this is not a verified gameplay result. Further runtime experiments add #967 for explicit RTX 5090 selection and the texture-resource commit from #1630. Those integrations are not an isolated end-to-end evaluation of this PR, and I am not attributing their rendering results to wave64 emulation alone. No game data, captures or shader dumps attached. AI assistance: OpenAI Codex ran tests and drafted this report at the account owner's request. Exact runtime model identifier unavailable.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-24 20:49 UTC · original

RTX 4090 (32-lane waves, driver 32.0.16.2124), Windows 11 26300, title 1.0.2.1, diag build, VICTORY_D3D12_DRED=1, VICTORY_SHADER_LOOP_LIMIT=1024. Tree: main ffe310e + #493 (c48b240) + #32, without #578, so main's lowering of d3e44e754b3eb6aa runs.

On the open point above: main's lowering of d3e44e754b3eb6aa does not terminate in the world on this card. The world reached about 2,100 draws/frame at 1.1–1.6 fps. The program's pipeline finished building 46 s in, and 18 s later the device was removed (0x887A0006) after a single 5,023 ms submission. DRED: one list, stopped at command 395 of 702. The only dispatch between its barriers (commands 295..407) was command 296: dispatch 136x1x1 [compute d3e44e754b3eb6aa]. No page fault reported.

One run. It fits the #71 row where this program hangs with mesh skipped.

AI-assisted test report.

**@⁠Yorivel** on GitHub · 2026-11-24 20:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7144096921) RTX 4090 (32-lane waves, driver 32.0.16.2124), Windows 11 26300, title 1.0.2.1, diag build, `VICTORY_D3D12_DRED=1`, `VICTORY_SHADER_LOOP_LIMIT=1024`. Tree: `main` `ffe310e` + #493 (`c48b240`) + #32, **without #578**, so main's lowering of `d3e44e754b3eb6aa` runs. On the open point above: **main's lowering of `d3e44e754b3eb6aa` does not terminate in the world on this card.** The world reached about 2,100 draws/frame at 1.1–1.6 fps. The program's pipeline finished building 46 s in, and 18 s later the device was removed (`0x887A0006`) after a single 5,023 ms submission. DRED: one list, stopped at `command 395 of 702`. The only dispatch between its barriers (commands 295..407) was `command 296: dispatch 136x1x1 [compute d3e44e754b3eb6aa]`. No page fault reported. One run. It fits the #71 row where this program hangs with mesh skipped. AI-assisted test report.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-24 21:27 UTC · original

@⁠Bullet18x, both examples from your WARP Wave32 report on Windows build 28000 point to the masked DPP shift-and-add. The combined shader packs the XOR-2 shuffle into the low 16 bits and the shifted sum into the high 16 bits, so we can check each half of the words you posted.

Lane Packed word, expected → got XOR-2 shuffle, expected → got Masked shift-and-add, expected → got
20 2555926 → 2818070 22 → 22 39 → 43
21 2686999 → 2424855 23 → 23 41 → 37

Both lanes are in an enabled 16-lane row. The expected sums are 20 + 19 = 39 and 21 + 20 = 41. This identifies which output differed in the combined shader. Running the operations separately on build 28000 would tell us whether the shift also fails on its own.

I ran the original 128-lane test and two new single-operation tests at PR head 54b333f on Windows 11 build 26300.10075. All 128 lanes matched in each test, in every mode listed. Each WARP version ran in five fresh processes, with the RTX 5080 tested alongside it.

Adapter Reported wave range Modes exercised Mismatches per 128 lanes, shuffle / masked shift / combined
RTX 5080, driver 621.24 32–32 Wave32, Emulate 0 / 0 / 0
Built-in Windows WARP 4–4 Emulate 0 / 0 / 0
App-local Microsoft WARP 1.0.22 4–128 Wave32, Emulate 0 / 0 / 0

Rerun on the affected machine. I kept the original combined test and added one shader for each operation. The test commit is directly on top of 54b333f. There’s also a downloadable patch.

From your checkout of this PR at 54b333f, using the same WARP setup as in your report:

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr189-lane-checks
git cherry-pick 99135ba50a2392b3e7e444ea03625306e2efaa37
cargo test -p victory-shader --lib --locked -- gpu_128_threads_ds_swizzle gpu_128_threads_dpp_row_shr_mask_a --nocapture --test-threads=1

That command runs exactly the three tests. If the mismatch reproduces, could you share which test names fail for (Wave32, warp=true) and the actual and expected values at the first differing lane?

**@⁠steven-seagull27** on GitHub · 2026-11-24 21:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7144958039) @⁠Bullet18x, both examples from your [WARP Wave32 report on Windows build 28000](https://git.gtahub.st/github/Marvisak--VIctory/pulls/189) point to the masked DPP shift-and-add. The combined shader packs the XOR-2 shuffle into the low 16 bits and the shifted sum into the high 16 bits, so we can check each half of the words you posted. | Lane | Packed word, expected → got | XOR-2 shuffle, expected → got | Masked shift-and-add, expected → got | |---|---|---|---| | 20 | 2555926 → 2818070 | 22 → 22 | **39 → 43** | | 21 | 2686999 → 2424855 | 23 → 23 | **41 → 37** | Both lanes are in an enabled 16-lane row. The expected sums are `20 + 19 = 39` and `21 + 20 = 41`. This identifies which output differed in the combined shader. Running the operations separately on build 28000 would tell us whether the shift also fails on its own. I ran the original 128-lane test and two new single-operation tests at PR head `54b333f` on Windows 11 build `26300.10075`. All 128 lanes matched in each test, in every mode listed. Each WARP version ran in five fresh processes, with the RTX 5080 tested alongside it. | Adapter | Reported wave range | Modes exercised | Mismatches per 128 lanes, shuffle / masked shift / combined | |---|---|---|---| | RTX 5080, driver 621.24 | 32–32 | Wave32, Emulate | 0 / 0 / 0 | | Built-in Windows WARP | 4–4 | Emulate | 0 / 0 / 0 | | App-local Microsoft WARP 1.0.22 | 4–128 | Wave32, Emulate | 0 / 0 / 0 | **Rerun on the affected machine.** I kept the original combined test and added one shader for each operation. The [test commit](https://github.com/steven-seagull27/VIctory/commit/99135ba50a2392b3e7e444ea03625306e2efaa37) is directly on top of `54b333f`. There’s also a [downloadable patch](https://github.com/steven-seagull27/VIctory/commit/99135ba50a2392b3e7e444ea03625306e2efaa37.patch). From your checkout of this PR at `54b333f`, using the same WARP setup as in your report: ```powershell git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr189-lane-checks git cherry-pick 99135ba50a2392b3e7e444ea03625306e2efaa37 cargo test -p victory-shader --lib --locked -- gpu_128_threads_ds_swizzle gpu_128_threads_dpp_row_shr_mask_a --nocapture --test-threads=1 ``` That command runs exactly the three tests. If the mismatch reproduces, could you share which test names fail for `(Wave32, warp=true)` and the actual and expected values at the first differing lane?
Author
Owner

@⁠meqsedus on GitHub · 2026-11-24 22:09 UTC · original

Tested this PR (54b333f) on NVIDIA: the world hangs come from translated shader loops running to the loop limit.

Setup: Windows 11, RTX 3050 Ti Laptop (4 GB, driver 32.0.16.2140), i7-11800H, 32 GB RAM. Each run used its own fresh VICTORY_CACHE_DIR.

Run Build / settings Result Slowest submission
main release, TdrDelay 10 device removed at 1:48 (cutscene start) 11.7 s
PR #189 release, TdrDelay 10 device removed at 2:04 11.4 s
PR #189 release, TdrDelay 60 device removed at 2:32, nvlddmkm 153 ~9 s into the submission 14.4 s
PR #189 diagnostics, VICTORY_D3D12_DRED=1 VICTORY_GPU_TIMING=1 device removed at 3:13 8.1 s
PR #189 diagnostics, VICTORY_SHADER_LOOP_LIMIT=4096 no hang, ran 8:40 until closed 0.44 s (avg 0.35 s)

DRED (diagnostics run): there was no page fault, so the GPU hung rather than faulted. The list stopped at command 82 of 135 (op 42). Commands 79..133 are mesh draws, mostly [mesh c962201cddbdd7dd, pixel 57a27c5e2e1d62a9], plus some [mesh 857b2e13c9cc107f, pixel 63051e97862e7dad]. Earlier crashes had other mesh pipelines in the failing submission, so I don't think it is one specific shader.

Takeaways:

  • On NVIDIA, this PR doesn't change stability compared to main: both hang once the world/cutscene starts.
  • Raising TDR doesn't help: the driver resets before 60 s.
  • With a lower loop limit the hangs go away, which per the README points at loops that hit the limit, i.e. likely a translation issue in some shaders' loop exit conditions.

I haven't found which shader yet. Happy to bisect with VICTORY_SKIP_PIPELINES or run other builds if useful.

**@⁠meqsedus** on GitHub · 2026-11-24 22:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7145867847) Tested this PR (54b333f) on NVIDIA: the world hangs come from translated shader loops running to the loop limit. **Setup:** Windows 11, RTX 3050 Ti Laptop (4 GB, driver 32.0.16.2140), i7-11800H, 32 GB RAM. Each run used its own fresh `VICTORY_CACHE_DIR`. | Run | Build / settings | Result | Slowest submission | |---|---|---|---| | main | release, TdrDelay 10 | device removed at 1:48 (cutscene start) | 11.7 s | | PR #189 | release, TdrDelay 10 | device removed at 2:04 | 11.4 s | | PR #189 | release, TdrDelay 60 | device removed at 2:32, nvlddmkm 153 ~9 s into the submission | 14.4 s | | PR #189 | diagnostics, `VICTORY_D3D12_DRED=1 VICTORY_GPU_TIMING=1` | device removed at 3:13 | 8.1 s | | PR #189 | diagnostics, `VICTORY_SHADER_LOOP_LIMIT=4096` | **no hang, ran 8:40 until closed** | **0.44 s** (avg 0.35 s) | **DRED (diagnostics run):** there was no page fault, so the GPU hung rather than faulted. The list stopped at command 82 of 135 (op 42). Commands 79..133 are mesh draws, mostly `[mesh c962201cddbdd7dd, pixel 57a27c5e2e1d62a9]`, plus some `[mesh 857b2e13c9cc107f, pixel 63051e97862e7dad]`. Earlier crashes had other mesh pipelines in the failing submission, so I don't think it is one specific shader. **Takeaways:** - On NVIDIA, this PR doesn't change stability compared to main: both hang once the world/cutscene starts. - Raising TDR doesn't help: the driver resets before 60 s. - With a lower loop limit the hangs go away, which per the README points at loops that hit the limit, i.e. likely a translation issue in some shaders' loop exit conditions. I haven't found which shader yet. Happy to bisect with `VICTORY_SKIP_PIPELINES` or run other builds if useful.
Author
Owner

@⁠MrEjecutor on GitHub · 2026-11-24 22:21 UTC · original

RTX 5060 Ti (32-lane waves), offline over the retail shaders: the default Emulate mode leaves 43 fewer working compute pipelines than main; Wave32 gives 115 more; every program Emulate handles, Wave32 handles too

Tested 54b333f (this PR alone on main ffe310e), with victory translate <game dir> --validate --pipelines --list on an RTX 5060 Ti (driver 621.24, Windows 11 26200, Rust 1.100). "Working" below means the compute program translated, validated, and its host pipeline was created on this card.

working compute pipelines vs main
main ffe310e 1,121 of 2,582
this PR, default mode (Emulate) 1,078 +94, −137
this PR, Wave32 mode 1,236 +117, −2

What Emulate loses (working on main, refused here): 132 with v_readfirstlane in divergent control flow (emulated_readfirstlane refuses it unless the mode is Wave32), 3 with a lane mask from a carry, 2 with LDS exceeding 32 KiB with wave64 emulation. The families include sr_denoising (10), indirect_diffuse_lighting (7), WaterSimMgr (7), smh_accessory (6), ambient_map (5), water_shading (5).

Per program, the set that works with Emulate is a subset of the one that works with Wave32 (0 programs work only with Emulate; 158 only with Wave32). So a per-program fallback, Emulate first and Wave32 only for a program the emulation refuses, would keep Emulate wherever it applies and reach the same 1,236.

The same numbers come out of #1589 at d83d4f8 against the stack under it (ca601f0): 1,652 → 1,609 working compute pipelines (+97, −140, 135 of them v_readfirstlane in divergent control flow). So it is this PR's default, not the bundle's merge.

Caveat: this counts what translates and builds, not what runs correctly. The comment in host.rs says Wave32 has divergent and cross-half miscompilations, and I have not checked any of these programs' output. To count Wave32 offline I changed one line locally in apps/victory/src/translate.rs so it honours VICTORY_WAVE64_EMULATE=wave32 (the runtime already does, through shader_cache.rs); that change is not proposed here.

Not tested: the title with either mode; AMD (native wave64, unaffected); #1589's newer head 60fa5d7.

AI use: Claude Code (Claude Opus 5.5) built, measured and wrote this; checked by mrejecutor.

**@⁠MrEjecutor** on GitHub · 2026-11-24 22:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7146126518) **RTX 5060 Ti (32-lane waves), offline over the retail shaders: the default `Emulate` mode leaves 43 fewer working compute pipelines than `main`; `Wave32` gives 115 more; every program `Emulate` handles, `Wave32` handles too** Tested `54b333f` (this PR alone on `main` `ffe310e`), with `victory translate <game dir> --validate --pipelines --list` on an RTX 5060 Ti (driver 621.24, Windows 11 26200, Rust 1.100). "Working" below means the compute program translated, validated, and its host pipeline was created on this card. | | working compute pipelines | vs `main` | |---|---|---| | `main` `ffe310e` | 1,121 of 2,582 | | | this PR, default mode (`Emulate`) | 1,078 | +94, −137 | | this PR, `Wave32` mode | 1,236 | +117, −2 | What `Emulate` loses (working on `main`, refused here): 132 with `v_readfirstlane in divergent control flow` (`emulated_readfirstlane` refuses it unless the mode is `Wave32`), 3 with `a lane mask from a carry`, 2 with `LDS exceeding 32 KiB with wave64 emulation`. The families include `sr_denoising` (10), `indirect_diffuse_lighting` (7), `WaterSimMgr` (7), `smh_accessory` (6), `ambient_map` (5), `water_shading` (5). Per program, the set that works with `Emulate` is a subset of the one that works with `Wave32` (0 programs work only with `Emulate`; 158 only with `Wave32`). So a per-program fallback, `Emulate` first and `Wave32` only for a program the emulation refuses, would keep `Emulate` wherever it applies and reach the same 1,236. The same numbers come out of #1589 at `d83d4f8` against the stack under it (`ca601f0`): 1,652 → 1,609 working compute pipelines (+97, −140, 135 of them `v_readfirstlane in divergent control flow`). So it is this PR's default, not the bundle's merge. **Caveat:** this counts what translates and builds, not what runs correctly. The comment in `host.rs` says `Wave32` has divergent and cross-half miscompilations, and I have not checked any of these programs' output. To count `Wave32` offline I changed one line locally in `apps/victory/src/translate.rs` so it honours `VICTORY_WAVE64_EMULATE=wave32` (the runtime already does, through `shader_cache.rs`); that change is not proposed here. **Not tested:** the title with either mode; AMD (native wave64, unaffected); #1589's newer head `60fa5d7`. **AI use:** Claude Code (Claude Opus 5.5) built, measured and wrote this; checked by mrejecutor.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:20 UTC · original · edited 2026-11-26 01:19 UTC

Automated triage for the maintainers.

Needs work. Rebased; it merges cleanly and CI passes (check). Thanks also to moe-miau for the in-game port. Two earlier asks are still open:

  • File encoding. crates/victory-shader/src/emit/lower.rs and the new emit/lower/wave64.rs start with a UTF-8 BOM. Many existing comments in lower.rs are rewritten as mojibake (× becomes ×, → becomes →, 2π becomes 2Ï€, e.g. "Block × 4096", "32 × 32-bit product"). Please drop the BOMs and keep main's comment text unchanged.
  • Divergent v_readfirstlane_b32 in Emulate. wave64.rs::emulated_readfirstlane now returns host_wave_readfirstlane there, the first active lane of the host wave (as small as 4 lanes on WARP), instead of refusing. That is right only when the value is uniform across the active lanes. Please either show it holds for the title's shaders (e.g. the refusal/translation counts plus a check of the affected programs), or keep refusing the divergent case in Emulate.

With those two fixed, the rest (the Wave64Mode selection in shader_cache.rs/host.rs, the split-wave lowering, the tests) can be reviewed on its merits.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7148402148) · edited 2026-11-26 01:19 UTC <!-- victory-triage v1 head=3e39e34037915da6d0f10b58b2872799bd9f3ca8 verdict=needs-work at=2026-11-26T01:19:51Z --> Automated triage for the maintainers. **Needs work.** Rebased; it merges cleanly and CI passes (`check`). Thanks also to moe-miau for the in-game port. Two earlier asks are still open: - **File encoding.** `crates/victory-shader/src/emit/lower.rs` and the new `emit/lower/wave64.rs` start with a UTF-8 BOM. Many existing comments in `lower.rs` are rewritten as mojibake (`×` becomes `×`, `→` becomes `→`, `2π` becomes `2Ï€`, e.g. "Block × 4096", "32 × 32-bit product"). Please drop the BOMs and keep `main`'s comment text unchanged. - **Divergent `v_readfirstlane_b32` in `Emulate`.** `wave64.rs::emulated_readfirstlane` now returns `host_wave_readfirstlane` there, the first active lane of the host wave (as small as 4 lanes on WARP), instead of refusing. That is right only when the value is uniform across the active lanes. Please either show it holds for the title's shaders (e.g. the refusal/translation counts plus a check of the affected programs), or keep refusing the divergent case in `Emulate`. With those two fixed, the rest (the `Wave64Mode` selection in `shader_cache.rs`/`host.rs`, the split-wave lowering, the tests) can be reviewed on its merits. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

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

#189 carried onto main 70564ae, with in-game results on an RTX 4070 SUPER

@⁠alfycs, since main moved by 28 commits last night, this PR conflicts in gpu/host.rs, gpu/shader_cache.rs, emit/mod.rs, emit/valu_tests.rs and emit/lower.rs (9 hunks). I carried it onto 70564ae. Use it or ignore it as you like:

How the conflicts were resolved

  • mod.rs: options goes into main's new parts closure, so both of its lowering attempts (with and without killed helper lanes) get it.
  • shader_cache.rs: main's redesigned cache (refusals stored, from-disk flag) with your mode byte in the key and VICTORY_WAVE64_EMULATE.
  • host.rs: main's multiply-add fusing check and your mode selection both run.
  • lower.rs:
    • find_sections gives way to your compute_sections (main had not changed its body).
    • mask_dword keeps your emulated path, and the native path takes main's new mask_number for a mask holding lanes elsewhere. The high dword is zeroed for Wave32 with 32 threads or fewer, as you do for ballots.
    • The DPP code keeps your in-range source lane, plus main's helpers_read quad path.
    • Main's new ds_bpermute_b32 stays ahead of your check on the title's own LDS size.
  • New on main, needing handling in your code:
    • Op::AddH added to apply_wave_op.
    • Shape::Half refused in a split 64-lane wave, since its host wave operation would only cover one half.

One harness change was needed. After the merge, all 11 wave64_tests::gpu tests removed the device on NVIDIA. The DXIL of your emulation was identical before and after (checked with dxc -dumpbin). The only difference was main's new view-stride table: every heap buffer read now goes through root SRV t255, and run_on_hosts passed no roots, so the shader read an unbound root view. The port binds a stride table for the raw UAV in heap slot 0. With that, all 26 wave64 tests pass on the RTX 4070 SUPER, the 11 GPU ones included. On your original head on ffe310e they also pass here.

I added one test, gpu_8x8x4_threads_console_lanes_follow_the_flat_thread_index. XCL's notes on the same technique (docs/wave64-on-wave32.md) report that an RTX 5070 Ti does not form its 32-lane waves from consecutive flat thread indices for an 8×8×4 group, which would break the (waveReadLaneFirst(flat) & !31) + laneIndex mapping. The test checks v_mbcnt against flat % 64 for an 8×8×4 group. It passes in both modes on the RTX 4070 SUPER, so it is a guard for other GPUs, not a reproduction.

CI-equivalent checks on the branch: both clippy configurations are clean, and cargo xtask policy passes. In cargo test --workspace, 5 tests fail, the same 5 that fail on plain 70564ae on this card: the two NVIDIA heap-cap tests (#1770 covers them) and three host-GPU shader tests.

In-game. Setup:

  • RTX 4070 SUPER, driver 32.0.16.1742, Windows 11 26300.
  • Title 1.0.2.1, Series X profile, diag build.
  • 70564ae + this port + #968 (needed on NVIDIA to get past the #1753 removal at 32 s).
  • A save past first-boot setup, then VICTORY_KEYS pressing Enter into the intro cutscene (from about 90 s).
  • A fresh shader cache per run.
Build Pipelines refused Shaders not translated GPU removal
70564ae + #968 (no port) 137 about 19 none in 240 s and 420 s runs
+ port, Emulate (default on this GPU) 0 155, 77 of them split-wave refusals 0x887A0006 at 224 s
+ port, VICTORY_WAVE64_EMULATE=wave32 0 112, 43 of them split-wave refusals 0x887A0006 at 271 s
+ port + #1733, wave32 0 96, 38 of them split-wave refusals 0x887A0006 at 203 s

The 3D picture stays black in all of them. Two points:

  1. Wave32 beats Emulate on coverage here too: 43 split-wave refusals against 77. That agrees with the offline counts above. On this evidence I'd make Wave32 the default on 32-lane hosts.
  2. The removal is the watchdog, not an invalid command.
    • Before each removal, single submissions take 2.5 to 7 s.
    • With VICTORY_D3D12_DRED=1 VICTORY_GPU_TIMING=1, the slowest single command is dispatch 16x16x16 [compute 00167d58cc5a78d7] at about 7 s. That is the same with the port (6.9 s) and without it (7.2 s), and that baseline also timed out under the timing overhead.
    • Next come dispatch 128x64x1 [compute 42683eebec081520] (1.5 s) and indirect mesh draws (about 1.2 s each).
    • VICTORY_SHADER_LOOP_LIMIT=1024 makes cutscene frames about ten times faster (about 1.1 fps against 0.1 fps).
    • So loops with huge trip counts dominate, as in #1581. The port only adds work by running the roughly 140 programs that were refused before.
    • VICTORY_SKIP_PIPELINES on the shader DRED named (f607780aa8e502d0, indirect) does not prevent the removal.

These are single runs per build, with no debug layer and no cache warm-up. Counts and times only, no game data.

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

**@⁠moe-miau** on GitHub · 2026-11-25 00:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7148578207) **#189 carried onto `main` `70564ae`, with in-game results on an RTX 4070 SUPER** @⁠alfycs, since `main` moved by 28 commits last night, this PR conflicts in `gpu/host.rs`, `gpu/shader_cache.rs`, `emit/mod.rs`, `emit/valu_tests.rs` and `emit/lower.rs` (9 hunks). I carried it onto `70564ae`. Use it or ignore it as you like: - Branch: [`moe-miau/VIctory@port/wave64-on-70564ae`](https://github.com/moe-miau/VIctory/tree/port/wave64-on-70564ae), one commit `9958eb9` with you as the author. Its message lists each resolution. **How the conflicts were resolved** - `mod.rs`: `options` goes into main's new `parts` closure, so both of its lowering attempts (with and without killed helper lanes) get it. - `shader_cache.rs`: main's redesigned cache (refusals stored, from-disk flag) with your mode byte in the key and `VICTORY_WAVE64_EMULATE`. - `host.rs`: main's multiply-add fusing check and your mode selection both run. - `lower.rs`: - `find_sections` gives way to your `compute_sections` (main had not changed its body). - `mask_dword` keeps your emulated path, and the native path takes main's new `mask_number` for a mask holding lanes elsewhere. The high dword is zeroed for `Wave32` with 32 threads or fewer, as you do for ballots. - The DPP code keeps your in-range source lane, plus main's `helpers_read` quad path. - Main's new `ds_bpermute_b32` stays ahead of your check on the title's own LDS size. - New on main, needing handling in your code: - `Op::AddH` added to `apply_wave_op`. - `Shape::Half` refused in a split 64-lane wave, since its host wave operation would only cover one half. **One harness change was needed.** After the merge, all 11 `wave64_tests::gpu` tests removed the device on NVIDIA. The DXIL of your emulation was identical before and after (checked with `dxc -dumpbin`). The only difference was main's new view-stride table: every heap buffer read now goes through root SRV `t255`, and `run_on_hosts` passed no roots, so the shader read an unbound root view. The port binds a stride table for the raw UAV in heap slot 0. With that, **all 26 wave64 tests pass on the RTX 4070 SUPER**, the 11 GPU ones included. On your original head on `ffe310e` they also pass here. **I added one test,** `gpu_8x8x4_threads_console_lanes_follow_the_flat_thread_index`. XCL's notes on the same technique ([docs/wave64-on-wave32.md](https://github.com/xcl-dev/xcl/blob/main/docs/wave64-on-wave32.md)) report that an RTX 5070 Ti does not form its 32-lane waves from consecutive flat thread indices for an 8×8×4 group, which would break the `(waveReadLaneFirst(flat) & !31) + laneIndex` mapping. The test checks `v_mbcnt` against `flat % 64` for an 8×8×4 group. It passes in both modes on the RTX 4070 SUPER, so it is a guard for other GPUs, not a reproduction. **CI-equivalent checks on the branch:** both clippy configurations are clean, and `cargo xtask policy` passes. In `cargo test --workspace`, 5 tests fail, the same 5 that fail on plain `70564ae` on this card: the two NVIDIA heap-cap tests (#1770 covers them) and three host-GPU shader tests. **In-game.** Setup: - RTX 4070 SUPER, driver 32.0.16.1742, Windows 11 26300. - Title 1.0.2.1, Series X profile, diag build. - `70564ae` + this port + #968 (needed on NVIDIA to get past the #1753 removal at 32 s). - A save past first-boot setup, then `VICTORY_KEYS` pressing Enter into the intro cutscene (from about 90 s). - A fresh shader cache per run. | Build | Pipelines refused | Shaders not translated | GPU removal | |---|---|---|---| | `70564ae` + #968 (no port) | 137 | about 19 | none in 240 s and 420 s runs | | + port, `Emulate` (default on this GPU) | **0** | 155, 77 of them split-wave refusals | `0x887A0006` at 224 s | | + port, `VICTORY_WAVE64_EMULATE=wave32` | **0** | 112, 43 of them split-wave refusals | `0x887A0006` at 271 s | | + port + #1733, `wave32` | 0 | 96, 38 of them split-wave refusals | `0x887A0006` at 203 s | The 3D picture stays black in all of them. Two points: 1. **`Wave32` beats `Emulate` on coverage here too**: 43 split-wave refusals against 77. That agrees with the offline counts above. On this evidence I'd make `Wave32` the default on 32-lane hosts. 2. **The removal is the watchdog, not an invalid command.** - Before each removal, single submissions take 2.5 to 7 s. - With `VICTORY_D3D12_DRED=1 VICTORY_GPU_TIMING=1`, the slowest single command is `dispatch 16x16x16 [compute 00167d58cc5a78d7]` at about 7 s. That is the same with the port (6.9 s) and without it (7.2 s), and that baseline also timed out under the timing overhead. - Next come `dispatch 128x64x1 [compute 42683eebec081520]` (1.5 s) and indirect mesh draws (about 1.2 s each). - `VICTORY_SHADER_LOOP_LIMIT=1024` makes cutscene frames about ten times faster (about 1.1 fps against 0.1 fps). - So loops with huge trip counts dominate, as in #1581. The port only adds work by running the roughly 140 programs that were refused before. - `VICTORY_SKIP_PIPELINES` on the shader DRED named (`f607780aa8e502d0`, indirect) does not prevent the removal. These are single runs per build, with no debug layer and no cache warm-up. Counts and times only, no game data. AI-assisted (Claude Code); runs done on my machine.
Author
Owner

@⁠MrEjecutor on GitHub · 2026-11-25 01:27 UTC · original

The port onto 70564ae on Blackwell (RTX 5060 Ti): all 27 wave64 tests pass, the 8x8x4 lane-order one included; in the title it trades 394 host refusals for 458 more programs that do not translate, and the world hang is unchanged

Tested @⁠moe-miau's port (port/wave64-on-70564ae, 9958eb9) merged onto 70564ae + #1775 + #1800 (those two only get this card past the boot, see #1800), against the same stack without the port.

Setup: RTX 5060 Ti 16 GB (Blackwell, 32-lane waves), driver 621.24; Intel Core Ultra 5 225F; 32 GB; Windows 11 26200; Rust 1.100; Series X profile.

Unit tests (cargo test -p victory-shader --lib -- wave64, hardware adapter then WARP): 27 passed, 0 failed, the 12 wave64_tests::gpu ones included. gpu_8x8x4_threads_console_lanes_follow_the_flat_thread_index passes here, so on this Blackwell card and driver the lanes of an 8x8x4 group do follow the flat thread index.

Warm-up (translate --cache --pipelines, pipelines of the shader pack skipped, by reason):

without the port with the port
the host refuses it 395 1
compute shader does not translate 61 519
pixel shader does not translate 40 40

In the title (diag build, VICTORY_D3D12_DRED=1, same scripted input, one run each, each after its own warm-up):

without the port with the port
world from 119 s 80 s
untranslated shaders reported in the run 15 173
slow submissions of about 5.65 s 10 9
end device removed at 186 s (0x887A0006) device removed at 179 s (0x887A0006)

Of the 173, the emulation's own refusals are 150: v_readfirstlane in divergent control flow 66, LDS accesses without a uniform LDS fence in split wave64 43, a 64-lane wave ballot in divergent control flow 35, a wave reduction in divergent control flow 6. That is the same pattern as my offline count on the old base above.

The hang does not move: both runs have the same kind of series of submissions of about 5.65 s (5,647 to 5,655 ms with the port, 5,655 to 5,720 ms and one of 5,333 ms without; that steadiness looks like a loop running to its limit rather than GPU load), and both end in DEVICE_HUNG with two nvlddmkm resets. So on this card the 64-lane programs the host refuses are not what hangs the world; that matches the loop-limit runs reported above on the RTX 3050 Ti.

Not tested: VICTORY_WAVE64_EMULATE=wave32; a lower VICTORY_SHADER_LOOP_LIMIT with the port; current main (this is 70564ae); more than one run each.

AI use: Claude Code built, ran and wrote this; checked by mrejecutor. No game data attached.

**@⁠MrEjecutor** on GitHub · 2026-11-25 01:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7149577238) **The port onto `70564ae` on Blackwell (RTX 5060 Ti): all 27 wave64 tests pass, the 8x8x4 lane-order one included; in the title it trades 394 host refusals for 458 more programs that do not translate, and the world hang is unchanged** Tested @⁠moe-miau's port (`port/wave64-on-70564ae`, `9958eb9`) merged onto `70564ae` + #1775 + #1800 (those two only get this card past the boot, see #1800), against the same stack without the port. **Setup:** RTX 5060 Ti 16 GB (Blackwell, 32-lane waves), driver 621.24; Intel Core Ultra 5 225F; 32 GB; Windows 11 26200; Rust 1.100; Series X profile. **Unit tests** (`cargo test -p victory-shader --lib -- wave64`, hardware adapter then WARP): **27 passed, 0 failed**, the 12 `wave64_tests::gpu` ones included. `gpu_8x8x4_threads_console_lanes_follow_the_flat_thread_index` passes here, so on this Blackwell card and driver the lanes of an 8x8x4 group do follow the flat thread index. **Warm-up** (`translate --cache --pipelines`, pipelines of the shader pack skipped, by reason): | | without the port | with the port | |---|---|---| | the host refuses it | 395 | 1 | | compute shader does not translate | 61 | 519 | | pixel shader does not translate | 40 | 40 | **In the title** (diag build, `VICTORY_D3D12_DRED=1`, same scripted input, one run each, each after its own warm-up): | | without the port | with the port | |---|---|---| | world from | 119 s | 80 s | | untranslated shaders reported in the run | 15 | 173 | | slow submissions of about 5.65 s | 10 | 9 | | end | device removed at 186 s (`0x887A0006`) | device removed at 179 s (`0x887A0006`) | Of the 173, the emulation's own refusals are 150: `v_readfirstlane in divergent control flow` 66, `LDS accesses without a uniform LDS fence in split wave64` 43, `a 64-lane wave ballot in divergent control flow` 35, `a wave reduction in divergent control flow` 6. That is the same pattern as my offline count on the old base above. The hang does not move: both runs have the same kind of series of submissions of about 5.65 s (5,647 to 5,655 ms with the port, 5,655 to 5,720 ms and one of 5,333 ms without; that steadiness looks like a loop running to its limit rather than GPU load), and both end in `DEVICE_HUNG` with two `nvlddmkm` resets. So on this card the 64-lane programs the host refuses are not what hangs the world; that matches the loop-limit runs reported above on the RTX 3050 Ti. **Not tested:** `VICTORY_WAVE64_EMULATE=wave32`; a lower `VICTORY_SHADER_LOOP_LIMIT` with the port; current `main` (this is `70564ae`); more than one run each. **AI use:** Claude Code built, ran and wrote this; checked by mrejecutor. No game data attached.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 04:08 UTC · original

Audited and hardware-tested #189 (54b333f) across NVIDIA GeForce RTX 5090, AMD Radeon(TM) Graphics (RDNA2), and D3D12 WARP (dxil.dll validated), and pushed a four-commit follow-up series on fuzeofficlal:fix/m2-189-whole-wave-sections (bd77535..1263964) covering three real edge cases hit in 64-lane compute reductions:

  1. Wave32 LDS exchange scratch vs whole-wave sections (bd77535): Instructions already lowered inside wave::sections do not need per-VGPR Wave32 cross-half LDS scratch slots; excluding in_sections instructions prevents false lds_overflow rejections when the title's compute group already uses most of the 32 KiB LDS budget.
  2. Single virtual-lane-0 writeback & whole-wave simulation bounds (8b9d76f): Guard v_readfirstlane_b32 writeback inside whole-wave sections so half-1 simulation does not overwrite the scalar result elected from the first active lane across all 64 lanes, and tighten section boundary eligibility.
  3. WaveSize(64) in Native mode for non-uniform v_readfirstlane_b32 in StageIo::Cs (e6d9e8f): Non-waterfall, non-uniform v_readfirstlane_b32 in compute programs sets console_lanes = true so Native mode emits [WaveSize(64)] instead of silently running at host Wave32 width, while leaving StageIo::Ms, StageIo::Vs, and StageIo::Ps host-wave semantics untouched.
  4. Multi-workgroup & nested saveexec regression coverage (1263964): 34/34 wave64_tests pass on RTX 5090, AMD Radeon Graphics, and WARP (including [4, 1, 1] multi-workgroup 64-lane float reductions, non-power-of-two tail waves, 3-level nested s_cbranch_execz + s_andn2_saveexec_b64 + v_readfirstlane_b32, and VS/PS/MS stage checks).
**@⁠fuzeofficlal** on GitHub · 2026-11-25 04:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7152573442) Audited and hardware-tested `#189` (`54b333f`) across **NVIDIA GeForce RTX 5090**, **AMD Radeon(TM) Graphics (RDNA2)**, and **D3D12 WARP** (`dxil.dll` validated), and pushed a four-commit follow-up series on [`fuzeofficlal:fix/m2-189-whole-wave-sections`](https://github.com/fuzeofficlal/VIctory/commits/1263964da2990de276edb108b44ca6ade11cb6e2) (`bd77535`..`1263964`) covering three real edge cases hit in 64-lane compute reductions: 1. **Wave32 LDS exchange scratch vs whole-wave sections (`bd77535`)**: Instructions already lowered inside `wave::sections` do not need per-VGPR Wave32 cross-half LDS scratch slots; excluding `in_sections` instructions prevents false `lds_overflow` rejections when the title's compute group already uses most of the 32 KiB LDS budget. 2. **Single virtual-lane-0 writeback & whole-wave simulation bounds (`8b9d76f`)**: Guard `v_readfirstlane_b32` writeback inside whole-wave sections so half-1 simulation does not overwrite the scalar result elected from the first active lane across all 64 lanes, and tighten section boundary eligibility. 3. **`WaveSize(64)` in `Native` mode for non-uniform `v_readfirstlane_b32` in `StageIo::Cs` (`e6d9e8f`)**: Non-waterfall, non-uniform `v_readfirstlane_b32` in compute programs sets `console_lanes = true` so `Native` mode emits `[WaveSize(64)]` instead of silently running at host Wave32 width, while leaving `StageIo::Ms`, `StageIo::Vs`, and `StageIo::Ps` host-wave semantics untouched. 4. **Multi-workgroup & nested `saveexec` regression coverage (`1263964`)**: 34/34 `wave64_tests` pass on RTX 5090, AMD Radeon Graphics, and WARP (including `[4, 1, 1]` multi-workgroup 64-lane float reductions, non-power-of-two tail waves, 3-level nested `s_cbranch_execz + s_andn2_saveexec_b64 + v_readfirstlane_b32`, and VS/PS/MS stage checks).
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-25 04:40 UTC · original

Thanks for taking it as the default — that is the right trade, and the !need_emu carve-out (native, zero scratch
LDS) is better than what I would have written.

One thing to put in front of the next tester, because it will otherwise be read as a new regression: Emulate is
correct but slow, and its cost is now the default path.
Numbers from our host (RTX 4070 SUPER 12 GB, 32-lane,
Windows 10, Series X, VICTORY_TEXTURE_MIP_DROP=1, #729 + #737 + #940 + #352 + four local fixes):

Wave32 Emulate
world pass never submitted runs
draws/frame 11 2296–5103 (1200–2311 indirect)
frame time 30 ms (menus only) 1034–1799 ms
fps 30 (menus) 0.6–1.0
pipelines compiling at once 0 167–243

So a correct-default run looks like a title that boots, holds 30 fps through the menus, then drops to ~1 fps the
moment the world pass starts, with a few hundred pipelines building. If the troubleshooting notes say "about 1 fps
in the world is expected on a 32-lane host until the pipeline library is warm", it saves someone a bisect.

Two related numbers that belong with it:

  • #352 matters more once Emulate is the default: with the library warm the per-run rebuild count went
    512 → 1 and the slowest world submission 13318 ms → 1031 ms. Without it, Emulate spends its first
    minutes compiling and the run can die before the world appears at all.
  • Our series of "device removed" and desktop freezes on this host were TdrLevel=0 (no recovery) rather than a
    runtime fault — #1054. Anyone reporting a freeze with no DRED and no event should check that registry value
    before anything else; with TdrLevel=3 the same workload ran 300 s and reported normally.

Not measured: Emulate on a native 64-lane host, and whether the !need_emu carve-out recovers a meaningful share
of the frame time in a real title (our runs had all classes active).

**@⁠bittertea0323** on GitHub · 2026-11-25 04:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7153054084) Thanks for taking it as the default — that is the right trade, and the `!need_emu` carve-out (native, zero scratch LDS) is better than what I would have written. One thing to put in front of the next tester, because it will otherwise be read as a new regression: **`Emulate` is correct but slow, and its cost is now the default path.** Numbers from our host (RTX 4070 SUPER 12 GB, 32-lane, Windows 10, Series X, `VICTORY_TEXTURE_MIP_DROP=1`, #729 + #737 + #940 + #352 + four local fixes): | | `Wave32` | `Emulate` | |---|---|---| | world pass | never submitted | runs | | draws/frame | 11 | **2296–5103** (1200–2311 indirect) | | frame time | 30 ms (menus only) | **1034–1799 ms** | | fps | 30 (menus) | **0.6–1.0** | | pipelines compiling at once | 0 | 167–243 | So a correct-default run looks like a title that boots, holds 30 fps through the menus, then drops to ~1 fps the moment the world pass starts, with a few hundred pipelines building. If the troubleshooting notes say "about 1 fps in the world is expected on a 32-lane host until the pipeline library is warm", it saves someone a bisect. Two related numbers that belong with it: - `#352` matters more once `Emulate` is the default: with the library warm the per-run rebuild count went **512 → 1** and the slowest world submission **13318 ms → 1031 ms**. Without it, `Emulate` spends its first minutes compiling and the run can die before the world appears at all. - Our series of "device removed" and desktop freezes on this host were `TdrLevel=0` (no recovery) rather than a runtime fault — #1054. Anyone reporting a freeze with no DRED and no event should check that registry value before anything else; with `TdrLevel=3` the same workload ran 300 s and reported normally. Not measured: `Emulate` on a native 64-lane host, and whether the `!need_emu` carve-out recovers a meaningful share of the frame time in a real title (our runs had all classes active).
Author
Owner

@⁠walterwallaceson on GitHub · 2026-11-25 05:34 UTC · original

In-game on an RTX 3070 (Ampere, Windows 10): wave32 mode beats both main and the auto-picked Emulate. Emulate refuses 75 programs that run without this PR.

Setup: RTX 3070 8 GB (32-lane waves, view heap capped at 1,000,000), driver 621.14, Windows 10 22H2 (19045). main 940d32f + #463 (f47a36e, Agility SDK runtime, needed on Windows 10) + #1775 (b079909) + #1751 (4521591) + #1906 (c84cbaa) + #385 (42fd559) + #688 (39e68e2), then this PR's head 9580571 merged on top. Diag build, VICTORY_SHADER_LOOP_LIMIT=4096, #1968's programs W and C skipped. Three 15-minute runs, one each, on the same stack apart from this PR. Both runs with the PR log wave64_mode=Emulate at startup; the third sets VICTORY_WAVE64_EMULATE=wave32.

without this PR with it, Emulate (auto) with it, wave32
end 15 min, no removal, no errors 15 min, no removal, no errors 15 min, no removal, no errors
programs not running (rejected by D3D12 + not translated) 186 (167 + 19) 217 (0 + 217) 128 (0 + 128)
draws/frame dropped without a host pipeline, end 614 920 337
indirect dispatches dropped/frame, end 75 102 54
world speed, last 40 readings 0.7 fps 0.6 fps 0.8 fps, steady from about 6 min on
copies per frame, end 867 ms 873 ms 741 ms
slow submissions 4, slowest 432 ms 217, slowest 2,576 ms 111, slowest 4,386 ms
slow submissions, last 5 min 0 26, slowest 425 ms 31, slowest 399 ms

Emulate (what the PR picks on this card): no pipeline is rejected by D3D12 any more, but of the 167 that were, only 44 run; the other 123 are refused by the emulation. It also refuses 75 programs that translate and run without this PR, 72 of them with v_readfirstlane in divergent control flow. So more programs are dropped than on main.

wave32: 59 of the 167 run, 74 of those 75 run again, and nothing that runs without the PR is refused. The remaining refusals are mostly a cross-lane wave operation in divergent control flow (59) and LDS accesses without a uniform LDS fence in split wave64 (50).

Cost: the newly running programs are slow. 107 of the 111 slow submissions in the wave32 run contain one of them (213 of 217 with Emulate). Most are early; in the last 5 minutes the slowest was 399 ms.

So on this card, defaulting 32-lane hosts to wave32 instead of Emulate would keep everything main runs and run more of what it rejects.

This differs from bittertea0323's RTX 4070 SUPER, where Wave32 never submitted the world pass. Here the world pass runs in all three runs: about 3,000 draws per frame at the end of each, up to 8,763 per frame with wave32 (8,449 with Emulate). Our stacks differ (we don't have #352, #729, #737 or #940; we do have #1906, #385 and #688), so the difference may come from those rather than the card. The ~1 fps world they describe matches what we see in all three modes.

Merging onto current main conflicts in 12 files, all one clash: main (cd94d35) added emit::Options { view_marks } in the same places this PR adds TranslateOptions { wave64 }. I made one Options with both fields (TranslateOptions as an alias), kept both view_marks and options in Parts, and gave the test initializers both fields. With that, cargo test --workspace fails the same 77 tests as without this PR (the known "no SM 6.6 device" skips and one texture test that also fails on main), and all 28 wave64 tests pass, the GPU ones on the RTX 3070 included.

Not tested: fuzeofficlal's follow-up series; more than one run per mode; whether the scene looks different.

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

**@⁠walterwallaceson** on GitHub · 2026-11-25 05:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7153905010) **In-game on an RTX 3070 (Ampere, Windows 10): `wave32` mode beats both `main` and the auto-picked `Emulate`. `Emulate` refuses 75 programs that run without this PR.** **Setup:** RTX 3070 8 GB (32-lane waves, view heap capped at 1,000,000), driver 621.14, Windows 10 22H2 (19045). `main` `940d32f` + #463 (`f47a36e`, Agility SDK runtime, needed on Windows 10) + #1775 (`b079909`) + #1751 (`4521591`) + #1906 (`c84cbaa`) + #385 (`42fd559`) + #688 (`39e68e2`), then this PR's head `9580571` merged on top. Diag build, `VICTORY_SHADER_LOOP_LIMIT=4096`, #1968's programs W and C skipped. Three 15-minute runs, one each, on the same stack apart from this PR. Both runs with the PR log `wave64_mode=Emulate` at startup; the third sets `VICTORY_WAVE64_EMULATE=wave32`. | | without this PR | with it, `Emulate` (auto) | with it, `wave32` | |---|---|---|---| | end | 15 min, no removal, no errors | 15 min, no removal, no errors | 15 min, no removal, no errors | | programs not running (rejected by D3D12 + not translated) | 186 (167 + 19) | 217 (0 + 217) | **128** (0 + 128) | | draws/frame dropped without a host pipeline, end | 614 | 920 | **337** | | indirect dispatches dropped/frame, end | 75 | 102 | 54 | | world speed, last 40 readings | 0.7 fps | 0.6 fps | **0.8 fps**, steady from about 6 min on | | copies per frame, end | 867 ms | 873 ms | 741 ms | | slow submissions | 4, slowest 432 ms | 217, slowest 2,576 ms | 111, slowest 4,386 ms | | slow submissions, last 5 min | 0 | 26, slowest 425 ms | 31, slowest 399 ms | **`Emulate` (what the PR picks on this card):** no pipeline is rejected by D3D12 any more, but of the 167 that were, only 44 run; the other 123 are refused by the emulation. It also refuses **75 programs that translate and run without this PR**, 72 of them with `v_readfirstlane in divergent control flow`. So more programs are dropped than on `main`. **`wave32`:** 59 of the 167 run, 74 of those 75 run again, and nothing that runs without the PR is refused. The remaining refusals are mostly `a cross-lane wave operation in divergent control flow` (59) and `LDS accesses without a uniform LDS fence in split wave64` (50). **Cost:** the newly running programs are slow. 107 of the 111 slow submissions in the `wave32` run contain one of them (213 of 217 with `Emulate`). Most are early; in the last 5 minutes the slowest was 399 ms. So on this card, defaulting 32-lane hosts to `wave32` instead of `Emulate` would keep everything `main` runs and run more of what it rejects. **This differs from bittertea0323's RTX 4070 SUPER**, where `Wave32` never submitted the world pass. Here the world pass runs in all three runs: about 3,000 draws per frame at the end of each, up to 8,763 per frame with `wave32` (8,449 with `Emulate`). Our stacks differ (we don't have #352, #729, #737 or #940; we do have #1906, #385 and #688), so the difference may come from those rather than the card. The ~1 fps world they describe matches what we see in all three modes. **Merging onto current `main`** conflicts in 12 files, all one clash: `main` (`cd94d35`) added `emit::Options { view_marks }` in the same places this PR adds `TranslateOptions { wave64 }`. I made one `Options` with both fields (`TranslateOptions` as an alias), kept both `view_marks` and `options` in `Parts`, and gave the test initializers both fields. With that, `cargo test --workspace` fails the same 77 tests as without this PR (the known "no SM 6.6 device" skips and one texture test that also fails on `main`), and all 28 `wave64` tests pass, the GPU ones on the RTX 3070 included. **Not tested:** fuzeofficlal's follow-up series; more than one run per mode; whether the scene looks different. No game data attached. I'm testing with Claude's help, and Claude drafted this comment.
Author
Owner

@⁠alfycs on GitHub · 2026-11-25 10:22 UTC · original

Rebased onto main (940d32f) and integrated @⁠fuzeofficlal's four follow-up commits (bd77535..1263964) into 39976ef:

  • Unified TranslateOptions into emit::Options (view_marks + wave64, keeping pub type TranslateOptions = Options) to resolve the conflict with cd94d35.
  • Integrated the whole-wave section LDS scratch exclusion, guarded native v_readfirstlane_b32 (preserving #1733's helper_reads_own), Native WaveSize(64) enforcement for non-uniform compute v_readfirstlane_b32, and the expanded regression suite (preserving VIEW_STRIDES root-view binding in GPU tests).

Local checks on 39976ef:

  • cargo xtask policy: asset policy: 183 files ok
  • cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated: clean
  • cargo test -p victory-shader --locked -- wave64 --test-threads=1: 37 passed; 0 failed
**@⁠alfycs** on GitHub · 2026-11-25 10:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7159612430) Rebased onto `main` (`940d32f`) and integrated @⁠fuzeofficlal's four follow-up commits (`bd77535`..`1263964`) into `39976ef`: - Unified `TranslateOptions` into `emit::Options` (`view_marks` + `wave64`, keeping `pub type TranslateOptions = Options`) to resolve the conflict with `cd94d35`. - Integrated the whole-wave section LDS scratch exclusion, guarded native `v_readfirstlane_b32` (preserving `#1733`'s `helper_reads_own`), `Native` `WaveSize(64)` enforcement for non-uniform compute `v_readfirstlane_b32`, and the expanded regression suite (preserving `VIEW_STRIDES` root-view binding in GPU tests). Local checks on `39976ef`: - `cargo xtask policy`: `asset policy: 183 files ok` - `cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated`: clean - `cargo test -p victory-shader --locked -- wave64 --test-threads=1`: `37 passed; 0 failed`
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-25 10:42 UTC · original

@⁠alfycs, I reran the shuffle and masked-shift check on your rebased head 39976ef0. The unmodified 128-thread combined test passed. I then ran it alongside the two split fixtures and logged all 128 output words from each dispatch.

Device on Windows 11 build 26300.10075 Modes that completed a readback Mismatches per mode, shuffle / masked shift-and-add / combined
RTX 5080, driver 621.40 Wave32, Emulate 0/128 · 0/128 · 0/128
Built-in WARP, wave range 4–4 Emulate 0/128 · 0/128 · 0/128
WARP 1.0.22, wave range 4–128 Wave32, Emulate 0/128 · 0/128 · 0/128

Lane 20 returned shuffle 22 and masked sum 39, packed as 2,555,926. Lane 21 returned 23 and 41, packed as 2,686,999. Both RTX adapter entries enumerated by DXGI gave these results. The WARP processes verified the loaded DLL path. Built-in WARP skipped Wave32, and this fixture only requests Emulate and supported Wave32 modes.

That confirms the two operations and their combination on this Windows build after the rebase. The original reporter's build 28000 remains the open hardware/OS configuration for reproducing the differing sums.

**@⁠steven-seagull27** on GitHub · 2026-11-25 10:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7160064101) @⁠alfycs, I reran the [shuffle and masked-shift check](https://git.gtahub.st/github/Marvisak--VIctory/pulls/189) on your rebased head `39976ef0`. The unmodified 128-thread combined test passed. I then ran it alongside the two [split fixtures](https://github.com/steven-seagull27/VIctory/commit/99135ba50a2392b3e7e444ea03625306e2efaa37) and logged all 128 output words from each dispatch. | Device on Windows 11 build 26300.10075 | Modes that completed a readback | Mismatches per mode, shuffle / masked shift-and-add / combined | |---|---|---| | RTX 5080, driver 621.40 | Wave32, Emulate | 0/128 · 0/128 · 0/128 | | Built-in WARP, wave range 4–4 | Emulate | 0/128 · 0/128 · 0/128 | | WARP 1.0.22, wave range 4–128 | Wave32, Emulate | 0/128 · 0/128 · 0/128 | Lane 20 returned shuffle **22** and masked sum **39**, packed as **2,555,926**. Lane 21 returned **23** and **41**, packed as **2,686,999**. Both RTX adapter entries enumerated by DXGI gave these results. The WARP processes verified the loaded DLL path. Built-in WARP skipped Wave32, and this fixture only requests Emulate and supported Wave32 modes. That confirms the two operations and their combination on this Windows build after the rebase. The [original reporter's build 28000](https://git.gtahub.st/github/Marvisak--VIctory/pulls/189) remains the open hardware/OS configuration for reproducing the differing sums.
Author
Owner

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

39976ef in-game on an RTX 4070 SUPER (Wave32 mode): the world's BVH builder programs, and two that hang once they translate

Setup: RTX 4070 SUPER, driver 32.0.16.1742, Windows 11 26300. Title 1.0.2.1, Series X profile, diag build, VICTORY_WAVE64_EMULATE=wave32. The PR's head 39976ef is merged onto main 940d32f + #1775 + #1762 + #1906 + #2098. Scripted input reaches the intro cutscene at about 90 s.

This head, as is: 6 minutes with no device removal. 0 pipelines refused, 126 shaders not translated.

The BVH builder. The world's ray traced pass (f607780aa8e502d0, #1968) walks a BVH built by the programs in XboxBvhBuilder.dll. Five of them are 64-lane programs that this card refuses on main: 14394a322f6dd5c2, 28918b7150a7aad5, caa78b8ca62bc3d6, e63d22c4def9ba6a, f6eb6498409ca974.

  • With this PR, 14394a32, e63d22c4 and f6eb6498 translate and run. The acceleration structure at 0xd_5f1c_0000 goes from all zeros to all 0xffffffff, which looks like the builder's clear pass.
  • 28918b71 and caa78b8c are refused: "LDS accesses without a uniform LDS fence in split wave64" (at 0x280 and 0x298). Both write per-lane records in a divergent loop: dword 24 * tid + 6 * i + k, i <= 3, k < 6. That is several writes in a row with no read, which plan_lds_fences treats like a write and a read.

Allowing write after write. I tried relaxing plan_lds_fences so that only a read and a write in one unfenced divergent region conflict: moe-miau/VIctory@fix/189-lds-write-after-write (205b10a, one commit on 39976ef, with a translation test and a GPU test). All five builder programs then translate, and untranslated shaders drop from 126 to 45. But in game both newly translated programs hang the GPU (0x887A0006):

run DRED stops at
both run dispatch 18x1x1 [compute caa78b8ca62bc3d6] at 102 s (after two earlier submissions with it went through)
caa78b8c skipped dispatch 563x1x1 [compute 28918b7150a7aad5] at 98 s
both run, VICTORY_SHADER_LOOP_LIMIT=256 dispatch 90x1x1 [compute 28918b7150a7aad5] at 93 s

What I checked in 28918b71's Wave32 DXIL (dxc -dumpbin):

  • 25 barriers, none inside any of its three loops.
  • The loop guards are kept (lanes with a zero count skip the loop).
  • Every loop is bounded by small per-lane counts (3, 24, 255).

With loops capped at 256 it still hangs, so it is not a loop that never ends. I haven't found what does hang. So I'm not proposing the relaxation as is; the branch is there in case it helps reproduce. Each half writes only its own lanes' records here, so the relaxation itself should not be what corrupts data. Something in how these two programs run split seems to be.

One run per row. Counts and times only, no game data attached. AI-assisted (Claude Code); runs done on my machine.

**@⁠moe-miau** on GitHub · 2026-11-25 10:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7160340550) **`39976ef` in-game on an RTX 4070 SUPER (Wave32 mode): the world's BVH builder programs, and two that hang once they translate** **Setup:** RTX 4070 SUPER, driver 32.0.16.1742, Windows 11 26300. Title 1.0.2.1, Series X profile, diag build, `VICTORY_WAVE64_EMULATE=wave32`. The PR's head `39976ef` is merged onto `main` `940d32f` + #1775 + #1762 + #1906 + #2098. Scripted input reaches the intro cutscene at about 90 s. **This head, as is:** 6 minutes with no device removal. 0 pipelines refused, 126 shaders not translated. **The BVH builder.** The world's ray traced pass (`f607780aa8e502d0`, #1968) walks a BVH built by the programs in `XboxBvhBuilder.dll`. Five of them are 64-lane programs that this card refuses on `main`: `14394a322f6dd5c2`, `28918b7150a7aad5`, `caa78b8ca62bc3d6`, `e63d22c4def9ba6a`, `f6eb6498409ca974`. - With this PR, `14394a32`, `e63d22c4` and `f6eb6498` translate and run. The acceleration structure at `0xd_5f1c_0000` goes from all zeros to all `0xffffffff`, which looks like the builder's clear pass. - `28918b71` and `caa78b8c` are refused: "LDS accesses without a uniform LDS fence in split wave64" (at 0x280 and 0x298). Both write per-lane records in a divergent loop: dword `24 * tid + 6 * i + k`, `i <= 3`, `k < 6`. That is several writes in a row with no read, which `plan_lds_fences` treats like a write and a read. **Allowing write after write.** I tried relaxing `plan_lds_fences` so that only a read and a write in one unfenced divergent region conflict: [`moe-miau/VIctory@fix/189-lds-write-after-write`](https://github.com/moe-miau/VIctory/tree/fix/189-lds-write-after-write) (`205b10a`, one commit on `39976ef`, with a translation test and a GPU test). All five builder programs then translate, and untranslated shaders drop from 126 to 45. **But in game both newly translated programs hang the GPU** (`0x887A0006`): | run | DRED stops at | |---|---| | both run | `dispatch 18x1x1 [compute caa78b8ca62bc3d6]` at 102 s (after two earlier submissions with it went through) | | `caa78b8c` skipped | `dispatch 563x1x1 [compute 28918b7150a7aad5]` at 98 s | | both run, `VICTORY_SHADER_LOOP_LIMIT=256` | `dispatch 90x1x1 [compute 28918b7150a7aad5]` at 93 s | **What I checked in `28918b71`'s Wave32 DXIL** (`dxc -dumpbin`): - 25 barriers, none inside any of its three loops. - The loop guards are kept (lanes with a zero count skip the loop). - Every loop is bounded by small per-lane counts (3, 24, 255). With loops capped at 256 it still hangs, so it is not a loop that never ends. I haven't found what does hang. So I'm not proposing the relaxation as is; the branch is there in case it helps reproduce. Each half writes only its own lanes' records here, so the relaxation itself should not be what corrupts data. Something in how these two programs run split seems to be. One run per row. Counts and times only, no game data attached. AI-assisted (Claude Code); runs done on my machine.
Author
Owner

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

Two more runs on the same machine and route, 39976ef + my branch above (205b10a). Both still hang in the builder:

run DRED stops at
+ #1769 (out-of-range LDS accesses read 0, writes dropped), Wave32 dispatch 18x1x1 [compute caa78b8ca62bc3d6] at 99 s, the only command in its barrier window
+ #1769, VICTORY_WAVE64_EMULATE=emulate dispatch 3x1x1 [compute 28918b7150a7aad5] at 83 s

So it is not Wave32-specific. It is also not the second loop's writes past the allocation. (28918b71 writes 24 * tid + 6 * s28 for s28 < v10, and lanes with v10 >= 4 skip the first loop but run the second; the console drops those writes.)

caa78b8c's Wave32 DXIL:

  • 19 barriers.
  • All three loops carry the loop-limit counter.
  • The only paths that skip a barrier go through the loop-limit ret. NVIDIA's bar.sync does not wait for exited threads, so that path should not deadlock.

I don't have an explanation yet. This matches #2311's note that without #2118/#1960 the device hangs inside these two programs.

**@⁠moe-miau** on GitHub · 2026-11-25 11:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7160840771) Two more runs on the same machine and route, `39976ef` + my branch above (`205b10a`). Both still hang in the builder: | run | DRED stops at | |---|---| | + #1769 (out-of-range LDS accesses read 0, writes dropped), Wave32 | `dispatch 18x1x1 [compute caa78b8ca62bc3d6]` at 99 s, the only command in its barrier window | | + #1769, `VICTORY_WAVE64_EMULATE=emulate` | `dispatch 3x1x1 [compute 28918b7150a7aad5]` at 83 s | So it is not Wave32-specific. It is also not the second loop's writes past the allocation. (`28918b71` writes `24 * tid + 6 * s28` for `s28 < v10`, and lanes with `v10 >= 4` skip the first loop but run the second; the console drops those writes.) `caa78b8c`'s Wave32 DXIL: - 19 barriers. - All three loops carry the loop-limit counter. - The only paths that skip a barrier go through the loop-limit `ret`. NVIDIA's `bar.sync` does not wait for exited threads, so that path should not deadlock. I don't have an explanation yet. This matches #2311's note that without #2118/#1960 the device hangs inside these two programs.
Author
Owner

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

Mode table from a 32-lane Ada card, as the maintainers suggested this belongs here. RTX 4060 Ti 8 GB, Windows 11 26200, native D3D12, built from this PR at 54b333f with --features diagnostics, same scene and logging settings for all three rows:

VICTORY_WAVE64_EMULATE host pipeline refused 0x80070057 draws dropped
native 116 119 434
wave32 0 3 457
emulate (what auto selects here) 0 3 563

All three reach the same later stop. So mode selection is the lever: native reproduces the refusals on its own, and either override clears them. The D3D12 debug layer names the cause for the native ones:

ID3D12Device::CreateComputeShader: Shader wants wave lane count of 64
but maximum wave lane count for device is 32    id=622

That is the whole of the refusal, on this card: native-wave64 bytecode reaching CreateComputeShader, not an allocator or root-signature problem. What I cannot tell from logs is whether wave32 and emulate differ in dispatch results rather than in creation.

A note for the rebase, also as suggested: this PR and #1076 do not stack. #189 uses emit::translate_with with TranslateOptions / Wave64Mode; #1076 adds emit::translate_for_wave on top of emit_for_wave. Merging either order with -X theirs leaves lower.rs calling emulate_wave64, emu_total, emu_exchange_pair and console_subwave on a Lower that does not define them; taking only crates/victory-gpu/src from #1076 onto #189 stops at translate_for_wave not found. Whichever lands first, the other needs a rebase onto its entry point.

Measured numbers only; no game code in this comment.

**@⁠aef200** on GitHub · 2026-11-25 11:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7161364432) Mode table from a 32-lane Ada card, as the maintainers suggested this belongs here. RTX 4060 Ti 8 GB, Windows 11 26200, native D3D12, built from this PR at `54b333f` with `--features diagnostics`, same scene and logging settings for all three rows: | `VICTORY_WAVE64_EMULATE` | host pipeline refused | 0x80070057 | draws dropped | |---|---|---|---| | `native` | **116** | 119 | 434 | | `wave32` | **0** | 3 | 457 | | `emulate` (what auto selects here) | **0** | 3 | 563 | All three reach the same later stop. So mode selection is the lever: `native` reproduces the refusals on its own, and either override clears them. The D3D12 debug layer names the cause for the native ones: ``` ID3D12Device::CreateComputeShader: Shader wants wave lane count of 64 but maximum wave lane count for device is 32 id=622 ``` That is the whole of the refusal, on this card: native-wave64 bytecode reaching `CreateComputeShader`, not an allocator or root-signature problem. What I cannot tell from logs is whether `wave32` and `emulate` differ in dispatch *results* rather than in creation. A note for the rebase, also as suggested: this PR and #1076 do not stack. #189 uses `emit::translate_with` with `TranslateOptions` / `Wave64Mode`; #1076 adds `emit::translate_for_wave` on top of `emit_for_wave`. Merging either order with `-X theirs` leaves `lower.rs` calling `emulate_wave64`, `emu_total`, `emu_exchange_pair` and `console_subwave` on a `Lower` that does not define them; taking only `crates/victory-gpu/src` from #1076 onto #189 stops at `translate_for_wave` not found. Whichever lands first, the other needs a rebase onto its entry point. Measured numbers only; no game code in this comment.
Author
Owner

@⁠Auroraooy on GitHub · 2026-11-25 15:24 UTC · original

Heads-up from real RTX 2080 Ti (Turing, SM 6.5) testing on Windows 10 19045: on PR head 92778cd, cargo test -p victory-shader --locked -- wave64 --test-threads=1 gives 18 passed; 19 failed. All GPU tests fail before shader execution with expected at least one SM 6.6 adapter because Host::all_adapters() filters out SM 6.5 hardware and WARP.

I filed the report as Marvisak/VIctory#2535 and prepared a small diagnostic patch as alfycs/VIctory#2 (targeting this PR's branch). It logs each rejected adapter and turns the empty-host panic into an explicit SKIPPED <test>: no SM 6.6 adapter; behavior on SM 6.6 hosts is unchanged. No game data was used.

**@⁠Auroraooy** on GitHub · 2026-11-25 15:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7166784485) Heads-up from real RTX 2080 Ti (Turing, SM 6.5) testing on Windows 10 19045: on PR head `92778cd`, `cargo test -p victory-shader --locked -- wave64 --test-threads=1` gives `18 passed; 19 failed`. All GPU tests fail before shader execution with `expected at least one SM 6.6 adapter` because `Host::all_adapters()` filters out SM 6.5 hardware and WARP. I filed the report as Marvisak/VIctory#2535 and prepared a small diagnostic patch as alfycs/VIctory#2 (targeting this PR's branch). It logs each rejected adapter and turns the empty-host panic into an explicit `SKIPPED <test>: no SM 6.6 adapter`; behavior on SM 6.6 hosts is unchanged. No game data was used.
Author
Owner

@⁠alfycs on GitHub · 2026-11-25 15:43 UTC · original

Integrated @⁠Auroraooy's fix (9db4e94, from alfycs/VIctory#2) so wave64_tests skip cleanly with adapter diagnostics when no SM 6.6 adapter is present. Re-verified locally on 9db4e94: cargo xtask policy (183 files ok), cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated (clean), and cargo test -p victory-shader --locked -- wave64 --test-threads=1 (37 passed; 0 failed).

**@⁠alfycs** on GitHub · 2026-11-25 15:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7167279091) Integrated @⁠Auroraooy's fix (`9db4e94`, from `alfycs/VIctory#2`) so `wave64_tests` skip cleanly with adapter diagnostics when no SM 6.6 adapter is present. Re-verified locally on `9db4e94`: `cargo xtask policy` (`183 files ok`), `cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated` (clean), and `cargo test -p victory-shader --locked -- wave64 --test-threads=1` (`37 passed; 0 failed`).
Author
Owner

@⁠KevinPratap on GitHub · 2026-11-25 16:05 UTC · original

Results from an RTX 4050 Laptop GPU (32 lanes, driver 621.24, Windows 11), testing this PR on main 940d32f. The diagnostics build (--features diagnostics) was run with VICTORY_SHADER_LOOP_LIMIT=4096.

  • cargo test -p victory-shader --release --lib: every wave64 test passes. The 8 failures are the same 8 that plain main has on this card (bvh ×3, arithmetic, heap zeros, permutes, fspx dot, 64-bit image atomics), so none are new.
  • Translate report, compute programs emitted (of 2,679): native 2,621 (about 394 then need WaveSize(64)), emulate 2,165, wave32 2,363. Top refusals:
    • LDS without a uniform fence in split wave64: about 147 in both modes
    • v_readfirstlane in divergent flow: 217 (emulate)
    • Cross-lane op in divergent flow: 111 (wave32)
  • The two modes refuse different programs. alfycs/VIctory#3 tries the other emulation, then native. With it, the pipelines the host refuses from the full shader pack go from 395 to 257, and the container refusals match native's (307).
  • World run with wave32 and that fallback: draws dropped as "refused" fell from about 100 to 69 per frame, and total drops from about 175 to 125. It then ran out of host memory during pipeline creation (that's main's memory use, not this PR).

AI-assisted (Claude Code).

**@⁠KevinPratap** on GitHub · 2026-11-25 16:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7167581841) Results from an RTX 4050 Laptop GPU (32 lanes, driver 621.24, Windows 11), testing this PR on main `940d32f`. The diagnostics build (`--features diagnostics`) was run with `VICTORY_SHADER_LOOP_LIMIT=4096`. - `cargo test -p victory-shader --release --lib`: every wave64 test passes. The 8 failures are the same 8 that plain main has on this card (bvh ×3, arithmetic, heap zeros, permutes, fspx dot, 64-bit image atomics), so none are new. - Translate report, compute programs emitted (of 2,679): `native` 2,621 (about 394 then need `WaveSize(64)`), `emulate` 2,165, `wave32` 2,363. Top refusals: - LDS without a uniform fence in split wave64: about 147 in both modes - `v_readfirstlane` in divergent flow: 217 (emulate) - Cross-lane op in divergent flow: 111 (wave32) - The two modes refuse different programs. alfycs/VIctory#3 tries the other emulation, then native. With it, the pipelines the host refuses from the full shader pack go from 395 to 257, and the container refusals match native's (307). - World run with `wave32` and that fallback: draws dropped as "refused" fell from about 100 to 69 per frame, and total drops from about 175 to 125. It then ran out of host memory during pipeline creation (that's main's memory use, not this PR). AI-assisted (Claude Code).
Author
Owner

@⁠alfycs on GitHub · 2026-11-25 16:39 UTC · original

Rebased onto main (67e8ae1) and integrated @⁠KevinPratap's fallback lowering from alfycs/VIctory#3 (trying the other emulation mode, then Native, when a Wave64 lowering refuses a program).

Also:

  • Extracted Wave64 lowering helpers into crates/victory-shader/src/emit/lower/wave64.rs to keep lower.rs under the 512 KiB xtask policy limit.
  • Kept the EXEC guard for v_readfirstlane_b32 (after 889b871 skipped EXEC guards for scalar VALU results) so it still elects the first active lane in EXEC while preserving a_scalar_result_needs_no_exec for v_readlane_b32.

Verified locally after the final edit:

  • cargo xtask policy: asset policy: 186 files ok
  • cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated: clean
  • cargo test -p victory-shader --locked -- wave64 a_scalar_result_needs_no_exec --test-threads=1: 38 passed; 0 failed
  • cargo test -p victory-gpu --locked -- a_lowering_refused: 1 passed; 0 failed
**@⁠alfycs** on GitHub · 2026-11-25 16:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7168320305) Rebased onto `main` (`67e8ae1`) and integrated @⁠KevinPratap's fallback lowering from `alfycs/VIctory#3` (trying the other emulation mode, then `Native`, when a Wave64 lowering refuses a program). Also: - Extracted Wave64 lowering helpers into `crates/victory-shader/src/emit/lower/wave64.rs` to keep `lower.rs` under the 512 KiB `xtask policy` limit. - Kept the `EXEC` guard for `v_readfirstlane_b32` (after `889b871` skipped `EXEC` guards for scalar VALU results) so it still elects the first active lane in `EXEC` while preserving `a_scalar_result_needs_no_exec` for `v_readlane_b32`. Verified locally after the final edit: - `cargo xtask policy`: `asset policy: 186 files ok` - `cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated`: clean - `cargo test -p victory-shader --locked -- wave64 a_scalar_result_needs_no_exec --test-threads=1`: `38 passed; 0 failed` - `cargo test -p victory-gpu --locked -- a_lowering_refused`: `1 passed; 0 failed`
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 18:17 UTC · original

Emulate (no declared wave size) runs on a 16-lane Intel iGPU (UHD 8086:a78b, 16..16): all 18 compute GPU tests match there. It is the only PR form that did. But the lowerings(Emulate) fallback re-declares sizes those hosts refuse. A divergent v_readfirstlane falls back to WaveSize(32), refused on Intel and WARP. A divergent cross-half ballot falls back to WaveSize(64), refused on the RTX 4060, Intel and WARP. Separately, vs_ps_readfirstlane_host_wave_contract fails on the Intel adapter with a pixel mismatch, 2.0 where 1.0 is expected. Details and table: #2220

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.

**@⁠KainanP** on GitHub · 2026-11-25 18:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7170697314) `Emulate` (no declared wave size) runs on a 16-lane Intel iGPU (UHD `8086:a78b`, 16..16): all 18 compute GPU tests match there. It is the only PR form that did. But the `lowerings(Emulate)` fallback re-declares sizes those hosts refuse. A divergent `v_readfirstlane` falls back to `WaveSize(32)`, refused on Intel and WARP. A divergent cross-half ballot falls back to `WaveSize(64)`, refused on the RTX 4060, Intel and WARP. Separately, `vs_ps_readfirstlane_host_wave_contract` fails on the Intel adapter with a pixel mismatch, 2.0 where 1.0 is expected. Details and table: https://git.gtahub.st/github/Marvisak--VIctory/issues/2220 _AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this._
Author
Owner

@⁠alfycs on GitHub · 2026-11-25 19:30 UTC · original

Thanks for catching that! Fixed in the latest commit:

  1. Capability-filtered fallback chain: shader_cache::lowerings now filters fallbacks using the host's D3D12 WaveLaneCountMin/WaveLaneCountMax (supports_wave32 / supports_wave64) recorded alongside set_wave64_mode, so Emulate won't fall back to Wave32 on 16-lane/WARP hosts or to Native on 32-lane/16-lane/WARP hosts.
  2. Divergent v_readfirstlane_b32 in Emulate: extracted host_wave_readfirstlane and enabled it for divergent v_readfirstlane_b32 in Wave64Mode::Emulate as well, so it runs directly on 16-lane and WARP hosts without needing a Wave32 fallback.
**@⁠alfycs** on GitHub · 2026-11-25 19:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7172384162) Thanks for catching that! Fixed in the latest commit: 1. **Capability-filtered fallback chain**: `shader_cache::lowerings` now filters fallbacks using the host's D3D12 `WaveLaneCountMin`/`WaveLaneCountMax` (`supports_wave32` / `supports_wave64`) recorded alongside `set_wave64_mode`, so `Emulate` won't fall back to `Wave32` on 16-lane/WARP hosts or to `Native` on 32-lane/16-lane/WARP hosts. 2. **Divergent `v_readfirstlane_b32` in `Emulate`**: extracted `host_wave_readfirstlane` and enabled it for divergent `v_readfirstlane_b32` in `Wave64Mode::Emulate` as well, so it runs directly on 16-lane and WARP hosts without needing a `Wave32` fallback.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 01:35 UTC · original

@⁠alfycs @⁠KainanP I tested the new divergent v_readfirstlane_b32 path at 3e39e34 with 40 executing lanes per virtual Wave64. The existing v0 < 32 test does not distinguish an election in the first physical Wave32 from an election across both halves on a Wave32 adapter. Test-only commit.

The 128-thread workgroup contains two guest waves. Active lanes should read group-thread ID 0 in the first guest wave and 64 in the second. Inactive lanes should retain 42. These are wrong output dwords out of 128 read back:

Adapter Emulate Explicit Wave32 Native Wave64
RTX 5080 (32..32) 16 16 Unsupported
Windows built-in WARP (4..4) 72 Unsupported Unsupported
Microsoft.Warp 1.0.22 (4..128) 48 16 0

RTX lanes 32–39 read 32 instead of 0, and lanes 96–103 read 96 instead of 64. Built-in WARP first diverged at lane 4 and app-local WARP in Emulate first diverged at lane 16. The repeated host-local election is observable in the new Emulate path even when capability filtering has chosen a supported shader. The empty-EXEC and 128-thread swizzle/DPP controls still matched on the supported modes.

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr189-divergent-readfirstlane-readback
git cherry-pick fa11afdc74a8ef7f3096a0c9f200dfc8bafb7165
cargo test -p victory-shader --lib gpu_divergent_readfirstlane_spans_host_waves -- --nocapture

The test deliberately asserts the guest result. The table comes from running each supported adapter/mode independently through the same fixture and oracle so a first failure cannot hide later cases. I'm checking whether we can elect across the guest wave before the divergent branch for this case.

**@⁠steven-seagull27** on GitHub · 2026-11-26 01:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7179928808) @⁠alfycs @⁠KainanP I tested the new divergent `v_readfirstlane_b32` path at `3e39e34` with 40 executing lanes per virtual Wave64. The existing `v0 < 32` test does not distinguish an election in the first physical Wave32 from an election across both halves on a Wave32 adapter. [Test-only commit](https://github.com/steven-seagull27/VIctory/commit/fa11afdc74a8ef7f3096a0c9f200dfc8bafb7165). The 128-thread workgroup contains two guest waves. Active lanes should read group-thread ID 0 in the first guest wave and 64 in the second. Inactive lanes should retain 42. These are wrong output dwords out of 128 read back: | Adapter | Emulate | Explicit Wave32 | Native Wave64 | |---|---:|---:|---:| | RTX 5080 (32..32) | 16 | 16 | Unsupported | | Windows built-in WARP (4..4) | 72 | Unsupported | Unsupported | | Microsoft.Warp 1.0.22 (4..128) | 48 | 16 | 0 | RTX lanes 32–39 read 32 instead of 0, and lanes 96–103 read 96 instead of 64. Built-in WARP first diverged at lane 4 and app-local WARP in `Emulate` first diverged at lane 16. The repeated host-local election is observable in the new `Emulate` path even when capability filtering has chosen a supported shader. The empty-EXEC and 128-thread swizzle/DPP controls still matched on the supported modes. ```sh git fetch https://github.com/steven-seagull27/VIctory.git codex/pr189-divergent-readfirstlane-readback git cherry-pick fa11afdc74a8ef7f3096a0c9f200dfc8bafb7165 cargo test -p victory-shader --lib gpu_divergent_readfirstlane_spans_host_waves -- --nocapture ``` The test deliberately asserts the guest result. The table comes from running each supported adapter/mode independently through the same fixture and oracle so a first failure cannot hide later cases. I'm checking whether we can elect across the guest wave before the divergent branch for this case.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 01:53 UTC · original

@⁠alfycs I opened the source fix against your current branch. Stacked PR with the readback and implementation.

Across six 128-thread dispatches, Emulate went from 48/768 wrong to zero on RTX 5080, 312/768 to zero on built-in WARP, and 208/768 to zero on Microsoft.Warp 1.0.22. Explicit Wave32 went from 48/768 to zero on both supported adapters. The suite includes both EXEC branch directions, a high-half winner and an entirely inactive guest wave. All 35 stock Wave64 tests passed.

The fix elects before the branch when the read starts the active edge and the VGPR is already available in its uniform predecessor. The separate Native Wave64 high-half control still varied on portable WARP before and after the patch. @⁠KainanP, your Intel Wave16 result on this branch would check the one hardware width I couldn't run here.

To pick up both commits on feat/wave64-compute-emulation:

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr189-firstlane-before-exec-split
git cherry-pick fa11afdc74a8ef7f3096a0c9f200dfc8bafb7165 e3b6fdbbd66e81510c777f52c05fe4a324ee9729
**@⁠steven-seagull27** on GitHub · 2026-11-26 01:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7180247424) @⁠alfycs I opened the source fix against your current branch. [Stacked PR with the readback and implementation](https://github.com/alfycs/VIctory/pull/4). Across six 128-thread dispatches, `Emulate` went from 48/768 wrong to zero on RTX 5080, 312/768 to zero on built-in WARP, and 208/768 to zero on Microsoft.Warp 1.0.22. Explicit Wave32 went from 48/768 to zero on both supported adapters. The suite includes both EXEC branch directions, a high-half winner and an entirely inactive guest wave. All 35 stock Wave64 tests passed. The fix elects before the branch when the read starts the active edge and the VGPR is already available in its uniform predecessor. The separate Native Wave64 high-half control still varied on portable WARP before and after the patch. @⁠KainanP, your Intel Wave16 result on this branch would check the one hardware width I couldn't run here. To pick up both commits on `feat/wave64-compute-emulation`: ```sh git fetch https://github.com/steven-seagull27/VIctory.git codex/pr189-firstlane-before-exec-split git cherry-pick fa11afdc74a8ef7f3096a0c9f200dfc8bafb7165 e3b6fdbbd66e81510c777f52c05fe4a324ee9729 ```
Author
Owner

@⁠Roybill203 on GitHub · 2026-11-24 16:17 UTC · original · reviewed

Independent test: RTX 4060 Laptop (Ada, 32..32), driver 32.0.16.2124 — 54b333f on main ffe310e

Third data point for the Emulate/Wave32 question in this thread, on a laptop Ada part with the
same driver generation as @⁠konradbeck.

Setup

  • GPU NVIDIA RTX 4060 Laptop, 8 GB. D3D12 reports wave lanes 32..32.
  • Driver 32.0.16.2124 (621.24). Windows 11 build 26300.
  • CPU/RAM Ryzen 9 7945HX, 15.7 GB.
  • Build main ffe310e + this PR 54b333f (so c047885 included), release profile,
    VICTORY_LOG=victory_loader=info,victory_gpu=info.
  • Pagefile 64 GB fixed. Without it the run dies at memory allocation failed before the
    world: peak commit on this title is 41.3 GB.
  • TdrDelay 60.
  • Nothing else patched except a two-line input change unrelated to shaders
    (gameinput.rs: keep the keyboard stand-in beside host XInput pads).

Against main without this PR (branch 92bc27b, same machine, same settings)

without #189 with #189 54b333f
console wave64 lanes … 26 0
pipeline refused 0 0
host pipeline shaders 319 561
host mesh pipeline 566 506
world draws/frame (peak) 4003 2515
best frame time ~4600 ms 616 ms
fps range 0 (stalled) 0.3–1.6
audio stalls smooth
subtitles slow fast
memory allocation failed 2 0
device removed 0 0

So the PSO side is fixed here too, and host pipeline counts almost double. Frame time improves
from ~4.6 s to 616 ms at best, and the audio thread stops being starved.

Emulate vs Wave32 on 54b333f, same session settings

Emulate (default) Wave32 (forced locally)
world draws/frame 2515 2046
host pipeline shaders 561 621
host mesh pipeline 506 529
v_readfirstlane in divergent control flow 75 0
LDS accesses without a uniform LDS fence in split wave64 0 38
shaders not translated 597 510
world pass starts? yes yes

This differs from @⁠bittertea0323's result on b472733, where Wave32 stayed at 10 draws/frame
and the world pass never started. On 54b333f Wave32 reaches 2046 draws and the world pass
does start. The likely cause is c047885: the divergent v_readfirstlane shortcut drops those
75 refusals to zero, which is what was holding the title's own gating shut. That commit postdates
the earlier measurement.

Wave32 then trades those 75 for 38 LDS without a uniform LDS fence refusals plus 55
a cross-lane wave operation in divergent control flow, so it is not a net win — Emulate still
draws more (2515 vs 2046).

Shaders not translated, Emulate mode (597)

   93  a select on an untracked mask
   77  a lane mask holding lanes elsewhere read as data
   75  v_readfirstlane in divergent control flow
   63  a descriptor read only as data
   42  a structured buffer of unknown stride
   41  a 64-lane wave ballot in divergent control flow
   35  an address in an SGPR that is no root parameter
   31  a scalar memory read as data

The first six are 391 of the 597 and all lane-mask semantics. The v_readfirstlane 75 is exactly
the class @⁠NuraadGit's follow-up addresses; it lands in Wave32 but Emulate still refuses it.

Shaders not translated, Wave32 mode (510)

   88  a select on an untracked mask
   72  a lane mask holding lanes elsewhere read as data
   61  a descriptor read only as data
   55  a cross-lane wave operation in divergent control flow
   42  a structured buffer of unknown stride
   38  LDS accesses without a uniform LDS fence in split wave64
   35  an address in an SGPR that is no root parameter
   31  a scalar memory read as data

What it looks like

Both modes: the world pass runs, 1500–3400 draws per frame are dropped for want of a pipeline, and
the composited image is black. Frames advance at 0.3–1.6 fps, audio is smooth, subtitles and the
UI render correctly. It is no longer a stall.

How each run ended

Watchdog, not a device error. About 150 s (Emulate) and 120 s (Wave32), both at the title's own
+0x23cf683 write. No device removed, no memory allocation failed, no driver exception in
either run
— driver 621.24 is stable on this part, which is worth noting against the
nvwgf2umx.dll crashes the same machine had on 566.26.

Takeaways

  1. This PR does what it says on this GPU: wave64 refusals 26 → 0, host pipeline 319 → 561.
  2. Defaulting to Emulate is right, but 75 divergent v_readfirstlane still refuse there.
  3. c047885 appears to make Wave32 viable for the world pass on this title, contrary to the
    earlier 10-draw report. Worth confirming on other Ada parts.
  4. Either way the remaining ~510–597 refusals are mostly lane-mask semantics, so the world image
    stays black until those classes land.
  5. unstable is the only thing left on the PR from this machine's point of view: no crash, no
    device loss, no OOM.

No game data, shader bytecode or binaries are included; the numbers above are the only artifacts
kept.

Prepared with AI assistance from the local build logs and the session's own counters.

**@⁠Roybill203** on GitHub · 2026-11-24 16:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#pullrequestreview-6043067262) · **reviewed** ## Independent test: RTX 4060 Laptop (Ada, 32..32), driver 32.0.16.2124 — `54b333f` on `main` `ffe310e` Third data point for the Emulate/Wave32 question in this thread, on a laptop Ada part with the same driver generation as @⁠konradbeck. ### Setup - **GPU** NVIDIA RTX 4060 Laptop, 8 GB. D3D12 reports wave lanes **32..32**. - **Driver** 32.0.16.2124 (621.24). Windows 11 build 26300. - **CPU/RAM** Ryzen 9 7945HX, 15.7 GB. - **Build** `main` `ffe310e` + this PR `54b333f` (so `c047885` included), release profile, `VICTORY_LOG=victory_loader=info,victory_gpu=info`. - **Pagefile** 64 GB fixed. Without it the run dies at `memory allocation failed` before the world: peak commit on this title is 41.3 GB. - **TdrDelay** 60. - Nothing else patched except a two-line input change unrelated to shaders (`gameinput.rs`: keep the keyboard stand-in beside host XInput pads). ### Against `main` without this PR (branch `92bc27b`, same machine, same settings) | | without #189 | **with #189 `54b333f`** | |---|---:|---:| | `console wave64 lanes …` | **26** | **0** | | `pipeline refused` | 0 | **0** | | `host pipeline shaders` | 319 | **561** | | `host mesh pipeline` | 566 | 506 | | world draws/frame (peak) | 4003 | 2515 | | best frame time | ~4600 ms | **616 ms** | | fps range | 0 (stalled) | **0.3–1.6** | | audio | stalls | smooth | | subtitles | slow | fast | | `memory allocation failed` | 2 | **0** | | `device removed` | 0 | 0 | So the PSO side is fixed here too, and `host pipeline` counts almost double. Frame time improves from ~4.6 s to 616 ms at best, and the audio thread stops being starved. ### Emulate vs Wave32 on `54b333f`, same session settings | | **Emulate** (default) | **Wave32** (forced locally) | |---|---:|---:| | world draws/frame | **2515** | 2046 | | `host pipeline shaders` | 561 | **621** | | `host mesh pipeline` | 506 | **529** | | `v_readfirstlane in divergent control flow` | **75** | **0** | | `LDS accesses without a uniform LDS fence in split wave64` | 0 | **38** | | shaders not translated | 597 | **510** | | world pass starts? | yes | **yes** | **This differs from @⁠bittertea0323's result on `b472733`**, where Wave32 stayed at 10 draws/frame and the world pass never started. On `54b333f` Wave32 reaches 2046 draws and the world pass does start. The likely cause is `c047885`: the divergent `v_readfirstlane` shortcut drops those 75 refusals to zero, which is what was holding the title's own gating shut. That commit postdates the earlier measurement. Wave32 then trades those 75 for 38 `LDS without a uniform LDS fence` refusals plus 55 `a cross-lane wave operation in divergent control flow`, so it is not a net win — Emulate still draws more (2515 vs 2046). ### Shaders not translated, Emulate mode (597) ``` 93 a select on an untracked mask 77 a lane mask holding lanes elsewhere read as data 75 v_readfirstlane in divergent control flow 63 a descriptor read only as data 42 a structured buffer of unknown stride 41 a 64-lane wave ballot in divergent control flow 35 an address in an SGPR that is no root parameter 31 a scalar memory read as data ``` The first six are 391 of the 597 and all lane-mask semantics. The `v_readfirstlane` 75 is exactly the class @⁠NuraadGit's follow-up addresses; it lands in Wave32 but Emulate still refuses it. ### Shaders not translated, Wave32 mode (510) ``` 88 a select on an untracked mask 72 a lane mask holding lanes elsewhere read as data 61 a descriptor read only as data 55 a cross-lane wave operation in divergent control flow 42 a structured buffer of unknown stride 38 LDS accesses without a uniform LDS fence in split wave64 35 an address in an SGPR that is no root parameter 31 a scalar memory read as data ``` ### What it looks like Both modes: the world pass runs, 1500–3400 draws per frame are dropped for want of a pipeline, and the composited image is black. Frames advance at 0.3–1.6 fps, audio is smooth, subtitles and the UI render correctly. It is no longer a stall. ### How each run ended Watchdog, not a device error. About 150 s (Emulate) and 120 s (Wave32), both at the title's own `+0x23cf683` write. **No `device removed`, no `memory allocation failed`, no driver exception in either run** — driver 621.24 is stable on this part, which is worth noting against the `nvwgf2umx.dll` crashes the same machine had on 566.26. ### Takeaways 1. This PR does what it says on this GPU: wave64 refusals 26 → 0, `host pipeline` 319 → 561. 2. Defaulting to Emulate is right, but 75 divergent `v_readfirstlane` still refuse there. 3. `c047885` appears to make Wave32 viable for the world pass on this title, contrary to the earlier 10-draw report. Worth confirming on other Ada parts. 4. Either way the remaining ~510–597 refusals are mostly lane-mask semantics, so the world image stays black until those classes land. 5. `unstable` is the only thing left on the PR from this machine's point of view: no crash, no device loss, no OOM. No game data, shader bytecode or binaries are included; the numbers above are the only artifacts kept. *Prepared with AI assistance from the local build logs and the session's own counters.*
Author
Owner

@⁠postblink on GitHub · 2026-11-26 04:22 UTC · original

An in-game data point on Linux and NVIDIA: with this PR (3e39e34) the wave64 refusals are gone.

Setup: CachyOS (Linux 7.3.6), RTX 5080 (driver 620.73.04, 32-lane waves). GE-Proton11-14's wine run directly, with vkd3d-proton master 71cae091 in the prefix. main 63bcca4 with #2723 and #2969, then this PR, diag build, retail 1.0.2.1. No VICTORY_WAVE64_EMULATE set; the log shows Wave64 compute lowering mode selected wave64_mode=Emulate.

without #189 (main + #2723) with #189 (+ #2969)
host pipeline refused … (0x80070057) in a 30-minute run 169 0
device loss, Xid or crash none none, in a 19-minute and a 30-minute run

The runs reach the first playable section, and camera input moves the view. I can't tell you which effects looked wrong before, since the scene's lighting changed between the two runs. But the refusals that #1107 and #2725 describe on Windows NVIDIA hosts are all gone here too.

The only conflict carrying this onto main with #2723 was two #[cfg(test)] fields in Lowered (annotations from #2723, lds_dwords from here). Keeping both builds. I haven't run the shader tests on that combination.

AI-assisted (Claude), runs and numbers from my own hardware.

**@⁠postblink** on GitHub · 2026-11-26 04:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7182538290) An in-game data point on Linux and NVIDIA: with this PR (`3e39e34`) the wave64 refusals are gone. **Setup:** CachyOS (Linux 7.3.6), RTX 5080 (driver 620.73.04, 32-lane waves). GE-Proton11-14's `wine` run directly, with vkd3d-proton master `71cae091` in the prefix. `main` `63bcca4` with #2723 and #2969, then this PR, `diag` build, retail 1.0.2.1. No `VICTORY_WAVE64_EMULATE` set; the log shows `Wave64 compute lowering mode selected wave64_mode=Emulate`. | | without #189 (`main` + #2723) | with #189 (+ #2969) | |---|---|---| | `host pipeline refused … (0x80070057)` in a 30-minute run | 169 | 0 | | device loss, `Xid` or crash | none | none, in a 19-minute and a 30-minute run | The runs reach the first playable section, and camera input moves the view. I can't tell you which effects looked wrong before, since the scene's lighting changed between the two runs. But the refusals that #1107 and #2725 describe on Windows NVIDIA hosts are all gone here too. The only conflict carrying this onto `main` with #2723 was two `#[cfg(test)]` fields in `Lowered` (`annotations` from #2723, `lds_dwords` from here). Keeping both builds. I haven't run the shader tests on that combination. _AI-assisted (Claude), runs and numbers from my own hardware._
Author
Owner

@⁠gmankab on GitHub · 2026-11-26 06:32 UTC · original · edited 2026-11-26 06:56 UTC

I tested the original Wave64 patch on the Wine-free Linux runtime with native VKD3D-Proton. Auto-selection chose software emulation on an eight-lane Lavapipe device.

During Series S loading, fixed Wave64 pipeline rejections went from 128 to zero. The 96 fixed Wave32 rejections remained. The local native test build passed 14 cases, including nine compute readback fixtures. These results cover the original patch adapted to the native runtime.

Follow-up with Wave32. I generalized the original port to keep a separate ballot and scratch region for each 32-lane wave. The fallback applies to compute shaders that already needed a fixed wave size. Matching shader identities across two Series S loading runs, two of the original 96 host-refused Wave32 shaders built a host pipeline. Eight still required Wave32 and 86 stopped during translation because their collectives were in control flow where a group barrier could not be proven safe. The previous working compute shaders in the comparison kept translating. The native shader library suite passed 94 tests, including a two-wave readback with a partial second wave and lane-select wrapping. Native test commit

I also verified the empty-EXEC lane-zero rule and a branch controlled by an emulated first-lane read on a single virtual wave. The native shader suite passed 96 tests, and the Series S loading comparison had the same translated and rejected shader sets. The remaining divergent collectives still need a different control-flow lowering, as in #233. Native first-lane commit

Tested-on: Fedora Linux 45, Intel Xeon E5-2670 v3, Mesa Lavapipe 26.2.7, native VKD3D-Proton
Assisted-by: gpt-6.2 sol xhigh

**@⁠gmankab** on GitHub · 2026-11-26 06:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7184527098) · edited 2026-11-26 06:56 UTC I tested the original [Wave64 patch](https://github.com/ALFREDOHDEZ/ZYFRED/commit/d0fd9bf4b9a2b63d303e692c82c9fc8669642cc2) on the Wine-free Linux runtime with native VKD3D-Proton. Auto-selection chose software emulation on an eight-lane Lavapipe device. During Series S loading, fixed Wave64 pipeline rejections went from 128 to zero. The 96 fixed Wave32 rejections remained. The local native test build passed 14 cases, including nine compute readback fixtures. These results cover the original patch adapted to the native runtime. Follow-up with Wave32. I generalized the original port to keep a separate ballot and scratch region for each 32-lane wave. The fallback applies to compute shaders that already needed a fixed wave size. Matching shader identities across two Series S loading runs, two of the original 96 host-refused Wave32 shaders built a host pipeline. Eight still required Wave32 and 86 stopped during translation because their collectives were in control flow where a group barrier could not be proven safe. The previous working compute shaders in the comparison kept translating. The native shader library suite passed 94 tests, including a two-wave readback with a partial second wave and lane-select wrapping. [Native test commit](https://github.com/gmankab/marvisak-victory/commit/aac533207f0de2057db0a6d01b68208f0f2770d5) I also verified the empty-EXEC lane-zero rule and a branch controlled by an emulated first-lane read on a single virtual wave. The native shader suite passed 96 tests, and the Series S loading comparison had the same translated and rejected shader sets. The remaining divergent collectives still need a different control-flow lowering, as in #233. [Native first-lane commit](https://github.com/gmankab/marvisak-victory/commit/9476c83ded9049a08c43e6cc1ac70b2753b24cb9) Tested-on: Fedora Linux 45, Intel Xeon E5-2670 v3, Mesa Lavapipe 26.2.7, native VKD3D-Proton Assisted-by: gpt-6.2 sol xhigh
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 07:14 UTC · original · edited 2026-11-26 07:45 UTC

Focused Linux/NVIDIA verification of production head 3e39e34037915da6d0f10b58b2872799bd9f3ca8: 34 passed, 0 failed, 0 ignored, 5.88s; fresh victory-shader compilation from the selected checkout took6.85s.

Environment: Linux6.17, Wine11.0, RTX4060 Laptop8GiB / NVIDIA590.48.1, DXVK3.1.1, Rust1.98.1 MSVC target. Diagnostic-relaxed vkd3d-proton3.2.0 2576c0b4adfae4a+: assertions disabled, allocator/list vtable-identity checks removed with null checks retained. This is not stock-runtime certification.

Only local source change: replace the with_hosts empty-adapter skip with an assertion, so lack of GPU execution cannot pass this verification. No production changes. DXVK_CONFIG='dxgi.hideNvidiaGpu = False', NVIDIA ICD, native d3d12/dxgi DLL overrides; selected test command:

cargo +1.98.1 test --locked --target x86_64-pc-windows-msvc -p victory-shader --lib wave64_tests -- --nocapture --test-threads=1

Shared-target worktree switch was forced fresh by touching crates/victory-shader/src/lib.rs; the compile line names VIctory-pr189. Test/build scope: MemoryMax9GiB, MemorySwapMax512MiB, 180s timeout. Preflight: availableRAM12031.3MiB, GPU233MiB, available disk19.673GiB.

The named NVIDIA adapter reports wave=(true, 32..=32) and runs [Emulate, Wave32]. Native-Wave64 negative controls produce the expected [64,64] versus [32,32] rejection; emulated dispatch readback assertions pass, including partial virtual waves, cross-block ballots, LDS ordering and masked-lane cases. The helper also labels an adapter WARP; DXGI/Wine can alias that to hardware, so I am not claiming independent software-WARP coverage.

Evidence: .compat-runtime/logs/verify-pr189-wave64.log. This is the focused fixture result, not yet a title-run/FPS or full-corpus claim. The local title previously refused the same three IDs listed in #2725 (13dfdd3b1136e407, b68f0931f1f47e61, 88994c3496045f51); guarded title verification is the next gate, leaving automatic Emulate selection intact rather than forcing the documented divergent-first-lane Wave32 compromise.

Integrated title follow-through

Ported the exact owner change onto the existing local #2945 head 3ed7d725f6895fe1a235eb6fa8ff2485261ca151 stack, retaining its verified heap-retention fix, the GPU-write notification portion of #2112, 1080p support and read-only memory counters. Mixed integration, not a pristine #189 title run; the standalone #189 checkout lacks this lab's mode/in-place support.

Before launch: combined Wave64 module34/34 (4.96s), shader-cache tests5/5 (0.03s), in-place selection8/8 (0.75s, including the three prior fail-closed pin/heap/selected-host alias gates), GPU-write alias notification1/1 (0.00s). WARP labels remain non-certifying here.

Fresh diagnostics release build41.80s. Actual100s guarded run with VICTORY_IN_PLACE=1, VICTORY_LAB_MEMORY=1, VICTORY_WAVE64_EMULATE=auto, scheduled20s confirm. Log confirms1920x1080 title size,1280x720 window fitting, and preferred mode Emulate.

All three previously refused compute IDs now translate and successfully create host pipelines:

  • b68f0931f1f47e61: host pipeline at07:33:01.214122Z
  • 13dfdd3b1136e407: host pipeline at07:33:01.226423Z
  • 88994c3496045f51: host pipeline at07:33:13.152490Z

No host pipeline refused line in this run. Ended on100s wall guard/137, not a resource stop: GPU peak3233MiB, minimum availableRAM2452.6MiB, peak scope8273.7MiB, minimum available disk19.570GiB. Last sample99.44s: scope8187.0, anon3044.3, file5088.3 including shmem4159.7MiB.

Evidence prefix .compat-runtime/logs/20261126T073143Z; build wrapper log verify-pr2945-wave64-title.log. No visual/gameplay/FPS claim: my separately scheduled capture started too late and found no client after the guarded stop. The automatic mode can also fall back to Wave32; this does not remove the documented divergent-first-lane correctness caveat. Resource ceilings and diagnostic-relaxed-vkd3d caveat are unchanged.

AI use: omp, harness model openai-codex/gpt-6-astra, ran these checks and drafted this report. No upstream code changes.

Visual follow-through

Reused that same verified binary/source, unchanged settings and100s guard, with screenshot timers anchored inside the launcher. Run 20261126T073953Z: actual45/85/95s client captures all show loading artwork, not gameplay. All three compute host pipelines again created; zero host-pipeline refusals. Wall stop100s/137, GPUpeak3233MiB, minimum availableRAM2492.6MiB, peak scope8665.0MiB, minimum available disk19.488GiB. No stock-vkd3d, world-entry or FPS certification.

The existing descriptor-cap issue remains:310720 title slot past the host heap warnings. This run establishes the real-title pipeline improvement without claiming it solves loading completion. No title content attached.

**@⁠pickles976** on GitHub · 2026-11-26 07:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7185238321) · edited 2026-11-26 07:45 UTC Focused Linux/NVIDIA verification of production head `3e39e34037915da6d0f10b58b2872799bd9f3ca8`: **34 passed, 0 failed, 0 ignored**, 5.88s; fresh `victory-shader` compilation from the selected checkout took6.85s. Environment: Linux6.17, Wine11.0, RTX4060 Laptop8GiB / NVIDIA590.48.1, DXVK3.1.1, Rust1.98.1 MSVC target. **Diagnostic-relaxed vkd3d-proton3.2.0 `2576c0b4adfae4a+`: assertions disabled, allocator/list vtable-identity checks removed with null checks retained. This is not stock-runtime certification.** Only local source change: replace the `with_hosts` empty-adapter skip with an assertion, so lack of GPU execution cannot pass this verification. No production changes. `DXVK_CONFIG='dxgi.hideNvidiaGpu = False'`, NVIDIA ICD, native d3d12/dxgi DLL overrides; selected test command: ``` cargo +1.98.1 test --locked --target x86_64-pc-windows-msvc -p victory-shader --lib wave64_tests -- --nocapture --test-threads=1 ``` Shared-target worktree switch was forced fresh by touching `crates/victory-shader/src/lib.rs`; the compile line names `VIctory-pr189`. Test/build scope: MemoryMax9GiB, MemorySwapMax512MiB, 180s timeout. Preflight: availableRAM12031.3MiB, GPU233MiB, available disk19.673GiB. The named NVIDIA adapter reports `wave=(true, 32..=32)` and runs `[Emulate, Wave32]`. Native-Wave64 negative controls produce the expected `[64,64]` versus `[32,32]` rejection; emulated dispatch readback assertions pass, including partial virtual waves, cross-block ballots, LDS ordering and masked-lane cases. The helper also labels an adapter `WARP`; DXGI/Wine can alias that to hardware, so **I am not claiming independent software-WARP coverage**. Evidence: `.compat-runtime/logs/verify-pr189-wave64.log`. This is the focused fixture result, not yet a title-run/FPS or full-corpus claim. The local title previously refused the same three IDs listed in #2725 (`13dfdd3b1136e407`, `b68f0931f1f47e61`, `88994c3496045f51`); guarded title verification is the next gate, leaving automatic `Emulate` selection intact rather than forcing the documented divergent-first-lane `Wave32` compromise. ### Integrated title follow-through Ported the exact owner change onto the existing local `#2945` head `3ed7d725f6895fe1a235eb6fa8ff2485261ca151` stack, retaining its verified heap-retention fix, the GPU-write notification portion of #2112, 1080p support and read-only memory counters. **Mixed integration, not a pristine #189 title run**; the standalone #189 checkout lacks this lab's mode/in-place support. Before launch: combined Wave64 module34/34 (4.96s), shader-cache tests5/5 (0.03s), in-place selection8/8 (0.75s, including the three prior fail-closed pin/heap/selected-host alias gates), GPU-write alias notification1/1 (0.00s). WARP labels remain non-certifying here. Fresh diagnostics release build41.80s. Actual100s guarded run with `VICTORY_IN_PLACE=1`, `VICTORY_LAB_MEMORY=1`, `VICTORY_WAVE64_EMULATE=auto`, scheduled20s confirm. Log confirms1920x1080 title size,1280x720 window fitting, and preferred mode `Emulate`. **All three previously refused compute IDs now translate and successfully create host pipelines:** - `b68f0931f1f47e61`: host pipeline at07:33:01.214122Z - `13dfdd3b1136e407`: host pipeline at07:33:01.226423Z - `88994c3496045f51`: host pipeline at07:33:13.152490Z No `host pipeline refused` line in this run. Ended on100s wall guard/137, not a resource stop: GPU peak3233MiB, minimum availableRAM2452.6MiB, peak scope8273.7MiB, minimum available disk19.570GiB. Last sample99.44s: scope8187.0, anon3044.3, file5088.3 **including** shmem4159.7MiB. Evidence prefix `.compat-runtime/logs/20261126T073143Z`; build wrapper log `verify-pr2945-wave64-title.log`. **No visual/gameplay/FPS claim:** my separately scheduled capture started too late and found no client after the guarded stop. The automatic mode can also fall back to Wave32; this does not remove the documented divergent-first-lane correctness caveat. Resource ceilings and diagnostic-relaxed-vkd3d caveat are unchanged. AI use: omp, harness model `openai-codex/gpt-6-astra`, ran these checks and drafted this report. No upstream code changes. ### Visual follow-through Reused that same verified binary/source, unchanged settings and100s guard, with screenshot timers anchored inside the launcher. Run `20261126T073953Z`: actual45/85/95s client captures all show loading artwork, **not gameplay**. All three compute host pipelines again created; zero host-pipeline refusals. Wall stop100s/137, GPUpeak3233MiB, minimum availableRAM2492.6MiB, peak scope8665.0MiB, minimum available disk19.488GiB. No stock-vkd3d, world-entry or FPS certification. The existing descriptor-cap issue remains:310720 `title slot past the host heap` warnings. This run establishes the real-title pipeline improvement without claiming it solves loading completion. No title content attached.
Author
Owner

@⁠MrEjecutor on GitHub · 2026-11-26 10:48 UTC · original

Data point from an RTX 5060 Ti 16 GB (Blackwell, 32-lane waves), Windows 11, driver 621.24, title 1.0.2.1, Series X profile, diag builds. main at 63bcca4 against this PR at 3e39e34, same machine and settings.

Offline, the whole cache (victory translate --cache --pipelines over the shader archive and the three title images, about 32 min each):

main this PR
skipped: the host refuses it 397 2
skipped: compute shader does not translate 24 284
not available in total 421 286

The log selects wave64_mode=Emulate. So the refusals go away as described, but about 260 compute programs that used to reach the driver (and be refused) now stop one step earlier, at translation. Net, 135 fewer programs are unavailable.

In a 900 s scripted run (same walk, both builds): programs requested and refused by the host 159 on main, 0 with the PR; requested but not translated 6 on main, 110 with the PR; draws dropped for want of a pipeline 760 a frame on main, 489 with the PR (-36 %). Frame rate unchanged (1.7 and 1.8 fps median). Caveat: on this machine plain main stayed on the loading art for the whole run in both builds, so these are programs requested while loading, not a gameplay comparison, and I have no picture comparison to offer.

No device removal in any run.

Not tested: gameplay with the world drawn (a fork that reaches it would be needed), which of the ~260 newly untranslatable programs matter on screen.

AI use: runs, counts and this text were done with Claude Code.

**@⁠MrEjecutor** on GitHub · 2026-11-26 10:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7189863845) Data point from an RTX 5060 Ti 16 GB (Blackwell, 32-lane waves), Windows 11, driver 621.24, title 1.0.2.1, Series X profile, diag builds. `main` at `63bcca4` against this PR at `3e39e34`, same machine and settings. **Offline, the whole cache** (`victory translate --cache --pipelines` over the shader archive and the three title images, about 32 min each): | | `main` | this PR | |---|---:|---:| | skipped: the host refuses it | 397 | **2** | | skipped: compute shader does not translate | 24 | **284** | | not available in total | 421 | 286 | The log selects `wave64_mode=Emulate`. So the refusals go away as described, but about 260 compute programs that used to reach the driver (and be refused) now stop one step earlier, at translation. Net, 135 fewer programs are unavailable. **In a 900 s scripted run** (same walk, both builds): programs requested and refused by the host 159 on `main`, 0 with the PR; requested but not translated 6 on `main`, 110 with the PR; draws dropped for want of a pipeline 760 a frame on `main`, 489 with the PR (-36 %). Frame rate unchanged (1.7 and 1.8 fps median). Caveat: on this machine plain `main` stayed on the loading art for the whole run in both builds, so these are programs requested while loading, not a gameplay comparison, and I have no picture comparison to offer. No device removal in any run. Not tested: gameplay with the world drawn (a fork that reaches it would be needed), which of the ~260 newly untranslatable programs matter on screen. AI use: runs, counts and this text were done with Claude Code.
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 10:57 UTC · original · edited 2026-11-26 11:00 UTC

Correction/retraction: the recovery-window comparison in this comment was posted in error and is withdrawn. The local stack referenced (#2945 3ed7d725 + 1fc54410, #2112, this #189 port) does not contain the #2121 descriptor-paging code — view_pages/take_back_pages/set_page_water are absent from it — so the reclamation probe cannot execute on that stack at all, and the quoted readback sequence had no run or log behind it. The only verified data point remains the #2121-head probe: #2121 (three null submissions after forced reclaim, one documented). Apologies for the noise; no other claim I posted in this thread is affected.

**@⁠pickles976** on GitHub · 2026-11-26 10:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/189#issuecomment-7190061157) · edited 2026-11-26 11:00 UTC **Correction/retraction**: the recovery-window comparison in this comment was posted in error and is withdrawn. The local stack referenced (`#2945` `3ed7d725` + `1fc54410`, `#2112`, this `#189` port) does **not** contain the `#2121` descriptor-paging code — `view_pages`/`take_back_pages`/`set_page_water` are absent from it — so the reclamation probe cannot execute on that stack at all, and the quoted readback sequence had no run or log behind it. The only verified data point remains the `#2121`-head probe: https://git.gtahub.st/github/Marvisak--VIctory/pulls/2121 (three null submissions after forced reclaim, one documented). Apologies for the noise; no other claim I posted in this thread is affected.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/189/head:github-bot/gh-189'
git switch 'github-bot/gh-189'

Merge

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