D3D12.X: a title allocator takes a free spare another one put aside #2725
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!2725
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@veyn-sudo on GitHub · 2026-11-26 08:58 UTC · original
veyn-sudo:pr/share-spare-allocators→main· +44 −3 · 1 files · 1 commits · openWhen 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
@Decodere on GitHub · 2026-11-26 09:28 UTC · original
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.@emirduran707 on GitHub · 2026-11-26 09:47 UTC · original
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
@jennydeth on GitHub · 2026-11-26 15:25 UTC · original
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.
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.