Skip to content

Shaders: prebuild split compute dispatch-chain pieces under --pipelines - #2338

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
ChalanaGimhanaX:shaders/precompile-dispatch-chain
Nov 25, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
ChalanaGimhanaX:shaders/precompile-dispatch-chain

Conversation

@ChalanaGimhanaX

Copy link
Copy Markdown
Contributor

Follow-up to #2080 (Part of #1833, Part of #2088): xcl shaders --precompile --pipelines now prebuilds and caches every piece of a split direct-DXIL compute program (.chain.pso) under dispatch_chain_root_signature, instead of compiling the unused unsplit whole container under abi_root_signature_with (.pso).

When direct DXIL translation splits a large compute program into a DispatchChain (under XCL_DIRECT_DXIL=1, or automatically for enormous compute shaders on default settings), the runtime (dispatch_chain::build) builds each piece with dispatch_chain_root_signature and looks up <hash>-<len>-<flags>.chain.pso on disk; even the lazy Chain::whole() fallback uses chained = true (.chain.pso). Previously, Pipelines::make ignored Compiled::dispatch_chain and compiled only c.dxil to <whole>.pso, leaving 0 .chain.pso blobs for the runtime and hitting the slow unsplit compile (or XCL_PIPELINE_MAX_KB cap) offline. On a local retail shader pack (XCL_DIRECT_DXIL=1, wave32), 744 of 2,080 translated compute programs split into 7,100 pieces.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: add driver_cache::name_for and driver_cache::path_for so real::compute_container and offline precompile share the exact .pso / .chain.pso naming; extend driver_cache::tests::a_file_is_named_after_its_dxil_and_flags.
  • crates/xcl/src/shaders.rs: key Pipelines::signatures by (chained, samplers) using pso::dispatch_chain_root_signature for chained pieces; update Pipelines::make_with_cache_path / make_one to build and cache each piece of a split DispatchChain (pieces.len() >= 2) as .chain.pso across up to XCL_PIPELINE_THREADS workers with per-piece XCL_PIPELINE_MAX_KB capping; print split compute programs: N (M pieces) when non-zero; add GPU test split_compute_program_prebuilds_and_caches_chain_pieces (compiles space2 pieces that only dispatch_chain_root_signature accepts, verifies .chain.pso write/reuse, runtime CreateComputePipelineState acceptance, and per-piece cap enforcement).
  • crates/xcl/tests/gpu_compute_e2e.rs: add offline_split_compute_pipeline_is_reused_by_a_second_process exercising xcl shaders --precompile --pipelines end-to-end on a synthetic wave32 multi-block console CS container (XCL_DIRECT_DXIL=1, XCL_DIRECT_SPLIT_INSTRUCTIONS=12), verifying only .chain.pso blobs are written, warm reuse across processes, and recovery from a corrupted .chain.pso.

Tested

  • Hardware / toolchain: NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.1714, wave32 only), Intel Core i5-10400F, 15.9 GB RAM, Windows 11 Pro Build 26200, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.8.2502.11 (Windows SDK 10.0.26100.0); debug for tests, release for precompile timing and smoke runs.
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4) on commit 2228be7: 1274 passed, 0 failed, 46 ignored. Both new GPU tests (split_compute_program_prebuilds_and_caches_chain_pieces and offline_split_compute_pipeline_is_reused_by_a_second_process) ran and passed on RTX 3060.
  • SKIPPED GPU tests (26 notices, unchanged from main): 21 wave64/no-wave64 tests (dispatch_chain_native_wave64_builds_whole, 4 lower::tests, 14 lower_dxil::tests wave64 cases, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware), 3 wave32 per-lane unsupported-op refusals in lower_dxil::tests (f16 arithmetic, f16 packed, f32 conversions), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), and pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache (Windows Developer Mode is required)).
  • Release A/B on two split compute records extracted locally from a retail shader pack (dca1b25b44878018: 1,231,896 B whole -> 14 pieces <= 156,380 B; 77229ada81e6f03f: 88,704 B whole -> 2 pieces <= 89,940 B; xcl shaders <dir> --precompile --only cs --pipelines --windows 4, XCL_DIRECT_DXIL=1, XCL_PIPELINE_THREADS=4, fresh XCL_DXIL_CACHE, NVIDIA implicit cache at OS default, measured on base 06c9f55 before rebasing onto 0829441):
    • main 06c9f55: 117.0 s (117.18 s wall) — 2 unused unsplit .pso files written, 0 / 16 .chain.pso files.
    • This change (cold, first time these pieces were compiled on this machine): 9.2 s (9.50 s wall) — 16 / 16 .chain.pso files written, 0 refused, 0 unsplit .pso files.
    • This change (warm repeat): 0.4 s (0.44 s wall) — 16 / 16 loaded from the driver cache.

Regression run
scripts/smoke.ps1 -Game <retail title> -Seconds 60, default settings, clean working trees, back-to-back on the same machine (main 0829441 then PR head 2228be7):

main:

xcl-smoke v1
commit: 082944135cd2b96288470a595861fa608eee08dc
gpu: NVIDIA GeForce RTX 3060
title: 37fe04ab
seconds: 60
exit: 0x0
frames shown: 645 (PresentX 646)
presents per 2 s (last 3): 2 13 16
device removals: 0
crashes: 0
peak commit: 14622 MB

