D3D12.X: a held last Release gives the resource's unified memory / sparse tiles back while the queues still use it #1033
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 DTsordas on 2026-11-24T10:47:27Z.
Since
e7da8a1(late release),res_releaseholds a resource whose lastReleasecomes while a queue may still have work on it. But the cleanup in the same call still runs at once (crates/xcl/src/hle/d3d12x/real.rs,res_release):u.free(p)puts the unified-memory block XCL placed under the resource back on the free list, so the next buffer or texture XCL places can get it while the GPU still reads or writes it for the held one;sparse::free(p)decommits the pages and gives the address range back, andsparse::forget_bufferunpins the buffer's tiles (release_if_unused). The held resource's in-flight work then reads unmapped tiles or loses its writes.The hold exists for exactly this case:
e7da8a1measured 356 held last releases on the retail title.Reproduced on main
e74dda2with a unit test. It stalls a known queue (Waiton a fence nobody signals), places an adopted buffer on a unified-memory block asplace_console_bufferrecords it, and does the title's lastReleasethroughres_release: the block is free again before the queue has moved on.I have a fix. Bookkeeping is still dropped at the title's
Release; a held resource's block and tile pins go tolate_release, which gives them back when the resource goes. The full suite passes with it on an RX 9060 XT (debug,cargo test --workspace --no-fail-fast -- --test-threads=4: 728 passed, 0 failed, 41 ignored, 0 SKIPPED). I'll open the PR once I have the smoke runs on a title.AI use: found, reproduced and written up with Claude Code (Claude Opus 5.5).