fix(victory-gpu): honor blocking fence waits for null events #314
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/314"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-26T02:26:41Z.
Change
ID3D12Fence::SetEventOnCompletion(value, nullptr)returnedE_NOTIMPLin Neptune when the value was still pending. A title thread could resume while the queue still held the work that would signal the fence.Register a private Win32 event on the fence's existing waiter list and block until the signal satisfies that wait. Release the waiter lock before settling any submitted GPU work. The event remains signaled once the request is satisfied even if the fence is rewound. An already reached value returns immediately.
This is the
victory-gpufence path in the runtime launched bytools/lancer_victory.ps1. Microsoft documents the blocking behavior for a null event handle. D3D12 fence documentationReproduction and oracle
The regression queues one four-byte
CopyBufferRegionbehind an unsignaled gate fence, followed by a completion signal. A separate thread callsSetEventOnCompletionwith a null event. The test checks whether it registered before opening the gate, captures the HRESULT and fence value at return, and reads back the copied word.c4c93bdc413191a9dc909998d2d53080a3f0c8800x80004001and completion value00x13579bdfafter the test opens the gate for cleanupf9fb590475db4931f10393d30fe5a4d7a16bfed9S_OKat completion value10x13579bdfBoth outcomes reproduced on an RTX 5070 Ti (driver 621.40) and on Microsoft WARP, using both
VICTORY_LATE_WAIT=0and the launcher relay path (VICTORY_LATE_WAIT=3,VICTORY_RELAY=2,VICTORY_RELAY_OWN_QUEUE=1). The focused tests had no skips on either adapter. The fixture builds the buffers and their contents itself.Verification
Windows x64, Rust 1.98.1 MSVC. Commands from
third_party/victory.cargo test --locked --offline -p victory-gpu --lib --features diagnostics fence::tests::null_event_waits_for_a_queued_gpu_copy -- --exact --nocapture --test-threads=1cargo test --locked --offline -p victory-gpu --lib --features diagnostics fence::tests:: -- --nocapture --test-threads=1cargo test --locked --offline -p victory-gpu --lib --features diagnostics -- --test-threads=1cargo test --locked --offline -p victory-loader --test load_probecargo build --locked --offline --release -p victorycargo xtask policyThe three GPU suite failures also reproduce on this base with the same suite command.
spans_say_the_next_start_and_the_lowest_level_viewed,warp_card_fetch_copies_flagged_pieces_to_their_slots, andwarp_card_patch_writes_the_masked_bytes_and_no_others.From the repository root,
python -m pytest -rspassed 1,342 tests and skipped 323 requiring built runtime artifacts that were absent locally.python -m ruff check --select W605,F,E9 PrototypeScarlett tests toolspassed.Prepared with AI assistance (OpenAI Codex).
Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-26T18:41:37Z.
Rebased and pushed the fence fix over main's merged-submission handling. The null-event path waits on a private event and still supports the opt-in fence-word wake path. GitHub now reports the PR as mergeable.
All six fence tests passed. The queued-copy regression also passed on the RTX 5070 Ti and WARP with late waits, relay, merged submissions, and fence-word wakeups enabled. The wait returned
S_OKafter the signal and the readback matched.GitHub Actions for this revision.
Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-27T12:24:00Z.
Review: fence.rs:153-165 waits on WaitForSingleObject(handle, 10) with no deadline. A fence that never reaches its value hangs the title thread forever. Please keep a deadline (e.g. 30 s), then log a warning, unregister the waiter and return E_NOTIMPL, as the previous code did.
Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-27T17:57:29Z.
Updated in
850a42a:NULL_EVENT_TIMEOUT) on the blocking null-event wait infence.rs. On timeout it logsblocking fence wait timed out, unregisters the private waiter, closes the event handle, and returnsE_NOTIMPL.null_event_times_out_and_unregisters_waiteralongsidenull_event_waits_for_a_queued_gpu_copy.Verified all 5
fence::testsandcargo xtask policy(285 files ok).