Shader tests: share one D3D12 queue per adapter #3093

Open
github-bot wants to merge 5 commits from github-bot/gh-3093 into main AGit
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 07:30 UTC · original
neonbyte1:pr/shader-test-queue → main · +300 −83 · 6 files · 5 commits · open

Split out of #2973, as asked in its review: this changes how every victory-shader GPU test runs, Windows included.

The shader tests made a D3D12 device and a command queue for every test. They now share one device and one queue per adapter for the whole test process, and each test waits for its own work to finish, as before.

Why: under Wine/vkd3d-proton, victory-shader's test process was killed with SIGKILL at exit: hundreds of queues were still being torn down when the process ended. With one queue per adapter it exits normally.

Tested (Linux, GE-Proton11-14 Wine, RTX 5090): victory-shader tests under cargo xtask wine-test (#1218), 298 passed, 4 failed, no SIGKILL. All four failures happen on main without this change too:

  • rounding_matches_the_hardware is fixed by #2968.
  • stub_pipeline_is_created is tracked in #1266.
  • hosts_that_do_not_fuse_are_named and a_heap_buffer_read_where_no_buffer_view_is_reads_zeros are fixed by #2973.

Not tested on Windows: I have no Windows machine. A run of cargo test -p victory-shader --lib on a Windows GPU, and once with WARP, would close that gap. A test that left the queue in a bad state would now affect the tests after it; on this run none did.

AI-assisted (Claude); measured on my machine, no game data shared.

**@⁠neonbyte1** on GitHub · 2026-11-26 07:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093) `neonbyte1:pr/shader-test-queue` → `main` · +300 −83 · 6 files · 5 commits · open Split out of #2973, as asked in its review: this changes how every `victory-shader` GPU test runs, Windows included. The shader tests made a D3D12 device and a command queue for every test. They now share one device and one queue per adapter for the whole test process, and each test waits for its own work to finish, as before. **Why:** under Wine/vkd3d-proton, `victory-shader`'s test process was killed with SIGKILL at exit: hundreds of queues were still being torn down when the process ended. With one queue per adapter it exits normally. **Tested** (Linux, GE-Proton11-14 Wine, RTX 5090): `victory-shader` tests under `cargo xtask wine-test` (#1218), 298 passed, 4 failed, no SIGKILL. All four failures happen on `main` without this change too: - `rounding_matches_the_hardware` is fixed by #2968. - `stub_pipeline_is_created` is tracked in #1266. - `hosts_that_do_not_fuse_are_named` and `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` are fixed by #2973. **Not tested on Windows:** I have no Windows machine. A run of `cargo test -p victory-shader --lib` on a Windows GPU, and once with WARP, would close that gap. A test that left the queue in a bad state would now affect the tests after it; on this run none did. _AI-assisted (Claude); measured on my machine, no game data shared._
The shader host made a command queue for every draw, dispatch and FMad
probe, and each vkd3d-proton queue starts its own queue and fence
threads: the five valu tests alone left about 11,600 of each. Under
Wine, the process was still tearing them down at exit when wineserver
killed it 0.5 s later, so the suite ended in SIGKILL after its last
test. A device and queue per adapter are now shared, as WARP's device
already was; each call keeps its own fence, so parallel tests wait only
for their own work.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 07:37:11 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 07:49 UTC · original · approved these changes

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

  • cargo test -p victory-shader emit::host -- --test-threads=1: 1 passed, 0 failed (parallel_warp_pipelines_and_draws).
  • cargo test -p victory-shader a_branch_to_fallthrough_keeps_both_values_at_a_join -- --test-threads=1 (RTX 5090 & WARP): 1 passed, 0 failed on both.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

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

**@⁠Dukestar69** on GitHub · 2026-11-26 07:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#pullrequestreview-6070261464) · **approved these changes** Tested locally merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP): - `cargo test -p victory-shader emit::host -- --test-threads=1`: 1 passed, 0 failed (`parallel_warp_pipelines_and_draws`). - `cargo test -p victory-shader a_branch_to_fallthrough_keeps_both_values_at_a_join -- --test-threads=1` (RTX 5090 & WARP): 1 passed, 0 failed on both. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 07:53 UTC · original

