Backlog
Description
Static audit on main @ c7e1799 found 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 SHARED scratch reuse race across released/recreated command lists, Wait64 split segments, and console lists (GPU scratch corruption)
- Where:
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, 751
- Root cause:
dispatch_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)
- Trigger: Command list
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.) - Fix: Call
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_chain bypass (falling back to synchronous chain.whole()?) on console lists and Wait64 split segments
- Where:
crates/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 D3D12.X: track split and created lists on alloc_pool's active backing #1071)
- Root cause: When
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 / NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403 shader heap limit).- In
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()?. - Newly created
Wait64split continuation lists (list_x.rs:2690) hit the same fallback until registered inalloc_pool.
- In
- Fix: Register console lists' PC command list in
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
- Antigravity (Gemini 4 Neon): static code audit on
main @ c7e1799and issue drafting.
Metadata
Metadata
Assignees
Labels
No labels
Activity
D3D12.X: clear dispatch_chain SHARED scratch and rotate DRED marks on…
D3D12.X: run split pieces for dispatches with no title allocator
KOLESNiii commentedon Nov 26, 2026
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. Shaders: --precompile --pipelines also builds a split program's whole form #2551 adds the whole shader under the chain ABI, which warms the second path. The new Shaders: reuse offline compute PSOs and compact repeated atomic shaders #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 commentedon Nov 26, 2026
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.
CryingLaughing commentedon Nov 26, 2026
I checked the case where the outer creation call has already recovered from a heap-window refusal. On main
b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, the outer wrapper can still enter the switch-form retry after that success. Fork commitff2ef9297438f2c81775edb6aeac36c618bbe8cfconsumes the refusal flag and retains a successful result with a nonnull pipeline output in compute, graphics, and mesh creation. A final failure with a recorded refusal remains eligible for switch-form retry.The focused CPU test passed (1/0/0). Its five scripted cases include recovery in one call, final failure, and a successful HRESULT with an empty output slot. The separate synthetic
gpu_memory_windows_from_the_heaptest passed (1/0/0, zero skips) on the RTX 4080. This exercises normal heap-window readback. Driver-induced refusal and retail impact remain unmeasured.Exact fork head, Windows 11 25H2 build 26200.9974, Core i5-13600K, RTX 4080 driver 621.01, Rust 1.100.0 x64 MSVC, DXC 1.8.2502.11.
cargo build --workspace --locked -j 4succeeded.cargo test --workspace --locked -j 4 -- --test-threads=4 --show-outputreported 1,436 passed, 0 failed, 47 ignored across 37 harnesses. The pass count includes 29 explicit capability skips.D3D12.X: clear dispatch_chain SHARED scratch and rotate DRED marks on…