PR:

xcl-smoke v1
commit: 2228be784e4ebd515b94a34afeaaee068ba865ae
gpu: NVIDIA GeForce RTX 3060
title: 37fe04ab
seconds: 60
exit: 0x0
frames shown: 565 (PresentX 566)
presents per 2 s (last 3): 2 16 17
device removals: 0
crashes: 0
peak commit: 14603 MB

Not tested

  • AMD and Intel GPUs, native wave64 GPUs, and Linux / Wine / vkd3d-proton.
  • Full retail world-load runtime pass measuring driver-cache hits after prebuilding all 744 split compute programs (the 60 s default smoke run stays on the startup/menu phase and does not exercise --pipelines).
  • Re-timing the two-shader A/B after rebasing onto 0829441 (which widened dispatch_chain_root_signature root constants from 4 to 8 dwords in e9ddf17; the unit and e2e GPU tests and smoke run above all ran on 2228be7 over 0829441).
  • XCL_HEAP_WINDOWS=1 and XCL_SAMPLE_* test suites.

AI use

  • Google Antigravity (Gemini 4 Neon): investigated the issue, implemented the fix and tests, ran the full test suite, two-shader A/B timing, and paired smoke runs on the hardware above, and drafted this PR description.

When direct DXIL translation splits a large compute program into a
dispatch chain (xcl-dev#2080, under XCL_DIRECT_DXIL=1 or automatically for
enormous compute shaders), the runtime builds each piece under
dispatch_chain_root_signature and caches its driver blob as .chain.pso.

xcl shaders --precompile --pipelines ignored Compiled::dispatch_chain
and instead built only the unsplit whole shader under
abi_root_signature_with (.pso), which neither the split runtime path
nor the Chain::whole() fallback loads. On two split retail compute
shaders (RTX 3060, XCL_DIRECT_DXIL=1, XCL_PIPELINE_THREADS=4), prebuild
wall time dropped from 117.0 s (0/16 .chain.pso blobs) to 9.2 s cold
and 0.4 s warm (16/16 .chain.pso blobs reused).

Part of xcl-dev#1833, xcl-dev#2088.

Assisted-by: Google Antigravity (Gemini 4 Neon)
@Aniseto

Aniseto commented Nov 25, 2026

Copy link
Copy Markdown

Ran the two new split-compute prebuild tests at 2228be7 (clean PR head on main 0829441):

System

  • GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB), driver 32.0.16.2124
  • CPU: Intel Core i5-12400F, 64 GB RAM
  • OS: Windows 11 Pro build 26200 x64
  • Toolchain: Rust 1.100.0 MSVC 14.44.35207, DXC/DXIL 1.9.2609.5, debug build
  • Adapter: XCL_ADAPTER=nvidia

Results

  • cargo test -p xcl --lib split_compute_program_prebuilds_and_caches_chain_pieces -- --nocapture: 1 passed, 0 failed, 0 ignored, 1229 filtered out (exit 0)
  • cargo test -p xcl --test gpu_compute_e2e offline_split_compute_pipeline_is_reused_by_a_second_process -- --nocapture: 1 passed, 0 failed, 0 ignored, 4 filtered out (exit 0)

What this adds
No comments or test reports in the thread yet. The author's run was an Ampere RTX 3060 with DXC 1.8.2502.11; this is a Blackwell wave32 part with DXC/DXIL 1.9.2609.5. Both new tests pass here: the library test checks the per-piece .chain.pso write/reuse and cap, and the e2e test covers the offline precompile path across two processes.

Not tested
The retail shader pack (including the 744 split programs named in the description), a release-profile timing A/B, a 60 s paired smoke run, AMD and Intel GPUs, native wave64, Wine, and XCL_HEAP_WINDOWS=1.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

@DarkPanda69

Copy link
Copy Markdown

AMD run with native wave64 (listed as untested), to go with the NVIDIA run above: the new prebuild test passes on an RX 9070 XT, so the AMD driver reuses the prebuilt split pieces in a second process too.

Head 2228be7 applied on main 0829441, debug, Windows 11 Pro 26200:

  • RX 9070 XT (RDNA4, driver 32.0.32029.2010, waves 32..64):
    • cargo test -p xcl --test gpu_compute_e2e: 5 passed, 0 failed. offline_split_compute_pipeline_is_reused_by_a_second_process ok, and so are offline_compute_pipeline_is_reused_by_a_second_process and console_wave64_compute_through_the_pso_hook_dispatch_and_read_back. 1 SKIPPED, unrelated to this PR: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
    • cargo test -p xcl --lib -- gpu::: 641 passed, 2 failed, 22 ignored; the 2 failures are the AMD fuzz seeds tracked in DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115, the same on main.
  • RTX 3060 (driver 32.0.16.1088): gpu_compute_e2e 5 passed (same skip); gpu:: 643 passed, 0 failed.

Not tested: a title, the full 744-program prebuild, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@minimalhipster990

minimalhipster990 commented Nov 25, 2026 •

Copy link
Copy Markdown

RTX 4090 retail runtime check. On clean PR head 2228be784e4ebd515b94a34afeaaee068ba865ae, the game supplied a precompiled driver blob for all 66 split pieces it requested from the selected records. On the clean parent 082944135cd2b96288470a595861fa608eee08dc, the same 66 requests had no blob. All 66 completed on both builds, with zero retries.

