Skip to content

D3D12.X: a released allocator leaves nothing behind in alloc_pool - #907

Merged
theaustinayers merged 1 commit into
xcl-dev:mainfrom
theaustinayers:alloc-release
Nov 24, 2026
Merged

theaustinayers merged 1 commit into
xcl-dev:mainfrom
theaustinayers:alloc-release

Conversation

@theaustinayers

Copy link
Copy Markdown
Collaborator

Fixes the CI failure #897 left on main: mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares fails there with E_INVALIDARG from a list Reset (run 45351827679, "Build and test (Windows, no GPU)").

#897 keeps, by address, which PC allocator a title's allocator stands for. The entry stayed when the allocator was released, so a later allocator at the same address went on with the old one's PC allocator – of another type or device. In the suite, alloc_pool's own test left such an entry and the split test's allocator then got that address. A title that releases its allocators would meet the same.

What is in it

  • crates/xcl/src/hle/d3d12x/alloc_pool.rs: forget – the allocator's entries go at its last Release; the PC allocators made for it are released when nothing records on them any more. The test now also releases the allocator while another PC allocator stands for it and checks that nothing is left.
  • crates/xcl/src/hle/d3d12x/real.rs: alloc_release calls it.

Tested

  • NVIDIA GeForce RTX 5090 (driver 621.14), Ryzen 9 9950X3D, Windows 11 build 26300, rustc 1.100.0, debug build for tests, release for the run
  • cargo build --workspace, then cargo test --workspace -- --test-threads=4: 716 passed, 0 failed, 41 ignored; no SKIPPED tests on this adapter

Regression run

main (11920b5 is the commit of #897, merged as 1c87b1d):

xcl-smoke v1
commit: 11920b5e0d127f04d45363ac8475e82d174d9e40
gpu: NVIDIA GeForce RTX 5090
title: NYCMain
seconds: 60
exit: 0x0
frames shown: 1639 (PresentX 1639)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 16186 MB

PR:

xcl-smoke v1
commit: 5c3ff31790711dcb010590c6c1e0889a61be27fd
gpu: NVIDIA GeForce RTX 5090
title: NYCMain
seconds: 60
exit: 0x0
frames shown: 1628 (PresentX 1628)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15994 MB

Not tested

AI use

  • Claude Code, Claude Fable 5.2: read the CI log, wrote the fix, the test and this description. The runs above were made on the hardware named.

🤖 Generated with Claude Code

xcl-dev#897 kept, by address, which PC allocator a title's allocator stands for.
The entry stayed when the allocator was released, so a later allocator at the
same address went on with the old one's PC allocator - of another type or
device. On CI (WARP) that failed
mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares: its list Reset
got E_INVALIDARG after alloc_pool's own test had left an entry for an address
the test's allocator then received.

The allocator's last Release now drops its entries; the PC allocators made
for it go with it when nothing records on them any more.

Assisted-by: Claude Code (Claude Fable 5.2)
@theaustinayers
theaustinayers merged commit 09940bb into xcl-dev:main Nov 24, 2026
2 checks passed
shelbykb2 added a commit to shelbykb2/xcl that referenced this pull request Nov 24, 2026
…eset

On the newer console command-list layout (real::QUEUE_SHIFTED), titles reset pooled lists through slot ivall#139 Reset(allocator, initial_pso, flags), which real.rs routes to list_x::reset_x.

title_list's wrapper vtable only overrode slots 0, 1, 2, 9, and 10, leaving slot ivall#139 as a raw forwarder to F_BACKING. Once a mid-list Wait64 split switched F_BACKING to a continuation segment, ivall#139 reset only that continuation segment and never ran title_list::reset: F_PRIMARY stayed bound to the previous recording/allocator, F_BACKING was never restored to F_PRIMARY, and extra_active kept accumulating split segments across frames.

On pre-ivall#897 main that caused D3D12 device removal (0x887a0001 / debug-layer id 541) as soon as the old allocator was reused; even with ivall#897/ivall#907 allocator pooling, stale primary/prior segments continue to be resubmitted and extra_active grows until MAX_EXTRA_SEGMENTS.

The wrapper's ivall#139 is now a guard::make_layout_split of its own: a title on the newer layout goes to a four-argument adapter that runs wrapper reset, while a title on the older layout and the runtime take the generated forwarder. The forwarder's tail jump keeps the caller's return address and arguments, which the backing list's own layout guard at ivall#139 needs to tell a title from the runtime; calling the backing slot from Rust would hide it and send an older-layout title to the PC method.

Tests: one covers the forwarder and the newer-layout reset on fake lists; one calls the slot from a caller in a registered mapped image, with the backing slot behind a layout guard as real.rs installs it and a test-local layout flag (flag clear: the older handler with the title's arguments; flag set: the primary is reset and the split segment reclaimed).

Co-Authored-By: Antigravity <noreply@google.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
theaustinayers pushed a commit to theaustinayers/xcl that referenced this pull request Nov 25, 2026
…:reset

On the newer console command-list layout (real::QUEUE_SHIFTED), titles reset pooled lists through slot xcl-dev#139 Reset(allocator, initial_pso, flags), which real.rs routes to list_x::reset_x.

title_list's wrapper vtable only overrode slots 0, 1, 2, 9, and 10, leaving slot xcl-dev#139 as a raw forwarder to F_BACKING. Once a mid-list Wait64 split switched F_BACKING to a continuation segment, xcl-dev#139 reset only that continuation segment and never ran title_list::reset: F_PRIMARY stayed bound to the previous recording/allocator, F_BACKING was never restored to F_PRIMARY, and extra_active kept accumulating split segments across frames.

On pre-xcl-dev#897 main that caused D3D12 device removal (0x887a0001 / debug-layer id 541) as soon as the old allocator was reused; even with xcl-dev#897/xcl-dev#907 allocator pooling, stale primary/prior segments continue to be resubmitted and extra_active grows until MAX_EXTRA_SEGMENTS.

The wrapper's xcl-dev#139 is now a guard::make_layout_split of its own: a title on the newer layout goes to a four-argument adapter that runs wrapper reset, while a title on the older layout and the runtime take the generated forwarder. The forwarder's tail jump keeps the caller's return address and arguments, which the backing list's own layout guard at xcl-dev#139 needs to tell a title from the runtime; calling the backing slot from Rust would hide it and send an older-layout title to the PC method.

Tests: one covers the forwarder and the newer-layout reset on fake lists; one calls the slot from a caller in a registered mapped image, with the backing slot behind a layout guard as real.rs installs it and a test-local layout flag (flag clear: the older handler with the title's arguments; flag set: the primary is reset and the split segment reclaimed).

Co-Authored-By: Antigravity <noreply@google.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b3a969b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant