Shaders: fix compute lane permutations on WARP #2997

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

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 02:58 UTC · original
andrewpozdnakov7-jpg:codex2/warp-compute-permute → main · +196 −93 · 9 files · 3 commits · open

Refs #2949

WARP 1.0.22 can return the wrong source for a compute ds_bpermute_b32 lane gather. Read within four-lane groups on the software adapter and select the requested result. Every intermediate read uses an active source, including when a branch leaves a group partially active or empty. The existing guest EXEC rule still zeroes an inactive source, and Wave64 picks from its own 32-lane half.

The runtime selects this translation after identifying its host adapter. Software and hardware DXIL use distinct shader-cache keys. Hardware continues to emit the direct lane read.

Verification

  • On the same Agility WARP runtime, the existing guest fixtures went from 19 of 32 mismatched lanes to zero for Wave32 and 32 of 64 to zero for Wave64. The other permutation fixtures pass, including divergent branches with 16 and 19 active lanes and Wave64 EXEC masking.
  • Separate DXC-compiled controls reproduced 10,752 mismatches across 16,384 Wave32 results and 21,504 across 32,768 Wave64 results. Reading in four-lane groups matched every result in both controls.
  • Full forced-WARP shader run went from 298 passed, 4 failed, 3 ignored to 300 passed, 2 failed, 3 ignored. Both revisions reproduce the texture gather rounding and edge-flagged triangle failures.
  • Both strict workspace Clippy builds, the cache key test, the WARP GPU diagnostics suite (246 passed, one ignored) and asset policy passed.

The adapter selection overlaps the host field in #2646. Both paths can share the detected software adapter.

Issue reproduction · WaveReadLaneAt semantics

AI-assisted with Codex.

Cache warming uses the same initialized D3D12 adapter classification as runtime. A synthetic compute shader warmed with a default software adapter now hits the cache on runtime lookup. The previous head missed, with the explicit software override off in both runs.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 02:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997) `andrewpozdnakov7-jpg:codex2/warp-compute-permute` → `main` · +196 −93 · 9 files · 3 commits · open Refs #2949 WARP 1.0.22 can return the wrong source for a compute ds_bpermute_b32 lane gather. Read within four-lane groups on the software adapter and select the requested result. Every intermediate read uses an active source, including when a branch leaves a group partially active or empty. The existing guest EXEC rule still zeroes an inactive source, and Wave64 picks from its own 32-lane half. The runtime selects this translation after identifying its host adapter. Software and hardware DXIL use distinct shader-cache keys. Hardware continues to emit the direct lane read. ## Verification - On the same Agility WARP runtime, the existing guest fixtures went from 19 of 32 mismatched lanes to zero for Wave32 and 32 of 64 to zero for Wave64. The other permutation fixtures pass, including divergent branches with 16 and 19 active lanes and Wave64 EXEC masking. - Separate DXC-compiled controls reproduced 10,752 mismatches across 16,384 Wave32 results and 21,504 across 32,768 Wave64 results. Reading in four-lane groups matched every result in both controls. - Full forced-WARP shader run went from 298 passed, 4 failed, 3 ignored to 300 passed, 2 failed, 3 ignored. Both revisions reproduce the texture gather rounding and edge-flagged triangle failures. - Both strict workspace Clippy builds, the cache key test, the WARP GPU diagnostics suite (246 passed, one ignored) and asset policy passed. The adapter selection overlaps the host field in #2646. Both paths can share the detected software adapter. [Issue reproduction](https://git.gtahub.st/github/Marvisak--VIctory/issues/2949) · [WaveReadLaneAt semantics](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/wavereadlaneat) AI-assisted with Codex. Cache warming uses the same initialized D3D12 adapter classification as runtime. A synthetic compute shader warmed with a default software adapter now hits the cache on runtime lookup. The previous head missed, with the explicit software override off in both runs.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:19:43 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 03:22 UTC · original

Independent Windows verification of 92bfec2, compared with its exact parent 63bcca4 (current main). WARP only. Runtime-limited: nothing dispatched.

Scope is the claim in #1633. I checked the head, the single parent, CLEAN state and green check before starting and again before posting. No overlapping run reports were found. All data is synthetic, with no game files.

