Repository navigation
Conversation
…, not reset
The sparse queue's wait (wait_for) gives up after 5 s and goes on.
begin_slot and the readback path then Reset the allocator and list of
the submission the wait gave up on, while the GPU may still execute it,
which D3D12 does not allow. Retail runs on other machines log the
timeout ("sparse: the queue has not reached fence value ... after 5 s")
five or more times a run (xcl-dev#675, xcl-dev#505, xcl-dev#846, xcl-dev#646).
wait_for now says whether the fence was reached. When it was not, the
allocator and list go to held_lists with the fence value of their last
submission, a new pair takes their place, and reclaim_ring drops held
pairs once the queue has passed that value. If no new pair can be made,
the wait goes on without a bound instead of resetting.
The mechanism follows Vice-Tay b06fdd5 (GPL-3.0-or-later): a submission
whose bounded wait timed out stays pending until its fence has passed.
No code is taken from it (THIRD_PARTY.md). C16 of xcl-dev#3011.
This makes the lists' lifetime safe, not the readback bytes: after a
timed-out wait, flush_and_copy still copies the readback buffer into
title memory (a separate change).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sparse queue's fence waits share one auto-reset event. When a wait gives up and its value is reached later, the event stays signalled, and the next wait woke at once, checked the fence once and reported that the queue had not got there, without waiting. With xcl-dev#3062 and xcl-dev#3063 that answer holds a list back or skips a readback copy that would have been fine 20 ms later; before them the caller went on early. wait_for now checks the fence after every wake and waits again against the same deadline until its value is reached or the bound is spent. The timeout warning gives the time actually waited, not the bound. Found by pickles976 in a review of xcl-dev#3063 (stale wake consumed by the next wait). The new test leaves such a wake on the event and fails without the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I checked the previously untested native D3D12 debug-layer path on RTX 5070 / NVIDIA 616.92 at head While the sparse queue was blocked, both 20 ms waits timed out. XCL retained both pending allocator/list pairs and used a distinct replacement for each subsequent recording. Releasing the first gate advanced the fence from 0 to 1 and reclaimed only the first pair; releasing the second advanced it to 3 and reclaimed the remaining pair. This tests the synthetic allocator lifetime and reclamation path under a stalled queue. It does not test retail stalls, physical memory savings, or readback contents. AI use: OpenAI Codex with GPT-6.2 Astra built and ran the checks; Codex reviewed and prepared this report. |
The sparse queue's wait (
wait_for) gives up after 5 s and goes on.begin_slotand the readback path thenResetthe allocator and list of the submission the wait gave up on, while the GPU may still be executing it. D3D12 does not allow that. Retail runs on other machines log the timeout (sparse: the queue has not reached fence value … after 5 s) five or more times a run: #675, #505, #846, #646.Now a pair that is still in flight after the wait is held until the queue has passed its submission, and a new pair takes its place. Part of #3011 (C16); the mechanism follows Vice-Tay
b06fdd5.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:wait_forreturns whether the fence was reached. The bound (5 s) is unchanged.hold_pending: the old allocator and list go toheld_listswith the fence value of their last submission, and a new pair replaces them. If no new pair can be made, it waits without a bound instead of resetting.begin_slot(upload slots) and the readback list use it.reclaim_ringdrops held pairs once the fence has passed.a_slot_still_in_flight_after_the_wait_is_held_not_reset. It holds the queue on an unsignalled fence (queue.Wait), submits a slot, comes round to it again with a 20 ms bound, and checks that the slot got a new allocator and that the old one goes once the queue is released. A test-only override of the bound (wait_ms) keeps it short.sparse.rs:wait_forchecks the fence after every wake and waits again against the same deadline. The sparse fence waits share one auto-reset event, so a wake left behind by a wait that gave up ended the next wait at once, and it reported "not reached" without waiting (found by pickles976 on D3D12.X: a sparse readback its wait gave up on is not copied into title memory #3063;mainhas the same single wait). The timeout warning now gives the time actually waited. Testa_stale_wake_does_not_end_the_next_wait: a wake is left on the event, then a wait for the next value, signalled from another thread 20 ms later, must returntrueafter at least 10 ms.THIRD_PARTY.md: a row for Vice-Tay. No code is taken from it, only the mechanism (a submission whose bounded wait timed out stays pending until its fence has passed), reimplemented here.This makes the lifetime of the lists safe, not the bytes. After a timed-out wait,
flush_and_copystill copies the readback buffer into title memory; #3063 (stacked on this one) leaves that copy out. The upload staging ring was already safe: its space is freed only for completed fences.Tested
cargo build --workspacethencargo test --workspace --no-fail-fast -- --test-threads=4ate9e84e87: 1467 passed, 0 failed, 47 ignored; 25SKIPPED(no wave64 on this adapter, and one "no heap windows").cargo test -p xcl --lib sparse::ate9e84e87: 19 passed, 0 failed, 1 ignored (early_commit_timing, ignored onmaintoo).a_stale_wake_does_not_end_the_next_waitalone: passed 3 of 3.begin_slot: "an allocator the GPU may still execute was reset for reuse". With the old single wait: "the wait ended on a stale wake after 111–192 µs", 3 of 3.Regression run
Both 60 s,
XCL_PREPARE=0(full shader preparation does not finish in time on this machine),XCL_PRESS_AT=25:A, a new emptyXCL_DXIL_CACHEfor each run, the same retail game.main:This PR:
Not tested
main, and the 60 s smoke never comes near a 5 s sparse-queue stall. The reporters of Retail title 1.0.2.1: GPU hang / crash at +0x23cf683 when the story loads (RTX 3070 Ti) #675 / Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505 would see it: the warningsparse: N command lists still in flight after the wait were held, not resetshould appear wherehas not reached fence valuedoes.AI use
Credit: the mechanism is Taynan Piza's (Vice-Tay #307,
b06fdd5).🤖 Generated with Claude Code