Skip to content

D3D12.X: run split pieces for dispatches with no title allocator or in a bundle - #2519

Open
b3IKK wants to merge 3 commits into
xcl-dev:mainfrom
b3IKK:review/2372-whole-scratch
Open

b3IKK wants to merge 3 commits into
xcl-dev:mainfrom
b3IKK:review/2372-whole-scratch

Conversation

@b3IKK

@b3IKK b3IKK commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2404 (5ca9c23).

dispatch_chain::dispatch only used a chain's scratch when the list had a title allocator and was not a bundle. Every other dispatch — a bundle, or a list whose allocator XCL cannot see (a console list, a Wait64 segment) — fell back to Chain::whole, a 0.7–1.1 MB unsplit compute pipeline that the driver takes 20–35 s to compile. On the retail 1.0.2.1 title (RTX 5080, XCL_DIRECT_DXIL=1, default wait) 46 such whole forms were still asked on the #2404+#2097 stack, and the first one stalled presentation at 92–94 s. Prebuilding the known forms at creation did not help (92–94 s), because each run asks ~20 new ones.

This gives those dispatches an XCL-owned scratch keyed by the list. The recording is held in LIST_RECORDINGS until the title resets that list or bundle, and the already-compiled chain pieces run instead of the whole form.

What is in it

  • crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs: LIST_RECORDINGS; dispatch treats allocator == 0 or a bundle as XCL-owned (scratch_for(..., 0)), stores the recording under the list, and list_reset drops it; test a_bundle_dispatch_runs_the_pieces_with_an_xcl_scratch_not_the_whole_form.

Retail A/B (RTX 5080, retail 1.0.2.1, XCL_DIRECT_DXIL=1, default wait, one run each):

condition whole forms presentation end
allocator-less lists only (400c095, 400 s) 37 100.1 s device removed at 100.5 s
allocator-less lists + bundles (50af98e, 300 s) 0 264.1 s device removed at 264.5 s

At 260 s the bundle-inclusive run had 270 programs split, 2,629 pieces, 121 Dispatch chains and 150 ExecuteIndirect chains, with no whole forms. The whole-form counts are the reliable difference (0 vs 37); the presentation times are one run each, and the wall in both is #2403 — how much code the title has in use decides when it lands.

The next wall is the driver's shader-code heap (#2403), not the split path. On the same stack with #2097 (9820c9b, 298 programs/2,786 pieces) the device was removed at 91.7 s with XCL_DRED=1: DRED's page-fault output was empty (GPU VA 0x0; allocations there: []; recently freed: []), there were no breadcrumb nodes, and no driver compile happened in the last 12 s. At the 90 s snapshot only 10 chained dispatches had been issued (0 ExecuteIndirect), during the title's own 9,067-dispatch/2 s burst.