Host and runtime. Windows 11 Pro 10.0.26200, rustc and cargo 1.98.1. Every device in these runs was the software adapter. Each attempt asserted this through EnumAdapterByLuid and logged Microsoft Basic Render Driver, vendor 0x1414, device 0x008c, DXGI_ADAPTER_FLAG_SOFTWARE, 0 dedicated VRAM, with C:\WINDOWS\SYSTEM32\d3d10warp.dll loaded. That is the inbox WARP 10.0.26100.9818, not the Agility WARP 1.0.22 used for the reproduction in the description. No Agility or redistributable WARP is installed here. The physical GPU was not used. Environment: VICTORY_WARP=1 (so the harness's hardware slot is also WARP, and both labels count as WARP), VICTORY_D3D12_WARP=1, and VICTORY_DXIL set to the Windows SDK 10.0.26100.0 dxil.dll (1.8.2502.11). Cargo ran with -j 4 --locked and a dedicated target directory. Before each switch between worktrees I ran cargo clean -p on the affected packages, because cargo had reused the other worktree's test binary when they shared a target directory.

The main limitation. This inbox WARP refuses every fixed-WaveSize compute pipeline that these tests build, Wave32 and Wave64. So no permute shader dispatched on either revision, and the #2949 miscompare could not be reproduced or confirmed fixed at runtime here. The existing permute tests pass on the head only through their no pipeline … skipped path.

Commands (cargo test -j 4 --locked -p victory-shader --lib -- synthetic_tests::permute synthetic_tests::wave64_permute verification_probe --nocapture --test-threads=1, plus a temporary local probe that was not committed):

Check Parent 63bcca4 Head 92bfec2
4 existing permute tests 2 Wave64 pass (skipped); the 2 Wave32 tests fail with hardware: no pipeline for a wave of 32 4 pass (all skipped on WARP)
Probe: 156 synthetic ds_bpermute_b32 cases × 2 labels (details below) 312 attempts, 0 dispatched 312 attempts, 0 dispatched
DXIL validation (dxil.dll 1.8.2502.11) of every probe shader all pass (direct read) all pass (four-lane form)
Software and hardware variants differ (Wave32 and Wave64) n/a yes. For example, Wave32 is 1480 B direct and 2220 B four-lane, and both validate
victory-gpu --features diagnostics shader_cache:: (4 tests, no device) not run 4 pass, including the_key_covers_translator_encoding_and_settings

The parent's two Wave32 failures come from forcing WARP, not from this PR. The parent asserts on the loop label (assert!(warp, …)), so the forced hardware slot fails. The head asserts host.is_software(). This is the harness-label behaviour tracked separately on #1633 (#2225), and I did not change it.

Probe cases: lane maps (k·lane + c) & 31 within each 32-lane half, using 6 odd-k permutations. EXEC was full, contiguous partial (<13, <19, <40, <51), or non-contiguous (lane & 5, & 0x22, & 0x0A nonzero). Each partial EXEC ran both straight-line (s_and_saveexec) and behind s_cbranch_execz. The probe used Wave32 and Wave64, and expected 0 from inactive sources and preserved values on inactive lanes.

Routing logic, checked on the CPU. Because nothing could dispatch, I modelled read_lane_on_warp plus the running select exactly as emitted. DXIL op 32 is FirstbitLo, consistent with its other uses in lower.rs. The model assumes a correct WaveReadLaneAt, so it says nothing about WARP 1.0.22's behaviour. It used random host-active sets, guest EXEC subsets of them (including empty and partial four-lane groups), and random addresses, with 20,000 trials per wave size: 328,714 Wave32 and 657,737 Wave64 lane results, 0 mismatches against ISA semantics. It also found 0 intermediate reads from a host-inactive lane: the fallback is the group's lowest active lane, or the wave's first lane when the group is empty. Wave64 sources stayed within their own half.

Not verified here: the runtime fix on Agility WARP 1.0.22 (I had no such runtime), any hardware adapter (not used on purpose), full shader or workspace suites, and Clippy. Someone with Agility WARP ≥ 1.0.22, which accepts fixed WaveSize, would need to confirm the dispatch-level result.

AI-assisted: verification run and written by Claude Code (Claude Opus 5.5). The figures above come from these runs on this host.

**@⁠oni-swr** on GitHub · 2026-11-26 03:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#issuecomment-7181660706) **Independent Windows verification of `92bfec2`, compared with its exact parent `63bcca4` (current `main`). WARP only. Runtime-limited: nothing dispatched.** Scope is the claim in https://git.gtahub.st/github/Marvisak--VIctory/issues/1633. I checked the head, the single parent, CLEAN state and green `check` before starting and again before posting. No overlapping run reports were found. All data is synthetic, with no game files. **Host and runtime.** Windows 11 Pro 10.0.26200, rustc and cargo 1.98.1. Every device in these runs was the software adapter. Each attempt asserted this through `EnumAdapterByLuid` and logged `Microsoft Basic Render Driver`, vendor `0x1414`, device `0x008c`, `DXGI_ADAPTER_FLAG_SOFTWARE`, 0 dedicated VRAM, with `C:\WINDOWS\SYSTEM32\d3d10warp.dll` loaded. That is the **inbox WARP 10.0.26100.9818**, not the Agility WARP 1.0.22 used for the reproduction in the description. No Agility or redistributable WARP is installed here. The physical GPU was not used. Environment: `VICTORY_WARP=1` (so the harness's `hardware` slot is also WARP, and both labels count as WARP), `VICTORY_D3D12_WARP=1`, and `VICTORY_DXIL` set to the Windows SDK 10.0.26100.0 `dxil.dll` (1.8.2502.11). Cargo ran with `-j 4 --locked` and a dedicated target directory. Before each switch between worktrees I ran `cargo clean -p` on the affected packages, because cargo had reused the other worktree's test binary when they shared a target directory. **The main limitation.** This inbox WARP refuses every fixed-`WaveSize` compute pipeline that these tests build, Wave32 and Wave64. So no permute shader dispatched on either revision, and the #2949 miscompare could not be reproduced or confirmed fixed at runtime here. The existing permute tests pass on the head only through their `no pipeline … skipped` path. Commands (`cargo test -j 4 --locked -p victory-shader --lib -- synthetic_tests::permute synthetic_tests::wave64_permute verification_probe --nocapture --test-threads=1`, plus a temporary local probe that was not committed): | Check | Parent `63bcca4` | Head `92bfec2` | |---|---|---| | 4 existing permute tests | 2 Wave64 pass (skipped); the 2 Wave32 tests **fail** with `hardware: no pipeline for a wave of 32` | 4 pass (all skipped on WARP) | | Probe: 156 synthetic `ds_bpermute_b32` cases × 2 labels (details below) | 312 attempts, 0 dispatched | 312 attempts, 0 dispatched | | DXIL validation (`dxil.dll` 1.8.2502.11) of every probe shader | all pass (direct read) | all pass (four-lane form) | | Software and hardware variants differ (Wave32 and Wave64) | n/a | yes. For example, Wave32 is 1480 B direct and 2220 B four-lane, and both validate | | `victory-gpu --features diagnostics` `shader_cache::` (4 tests, no device) | not run | 4 pass, including `the_key_covers_translator_encoding_and_settings` | The parent's two Wave32 failures come from forcing WARP, not from this PR. The parent asserts on the loop label (`assert!(warp, …)`), so the forced `hardware` slot fails. The head asserts `host.is_software()`. This is the harness-label behaviour tracked separately on #1633 (#2225), and I did not change it. Probe cases: lane maps `(k·lane + c) & 31` within each 32-lane half, using 6 odd-`k` permutations. EXEC was full, contiguous partial (`<13`, `<19`, `<40`, `<51`), or non-contiguous (`lane & 5`, `& 0x22`, `& 0x0A` nonzero). Each partial EXEC ran both straight-line (`s_and_saveexec`) and behind `s_cbranch_execz`. The probe used Wave32 and Wave64, and expected 0 from inactive sources and preserved values on inactive lanes. **Routing logic, checked on the CPU.** Because nothing could dispatch, I modelled `read_lane_on_warp` plus the `running` select exactly as emitted. DXIL op 32 is FirstbitLo, consistent with its other uses in `lower.rs`. The model assumes a correct `WaveReadLaneAt`, so it says nothing about WARP 1.0.22's behaviour. It used random host-active sets, guest EXEC subsets of them (including empty and partial four-lane groups), and random addresses, with 20,000 trials per wave size: 328,714 Wave32 and 657,737 Wave64 lane results, **0 mismatches** against ISA semantics. It also found **0 intermediate reads from a host-inactive lane**: the fallback is the group's lowest active lane, or the wave's first lane when the group is empty. Wave64 sources stayed within their own half. **Not verified here:** the runtime fix on Agility WARP 1.0.22 (I had no such runtime), any hardware adapter (not used on purpose), full shader or workspace suites, and Clippy. Someone with Agility WARP ≥ 1.0.22, which accepts fixed WaveSize, would need to confirm the dispatch-level result. AI-assisted: verification run and written by Claude Code (Claude Opus 5.5). The figures above come from these runs on this host.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 03:47 UTC · original

14f3b63 makes cache warming classify the same D3D12 device that runtime translation uses. The first call can initialize that device. If D3D12 is unavailable, offline translation still uses the explicit setting.

I tested the same synthetic compute container with an empty cache in a non-diagnostics build. The temporary probe made the default device call select the actual Agility WARP adapter with the explicit WARP override off. At 92bfec2, the runtime lookup missed the warmed shader. At 14f3b63, it hit. The probe and the temporary selection were removed after the comparison.

The cache key tests, full Agility WARP GPU suite, strict workspace Clippy in both configurations, and asset policy passed.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 03:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#issuecomment-7182028606) [14f3b63](https://github.com/Marvisak/VIctory/commit/14f3b63fc3ae3fc7abafddaa38c0896f017db074) makes cache warming classify the same D3D12 device that runtime translation uses. The first call can initialize that device. If D3D12 is unavailable, offline translation still uses the explicit setting. I tested the same synthetic compute container with an empty cache in a non-diagnostics build. The temporary probe made the default device call select the actual Agility WARP adapter with the explicit WARP override off. At `92bfec2`, the runtime lookup missed the warmed shader. At `14f3b63`, it hit. The probe and the temporary selection were removed after the comparison. The cache key tests, full Agility WARP GPU suite, strict workspace Clippy in both configurations, and asset policy passed.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 03:49 UTC · original

I ran the four ds_bpermute_b32 tests on the exact PR head 92bfec2 and ran the same fixtures through the parent translator (63bcca4). I verified the DXGI adapter and loaded d3d10warp.dll path. With app-local Microsoft WARP 1.0.22, all three independent processes gave the following readbacks.

Guest wave and case Parent wrong / checked PR wrong / checked
Wave32, original varying source and EXEC 7/32 0/32
Wave32, high address bits, 16 participating lanes 8/32 0/32
Wave32, high address bits, 19 participating lanes 11/32 0/32
Wave64, EXEC within each half 32/64 0/64
Wave64, source remains inside each half 24/64 0/64

That’s 82/224 → 0/224 per WARP 1.0.22 run. RTX 5080 (621.40) returned 0/96 → 0/96 at its supported Wave32 width. Windows WARP 10.0.26100.10068 skipped both fixed widths and produced no readback. The parent comparison kept reading after mismatches so the totals cover all five dispatches. This supplies the software-runtime check requested on #2949.

I also integrated your banked-read helper with #1737. On that separate branch all five DS dispatches still matched, and WARP now matches the tested full-wave permlane row-shuffle cases as well. Integration, per-wave counts and limits

AI-assisted with Codex. Synthetic shaders and real readbacks.

**@⁠steven-seagull27** on GitHub · 2026-11-26 03:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#issuecomment-7182054726) I ran the four `ds_bpermute_b32` tests on the exact PR head `92bfec2` and ran the same fixtures through the parent translator (`63bcca4`). I verified the DXGI adapter and loaded `d3d10warp.dll` path. With app-local Microsoft WARP **1.0.22**, all three independent processes gave the following readbacks. | Guest wave and case | Parent wrong / checked | PR wrong / checked | |---|---:|---:| | Wave32, original varying source and EXEC | 7/32 | 0/32 | | Wave32, high address bits, 16 participating lanes | 8/32 | 0/32 | | Wave32, high address bits, 19 participating lanes | 11/32 | 0/32 | | Wave64, EXEC within each half | 32/64 | 0/64 | | Wave64, source remains inside each half | 24/64 | 0/64 | That’s **82/224 → 0/224** per WARP 1.0.22 run. RTX 5080 (621.40) returned **0/96 → 0/96** at its supported Wave32 width. Windows WARP 10.0.26100.10068 skipped both fixed widths and produced no readback. The parent comparison kept reading after mismatches so the totals cover all five dispatches. This supplies the software-runtime check requested on [#2949](https://git.gtahub.st/github/Marvisak--VIctory/issues/2949). I also integrated your banked-read helper with #1737. On that separate branch all five DS dispatches still matched, and WARP now matches the tested full-wave permlane row-shuffle cases as well. [Integration, per-wave counts and limits](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1737) AI-assisted with Codex. Synthetic shaders and real readbacks.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 05:49 UTC · original · edited 2026-11-26 07:19 UTC

Automated triage for the maintainers.

Still a merge candidate. The new commit a4484f5 only gates the lower::lower wrapper in crates/victory-shader/src/emit/lower.rs with #[cfg(any(test, all(windows, feature = "host")))], which fixes the default-library Clippy dead-code warning. I checked its callers: the test modules, the in-file tests, and emit/host.rs, which is compiled only under all(windows, any(test, feature = "host")), so every caller is still covered. No behaviour changes.

The points from our previous comment still apply: host_shader may create the D3D12 device on first translation; an unidentified adapter falls back to the slower four-lane form; and #233 touches the same emit::Options call sites.

CI: passing.

Recommending a look, not approving.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 05:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#issuecomment-7183834266) · edited 2026-11-26 07:19 UTC <!-- victory-triage v1 head=a4484f589f5ec4255fd1dbcd8057569fe51f5fd3 verdict=merge-candidate at=2026-11-26T07:19:37Z --> Automated triage for the maintainers. **Still a merge candidate.** The new commit `a4484f5` only gates the `lower::lower` wrapper in `crates/victory-shader/src/emit/lower.rs` with `#[cfg(any(test, all(windows, feature = "host")))]`, which fixes the default-library Clippy dead-code warning. I checked its callers: the test modules, the in-file tests, and `emit/host.rs`, which is compiled only under `all(windows, any(test, feature = "host"))`, so every caller is still covered. No behaviour changes. The points from our previous comment still apply: `host_shader` may create the D3D12 device on first translation; an unidentified adapter falls back to the slower four-lane form; and #233 touches the same `emit::Options` call sites. CI: passing. Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 06:37 UTC · original

The default library warning reproduced on 14f3b63 with cargo clippy --lib -- -D warnings. Commit a4484f5 compiles the wrapper for tests and the Windows host feature. The FMA capability probe under host still calls it.

Strict library Clippy passes with default and all features. Strict all-targets Clippy with all features and asset policy pass too. All six permutation tests passed with app-local WARP SM 6.6 and the DXIL validator.

Please retain the Git author if moving this change. If it is folded into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 06:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#issuecomment-7184614358) The default library warning reproduced on `14f3b63` with `cargo clippy --lib -- -D warnings`. [Commit a4484f5](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/a4484f589f5ec4255fd1dbcd8057569fe51f5fd3) compiles the wrapper for tests and the Windows `host` feature. The FMA capability probe under `host` still calls it. Strict library Clippy passes with default and all features. Strict all-targets Clippy with all features and asset policy pass too. All six permutation tests passed with app-local WARP SM 6.6 and the DXIL validator. Please retain the Git author if moving this change. If it is folded into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 03:03 UTC · original · approved these changes

LGTM — fixes #2949. Verified the workaround's mechanism: each bank iteration calls WaveReadLaneAt with a uniform group base (only the within-bank index diverges), which is precisely what avoids WARP 1.0.22's wrong four-lane-group selection; requested picks the iteration matching the target's bank. Dead-bank reads use the wave's first lane (live source), dead in-bank targets use popcount(mask) — harmless since running zeroes inactive sources downstream. Cache key covers warp_permute; uses_software_adapter() resolves pre-device via prefer_warp for offline translate. The active=19 test cuts through a bank — the discriminating case.

**@⁠kotekompotek** on GitHub · 2026-11-26 03:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#pullrequestreview-6067992126) · **approved these changes** LGTM — fixes #2949. Verified the workaround's mechanism: each bank iteration calls WaveReadLaneAt with a uniform group base (only the within-bank index diverges), which is precisely what avoids WARP 1.0.22's wrong four-lane-group selection; `requested` picks the iteration matching the target's bank. Dead-bank reads use the wave's first lane (live source), dead in-bank targets use popcount(mask) — harmless since `running` zeroes inactive sources downstream. Cache key covers warp_permute; uses_software_adapter() resolves pre-device via prefer_warp for offline translate. The active=19 test cuts through a bank — the discriminating case.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 03:22 UTC · original · requested changes

Code review on 92bfec27 (static source inspection; no runtime WARP/GPU execution):

  • P2 — Offline shader cache warm-up (translate --cache) can warm the wrong warp_permute variant vs runtime (apps/victory/src/translate.rs:372, crates/victory-gpu/src/host.rs:56-69, 216, crates/victory-gpu/src/shader_cache.rs:84-98):
    • uses_software_adapter() checks HOST.get(), falling back to prefer_warp() (cfg!(feature = "diagnostics") && switch::on("VICTORY_D3D12_WARP")) before a device exists.
    • During offline warm-up (translate::warm), no Host is created, so uses_software_adapter() always returns false unless diagnostics + VICTORY_D3D12_WARP are both set. At runtime, Host::create sets host.software = warp || on_software_adapter(&device).
    • On any machine where the default D3D12 device resolves to a software adapter (e.g., WARP-only host / VM, or when DXGI adapter lookup fails), warm-up populates cache entries under build(false) while runtime looks up build(true), missing every warmed shader (and forcing full re-translation on startup).
    • Suggest determining adapter classification consistently between warm-up and runtime (or populating/detecting the software adapter in warm-up when applicable).
**@⁠fuzeofficlal** on GitHub · 2026-11-26 03:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#pullrequestreview-6068131266) · **requested changes** Code review on `92bfec27` (static source inspection; no runtime WARP/GPU execution): - **P2 — Offline shader cache warm-up (`translate --cache`) can warm the wrong `warp_permute` variant vs runtime (`apps/victory/src/translate.rs:372`, `crates/victory-gpu/src/host.rs:56-69, 216`, `crates/victory-gpu/src/shader_cache.rs:84-98`)**: - `uses_software_adapter()` checks `HOST.get()`, falling back to `prefer_warp()` (`cfg!(feature = "diagnostics") && switch::on("VICTORY_D3D12_WARP")`) before a device exists. - During offline warm-up (`translate::warm`), no `Host` is created, so `uses_software_adapter()` always returns `false` unless `diagnostics` + `VICTORY_D3D12_WARP` are both set. At runtime, `Host::create` sets `host.software = warp || on_software_adapter(&device)`. - On any machine where the default D3D12 device resolves to a software adapter (e.g., WARP-only host / VM, or when DXGI adapter lookup fails), warm-up populates cache entries under `build(false)` while runtime looks up `build(true)`, missing every warmed shader (and forcing full re-translation on startup). - Suggest determining adapter classification consistently between warm-up and runtime (or populating/detecting the software adapter in warm-up when applicable).
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 06:12 UTC · original · reviewed

Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):

  • cargo test -p victory-shader permute -- --test-threads=1 (RTX 5090 & WARP): 6 passed, 0 failed on both.
  • cargo test -p victory-gpu shader_cache::tests: 4 passed, 0 failed.
  • cargo xtask policy: 191 files ok.

