D3D12.X: fence reclaimed VRAM heaps across all live queues and isolate arenas by device #2275
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2275
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2275/head"
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?
@Decodere on GitHub · 2026-11-25 12:02 UTC · original
Decodere:fix-1985-vram-retire-multiqueue→main· +205 −91 · 1 files · 1 commits · merged 2026-11-25 18:15 UTCWhat is in it
Follow-up to #1985 (
Part of #1773) fixing three lifetime/isolation gaps incrates/xcl/src/hle/d3d12x/vram.rs:RetireQueue): Replaces the single-queue(retire_fence, retire_value, retiring)fields onPageswith a per-deviceRetireQueue<ID3D12Heap, ID3D12Fence>(static RETIRE, gated on the hot path byRETIRING_BATCHES). On retirement,collect_device_queuesgathers all known live queues belonging to the same device (extraexecuting queue,present::known_queues(),title_textures::upload_queues(), andsparse::queue(), deduplicated by raw pointer and filtered byGetDevice() == dev_key). Each queue gets its own monotonically signaled(ID3D12Fence, u64)mark before the sealedRetiringBatchis pushed; a batch is reaped only once both its optionalunmap_markand every per-queue mark have completed. Cached fences for queues no longer in the live set are pruned once their last signaled value completes, and every finishedID3D12Heap, completed batch fence ref, and prunedID3D12Fenceis dropped strictly outside all locks.ARENAS.lock():Arenas::take_fornow returns(Option<(H, usize, u64)>, Vec<H>)instead of dropping expired arena heaps synchronously insideARENAS.lock().vram::placeretires returned expired heaps viaretire_heaps_and_sweepoutsideARENAS.lock()(dropping immediately outside locks only when zero live queues exist on the device).Arena<H>now recordsdev: usize, and bothtake_for(dev, ...)andsweep_dropped_for(dev, now)filter bydevso multiple D3D12 devices never alias or sweep each other's arenas at matching title virtual addresses.Tested
Arenas::takesynchronously dropped expired arena heaps insideARENAS.lock()(DropFlagdrop count1instead of0before returning fromtake).crates/xcl/src/hle/d3d12x/vram.rs:arenas_isolate_devices_and_take_for_returns_expired_heaps(pure CPU): verifies device isolation at identical VAs and deferred drop of expired arenas returned bytake_for/sweep_dropped_for.retire_queue_waits_for_all_queues_and_prunes_dead_queue_fences(pure CPU): verifies multi-queue +unmap_markgating, out-of-order queue completion, outside-lock retention of completed batch fence refs, dead-queue fence pruning only after completion, and immediate return with zero queues.gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark(D3D12, guarded byVRAM_TEST_LOCKandskip_testif no D3D12 device is available): creates two real D3D12 queues on one device, blocksQ1behind an unsignaledgatefence whileQ2finishes past its mark, verifies theID3D12Heapstays alive whileQ1is blocked, then signalsgateand verifies the heap drops outsidesweep_withandQ2's dead-queue fence is pruned.cargo test --release -p xcl --lib hle::d3d12x::vram::tests:: -- --test-threads=1 --nocaptureon RTX 4060 and withXCL_ADAPTER="Microsoft Basic Render Driver"/XCL_ADAPTER=warp:18 passed, 0 failed, 1 ignored(churn_update_tile_mappings_timing),0skipped.cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocaptureon RTX 4060):23test binaries,1253 passed, 0 failed, 46 ignored(27pre-existing runtimeSKIPPED:20no wave64on 32-lane GPU,3wave32 per-lanerefused,2missing D3D12 debug layer,1driver cache toggle,1no heap windows;0skipped invram::tests).Regression run
Paired 60 s
scripts/smoke.ps1runs on the same RTX 4060 host againstorigin/main(1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6) and PR head (11aa227bc569f94f24f57a621909be7968070327):Baseline (
origin/main):PR head:
Not tested
d3d12SDKLayers.dllis not installed on this machine) and the#[ignore]microbenchmarkchurn_update_tile_mappings_timing.AI use
Implemented and verified with Google Antigravity (Gemini 4 Neon).
Part of #1773
@thehollowedone on GitHub · 2026-11-25 15:04 UTC · original
Independent Windows check of 11aa227 on an RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC and DXC 1.8.2502.11.
Synthetic tests only. AI-assisted. Codex (GPT-6, exact variant unavailable) instrumented the focused test, ran the checks and drafted this report.
@thiagocalile on GitHub · 2026-11-25 16:25 UTC · original
Independent test and 60 s smoke report for head
11aa227bc569f94f24f57a621909be7968070327on an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native wave64).Tested
32.0.21045.29003,XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11.XCL_ADAPTER=radeon cargo test --no-fail-fast -p xcl --lib -- vram --test-threads=4: 20 passed, 0 failed, 1 ignored (0skipped).Regression run (
scripts/smoke.ps1 -Seconds 60, release builds,XCL_ADAPTER=radeon)main(06c9f55):PR
#2275(11aa227):Not tested: full workspace test suite on this head, NVIDIA/Intel GPUs, Linux/Wine, or world load past the 60 s smoke window.
AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting.
@amazedturnip on GitHub · 2026-11-25 16:32 UTC · original
Independent AMD Radeon (native wave64) verification of exact head
11aa227bc569f94f24f57a621909be7968070327(clean detached worktree, compared againstmain3f4495a2b325).Tested
AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64)(XCL_ADAPTER=radeon, native wave64)cargo test -p xcl --lib hle::d3d12x::vram -- --test-threads=2— 18 passed, 0 failed, 1 ignored (exit 0)Regression run (
scripts/smoke.ps1 -Seconds 60, release build,XCL_ADAPTER=radeon)main:
PR:
Not tested
AI use
@DavidM1911 on GitHub · 2026-11-25 17:05 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@DarkPanda69 on GitHub · 2026-11-25 12:20 UTC · original · edited 2026-11-25 19:29 UTC
Correction:
gpu_retire_queue_holds_heap_until_blocked_queue_passes_markcreates its device withagility::create_device(None, ..), so it runs on DXGI adapter 0, which on this machine is the RX 9070 XT, whateverXCL_ADAPTERsays. Both runs of that test below were on the RX 9070 XT: the AMD result stands, but the RTX 3060 line for this test is not an RTX 3060 result. The per-cardgpu::counts are unaffected.AMD run (listed as untested), plus an RTX 3060: the new GPU test passes on both.
Head
11aa227applied onmain1a0bbe3, debug, Windows 11 Pro 26200,XCL_ADAPTERset to each card:gpu_retire_queue_holds_heap_until_blocked_queue_passes_markok. Wholegpu::filter: 629 passed, 2 failed, 22 ignored, the same as onmain; the 2 failures are the AMD fuzz seeds 722 and 1599 tracked in #2115.gpu::631 passed, 0 failed, 22 ignored.Not tested: a multi-device title, the D3D12 debug layer, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.