Skip to content

D3D12.X: build a split program's whole form on a worker with the default wait - #2491

Open
b3IKK wants to merge 2 commits into
xcl-dev:mainfrom
b3IKK:review/2372-default-worker-wait
Open

b3IKK wants to merge 2 commits into
xcl-dev:mainfrom
b3IKK:review/2372-default-worker-wait

Conversation

@b3IKK

@b3IKK b3IKK commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Stacked on #2372 (9dd8715).

#2372 moves a split program's whole form into pso_async, but Chain::whole calls pso_async::resolve_wait_for(key, budget). With the default wait (XCL_PSO_WAIT_MS unset, budget = None) that function takes the job and builds it on the calling (title) thread — the stall #2372 is about. Only setting XCL_PSO_WAIT_MS sends it to a worker, and then the bind skips dispatches. On the retail 1.0.2.1 title on an RTX 5080 (XCL_DIRECT_DXIL=1, XCL_PSO_WAIT_MS=50, 600 s) that was whole form: 198 asked for, 30 built, **16,701 dispatches skipped** while it was being built, followed by 0xc0000005 at game_scarlett_master.exe+0x5293422.

This adds pso_async::resolve_wait_worker: the whole form is enqueued on the xcl-pso workers and the caller waits for it, never taking the job itself. Chain::whole uses it when the budget is None; with XCL_PSO_WAIT_MS set, the existing budgeted/skip behavior is unchanged.

What is in it

  • crates/xcl/src/hle/d3d12x/pso_async.rs: resolve_wait_worker (sent to the workers, waited for there).
  • crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs: Chain::whole uses it for None.
  • whole_tests::a_whole_form_with_no_budget_is_built_on_a_worker_and_not_skipped: the build runs on an xcl-pso thread, returns Whole::Built, and WHOLE_SKIPS does not move.

Measured on the retail title (RTX 5080, retail 1.0.2.1, XCL_DIRECT_DXIL=1, default wait, 600 s):

#2372 + wait 50 ms this branch, default wait
whole forms asked / built 198 / 30 46 / 45
dispatches skipped 16,701 0
last 2 s interval with a present 166 s 92 s
crash 0xc0000005 at 166.5 s none (clean 600 s)

So the skips and the crash are gone, but the title still stops presenting at 92 s: its binds now wait for 45 serialized ~0.7–1.1 MB worker builds. The remaining lever is precompiling those whole forms (or more huge-compile capacity), not skipping them.

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: 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): 1274 passed, 0 failed, 46 ignored (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))
  • cargo test -p xcl --lib -- whole_tests: 2 passed, 0 failed
  • the new test with the None branch put back to resolve_wait_for(key, None): 0 passed, 1 failed — built on None, not on a PSO worker

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 (caae07d, clean tree, no local changes):

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

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

Not tested

  • whether the world presents with a precompiled whole-form set (the 45 worker builds are the remaining wall)
  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Claude Fable 5.2: implemented the worker path, added the test and confirmed it fails without it, ran the suite and the scripts/smoke.ps1 pair, and ran both retail comparisons on this machine.

Kalmarv and others added 2 commits November 25, 2026 10:25
A split compute program keeps its whole form for what the pieces cannot
run: an ExecuteIndirect, and a dispatch with no allocator to keep its
scratch, in a bundle, or whose scratch allocation fails. That form was built in
`Chain::whole` on the calling thread, the title's, the first time it was
needed, ungated (a title thread's huge compile skips the huge-build
slots) and outside `XCL_PSO_WAIT_MS`. A retail title's ExecuteIndirect
of split programs then held its thread for one 20-35 s whole build after
another, with no present (reported on xcl-dev#2080).

The whole form is now a lazy pipeline in `pso_async`, behind the chain's
address as a stand-in's: it is sent to the PSO workers on first need,
where the huge-build slots and the driver blob cache apply as before (the
build itself, `compute_container` with the chain's root signature and its
`.chain.pso` blob, is unchanged). Its callers wait for it as a bind waits
for an unsplit pipeline: with `XCL_PSO_WAIT_MS` up to the budget, then the
dispatch is skipped and counted until a worker has built it; without a
budget, until it is built, built on the calling thread if no worker has
started it, as before. `XCL_PSO_IMAGE_SKIP` spares it as it would spare the
unsplit program. `forget` releases it, or marks it orphaned while it is
being built. The `compute split:` log line counts the whole forms asked
for and built and the dispatches skipped while one was being built.

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

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) test report on exact head caae07d1874fcc2a322a9518982703a4f40c35f8 (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: 1272 passed, 2 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.
    • Both PR tests passed: hle::d3d12x::real::dispatch_chain::whole_tests::a_whole_form_still_being_built_is_not_waited_for_past_the_budget and a_whole_form_with_no_budget_is_built_on_a_worker_and_not_skipped.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722 and fuzz_validate_and_gpu_3 seed 1599) are pre-existing on unmodified main on this GPU.

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

xcl-smoke v1
commit: caae07d1874fcc2a322a9518982703a4f40c35f8
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1616 (PresentX 1616)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13923 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.

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.

3 participants