Measurement Parent PR
Offline driver files for 16 compute records 16 whole 8 whole + 85 pieces
Matched piece calls supplied with a blob 0/66 66/66
Sum of driver-call times for those pieces 86.199 s 2.874 s
Median driver time per piece 1,274 ms 33.5 ms
Unsplit control records supplied with a blob 8/8 8/8
Last 2 s activity interval with any presents ended at 100.054 s 100.043 s
Total PresentX calls at 300 s 1,263 1,274

World loading. Both runs showed loading artwork and ended at the configured cutoff with exit code 0 and no logged device removal. No gameplay HUD or recognizable world geometry appeared in the captures. The first matched piece request came at 201.212 s on the parent and 196.818 s on the PR, well after the last active presentation interval in each. The driver times above sum overlapping calls. Both runs still built 789 pieces across 90 split programs in total.

Method. RTX 4090 24 GB, NVIDIA 621.40, Ryzen 7 5800X3D, 32 GB RAM, Windows 11 build 26300, Rust 1.99.1 MSVC. Each clean tree was built with cargo build --locked --release -p xcl --bin xcl. I selected 16 records seen in a previous retail run and ran xcl shaders <pack> --precompile --only cs --pipelines --used-only --split 1 --windows 4 with an empty driver cache per arm, XCL_DIRECT_DXIL=1, XCL_HEAP_WINDOWS=1 and four pipeline and DXC threads. Both builds produced identical translation plans. Eight records split naturally into 85 pieces. Six of those records were requested during both runs, covering the same 66 pieces. Each runtime record hash and DXIL byte length identified exactly one piece in its saved plan.

For each 300 s xcl run <title>, I used the matching build’s offline cache, identical copies of the configured profile, the same 410 graphics blobs and 1,069-key runtime list, identical scripted input, XCL_PSO_TRACE=1, XCL_NETWORK=0 and one capture per 12 presents. One run per revision, parent first. NVIDIA’s internal cache was uncontrolled. AI assistance: OpenAI Codex (GPT-6) built and ran the comparison, matched the traces to the offline files, inspected the captures and drafted the report.

Follow-up on the last presents. I repeated the 300 s retail run twice on the same clean PR head (2228be78, RTX 4090, driver 621.40). In the earlier PR trace, 153 compute driver calls started before 100 s. I recovered the exact blobs for 74 of them, including 35 dispatch-chain pieces. These calls accounted for 149.789 of the original 156.102 cumulative driver seconds. The two new runs started with the same profile, scripted input and 520 common cache files. I added only those 74 XCL driver blobs to the second run.

Measurement Control With 74 blobs
Selected calls supplied with a blob 0/74 74/74
Cumulative driver time for the same 74 calls 172 ms 119 ms
Last selected driver call finished at 133.736 s 43.883 s
Last 2 s interval with presents ended at 156.417 s 102.046 s
PresentX calls at the 300 s cutoff 1,282 1,333

All 74 calls completed without a retry in both runs. In the second run, the game kept presenting for another 58 s after the last selected call finished. Neither run resumed presenting by 300 s. The captures showed loading artwork and no gameplay HUD or recognizable world geometry. No compute driver call overlapped the last active interval in either run. The four graphics driver calls overlapping it in the second run each took at most 3 ms.

This narrows the next trace to what the presentation thread was waiting for at the transition out of loading. The control ran first and NVIDIA's internal cache was uncontrolled. The 74 calls were already fast in the new control, so the difference in stop times cannot be attributed to the added files. Driver timings sum overlapping calls and exclude queue waits. AI assistance. OpenAI Codex (GPT-6) ran the comparison, checked the traces and captures, and drafted this update.

What the presenting thread waited for on 2228be78. I repeated the 300 s RTX 4090 run with the same executable and the same 594 initial cache files as the targeted-cache run above. The last PresentX returned at approximately 106.58 s. After that, worker 2 (TID 267752, job slot 37) successfully released one count on semaphore 0x1020 at 110.62 s. The presenting thread (TID 263232) returned from its wait in the same millisecond. Worker 2 then signalled its own completion event, and the coordinator returned from that wait. The presenter entered another infinite wait on 0x1020 at 110.70 s. No further title release on that semaphore or new PresentX was observed by cutoff.

The coordinator (TID 263228) completed 81 waits and then waited on event 0x1ac8. The event and job descriptor both matched slot 81 on worker 3 (TID 257776). That worker completed 60 calls from ExecuteIndirect to resolve_wait in 188.65 s, then entered a 61st at 297.44 s. Its job had not returned or signalled completion at cutoff. This identifies the worker responsible for the coordinator’s pending event. Whether completing that job would release the presenter’s semaphore remains open. All 378 Windows samples taken during the final waits confirmed the same semaphore and the same unsignalled auto-reset event. Handles and TIDs are local to this run.

The completed run used in-process tracepoints with the release PDB and exited normally at 300 s with 1,437 PresentX calls. A separate breakpoint-debugger attempt slowed presentation and was excluded. AI assistance. OpenAI Codex (GPT-6) ran the trace and verified the event sequence.

Slot 81, extended replay on the same clean head (2228be78, RTX 4090, NVIDIA 621.40). With the original 594-file cache, I ran the title for 1,200 s. Slot 81 remained open at cutoff after 385 direct ExecuteIndirect → resolve_wait calls had returned. The last PresentX returned at 104.82 s. The presenter received no further semaphore release during its final wait.

