Repository navigation
D3D12.X: segments parked as spares stop holding their PC allocator (~4 GB less non-local memory) - #2936
D3D12.X: segments parked as spares stop holding their PC allocator (~4 GB less non-local memory)#2936Kalmarv wants to merge 1 commit into
Conversation
A 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_pool still counted it as a user of the PC allocator it last recorded on, so that allocator was never free: each later Reset of the title's allocator while those were "in use" put another 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. alloc_pool::park_list drops the list from its allocator's users (its submit marks stay, so the allocator is reused only once the GPU is past them). title_list::reset parks the moved segments and the replaced recording; KickoffX parks its reclaimed segments after both submits. Measured on the title (RTX 5070 Ti, Series X profile, 240 s untimed runs, object counts from 100 to 240 s): PC allocators 1,137 -> 1,928 without, 728-753 -> 862-897 with; non-local video memory 6.2 -> 9.6 GB without, 5.0 -> 5.4-5.5 GB with (about 4 GB less at 240 s). Timed pairs showed no frame-rate cost (late window 11.99 / 10.76 fps without, 10.76 / 11.76 with; run-to-run spread ~10 %). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent GPU fence check on The test holds a real D3D12 queue behind a fence, submits a closed command list and calls This checks the allocator-pool transition directly. It does not exercise the title-side |
|
Tested: production head
XCL_SOURCE_DIR="$PWD/xcl-pr2936" DXVK_CONFIG='dxgi.hideNvidiaGpu = False' \
/usr/bin/bash .compat-tools/cargo-xcl-wine.sh \
test --locked --target x86_64-pc-windows-msvc -p xcl --lib \
hle::d3d12x::alloc_pool::tests:: -- --nocapture --test-threads=1Local 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 Evidence: 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 AI assistance: omp ( |
|
Independent pending-fence checks on RTX 5070 at PR head 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
left a comment
There was a problem hiding this comment.
The new a_parked_spare_no_longer_holds_its_allocator fixture depends on the caller's XCL_ALLOC_SWAP setting. In a fresh test process with XCL_ALLOC_SWAP=0, created_on returns before it creates the backing, then the fixture unconditionally unwraps STATE and 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 local State, as the neighboring reset test does? Fixture · Environment gate
AI use: OpenAI Codex (GPT-6.2 Sol) reviewed the exact source and drafted this comment. I did not run the fixture.
|
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. |
|
Smoke runs of 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.
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 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. |
|
Verified PR #2936 ( Environment
Test Results (
|
| Command | Adapter | Result |
|---|---|---|
cargo test --locked -p xcl --lib -- hle::d3d12x::alloc_pool:: -- --test-threads=1 |
Intel(R) UHD Graphics | 5 passed, 0 failed (0.36s, includes a_parked_spare_no_longer_holds_its_allocator and GPU a_recording_outlives_the_reset_of_the_titles_allocator) |
cargo test --locked -p xcl --lib -- hle::d3d12x::title_list:: -- --test-threads=1 |
Intel(R) UHD Graphics | 3 passed, 0 failed (0.03s) |
cargo test --locked -p xcl --lib -- hle::d3d12x::list_x:: -- --test-threads=1 |
Intel(R) UHD Graphics | 40 passed, 0 failed (0.99s) |
cargo test --locked -p xcl --test d3d12_command_objects_and_root_sig --test d3d12_command_queue --test d3d12_resource_and_sync -- --test-threads=1 |
Intel(R) UHD Graphics | 7 passed, 0 failed (3 + 1 + 3) |
cargo build --workspace --locked && cargo test --workspace --locked --no-fail-fast -- --test-threads=4 |
NVIDIA RTX 4060 Laptop (XCL_ADAPTER=NVIDIA) |
1,447 passed, 0 failed, 47 ignored (29 capability/SDK SKIPPED lines on wave32 without Graphics Tools/Developer Mode) |
Diff Review Notes
- Lifetime invariants verified:
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).
- Minor non-blocking note (
crates/xcl/src/hle/d3d12x/list_x.rs:2602-2619):- In
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.
- In
Not Tested
- Live retail title memory / FPS measurements (no retail title files used).
- AMD, Wine, or native wave64 hardware.
- The 47
#[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.)
|
Tested PR #2936 ( Unit Test (
|
| Build | Entry / World load | Frames shown | Peak commit | Peak local VRAM | Peak non-local VRAM | Console stats logged (t ≈ 240 s) |
Crashes / Removals |
|---|---|---|---|---|---|---|---|
main (8b957bec) |
67.2 s / 188.4 s |
1240 |
29,411 MB |
14,281 MB |
2,241 MB |
9,178 draws, 34,068 dispatches; 100 blocks held for 58 allocators |
0 / 0 (exit: 0x0) |
PR #2936 (cae11a79) |
67.2 s / 176.5 s |
1413 |
29,610 MB |
14,873 MB |
2,104 MB |
17,271 draws, 65,536 dispatches; 118 blocks held for 70 allocators |
0 / 0 (exit: 0x0) |
Peak non-local VRAM was slightly lower (2,104 MB vs 2,241 MB, -137 MB) even while PR #2936 progressed further (17,271 vs 9,178 draws; 294 made / 293 put aside vs 341 made / 341 put aside at 512 resets). No regressions observed.
Not tested: Multi-minute sustained world streaming beyond 180 s (~70.7 s post-world) where spare allocator accumulation becomes larger, or full workspace test suite on cae11a79.
A 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=4on cae11a7: 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 xcl run: prepare shaders in the game window before title execution #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 8b957be:
cae11a7:
Not tested
XCL_PARK_SPARES=1); this PR has no switch.AI use