D3D12.X: a title allocator takes a free spare another one put aside #2715
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2725"
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?
Imported from ivall/xcl. Originally posted by veyn-sudo on 2026-11-26T08:58:12Z.
When the title resets a command allocator while lists still hold recordings on its PC allocator,
alloc_poolputs that one aside and goes on with another: one this title allocator put aside earlier that is free again, or a new one. A title that resets many allocators so makes a PC allocator for almost every one of them and keeps it, although others lie free. This lets a title allocator take a free spare of the same list type that another one put aside.Part of #2688 (workstream 6: memory that grows in the world). Related: #2138 drops free spares beyond two per title allocator, and #2707 resets idle ones so their memory comes back. Both deal with spares already made; this makes fewer of them. #2707 also changes
title_reset_in, so whichever merges second needs a rebase.What is in it
crates/xcl/src/hle/d3d12x/alloc_pool.rs:title_reset_inlooks for a free spare of the same type among the other title allocators' when it has none of its own, and takes it over (it then goes with this title allocator'sforget). Never another title allocator's own allocator: that one goes with the title's Release. Test:a_free_spare_another_title_allocator_put_aside_is_taken(also: not one in use, not one of another type).Tested
cargo test --workspace --no-fail-fast -- --test-threads=4onad9172c0: 1436 passed, 0 failed, 47 ignored; 25SKIPPEDlines (21 no wave64, 3 f16 forms refused, 1 no heap windows).main+ #1453 + other open PRs,XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1), with a temporary count of the spares: before, at 162 s, 315 title allocators had 327 PC allocators made, 287 of them free, and the process's non-local video memory grew 1.3 → 3.0 GB in 40 s. With this, 282 made at 191 s (flat after 160 s), non-local memory flat at about 2.6 GB from 160 s on, and the run went from 169 s to 194 s before the memory guard stopped it.Regression run
main:
this PR:
Not tested
AI use
🤖 Generated with Claude Code
https://claude.ai/code/session_01WStEFektfHt5AEbK6Wupac
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T09:28:43Z.
Independent RTX 4060 (8 GB) / Windows 11 verification of PR #2725 at
ad9172c015a8b33aa90ca002704ea4d3db212b40(exact parentorigin/mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Measurements and targeted test results only; not a full source review.Setup
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200rustc 1.100.0 (0ef1bc386 2026-11-09), DXC1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)title: 29640639viascripts/smoke.ps1 -Seconds 60(XCL_NETWORK=0 XCL_ACTIVITY=1, default flags, no input)Targeted RTX 4060 release unit tests (
ad9172c0)cargo test --release -p xcl --lib hle::d3d12x::alloc_pool::tests::a_free_spare_another_title_allocator_put_aside_is_taken -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, exit0).cargo test --release -p xcl --lib hle::d3d12x::alloc_pool:: -- --test-threads=4: 5 passed, 0 failed, 0 ignored (0.22 s,0skipped, exit0).cargo test --release -p xcl --lib hle::d3d12x::list_x:: -- --test-threads=4: 40 passed, 0 failed, 0 ignored (0.70 s,0skipped, exit0).Observations
title_reset_inpasses the new regression test (a_free_spare_another_title_allocator_put_aside_is_taken) and all 45 targetedalloc_pool::+list_x::tests cleanly in--releaseon this RTX 4060 host.XCL_ACTIVITY=1) ran cleanly (exit: 0x0,1582frames shown,60 60 60steady-state presents per 2 s,0device removals,0crashes,14008 MBpeak commit vs parentb49be183's14018 MB/1518frames; steady-state VRAM6116 MBlocal /4685 MBnon-local at58.2 s).4reset-while-busy swaps (14.9..18.8 s, ending at4 made, 4 put aside nowand214 blocks held for 214 allocators), with no allocator errors or stalls.Paired 60 s RTX 4060 smoke (
b49be183vsad9172c0)Parent
origin/main(b49be183):PR #2725 head (
ad9172c0):Limits of coverage
ad9172c0(only targetedalloc_pool::andlist_x::release tests plus paired quiet 60 s smoke).4reset-while-busy allocator swaps (4 made, 4 put aside), so it verifies zero runtime regression rather than long-session world-load non-local VRAM reduction under high allocator churn (cross-allocator spare reuse itself is exercised bya_free_spare_another_title_allocator_put_aside_is_taken).RTX 4060) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host.AI use
Ran the targeted release unit tests and paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts, log figures, and smoke blocks were taken directly from
cargo test,xcl.log, andscripts/smoke.ps1outputs.Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-26T09:47:13Z.
Independent AMD RDNA4 (native wave64) verification of exact PR head
ad9172c015a8b33aa90ca002704ea4d3db212b40on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC1.9.2602.17).Tested
cargo build --workspace(debug): passed (0errors).cargo test --workspace --no-fail-fast -- --test-threads=4:1434 passed, 2 failed, 47 ignored(8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1heap_window_out_of_memory_falls_back_to_the_switch_formno heap windows, 1pso_measurement_compiles_an_exact_synthetic_recordWindows Developer Mode off).hle::d3d12x::alloc_pool::tests::a_free_spare_another_title_allocator_put_aside_is_takenpassed.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1andfuzz_validate_and_gpu_3) are pre-existing on unmodifiedmainon this RX 9060 XT / driver32.0.31044.16.cargo build --release -p xcl+ 60 s retail-title smoke test (scripts/smoke.ps1, offline):(Compare against
mainb49be183on this machine:1603 frames, 18576 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
Imported from ivall/xcl. Originally posted by jennydeth on 2026-11-26T15:25:16Z.
Windows / NVIDIA results for
ad9172cwith the retail title (1.0.2.1) on an RTX 3060 12 GB.Regression run (default settings, 600 s)
mainb49be18:This PR,
ad9172c:main's 2,047 (95 %) and peak commit of 35,596 MB against 35,859 MB (99 %), with no removal and no crash in either. Neither run reaches the world: presents stop at 100.3 s onmainand at 96.0 s with this PR, while big compute programs are still compiling.allocator resets so far with recordings still held or on the GPU – another PC allocator took its place (N made, …)): at 32 resets, 23 made with this PR against 20 onmainin the 600 s pair. In the direct DXIL runs, 64 made at 64 resets with this PR against 31 at 32 onmaintoday. So in these runs nearly every reset made a new PC allocator, and I can't see the spares of other allocators being taken. One run each, and the line only says how many were made, not where a reused one came from.XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DRED=1, warm caches, 900 s): the device was lost (0x887a0005, #2403) at 114.2 s, last present at 110.3 s, with the same DRED line as onmain(page fault at GPU VA 0x0; allocations there: []; recently freed: []). Threeb49be18runs today with the same switches lost it at 110.6, 211.2 and 216.0 s, so one run can't tell this PR apart frommainthere.Tested
stable-x86_64-pc-windows-msvc); release; DXC 1.9.2609.5.cargo test --workspace --release --no-fail-fast -- --test-threads=4onad9172c: 1436 passed, 0 failed, 47 ignored. SKIPPED (29): 21 × no wave64; 3 × per-lane form refused; 3 × no D3D12 debug layer /d3d12SDKLayers.dll; 1 × no heap windows; 1 ×pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache).scripts/smoke.ps1 -Game <folder>(XCL_NETWORK=0), the same scripted pad presses into the story load in every run;XCL_FRAME_DUMP=300in the pair,100in the direct DXIL runs. Every run was of a copy namedxcl-noprofile.exe: this machine has #2590's 1 GiB shader-heap profile onxcl.exe, and a copy under another name does not match it.Not tested: how often a spare comes from another title allocator (no log line for it); AMD / wave64.
AI use: Claude Code (Claude Opus 5.5) built the commit, ran the suite and the runs on my machine, read the logs and wrote this.
Imported from ivall/xcl. Originally posted by throny on 2026-11-26T15:49:17Z.
Test report: in the world on an RTX 4080 16 GB. No harm; no measurable change on this card.
Tested
git apply, as it is) onnvidia-devaf2cecc4+ #684 + #2697 + #2749 + #2729 + #2794 + #2817 (stack) + #2768 + #2782. The retail title of #505, Series X profile, into the world.Not tested
AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report.
Imported from ivall/xcl. Originally posted by veyn-sudo on 2026-11-26T15:54:50Z.
@jennydeth @throny thank you both. Your two reports agree, and they point at a gap in how I measured this.
The saving in the description (327 → 282 PC allocators made, non-local memory flat from 160 s) was measured on our local tree, which also has #1453. As the description says under Not tested, without #1453 the retired split segments keep their spares, so few of them are free for another title allocator to take. That fits what you both saw on
main/nvidia-dev: about one new PC allocator per reset, and no change in blocks held or non-local memory.The PR's log line also can't show whether a spare came from another allocator, so a run can't tell a take-over from a fresh allocator. I'm setting the PR back to draft until I have:
mainwith and without #1453 underneath, so the effect and its dependency are both shown.If it turns out to matter only with #1453, I'll stack it on #1453 and say so at the top.
AI use: Claude Code (Claude Opus 5.5) wrote this.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:34:53Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:49:21Z.
Triage (#1607) – head
ad9172cMain commit
8e7b566makes this change and says it is adapted from this PR.shared_aside_probes/take_shared_asideinalloc_pool.rstake a free spare of the same type from another title allocator's aside list, never the owner's own allocator. Its test is the same as this PR's. The main version also checks fences outside STATE and skips donors with a reset in progress. alloc_pool.rs has since been reworked, so this branch conflicts.Recommendation: close (superseded by main commit
8e7b566).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:59:12Z.
Closing as superseded: this change is already on
main(8e7b566).8e7b566'Adapted from PR #2725': alloc_pool takes a free same-type spare from another allocator's aside list, never a title allocator itself or a busy/other-type one; test a_free_spare_from_another_allocator_is_transferred_safelyTwo independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed