Shaders: share and serialize WARP host operations across threads #244

Manually merged
github merged 2 commits from gh-pr/244/head into gh-pr/244/base 2026-11-26 03:56:16 +00:00
Owner

@⁠AndyLatimer on GitHub · 2026-11-24 01:45 UTC · original
AndyLatimer:fix/shader-warp-parallel-crash → main · +174 −50 · 3 files · 2 commits · merged 2026-11-25 21:37 UTC

Fixes #181.

Cause

On Windows 11, concurrent d3d10warp.dll activity across threads crashes with 0xC0000005 (STATUS_ACCESS_VIOLATION). Sharing a single process-wide WARP ID3D12Device via OnceLock alone was not enough — VICTORY_WARP=1 cargo test -q -p victory-shader --lib still crashed on the first run — showing that concurrent WARP pipeline compilation / execution itself races inside d3d10warp.dll.

Change

  • crates/victory-shader/src/emit/host.rs:
    • Keep a single process-wide WARP ID3D12Device in Host::new whenever WARP is used (warp == true, VICTORY_WARP=1, or when DXGI's default adapter carries DXGI_ADAPTER_FLAG_SOFTWARE).
    • Serialize WARP operations (Host::new initialization, root_signature_bytes / root_signature_for, compute_pipeline_with, pipeline_with, mesh_pipeline_with, draw, and dispatch) behind a process-wide Mutex.
    • Per-operation locking (rather than holding a guard for Host's lifetime) keeps Host's public API intact and preserves multi-threaded IR/lowering/validation parallelism in apps/victory/src/translate.rs (--jobs N), while leaving hardware D3D12 devices completely unserialized.
    • Add a multi-threaded regression test (emit::host::tests::parallel_warp_pipelines_and_draws) that launches 8 threads behind a Barrier to create WARP hosts, compile graphics pipelines, and draw concurrently.
  • crates/victory-shader/src/emit/diff_tests.rs:
    • Replace the three direct host.device.CreateRootSignature(...) calls with host.root_signature_bytes(...) so differential tests also serialize under VICTORY_WARP=1.

Verification

Tested on Windows 11 (debug build, synthetic tests only — no game data or console SDK used):

Command Before (d2a4bae) After (7f95b87)
VICTORY_WARP=1 cargo test -q -p victory-shader --lib 10 / 10 crashed (0xC0000005) 0 / 25 failed
VICTORY_WARP=1 cargo test -q -p victory-shader --lib -- --test-threads=16 — 0 / 50 failed
cargo test -q -p victory-shader --lib (default: hardware + WARP) intermittent crashes (#181) 0 / 25 failed
cargo test -p victory-shader — 70 / 70 passed
cargo clippy -p victory-shader --all-targets -- -D warnings — 0 warnings
cargo clippy -p victory --all-targets — 0 warnings in victory / victory-shader
rustfmt --edition 2024 --check (touched files) — clean
cargo xtask policy — 151 files ok

(Sharing one WARP ID3D12Device without the mutex was also tested and crashed on run 1 with 0xC0000005.)

AI assistance

Assisted by Google Antigravity in reproducing the crash, isolating that a shared WARP device without serialization still faults, implementing the fix and regression test, and running the stress and verification checks above.

**@⁠AndyLatimer** on GitHub · 2026-11-24 01:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/244) `AndyLatimer:fix/shader-warp-parallel-crash` → `main` · +174 −50 · 3 files · 2 commits · merged 2026-11-25 21:37 UTC Fixes #181. ## Cause On Windows 11, concurrent `d3d10warp.dll` activity across threads crashes with `0xC0000005` (`STATUS_ACCESS_VIOLATION`). Sharing a single process-wide WARP `ID3D12Device` via `OnceLock` alone was **not** enough — `VICTORY_WARP=1 cargo test -q -p victory-shader --lib` still crashed on the first run — showing that concurrent WARP pipeline compilation / execution itself races inside `d3d10warp.dll`. ## Change - **`crates/victory-shader/src/emit/host.rs`**: - Keep a single process-wide WARP `ID3D12Device` in `Host::new` whenever WARP is used (`warp == true`, `VICTORY_WARP=1`, or when DXGI's default adapter carries `DXGI_ADAPTER_FLAG_SOFTWARE`). - Serialize WARP operations (`Host::new` initialization, `root_signature_bytes` / `root_signature_for`, `compute_pipeline_with`, `pipeline_with`, `mesh_pipeline_with`, `draw`, and `dispatch`) behind a process-wide `Mutex`. - Per-operation locking (rather than holding a guard for `Host`'s lifetime) keeps `Host`'s public API intact and preserves multi-threaded IR/lowering/validation parallelism in `apps/victory/src/translate.rs` (`--jobs N`), while leaving hardware D3D12 devices completely unserialized. - Add a multi-threaded regression test (`emit::host::tests::parallel_warp_pipelines_and_draws`) that launches 8 threads behind a `Barrier` to create WARP hosts, compile graphics pipelines, and draw concurrently. - **`crates/victory-shader/src/emit/diff_tests.rs`**: - Replace the three direct `host.device.CreateRootSignature(...)` calls with `host.root_signature_bytes(...)` so differential tests also serialize under `VICTORY_WARP=1`. ## Verification Tested on Windows 11 (debug build, synthetic tests only — no game data or console SDK used): | Command | Before (`d2a4bae`) | After (`7f95b87`) | |---|---|---| | `VICTORY_WARP=1 cargo test -q -p victory-shader --lib` | **10 / 10** crashed (`0xC0000005`) | **0 / 25** failed | | `VICTORY_WARP=1 cargo test -q -p victory-shader --lib -- --test-threads=16` | — | **0 / 50** failed | | `cargo test -q -p victory-shader --lib` (default: hardware + WARP) | intermittent crashes (#181) | **0 / 25** failed | | `cargo test -p victory-shader` | — | 70 / 70 passed | | `cargo clippy -p victory-shader --all-targets -- -D warnings` | — | 0 warnings | | `cargo clippy -p victory --all-targets` | — | 0 warnings in `victory` / `victory-shader` | | `rustfmt --edition 2024 --check` (touched files) | — | clean | | `cargo xtask policy` | — | `151 files ok` | *(Sharing one WARP `ID3D12Device` without the mutex was also tested and crashed on run 1 with `0xC0000005`.)* ## AI assistance Assisted by Google Antigravity in reproducing the crash, isolating that a shared WARP device without serialization still faults, implementing the fix and regression test, and running the stress and verification checks above.
Fixes #181.

Concurrent WARP (d3d10warp.dll) usage across threads crashes with
0xC0000005 on Windows 11, both when creating/tearing down separate
WARP devices and when compiling pipelines or executing work concurrently
on a single shared WARP device.

Keep one process-wide WARP ID3D12Device in Host::new (for explicit
warp = true, VICTORY_WARP=1, and systems whose default DXGI adapter
has DXGI_ADAPTER_FLAG_SOFTWARE) and serialize WARP root signature
creation, pipeline compilation, draws, and dispatches behind a
process-wide mutex. Hardware D3D12 devices remain unserialized.

Route diff_tests's direct CreateRootSignature calls through
Host::root_signature_bytes so they share the same serialization, and
add a multi-threaded WARP regression test (parallel_warp_pipelines_and_draws).
Conflict in `emit/host.rs`: `main` now picks a hardware adapter (or
WARP when asked) and refuses a software default adapter, so the branch's
`default_adapter_is_warp` fallback goes; the shared WARP device and its
lock stay, on `main`'s adapter choice. The GPU crate built the shader
`Host` as a literal for its fused multiply-add probe, which the private
`warp` field no longer allows: it now goes through `Host::from_device`,
which takes the lock when the device is on a software adapter. The probe
runs its dispatch under the lock too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:56:16 +00:00
github manually merged commit c3ac59ec7b into gh-pr/244/base 2026-11-26 03:56:16 +00:00
Author
Owner

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

Verified the fix for #181 with the same runs that reproduced it. 7f95b87 merged onto main d2a4bae (clean merge), AMD Radeon RX 9060 XT, Windows 11 26200 (d3d10warp.dll 10.0.26100.9818), Rust 1.98.1, debug:

cargo test -q -p victory-shader --lib main this PR
WARP only (VICTORY_WARP=1) 10 / 10 crashed 0 / 20
default (hardware + WARP) 3 / 25 crashed 0 / 25

cargo test --workspace: 265 passed, 0 failed, 4 ignored.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
**@⁠ghost** on GitHub · 2026-11-24 01:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7119485913) Verified the fix for #181 with the same runs that reproduced it. `7f95b87` merged onto `main` `d2a4bae` (clean merge), AMD Radeon RX 9060 XT, Windows 11 26200 (`d3d10warp.dll` 10.0.26100.9818), Rust 1.98.1, debug: | `cargo test -q -p victory-shader --lib` | `main` | this PR | |---|---|---| | WARP only (`VICTORY_WARP=1`) | 10 / 10 crashed | **0 / 20** | | default (hardware + WARP) | 3 / 25 crashed | **0 / 25** | `cargo test --workspace`: 265 passed, 0 failed, 4 ignored. **AI use** - Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
Author
Owner

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

Tested 7f95b87 on an NVIDIA RTX 3060 Ti (driver 32.0.16.1088), Windows 11 build 26300, d3d10warp.dll 10.0.26100.9818, debug, victory-shader lib tests:

main (d2a4bae) #244 (7f95b87)
VICTORY_WARP=1, default threads 10 / 10 runs crash (0xC0000005) 20 / 20 pass (~0.3 s)
default (hardware + WARP) passes 10 / 10 pass (~2.7-3.3 s)
parallel_warp_pipelines_and_draws alone — 10 / 10 pass

No hangs (each run under a 180 s timeout). Not covered here: a default adapter that is itself WARP, and victory translate --pipelines.

AI use: Claude Code ran the commands and drafted this from the logs; I checked it before posting.

**@⁠rhuantac** on GitHub · 2026-11-24 01:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7119618360) Tested 7f95b87 on an NVIDIA RTX 3060 Ti (driver 32.0.16.1088), Windows 11 build 26300, `d3d10warp.dll` 10.0.26100.9818, debug, `victory-shader` lib tests: | | main (d2a4bae) | #244 (7f95b87) | |---|---|---| | `VICTORY_WARP=1`, default threads | 10 / 10 runs crash (0xC0000005) | 20 / 20 pass (~0.3 s) | | default (hardware + WARP) | passes | 10 / 10 pass (~2.7-3.3 s) | | `parallel_warp_pipelines_and_draws` alone | — | 10 / 10 pass | No hangs (each run under a 180 s timeout). Not covered here: a default adapter that is itself WARP, and `victory translate --pipelines`. AI use: Claude Code ran the commands and drafted this from the logs; I checked it before posting.
Author
Owner

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

