D3D12.X: retain backing UMA block while placed buffers survive (#1488) #1648
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!1648
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1648"
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?
@slopgobblercobbler on GitHub · 2026-11-24 18:40 UTC · original
slopgobblercobbler:fix/heap-release-placed-buffer-refcount→main· +199 −7 · 1 files · 1 commits · openResolves XCL-BT-001 in #1488.
What is in it
crates/xcl/src/hle/d3d12x/real.rs:HeapUmawithplaced_buffers: usizerefcount andreleased: boolstate flag.dev_create_placed_resource_x, registers placed buffer resources vianote_placed_buffer(heap, *ppv as usize)when placing buffers into aHEAP_UMAheap.mem_heap_release(ID3D12Heap::Release), setsreleased = true. Ifplaced_buffers > 0, defers freeing the backing UMA block to prevent use-after-free while placed buffers remain mapped.res_release, callsforget_placed_buffer(this as usize). Whenplaced_buffersdecrements to 0 andreleased == true, removes the heap entry fromHEAP_UMAand safely frees the backing physical sparse/UMA allocation.placed_buffers_keep_heap_uma_allocation_alive_until_all_releasedandplaced_buffers_released_before_heap_frees_block_on_heap_release.Tested
cargo test -p xcl -- real(30 passed, 0 failed, including both new placed buffer lifetime tests)git diff --check upstream/main..HEADclean with zero trailing whitespacepython -I scripts/check_no_game_data.py crates/xcl/src/hle/d3d12x/real.rsconfirmed cleanNot tested
AI use
@Anon64 on GitHub · 2026-11-24 19:33 UTC · original
Regression run for this PR: head
d5f9f9c, based onmainc160d86. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release,XCL_NETWORK=0, A pressed every 4 s from 20 s,scripts/smoke.ps1on a retail title for 60 s, in one batch with themainrun.main
c160d86:this PR:
No device removals or crashes; 98 % of main's frames, 103 % of its peak commit.
Peak commit on this machine is mostly the pipeline preload's DXC compiles (#1035) and varies from run to run, so it says little about this PR.
Not tested: the whole suite; whether the title reaches the changed code in these 60 s.
Written with Claude Code (Claude Opus 5.5) from runs on this machine.
@DavidM1911 on GitHub · 2026-11-24 21:06 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@throny on GitHub · 2026-11-25 17:24 UTC · original
Two contributors checked independently and found that #2086 solves the same problem (for #1488) in a different way: #1607, group D88. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@luckyteagirl on GitHub · 2026-11-26 09:49 UTC · original · reviewed
On
d5f9f9c, the new last-placed-buffer cleanup can free the backing while the GPU still uses that buffer. With late release enabled,res_releasesets logicaln = 0when it intentionally retains one native reference forlate_release. If the heap was already released,forget_placed_bufferthen drops the final pin and callsUma::freebeforelate_release::hold. For a coherent block,Uma::freeimmediately returns the range to XCL's free list; another allocation can reuse or zero it while the old submission remains behind a queue fence. Holding the COM resource alone does not retain that pool allocation. The later drain calls rawRelease, so simply omitting the early cleanup whenheldis true would also need a deferred cleanup path.Could the backing's lifetime follow the deferred resource release (or coordinate with the held-heap approach in open #1457 for #1394)? A fence-blocked test can release the heap and last placed buffer, verify an equal-sized coherent allocation cannot reuse the old range before the queue completes, then verify reuse is possible after the drain. This is exact-head source review; I did not run that GPU fixture or claim the same immediate recycling for sparse storage.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.