Repository navigation
D3D12.X: reuse a retired sparse pool once its unmap fence has completed - #930
DavidM1911 wants to merge 2 commits into
Conversation
retire_free_pools parks a fully-free 64 MiB heap for at least 2 s, but take_tile only popped the free list or created a new heap, so an alloc/free cycle inside that window minted a fresh heap each time — the lib test from xcl-dev#348 asked a 12 GB card for ~18 GB. take_tile now adopts the oldest retired heap whose fence value has completed; heaps still inside their window stay retired.
|
Resolved on On Reproduced on native Windows (RTX 5070 Ti Laptop) with the pool-retirement test from #923 and a D3D12 fence explicitly completed at the pool's retirement value. The fresh heap correctly returned 12 GB VRAM measurements on clean heads. I ran the debug library suite ( OpenAI Codex (GPT-6.2 Astra) assisted with verification. Originally posted by @ettehn in #930 (comment) Originally posted by @ettehn in #930 (comment) |
|
This patch fails the sparse e2e check on Windows, twice in a row, with the same value:
Environment: Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, AI-assisted (opencode): applied the patch to a built tree, ran the suite twice, reverted it. |
RX 590 on native Windows: sparse-upload e2e passes on
|
|
Heads-up: my failure above was measured on |
|
Retraction on the current pair: the failure does not reproduce, and my earlier comment was against stale SHAs. On this box, same machine and command, in the same tree: The sparse e2e check ( Environment unchanged: Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, AI-assisted (opencode): rebuilt on the new base, ran both pairs, reverted. |
Fixes #913.
retire_free_poolsparks a fully-free 64 MiB pool heap for at least 2 s, buttake_tileonly ever poppedself.freeor calledCreateHeap— it never looked atretired. An alloc/free cycle inside that window therefore minted a fresh 64 MiB heap every time: the #348 lib test asked a 12 GB card for ~18 GB of pools.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs: the pool-placement tail oftake_tileis factored intoadopt_heap; beforeCreateHeap,take_tilenow adopts the oldest retired heap whose unmap fence value has already completed (GetCompletedValue() >= retired.value). Heaps still inside their fence/age window stay retired, so the decommit-before-reuse ordering from Memory: a freed sparse block is decommitted before its address is reused #348 is preserved, andretire_free_poolsstill shrinkspools/freethe same way.Tested
x86_64-pc-windows-msvc, rebased onmain09940bb:cargo test -p xcl --lib sparse: 13 passed, 0 failed, 1 ignoredcargo test -p xcl --lib -- --test-threads=4: 675 passed, 0 failed, 21 ignored (one earlier parallel run hit the knowncoherent_buffer_sanitizes_console_flags_and_stateflake reported in Memory: a sparse alloc/free loop makes a new 64 MiB pool each cycle; lib tests fill a 12 GB card (#348's test) #913; it passes standalone and on rerun)cargo test --workspace -- --test-threads=4: 694 passed, 1 failed (same flake), 25 ignoredscripts/smoke.ps1 -Seconds 60,cargo build --release -p xcl:main
a6f5f7abaseline is stale relative to the rebase; closest fresh main smoke on this machine:this PR's head
bd2e4c6:Not tested
take_tile/retire_free_poolsvs decommit parking); whichever lands second may need a small rebaseAI use