D3D12.X: stop sparse upload_dirty ring wait when fence times out #1267
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1277"
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 ivall/xcl. Originally posted by ExoCalibra on 2026-11-24T14:08:47Z.
sparse::State::wait_forreturns after 5 s with a warning if the sparse upload queue stalls, butupload_dirtycalledwait_for(fv)inside awhileloop waiting for staging ring space. When the oldest in-flight fence failed to advance,reclaim_ringfreed nothing andupload_dirtylooped forever while holding the globalSTATEmutex, hangingxcl-activity(sparse::pool_bytes) and every subsequent submit thread permanently.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs: return whetherwait_forreached its target fence value, break out ofupload_dirtywith a bounded warning on timeout soSTATEis released cleanly, and add GPU regression testupload_dirty_exits_when_ring_fence_wait_times_out.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), debug (scripts/test.ps1) + release (cargo build --release -p xcl)..\scripts\test.ps1(cargo test --workspace -- --test-threads=4): 742 passed, 0 failed, 41 ignored.SKIPPEDGPU tests on this adapter: 2 (no wave64—gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware).Regression run
Main (
67a3735):PR (
0f66820):Not tested
upload_dirty_exits_when_ring_fence_wait_times_out) and did not trigger during the healthy 60 s retail smoke run.XCL_SAMPLE_*tests on local sample files (not set).AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T14:10:02Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib sparse: 17 passed, 0 failed, 1 ignored.Thanks!
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:38:03Z.
Full-suite run to go with the subset check above. Tested exact head
0f66820(on its base47efa2e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.upload_dirty_exits_when_ring_fence_wait_times_out.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
Imported from ivall/xcl. Originally posted by WebIdentity1 on 2026-11-24T17:08:14Z.
Independent native recovery check: this branch reproduces the dropped-upload risk already described by #1385's author. Exact head
0f66820065129bca1e0cd7f3ae0125e140d835f3; exact parent47efa2ecea0a12934719ae69b81930cf02a4b1c3.Tested
The same fixture used for #1495, unchanged (SHA256
1fd8f7d154e9663b25d9fe98153fccd2bc8de5291db5aa24414e48f3ddfaa958): fill the real64MiB staging ring behind a controlled queue fence with0x11, change a4KiB page to0x22, wait through the actual5-second timeout, release the gate, explicitly retry that same dirty page, then read all1,024words from the GPU. A six-second recovery guard lets the parent finish without an infinite wait.No skips or harness timeouts. Head exits101 on the byte assertion; parent exits0. All wrong head words are the old0x11111111. Head ring_write stays67108864 through timeout and retry; parent advances to67112960. Invalidating only the page's
senthashes and explicitly retrying the unchanged bytes yields0wrong on both GPUs. Queue drain/device-removal checks succeed; cleanup occurs before the failing assertion.scan_pageupdates the hashes before upload, and the new early return loses the remaining bytes whilebefore_executeclears its dirty runs. The next same-page retry sees matching hashes and stages nothing. Invalidation alone is not a complete fix: normal write-watch scans reset their records, so the next dirty-page list need not include the page. Retain pending uploads or propagate the failure. #1385 already proposes keeping pending work while releasing STATE during waits; native validation of that alternative now passes the byte-recovery and existing lock-progress tests on RTX3090 and AMD, with exact-parent controls. These focused results do not establish full merge readiness.Fresh process for each run,
XCL_ADAPTER=3090/AMD:cargo test --locked -p xcl --lib timed_out_sparse_upload_retries_unsent_bytes -- --test-threads=1 --show-output --nocaptureWindows10 Home19045, Ryzen7 7800X3D, RTX3090 driver591.74 / AMD Radeon integrated32.0.21030.2001, Rust1.98.1 MSVC, Agility1.620.2, debug, SSH Session0. All222source-file hashes match each tree; parent/head differ only in sparse.rs, plus identical diagnostic wiring. Restored head verified. Patch reverse-apply and diff checks pass.
Not tested
Full workspace with this fixture, retail /
xcl-smoke, actual device loss, partial multi-run suffixes, release, Linux/Wine. The existing timeout test demonstrates bounded return; this additional test checks recovery bytes. The parent control does not endorse repeated waits under STATE. Run alone because the fixture initializes sparse globals. No competing runtime implementation or PR.AI use
Codex (GPT-6) inspected the overlap, adapted diagnostic wiring, ran tests and prepared this report. Synthetic bytes/public source only.
Complete diagnostic patch against0f66820
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T11:42:17Z.
Test report for head
0f66820as pushed (not merged onto currentmain) – NVIDIA, wave32.Tested
.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 742 passed, 0 failed, 41 ignoredupload_dirty_exits_when_ring_fence_wait_times_outran and passedXCL_SAMPLE_*data set (game-data tests not run)Not tested
mainAI use
Imported from ivall/xcl. Originally posted by 4usphs on 2026-11-25T11:52:39Z.
AMD run on the exact head
0f66820(0f66820065), as pushed on its base47efa2e(not merged onto currentmain), on two AMD adapters with native 64-lane waves: RDNA4 and the console's generation, RDNA2.Tested
XCL_TRANSLATED_CACHE=0; adapter picked withXCL_ADAPTER.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4:gfx1036), driver 32.0.21045.29003: 742 passed, 0 failed, 41 ignoredSKIPPEDtests on either adapter.upload_dirty_exits_when_ring_fence_wait_times_outruns and passes on both adapters.Not tested
AI use
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-25T12:19:36Z.
Linux / AMD RDNA4 (RADV) test report for head
0f66820merged locally ontomain1a0bbe3(clean merge).Environment
experimental-11.0-20261112), vkd3d-proton v3.1 (#257+dxil-spirv53aac418), DXVKv3.1.1-209, DXC1.9.2609.5,x86_64-pc-windows-gnucross-compileTested (debug test binary under Wine,
XCL_ADAPTER=9070 XCL_REQUIRE_GPU=wave64,--test-threads=1 --nocapture)hle::d3d12x::sparse: 16 passed, 0 failed, 1 ignored (early_commit_timing), 0 skipped (2.31 s), includingupload_dirty_exits_when_ring_fence_wait_times_outon RX 9070 / RADV.Not tested: full workspace suite, retail title run, native Windows.
AI use: T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T13:19:13Z.
AMD RDNA3 (native wave64) test report for exact head
0f66820065129bca1e0cd7f3ae0125e140d835f3, as pushed on its base47efa2e(not merged onto currentmain).Tested
cargo build --workspace: okupload_dirty_exits_when_ring_fence_wait_times_out: 1 passed;sparsefilter: 17 passed, 0 failed, 1 ignoredcargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored (summed over all test binaries)Not tested
scripts/smoke.ps1regression run (synthetic GPU/unit tests only)main; other GPUs (NVIDIA / Intel / RDNA2 / RDNA4)AI use: Claude Code (Claude Sonnet 5.5) ran the build and tests and wrote this report; the numbers are from the runs above.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:40:56Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T13:08:40Z.
Independent desktop NVIDIA verification of PR #1277 at head
0f66820065129bca1e0cd7f3ae0125e140d835f3(1commit; exact parent & merge-base:47efa2ecea0a12934719ae69b81930cf02a4b1c3, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted tests & build (
0f668200)cargo test --release -p xcl --lib -- --nocapture upload_dirty_exits_when_ring_fence_wait_times_out(3 consecutive runs)1 passed; 0 failed; 0 ignored; 719 filtered out× 3 (0.30s,0.28s,0.27s,0skipped; live RTX 4060 D3D12 device + reserved buffer, timed out after 50 ms on unsignaled fence 1 and returned cleanly with ring/inflight invariants intact)cargo test --release -p xcl --lib -- --nocapture hle::d3d12x::sparse::(3 consecutive runs)14 passed; 0 failed; 1 ignored; 705 filtered out× 3 (0.34s,0.34s,0.35s,0runtime skips;1pre-existing#[ignore]timing harnessearly_commit_timing)cargo build --release -p xcl1m 13s, exit0,0new warnings insparse.rs)Paired quiet 60 s retail smoke (
title: 29640639)(Note:
scripts/smoke.ps1at47efa2ecpredates9683e7a6and printed the local folder basename ontitle:; replaced below with the standard9683e7a6title hash29640639, with all measured fields verbatim.)Exact parent & merge-base (
47efa2ecea0a12934719ae69b81930cf02a4b1c3, cached baseline on the same machine):PR #1277 (
0f66820065129bca1e0cd7f3ae0125e140d835f3):Limits of coverage
upload_dirty_exits_when_ring_fence_wait_times_outand all14activehle::d3d12x::sparse::tests (14/14executed,0runtime skips;1pre-existing#[ignore]early_commit_timing) passed3/3on live RTX 4060 D3D12 reserved resources, directly verifyingwait_for_mstimeout handling and cleanupload_dirty_with_timeoutbail-out under a synthetic 50 ms stalled-fence condition.0device removals,0crashes, steady 60 Hz) without encountering a real 5 s GPU queue stall in flight; single-run frame/commit delta vs. the cached parent reflects normal startup variance.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:18:52Z.
Triage (#1607) – head
0f66820Main already has this fix. Commit
711ff3ef'D3D12.X: stop stalled sparse ring reclaim cleanly' adapts the bounded exit from this PR and credits #1277. It also marks the unsubmitted chunks for retry, where this patch's earlyreturnfromupload_dirty_with_timeoutleaves them stale. Since then,86bad822has replaced the ring wait entirely:ring_roomin sparse.rs returns a wait ticket and releases the sparse state, andwait_for_msnow returns bool. The branch also conflicts with main.#1495 (closed) attempted the same bounded wait.
Recommendation: close (superseded by main commit
711ff3ef).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:44:12Z.
Closing as superseded: this change is already on
main(711ff3ef).711ff3ef(adapts #1277, credits it) bounds the sparse ring wait; main since moved to wait tickets (86bad822, sparse.rs ring_room returns UploadStep::Wait) so STATE is no longer held foreverTwo independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed