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>
|
Verified stacked production head 1409b38 (#3062 parent 5a9c5ed) on Wine 11 / Linux 6.17 / real NVIDIA RTX 4060 Laptop, driver 590.48.1. Test-only strengthening selects NVIDIA explicitly and uses panic-safe CPU fence release before State destruction. Diagnostic-relaxed vkd3d-proton 2576c0b4adfae4a+, not stock certification. The allocator-retention test passes, but extending readback to a successful retry exposes the shared-event wait bug. The original timeout checks pass: real GPU bytes 0x3C are seeded, CPU is changed to 0xAA, stale readback buffer is poisoned 0xBB, and a CPU-held queue gate forces the 20ms timeout. CPU bytes and A separate, GPU-work-free fence fixture isolates the event behavior:
Observed: Causal control: a temporary local helper-only probe rechecked the requested fence after every wake and waited against the same absolute deadline (including stale wakes), without resetting the event, forcing completion, raising the production5s budget, or changing the readback algorithm. All3 fixtures then passed, including the actual GPU retry and allocator retirement. Isolated wait: Local evidence directories:
Suggested owner correction: deadline-based fence rechecking, explicit event/failed-wait/device-removal handling, and keep the successful retry assertion alongside the timeout assertion. A simple ResetEvent before waiting does not establish protection against a late old registration. True timeout still returns |
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>
…le memory readback_ranges submits the copies from the sparse windows into the readback buffer, waits for them (at most 5 s), then copies the buffer into the CPU view and records the sent hashes. When the wait gave up, the GPU copies have not run: the buffer still holds an earlier readback, of other addresses, and those bytes were written into the title's memory as if they were its own, and hashed as sent. Now the copy and the hashes are left out for that batch: the CPU view keeps its bytes. A rate-limited warning counts these readbacks. Stacked on the change that holds lists still in flight (C16 of xcl-dev#3011). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1409b38 to
89bcf0d
Compare
|
@pickles976 thanks, confirmed against the source: Fixed in a new commit on #3062,
Tested (RTX 2070 SUPER, driver 621.40, Windows 11 26300, debug tests): full suite Not changed, as you noted: a real timeout still returns AI use: Claude Code (Claude Opus 5.5) checked the finding, wrote the fix, the tests and this reply at the account owner's request. |
|
I checked the device-removed fence sentinel on head For a nonzero target, injecting that value at entry or after a wake returned true in both cases. Controls behaved as expected: pending timeout returned false; exact, past, and pending-then-completed values returned true. The comparison treats the removal sentinel as completion. In A simple global change to return false on the sentinel needs care: the allocation-failure path retries AI use: OpenAI Codex with GPT-6.2 Astra built and ran the harness; Codex reviewed and prepared this report. |
|
@andrewDoing thanks. Confirmed by reading I'm leaving it as it is in this PR:
If a removal needs its own handling here, I'd add it as a separate change: a check of the sentinel in AI use: Claude Code (Claude Opus 5.5) checked the finding against the code and wrote this reply. |
|
I tested the suggested readback-local approach on top of In a test-only extension of the existing native sparse readback fixture, the real queue and device remained healthy. After a real completed GPU copy, an auxiliary D3D12 fence initialized to This is a local candidate, not an actual device-removal test or a complete lifetime fix. A removal occurring after the final observation remains outside the check, and no retail behavior or performance was measured. AI use: OpenAI Codex with GPT-6.2 Astra built and ran the test; Codex reviewed and prepared this report. |
Stacked on #3062; only the top commit (
89bcf0d8) belongs here.readback_rangessubmits the copies from the sparse windows into the readback buffer, waits for them (at most 5 s), then copies the buffer into the CPU view and records the sent hashes. When the wait gave up, the GPU copies have not run, and the buffer still holds an earlier readback, of other addresses. Those bytes were written into the title's memory as if they were its own, and hashed as sent. Retail runs log this wait timing out (#675, #505, #846, #646). Part of #3011 (C16).Now that batch's copy and hashes are left out, so the CPU view keeps its own bytes. A rate-limited warning counts these readbacks.
What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:flush_and_copyinreadback_rangesleaves the copy out whenwait_forsays the fence was not reached.a_readback_the_wait_gave_up_on_leaves_the_cpu_view_as_it_was. It fills the readback buffer with an earlier readback's bytes, holds the queue on an unsignalled fence, reads back with a 20 ms bound, and checks that the CPU view is unchanged. Once the queue is released, the same readback must bring the bytes the GPU holds (0x3C, uploaded first) into the CPU view. That retry is the check pickles976 asked for; it failed before the stale-wake fix in D3D12.X: a sparse list still in flight after its bounded wait is held, not reset #3062.Tested
cargo build --workspacethencargo test --workspace --no-fail-fast -- --test-threads=4at89bcf0d8: 1468 passed, 0 failed, 47 ignored; 25SKIPPED(no wave64 on this adapter, and one "no heap windows").cargo test -p xcl --lib sparse::: 20 passed, 0 failed, 1 ignored (early_commit_timing, ignored onmaintoo). The new test alone: passed 3 of 3.Regression run
Both 60 s,
XCL_PREPARE=0,XCL_PRESS_AT=25:A, a new emptyXCL_DXIL_CACHEfor each run, the same retail game.main:This PR:
Not tested
main.()throughreadback_ranges/readback_now/readback_after_execute, so callers get no failure receipt.AI use
🤖 Generated with Claude Code