I replayed from the first run’s final cache (2,399 files, with all 594 originals unchanged). This time the worker running slot 81 released the presenter’s semaphore, and one new PresentX followed. The job was identified by the same descriptor and callback (+0x15b4aa0) in both runs. The scheduler assigned it to worker 0 in the first run and worker 2 in the second.

  • At approximately 295.368 s, worker 2 successfully released one count on semaphore 0x1024. The presenter returned from its 181.18 s wait. Slot 81 then returned, worker 2 signalled completion event 0x1a4c, and the coordinator’s 82nd wait returned. These events share a millisecond, with that order recorded by the probes.
  • The presenter entered PresentX at 295.756 s, 388 ms after the release, and returned at 295.828 s. XCL’s activity counter independently counted one presentation. No image of that frame was saved at the one-in-12 capture interval, so its visual contents are unknown.
  • At 296.074 s, XCL logged D3D12 device removal (0x887A0005) and an unhandled breakpoint exception (0x80000003). No second presentation followed. The observed trace establishes the wake-up and the next present call. The cause of device removal is still open.

Both runs used the same release executable, fresh copies of the same profile, and the same inputs. The second run had a 3,600 s limit and exited on the exception. AI assistance. OpenAI Codex (GPT-6) ran the replays and verified the call sequence against the activity log and Windows wait samples.

First frame after slot 81 and device removal (RTX 4090, 621.40, same 2228be78 executable). I replayed from verified copies of the same 2,399-file XCL cache with DRED enabled.

  • In one replay, the first and only PresentX after the wait completed. A one-shot readback on the presenter thread saved frame 1368 at 135.959 s. All 518,400 sampled texels were 0xff000000 (960×540 sampled from 3840×2160), identical to frame 1367 before the gap. No HUD or world geometry was visible. XCL counted 28 more submissions in the following two-second interval, then reported DXGI_ERROR_DEVICE_REMOVED at 151.063 s, 15.104 s after the readback.
  • In a second replay, slot 81 released the presenter and completed, but the device was reported removed before another PresentX was called. The failure therefore also reproduces without the resumed present or its readback. In both runs DRED returned VA 0 and empty allocation lists, and XCL printed no incomplete command list. Both reached the same title breakpoint (+0x2474606).
  • In a third system-runtime replay, the NVIDIA user-mode driver called D3D12Core!CDevice::UMSetError_(0x88760870) on the presenter thread 24 ms into the resumed call. The stack resolved to title_textures::refresh_once → sparse::before_execute → State::upload_zeros → State::submit_slot → ExecuteCommandLists. On that stack D3D12 processed the driver error as 0x887A0005. This identifies the sparse tile-clear submission as a place to instrument. Which GPU operation originally failed is still open. Submission on the tested head

AI assistance. OpenAI Codex (GPT-6) ran the replays and checked the frame counter, bitmap and symbolized call stacks.

Which sparse pages were being cleared? On two more RTX 4090 replays of 2228be78 (621.40, identical 2,399-file cache at launch), the first NVIDIA error callback again occurred inside upload_zeros → submit_slot → ExecuteCommandLists. The actual copy destinations matched the requested ranges: 121 × 64 KiB in one run (1,936 pages in 17 intervals), 86 × 64 KiB in the other (1,376 pages in five intervals). The batches had different addresses. In both cases XCL’s sparse-upload fence had already reached its last signalled value before the clear.

In the second replay, two submissions on another queue (29 and 30 command lists) had trailing fence signals of 5,425 and 5,426. An independent CPU sampler read 5,424 on both sides of the first driver callback (−0.55 and +0.96 ms). It first saw the two signals complete at +11.14 and +40.79 ms, before the removal sentinel. Neither batch had a captured sparse buffer copy or a tracked buffer binding overlapping the cleared pages. Shader-selected descriptor accesses remain unobserved, so these measurements establish outstanding queue work but do not establish a same-page conflict. The observers added no GPU signals or waits. AI assistance: OpenAI Codex (GPT-6).

Descriptor tables at the sparse-clear callback (RTX 4090, driver 621.40, same 2228be78 executable and retained cache). A replay captured one outstanding 29-list submission on another queue when the NVIDIA callback reported 0x88760870 inside upload_zeros. All 2,752 requested 4 KiB pages matched the recorded copy destinations. The covering fence still read 5,627 at −0.91 and +0.60 ms relative to the callback. It reached 5,628 at +26.20 ms.

XCL prepared 245 distinct table bases on 11 of the 29 lists. I sampled up to the first 64 slots per table. All 5,678 distinct slots were readable and byte-identical at submission and on reread in the callback. None of the 947 records matching XCL's buffer encoding overlapped the clear or a reconstructed physical alias. Of 1,182 image-shaped records, 933 resolved to a unique observed host resource and 280 to a title-memory start. No resolved start or known mapped resource matched the clear.

A second replay captured the consecutive 29- and 30-list submissions and the same callback inside a 688-page clear. Their covering fences had already completed 276.72 ms and 245.10 ms before the callback, respectively. The 29-list sample contained 6,133 slots and the 30-list sample 1,899. Neither had a matching canonical buffer range on either read. Fifteen slots changed in the 29-list sample and zero in the 30-list sample. All table-base records retained the same bytes. At this callback, three single-list submissions on other queues still lacked completed covering signals. They fell below the descriptor capture threshold.