Independent WARP verification of this PR at dc56cd73 against its pre-series base 63bcca43 (the claim is #1633). No source changes and no PR from me.

Setup: Windows 11, x86_64-pc-windows-msvc, Rust 1.98.1, --locked. Separate binaries per tree, run with VICTORY_WARP=1. I confirmed the adapter with a throwaway probe test first: Microsoft Basic Render Driver, software flag set, 0 dedicated video memory. The physical GPU was not used, so the PR's hardware-adapter queue (HARDWARE_DEVICE) was never exercised. The SDK dxil.dll was present. Synthetic inputs only, no game data.

Queue creation: CreateCommandQueue appears 3 times in victory-shader on base and once on head, in create_queue. The three submission sites now call Host::queue().

Repeated parallel runs. The full victory-shader lib suite, default test threads, 10 runs each, alternating base and head:

exit failures suite time
base 101 in 10/10 the same 4 in 10/10 13.0 to 15.6 s
head 101 in 10/10 the same 4 in 10/10 10.0 to 13.3 s (9 of 10 within 10.0 to 11.9 s)

The four failing tests are the same on both and are hardware-lane checks that WARP does not satisfy. Skipping those four, 6 further runs each exited 0 on both (298 passed, 0 failed, 3 ignored). The head was also exit 0 at --test-threads=1 (10.0 s) and --test-threads=16 (11.9 s). No hang, crash or changed result between base and head. The head is about 3 to 4 s faster, which fits one queue instead of one per call. That is only a WARP timing from this machine.

Limits: this does not test the PR's stated reason (Wine/vkd3d-proton SIGKILL at exit), and it does not cover a hardware adapter or the "a test leaves the queue in a bad state" risk the description mentions. On WARP, Host work is already serialised by WARP_LOCK, so a poisoned queue would be less visible here than on a GPU.

AI use: Claude Code (Claude Sonnet 5.5) ran the verification, coordinated by Codex (gpt-6.2-sol).

**@⁠oni-swr** on GitHub · 2026-11-26 07:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7185955195) Independent WARP verification of this PR at `dc56cd73` against its pre-series base `63bcca43` (the claim is https://git.gtahub.st/github/Marvisak--VIctory/issues/1633). No source changes and no PR from me. **Setup:** Windows 11, `x86_64-pc-windows-msvc`, Rust 1.98.1, `--locked`. Separate binaries per tree, run with `VICTORY_WARP=1`. I confirmed the adapter with a throwaway probe test first: `Microsoft Basic Render Driver`, software flag set, 0 dedicated video memory. The physical GPU was not used, so the PR's hardware-adapter queue (`HARDWARE_DEVICE`) was never exercised. The SDK `dxil.dll` was present. Synthetic inputs only, no game data. **Queue creation:** `CreateCommandQueue` appears 3 times in `victory-shader` on base and once on head, in `create_queue`. The three submission sites now call `Host::queue()`. **Repeated parallel runs.** The full `victory-shader` lib suite, default test threads, 10 runs each, alternating base and head: | | exit | failures | suite time | |---|---|---|---| | base | 101 in 10/10 | the same 4 in 10/10 | 13.0 to 15.6 s | | head | 101 in 10/10 | the same 4 in 10/10 | 10.0 to 13.3 s (9 of 10 within 10.0 to 11.9 s) | The four failing tests are the same on both and are hardware-lane checks that WARP does not satisfy. Skipping those four, 6 further runs each exited 0 on both (298 passed, 0 failed, 3 ignored). The head was also exit 0 at `--test-threads=1` (10.0 s) and `--test-threads=16` (11.9 s). No hang, crash or changed result between base and head. The head is about 3 to 4 s faster, which fits one queue instead of one per call. That is only a WARP timing from this machine. **Limits:** this does not test the PR's stated reason (Wine/vkd3d-proton SIGKILL at exit), and it does not cover a hardware adapter or the "a test leaves the queue in a bad state" risk the description mentions. On WARP, `Host` work is already serialised by `WARP_LOCK`, so a poisoned queue would be less visible here than on a GPU. AI use: Claude Code (Claude Sonnet 5.5) ran the verification, coordinated by Codex (gpt-6.2-sol).
Author
Owner

@⁠YaBulochka on GitHub · 2026-11-26 08:10 UTC · original

Offline validation on the retail corpus, with the current main as the baseline:

  • baseline: main 63bcca4 — 24 850 programs validated
  • this branch (pull/3093/head) — 24 850 programs validated

So no regression and no change in the count on this corpus. Environment: Wine 11.22 on CachyOS (kernel 7.3.5), retail 1.0.2.1 shaders.rpf (26,503 containers), built with --features diagnostics, victory translate <shaders.rpf> --validate --list, unchanged prefix and settings for both runs.

If the change is meant to move that number, it does not on this dump; if it is about correctness of the emitted DXIL for an instruction shape the corpus does not hit, then parity is the expected result and this says only that nothing else moved.

Numbers only, no game files or dumps.

**@⁠YaBulochka** on GitHub · 2026-11-26 08:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7186272257) Offline validation on the retail corpus, with the current main as the baseline: - baseline: `main` `63bcca4` — **24 850** programs validated - this branch (`pull/3093/head`) — **24 850** programs validated So no regression and no change in the count on this corpus. Environment: Wine 11.22 on CachyOS (kernel 7.3.5), retail 1.0.2.1 `shaders.rpf` (26,503 containers), built with `--features diagnostics`, `victory translate <shaders.rpf> --validate --list`, unchanged prefix and settings for both runs. If the change is meant to move that number, it does not on this dump; if it is about correctness of the emitted DXIL for an instruction shape the corpus does not hit, then parity is the expected result and this says only that nothing else moved. Numbers only, no game files or dumps.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 08:19 UTC · original

Automated triage for the maintainers.