One small warning caught in non-test lib builds (cargo test / cargo check --lib):

warning: function `lower` is never used
  --> crates\victory-shader\src\emit\lower.rs:98:15

lower::lower is now only called from #[cfg(test)] modules (emit/mod.rs calls lower_with), so gating pub(crate) fn lower with #[cfg(test)] (or removing it) will keep cargo clippy --lib -- -D warnings clean.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 06:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#pullrequestreview-6069341615) · **reviewed** Tested locally merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP): - `cargo test -p victory-shader permute -- --test-threads=1` (RTX 5090 & WARP): 6 passed, 0 failed on both. - `cargo test -p victory-gpu shader_cache::tests`: 4 passed, 0 failed. - `cargo xtask policy`: 191 files ok. One small warning caught in non-test lib builds (`cargo test` / `cargo check --lib`): ``` warning: function `lower` is never used --> crates\victory-shader\src\emit\lower.rs:98:15 ``` `lower::lower` is now only called from `#[cfg(test)]` modules (`emit/mod.rs` calls `lower_with`), so gating `pub(crate) fn lower` with `#[cfg(test)]` (or removing it) will keep `cargo clippy --lib -- -D warnings` clean. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 11:00 UTC · original · edited 2026-11-26 11:10 UTC

I tested the exact a4484f5 head with #2225 at d239815 on 63bcca4, keeping one executable per source tree across the three packages. Every run loaded Agility SDK 1.620.2 and the designated app-local WARP DLL, as verified by inspecting the loaded modules.