The 29/30 pair can therefore retire before this error is reported. The original two-outstanding-batch trace has no descriptor snapshot. Full image extents, dynamically selected indices and accesses through the raw window UAVs remain open. AI assistance: OpenAI Codex (GPT-6).

Three outstanding single-list submissions on the RTX 4090. The original 688-page trace shows that each destination queue had successfully enqueued a GPU-side Wait(1368) on a different dependency fence before submitting its list. All three dependency fences still read 1367 on both sides of sparse-submit entry and at −0.54 / +0.96 ms around the NVIDIA callback. One other queue supplied the recorded signals for all three fences, up to 1367. The covering signals of 8, 5 and 7 previously reported describe completion of the lists. The earlier waits show that all three lists were still blocked before shader execution during this clear. Their descriptor contents were not captured in the original run. D3D12 queue wait semantics

I extended the descriptor capture to single compute lists on the same executable and retained cache. In a separate replay, three queues had outstanding single-list submissions during a 640-page clear, 815.5 ms before the callback. In submission order I sampled 208, 178 and 178 slots and found 84, 64 and 64 canonical buffer records. None overlapped that clear or a reconstructed physical alias. All three lists bound a raw UAV spanning the affected window. Two image-shaped records remained unresolved. The sampled table prefixes and CPU-side bindings do not identify shader-selected addresses. These three lists had retired by that replay's callback. AI assistance: OpenAI Codex (GPT-6).

Producer side of the three Wait64 dependencies (same RTX 4090, driver 621.40, 2228be78 and retained cache). In the original trace, the direct queue signaled 1367 on the three dependency fences as the first three of 18 signals after an eight-list submission. Its last observed native submission returned 116 ms before the NVIDIA callback. The compute queues enqueued their waits for 1368 at −74, −41 and −15 ms. None of those three fences had a recorded successful signal for 1368.

I followed the same three guest cells across recording, close and submission in fresh replays. The successful control showed Write64BitValueBottomOfPipeX recording the writes, then the closed list appearing in a native batch. After ExecuteCommandLists, signal_write64_fences → signal_write64_pairs issued all 18 native queue signals. In that replay the worker recorded the next three values (1372) on a single list at −251, −236 and −230 ms. Its Close succeeded at −121 ms. That list had no observed reset, mapped batch, native submission or next-value signal attempt before the callback. All three fences still read 1371 at callback entry. A second replay also captured a successful close at −64 ms with no subsequent native submission of that list before the callback.

In the fully traced replay, the presenter was processing a different list on the producer queue when texture refresh submitted sparse clear work on another queue and the driver reported 0x88760870. The next point to trace is ownership of the already-closed Write64 list before it reaches a producer submission. The exact 1368 run had no list-close probe; the new runs establish the lifecycle on the same cells at different counter values. XCL submission order · Native signal. AI assistance: OpenAI Codex (GPT-6).

Follow-up — who submits the closed three-Write64 list?

Two RTX 4090 replays on 2228be78 started from independent, hash-verified copies of the same retained cache. I tracked the title wrapper separately from its active native command list.

  • In both successful control cycles, the presenter thread handed the wrapper to XCL as list 8 of 8 on the direct producer queue, 317 and 323 ms after a successful Close. XCL expanded the wrapper to the expected native list, which occupied the same slot in D3D12 ExecuteCommandLists. The three fence signals followed.
  • In the failing cycles, the worker completed the same title job and the coordinator's wait on its completion event returned successfully. The first NVIDIA error callback arrived 137 and 117 ms after Close. No observed XCL input array contained that wrapper, no native submission contained its backing list, and there was no signal attempt for the next value on those three fences.
  • In the second replay, the worker cleared its active-list field while its command record still contained the closed wrapper. In the control cycle the presenter copied that wrapper from a different record into batch slot 8. For the failing cycle we saw no corresponding copy before the callback. All three fence reads at callback entry still reported 1374 (next value 1375). The callback occurred during a sparse clear while the presenter was handling a different list.

This locates the last observed copy on the worker side. The callback came sooner than the control cycle's Close-to-submit interval in both runs, so the trace cannot distinguish a delayed handoff from a dropped record. The remaining boundary to instrument is the transfer into the presenter's input records.

@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).

One red on this lane.

  • gpu_ suite (--release --locked, --test-threads=2): 143 passed / 4 failed / 1 ignored. Three failures are the rig's baseline (fuzz seed 1003 of DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115, gpu_nonfused_mad_and_mac_prevent_fma_contraction, gpu_depth_buffer_created_for_unordered_access_is_placed); the fourth, gpu_geometry_wave32_prefix_count_over_a_mask, is this rig's known flaky family (main reproduces it, solo reruns green).
  • New unit test shaders::pipeline_cap_tests::split_compute_program_prebuilds_and_caches_chain_pieces: passes on this lane.
  • New integration test offline_split_compute_pipeline_is_reused_by_a_second_process (crates/xcl/tests/gpu_compute_e2e.rs): fails on the Wine lane, deterministic (2/2 test runs). It fails at the first child-process assert (line 189): the spawned xcl shaders --precompile --pipelines --windows 1 (with XCL_DIRECT_DXIL=1, XCL_DIRECT_SPLIT_INSTRUCTIONS=12, XCL_PSO_DISK_CACHE=1) exits with status 5 without printing any error. Reproduced standalone outside the test harness on the same input the test builds: stdout ends after precompiling 1 shaders ... (23 compile threads; 1 memory windows) and the DXC version banner, stderr carries only DXVK startup noise, no xcl error line. The translated cache dir gets created before the child dies.