Merge candidate. crates/victory-shader/src/emit/host.rs: Host::new now hands out one device and one direct queue per adapter kind (HARDWARE_DEVICE / WARP_DEVICE), and the three submission sites use Host::queue() in place of a new queue per call. Each submission still makes its own fence and waits on it, and the WARP path still creates its device under WARP_LOCK. A Host::from_device host (used by victory-gpu's fuses_fmad probe) makes its queue once, lazily. Host::new(false) is also used by victory translate (apps/victory/src/translate.rs), which only makes pipelines there, so the shared queue does not affect it.

A Windows WARP run comparing this branch with main has been posted here. The hardware-adapter path is still not run on Windows; a run of cargo test -p victory-shader --lib on a Windows GPU would close that gap.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 08:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7186459637) <!-- victory-triage v1 head=dc56cd73aa68d56032ef1b5cc68f7d56ae2b96ca verdict=merge-candidate at=2026-11-26T08:17:31Z --> Automated triage for the maintainers. **Merge candidate.** `crates/victory-shader/src/emit/host.rs`: `Host::new` now hands out one device and one direct queue per adapter kind (`HARDWARE_DEVICE` / `WARP_DEVICE`), and the three submission sites use `Host::queue()` in place of a new queue per call. Each submission still makes its own fence and waits on it, and the WARP path still creates its device under `WARP_LOCK`. A `Host::from_device` host (used by `victory-gpu`'s `fuses_fmad` probe) makes its queue once, lazily. `Host::new(false)` is also used by `victory translate` (`apps/victory/src/translate.rs`), which only makes pipelines there, so the shared queue does not affect it. A Windows WARP run comparing this branch with `main` has been posted here. The hardware-adapter path is still not run on Windows; a run of `cargo test -p victory-shader --lib` on a Windows GPU would close that gap. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 08:29 UTC · original · requested changes

The wall-clock improvement on real hardware is huge! Tested locally on Windows 11 (RTX 5090, running the victory-shader lib suite excluding the pre-existing heap_direct_texture_reads_mark_their_heap_index crash):

  • Base 63bcca43: 523.12s (298 passed, 3 pre-existing failures)
  • This PR dc56cd73: 33.56s (298 passed, same 3 pre-existing failures) — a 15.6x speedup, and concurrent submission is sound on the happy path because each call owns its own allocator, command list, resources, and fence.

However, caching the hardware (device, queue) permanently in a LazyLock introduces a few correctness issues in crates/victory-shader/src/emit/host.rs:

  1. Host::new(false) permanently returns a removed device after DEVICE_REMOVED (emit/host.rs:183-188, 206-224): Once HARDWARE_DEVICE initializes to Ok(...), any subsequent Host::new(false) clones and returns the same device/queue even if the GPU has since entered DEVICE_REMOVED. Previously, create_device(false) surfaced device removal when callers like emit/semantics_tests.rs:577-585 requested a fresh Host after a failure. Please check GetDeviceRemovedReason() on construction (and decide/document whether an initial creation failure should stay cached forever).
  2. pub device can diverge from the private cached queue (emit/host.rs:17-20, 191-195, 215-234): Host.device is pub, so replacing it leaves the cached queue bound to the old device while fuses_fmad / draw / dispatch create allocators, lists, and fences on the new device. Keeping device and queue paired behind read-only access (or rebuilding the queue when the device changes) prevents mismatched-device submissions.
  3. Fence completion loops treat UINT64_MAX (DEVICE_REMOVED) as success in fuses_fmad and dispatch (emit/host.rs:751-763, 2011-2023): draw checks GetDeviceRemovedReason() after exiting the wait loop (:1285-1288), but fuses_fmad and dispatch only check it inside while fence.GetCompletedValue() < 1. On DEVICE_REMOVED, GetCompletedValue() returns u64::MAX, exiting the loop immediately and mapping incomplete readback data. Now that a removed device is shared across tests, sharing a single completion-check helper across all three paths is much more important.
  4. Hardware concurrency coverage: The new test (:2055-2097) currently exercises the serialized WARP_LOCK path. Adding a hardware-path concurrency test (when not forced to WARP) with distinct per-thread readback payloads would directly cover the concurrent queue path this PR enables.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 08:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#pullrequestreview-6070713265) · **requested changes** The wall-clock improvement on real hardware is huge! Tested locally on Windows 11 (RTX 5090, running the `victory-shader` lib suite excluding the pre-existing `heap_direct_texture_reads_mark_their_heap_index` crash): - Base `63bcca43`: **523.12s** (298 passed, 3 pre-existing failures) - This PR `dc56cd73`: **33.56s** (298 passed, same 3 pre-existing failures) — a **15.6x speedup**, and concurrent submission is sound on the happy path because each call owns its own allocator, command list, resources, and fence. However, caching the hardware `(device, queue)` permanently in a `LazyLock` introduces a few correctness issues in `crates/victory-shader/src/emit/host.rs`: 1. **`Host::new(false)` permanently returns a removed device after `DEVICE_REMOVED` (`emit/host.rs:183-188, 206-224`)**: Once `HARDWARE_DEVICE` initializes to `Ok(...)`, any subsequent `Host::new(false)` clones and returns the same device/queue even if the GPU has since entered `DEVICE_REMOVED`. Previously, `create_device(false)` surfaced device removal when callers like `emit/semantics_tests.rs:577-585` requested a fresh `Host` after a failure. Please check `GetDeviceRemovedReason()` on construction (and decide/document whether an initial creation failure should stay cached forever). 2. **`pub device` can diverge from the private cached `queue` (`emit/host.rs:17-20, 191-195, 215-234`)**: `Host.device` is `pub`, so replacing it leaves the cached `queue` bound to the old device while `fuses_fmad` / `draw` / `dispatch` create allocators, lists, and fences on the new device. Keeping `device` and `queue` paired behind read-only access (or rebuilding the queue when the device changes) prevents mismatched-device submissions. 3. **Fence completion loops treat `UINT64_MAX` (`DEVICE_REMOVED`) as success in `fuses_fmad` and `dispatch` (`emit/host.rs:751-763, 2011-2023`)**: `draw` checks `GetDeviceRemovedReason()` after exiting the wait loop (`:1285-1288`), but `fuses_fmad` and `dispatch` only check it inside `while fence.GetCompletedValue() < 1`. On `DEVICE_REMOVED`, `GetCompletedValue()` returns `u64::MAX`, exiting the loop immediately and mapping incomplete readback data. Now that a removed device is shared across tests, sharing a single completion-check helper across all three paths is much more important. 4. **Hardware concurrency coverage**: The new test (`:2055-2097`) currently exercises the serialized `WARP_LOCK` path. Adding a hardware-path concurrency test (when not forced to WARP) with distinct per-thread readback payloads would directly cover the concurrent queue path this PR enables.
Address PR review: replace a removed cached device and queue, keep the pair
private behind a read-only accessor, wait through one fence helper in all
three readback paths, and cover concurrent hardware dispatches.
The concurrent dispatch test checks that two hosts and every worker get the same queue, not just the same device. It skips only when no hardware SM 6.6 device can be made; a failed queue creation on a working device fails the test.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 09:57 UTC · original

@⁠neonbyte1 @⁠fuzeofficlal I ran the hardware concurrency check requested in review item 4. On dc56cd73, eight RTX 5080 workers using the shared D3D12 queue each got back their own value on every dispatch. The same test applies to the parent, 63bcca43. Test-only commit

Adapter Parent PR head
RTX 5080, driver 621.40 512/512 payloads correct 512/512 payloads correct
Windows WARP, 10.0.26100.10068 512/512 payloads correct 512/512 payloads correct

Each cell covers four fresh processes. In each process, eight workers synchronized after pipeline creation, then each submitted 16 dispatches with distinct root constants. The shader wrote one word of a two-word UAV. The untouched neighbor stayed zero in every readback. The test identified the adapter by its D3D12 device LUID. WARP used its existing serialization. This run covers successful submissions; the device-removal questions in the review are still open.

To try it on this PR:

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr3093-concurrent-readback
git cherry-pick 5b871f8170440350c11ad5532e6260ac7a574be2
$env:VICTORY_WARP = '0'
cargo test --locked -p victory-shader --lib emit::valu_tests::parallel_dispatches_keep_each_workers_readback -- --exact --test-threads=1 --nocapture

Set VICTORY_WARP=1 for the software control. Each completed run prints the adapter name and 128 matched readbacks. AI-assisted test and write-up, run locally on Windows.

**@⁠steven-seagull27** on GitHub · 2026-11-26 09:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7188708523) @⁠neonbyte1 @⁠fuzeofficlal I ran the hardware concurrency check requested in [review item 4](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3093). On `dc56cd73`, eight RTX 5080 workers using the shared D3D12 queue each got back their own value on every dispatch. The same test applies to the parent, `63bcca43`. [Test-only commit](https://github.com/steven-seagull27/VIctory/commit/5b871f8170440350c11ad5532e6260ac7a574be2) | Adapter | Parent | PR head | |---|---:|---:| | RTX 5080, driver 621.40 | 512/512 payloads correct | 512/512 payloads correct | | Windows WARP, 10.0.26100.10068 | 512/512 payloads correct | 512/512 payloads correct | Each cell covers four fresh processes. In each process, eight workers synchronized after pipeline creation, then each submitted 16 dispatches with distinct root constants. The shader wrote one word of a two-word UAV. The untouched neighbor stayed zero in every readback. The test identified the adapter by its D3D12 device LUID. WARP used its existing serialization. This run covers successful submissions; the device-removal questions in the review are still open. To try it on this PR: ```powershell git fetch https://github.com/steven-seagull27/VIctory.git codex/pr3093-concurrent-readback git cherry-pick 5b871f8170440350c11ad5532e6260ac7a574be2 $env:VICTORY_WARP = '0' cargo test --locked -p victory-shader --lib emit::valu_tests::parallel_dispatches_keep_each_workers_readback -- --exact --test-threads=1 --nocapture ``` Set `VICTORY_WARP=1` for the software control. Each completed run prints the adapter name and 128 matched readbacks. AI-assisted test and write-up, run locally on Windows.
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 10:01 UTC · original

Thanks for the Windows hardware run and the four points. All four are addressed in a follow-up commit, deedac2:

  1. Removed device. The cached hardware (and WARP) device and queue sit in a mutex as one pair. Host::new checks GetDeviceRemovedReason() and, if the cached device is removed, drops the pair and makes a new one. Creation failures aren't cached: before this PR, Host::new(false) tried again on every call, and an adapter that appears later should still work.
  2. Device and queue paired. Host::device is private now, behind a read-only device() accessor. The cache only hands out the device and its queue together, so nothing can swap a device under a cached queue. In-tree callers are updated.
  3. Completion. fuses_fmad, draw and dispatch share one wait_for_completion(). It treats u64::MAX and any GetDeviceRemovedReason() error as failure, and checks again after the last fence read, before any readback is mapped.
  4. Hardware concurrency. New test parallel_hardware_dispatches_on_shared_queue: eight threads take hosts on the shared hardware queue, each dispatch writes its own token, and each thread checks its own readback. It deliberately ignores VICTORY_WARP. It skips, with a message, only when there's no SM 6.6 hardware adapter.

Tested on the RTX 5090 under Wine (vkd3d-proton):

  • The new test passes. With the fence wait removed, as a mutation check, it fails.
  • The whole victory-shader lib suite has 299 passed and the same 4 failures as main under Wine, and no SIGKILL at exit.
  • Clippy with and without diagnostics, and cargo xtask policy, are clean.

Not run on native Windows.

AI-assisted (Claude); measured on my machine, no game data shared.

**@⁠neonbyte1** on GitHub · 2026-11-26 10:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7188802087) Thanks for the Windows hardware run and the four points. All four are addressed in a follow-up commit, `deedac2`: 1. **Removed device.** The cached hardware (and WARP) device and queue sit in a mutex as one pair. `Host::new` checks `GetDeviceRemovedReason()` and, if the cached device is removed, drops the pair and makes a new one. Creation failures aren't cached: before this PR, `Host::new(false)` tried again on every call, and an adapter that appears later should still work. 2. **Device and queue paired.** `Host::device` is private now, behind a read-only `device()` accessor. The cache only hands out the device and its queue together, so nothing can swap a device under a cached queue. In-tree callers are updated. 3. **Completion.** `fuses_fmad`, `draw` and `dispatch` share one `wait_for_completion()`. It treats `u64::MAX` and any `GetDeviceRemovedReason()` error as failure, and checks again after the last fence read, before any readback is mapped. 4. **Hardware concurrency.** New test `parallel_hardware_dispatches_on_shared_queue`: eight threads take hosts on the shared hardware queue, each dispatch writes its own token, and each thread checks its own readback. It deliberately ignores `VICTORY_WARP`. It skips, with a message, only when there's no SM 6.6 hardware adapter. **Tested** on the RTX 5090 under Wine (vkd3d-proton): - The new test passes. With the fence wait removed, as a mutation check, it fails. - The whole `victory-shader` lib suite has 299 passed and the same 4 failures as `main` under Wine, and no SIGKILL at exit. - Clippy with and without `diagnostics`, and `cargo xtask policy`, are clean. Not run on native Windows. _AI-assisted (Claude); measured on my machine, no game data shared._
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 10:16 UTC · original