Test report on NVIDIA (#181 lists NVIDIA as not tested).

Tested

  • NVIDIA GeForce RTX 5080, driver 621.14; Ryzen 7 9800X3D; Windows 11 Pro 26300; Rust 1.98.1; debug build
  • Command, run in a loop, default test threads: cargo test -q -p victory-shader --lib
Commit Runs 0xC0000005 crashes Other failures
main d2a4bae 100 1 0
this PR 7f95b87 100 0 0
  • So #181 does reproduce on NVIDIA, but rarely here (1 in 100; the one crash was exit code 0xC0000005 with no test panic, as in the issue).
  • With this PR all 100 runs passed: 70 passed, 0 failed, 0 ignored each run (main: 69 passed).

Not tested

  • At a 1 % base rate, 100 clean runs do not prove the fix on this card; they show no crash and no regression. The AMD numbers in #181 are the stronger check.
  • The GPU diff tests skipped here (no VICTORY_CONSOLE_DXC).
  • Release build, the rest of the workspace on this PR, the title itself (no game files used).

AI use

  • Claude Code (Claude Fable 5.2) ran the loops and wrote this report from their output.
**@⁠MisaXz** on GitHub · 2026-11-24 02:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7119716810) Test report on NVIDIA (#181 lists NVIDIA as not tested). **Tested** - NVIDIA GeForce RTX 5080, driver 621.14; Ryzen 7 9800X3D; Windows 11 Pro 26300; Rust 1.98.1; debug build - Command, run in a loop, default test threads: `cargo test -q -p victory-shader --lib` | Commit | Runs | `0xC0000005` crashes | Other failures | |---|---|---|---| | `main` `d2a4bae` | 100 | 1 | 0 | | this PR `7f95b87` | 100 | 0 | 0 | - So #181 does reproduce on NVIDIA, but rarely here (1 in 100; the one crash was exit code `0xC0000005` with no test panic, as in the issue). - With this PR all 100 runs passed: 70 passed, 0 failed, 0 ignored each run (`main`: 69 passed). **Not tested** - At a 1 % base rate, 100 clean runs do not prove the fix on this card; they show no crash and no regression. The AMD numbers in #181 are the stronger check. - The GPU diff tests skipped here (no `VICTORY_CONSOLE_DXC`). - Release build, the rest of the workspace on this PR, the title itself (no game files used). **AI use** - Claude Code (Claude Fable 5.2) ran the loops and wrote this report from their output.
Author
Owner

@⁠Aefekaa on GitHub · 2026-11-24 02:32 UTC · original

One more NVIDIA data point: RTX 4060 (driver 617.42), Windows 11 26200, Rust 1.98.1, debug. Same result as above. With VICTORY_WARP=1, main crashed 10 of 10 runs and this PR 0 of 10. With default threads, main crashed 1 of 25 and this PR 0 of 55.

One thing not mentioned above: twice the test binary hung instead of finishing, once on main and once with this PR (1 of 55 runs). It kept a core busy until my 120 s limit. I couldn't catch which test it was in 30 more runs, so it's probably a separate, rarer race and not caused by this PR. I'm mentioning it in case someone else hits a run that never ends.

AI-assisted: yes

**@⁠Aefekaa** on GitHub · 2026-11-24 02:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7120250499) One more NVIDIA data point: RTX 4060 (driver 617.42), Windows 11 26200, Rust 1.98.1, debug. Same result as above. With `VICTORY_WARP=1`, main crashed 10 of 10 runs and this PR 0 of 10. With default threads, main crashed 1 of 25 and this PR 0 of 55. One thing not mentioned above: twice the test binary hung instead of finishing, once on main and once with this PR (1 of 55 runs). It kept a core busy until my 120 s limit. I couldn't catch which test it was in 30 more runs, so it's probably a separate, rarer race and not caused by this PR. I'm mentioning it in case someone else hits a run that never ends. AI-assisted: yes
Author
Owner

