D3D12.X: segments parked as spares stop holding their PC allocator (~4 GB less non-local memory) #2936
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!2936
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2936"
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?
@Kalmarv on GitHub · 2026-11-27 01:15 UTC · original
Kalmarv:park-spares→main· +41 −0 · 3 files · 1 commits · openA title list's extra segments (mid-list splits) are parked as spares at the list's next Reset, and the segments KickoffX takes back become spares too. A spare records again only after its own later Reset, but
alloc_poolstill counted it as a user of the PC allocator it last recorded on, so that allocator never became free. Every later Reset of the title's allocator while those were "in use" put one more PC allocator aside, and none was ever reused or released. The previous recording a stand-in replaces at Reset pinned its allocator the same way. On the title this is a host GPU memory step of several GB about 160-180 s into the world that never comes back.What is in it
alloc_pool::park_list: drops a list from its allocator's users; the allocator's own submit marks stay, so it is reused only once the GPU is past them (alloc_pool.rs, with the testa_parked_spare_no_longer_holds_its_allocator).title_list::resetparks the moved segments and the recording a stand-in replaces (title_list.rs);kickoff_xparks its reclaimed segments after both submits (list_x.rs).Tested
XCL_DXC_DIR.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4oncae11a79: 1447 passed, 0 failed, 47 ignored. 25SKIPPED: 21 no wave64, 3 refused per-lane f16 forms, 1 no heap windows.Regression run
xcl shaders --precompile --pipelines(this PR changes no shader translation, so its keys are main's; at 60 s a run on current main ends inside the startup shader preparation of #2555). Same env as the timed runs' base (XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL=all XCL_DIRECT_SPLIT_INSTRUCTIONS=0 XCL_PSO_JOURNAL=0 XCL_DRED=1, DXC 1.9), no switch of this PR set, the same button presses.main
8b957bec:cae11a79:Not tested
XCL_PARK_SPARES=1); this PR has no switch.AI use
@ettehn on GitHub · 2026-11-27 01:30 UTC · original
Independent GPU fence check on
cae11a79, native Windows with an RTX 5070 Ti Laptop (NVIDIA 621.24). I added a local test to the allocator pool module and ran it with the existing tests: 6 passed, 0 failed, 0 skipped.The test holds a real D3D12 queue behind a fence, submits a closed command list and calls
park_listbefore the GPU can finish. Parking detached the list from its recording allocator while both the list and allocator still reported an in-flight submit. The first allocator reset chose a different backing. After releasing the queue and waiting for completion, the next reset could reuse the original backing while another recording still held the second one. The device remained healthy.This checks the allocator-pool transition directly. It does not exercise the title-side
KickoffXorResetcallers or measure retail memory usage. OpenAI Codex (6.2sol) assisted with verification.@pickles976 on GitHub · 2026-11-27 01:32 UTC · original
Tested: production head
cae11a796aa424700977d6d5b28082fc5ebe172e(base8b957bec6f82495aec940944c6bf47faa02db590) under Wine11/Linux6.17, RTX4060 Laptop8GiB/NVIDIA590.48.1, i7-13620H/15693MiB RAM, Rust1.98.1 Windows-MSVC. Diagnostic-relaxed vkd3d2576c0b4adfae4a+, NVIDIA masking disabled: not stock-runtime certification.alloc_pool::tests::: 6 passed,0 failed,0 ignored,0.72s; fresh intended-worktreeCompiling xcl26.62s. No silent GPU skips. Two owner fixtures create the real NVIDIA device: recording survival across allocator Reset, and detection of a still-pending resubmit. The latter uses a CPU-signaled native fence, not an intentionally stalled GPU queue. No shader rendering claim.Local test-only strengthening, production unchanged: required successful device creation in the two optional-device tests; parameterized the existing synthetic-fence release fixture to additionally call
park_listfor both recordings. That additional sixth check verifies: parking one list preserves the other recording; parking both removes recording holds but retains the pending fence and prevents backing reuse; duplicate parking is harmless; advancing the synthetic fence makes the backing reusable. This does not exercise real GPU completion races or multiple outstanding queues.Evidence:
.compat-runtime/logs/verify-xcl-pr2936-allocator-lifetime-20261127T012945Z/(command.json,provenance.txt,console.log,resources.jsonl,result.json). Guarded scope9GiB/512MiB, unchanged2048MiB available-RAM/6000MiB GPU/10GiB disk floors. Sampled minimum availableRAM9783.1MiB, GPUpeak138MiB; this short fixture is not an allocator-memory benchmark.Not tested: matched parent, retail title, full suite, AMD/Intel, stock vkd3d, or the claimed ~4GB non-local saving on this machine. Our earlier XCL Game-Init stuck fence/watchdog is a separate unresolved path; this pass is not evidence that it is fixed. Suggested addition: retain a parked-spare regression with a pending fence, and cover
last_submit/stand-in selection plus more than one queue before calling the lifecycle fully covered.AI assistance: omp (
openai-codex/gpt-6-astra) for local test adaptation, review and this report. All results above came from the named local run.@andrewDoing on GitHub · 2026-11-27 02:01 UTC · original
Independent pending-fence checks on RTX 5070 at PR head
cae11a796aa424700977d6d5b28082fc5ebe172e, with test-only fixtures. In the first test, parking two sibling lists removed their recording holds, but the allocator remained unavailable while submitted work was gated. After queue completion it became reusable, with a healthy device.A second test submitted two parked lists on different queues. Draining only queue A did not release the backing still held by queue B; after B completed, the backing became reusable. Both tests passed without reported skips. These checks exercise bookkeeping and real queue fences, not title Reset/KickoffX end to end or GTA VI memory savings.
AI use: OpenAI Codex with GPT-6.2 Astra wrote and ran the fixtures; Codex coordinated and prepared this report.
@luckyteagirl on GitHub · 2026-11-27 05:41 UTC · original · reviewed
The new
a_parked_spare_no_longer_holds_its_allocatorfixture depends on the caller'sXCL_ALLOC_SWAPsetting. In a fresh test process withXCL_ALLOC_SWAP=0,created_onreturns before it creates the backing, then the fixture unconditionally unwrapsSTATEand indexes the missing backing. With the switch enabled, the fixture also leaves its synthetic allocator and recording keys in global state after the backing storage for those IDs is dropped. Could the test exercise the parking transition on a localState, as the neighboring reset test does? Fixture · Environment gateAI use: OpenAI Codex (GPT-6.2 Sol) reviewed the exact source and drafted this comment. I did not run the fixture.
@throny on GitHub · 2026-11-27 06:08 UTC · original
Two contributors checked independently and found that #1071 #1453 #2707 solves the same problem in a different way: #1607, group D147. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@Anon64 on GitHub · 2026-11-27 06:08 UTC · original · edited 2026-11-27 09:25 UTC
Smoke runs of
cae11a79against its base8b957bec, on a 12 GB Ampere card. No regression, but this machine cannot show the fix: the title stops presenting before it gets to the point where the step happens.Setup: NVIDIA GeForce RTX 3060 12 GB, i9-14900KF, 64 GB RAM, Windows 11 26200, Rust 1.100.0 MSVC release, DXC 1.9.2609.5.
xcl runon the same retail title, warm caches, A presses scripted,XCL_NETWORK=0. Same machine and settings for both trees, run back to back.In both 240 s runs presents stop at about 75–90 s into the run, during world loading. That is the 12 GB-card stall this title already has on
main, not something this PR adds: the base does the same. Non-local memory is flat from 120 s on in both (base 4.80 GB, PR 4.74 GB), so the several-GB step at 160–180 s into the world from the description never occurs here, with or without the PR. The PR's peak commit was 2.2 GB higher in the 240 s pair, but the 60 s pairs went the other way, so I read it as run-to-run noise rather than an effect.Not tested: the full test suite on this tree, a card that gets far enough into the world to see the step, AMD.
Regression run (240 s), base then PR:
AI use: Claude Code (Claude Opus 5.5) ran the builds and smoke runs and wrote this report.
@retrope13 on GitHub · 2026-11-27 06:20 UTC · original
Verified PR #2936 (
cae11a79) independently on Windows 11 across NVIDIA Ada Lovelace (8 GB) and Intel UHD Graphics (covering the untested Intel hardware gap for allocator/command-list tests) and audited the lifetime invariants acrossalloc_pool.rs,title_list.rs, andlist_x.rs. All tests passed cleanly with zero failures.Environment
26300.9818)32.0.16.2140)32.0.101.7092)rustc 1.100.0(stable-x86_64-pc-windows-msvc), VS 2022 Build Tools17.14.45, Windows SDK10.0.26100.0(DXC1.9.2602.17)Test Results (
cae11a79)cargo test --locked -p xcl --lib -- hle::d3d12x::alloc_pool:: -- --test-threads=10.36s, includesa_parked_spare_no_longer_holds_its_allocatorand GPUa_recording_outlives_the_reset_of_the_titles_allocator)cargo test --locked -p xcl --lib -- hle::d3d12x::title_list:: -- --test-threads=10.03s)cargo test --locked -p xcl --lib -- hle::d3d12x::list_x:: -- --test-threads=10.99s)cargo test --locked -p xcl --test d3d12_command_objects_and_root_sig --test d3d12_command_queue --test d3d12_resource_and_sync -- --test-threads=13 + 1 + 3)cargo build --workspace --locked && cargo test --workspace --locked --no-fail-fast -- --test-threads=4XCL_ADAPTER=NVIDIA)SKIPPEDlines on wave32 without Graphics Tools/Developer Mode)Diff Review Notes
alloc_pool::park_listdropslistfromof_listandbackings[backing].userswhile leavingbackings[backing].marksandlast_submit(in_flight) untouched, so backing allocators cannot be reused until the GPU finishes their submit fences.list_x::kickoff_x(list_x.rs:3382) parks reclaimed segments strictly after bothalloc_pool::executedcalls (3336,3355), so fence marks are already attached to their backing allocators before parking.title_list::reset(title_list.rs:199,203) parks moved segments and, when a stand-in replaces an in-flightprimary, parksprimarywithout disturbingin_flight(primary).crates/xcl/src/hle/d3d12x/list_x.rs:2602-2619):reset_stand_in, when a freshly created list (on_create→alloc_pool::created_on) failsClose(2609) orreset_pc(2616), it is parked viatitle_list::put_spare(wrapper, ...)without callingalloc_pool::park_list, so on that rare failure path the unused spare would continue pinningpc_allocuntil popped and reset later. Callingalloc_pool::park_list(pc as usize)insidetitle_list::put_spare(or on those two error returns) would cover that path too.Not Tested
#[ignore]tests in the workspace suite.(AI disclosure: diff review, test execution commands, and summary formatting were assisted by Antigravity / Gemini 4; all tests were executed locally on the hardware listed above.)
@LocranKing on GitHub · 2026-11-27 10:00 UTC · original
Tested PR #2936 (
cae11a79) 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::a_parked_spare_no_longer_holds_its_allocator: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)Both runs started from identical pre-warmed DXIL/driver cache snapshots and reached the 3D world cleanly:
t ≈ 240 s)main(8b957bec)67.2 s/188.4 s124029,411 MB14,281 MB2,241 MB9,178draws,34,068dispatches;100blocks held for58allocators0 / 0(exit: 0x0)cae11a79)67.2 s/176.5 s141329,610 MB14,873 MB2,104 MB17,271draws,65,536dispatches;118blocks held for70allocators0 / 0(exit: 0x0)Peak non-local VRAM was slightly lower (
2,104 MBvs2,241 MB,-137 MB) even while PR #2936 progressed further (17,271vs9,178draws;294 made / 293 put asidevs341 made / 341 put asideat 512 resets). No regressions observed.Not tested: Multi-minute sustained world streaming beyond 180 s (
~70.7 spost-world) where spare allocator accumulation becomes larger, or full workspace test suite oncae11a79.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.