@⁠neonbyte1 I ran your new parallel_hardware_dispatches_on_shared_queue at deedac2e7 on native Windows. It passed in four fresh processes on the RTX 5080, with eight workers checking their own token each time (32/32 readbacks).

I also reran the longer test from my earlier comment, updated to use the new device() accessor. In four fresh processes per adapter, each worker made 16 submissions. The RTX 5080 returned 512/512 correct payloads, and all 512 untouched neighbor words stayed zero. Windows inbox WARP returned the same counts through its serialized path. Optional 16-round test on your new revision

I found one failure path in the new test itself. If one worker fails host or pipeline setup, it panics before reaching the eight-worker barrier. I injected one setup error on a healthy device. All seven peers reached the barrier, none reached dispatch, and I stopped the test after 10 seconds. Carrying the setup result across the barrier let the seven peers return their correct tokens and the test report the injected error in 0.25 seconds. With the injected error removed, the fix passed 24/24 worker readbacks across three RTX runs. Affected lines · Test-only fix

To pick up just the barrier fix on deedac2e7

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr3093-worker-setup-barrier
git cherry-pick a205dde3bc745f006d1f14920935d82f741d2d1d

Windows 11, NVIDIA driver 621.40, inbox WARP 10.0.26100.10068. The injected error exercised worker setup on a healthy adapter. Hardware device-removal recovery remains untested here. AI-assisted testing with synthetic inputs.

