D3D12.X: keep caller allocator for untracked lists and retain whole PSOs in dispatch_chain #2333
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!2333
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2333"
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?
@Decodere on GitHub · 2026-11-25 14:57 UTC · original
Decodere:fix-2080-dispatch-chain-allocator-lifetime→main· +196 −22 · 4 files · 1 commits · openWhat is in it
Follow-up to #2080 (
Part of #2088,Part of #1269) fixing four runtime allocator/lifetime bugs acrosscrates/xcl/src/hle/d3d12x/real/dispatch_chain.rs,crates/xcl/src/hle/d3d12x/bind.rs,crates/xcl/src/hle/d3d12x/list_x.rs, andcrates/xcl/src/hle/d3d12x/alloc_pool.rs:alloc_pool: Extractedresolve_allocator(resolve_allocator_with) so whenalloc_pool::enabled()is true andalloc_pool::recording_backing(list)returnsNone(as for console command lists created viadev_create_command_list_xand bundles),dispatch_chainfalls back to the caller'sallocatorinstead of0. Previously, zeroing the allocator forced every console-list split compute dispatch onto the synchronous unsplitchain.whole()fallback.alloc_poolbacking: Inlist_x::split, when no idle spare exists and a fresh segment is created onpc_alloc = alloc_pool::current(alloc), callalloc_pool::created_on(p as usize, pc_alloc, ty.0)(andreal::dispatch_chain::list_reset(p as usize)). Previously, leaving the new segment unregistered causedresolve_allocatorto fall back to the title allocatorAafter an allocator swap (current(A) == B), so a later titleReset()reusingAwould calldispatch_chain::allocator_reset(A)and drop scratch/retained PSOs while the split segment onBwas still alive (caught by@pvfreis).Arc<Chain>(and its boundwholePSO) untilallocator_reset: ChangedRecording::{scratch, first}toOption<Arc<Scratch>>/Option<ID3D12PipelineState>, updateddispatch_chain::whole(list, pso, allocator)(and itsbind.rsExecuteIndirectcallsite), and addedretain_whole(allocator, chain)on both thedispatch()wholefallback andExecuteIndirect'swhole()path. Wheneverallocator != 0,Arc<Chain>is retained inRECORDINGS[allocator](deduplicated per allocator, dropping any duplicateArc<Chain>outsideRECORDINGS.lock()) soforget(pso)while the command list is still in flight does not destroy the boundwholeID3D12PipelineStatebeforeallocator_reset(allocator).alloc_pool::created_on: Changeds.types.entry(raw).or_insert(ty)tos.types.insert(raw, ty)(matchingreset_list), so recycling a non-adopted test allocator address under a different command-list type does not keep a stale allocator type across parallel tests (caught by@ivall).(Rebased onto
origin/main6d12f58a.)Tested
whole_fallback_retains_chain_until_allocator_reset_preflight: confirmed unmodifieddispatch()wholefallback failed (0 passed; 1 failed—Chainand itswholePSO dropped immediately onforget(pso)).wait_split_fresh_segment_tracks_swapped_backing_allocator(WARP, beforecreated_on): failed0 passed; 1 failed(recording_backing_for_test(seg1)wasNoneinstead ofSome(pc_alloc_b)).--release -- --test-threads=1 --nocapture, commita7b93a85):hle::d3d12x::real::dispatch_chain::tests:4 passed, 0 failed, 0 ignored(0skipped) on both RTX 4060 (0.41 s) and WARP (0.40 s), includinga_list_recorded_after_another_goes_on_in_its_scratch.hle::d3d12x::list_x::tests::wait_split_fresh_segment_tracks_swapped_backing_allocator:1 passed, 0 failed, 0 ignored(0skipped) on both RTX 4060 (0.23 s) and WARP (0.23 s), verifying a realalloc_poolswapA -> B, fresh mid-list split segment tracking onB,resolve_allocatorreturningB, and reuse/reset ofAleavingseg1keyed toB.cargo test --release -p xcl --lib -- dispatch_chain list_x::tests alloc_pool --test-threads=8): 20 consecutive runs,0/20failures (57 passed, 0 failedper run).cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocaptureon RTX 4060):37test binaries,1426 passed, 0 failed, 46 ignored(29pre-existing hardware/debug-layerSKIPPED:21no wave64,3wave32 per-lanerefused,3missing D3D12 debug layer,1driver cache toggle,1no heap windows;0skipped in our tests).Regression run
Paired 60 s
scripts/smoke.ps1runs on the same RTX 4060 host againstorigin/main(889ef3e8aa7f267323ab4879e735e65da6bcef10) and PR head (a7b93a853ec56621bdef65a695cd858094878bfe):Baseline (
origin/main):PR head:
Not tested
XCL_CONSOLE_LISTS=1or D3D12 debug-layer execution (d3d12SDKLayers.dllis not installed on this host; allocator fallback, Wait-splitalloc_poolregistration, andwholePSO lifetime retention are verified directly by the unit/D3D12 tests).AI use
Implemented and verified with Google Antigravity (Gemini 4 Neon).
Part of #2088
Part of #1269
@nnonno91 on GitHub · 2026-11-25 15:06 UTC · original
Independent Radeon and RTX 5090 verification of
af0b6672d1ed51a7d8855c61050262ad9c470464.Tested
cargo test --locked -p xcl --lib hle::d3d12x::real::dispatch_chain::tests:: -- --nocapture --test-threads=1with each adapter selected byXCL_ADAPTER. The checked-in GPU fixture uses the default device, so I temporarily changed only its adapter lookup and printed the selected device. Both runs gave 2 passed, 0 failed, 0 ignored and no skips.forget(pso), deduplicated repeated recording, then released it on allocator reset. The adapter selection edit was restored.Not tested
Submitted in-flight work outside the unit fixture, the parent, retail smoke and the full workspace suite.
AI use
OpenAI Codex (GPT-6.2 Sol) adapted the test's adapter lookup, ran the tests and wrote this report.
@luckyteagirl on GitHub · 2026-11-25 15:30 UTC · original
Independent RX 6800M check on exact head
af0b6672d1ed51a7d8855c61050262ad9c470464.Tested
30.0.13002.13003), Rust 1.99 MSVC, DXC/DXIL 1.9.2609.5.cargo test --locked -p xcl --lib hle::d3d12x::real::dispatch_chain::tests:: -- --test-threads=1 --show-output: 2 passed, 0 failed, 0 ignored, 0 explicit skips. The checked-in fixture uses the default D3D12 device, so this run alone does not identify the adapter.XCL_ADAPTER=6800Mand printeddispatch_chain test adapter: AMD Radeon RX 6800M. WithXCL_REQUIRE_GPU=wave64, the same filter gave 2 passed, 0 failed, 0 ignored, 0 explicit skips. The GPU fixture exercised bothdispatch()whole fallback and repeatedwhole()calls, including retention acrossforget(pso), deduplication, and release at allocator reset. The selector change was restored; the checkout is clean.This adds a discrete RDNA2 and older AMD driver to the existing Radeon/NVIDIA checks. I did not run the full workspace suite or a retail-title smoke comparison for this PR, and these focused tests do not cover an in-flight console command list.
AI use: OpenAI Codex (GPT-6) ran the checks and prepared this report.
@Decodere on GitHub · 2026-11-25 16:14 UTC · original
Thank you @nnonno91, @fromthemoonx, and @luckyteagirl for testing across RTX 5090, RX 7900 XTX / Arc A770, and RX 6800M!
Rebased
#2333cleanly ontoorigin/main(08294413->e406771b) to integrate withe9ddf17/0829441slabbed bounded scratch:Recording::scratchtoOption<Arc<Scratch>>while keeping theSLABS/scratch_for/record_dispatch_chaindesign anda_chains_scratch_is_bounded_by_what_all_recordings_holdintact.whole_fallback_and_indirect_retain_chain_until_allocator_resetso thedispatch()wholefallback test uses aD3D12_COMMAND_LIST_TYPE_BUNDLEcommand list withSetComputeRootSignatureand[1, 1, 1]groups (deterministically hitting the fallback without huge grid args, addressing @fromthemoonx's note about D3D12 debug layer ID 952/1296).dispatch_chain::tests(3 passed, 0 failedon both RTX 4060 and WARP), full release workspace (1274 passed, 0 failed), and paired 60 s smoke (1553 -> 1624,0device removals/crashes).@pvfreis on GitHub · 2026-11-25 17:40 UTC · original
By reading only, on
e406771:With default switches this fallback also reaches Wait-split segments, and after an allocator swap the title's allocator is the wrong key for them.
try_split_for_waitcreates the segment onalloc_pool::current(alloc)without registering it, sorecording_backingisNone. Onmainits split dispatches go whole; here they chain.RECORDINGS[A]. A title Reset with B busy and A free reuses A (title_reset_in);reset_pc_allocator(A)drops scratch and chain, while the recording on B can be submitted again.Fix: register it where it is made,
alloc_pool::created_on(p as usize, pc_alloc, ty.0); #1071 (draft, conflicting) has that hunk.Tested: nothing run. Not tested: whether a retail title hits it.
AI use: Claude Code (Claude Opus 5.5) found it, Claude Fable 5.2 checked it; checked by a person before posting.
@DavidM1911 on GitHub · 2026-11-25 18:04 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Decodere on GitHub · 2026-11-25 18:46 UTC · original
Good catch
@pvfreis— verified directly inlist_x::try_split_for_wait(Nonespare branch): creating a fresh mid-list Wait split segment onalloc_pool::current(alloc)without callingalloc_pool::created_on(p as usize, pc_alloc, ty.0)leftrecording_backing(seg1)asNone, so after an allocator swap (A -> B)resolve_allocatorfell back to title allocatorAinstead ofB.Updated the branch to
02ba2f94(rebased ontobe67bfcf):alloc_pool::created_on(p as usize, pc_alloc, ty.0)(andreal::dispatch_chain::list_reset(p as usize)).wait_split_fresh_segment_tracks_swapped_backing_allocatorinlist_x.rs(confirmed failing before the fix withrecording_backing == None, passing1/0on RTX 4060 and WARP after, including across anA -> B -> Aallocator swap/reuse cycle).dispatch_chain::tests(3/0RTX 4060 & WARP),mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares(1/0), full release workspace (1322/1— sole failure isorigin/main's pre-existing#2074test), and paired 60 s smoke (be67bfcf1525frames /13969 MBvs02ba2f941544frames /13976 MB,0removals/crashes).@ivall on GitHub · 2026-11-25 19:43 UTC · original
Read in full (body, thread, diff) and tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug. The three fixes look right to me. One thing holds the merge: the new test
wait_split_fresh_segment_tracks_swapped_backing_allocatoris flaky when tests run in parallel, and the cause is increated_on.What happens (
02ba2f9alone, no other PR)wait_split_fresh_segment --test-threads=1: 40 of 40 runs pass.list_x::tests --test-threads=8: 11 of 40 runs fail;dispatch_chain list_x::tests --test-threads=8: 13 of 40. Always this test, atassert_eq!(reset_fn(wrap_c, a_raw, 0), 0)(list_x.rs:6963),E_INVALIDARG. No other test failed in those runs.Cause
alloc_pool::created_ondoess.types.entry(raw).or_insert(ty). Otherlist_xtests make lists on allocators that are never adopted, soforgetnever runs for them and their type stays intypesunder that address.a_titlegets such an address, its type stays the old one. The title Reset then makes the backing allocator with that type (DIRECT), and the COMPUTE list cannot be reset on it.cross_queue_wait64_before_signal_does_not_deadlock_submit_thread,cross_queue_cycle_and_same_queue_fifo_do_not_deadlock.forgetremoves the entry. I only checked that by reading.Fix I tried
created_on,s.types.insert(raw, ty);instead ofor_insert: a list that was just made on the allocator has the allocator's type, so the newer value is the right one.list_x::tests --test-threads=80 of 60 runs failed,dispatch_chain list_x::tests alloc_pool --test-threads=80 of 60.@Decodere, could you take that line (or forget the address in the test) and rerun your smoke for the new head?
mainat06055a7with this PR, #2097, #2368, #2408 and #2383: whole suite 1422 passed, 2 failed, 46 ignored (fuzz_validate_and_gpu_1and_3, the same onmainhere); withXCL_DIRECT_DXIL=1,gpu:: hle::d3d12x952 passed, the same 2 failed. I will merge it once the test is stable. #2404 and #2372 touch the same code and then rebase over it.Not tested: a title run with this PR; the two fixed cases that the tests do not reach.
AI use: Claude Code (Claude Opus 5.5) read the thread and the diff, ran the tests, found the cause and wrote this on the maintainer's behalf.
@Decodere on GitHub · 2026-11-25 20:16 UTC · original
Thanks for tracking that down! Updated
alloc_pool::created_ontos.types.insert(raw, ty)(matchingreset_list), rebased cleanly onto6d12f58a(a7b93a85), verified0/20failures across 20 consecutive--test-threads=8runs ofdispatch_chain list_x::tests alloc_pool(57 passed, 0 failedeach), full release workspace1426 passed, 0 failed, and fresh paired 60 s RTX 4060 smoke (889ef3e81550frames vsa7b93a851522frames,0device removals/crashes). Ready to merge!@fromthemoonx on GitHub · 2026-11-25 15:08 UTC · original · edited 2026-11-25 20:48 UTC
Rerun on the new head
a7b93a8(rebased ontomain6d12f58,created_onnowinserts): the new test no longer flakes in parallel on NVIDIA: it did not fail in 290 parallel runs (--test-threads=8) where failures were logged by name.cargo test --workspace --no-fail-fast -- --test-threads=4ata7b93a8(on currentmain)SKIPPEDlineslist_x::tests::(41 tests),--test-threads=8, 40 runsdispatch_chain::tests:: list_x::tests:: alloc_pool::(49 tests),--test-threads=8, 330 runs-q, whose name I did not keep), which fail the same way onmain6d12f58(6 of 200 runs):rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang(E_OUTOFMEMORYatlist_x.rs:6777with 8 threads),a_dispatch_with_a_pipeline_still_building_waits_at_the_submit(from #2118), oncewrite_buffer_immediate_on_open_existing_heap_visible_to_cpu. Not this PR.wait_split_fresh_segment_tracks_swapped_backing_allocatoralone, 30 runsMy first rerun below repeated the module only 5 times at 4 threads, too few to catch what @ivall found.
Rerun on
02ba2f9: The newwait_split_fresh_segment_tracks_swapped_backing_allocatorpassed 30 of 30 alone, failed without thecreated_online, and recorded no debug-layer messages.cargo test --workspace --no-fail-fast -- --test-threads=4,02ba2f9merged ontomain2898511(clean)SKIPPEDlines; the new test ran and passed02ba2f9a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, from the base; passes on currentmain(c828d8c), not this PRlist_x::tests::(37 tests), 5 runs;dispatch_chain::tests::(3 tests), 30 runsalloc_pool::created_on(p as usize, pc_alloc, ty.0)(scratch)list_x.rs:6987,recording_backingNonereal::dispatch_chain::list_reset(p as usize)(scratch)EnableDebugLayer()and an info-queue dumpEarlier rerun, on
e406771: Passed on NVIDIA, and with the debug layer on, the new D3D12 test was clean (0 messages). The fixture change (a bundle withSetComputeRootSignature, dispatching[1, 1, 1]) resolves the two messages reported below.cargo test --workspace --no-fail-fast -- --test-threads=4SKIPPEDlines;test_title_draws_with_a_root_signature_under_the_debug_layerran and passedhle::d3d12x::real::dispatch_chain::tests::(3 tests, now withmain'sa_chains_scratch_is_bounded_by_what_all_recordings_hold), 30 runswhole_fallback_and_indirect_retain_chain_until_allocator_resetwith a scratchEnableDebugLayer()and an info-queue dump0stored messagesFirst run, on
af0b667: Passed on NVIDIA with the D3D12 debug layer installed, and the e2e debug-layer messages were the same as onmain06c9f55. 1267 passed, 0 failed, 46 ignored.dispatch_chain::tests::passed 30 of 30. With the layer turned on inside the new D3D12 test, its fixture recorded error id 952 (Dispatchwith no root signature set) and warning id 1296 (group count 4294967295 > 65535), fromdispatch(&list, p1, a1, [u32::MAX, 1, 1])on a list with no root signature. The list was never executed, so nothing broke.Tested: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug, Graphics Tools (D3D12 debug layer) installed.
Not tested: a title with
XCL_CONSOLE_LISTS=1, a release build, AMD / Intel.AI use: Claude Code (Claude Opus 5.5) ran the tests and the scratch debug-layer check, and wrote this report.
@thehollowedone on GitHub · 2026-11-25 21:02 UTC · original
Independent Windows/RTX 3080 Ti verification of #2333 head
a7b93a8in a clean, isolated checkout.Tested — Windows 11 Pro build 26300, RTX 3080 Ti 12 GB / driver 621.35, Ryzen 7 9800X3D, 32 GB RAM, Rust 1.99.1 MSVC, DXC 1.8.2502.11.
cargo build --offline --locked --release --workspace, thencargo test --offline --locked --release --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1,426 passed, 0 failed, 46 ignored; 26 explicit SKIPPED (21 no wave64, 3 unsupported per-lane forms, 1 heap-window case, 1 driver-cache control). The workspace build supplied the test-title fixtures before the passing run.dispatch_chain::tests,alloc_pool::tests, andwait_split_fresh_segment_tracks_swapped_backing_allocatortests passed 20/20 parallel repetitions (9 passed, 0 failedeach,--test-threads=8) using a PR-specific build directory.cross_queue_cycle_and_same_queue_fifo_do_not_deadlockfailed atCreateCommandQueuewith0x8007000E. The same test failed atCreateCommandQueueon untouched main6d12f58in its first matching parallel run. This is a baseline/environment limitation, not evidence that this PR introduced that failure. The queue-cycle test passed 10/10 when run alone on the PR head.Not tested — paired retail smoke,
XCL_CONSOLE_LISTS=1in a title, or native-wave64 hardware. This confirms the previously flaky allocator tests and full GPU suite here; it does not establish a first-frame speedup.AI-assisted: Codex (GPT-6, exact variant unavailable) inspected the change, ran the tests, and drafted this report.
@oni-swr on GitHub · 2026-11-25 21:11 UTC · original
Tested
XCL_ADAPTER=radeon.a7b93a853ec56621bdef65a695cd858094878bfe. Baselineorigin/mainwas6d12f58a229bc73889878a448c64dc3af25eeba0.cargo test --workspace --no-fail-fast -- --test-threads=4: 1,425 passed, 1 failed, 46 ignored, 25SKIPPEDnotices (exit 101). The sole failure wasgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, also the sole baseline failure.cargo test -p xcl --lib hle::d3d12x::real::dispatch_chain::tests -- --test-threads=1: 4 passed, 0 failed, 0 ignored.cargo test -p xcl --lib hle::d3d12x::list_x::tests::wait_split_fresh_segment_tracks_swapped_backing_allocator -- --test-threads=1: 1 passed, 0 failed, 0 ignored.cargo test --workspace --no-fail-fast -- --test-threads=4: 1,422 passed, 1 failed, 46 ignored, 25SKIPPEDnotices (exit 101).Not tested
AI use
@bmjask on GitHub · 2026-11-25 20:16 UTC · original · reviewed
No source-level defect found in the reviewed paths. The untracked-list allocator fallback and retained whole-PSO lifetime both line up with the backing-list registration and allocator-reset release paths, and the tests cover the main fallback/dedup cases. The head is mergeable_state=dirty, so please rebase and refresh CI before merge.
@DavidM1911 on GitHub · 2026-11-26 08:15 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: 1 failure under parallel scheduling; clean on--test-threads=1rerun (1312 passed, 0 failed, 27 ignored, 82s). Intermittent single-test flake — tracked in #1978.Thanks!
— Devin
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.