@⁠GamingRipperDoc on GitHub · 2026-11-24 02:53 UTC · original

Windows 10 data point (the reports so far are Windows 11). Short version: #181 cannot happen on Windows 10, because WARP there has no SM 6.6 device; #244 is harmless there, but it conflicts with #175.

Setup: Windows 10 22H2 19045.7846, d3d10warp.dll 10.0.19041.7811, AMD RX 9070 XT (driver 32.0.32015.7029), Rust 1.98.1, debug. On Windows 10 the victory-shader tests only get an SM 6.6 device at all with the Agility SDK runtime in the test executable, so I tested on top of #175 + #362 (which gives the test executables that runtime).

victory-shader lib tests #175 + #362 + #244 (7f95b87)
default (hardware + WARP), 25 runs 25 / 25 pass, 0 crashes (69 tests) 25 / 25 pass, 0 crashes (70 tests)
VICTORY_WARP=1 7 valu_tests fail: neither hardware nor WARP SM 6.6 device available same
parallel_warp_pipelines_and_draws alone – passes, printing no SM 6.6 warp device; skipped
  • WARP on Windows 10 offers no SM 6.6 device, even with the 1.620 runtime. The Agility SDK does not ship WARP; d3d10warp.dll comes from the OS. So every Host::new(true) fails, the tests that try WARP skip it, and no two threads ever use WARP at once. #181 does not reproduce there, with or without #244.
  • So on Windows 10 the new parallel_warp_pipelines_and_draws passes without running anything. Not a problem for this PR, just worth knowing: on Windows 10 it guards nothing.
  • Merge conflict with #175 in crates/victory-shader/src/emit/host.rs: #175 extends the SM 6.5 error message in Host::new; this PR moves that code into create_device. Resolving it is mechanical (keep this PR's structure and put #175's message into create_device); with that, the table's last column builds and passes, rustfmt --check is clean, and cargo xtask policy passes (156 files). Whichever of the two merges second needs that rebase.