**@⁠steven-seagull27** on GitHub · 2026-11-26 10:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7189154125) @⁠neonbyte1 I ran your new `parallel_hardware_dispatches_on_shared_queue` at `deedac2e7` on native Windows. It passed in four fresh processes on the RTX 5080, with eight workers checking their own token each time (32/32 readbacks). I also reran the longer test from my earlier comment, updated to use the new `device()` accessor. In four fresh processes per adapter, each worker made 16 submissions. The RTX 5080 returned 512/512 correct payloads, and all 512 untouched neighbor words stayed zero. Windows inbox WARP returned the same counts through its serialized path. [Optional 16-round test on your new revision](https://github.com/steven-seagull27/VIctory/commit/50342b8d147b7ba8658918669ebf3573b1f41bd8) I found one failure path in the new test itself. If one worker fails host or pipeline setup, it panics before reaching the eight-worker barrier. I injected one setup error on a healthy device. All seven peers reached the barrier, none reached dispatch, and I stopped the test after 10 seconds. Carrying the setup result across the barrier let the seven peers return their correct tokens and the test report the injected error in 0.25 seconds. With the injected error removed, the fix passed 24/24 worker readbacks across three RTX runs. [Affected lines](https://github.com/Marvisak/VIctory/blob/deedac2e7eedc232c69302db88f137132da033d5/crates/victory-shader/src/emit/host.rs#L2229-L2237) · [Test-only fix](https://github.com/steven-seagull27/VIctory/commit/a205dde3bc745f006d1f14920935d82f741d2d1d) To pick up just the barrier fix on `deedac2e7` ```powershell git fetch https://github.com/steven-seagull27/VIctory.git codex/pr3093-worker-setup-barrier git cherry-pick a205dde3bc745f006d1f14920935d82f741d2d1d ``` Windows 11, NVIDIA driver 621.40, inbox WARP 10.0.26100.10068. The injected error exercised worker setup on a healthy adapter. Hardware device-removal recovery remains untested here. AI-assisted testing with synthetic inputs.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 10:17 UTC · original · requested changes

deedac2e cleanly addresses the earlier review items: SharedDevice pairs device and queue and recreates on GetDeviceRemovedReason(), Host::device is private behind device(), and fuses_fmad/draw/dispatch share wait_for_completion with u64::MAX and pre/post-read device-removal checks.

One blocker in the new parallel_hardware_dispatches_on_shared_queue test (emit/host.rs:2221-2238): each of the eight spawned threads calls Host::new_for(false).expect(...) and host.compute_pipeline(shader).expect(...) inside std::thread::scope before barrier.wait(). If any worker fails during host setup or PSO creation, the remaining workers deadlock permanently on barrier.wait() and thread::scope never returns. Please complete fallible setup before entering the fixed-count barrier (or propagate setup failures). It would also help to assert queue sharing alongside first.device() == second.device(), and to only skip when adapter creation itself fails rather than on CreateCommandQueue errors.

Verified locally on Windows 11 x64 (RTX 5090 + WARP + dxil.dll, deedac2e):

  • cargo run --locked -p xtask -- policy & cargo check --workspace --all-targets --locked: passed
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings (default and --all-features): clean
  • emit::host::tests (--test-threads=1 and default parallel on RTX 5090, plus VICTORY_WARP=1): 2 passed, 0 failed
  • emit::tests / emit::semantics_tests (parallel on RTX 5090 and VICTORY_WARP=1): 17 / 34 passed, 0 failed (1 ignored)
**@⁠fuzeofficlal** on GitHub · 2026-11-26 10:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#pullrequestreview-6072266593) · **requested changes** `deedac2e` cleanly addresses the earlier review items: `SharedDevice` pairs `device` and `queue` and recreates on `GetDeviceRemovedReason()`, `Host::device` is private behind `device()`, and `fuses_fmad`/`draw`/`dispatch` share `wait_for_completion` with `u64::MAX` and pre/post-read device-removal checks. One blocker in the new `parallel_hardware_dispatches_on_shared_queue` test (`emit/host.rs:2221-2238`): each of the eight spawned threads calls `Host::new_for(false).expect(...)` and `host.compute_pipeline(shader).expect(...)` inside `std::thread::scope` before `barrier.wait()`. If any worker fails during host setup or PSO creation, the remaining workers deadlock permanently on `barrier.wait()` and `thread::scope` never returns. Please complete fallible setup before entering the fixed-count barrier (or propagate setup failures). It would also help to assert queue sharing alongside `first.device() == second.device()`, and to only skip when adapter creation itself fails rather than on `CreateCommandQueue` errors. Verified locally on Windows 11 x64 (RTX 5090 + WARP + `dxil.dll`, `deedac2e`): - `cargo run --locked -p xtask -- policy` & `cargo check --workspace --all-targets --locked`: passed - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings` (default and `--all-features`): clean - `emit::host::tests` (`--test-threads=1` and default parallel on RTX 5090, plus `VICTORY_WARP=1`): 2 passed, 0 failed - `emit::tests` / `emit::semantics_tests` (parallel on RTX 5090 and `VICTORY_WARP=1`): 17 / 34 passed, 0 failed (1 ignored)
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 10:31 UTC · original

@⁠fuzeofficlal @⁠steven-seagull27 Thanks both. Two new commits:

  1. Barrier deadlock (@⁠fuzeofficlal's blocker, @⁠steven-seagull27's reproduction): I cherry-picked @⁠steven-seagull27's fix unchanged, with your authorship, as b0fed71. Each worker's host and pipeline setup is now a Result carried across the barrier, so a worker whose setup fails still releases the others, and the test reports the error afterwards. To check it, I made one worker's setup return an error before any GPU work. The test then failed in 0.8 s with hardware Host::new: "injected setup error" instead of hanging. The injected error is removed again.
  2. Queue sharing (@⁠fuzeofficlal): 076c0e7 checks that two hosts get the same queue, not just the same device. Each of the eight workers also checks that its host has that same queue.
  3. Skip (@⁠fuzeofficlal): the test now skips only when no hardware SM 6.6 device can be created. If the device can be made but Host::new still fails, for example in CreateCommandQueue, the test fails.

@⁠steven-seagull27, thanks also for the native Windows runs and the 16-round test (50342b8). I didn't add it because it covers the same shared-queue readbacks as this test. It's a good heavier stress check to run by hand, and your 512/512 results on the RTX 5080 and on WARP are a useful record here.

Tested on the RTX 5090 under Wine (vkd3d-proton):

  • The new test passed in three runs.
  • The whole victory-shader lib suite has 299 passed and the same 4 failures as main under Wine, and no SIGKILL at exit.
  • Clippy (with and without diagnostics), policy and format checks are clean.

Not run on native Windows.

AI-assisted (Claude); measured on my machine, no game data shared.

**@⁠neonbyte1** on GitHub · 2026-11-26 10:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7189472174) @⁠fuzeofficlal @⁠steven-seagull27 Thanks both. Two new commits: 1. **Barrier deadlock** (@⁠fuzeofficlal's blocker, @⁠steven-seagull27's reproduction): I cherry-picked @⁠steven-seagull27's fix unchanged, with your authorship, as `b0fed71`. Each worker's host and pipeline setup is now a `Result` carried across the barrier, so a worker whose setup fails still releases the others, and the test reports the error afterwards. To check it, I made one worker's setup return an error before any GPU work. The test then failed in 0.8 s with `hardware Host::new: "injected setup error"` instead of hanging. The injected error is removed again. 2. **Queue sharing** (@⁠fuzeofficlal): `076c0e7` checks that two hosts get the same queue, not just the same device. Each of the eight workers also checks that its host has that same queue. 3. **Skip** (@⁠fuzeofficlal): the test now skips only when no hardware SM 6.6 device can be created. If the device can be made but `Host::new` still fails, for example in `CreateCommandQueue`, the test fails. @⁠steven-seagull27, thanks also for the native Windows runs and the 16-round test (`50342b8`). I didn't add it because it covers the same shared-queue readbacks as this test. It's a good heavier stress check to run by hand, and your 512/512 results on the RTX 5080 and on WARP are a useful record here. **Tested** on the RTX 5090 under Wine (vkd3d-proton): - The new test passed in three runs. - The whole `victory-shader` lib suite has 299 passed and the same 4 failures as `main` under Wine, and no SIGKILL at exit. - Clippy (with and without `diagnostics`), policy and format checks are clean. Not run on native Windows. _AI-assisted (Claude); measured on my machine, no game data shared._
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 10:46 UTC · original

