D3D12.X: a freed allocator's recordings leave before its address is reused #2919
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!2919
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2919"
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?
@b3IKK on GitHub · 2026-11-26 23:19 UTC · original
b3IKK:review/free-aside→main· +1188 −18 · 9 files · 15 commits · openStacked on #2404 (
5b9d4ff).alloc_pool::title_resetputs a PC allocator aside and computes the free backings underSTATE, then drops theirdispatch_chain::RECORDINGSafter unlocking. A backing reused in that window could have its new recording swept away, or keep the old recording's readbacks/COM releases alive; KDenKC's trace and the new test isolate the interleaving (#2404).This takes each free backing's
RECORDINGSentries out whileSTATEis held (dispatch_chain::take_recordings) and drops them after the unlock, so a backing reused in between keeps the recordings made after its reuse. The lock order staysSTATEthenRECORDINGS.What is in it
crates/xcl/src/hle/d3d12x/alloc_pool.rs:title_reset_with/take_recordings; the free set is detached under the lock.crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs:take_recordings.aside_sweep_keeps_recordings_made_after_backing_reuse(pauses the sweep after the unlock, reuses the backing and records on it, then finishes the sweep; fails on5b9d4ff, passes here).Measured on the retail title (RTX 5080, 2 GiB shader heap, heap windows, the stack of #2404 + #2519 + #684 + #2877):
Two 600 s runs with it, both 0 removals and 0 crashes. Royalflamejlh reports 0/2 device losses with it against 2/2 without on Linux + NVIDIA.
Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 1448 passed, 0 failed, 47 ignored5b9d4ff(the earlier sweep erased the reused backing's new recording)no heap windows, andcannot disable the driver cache (Windows Developer Mode is required)Regression run
main (
426a5a7, clean tree, no local changes):PR (
2b32e81, clean tree, no local changes):(The main block is
426a5a7, an ancestor of currentmain, from the same machine and data folder. A fresh launch on8b957beis blocked on this machine by #2555's startup preparation, reported on that PR.)Not tested
AI use
scripts/smoke.ps1pair and the two 600 s title runs, and wrote this. Patch and test by KDenKC (#2404).@DarkPanda69 on GitHub · 2026-11-26 23:38 UTC · original
AMD run (listed as untested), with an RTX 3060 in the same PC: the 13 new
d3d12xtests pass on both, and nothing else changes frommain.Tested: pass, head
2b32e81applied onmain8b957be, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17, card picked withXCL_ADAPTER;mainand this PR one after the other on each card.cargo test -p xcl --lib -- hle::d3d12x:: --test-threads=4 --nocapture:main260 passed, 0 failed; this PR 273 passed, 0 failed, 2 ignored, 0 SKIPPED.aside_sweep_keeps_recordings_made_after_backing_reusetoa_title_thread_does_not_wait_behind_a_background_whole_build_waiting_for_its_turn).cargo test -p xcl --lib -- gpu:: --test-threads=4 --nocapture(XCL_DIRECT_DXILunset): RX 9070 XT 708 passed, 2 failed (the #2115 fuzz seeds, same onmain), 6 SKIPPED, on bothmainand this PR; RTX 3060 710 passed, 0 failed, 24 SKIPPED on both. No result changes.The diff adds test code that makes its device with
D3D12CreateDevice(None, ..), so on the RTX 3060 run those still ran on the first adapter, the RX 9070 XT.Not tested: the whole workspace suite, a title run, release, Intel, Linux / Wine.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@luckyteagirl on GitHub · 2026-11-27 06:21 UTC · original · reviewed
Could the new regression call a helper that bypasses the production environment gate, or explicitly assert that its reuse callback ran? With
XCL_ALLOC_SWAP=0,title_reset_withreturnsNonebefore callingafter_unlock. The test already callednote(spare), soholds(spare)still reports true for the old entry. Consequently both final assertions pass even though the sweep and reuse never ran. Checking callback execution would prevent this false pass. Moving the env gate totitle_resetwould also let the test exercise the same sweep regardless of shell settings.Environment gate and sweep · Regression
AI-assisted review (GPT-6.2 Sol).
@LocranKing on GitHub · 2026-11-27 10:00 UTC · original
Tested PR #2919 (
2b32e818) againstmain(8b957bec) on Windows 11 (26300), Ryzen 5 5500 (6C/12T), RTX 3060 Ti 8 GiB (driver621.40),rustc 1.100.0, DXC1.9.2602.17.Unit Test (
cargo test --locked -p xcl)hle::d3d12x::alloc_pool::tests::aside_sweep_keeps_recordings_made_after_backing_reuse:1 passed, 0 failed.Paired 180 s Retail Smoke (
9cc6a39e, Series Slockhart,XCL_HEAP_WINDOWS=1,XCL_DIRECT_DXIL=all,XCL_DIRECT_SPLIT_INSTRUCTIONS=0,XCL_PSO_WAIT_MS=50)t ≈ 297 s)main(8b957bec)67.2 s/188.4 s124029,411 MB14,281 / 2,241 MB9,178draws,34,068dispatches (100blocks held for58allocators)0 / 0(exit: 0x0)2b32e818)119.1 s/256.8 s125729,540 MB14,237 / 2,153 MB10,944draws,33,195dispatches (78blocks held for50allocators)0 / 0(exit: 0x0)Clean
180 sretail run (exit: 0x0,0crashes,0device removals,256put-aside allocator resets handled cleanly). Note that PR #2919 is stacked on #2404 (5b9d4ff6), so the retail binary includes that prerequisite commit.Not tested: Multi-minute stress soak past 180 s or full workspace test suite on
2b32e818.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.