Repository navigation
D3D12.X: flush pending tile mappings before submit and fix VRAM unmap/retire races - #2981
Saksukella wants to merge 2 commits into
Conversation
|
Tested on unmodified PR head
The blocked-queue retirement and sparse fixtures use the D3D12 default adapter, which I checked is the integrated Radeon on this machine. Not tested — The full workspace suite, retail-title smoke, the streaming race on RX 6800M, or a comparison with upstream main. AI use — Codex (GPT-6, exact variant unavailable) selected and ran the tests and wrote this report. |
|
Tested (retail title, RX 6800): not the clean PR tree. This PR's three files (
Not tested: the clean PR head, the test suite on this tree, AI use: Claude Code with Claude Fable 5.2 ran the title, read the logs and wrote this report. |
|
Updated RX 9070 / Wine check on RX 9070 16 GB (RADV GFX1201), Ryzen 7 7700, CachyOS kernel 7.3.6-1-cachyos, Mesa 26.3.1-5, GE-Proton11-12 / Wine 11.0 Staging, ntsync. Native vkd3d-proton Tested The four new tests each passed in a separate fresh process (1 passed / 0 failed), then together at both Under
Also
18 processes total. Copied source trees, original assertions unchanged; only passive test observations and the local native fixture added. The last filter is a local fixture using actual Earlier result retained: my original Not tested: full AI use: OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed both public revisions, added passive adapter/state observations, ran the new tests and native controls, independently checked the results, and updated this report. Publication authorized by the account owner. |
|
Rerun on the new head Same machine.
NVIDIA run (listed under Not tested): no new failure compared with Tested:
The new tests run a copy of each fix rather than the code that ships:
If you want the field order guarded, a test on Not tested: a title on NVIDIA with this branch, a release build, Intel, a long run. AI use: Claude Code (Claude Opus 5.5) ran the tests and the scratch mutations and wrote this report. |
|
Linux (Wine) run of #2981 on the NVIDIA+Wine lane: your fixes do not change this branch's behavior there - the suite still dies at the same place. Boxb (i5-10600K, 16 GB DDR4, GTX 1070 8 GB, 550.163.01, Debian 13, wine-10.0, xvfb),
Solo deadlock test at tip AMD+Wine lane (rig, RX 7900 XT, wine-11.0 Proton) cannot complete any recent amd-dev suite (dies partway), so no rig numbers for this one. AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting. |
|
Follow-up to the independent NVIDIA mutation check: I verified a small way for the existing retirement test to guard the production type's field order, rather than a separate On #2981 head
Candidate test-only diff (production behavior unchanged)--- a/crates/xcl/src/hle/d3d12x/vram.rs
+++ b/crates/xcl/src/hle/d3d12x/vram.rs
@@
-struct RetiringHeap {
- _zero_buf: Option<ID3D12Resource>,
- _heap: ID3D12Heap,
+struct RetiringHeap<Z = ID3D12Resource, H = ID3D12Heap> {
+ _zero_buf: Option<Z>,
+ _heap: H,
}
@@
- struct FakeRetiringHeap {
- _zero_buf: Option<DropTracker>,
- _heap: DropTracker,
- }
let dropped = Arc::new(AtomicUsize::new(0));
let order = Arc::new(std::sync::Mutex::new(Vec::new()));
- let item = FakeRetiringHeap {
+ let item = RetiringHeap {
_zero_buf: Some(DropTracker(dropped.clone(), "zero_buf", order.clone())),
_heap: DropTracker(dropped.clone(), "heap", order.clone()),
};
- let mut rq: RetireQueue<FakeRetiringHeap, Arc<AtomicU64>> = RetireQueue::new();
+ let mut rq: RetireQueue<RetiringHeap<DropTracker, DropTracker>, Arc<AtomicU64>> = RetireQueue::new();This covers the field-order regression only. It does not establish the native COM lifetime, the late mapping wait, or the unmap snapshot race; those still need their own production-path evidence. No title executable or full workspace suite was run for this candidate. AI use: Codex (GPT-6.2 Sol) reviewed the code, wrote the local diff, and ran the passing and mutation checks. |
…ecycle_ready, and take_heap paths directly
|
Thanks @fromthemoonx and @thehollowedone! Pushed shipped-code tests directly exercising \seal_and_drain_unmaps_with, \�ram::wait_pending_mappings, \�ram::recycle_ready, \sparse::wait_pending_mappings, and \PoolHeaps::take_heap\ + \RetiringHeap\ COM refcount retention (\39/39\ \�ram, \38/38\ \sparse\ passed on RX 9070 XT). |
|
Clean-tree title A/B on an RX 6800 (RDNA2): with Setup: RX 6800 16 GB, driver 32.0.21045.5002, i5-10600KF, 32 GB, Windows 11 Pro 26200, release builds of
Not tested: AI use: Claude Code (Claude Opus 5.5) ran the A/B through a local test runner, read the logs and wrote this comment. Update, on the current
So on this card the two clean 300 s runs above came from runs that were simply shorter than the reset, which happens at 330-350 s here. With 600 s runs the PR did not remove the reset. Please read the earlier table as "no reset within 300 s", not as a fix. |
|
RDNA3 / Windows data for #2981 at the new head: 0 of 3 600 s runs hung with it; on the same setup the amd-dev tree hung in 1 of 3. That is "no hang seen in 3 runs", not a fix claim. RDNA2 counterpart: vibryxcx's run above (7214590553). Setup: RX 7800 XT 16 GB (RDNA3), driver 32.0.31035.1003, Ryzen 7 5700X3D, 64 GB, Windows 11 build 26200, DXC 1.8.2502.11, release builds, the same retail title.
Not tested: more than 3 runs per arm (1 vs 0 hangs is not a difference), DRED, a cold cache, other GPUs. AI use: Claude Code (Claude Sonnet 5.5) built the trees, ran the title, read the logs and wrote this comment. Every number comes from those runs. |
|
Second RX 9070 XT data point, matching @bobosneefdev's RX 6800 run above: with this PR the device removal and Setup: RX 9070 XT 16 GB, Windows 10 22H2 (19045), i7-9700K, 32 GB RAM. Release build of ecbbf96 plus bfb4031 (amd-dev, cherry-picked) plus the #662 XG fix.
So on this machine, with the PR the title queues go idle, and the stuck work is on XCL's own upload, page and sparse queues. One run only, so the order may vary. Next I'm testing Tested with Claude Code (Claude Opus 5.5). The lines are from the run logs. |
Port the mapping and retirement changes from #2981. Seal only the unmaps covered by the queue signals and keep zero-buffer aliases alive through retirement. Assisted-by: Codex (exact model identifier unavailable)
|
Independent test report under Wine/Proton (not native Windows) for head Setup
Tests (debug,
Retail title, 300 s (release;
Not tested
AI use
|
Fixes four tile-mapping synchronization and VRAM retirement races that caused deterministic
DXGI_ERROR_DEVICE_HUNG(0x887A0006) GPU page faults during world streaming on AMD RDNA 4 (RX 9070 XT).Root causes & fixes (
real.rs,sparse.rs,vram.rs)record_deferredtile-mapping flush & wait (real.rs,sparse.rs,vram.rs):q_execute_command_listsflushedsparseandvramtile mappings viatitle_textures::refreshbeforelist_x::record_deferred, which can block for several milliseconds while compiling pipelines.UpdateTileMappingsor recycled-tile zero-fills queued on another thread during thatrecord_deferredwindow were never flushed or waited on beforeexecute_with_waits_on, letting active dispatches read pages whose tile mappings or GPU zero-fills were still in flight.sparse::wait_pending_mappings(q)andvram::wait_pending_mappings(q)right beforeexecute_with_waits_on(returns immediately with 0 signals / 0 waits when no concurrent thread dirtied mappings duringrecord_deferred).seal_and_drain_unmapsTOCTOU & missingflush_signal(vram.rs):seal_and_drain_unmapspreviously droppedPAGES.lock(), calledsignal_device_queues, re-acquired the lock, and only then calledstd::mem::take(&mut pages.unsealed_unmaps)— attaching concurrent unmaps pushed after the signal to stale fence marks soUpdateTileMappings(NULL)could unmap tiles while a newer title submit was still reading them.unsealed_unmapsbefore releasingPAGES.lock()(seal_snapshot_ops) and flushespages.flush_signal()wheneverpages.dirty_signalis true (coveringPendingUnmapOp::Tiles).recycle_readyunsignaled unmap (vram.rs):pages.flush_signal()immediately afterpages.unmap(res, info.total)before pushing the recycled resource back intoreserved_pool.zero_buflifetime (vram.rs):PoolHeaps::take_heapnow returns(ID3D12Heap, Option<ID3D12Resource>)and retires both insideRetiringHeap { _zero_buf, _heap }inRetireQueue(dropping_zero_bufbefore its backing_heap) instead of dropping the placed alias buffer underPAGES.lock()while still in flight.Tested
amd-dev(bf7c82ee+ebef6042,--test-threads=1, 0 new warnings):cargo test -p xcl --lib hle::d3d12x::vram -- --test-threads=1:36 passed; 0 failed; 1 ignored, including 3 new pure-CPU regression tests:seal_and_drain_unmaps_does_not_attach_stale_marks_to_concurrent_unmapswait_pending_mappings_flushes_post_refresh_dirty_signalretire_queue_keeps_zero_buf_alive_until_marks_completecargo test -p xcl --lib hle::d3d12x::sparse -- --test-threads=1:37 passed; 0 failed; 1 ignored73 passed; 0 failed; 2 ignored.XCL_DIRECT_DXIL=1 XCL_PER_LANE=1 XCL_RT_GATE=miss XCL_DRED=1 XCL_GPU_CULPRIT=1):71b8e6e0base): deterministic0x887A0006DRED page fault (VA 0x1c7103000) att=100.7swithvram pages queuework pending during arecord_deferredwindow.amd-dev(bf7c82ee+ebef6042): survived full 240.04 s (1,464frames,00x887A0006,00x887A0005,0DRED page faults,0crashes,0exceptions).Not tested
Regression run
Baseline (
main,b49be183):This PR (
ebef6042onamd-devbf7c82ee):AI use