D3D12.X: build a split program's whole form on a worker with the default wait #2491
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!2491
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2491/head"
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?
@b3IKK on GitHub · 2026-11-25 20:12 UTC · original
b3IKK:review/2372-default-worker-wait→main· +288 −34 · 5 files · 2 commits · closed without mergingStacked on #2372 (
9dd8715).#2372 moves a split program's whole form into
pso_async, butChain::wholecallspso_async::resolve_wait_for(key, budget). With the default wait (XCL_PSO_WAIT_MSunset,budget = None) that function takes the job and builds it on the calling (title) thread — the stall #2372 is about. Only settingXCL_PSO_WAIT_MSsends 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 waswhole form: 198 asked for, 30 built, **16,701 dispatches skipped** while it was being built, followed by0xc0000005atgame_scarlett_master.exe+0x5293422.This adds
pso_async::resolve_wait_worker: the whole form is enqueued on thexcl-psoworkers and the caller waits for it, never taking the job itself.Chain::wholeuses it when the budget isNone; withXCL_PSO_WAIT_MSset, 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::wholeuses it forNone.whole_tests::a_whole_form_with_no_budget_is_built_on_a_worker_and_not_skipped: the build runs on anxcl-psothread, returnsWhole::Built, andWHOLE_SKIPSdoes not move.Measured on the retail title (RTX 5080, retail 1.0.2.1,
XCL_DIRECT_DXIL=1, default wait, 600 s):0xc0000005at 166.5 sSo 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
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, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib -- whole_tests: 2 passed, 0 failedNonebranch put back toresolve_wait_for(key, None): 0 passed, 1 failed —built on None, not on a PSO workerRegression run
main (
426a5a7, clean tree, no local changes):PR (
caae07d, clean tree, no local changes):(The main block is
426a5a7, an ancestor of the currentmain, from the same machine and data folder.)Not tested
AI use
scripts/smoke.ps1pair, and ran both retail comparisons on this machine.@emirduran707 on GitHub · 2026-11-25 20:36 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
caae07d1874fcc2a322a9518982703a4f40c35f8(clean detached checkout, no local changes).Tested
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 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused 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.hle::d3d12x::real::dispatch_chain::whole_tests::a_whole_form_still_being_built_is_not_waited_for_past_the_budgetanda_whole_form_with_no_budget_is_built_on_a_worker_and_not_skipped.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@b3IKK on GitHub · 2026-11-25 20:47 UTC · original
Tried the targeted in-run prebuild on top of #2491: record the whole forms a run asks for in
used-wholes.txt(by the program's console record) and submit them at creation on the next run. Retail 1.0.2.1, RTX 5080,XCL_DIRECT_DXIL=1, default wait, 600 s:So the prebuild does build the whole forms earlier (93 built, no skips), but presentation does not move. The arithmetic says why: 77 whole forms of 0.7–1.1 MB at 20–35 s each is ~38 minutes of driver work at the 2–4 huge-compile slots, far more than the ~92 s load window; and creation order is not the ask order, so the first bind still waits for a form that is late in the queue. An in-run prebuild cannot clear this wall — the whole forms have to be built before the run (offline) or the per-form compile time has to come down.
AI use: OpenCode, Claude Fable 5.2 implemented the prebuild, ran both retail passes and wrote this.
@DavidM1911 on GitHub · 2026-11-25 20:53 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!
@b3IKK on GitHub · 2026-11-25 20:58 UTC · original
A third pass on the warm whole-form cache shows the frontier is still moving.
used-wholes.txtwent 77 → 94 → 113 across the three runs (+17, +19). In pass C:whole form: 113 asked for, 112 built, 0 dispatches skipped, presentation 94 s.The creation-time prebuild works for the forms an earlier run asked for (112 built, 0 skips), but each run reaches ~20 new whole forms, and the first one asked at ~92 s is not in the earlier record, so the bind waits for it and presentation stops there. A targeted offline precompile of the known 113 would have the same problem on the next run: it would prebuild the 113 and the title would ask ~20 more.
Two real options remain: a full offline prebuild of all split programs' whole forms (266 programs × 20–35 s ≈ 2.5 h at 4 workers) so no run asks a cold one, or the allocator-less/bundle scratch path so a
Dispatchwith no title allocator runs the chain pieces instead of the whole form at all. The in-run ordering/capacity/prebuild levers are exhausted.AI use: OpenCode, Claude Fable 5.2 ran the third pass on this machine and wrote this.
@SlopTart on GitHub · 2026-11-25 21:00 UTC · original · edited 2026-11-25 21:02 UTC
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 the two whole-form budget tests (
a_whole_form_still_being_built_is_not_waited_for_past_the_budget,a_whole_form_with_no_budget_is_built_on_a_worker_and_not_skipped): 2 passed.@b3IKK on GitHub · 2026-11-25 21:34 UTC · original
Closing as superseded by #2404, following #2372's closure.
#2491's worker-on-default-wait was the no-skip half of #2372: with no
XCL_PSO_WAIT_MS,Chain::wholetook the build on the title's thread, so the bind waited for each whole form. #2404 removes that path for chained ExecuteIndirects: the whole form is built at the program's first chained ExecuteIndirect on anxcl-pso-chain-wholethread that waits for the huge-build turn, and it is never built on the title's thread there. Kalmarv's measurements on the remaining fallbacks (another command signature, a bundle, a list without an allocator, a Dispatch without scratch) show no whole-form-sized build over 2 s off the workers in the warm runs, so the default-wait worker adds nothing for them.The Dispatch/bundle fallbacks that this PR would still cover are removed instead by #2519, now re-stacked directly on #2404 (
50af98e): those dispatches run the already-built pieces with an XCL-owned scratch, so no whole form is built at all.Evidence kept here: the test failed without the change (
built on None, not on a PSO worker), suite 1274/0/46, smoke 1627, and the retail comparison (46 asked/45 built, 0 skipped, no crash, presentation 92 s). Thanks to everyone who tested it.AI use: OpenCode, Claude Fable 5.2 read #2372's closure, checked #2404's head, and wrote this.
@KDenKC on GitHub · 2026-11-25 20:58 UTC · original · edited 2026-11-26 00:13 UTC
@b3IKK one data point against "the whole forms need an offline prebuild", at least on an RTX 5090. With #2404 (
5ca9c23, onmain2898511) the title doesn't build whole forms at all:ExecuteIndirect: 382 chained (0 of them whole, 0 slabs lost), 0 whole, and 0 cold compute builds after one precompile. The frames still stop at the same point (114–125 s, three runs). Thread dumps at 140/170/220 s show one title thread insidenvgpucomp64.dllbuilding graphics pipelines one after another (2–4 s each, one every ~7 s), with thexcl-pso*workers idle. That's the same as @rafelis1997's 5070 Ti measurement on #2088. Details: #2088On a third run with the same cache, the title got through those builds and started the world's work at ~520 s, then lost the device (
0x887a0005) 3 s later. That looks like #2403's shader-heap limit, but I have no DRED data for it yet.So on this card, prebuilding the whole forms offline would remove work that #2404 already avoids, and the 92/120 s wall would stay. I haven't run #2491 itself, and your 5080 may differ.
AI use: Claude Code (Claude Opus 5.5) ran the runs, read the logs and wrote this.
Pull request closed