No game data used.

AI-assisted (Claude Code); I ran everything above on my machine.

**@⁠GamingRipperDoc** on GitHub · 2026-11-24 02:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7120567533) Windows 10 data point (the reports so far are Windows 11). Short version: #181 cannot happen on Windows 10, because WARP there has no SM 6.6 device; #244 is harmless there, but it conflicts with #175. **Setup:** Windows 10 22H2 19045.7846, `d3d10warp.dll` 10.0.19041.7811, AMD RX 9070 XT (driver 32.0.32015.7029), Rust 1.98.1, debug. On Windows 10 the `victory-shader` tests only get an SM 6.6 device at all with the Agility SDK runtime in the test executable, so I tested on top of #175 + #362 (which gives the test executables that runtime). | `victory-shader` lib tests | #175 + #362 | + #244 (`7f95b87`) | |---|---|---| | default (hardware + WARP), 25 runs | 25 / 25 pass, 0 crashes (69 tests) | 25 / 25 pass, 0 crashes (70 tests) | | `VICTORY_WARP=1` | 7 `valu_tests` fail: `neither hardware nor WARP SM 6.6 device available` | same | | `parallel_warp_pipelines_and_draws` alone | – | passes, printing `no SM 6.6 warp device; skipped` | - **WARP on Windows 10 offers no SM 6.6 device, even with the 1.620 runtime.** The Agility SDK does not ship WARP; `d3d10warp.dll` comes from the OS. So every `Host::new(true)` fails, the tests that try WARP skip it, and no two threads ever use WARP at once. #181 does not reproduce there, with or without #244. - So on Windows 10 the new `parallel_warp_pipelines_and_draws` passes without running anything. Not a problem for this PR, just worth knowing: on Windows 10 it guards nothing. - **Merge conflict with #175** in `crates/victory-shader/src/emit/host.rs`: #175 extends the SM 6.5 error message in `Host::new`; this PR moves that code into `create_device`. Resolving it is mechanical (keep this PR's structure and put #175's message into `create_device`); with that, the table's last column builds and passes, `rustfmt --check` is clean, and `cargo xtask policy` passes (156 files). Whichever of the two merges second needs that rebase. No game data used. AI-assisted (Claude Code); I ran everything above on my machine.
Author
Owner

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

