D3D12.X: mem_heap_release frees HEAP_UMA backing immediately while placed resources may still be in flight #1394
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#1394
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?
@microwave805 on GitHub · 2026-11-24 15:31 UTC · original
Checked on
main(930e8b4).Problem
Unlike
res_release(which holds a resource's finalReleasevialate_release::hold— and PR #1070 defers its backing-memory teardown),mem_heap_release(crates/xcl/src/hle/d3d12x/real.rs:3007-3021) destroys theID3D12Heapand immediately frees itsHEAP_UMAblock without waiting for in-flight GPU work or held placed resources:u.free(p)(gpu/uma.rs:575-604) immediately returns the memory toUma::inner.free, where the nextu.alloc()zeroes (write_bytesatuma.rs:569) and reuses it.sparse::free(p)immediately parks/unmaps tiles, decommits virtual pages (MEM_DECOMMIT), and releases the sparse address range.Minimal trigger
ID3D12Heapbacked byHEAP_UMA, places a resourceRon it, submits GPU work referencingR, and releases bothRand the heap while the GPU queue is busy (a common pattern;Ris kept alive bylate_release, orRis still referenced by in-flight command lists).mem_heap_releaseseesn == 0and immediately frees/decommits/zeroes the heap's backing UMA/sparse block while the GPU is still accessingR.(Checked #1040 / PR #1070 — neither touches
mem_heap_releaseorHEAP_UMA.)Suggested fix
Hold the final
ID3D12Heaprelease and defer freeing itsHEAP_UMAblock throughlate_releaseuntil in-flight GPU queues have passed.AI use: Antigravity (Gemini 4 Neon) performed the read-only source audit and drafted this issue; checked and verified on
930e8b4before opening.github-bot referenced this issue2026-11-26 04:54:25 +00:00
@ySKELLETONX on GitHub · 2026-11-24 16:06 UTC · original
I'll take this, stacked on #1070 (it gives
late_release::holdthe block to free once the queues are past):mem_heap_releaseholds the heap's lastReleasethe wayres_releasedoes and passes itsHEAP_UMAblock along, so a heap released while a queue still has work keeps its block until the queues are past it. With a GPU test like #1070's (a queue held on a fence: the block stays allocated until the fence is signalled).Written with Claude Code (Claude Opus 5.5).