@⁠neonbyte1 I retested 076c0e7 on native Windows 11 with the RTX 5080 (driver 621.40). The upstream identity test passed in four fresh processes. In each process both initial hosts shared the same device and queue, and all eight workers used that queue. All 32 worker tokens matched.

I also checked both failure paths on the RTX. Giving worker 0 a second queue on the same D3D12 device triggered thread 0 has its own queue. Injecting a setup error in worker 0 made the test fail normally after the barrier. Its seven peers returned the correct tokens in both runs.

The separate 16-round stress test passed in four fresh processes per adapter. The RTX returned 512/512 expected tokens and Windows WARP (10.0.26100.10068) returned 512/512. The adjacent word stayed zero on every readback. Stress test used

**@⁠steven-seagull27** on GitHub · 2026-11-26 10:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7189823357) @⁠neonbyte1 I retested `076c0e7` on native Windows 11 with the RTX 5080 (driver 621.40). The upstream identity test passed in four fresh processes. In each process both initial hosts shared the same device and queue, and all eight workers used that queue. All 32 worker tokens matched. I also checked both failure paths on the RTX. Giving worker 0 a second queue on the same D3D12 device triggered `thread 0 has its own queue`. Injecting a setup error in worker 0 made the test fail normally after the barrier. Its seven peers returned the correct tokens in both runs. The separate 16-round stress test passed in four fresh processes per adapter. The RTX returned 512/512 expected tokens and Windows WARP (10.0.26100.10068) returned 512/512. The adjacent word stayed zero on every readback. [Stress test used](https://github.com/steven-seagull27/VIctory/commit/50342b8d147b7ba8658918669ebf3573b1f41bd8)
Author
Owner

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

Verified the updates in 076c0e7e on RTX 5090 and WARP: moving Host::new_for(false) and compute_pipeline ahead of barrier.wait(), asserting shared device/queue identity across all 8 worker threads (first.queue() == second.queue() and matching own.as_raw() while keeping first alive), and distinguishing hardware adapter absence from queue failure all cleanly resolve the previous review blockers.

Verified locally on Windows 11 x64 (076c0e7e):

  • rustfmt --edition 2024 --check on all 6 modified files, cargo run --locked -p xtask -- policy (191 files ok), cargo check --workspace --all-targets, and cargo clippy --workspace --all-targets -- -D warnings (default and --all-features): clean.
  • RTX 5090 (--test-threads=1 and default parallel) & VICTORY_WARP=1: emit::host::tests 2/2, emit::tests 17/17, emit::semantics_tests 34/34 (1 ignored).

Two minor edge notes (non-blocking):

  1. In parallel_hardware_dispatches_on_shared_queue, if Host::new_for(false) succeeds at device creation and fails queue creation, and the fallback create_device(false) check then fails transiently, the test would still skip instead of surfacing the original queue failure stage.
  2. Host::from_device uses a per-instance OnceLock<Result<ID3D12CommandQueue, String>>, so unlike shared() (which checks removed() and retries), a transient or post-removal queue error on an externally created device remains cached for the lifetime of that Host.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 11:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#pullrequestreview-6072967183) · **approved these changes** Verified the updates in `076c0e7e` on RTX 5090 and WARP: moving `Host::new_for(false)` and `compute_pipeline` ahead of `barrier.wait()`, asserting shared device/queue identity across all 8 worker threads (`first.queue() == second.queue()` and matching `own.as_raw()` while keeping `first` alive), and distinguishing hardware adapter absence from queue failure all cleanly resolve the previous review blockers. Verified locally on Windows 11 x64 (`076c0e7e`): - `rustfmt --edition 2024 --check` on all 6 modified files, `cargo run --locked -p xtask -- policy` (`191 files ok`), `cargo check --workspace --all-targets`, and `cargo clippy --workspace --all-targets -- -D warnings` (default and `--all-features`): clean. - RTX 5090 (`--test-threads=1` and default parallel) & `VICTORY_WARP=1`: `emit::host::tests` 2/2, `emit::tests` 17/17, `emit::semantics_tests` 34/34 (1 ignored). Two minor edge notes (non-blocking): 1. In `parallel_hardware_dispatches_on_shared_queue`, if `Host::new_for(false)` succeeds at device creation and fails queue creation, and the fallback `create_device(false)` check then fails transiently, the test would still skip instead of surfacing the original queue failure stage. 2. `Host::from_device` uses a per-instance `OnceLock<Result<ID3D12CommandQueue, String>>`, so unlike `shared()` (which checks `removed()` and retries), a transient or post-removal queue error on an externally created device remains cached for the lifetime of that `Host`.
Author
Owner

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

Windows 11, Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010), 63bcca4 + this PR. You asked for cargo test -p victory-shader --lib on a Windows GPU and once with WARP:

  • Hardware: 303 passed, 0 failed, 3 ignored (37.6 s).
  • WARP (VICTORY_WARP=1): 299 passed, 4 failed, 3 ignored — gathers_at_a_level_match_the_hardware ("lane 4 against its gather"), permutes_read_the_lane_named_and_zero_from_lanes_left_out, permutes_mask_high_address_bits_and_divergent_branches, a_mask_joined_with_data_at_a_uniform_loop_is_its_number.
  • Control, unpatched 63bcca4 with the same WARP setup: 298 passed, 4 failed — the exact same four. So the shared queue adds nothing new here; those four are the pre-existing WARP gaps.