WARP package Full suite on main Full suite with #2997 and #2225 Focused divergent-permute failures with both PRs
1.0.21 298 passed, 4 failed, 3 ignored 301 passed, 1 failed, 3 ignored 3/12
1.0.22 297 passed, 5 failed, 3 ignored 300 passed, 2 failed, 3 ignored 0/12
1.65535.22-preview 297 passed, 5 failed, 3 ignored 301 passed, 1 failed, 3 ignored 1/12

The original varying-source and Wave64 readbacks passed in all three combined full-suite runs. The remaining permutation failure is intermittent in permutes_mask_high_address_bits_and_divergent_branches. The 1.0.22 full run returned a nonzero value for lane 18 in the 19-active-lane case. Across the separate focused runs, lanes 14, 17, or 18 occasionally returned nonzero values where their selected source lanes were inactive and the expected value was zero. Each focused run used a fresh process. The existing edge-flagged mesh test failed on all three package versions in both trees.

Native control. I compiled five CS 6.6 variants with DXC and ran 512 groups of 32 lanes per variant, with 16 through 19 participating lanes. Across three fresh runs on each listed WARP version, both the plain arithmetic control and the ballot taken before divergence matched all 147,456 values each. A ballot taken inside the divergent branch, with arithmetic in place of the lane reads, produced 198–530 mismatches per 16,384 values. The banked-read variants also reproduced mismatches with DXC optimizations on and off. This narrows the remaining behavior to a divergent wave operation on these WARP runtimes. The banked-read workaround still fixes the original permutation cases in the table.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 11:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#issuecomment-7190141884) · edited 2026-11-26 11:10 UTC I tested the exact `a4484f5` head with #2225 at `d239815` on `63bcca4`, keeping one executable per source tree across the three packages. Every run loaded Agility SDK 1.620.2 and the designated app-local WARP DLL, as verified by inspecting the loaded modules. | WARP package | Full suite on main | Full suite with #2997 and #2225 | Focused divergent-permute failures with both PRs | | --- | --- | --- | --- | | 1.0.21 | 298 passed, 4 failed, 3 ignored | 301 passed, 1 failed, 3 ignored | 3/12 | | 1.0.22 | 297 passed, 5 failed, 3 ignored | 300 passed, 2 failed, 3 ignored | 0/12 | | 1.65535.22-preview | 297 passed, 5 failed, 3 ignored | 301 passed, 1 failed, 3 ignored | 1/12 | The original varying-source and Wave64 readbacks passed in all three combined full-suite runs. The remaining permutation failure is intermittent in `permutes_mask_high_address_bits_and_divergent_branches`. The 1.0.22 full run returned a nonzero value for lane 18 in the 19-active-lane case. Across the separate focused runs, lanes 14, 17, or 18 occasionally returned nonzero values where their selected source lanes were inactive and the expected value was zero. Each focused run used a fresh process. The existing edge-flagged mesh test failed on all three package versions in both trees. **Native control.** I compiled five CS 6.6 variants with DXC and ran 512 groups of 32 lanes per variant, with 16 through 19 participating lanes. Across three fresh runs on each listed WARP version, both the plain arithmetic control and the ballot taken before divergence matched all 147,456 values each. A ballot taken inside the divergent branch, with arithmetic in place of the lane reads, produced 198–530 mismatches per 16,384 values. The banked-read variants also reproduced mismatches with DXC optimizations on and off. This narrows the remaining behavior to a divergent wave operation on these WARP runtimes. The banked-read workaround still fixes the original permutation cases in the table.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 11:15 UTC · original · approved these changes