So the piece-prebuild path itself works in-process here, but the offline two-process reuse check does not complete under wine-11.0/vkd3d-proton. Note the child queries IDXCoreAdapter (interface f0db4c7f-fe5a-42a2-bd62-f2a6cf6fc83e), which this driver stack answers as unknown before falling back to CreateDXGIFactory2; whether that is related I cannot say from the outside. A diagnostic print on the child's failure path would help pin this down, since exit 5 currently carries no message.

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.

@SlopTart

Copy link
Copy Markdown

Follow-up to my report above, now with the child failure pinned down.

The silent exit 5 is an access violation inside the shim, not a hung or refused start. Re-ran with WINEDEBUG=warn+seh (the -all I normally use hides wine's own crash report): wine raises EXCEPTION_ACCESS_VIOLATION (0xc0000005) on the compile threads, and the full unwind is inside d3d12core.dll (+0x1AB118, +0x1784EC, +0x1A1676, +0x1A7852, +0x1A9450, +0x0DF8DB). Exit status 5 is 0xC0000005 truncated, hence the message-free failure.

Control that keeps this on the PR: running the whole gpu_compute_e2e binary on this same tree gives 4 passed / 1 failed / 1 skipped, and the failing test is only this PR's offline_split_compute_pipeline_is_reused_by_a_second_process; the pre-existing offline_compute_pipeline_is_reused_by_a_second_process passes in the same binary. So the environment is fine, the new prebuilt-split-piece path faults.

Also worth noting for whoever picks this up: the new dispatch_chain_transports_live_f16_and_f64_across_cuts in #2344 crashes at the same d3d12core.dll offsets on this Wine lane (reported there). Two different new split-chain pipeline paths, one fault site in the D3D12core shim, on vkd3d-proton 3.1 (XCL patch) + Mesa 26.2.5 + RADV. Native Windows runs from Aniseto and DarkPanda69 are green, so this only shows up here.

AI use: same as above (Hermes agent, local Qwen-class, checked before posting).

@b3IKK

b3IKK commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

This runtime check matches what I see on an RTX 5080: the split pieces named in the offline cache are supplied (66/66 here, 86.2 s → 2.87 s), but the run still builds the other pieces (789 across 90 split programs above), and the world-load stop is unchanged.

The missing part is the records that were never precompiled. On main, the cold compute compiles after the 96 s stop fall 54 → 24 → 9 → 8 → 7 over five warm runs with disjoint record sets, but each remaining program is a whole 0.99–1.21 MB DXIL compile at 50–105 s, so no frame is presented after 96 s even with only seven left. This PR fixes the storage/naming for split pieces; the next lever is precompiling more of the set (or the whole pack) before the title runs. The warm-run timings are in #1380.

AI use: OpenCode, Claude Fable 5.2 compared this check with retail-run logs on this machine and wrote this.

@imnicho

imnicho commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

A retail-title data point from an RTX 5080, and what is left after the pieces: the whole pipelines of split programs. @b3IKK, I think the 50 – 105 s whole compiles in your world load are these, not records that were never precompiled.

I had written the same change independently this afternoon (pieces made offline with the chain's root signature into .chain.pso) and claimed it on #2088 five minutes after this PR was opened, without seeing it. This one was first, so I am not opening mine. The measurements below are with my equivalent of it on a local tree, not on this head.

Setup: RTX 5080 16 GB (driver 610.47, 32-lane waves), i7-7700K (4 cores / 8 threads), 16 GB RAM, Windows 10 22H2, release. Local tree: #2057 at 4df1e6e + main at 0829441 + the mesh stack. XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1, Series S profile, XCL_NETWORK=0, scripted pad.

The pieces work in the title

  • Offline, --precompile --only cs --pipelines --used-only in two processes: of the 1 034 compute programs earlier runs used, 295 are split; 3 243 pipelines made (316 of them from blobs of an earlier pass), 0 refused, 15.9 min.
  • In the title all 2 504 pieces of the 295 programs are built 50 s into the run, and none of the compute pipelines the log names before the world's set-up comes without a blob (72 supplied, 0 absent).

What is left: the whole pipeline of a split program, made with the chain's signature

  • After the set-up the same run makes 11 compute pipelines with no blob, one after another on a title thread: 559, 703, 745, 656, 734, 788, 738, 645, 759, 784 and 734 KB of DXIL, 52 – 73 s each in the driver (ten finished before the run's 900 s were over). No frame is presented in that time (graphics pipelines are built in it too, 137 of them).
  • Each is then kept as <hash>-<size>-0.chain.pso: they are Chain::whole()'s pipelines, the unsplit program built with the chain's root signature when the title dispatches a split program through ExecuteIndirect. Neither main's offline pass (the whole with the title's signature, in .pso) nor the pieces give the runtime that file, so every split program a title dispatches indirectly costs one such build in its world load. The two runs before had made 1 and 3 of them.

What I propose on top of this PR, unless you would rather put it in here:

  • the runtime notes the record of each split program whose whole pipeline it had to make (used-chain-wholes.txt beside used-pipelines.txt, a hash a line);
  • --pipelines makes that whole pipeline too, as the runtime does (chain signature, .chain.pso), after the program's pieces; with --used-only only for the noted programs, without it for every split program.

I have that written against main with its tests (170 lines, the whole suite passes) and will rebase it onto this PR's Pipelines once this is merged, or stack it now if that is easier for you. Running the title with it to get the before / after of those eleven builds is what my machine is doing now.

Not tested: this head (its tests, the suite, a smoke pair).

AI use: Claude Code with Claude Fable 5.2 ran the title and the offline pass on the machine above and wrote this.

@KDenKC

KDenKC commented Nov 25, 2026

Copy link
Copy Markdown

Tested on NVIDIA / Windows: both new tests pass, including the offline two-process split reuse test that fails on @SlopTart's Wine/RADV lane.

  • Hardware/OS: RTX 5090 32 GB (driver 621.24), Ryzen 7 9800X3D, 62 GB RAM, Windows 11 26200 (native D3D12, no Wine), rustc 1.99.1 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0).
  • Commit: PR head 2228be784e4ebd515b94a34afeaaee068ba865ae as it is (its base is main 0829441), clean tree, release profile.
  • cargo test --release -p xcl --lib split_compute_program_prebuilds_and_caches_chain_pieces -- --test-threads=1: 1 passed, 0 failed, 0 ignored, no SKIPPED.
  • cargo test --release -p xcl --test gpu_compute_e2e offline_ -- --test-threads=1: 2 passed, 0 failed, 0 ignored (offline_split_compute_pipeline_is_reused_by_a_second_process, offline_compute_pipeline_is_reused_by_a_second_process), no SKIPPED.

So the exit-5 child on the RADV lane looks specific to that stack (the access violation inside d3d12core.dll under Wine that SlopTart traced), not to the PR's cache handling.

Not tested: the whole workspace suite on this head; a retail-title run — @b3IKK's and @imnicho's RTX 5080 runs above already show the pieces supplied and the world-load stop unchanged with the whole forms still cold, and I did not repeat that.

AI use: Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this.

@ChalanaGimhanaX

Copy link
Copy Markdown
Contributor Author

Thanks @imnicho (and everyone who tested across RTX 4090 / 5070 Ti / 5080 / 5090, RX 9070 XT, and Wine)!

Let's keep #2338 scoped to the split dispatch-chain pieces so it stays small and focused on one logical change — please go ahead and stack your Chain::whole() / used-chain-wholes.txt follow-up on top (either now or once this lands).

AI use: Google Antigravity (Gemini 4 Neon) drafted this reply.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@oni-swr

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

amd-win test report for 2228be78 (exact head 2228be784e4ebd515b94a34afeaaee068ba865ae) on AMD Radeon RX 7800 XT

Tested

  • AMD Radeon RX 7800 XT 16 GB (RDNA3), driver 32.0.31035.1003; Ryzen 7 5700X3D; Windows 11 build 26200; rustc 1.100.0 MSVC; DXC 1.8.2502.11 (Windows SDK 10.0.26100); debug build for the tests, release build for the smoke runs
  • The PR head exactly as pushed (its base is older than current main; the merged tree was not tested). Merges cleanly into origin/main 55d64c27 (git merge-tree)
  • Focused: cargo test -p xcl --lib driver_cache: 4 passed; --lib split_compute_program_prebuilds: 1 passed; cargo test -p xcl --test gpu_compute_e2e: 5 passed, 0 failed (includes offline_split_compute_pipeline_is_reused_by_a_second_process), 1 SKIPPED (heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows)
  • Full suite, cargo test --workspace -- --test-threads=4: 1273 passed, 1 failed, 46 ignored (with --no-fail-fast). The failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722: res[30] = 0x1, CPU 0x7fffffff). It is not caused by this PR: it fails identically, deterministically (3 of 3 runs), on main at 08294413 and at the current origin/main 55d64c27 on this adapter. 6 SKIPPED lines, all lower_dxil f16 / f16-conversion programs refused as unsupported by the recompiler.