Note: on this host victory-shader has to be built with --features host, otherwise the hardware backend silently skips. Synthetic only. AI-assisted.

**@⁠Jackster** on GitHub · 2026-11-26 16:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7197613189) Windows 11, Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010), `63bcca4` + this PR. You asked for `cargo test -p victory-shader --lib` on a Windows GPU and once with WARP: - Hardware: **303 passed, 0 failed, 3 ignored** (37.6 s). - WARP (`VICTORY_WARP=1`): **299 passed, 4 failed, 3 ignored** — `gathers_at_a_level_match_the_hardware` ("lane 4 against its gather"), `permutes_read_the_lane_named_and_zero_from_lanes_left_out`, `permutes_mask_high_address_bits_and_divergent_branches`, `a_mask_joined_with_data_at_a_uniform_loop_is_its_number`. - Control, unpatched `63bcca4` with the same WARP setup: **298 passed, 4 failed** — the exact same four. So the shared queue adds nothing new here; those four are the pre-existing WARP gaps. Note: on this host `victory-shader` has to be built with `--features host`, otherwise the hardware backend silently skips. Synthetic only. AI-assisted.
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 16:43 UTC · original

@⁠fuzeofficlal thanks for the approval and the two notes; both are addressed in 8d1518d:

  1. The skip in parallel_hardware_dispatches_on_shared_queue: when the shared host fails, the test now skips only if no SM 6.6 hardware device can be made, and the skip message includes both errors (device and shared queue). If a device can be made, it fails with the queue error instead of skipping.
  2. Host::from_device: the queue cell caches only success now. A failed creation returns the error and is retried on the next call, so a transient or post-removal error no longer sticks for the host's lifetime, matching shared().