Reviewed the WARP compute lane-permutation lowering, shader cache keying, and adapter detection changes at a4484f58.

  • read_lane_on_warp splits ds_bpermute_b32 into 4-lane bank iterations using the active-lane ballot per bank, falling back to FirstbitLo (unaryBits.i32 op 32) within nonempty banks and waveReadLaneFirst(me) for empty banks so every WaveReadLaneAt reads either a uniform lane or strictly within a single live 4-lane group.
  • uses_software_adapter() keeps victory translate --cache aligned with runtime cache lookups while warp_permute in the shader cache key cleanly separates hardware and software entries in the shared cache directory.
  • a4484f58 cleanly resolves the non-test dead-code warning on the lower() wrapper (cargo clippy -p victory-shader --lib -- -D warnings passes).

Verified locally on Windows 11 with RTX 5090, WARP (VICTORY_D3D12_WARP=1 with --features diagnostics), D3D12 Debug Layer (VICTORY_D3D12_DEBUG=1), and Windows 11 SDK dxil.dll:

  • cargo xtask policy (191 files ok) and cargo clippy -p victory-shader -p victory-gpu -p victory --tests -- -D warnings (default and --all-features): clean.
  • victory-shader permute tests: 6/6 passed (covering both RTX 5090 and WARP, Wave32/Wave64 halves, and non-4-aligned divergent active counts 16 and 19).
  • victory-gpu shader_cache::tests: 4/4 passed on RTX 5090 and 4/4 on WARP + Debug Layer; draw::tests::compute_view_marks_rebind_after_depth_twin_conversion: passed on WARP + Debug Layer.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 11:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2997#pullrequestreview-6073183849) · **approved these changes** Reviewed the WARP compute lane-permutation lowering, shader cache keying, and adapter detection changes at `a4484f58`. - `read_lane_on_warp` splits `ds_bpermute_b32` into 4-lane bank iterations using the active-lane ballot per bank, falling back to `FirstbitLo` (`unaryBits.i32` op 32) within nonempty banks and `waveReadLaneFirst(me)` for empty banks so every `WaveReadLaneAt` reads either a uniform lane or strictly within a single live 4-lane group. - `uses_software_adapter()` keeps `victory translate --cache` aligned with runtime cache lookups while `warp_permute` in the shader cache key cleanly separates hardware and software entries in the shared cache directory. - `a4484f58` cleanly resolves the non-test dead-code warning on the `lower()` wrapper (`cargo clippy -p victory-shader --lib -- -D warnings` passes). Verified locally on Windows 11 with RTX 5090, WARP (`VICTORY_D3D12_WARP=1` with `--features diagnostics`), D3D12 Debug Layer (`VICTORY_D3D12_DEBUG=1`), and Windows 11 SDK `dxil.dll`: - `cargo xtask policy` (`191 files ok`) and `cargo clippy -p victory-shader -p victory-gpu -p victory --tests -- -D warnings` (default and `--all-features`): clean. - `victory-shader` `permute` tests: 6/6 passed (covering both RTX 5090 and WARP, Wave32/Wave64 halves, and non-4-aligned divergent active counts `16` and `19`). - `victory-gpu` `shader_cache::tests`: 4/4 passed on RTX 5090 and 4/4 on WARP + Debug Layer; `draw::tests::compute_view_marks_rebind_after_depth_twin_conversion`: passed on WARP + Debug Layer.
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/2997/head:github-bot/gh-2997'
git switch 'github-bot/gh-2997'

Merge

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