Regression run (own test title tests/testtitle, 60 s, release; same title and time for both. The test title exits with code 2 by design and shows no frames, so crashes: 1 is its normal exit and is the same on both)
PR head:

xcl-smoke v1
commit: 2228be784e4ebd515b94a34afeaaee068ba865ae
gpu: AMD Radeon RX 7800 XT
title: 7719a52c
seconds: 60
exit: 0x2
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 
device removals: 0
crashes: 1
peak commit: n/a MB

main (0829441):

xcl-smoke v1
commit: 082944135cd2b96288470a595861fa608eee08dc
gpu: AMD Radeon RX 7800 XT
title: 7719a52c
seconds: 60
exit: 0x2
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 
device removals: 0
crashes: 1
peak commit: n/a MB

Not tested

  • No retail title: this is a run of our own test title only, so the smoke run does not reach the code this PR changes and says nothing about frames or frame time
  • Other GPUs (NVIDIA / Intel), wave64-only paths on other adapters, and the merged tree on current main

AI use

  • Run and written up by Claude Code (Claude Sonnet 5.5) from real runs on the hardware named above, for oni-swr. No code was changed.

@Eterst

Eterst commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

A data point for the "unused whole container" here: on a retail title the whole program under the chain's root signature is used, by ExecuteIndirect (bind.rs → dispatch_chain::whole), and building it on the title's thread is what stops that title at its world load on NVIDIA (details: #2080 (comment)).

In a thread dump during the stop, one title thread waits on Chain::build_whole in ExecuteIndirect while another builds whole programs with dispatch_chain_root_signature one after another, with no .chain.pso blob for them: 10,452 / 10,281 / 8,412 ms for 650–780 KB of DXIL (records 742a41ceb422beb5, 99604bc99eb833eb, cfd8542440a534bb), 28–161 ms where a blob existed. With XCL_DIRECT_SPLIT_INSTRUCTIONS=0 the title goes on.

So prebuilding the pieces alone would probably leave this stop in place: the whole program under the chain's root signature may need a .chain.pso too (or ExecuteIndirect the unsplit pipeline under the title's root signature, which the precompile already makes).

