D3D12.X: unpin retired split segments from alloc_pool and guard title_list::release ABA #1453
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!1453
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1453"
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-24 16:19 UTC · original
b3IKK:d3d12x/title-list-segment-leak-and-aba→main· +83 −3 · 2 files · 1 commits · openFixes two lifecycle bugs in
title_listsplit segments and wrapper release:title_listsplit onto an extra PC segment and later returned that segment tosparesviaResetorKickoffX,alloc_pool::forget_listwas never called on the retired segment. The segment stayed pinned in its backing allocator'susersset indefinitely, preventing reuse of that backing allocator and leaking new PCID3D12CommandAllocators on subsequentResets.title_list::release, afterf(pc)freed the primary PC command list,WRAPPER_OF.remove(&pc)andbind::forget(pc)ran unconditionally. If another thread created a new command list that reused the freedpcheap address in the window afterf(pc), the old wrapper's cleanup detached the new wrapper and wiped the new list'sbindstate.This calls
alloc_pool::forget_list(list)insidelist_x::clear_segment_state(covering bothtitle_list::resetandKickoffX) and before releasing spare segments; intitle_list::release, it only removesWRAPPER_OFentries still mapped tothisand skips the redundantbind::forget(pc)whenpcwas adopted (already cleaned up insidereal::cl_release).What is in it
crates/xcl/src/hle/d3d12x/list_x.rs: callalloc_pool::forget_list(list)inclear_segment_state.crates/xcl/src/hle/d3d12x/title_list.rs: guardWRAPPER_OFremoval against address reuse, skip redundantbind::forget(pc)for adopted lists, forget spare segments fromalloc_poolbefore release, and add unit testsreset_releases_retired_split_segment_from_alloc_poolandrelease_does_not_remove_reused_pc_from_wrapper_map(both verified failing before the fix).Since the last push: rebased onto
main06c9f55. The conflicts were in the test module (main'snewer_layout_slot_139_resets_primary_and_reclaims_split_segmentsandslot_139_keeps_the_title_caller_for_the_backing_layout_guard, both kept) and inrelease's loop, wheremainiteratesextra_active,sparesandfirst: the PR's ABA guard now applies to all three.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): 1267 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib title_list: 3 passed, 0 failed (both new tests failed before the fix)Regression run
main (
426a5a7, clean tree, no local changes):PR (
0bfea00, clean tree, no local changes):(The main block is
426a5a7, an ancestor of the currentmain, from the same machine and data folder.)Not tested
AI use
main06c9f55, resolved the conflicts, ran the suite and thescripts/smoke.ps1pair at the head above.github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@crosettiremi on GitHub · 2026-11-24 16:39 UTC · original
Tested the change at d827520 on Windows with an RX 7900 XT, on a downstream XCL stack that includes #1422 and a local direct texture upload change. Both split-segment tests and the existing in-flight allocator lifetime test passed individually. The release build passed.
I ran one game comparison per build with the same saved Series X profile, separate copies of the same populated DXIL/PSO caches, two DXC workers, a 28 GiB whole-job limit, and the same scripted Player1 selection at 33 s.
With the patch, at 256 allocator replacements the runtime logged 197 created and 197 put aside. The warm control ended before that counter appeared. An earlier run with the control executable and different cache history reached 256 replacements with 184 put aside. These counts include in-flight work and do not isolate a leak. The later run still had a dark captured frame. I could not verify a visible world or player control. One run per variant does not establish a timing improvement.
@LocranKing on GitHub · 2026-11-24 16:55 UTC · original
Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB) test report for
d827520e3d4741137e4b569fde77e415024cb186.Tested
d827520e3d4741137e4b569fde77e415024cb186(clean tree, merge-baseb7aa9f3)8024 MiB VRAM, driver32.0.16.2101),rustc 1.100.0(x86_64-pc-windows-msvc, MSVC14.44.35207), DXC1.9.2602.17(SDK10.0.26100.0),--releasecargo build --release --workspace: ok (exit 0)cargo test --workspace --release --no-fail-fast -- --test-threads=4: 772 passed, 0 failed, 41 ignored, exit0hle::d3d12x::title_list::tests::reset_releases_retired_split_segment_from_alloc_pool,hle::d3d12x::title_list::tests::release_does_not_remove_reused_pc_from_wrapper_mapSKIPPED(no wave64):gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardwareRegression run
mainbaseline (b7aa9f3bd212088e0d927439284dc5ed325ce3c7):PR head (
d827520e3d4741137e4b569fde77e415024cb186):Not tested: debug build,
XCL_SAMPLE_*tests on this branch, AMD / native wave64 hardware, extended gameplay sessions past 60 s.AI use: Antigravity (
Gemini 4 Hydrogen) ran the build, tests, and smoke runs and drafted this report from the command outputs.@DavidM1911 on GitHub · 2026-11-24 18:52 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@SergeAx on GitHub · 2026-11-26 03:11 UTC · original
Test report: #1453's diff (head
0bfea00) applied ontomainb49be183, measured on the parallel-only failure oflist_x::tests::a_dispatch_with_a_pipeline_still_building_waits_at_the_submitreported in #42.That failure is the second bug this PR fixes. In a failing run on
main, an instrumentedbind::forgetremoved the dispatch test's stand-in state (pso == 0x7E57_D001) on the thread ofa_reset_while_the_last_submit_runs_records_on_another_pc_list, fromtitle_list::release'sbind::forget(pc). A split segment the dispatch test had just made had the address of the reset test's freed primary list.bind::dispatchthen saw no pending pipeline and stopped splitting (273, 289, 301 or 5 segments instead of 421).Tested
--test-threads=4 hle::d3d12x::list_x, the builds alternating run by run: the dispatch test failed in 13 of 200 runs onmainand in 0 of 400 with this PR.list_xtest could not create a queue or allocator (E_OUTOFMEMORY,0x8007000E). The same error came on a build without this PR too (mainplus another change);mainitself had 1 other failure in 200 runs, output not kept.Not tested
real::cl_releasestill forgets a list after the runtime frees it (the same order, with a shorter window); that is not this PR's to fix.AI use: Claude Code (Claude Opus 5.5) found the cause, ran the measurements and wrote this report.
@DavidM1911 on GitHub · 2026-11-26 05:27 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
@sage-sage on GitHub · 2026-11-26 07:40 UTC · original
Test report: passes on NVIDIA merged onto current
main, and with #2691 the dispatch flake from #2690 did not show in 300 parallel runs. Head0bfea00emerged locally ontomainb49be18(clean, merge289952d).Tested
cargo test --workspace -- --test-threads=4onmain+ this PR: 1437 passed, 0 failed, 47 ignored; onmain+ #2691 + this PR: 1438 passed, 0 failed, 47 ignoredmainon this machine (wave64, debug layer, Developer Mode, heap windows)main+ #2691 + #1453 merged locally (fc8561d), the lib test binary withhle:: --test-threads=12, 300 runs:a_dispatch_with_a_pipeline_still_building_waits_at_the_submitfailed 0 times. Onmain(with only a test-only acphal change, #2700) the same setting failed it 32 times in 300 runs. The other failures in the 300 wereacphal::tests::xapu_connect_returns_oom_and_cleans_up_on_failure(5), a test-only flake #2700 fixes.Not tested
main); this PR without #2691 under the stress run; no game; AMD / Intel.Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
@KDenKC on GitHub · 2026-11-26 08:18 UTC · original
Source review of
0bfea00e, no run yet. Two things:1. The spare pool's in-flight check may lose its data. This PR adds
alloc_pool::forget_list(list)tolist_x::clear_segment_state(list_x.rs:857).title_list::resetcalls that for every segment it has just moved tob.spares(title_list.rs:~185-196).forget_listremoves the segment'slast_submit(alloc_pool.rs:92), and with it itsrecordingsand its entry in the backing'susers. But a title may reset a list while its last submission still runs, andpop_sparedecides reuse withalloc_pool::in_flight(p)(title_list.rs:285), which reads that samelast_submit. So a retired segment still on the GPU now looks idle and can be taken and reset at once. That is the case the check is there for. Keepinglast_submit(and the recordings) until the segment is really released or done, and clearing only the list's own state here, would keep the guard working.2. Our flake looks like yours. On an AMD iGPU (RDNA2, Ryzen 7 9800X3D), with the
list_xfixtures pointed at it,a_dispatch_with_a_pipeline_still_building_waits_at_the_submitfailed once in 6 parallel runs. The skipped dispatches showed pipeline0x0instead of the stand-in, and it gave 317 segments instead of 421. The standalone and serial runs passed. That matches what you describe (273/289/301 instead of 421). We'll runmain, #2691, this PR, and both together, 50 times each on that iGPU, and post the counts here.AI use: Gemini (Antigravity) found point 1 in a review; Claude Code (Claude Opus 5.5) checked it against
0bfea00eandmainand wrote this.@KDenKC on GitHub · 2026-11-26 09:12 UTC · original
The repetition counts promised in 7186429674: this PR removes the flake on our AMD iGPU.
AMD Radeon integrated graphics (RDNA2) of a Ryzen 7 9800X3D, Windows 11, debug,
XCL_ADAPTER=amdwith a test-only fixture change so thelist_xdevices honour it (the fixture printed the AMD adapter on every run),cargo test -p xcl --lib list_x -- --test-threads=4. Up to 50 runs per arm; an arm stopped at its third failure.mainb49be18008fc961)0bfea00e)Every failure was
a_dispatch_with_a_pipeline_still_building_waits_at_the_submit, withDispatch with a pipeline that has no translated console shader (0x0) skipped: the stand-in's state was gone, as you describe. The two PRs merge cleanly together.Point 1 of my earlier comment (the spare pool's
last_submit) still stands. These tests don't reach it.Not tested: NVIDIA (never seen to fail there, 0 of 11 earlier runs); a title.
AI use: Claude Code (Claude Opus 5.5) ran the arms and wrote this.
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.