Tested under Wine on the RTX 5090:

  • emit::host::tests pass.
  • victory-gpu's read_marks_of_both_bitmaps_are_taken, which goes through from_device, passes.
  • Clippy (both configurations), policy and formatting are clean.

hosts_that_do_not_fuse_are_named fails here both with and without this commit: under Wine, DXVK maps "WARP" to the RTX 5090, which fuses FMad. That's unrelated to this change; #2973 makes that test report the Wine case.

AI-assisted (Claude); measured on my machine, no game data shared.

**@⁠neonbyte1** on GitHub · 2026-11-26 16:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#issuecomment-7198022134) @⁠fuzeofficlal thanks for the approval and the two notes; both are addressed in `8d1518d`: 1. **The skip in `parallel_hardware_dispatches_on_shared_queue`:** when the shared host fails, the test now skips only if no SM 6.6 hardware device can be made, and the skip message includes both errors (device and shared queue). If a device can be made, it fails with the queue error instead of skipping. 2. **`Host::from_device`:** the queue cell caches only success now. A failed creation returns the error and is retried on the next call, so a transient or post-removal error no longer sticks for the host's lifetime, matching `shared()`. **Tested** under Wine on the RTX 5090: - `emit::host::tests` pass. - `victory-gpu`'s `read_marks_of_both_bitmaps_are_taken`, which goes through `from_device`, passes. - Clippy (both configurations), policy and formatting are clean. `hosts_that_do_not_fuse_are_named` fails here both with and without this commit: under Wine, DXVK maps "WARP" to the RTX 5090, which fuses FMad. That's unrelated to this change; #2973 makes that test report the Wine case. _AI-assisted (Claude); measured on my machine, no game data shared._
Author
Owner

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

Verified the follow-up commit 8d1518de285e37a444292795e7d864d5077f0a12 on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):

  • Host::from_device (crates/victory-shader/src/emit/host.rs:17, 263-292) now stores OnceLock<ID3D12CommandQueue> and caches successes only, so transient or post-removal create_queue failures are retried cleanly.
  • parallel_hardware_dispatches_on_shared_queue (host.rs:2214-2235) surfaces both the device-probe and shared-queue errors when skipping without a hardware SM 6.6 adapter.
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed (asset policy: 191 files ok); cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features): clean.
  • RTX 5090 (VICTORY_WARP=0): emit::host::tests 2 passed, 0 failed (parallel 0.29s, --test-threads=1 0.28s); full --lib skipping the pre-existing heap_direct_texture_reads_mark_their_heap_index crash: 299 passed; 3 failed; 3 ignored; 1 filtered out in 17.72s (same 3 pre-existing failures as main).
  • WARP (VICTORY_WARP=1): 299 passed; 4 failed; 3 ignored in 6.73s (parallel_hardware_dispatches_on_shared_queue passes).
  • cargo test --locked -p victory-gpu --lib read_marks_of_both_bitmaps_are_taken: 1 passed, 0 failed (0.34s, exercising Host::from_device).

Both post-approval notes are cleanly resolved — ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 18:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/3093#pullrequestreview-6078968635) · **approved these changes** Verified the follow-up commit `8d1518de285e37a444292795e7d864d5077f0a12` on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP): - `Host::from_device` (`crates/victory-shader/src/emit/host.rs:17, 263-292`) now stores `OnceLock<ID3D12CommandQueue>` and caches successes only, so transient or post-removal `create_queue` failures are retried cleanly. - `parallel_hardware_dispatches_on_shared_queue` (`host.rs:2214-2235`) surfaces both the device-probe and shared-queue errors when skipping without a hardware SM 6.6 adapter. - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: `1 passed` (`asset policy: 191 files ok`); `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`): clean. - RTX 5090 (`VICTORY_WARP=0`): `emit::host::tests` `2 passed, 0 failed` (parallel `0.29s`, `--test-threads=1` `0.28s`); full `--lib` skipping the pre-existing `heap_direct_texture_reads_mark_their_heap_index` crash: `299 passed; 3 failed; 3 ignored; 1 filtered out` in **17.72s** (same 3 pre-existing failures as `main`). - WARP (`VICTORY_WARP=1`): `299 passed; 4 failed; 3 ignored` in `6.73s` (`parallel_hardware_dispatches_on_shared_queue` passes). - `cargo test --locked -p victory-gpu --lib read_marks_of_both_bitmaps_are_taken`: `1 passed, 0 failed` (`0.34s`, exercising `Host::from_device`). Both post-approval notes are cleanly resolved — ready to merge.
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/3093/head:github-bot/gh-3093'
git switch 'github-bot/gh-3093'

Merge

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