D3D12.X: alloc_reset frees UMA/sparse shader argument tables while alloc_pool keeps a busy allocator aside #1358
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#1358
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:12 UTC · original
Checked on
main(930e8b4).Problem
bind::bind_abi(bind.rs:862-881) andbind::allocate_upload_memory(bind.rs:818-842) allocate per-draw translated shaderio/root-argument tables andAllocateUploadMemorybuffers intoState.uma, tracked against the title allocator pointer. When a command list is reset onto another allocator, split, or released,bind::reset/forgetmoves those blocks intoconsole_list::PENDING[title_alloc].When the title calls
ID3D12CommandAllocator::Reset(),alloc_pool::title_reset(this)(alloc_pool.rs:195-259) intentionally puts the busy PC allocator aside and returnsSome(0)(S_OK) specifically because recordings on it are still held by lists or still executing on the GPU. However,real::alloc_reset(crates/xcl/src/hle/d3d12x/real.rs:4997-5008) treatshr >= 0as meaning the GPU is done and immediately freesPENDING[this]:console_list::allocator_resetimmediately runsu.free(b)(pushing coherentArenablocks ontoUma.pool's LIFO stack atgpu/uma.rs:583, where the very next draw pops and overwrites them) orsparse::free(b)(decommitted+VirtualFree(MEM_DECOMMIT)+u.sparse_releasefor largeAllocateUploadMemoryblocks).Minimal trigger
AllocateUploadMemory) on listLwith title allocatorA, close and submitL.Lonto allocatorA2(or releaseL) whileL's GPU submission is still in flight —bind::resetmovesL's UMA/sparse blocks intoPENDING[A].A->Reset()beforeLfinishes on the GPU (or while another listL2still holds a recording onA).alloc_pool::title_reset(A)swapscur[A] = Band returnsSome(0).real::alloc_resetimmediately freesPENDING[A]; the next translated draw reuses the same LIFO block and overwrites in-flight GPU shader arguments (orsparse::freedecommits the upload buffer).Suggested fix
Key
console_list::PENDINGby the actual PC backing allocator (alloc_pool::current(alloc)) instead of the title allocator pointer, and free a backing's pending UMA/sparse blocks only whenalloc_poolactually resets or retires that PC backing afterBacking::free()is true.AI use: Antigravity (Gemini 4 Neon) performed the read-only source audit and drafted this issue; checked and verified on
930e8b4before opening.