D3D12.X: an allocator Reset keeps the recordings the title still submits #897
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!897
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/897/head"
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?
@theaustinayers on GitHub · 2026-11-24 07:54 UTC · original
theaustinayers:alloc-swap→main· +296 −7 · 4 files · 1 commits · merged 2026-11-24 07:56 UTCA retail title's device was removed (
0x887a0001) a few seconds after its world started, in every run. The debug layer names it: "The command allocator was reset after the command list was recorded" (id 541). A trace of every list reset, allocator reset and submit showed the title's own order: one recording made at 61.4 s, submitted at 61.6 s, again at 63.2 s on a second queue, the allocator it was given reset at 67.2 s, and the same recording submitted a third time at 67.8 s. Its console lets it; on the PC the recording lives in the allocator and is gone at the Reset.The title's allocator now stands for a PC allocator that changes: at the title's Reset, if lists still hold recordings on the one in use (or the GPU has not finished them), it is put aside as it is and another takes its place.
What is in it
crates/xcl/src/hle/d3d12x/alloc_pool.rs(new): which PC allocator each list's recording is on, a fence value a queue after each submit, and the swap at the title's Reset – to an allocator put aside earlier that no list uses any more and whose submits are done, or a new one. A list holds one recording, so no more are put aside than there are lists. GPU testa_recording_outlives_the_reset_of_the_titles_allocator(withXCL_ALLOC_SWAP=0it fails at its first assertion).real.rs:alloc_resetasksalloc_poolfirst;reset_pc_allocator; a note of each submit inq_execute_command_lists.list_x.rs: every PC list Reset (the title's, the mid-list split's, KickoffX's) takes the PC allocator in use; CreateCommandList notes the list's allocator; KickoffX's submits are noted.XCL_ALLOC_SWAP=0turns it off.Tested
cargo build --workspace, thencargo test --workspace -- --test-threads=4: 716 passed, 0 failed, 41 ignored; no SKIPPED tests on this adapterbeaa245with this change and the trace: before, the device was removed 5–9 s into the world in every run (4 runs). With it, no device removal and no stale submit in the trace in 5 world runs: 4 reached their limit of 100–120 s; the first ran 134 s and was ended on an NVIDIA driver error (nvlddmkm 153) whose cause I do not know. In 60 s of world: 240 Resets swapped, 163 allocators made, 77 reuses. (A sixth run crashed at 22 s in the menus intiling::detile_levelreading title memory – not this code.)Regression run
main (
dbe9324is the commit of #873, merged as1ec4c98):PR:
Not tested
alloc_poollogic on a build that also carried the trace and other local changes. The 60 s regression run is of the head commit and does not reach the world.AI use
🤖 Generated with Claude Code
@shelbykb2 on GitHub · 2026-11-24 17:47 UTC · original
A result for the allocator swap on an AMD RX 6800 (16 GB) with a newer retail game. Builds are local: main at
384f7f7plus lateralloc_poolcommits up to01d4c77, with other open PRs and local changes on top, so take it as a pointer, not a clean A/B of main.With the swap on (default), 14 runs in a row ended with a device removal
0x887a0007at 213-347 s into the run, always at about 2,640-2,770 presented frames. WithXCL_D3D12_DEBUG=1the debug layer logsKernel memory failure. There might be a memory leak.(id 834) at the removal. DRED page-fault reporting shows no fault, and no operation is stuck on any queue.What grows: this title uses about 246 command allocators and resets each one before the lists recorded on it, while those lists still hold recordings that have already executed. The swap counts them as live, so nearly every title allocator gets a second PC allocator (389 made by about 210 s in one run: 246 because none was put aside yet, 143 because a recording held the spare). Each keeps the memory of its largest recording. Non-local video memory outside our own resources rises from 4.6 GB at world start to about 6.1 GB, and the removal comes at that level every time.
With
XCL_ALLOC_SWAP=0: 4 runs to their timers (310, 400, 450, 560 s; up to 3,177 frames), no removal, and the same memory levels off near 5.7 GB. No0x887a0001either; these builds have the slot #139 list Reset change of #929. I did not run the debug layer in those four, so I cannot say whether id 541 still appears.Two things I tried that did not bound it: releasing a segment's hold when it is set aside at Reset, and capping idle spares per title allocator.
Measured in runs on my machine; the diagnostics and this report were written with Claude Code (Claude Opus 5.5, reviewed with Claude Fable 5.2).