Repository navigation
Conversation
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.
Dukestar69
left a comment
There was a problem hiding this comment.
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).
|
Independent WARP verification of this PR at Setup: Windows 11, Queue creation: Repeated parallel runs. The full
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 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, AI use: Claude Code (Claude Sonnet 5.5) ran the verification, coordinated by Codex (gpt-6.2-sol). |
|
Offline validation on the retail corpus, with the current main as the baseline:
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 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. |
|
Automated triage for the maintainers. Merge candidate. A Windows WARP run comparing this branch with CI: passing. Generated by Claude Code |
fuzeofficlal
left a comment
There was a problem hiding this comment.
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:
Host::new(false)permanently returns a removed device afterDEVICE_REMOVED(emit/host.rs:183-188, 206-224): OnceHARDWARE_DEVICEinitializes toOk(...), any subsequentHost::new(false)clones and returns the same device/queue even if the GPU has since enteredDEVICE_REMOVED. Previously,create_device(false)surfaced device removal when callers likeemit/semantics_tests.rs:577-585requested a freshHostafter a failure. Please checkGetDeviceRemovedReason()on construction (and decide/document whether an initial creation failure should stay cached forever).pub devicecan diverge from the private cachedqueue(emit/host.rs:17-20, 191-195, 215-234):Host.deviceispub, so replacing it leaves the cachedqueuebound to the old device whilefuses_fmad/draw/dispatchcreate allocators, lists, and fences on the new device. Keepingdeviceandqueuepaired behind read-only access (or rebuilding the queue when the device changes) prevents mismatched-device submissions.- Fence completion loops treat
UINT64_MAX(DEVICE_REMOVED) as success infuses_fmadanddispatch(emit/host.rs:751-763, 2011-2023):drawchecksGetDeviceRemovedReason()after exiting the wait loop (:1285-1288), butfuses_fmadanddispatchonly check it insidewhile fence.GetCompletedValue() < 1. OnDEVICE_REMOVED,GetCompletedValue()returnsu64::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. - Hardware concurrency coverage: The new test (
:2055-2097) currently exercises the serializedWARP_LOCKpath. 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.
|
@neonbyte1 @fuzeofficlal I ran the hardware concurrency check requested in review item 4. On
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 --nocaptureSet |
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.
|
Thanks for the Windows hardware run and the four points. All four are addressed in a follow-up commit,
Tested on the RTX 5090 under Wine (vkd3d-proton):
Not run on native Windows. AI-assisted (Claude); measured on my machine, no game data shared. |
|
@neonbyte1 I ran your new I also reran the longer test from my earlier comment, updated to use the new 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 git fetch https://github.com/steven-seagull27/VIctory.git codex/pr3093-worker-setup-barrier
git cherry-pick a205dde3bc745f006d1f14920935d82f741d2d1dWindows 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. |
fuzeofficlal
left a comment
There was a problem hiding this comment.
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: passedcargo clippy -p victory-shader --all-targets --locked -- -D warnings(default and--all-features): cleanemit::host::tests(--test-threads=1and default parallel on RTX 5090, plusVICTORY_WARP=1): 2 passed, 0 failedemit::tests/emit::semantics_tests(parallel on RTX 5090 andVICTORY_WARP=1): 17 / 34 passed, 0 failed (1 ignored)
…a device 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.
|
@fuzeofficlal @steven-seagull27 Thanks both. Two new commits:
@steven-seagull27, thanks also for the native Windows runs and the 16-round test ( Tested on the RTX 5090 under Wine (vkd3d-proton):
Not run on native Windows. AI-assisted (Claude); measured on my machine, no game data shared. |
|
@neonbyte1 I retested I also checked both failure paths on the RTX. Giving worker 0 a second queue on the same D3D12 device triggered 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 |
fuzeofficlal
left a comment
There was a problem hiding this comment.
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 --checkon all 6 modified files,cargo run --locked -p xtask -- policy(191 files ok),cargo check --workspace --all-targets, andcargo clippy --workspace --all-targets -- -D warnings(default and--all-features): clean.- RTX 5090 (
--test-threads=1and default parallel) &VICTORY_WARP=1:emit::host::tests2/2,emit::tests17/17,emit::semantics_tests34/34 (1 ignored).
Two minor edge notes (non-blocking):
- In
parallel_hardware_dispatches_on_shared_queue, ifHost::new_for(false)succeeds at device creation and fails queue creation, and the fallbackcreate_device(false)check then fails transiently, the test would still skip instead of surfacing the original queue failure stage. Host::from_deviceuses a per-instanceOnceLock<Result<ID3D12CommandQueue, String>>, so unlikeshared()(which checksremoved()and retries), a transient or post-removal queue error on an externally created device remains cached for the lifetime of thatHost.
Split out of #2973, as asked in its review: this changes how every
victory-shaderGPU 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-shadertests undercargo xtask wine-test(#1218), 298 passed, 4 failed, no SIGKILL. All four failures happen onmainwithout this change too:rounding_matches_the_hardwareis fixed by Shaders: f32 floor, ceil and fract flush denormal operands #2968.stub_pipeline_is_createdis tracked in Tests: keep the D3D12 pipeline smoke check portable under Wine #1266.hosts_that_do_not_fuse_are_namedanda_heap_buffer_read_where_no_buffer_view_is_reads_zerosare fixed by Tests and fixes so the suite runs under Wine #2973.Not tested on Windows: I have no Windows machine. A run of
cargo test -p victory-shader --libon 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.