Repository navigation
D3D12.X: a released allocator leaves nothing behind in alloc_pool - #907
Merged
Merged
Conversation
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)
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the CI failure #897 left on
main:mid_list_write64_wait64_split_avoids_cycle_and_reuses_sparesfails 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_releasecalls it.Tested
cargo build --workspace, thencargo test --workspace -- --test-threads=4: 716 passed, 0 failed, 41 ignored; no SKIPPED tests on this adapterRegression run
main (11920b5 is the commit of #897, merged as 1c87b1d):
PR:
Not tested
AI use
🤖 Generated with Claude Code