D3D12.X: dispatch_chain SHARED scratch reuse race across released/recreated lists and silent whole-pipeline fallback on console lists and Wait64 splits #2459
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#2459
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@microwave805 on GitHub · 2026-11-25 19:30 UTC · original
Static audit on
main @ c7e1799found two bugs in the newly merged compute dispatch-splitting runtime (crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs, #2080). Part of #1269, Part of #1833.1. [High] Stale
SHAREDscratch reuse race across released/recreated command lists, Wait64 split segments, and console lists (GPU scratch corruption)crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs:132-137, 164-175crates/xcl/src/hle/d3d12x/list_x.rs:822, 837-869, 2263-2268crates/xcl/src/hle/d3d12x/console_list.rs:423-439, 751dispatch_chain::SHAREDmapslist_ptr -> (allocator_ptr, Weak<Scratch>), andscratch_forreusesSHARED[list]whenevers.0 == allocatorands.1.upgrade()succeeds (theArc<Scratch>stays alive inRECORDINGS[allocator]untilallocator_reset).dispatch_chain::list_reset(list)is called only fromlist_x::reset_copy_scratch(list_x.rs:2264), never from:list_x::on_release(list)orlist_x::on_create(list, ...)(list_x.rs:822, 837-853)list_x::clear_segment_state(list)(list_x.rs:856-869, when Wait64 split segments return totitle_list's spare pool)console_list::cl_reset/console_list::cl_release(console_list.rs:423-439, 751)L1records a split compute dispatch on allocatorA(SHARED[L1] = (A, Weak(S1))), closes, submits to Queue 1 (still running on GPU), and is Released. A newly created command listL2onAreuses freed addressL1and records a split compute dispatch →scratch_forhitsSHARED[L2](s.0 == A,S1upgrades) and handsL2the exact same scratch bufferS1thatL1is actively executing on Queue 1, with zero cross-list/cross-queue synchronization. (Same hazard onconsole_listreset underXCL_ALLOC_SWAP=0.)real::dispatch_chain::list_reset(list)inlist_x::on_create,list_x::on_release,list_x::clear_segment_state, andconsole_list::cl_reset/cl_release.2. [High] Silent
dispatch_chainbypass (falling back to synchronouschain.whole()?) on console lists and Wait64 split segmentscrates/xcl/src/hle/d3d12x/real/dispatch_chain.rs:204-218crates/xcl/src/hle/d3d12x/real.rs:2834-2841&crates/xcl/src/hle/d3d12x/console_list.rs:437-438, 915crates/xcl/src/hle/d3d12x/list_x.rs:2690-2747(note: Wait64 splitcreated_onregistration is also addressed in open PR #1071)alloc_pool::enabled()is true (default),dispatch_chain::dispatch(dispatch_chain.rs:204-206) unconditionally replaces the caller'sallocatorwithalloc_pool::recording_backing(list).unwrap_or(0). Whenrecording_backingreturnsNone,allocatorbecomes0,scratchbecomesNone, and lines 214-218 synchronously compile and dispatchchain.whole()?— defeating dispatch splitting (and hitting NVIDIA's driver compile stall / #2403 shader heap limit).dev_create_command_list_x(real.rs:2834-2841) andconsole_list::cl_reset(console_list.rs:437-438), console lists' backing PC command lists are never registered withalloc_pool::created_on/alloc_pool::reset_list, so every split compute dispatch from a console list (console_list.rs:915) getsrecording_backing == Noneand forceschain.whole()?.Wait64split continuation lists (list_x.rs:2690) hit the same fallback until registered inalloc_pool.alloc_pool(or fall back indispatch_chain.rs:205toalloc_pool::current(allocator)instead of.unwrap_or(0)whenrecording_backingisNone), and callalloc_pool::created_onfor newly createdtry_split_for_waitsegments.AI use
main @ c7e1799and issue drafting.@KOLESNiii on GitHub · 2026-11-26 00:52 UTC · original
Static follow-up on the whole-form fallback after #2371, at main
b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.translated_compute_pso_oncechecks an ordinary.psowith the ordinary ABI before it builds a chain. After a chain is selected,Chain::wholeuses the chain ABI and looks for the whole shader under.chain.pso. The pack precompiler writes only the pieces when the program splits. #2551 adds the whole shader under the chain ABI, which warms the second path. The new #2371 end-to-end test seeds the first path by using a split limit of 12,500 offline and 12 at runtime. A same-settings precompile test should check the exact artifact and runtime consumer it intends to warm. Runtime selection, whole fallback, pack precompile, test setup.driver_psosets a thread-local flag and the outer wrapper reads it on the parent. A piece that still fails after a helper seesE_OUTOFMEMORYreaches the parent as a zero result, with no HRESULT. If a parent-side attempt hits OOM and a later attempt succeeds, the same flag stays set and the wrapper can rerun the entire build with the same output pointer. One example is a cached whole probe returning OOM followed by a successful chain build. This can replace a successful result and spend another driver compile. An explicit retry reason per build would let the caller retain a successful result and propagate a helper refusal when the overall build fails. Retry wrapper, piece results, helper execution.On
amd-devat6a0bb5b, the direct scratch-miss path now queues the whole build and returns an error. The caller counts that invocation as skipped. A failed background build setswhole_failed, which suppresses another enqueue, but this direct path still returns the “still building” message. It also still materializes the one-group-per-slab plan before checking for scratch, the allocation already covered by #2350. A distinct failed status and skipped-producer count would make the new path easier to evaluate. Scratch miss, background failure, skipped count.A standalone Rust probe using the retry wrapper and simulated outcomes confirmed the two control-flow cases. Windows, driver behavior and title impact remain unmeasured.
AI use — OpenAI Codex (GPT-6, exact serving variant unavailable) traced the code, ran the standalone probe and drafted this comment.
@KOLESNiii on GitHub · 2026-11-26 01:08 UTC · original
A separate split-pipeline reuse point on
mainatb49be18. XCL callsCreateRootSignaturefor each chain build, and the chain passes that signature to each piece and to its whole fallback. The compute blob RAM key contains the root signature address. The offline builder already retains chain signatures by sampler set.Verified: Identical piece DXIL and flags with different root-signature addresses have different RAM keys. If D3D12 returns a distinct live object for each equivalent chain signature, duplicate chain builds will miss each other’s RAM blobs and try disk. This is a plausible source of repeated driver work when disk reuse is unavailable. XCL does a new serialize/create on every chain build. Runtime object identity and title impact remain open. A focused check would create the same split PSO twice, keep the first alive, and compare the two root addresses, RAM hits, disk hits and native create times. Run it with an empty XCL driver cache and then with a warmed one. Runtime chain creation · Signature creation · Serialize and create · RAM key and test · Offline signature reuse
Static review. Windows and title timing remain unmeasured. AI use was OpenAI Codex (GPT-6, exact serving variant unavailable) for review and drafting.