AI-assisted.

Tested 7f95b87ea on Windows 11 Home 26H2 (build 26200) with Intel(R) Iris(R) Xe Graphics (8086:46a6, driver 32.0.101.7088, DXGI Adapter 0) + WARP (Microsoft Basic Render Driver), rustc 1.100.0 (x86_64-pc-windows-gnullvm):

  • cargo xtask policy: 151 files ok
  • cargo test -p victory-shader (default parallel test threads, no --test-threads=1): 69/70 passed in 0.78s, zero 0xC0000005 WARP crashes (emit::host::tests::parallel_warp_pipelines_and_draws passed).
    • The 1 failure (emit::valu_tests::v_med3_f32_matches_rdna2_with_nan: hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1) is the pre-existing Intel Iris Xe fcmp uno driver bug on main (unrelated to this PR; fixed in #110).
  • Stress check: cargo test -p victory-shader --lib parallel_warp_pipelines_and_draws passed 5/5 consecutive runs with zero crashes.

Verified clean on Windows 11 26200 + Intel Xe / WARP.

**@⁠lordon1a** on GitHub · 2026-11-24 03:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7120796361) AI-assisted. Tested `7f95b87ea` on **Windows 11 Home 26H2 (build 26200)** with **Intel(R) Iris(R) Xe Graphics** (`8086:46a6`, driver `32.0.101.7088`, DXGI Adapter 0) + **WARP** (Microsoft Basic Render Driver), `rustc 1.100.0` (`x86_64-pc-windows-gnullvm`): - `cargo xtask policy`: `151 files ok` - `cargo test -p victory-shader` (default parallel test threads, no `--test-threads=1`): **69/70 passed in 0.78s**, zero `0xC0000005` WARP crashes (`emit::host::tests::parallel_warp_pipelines_and_draws` passed). - The 1 failure (`emit::valu_tests::v_med3_f32_matches_rdna2_with_nan`: `hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1`) is the pre-existing Intel Iris Xe `fcmp uno` driver bug on `main` (unrelated to this PR; fixed in #110). - Stress check: `cargo test -p victory-shader --lib parallel_warp_pipelines_and_draws` passed **5/5 consecutive runs** with zero crashes. Verified clean on Windows 11 26200 + Intel Xe / WARP.
Author
Owner

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

A data point on the hang mentioned above as probably separate: it reproduces here, and it is separate.

Tested

  • NVIDIA RTX 5070 with an AMD Radeon iGPU; Windows 11; Rust 1.98.1; debug.
  • The workspace build of the victory-shader test binary in a loop, filter valu_tests (the seven tests that run on the hardware adapter and on WARP), 45 s limit per run; a good run takes about 3 s:
runs hung crashed
main d2a4bae 30 3 0
this PR 7f95b87 60 3 1 (access violation, exit 139)

In a hung run none of the seven tests finishes and one core stays busy. With --skip valu_tests nothing hung in 14 runs.

So on this machine the hang survives serialising WARP alone. Taking a lock around valu_tests::run_cases, so those tests do not overlap on the hardware adapter either, gave 0 hung of 60 on main; that is #433 (five lines, tests only). It composes with this PR, which covers every WARP user.

The one crash in 60 runs on this PR I cannot explain and did not see again; I did not run VICTORY_WARP=1, where this PR's effect was measured by others.

No game data used. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 03:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7120977913) A data point on the hang [mentioned above](https://git.gtahub.st/github/Marvisak--VIctory/pulls/244) as probably separate: it reproduces here, and it is separate. **Tested** - NVIDIA RTX 5070 with an AMD Radeon iGPU; Windows 11; Rust 1.98.1; debug. - The workspace build of the `victory-shader` test binary in a loop, filter `valu_tests` (the seven tests that run on the hardware adapter and on WARP), 45 s limit per run; a good run takes about 3 s: | | runs | hung | crashed | |---|---|---|---| | `main` `d2a4bae` | 30 | 3 | 0 | | this PR `7f95b87` | 60 | 3 | 1 (access violation, exit 139) | In a hung run none of the seven tests finishes and one core stays busy. With `--skip valu_tests` nothing hung in 14 runs. So on this machine the hang survives serialising WARP alone. Taking a lock around `valu_tests::run_cases`, so those tests do not overlap on the hardware adapter either, gave 0 hung of 60 on `main`; that is #433 (five lines, tests only). It composes with this PR, which covers every WARP user. The one crash in 60 runs on this PR I cannot explain and did not see again; I did not run `VICTORY_WARP=1`, where this PR's effect was measured by others. No game data used. AI-assisted.
Author
Owner

@⁠CaravelaLabs on GitHub · 2026-11-25 00:10 UTC · original

@⁠AndyLatimer this is fine on its own. It does not compile once it is on current main.

Main 70564ae probes fused multiply-adds by building Host { device } from the gpu crate (github.com/Marvisak/VIctory@70564ae08c/crates/victory-gpu/src/host.rs (L227), from 77053a0). This head adds a private warp field (github.com/Marvisak/VIctory@7f95b87ea9/crates/victory-shader/src/emit/host.rs (L19)), so that literal is no longer legal outside the shader crate. The two edits combine without a text conflict. The Windows workspace check of that merge then stops on the literal. warp has to be set inside the shader crate, on the device the gpu crate already has. Host::new creates a different device, so it is not a drop-in.

@⁠mercuryVM's approval and the reports above are on 7f95b87 against d2a4bae, which does not have this probe. Separate from the text conflict with #175 that @⁠GamingRipperDoc described. #175 is now closed without merging, so that conflict is gone. This compile break is not.

Compile only (cargo xwin check --workspace --all-targets --all-features --locked, Windows target). No tests, no clippy. No title run.

AI-assisted; Windows workspace check of the merge, run on this machine.

**@⁠CaravelaLabs** on GitHub · 2026-11-25 00:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7148224141) @⁠AndyLatimer this is fine on its own. It does not compile once it is on current main. Main `70564ae` probes fused multiply-adds by building `Host { device }` from the gpu crate (https://github.com/Marvisak/VIctory/blob/70564ae08c82d43df5fad97b08d34628b07b1d9d/crates/victory-gpu/src/host.rs#L227, from `77053a0`). This head adds a private `warp` field (https://github.com/Marvisak/VIctory/blob/7f95b87ea94514a02d180d562922f6fd25704454/crates/victory-shader/src/emit/host.rs#L19), so that literal is no longer legal outside the shader crate. The two edits combine without a text conflict. The Windows workspace check of that merge then stops on the literal. `warp` has to be set inside the shader crate, on the device the gpu crate already has. `Host::new` creates a different device, so it is not a drop-in. @⁠mercuryVM's approval and the reports above are on `7f95b87` against `d2a4bae`, which does not have this probe. Separate from the text conflict with #175 that @⁠GamingRipperDoc described. #175 is now closed without merging, so that conflict is gone. This compile break is not. Compile only (`cargo xwin check --workspace --all-targets --all-features --locked`, Windows target). No tests, no clippy. No title run. AI-assisted; Windows workspace check of the merge, run on this machine.
Author
Owner

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

Automated triage for the maintainers.

Merge candidate. Now merges cleanly into main, and the compile break @⁠CaravelaLabs reported is fixed. In crates/victory-shader/src/emit/host.rs, Host::new(true) now shares one process-wide WARP device (OnceLock), and every device operation on WARP goes through WARP_LOCK (lock_warp): root signatures, the three pipeline builders, draw, dispatch and the fuses_fmad dispatch. The new Host::from_device sets warp from the adapter's LUID. victory-gpu's create now uses it, which removes the struct literal that no longer compiled. fuses_fmad takes the lock after compute_pipeline and does not call dispatch, so it does not lock twice. The diff tests use root_signature_bytes.

Hardware devices are not serialised. The new parallel_warp_pipelines_and_draws test covers #181. CI passes on c3ac59e. Earlier test reports were on 7f95b87.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7148523201) · edited 2026-11-25 10:21 UTC <!-- victory-triage v1 head=c3ac59ec7b0d2bd1dd2d027d5eb8f7bae1558885 verdict=merge-candidate at=2026-11-25T10:21:24Z --> Automated triage for the maintainers. **Merge candidate.** Now merges cleanly into `main`, and the compile break @⁠CaravelaLabs reported is fixed. In `crates/victory-shader/src/emit/host.rs`, `Host::new(true)` now shares one process-wide WARP device (`OnceLock`), and every device operation on WARP goes through `WARP_LOCK` (`lock_warp`): root signatures, the three pipeline builders, `draw`, `dispatch` and the `fuses_fmad` dispatch. The new `Host::from_device` sets `warp` from the adapter's LUID. `victory-gpu`'s `create` now uses it, which removes the struct literal that no longer compiled. `fuses_fmad` takes the lock after `compute_pipeline` and does not call `dispatch`, so it does not lock twice. The diff tests use `root_signature_bytes`. Hardware devices are not serialised. The new `parallel_warp_pipelines_and_draws` test covers #181. CI passes on `c3ac59e`. Earlier test reports were on `7f95b87`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠AndyLatimer on GitHub · 2026-11-25 09:38 UTC · original

Merged main (940d32f) at c3ac59e. This fixes the compile break @⁠CaravelaLabs found.

  • main now picks a hardware adapter (or WARP when asked) and refuses a software default adapter. So I dropped this branch's default_adapter_is_warp fallback, and hardware-only checks stay off WARP as main intends. The shared WARP device and WARP_LOCK stay, using main's adapter choice.
  • The GPU crate's multiply-add probe now builds the shader host with Host::from_device(device), as you suggested: warp is set inside the shader crate. It takes the WARP lock when the device is on a software adapter (found by its LUID), and serialises if that can't be told. fuses_fmad used to take the lock only to build the pipeline; it now holds it for the dispatch too.

Checks (Windows 11, NVIDIA, Rust 1.98.1):

  • clippy -D warnings, default and --all-features: clean.
  • cargo test --workspace --locked --no-fail-fast: 697 passed, 5 failed. The 5 are the ones #1744 lists, which fail on main too.
  • VICTORY_WARP=1 cargo test -p victory-shader --lib, in parallel (the #181 repro): no access violation; 246 passed, 2 failed. The 2 are gathers_at_a_level_match_the_hardware and permutes_read_the_lane_named_and_zero_from_lanes_left_out, hardware-only checks that VICTORY_WARP=1 forces onto WARP. They fail the same way on main with VICTORY_WARP=1.

The earlier approval and test reports were on 7f95b87.

**@⁠AndyLatimer** on GitHub · 2026-11-25 09:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/244#issuecomment-7158597628) Merged `main` (`940d32f`) at `c3ac59e`. This fixes the compile break @⁠CaravelaLabs found. - `main` now picks a hardware adapter (or WARP when asked) and refuses a software default adapter. So I dropped this branch's `default_adapter_is_warp` fallback, and hardware-only checks stay off WARP as `main` intends. The shared WARP device and `WARP_LOCK` stay, using `main`'s adapter choice. - The GPU crate's multiply-add probe now builds the shader host with `Host::from_device(device)`, as you suggested: `warp` is set inside the shader crate. It takes the WARP lock when the device is on a software adapter (found by its LUID), and serialises if that can't be told. `fuses_fmad` used to take the lock only to build the pipeline; it now holds it for the dispatch too. **Checks** (Windows 11, NVIDIA, Rust 1.98.1): - clippy `-D warnings`, default and `--all-features`: clean. - `cargo test --workspace --locked --no-fail-fast`: 697 passed, 5 failed. The 5 are the ones #1744 lists, which fail on `main` too. - `VICTORY_WARP=1 cargo test -p victory-shader --lib`, in parallel (the #181 repro): no access violation; 246 passed, 2 failed. The 2 are `gathers_at_a_level_match_the_hardware` and `permutes_read_the_lane_named_and_zero_from_lanes_left_out`, hardware-only checks that `VICTORY_WARP=1` forces onto WARP. They fail the same way on `main` with `VICTORY_WARP=1`. The earlier approval and test reports were on `7f95b87`.
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!244
No description provided.