Tested

  • hardware: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 1220 passed, 1 failed, 26 ignored. The failure is gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier (3 group barriers; the base's expectation is 1). 68a284a's test expectation is fixed on main by c828d8c ("Tests: check divergent block barriers in a_bridged_mask_write"), and this PR does not touch the recompiler.
  • the new test alone: 1 passed, 0 failed. With owned forced to false: 0 passed, 1 failed (the dispatch falls back to the whole form).
  • SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses, no heap windows, and cannot disable the driver cache (Windows Developer Mode is required).

Regression run

main (426a5a7, clean tree, no local changes):

xcl-smoke v1
commit: 426a5a745db4d5e4b037449ede0b70cb342f5192
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1642 (PresentX 1642)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15158 MB

PR (50af98e, clean tree, no local changes):

xcl-smoke v1
commit: 50af98ed1f5e95d4e9af2195e93d395d2ae187d7
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1621 (PresentX 1622)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14713 MB

(The main block is 426a5a7, an ancestor of the current main, from the same machine and data folder.)

Not tested

AI use

  • OpenCode, Claude Fable 5.2: implemented the list-keyed scratch, added the test and checked it fails without the change, ran the suite and the scripts/smoke.ps1 pair, ran the retail A/B (bundle-inclusive vs narrowed), the DRED pass, and wrote this.

Kalmarv and others added 2 commits November 25, 2026 12:42
An ExecuteIndirect of a compute program that the recompiler split into
pieces fell back to the program's whole form, and that form was compiled
on the recording thread when first needed. On an RTX 5070 Ti with
XCL_DIRECT_DXIL=1 a retail title stalls its world load on it: 11
per-material programs, 9-14 pieces each, each dispatched through
ExecuteIndirect, each whole form 690-950 KB of DXIL taking 16-40 s to
compile, one after another from 326 s to past 600 s.

The title's ExecuteIndirects of split programs all have one command
signature: one Dispatch, stride 12, MaxCommandCount 1, no count buffer
(150 of them in 360 s). Their group counts are written on the GPU, so
the CPU cannot slice them when recording.

The ExecuteIndirect now runs the chain on the GPU. A small compute pass
(pso::record_slicer) reads the title's arguments (and count) and writes,
for a fixed number of rounds, one command per piece of each slab of
dispatch_slabs (the root constants of record_dispatch_chain, then the
slab's group counts); unused rounds get empty dispatches. Each piece then
runs one ExecuteIndirect per round with the chain's command signature,
with UAV barriers between them, in the bounded scratch.

The rounds come from the arguments the CPU sees now and the most slabs an
earlier ExecuteIndirect of the program had, plus a quarter (2 to
XCL_SPLIT_INDIRECT_ROUNDS, 16). When the arguments need more slabs, the
slicer sets a predicate: the rounds are skipped and the title's
ExecuteIndirect runs with the whole form if it is built already. If it
is not, the rounds run, the lost slabs are counted and warned about once
per program, the whole form is built on another thread for the next
ones, and the next rounds are sized from the count. Under the title's
own predication XCL's is not set. Bundles, lists without scratch and
other command signatures keep the whole form. The 'compute split' line
counts chained, whole and lost ExecuteIndirects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runner::dispatch_split_indirect records a chain's ExecuteIndirect the way
the runtime does (slicer, chain ExecuteIndirects, the whole form under
the predicate). dispatch_chain_divergent_forward_edges_3d runs it with
one command, several with empty commands and a count buffer that leaves
the last out, a stride of 20 bytes, in slabs of 1 to 12 groups and 1 to
16 rounds, and checks the memory against the whole program and the
slicer's slab count. With more slabs than rounds it checks that the
predicate is set and the whole form runs instead, and that without a
whole form only the rounds' groups run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@b3IKK
b3IKK force-pushed the review/2372-whole-scratch branch from 50af98e to 400c095 Compare November 25, 2026 21:46
@b3IKK

b3IKK commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the 3060 Ti run. That is the known parallel-run flake (#1978): the same single test passes when the suite is rerun single-threaded, and our 5080 shows the same pattern.

The head is now 400c095, re-stacked directly on #2404 (5ca9c23) and narrowed to lists whose allocator XCL cannot see (bundles keep the whole-form fallback, #2459). On this machine its suite is 1220 passed / 1 failed / 26 ignored; the one failure is a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, a base 68a284a expectation that main fixes in c828d8c and that this PR does not touch. Smoke: 1622 frames, 0 removals. I am updating the PR body with the full pair and the retail numbers.

AI use: OpenCode, Claude Fable 5.2 wrote this.

@b3IKK
b3IKK force-pushed the review/2372-whole-scratch branch from 400c095 to 50af98e Compare November 25, 2026 21:48
@emirduran707

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) test report on exact head 50af98ed1f5e95d4e9af2195e93d395d2ae187d7 (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1288 passed, 3 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release)

xcl-smoke v1
commit: 50af98ed1f5e95d4e9af2195e93d395d2ae187d7
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1620 (PresentX 1620)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13934 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.

@SlopTart

Copy link
Copy Markdown

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of a_bundle_dispatch_runs_the_pieces_with_an_xcl_scratch_not_the_whole_form: passed.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

@KOLESNiii KOLESNiii mentioned this pull request Nov 25, 2026
@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

Thanks!

— Devin

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.

5 participants