Repository navigation
Conversation
sparse::State::wait_for intentionally returns after 5 s with a warning if the sparse queue stalls, but upload_dirty wrapped wait_for in a while loop waiting for staging ring space. When the oldest in-flight fence failed to advance, reclaim_ring freed nothing and upload_dirty looped forever while holding the global STATE mutex, blocking xcl-activity (pool_bytes) and every submitting thread. Return whether wait_for reached its target fence value, bail out of upload_dirty with a bounded warning on timeout so STATE is released, and add a GPU regression test reproducing a full staging ring with a stalled fence. (cherry picked from commit 0f66820)
|
Independent Windows check on The local fixture logically fills the staging ring, queues a real copy behind a gate fence, and dirties two adjacent 64-byte chunks. The 20 ms upload and allocator waits correctly time out without submitting anything. After releasing the gate, the rescan correctly selects the same 128 bytes and the retry submits. The following wait for fence 4 returns false at completed value 3, with a “5000 ms” warning even though the entire test finished in 0.38–0.50 s. An earlier registration on the shared auto-reset event can still wake this later wait. The focused test reproduced the premature return in 6/6 fresh processes. I then used the unchanged Command: |
|
Update for head Update for head AMD run for the Not tested line. Tested: pass, head
The sparse tests make their device with Not tested: a real stalled sparse queue in a title; Reset/Close failures; Intel. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report. |
|
Under Wine + vkd3d-proton on an RTX 4070, this pull request's Setup:
Not tested: Windows; a ring stall in the title; AI use: Claude Code (Claude Opus 5.5) ran the title and the tests and wrote this comment. Posted without review by a person: the account owner was away and reads replies later. |
|
Suite on RTX 5070 Ti (Windows 11) at Tested
Not tested
AI use
|
|
Ran the stalled-sparse-upload tests at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. Both new tests pass here. They use an unsignalled fence to exercise the timeout path: only the unsubmitted dirty 64-byte chunks are retried, and the stalled allocator is not reset. These are CPU/D3D12-mock tests; no real stalled GPU queue was produced. What this adds: the author's suite ran on an RTX 2070 SUPER. This is a Blackwell host, and the thread has no report from another machine. Not tested: a real stalled sparse queue in the title, injected Reset/Close failures, the full workspace suite, a paired 60 s smoke run, AMD and Intel GPUs, Wine, release profile, title data. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
gut0to
left a comment
There was a problem hiding this comment.
AI-assisted review (OpenAI GPT-6). I traced this timeout path in the diff; I did not run the tests or the game.
| } | ||
| if !dirty_runs.is_empty() { | ||
| s.upload_dirty(&dirty_runs); | ||
| let _ = s.upload_dirty(&dirty_runs); |
There was a problem hiding this comment.
When upload_dirty returns false, retry_dirty_from only marks the unsent CPU chunks for a later scan, but before_execute continues toward the title queue submission. That submission can consume stale VRAM for work depending on these writes. Could this failure path defer the title work or otherwise keep it from executing until the dirty suffix has been uploaded? AI-assisted review (OpenAI GPT-6); I checked this against the timeout/retry flow in this diff and did not run tests or the game.
There was a problem hiding this comment.
No, the title's work still goes ahead: this PR does not hold back ExecuteCommandLists, and doing that is a larger change than this PR. Before #1277 the same stall kept upload_dirty looping with the STATE lock held, so the title hung instead. Now its queue still GPU-waits for every upload that was submitted, and only the chunks left unsent can be stale for work submitted during the stall.
Checking this turned up a real gap: the unsent chunks were marked, but their page was scanned again only when the CPU wrote it again, since its write-watch had already been reset. A page written once stayed stale. D3D12.X: sparse chunks a stalled upload left unsent are scanned again now records those pages and scans them again at the next submit (test unsent_chunks_are_scanned_again_without_a_new_cpu_write, which fails without the change). So the stale window ends at the first submit after the queue moves again. Holding the title's work back is listed under Not tested as not done.
AI use: Claude Code (Claude Opus 5.5) checked this and wrote the change and this reply.
|
The timeout handling is also relevant to the current In one retained Ampere world-transition run, the existing five-second sparse warning occurred with the queue one fence behind shortly before a q0 compute On the same Windows 10 19045 / RTX 3090 Ti host, I ran the exact |
|
Source review of In How often: we saw no sparse fence timeouts or clear failures in ~150 runs on an RTX 5090. It needs a ring that stays busy past its wait, or a failed zero-buffer allocation (a 5 s sparse wait has been reported on Ampere). Not tested: no build or run of this head. AI use: Gemini (Antigravity) found it in a review. Claude Code (Claude Opus 5.5) checked it against |
…event (cherry picked from commit 3861d2e, xcl-dev#1419; on top of xcl-dev#1277, wait_for_ms passes its own timeout to wait_fence_until and keeps returning whether the fence was reached)
|
Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2821 at Setup
Targeted RTX 4060 release unit & GPU tests (
|
The sparse upload ring retried a five-second fence wait forever while holding global sparse state. A stalled upload queue therefore blocked activity reporting and every later title submission permanently.\n\nAdapt xcl-dev#1277's bounded exit, but preserve correctness beyond the source patch: mark exactly the unsubmitted 64-byte chunk suffix for retry instead of leaving its sent hashes stale or invalidating already-submitted chunks in the same page. A synchronous readback aborts when its prerequisite upload did not complete, so it cannot overwrite CPU memory with stale GPU data.\n\nThe Windows GNU library/test cross-check passed with the existing warnings. Windows MSVC runtime, GPU execution, and smoke tests were not available here.\n\nSource diagnosis and timeout test: xcl-dev#1277 by ExoCalibra, assisted by Antigravity (Gemini 4 Neon).\n\nAssisted-by: Codex (GPT-5.6-sol) (cherry picked from commit faea307)
Sparse upload and readback paths continued after a five-second fence timeout, resetting command allocators which the GPU could still be using and publishing readback staging bytes whose copy had not completed. Reset and Close failures were ignored as well.\n\nMake upload-slot acquisition fail closed, retry exact dirty or zero work, and abort readback before allocator reuse or CPU publication whenever its wait or command-list transition fails. The healthy asynchronous path is unchanged.\n\nThe Windows GNU library/test cross-check passed with the existing warnings. Windows MSVC runtime, GPU execution, and smoke tests were not available here.\n\nAssisted-by: Codex (GPT-5.6-sol) (cherry picked from commit 37271a3)
retry_sent_range marks the chunks a stalled upload could not submit as unsent, but before_execute only scans the pages the write-watch reports, and that write-watch was reset when the page was first scanned. The marked chunks therefore stayed stale in video memory until the CPU wrote the same page again, which a page written once may never do. retry_sent_range now records the page, and before_execute scans the recorded pages again with the write-watch's ones. A chunk already sent hashes equal and is not uploaded twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since a failed tile clear goes back to to_zero, before_execute could still upload the submit's CPU writes when the clears found no upload slot or zero buffer. The clears then went out at a later submit, after those writes, and zeroed them: the write-after-write that submitting the clears first is there to avoid. On main a failed clear was dropped. When the clears cannot be submitted, the CPU writes are now marked for the next upload with them, as readback_now already stops in that case. Reported by KDenKC in xcl-dev#2821. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
475341d to
43425fb
Compare
|
Thanks for the reports and reviews.
The description has the new test counts and regression runs. The earlier test reports were made on AI use: Claude Code (Claude Opus 5.5) made the changes, ran the tests and wrote this comment. |
|
Thanks @KOLESNiii, the clear/write ordering is fixed in AI use: Gemini (Antigravity) found it in a review. Claude Code (Claude Opus 5.5) checked it against |
|
Re-ran the sparse-upload tests at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. All four pass here, including the two added in this push ( Not tested: a real stalled sparse queue in the title, injected Reset/Close failures, the full workspace suite, a paired smoke run, AMD and Intel GPUs, native wave64, Wine, release profile, game data. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
Since a failed tile clear goes back to to_zero, before_execute could still upload the submit's CPU writes when the clears found no upload slot or zero buffer. The clears then went out at a later submit, after those writes, and zeroed them: the write-after-write that submitting the clears first is there to avoid. On main a failed clear was dropped. When the clears cannot be submitted, the CPU writes are now marked for the next upload with them, as readback_now already stops in that case. Reported by KDenKC in xcl-dev#2821. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43425fb to
970b8a4
Compare
|
Thanks @KDenKC, confirmed: with tile clears but no CPU writes in a submit, a failed clear sent an empty The full suite and a new smoke run on AI use: Claude Code (Claude Opus 5.5) checked the report, wrote the fix and this reply. |
|
At head Setup as there:
Not tested: Windows; a ring stall or a failed tile clear in the title; the whole test suite. AI use: Claude Code (Claude Opus 5.5) ran the title and the tests and wrote this comment. Posted without review by a person: the account owner was away and reads replies later. |
|
Re-ran the sparse-upload tests at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. All four pass here. The new push adds a bounds guard in Not tested: a real stalled sparse queue, injected Reset/Close failures, the full workspace suite, a paired smoke run, AMD and Intel GPUs, native wave64, Wine, release profile, game data. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
|
Follow-up independent desktop NVIDIA verification of PR #2821 at updated head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib a_stalled_ring_retries_only_the_unsubmitted_dirty_suffix -- --nocapture |
1 passed; 0 failed; 0 ignored; 1341 filtered out (0.00s) |
cargo test --release -p xcl --lib a_stalled_upload_ring_returns_and_retries_exact_chunks -- --nocapture |
1 passed; 0 failed; 0 ignored; 1341 filtered out (0.25s, on-GPU) |
cargo test --release -p xcl --lib unsent_chunks_are_scanned_again_without_a_new_cpu_write -- --nocapture |
1 passed; 0 failed; 0 ignored; 1341 filtered out (0.23s, on-GPU) |
cargo test --release -p xcl --lib cpu_writes_wait_for_tile_clears_that_could_not_be_submitted -- --nocapture |
1 passed; 0 failed; 0 ignored; 1341 filtered out (0.23s, on-GPU) |
cargo test --release -p xcl --lib wait_fence_until_ignores_stale_event_signal -- --nocapture |
1 passed; 0 failed; 0 ignored; 1341 filtered out (0.26s, on-GPU) |
cargo test --release -p xcl --lib upload_dirty_exits_when_ring_fence_wait_times_out -- --nocapture |
1 passed; 0 failed; 0 ignored; 1341 filtered out (0.25s, on-GPU) |
cargo test --release -p xcl --lib hle::d3d12x::sparse:: (3 consecutive runs) |
23 passed; 0 failed; 1 ignored; 1318 filtered out × 3 (0.52s, 0.42s, 0.39s; early_commit_timing is #[ignore]) |
cargo build --release -p xcl --bin xcl |
Clean build (1m 14s, exit 0) |
Paired quiet 60 s retail smoke (title: 29640639)
Merge-base (b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, cached baseline on the same machine):
xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1518 (PresentX 1518)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14018 MB
PR #2821 (970b8a4ad7c5a64e6bb5e605a5cd16ecbd1cb784):
xcl-smoke v1
commit: 970b8a4ad7c5a64e6bb5e605a5cd16ecbd1cb784
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1604 (PresentX 1604)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 13976 MB
Runtime log observations (xcl.log)
9223log lines,0[ERROR]/ device-removal / panic lines, and0sparse-queue stall/timeout warnings.- Active steady-state sparse uploads observed through the full smoke window: last
sparse windows timing:entrywrite-watch 8174 ms (407910 dirty pages), lock wait 1 ms, chunk scan 82 ms, upload 177 ms (52551 runs). - Final draw/memory telemetry in log:
19606 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13975 MB committed by the process; video memory 6115 MB local, 4651 MB non-local; sparse pools 896 MB (838 MB mapped).
Limits of coverage
- The steady-state 60 s retail smoke encountered
0live sparse-queue stalls or fence timeouts, verifying zero steady-state regression across52551sparse upload runs. Stalled-ring reclaim, stale event rejection, unsent-chunk re-scanning, and failed-tile-clear ordering (cpu_writes_wait_for_tile_clears_that_could_not_be_submitted) were verified directly on the RTX 4060 through the 6 targeted tests and 3×hle::d3d12x::sparse::runs (early_commit_timingremained#[ignore]). - Frame-count delta vs. the cached merge-base smoke (
1604vs.1518frames) reflects normal single-run startup variance and is not attributed to this PR.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Stacked on #1277 and #1419; only the top four commits belong here. Part of #1833. This is S1 from the extraction plan in #2787.
#1277 (ExoCalibra) stops
upload_dirtyfrom looping forever, holding the sparseSTATElock, when the staging ring's oldest fence never advances. That loop blockedxcl-activityand every later title submit. #1419 (gridoe) stops a fence wait from returning early on a stale signal of the reused event. ettehn saw that happen after a timed-out wait on this PR. This PR ports #2778's two follow-ups (bmjask) and adds two fixes to the retry:upload_dirtyreturns whether everything was submitted. A synchronousreadback_nowstops instead of copying stale GPU bytes over CPU memory when its upload did not go through.begin_slotreturnsNoneinstead of resetting an allocator the GPU may still be using, and checks Reset/Close results. The readback path stops before Reset or before writing to CPU memory when its wait, Close or Reset fails. Failed zero-fills go back toto_zero. The normal path is unchanged.STATE, KDenKC).The title's own work is not held back while the sparse queue is stalled. Work submitted during the stall can read the chunks left unsent (see gut0to's review thread).
What is in it
D3D12.X: stop sparse upload_dirty ring wait when fence times out: D3D12.X: stop sparse upload_dirty ring wait when fence times out #1277's commit, author kept. For currentmain, I added the twoStatefieldsmainhas since gained (quarantined,queue_fences) to its test's initializer. Without them the test does not compile. D3D12.X: stop sparse upload_dirty ring wait when fence times out #1277 needs the same fix when it is rebased.D3D12.X: wait_for ignores stale signals on the reusable sparse fence event: D3D12.X: wait_for ignores stale signals on the reusable sparse fence event #1419's commit, author kept. On top of D3D12.X: stop sparse upload_dirty ring wait when fence times out #1277,wait_for_mspasses its own timeout towait_fence_untiland still returns whether the fence was reached.D3D12.X: stop stalled sparse ring reclaim cleanly(crates/xcl/src/hle/d3d12x/sparse.rs), ported fromfaea307a. The conflicts were resolved by hand: Bmjask/ultra performance redesign #2778'sstalltracing span and its quarantine-fence helpers are left out. Tests:a_stalled_ring_retries_only_the_unsubmitted_dirty_suffix,a_stalled_upload_ring_returns_and_retries_exact_chunks.D3D12.X: abort sparse allocator reuse after wait failure(same file), ported from37271a3c. It keepsmain's readbackExecuteCommandListscall, not Bmjask/ultra performance redesign #2778'snative_queue_execute. The stalled-ring test also checks that a slot whose wait timed out is not reset.D3D12.X: sparse chunks a stalled upload left unsent are scanned again(same file):retry_pages,scan_retry_pages. Test:unsent_chunks_are_scanned_again_without_a_new_cpu_write.D3D12.X: sparse CPU writes wait for tile clears that could not be sent(same file):upload_zeros_then_dirty. Tests:cpu_writes_wait_for_tile_clears_that_could_not_be_submitted, and the empty-runs case ina_stalled_ring_retries_only_the_unsubmitted_dirty_suffix.Tested
cargo test --workspace -- --test-threads=4on970b8a4a: 1441 passed, 0 failed, 47 ignoredSKIPPEDon this adapter: 24 recompiler GPU tests withno wave64(or the wave32 per-lane form refused), andheap_window_out_of_memory_falls_back_to_the_switch_formwithno heap windowscargo test -p xcl --lib hle::d3d12x::sparse -- --test-threads=1: 23 passed, 0 failed, 1 ignored (early_commit_timing)the unsent chunks were not found again, andupload_zeros_then_dirtyreturning true because the CPU writes were submitted)cargo test -p xcl --lib --no-run)sparsefilter run above was on43425fba; the empty-runs guard was squashed in after it.475341d1, including an AMD RX 9070 XT run of the sparse tests (DarkPanda69). They do not cover the last two commits or D3D12.X: wait_for ignores stale signals on the reusable sparse fence event #1419's.Regression run
Both runs with
XCL_PRESS_AT=15:A.main:This PR:
Neither run logged a
sparse:warning, so no fence wait timed out and the new failure paths were not reached. The PR's run went through the normal upload path (sparse windows: 4096 submits, 1671 MB of CPU writes uploadedat 42 s).Not tested
AI use
🤖 Generated with Claude Code