Setup: RTX 4070 SUPER 12 GB, driver 616.92, Windows 10 19045, release; a test tree of main 50a9fde with #2057 and a few other open PRs, plus #2333; XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1. Not tested: this PR itself.

AI use: Claude Code (Claude Opus 5.5) made the runs and wrote this; posted with my OK.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@raylitebull

Copy link
Copy Markdown
Member

Code review on 2228be7 (crates/xcl/src/hle/d3d12x/real.rs, crates/xcl/src/shaders.rs, crates/xcl/tests/gpu_compute_e2e.rs):

  • Diff looks clean: driver_cache::name_for / path_for consistently separate .chain.pso from whole-program .pso, and Pipelines caches each split dispatch-chain piece under dispatch_chain_root_signature.
  • Both CI checks are green (MERGEABLE), and native Windows tests pass on both NVIDIA (RTX 5070 Ti / 3060 / 5090 / 4090) and AMD (RX 9070 XT / RX 7800 XT).

One open item before merge: @SlopTart hit a deterministic exit-5 (0xC0000005 inside d3d12core.dll) crash on offline_split_compute_pipeline_is_reused_by_a_second_process under Wine/vkd3d-proton (matching the d3d12core.dll fault offsets seen on #2344). Please confirm whether that is purely an upstream vkd3d-proton issue with space2 / split-chain PSO creation or if anything in the precompile test setup triggers it.

@imnicho

imnicho commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

@ChalanaGimhanaX thank you. I am holding the whole-pipeline follow-up back: #2404 (an ExecuteIndirect of a split program runs its pieces) removes the case it was for. With it the whole form is no longer made in a title's world load, so a pass that prebuilds it would write files nothing reads, and the pieces this PR makes are what the runtime needs. If #2404 does not land, the follow-up is ready to stack here.

The numbers I promised, for whoever weighs #2372 / #2404 (same machine and tree as my comment above: RTX 5080 16 GB, i7-7700K 4 cores / 8 threads, Series S profile, pieces prebuilt):

  • Before: in five runs the title asked for 71 whole pipelines of split programs in its world load (1, 3, 11, 24 and 32 new ones a run), each built on a title thread - 52 to 73 s each in the third run, 39 s at the median in the fifth - and it had still not drawn the world when I stopped: about 50 minutes of world load in the last three runs.
  • Building them ahead: all 295 split programs' whole pipelines with the chain's signature, offline in two processes: the 224 still missing took 46.2 min, about 12 s each, 0 refused.
  • After, four runs: no whole form is built in the title any more, and frames go on from the world's set-up (the first comes 4 to 38 s after it). One run shows 57 frames in the first minute of the world, the longest 93 frames over 191 s; in that one two compute programs the title had not reached before (727 and 781 KB of DXIL) came without a blob, 52 and 60 s each.

So on this card the whole forms were what stood between the set-up and the world's frames once the pieces were there. What ends the runs now is the device loss of #505, not a build.

AI use: Claude Code with Claude Fable 5.2 ran the title and the offline passes on the machine above and wrote this.

@ivall

ivall commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Merging at 2228be7. On the open item: the crash under Wine is not from this PR. The report on #2080 (before this PR) has the fault at 0x6ffffca2b118 with d3d12core.dll loaded at 0x6ffffc880000, which is d3d12core.dll+0x1AB118, the first offset of the report here. #2080 is on main already, and the native Windows runs on NVIDIA and AMD pass. What vkd3d-proton trips over is still open and deserves its own issue.

Read in full: the pieces are built with the chain root signature and the runtime's .chain.pso names, per-piece cap included. Both new tests pass here. The whole forms of split programs are still built in the title (#2372, #2404).

Tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug, on main 3f27770 with #2420, #2257, #2408, #2247, #2338, #2097 and #2372 merged locally: cargo test --workspace --no-fail-fast -- --test-threads=4: 1367 passed, 2 failed, 46 ignored, 7 SKIPPED lines. main alone, same command: 1354 passed, 3 failed, 46 ignored. Both failures left (fuzz_validate_and_gpu_1 seed 722, _3 seed 1599) fail the same way on main. No title was run on the merged tree.

AI use: Claude Code (Claude Opus 5.5) read the diff, ran the tests and wrote this on the maintainer's behalf.

@ivall
ivall merged commit e3f042c into xcl-dev:main Nov 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.