Repository navigation
Shaders: prebuild split compute dispatch-chain pieces under --pipelines - #2338
Conversation
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)
|
Ran the two new split-compute prebuild tests at System
Results
What this adds Not tested 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. |
|
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
Not tested: a title, the full 744-program prebuild, Intel. |
|
RTX 4090 retail runtime check. On clean PR head
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 For each 300 s Follow-up on the last presents. I repeated the 300 s retail run twice on the same clean PR head (
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 The coordinator (TID 263228) completed 81 waits and then waited on event 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 ( 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
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
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 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 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 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, I followed the same three guest cells across recording, close and submission in fresh replays. The successful control showed 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 Follow-up — who submits the closed three-Write64 list? Two RTX 4090 replays on
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. |
|
Tested: current PR head merged onto current One red on this lane.
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 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. |
|
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 Control that keeps this on the PR: running the whole Also worth noting for whoever picks this up: the new AI use: same as above (Hermes agent, local Qwen-class, checked before posting). |
|
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 AI use: OpenCode, Claude Fable 5.2 compared this check with retail-run logs on this machine and wrote this. |
|
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 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 The pieces work in the title
What is left: the whole pipeline of a split program, made with the chain's signature
What I propose on top of this PR, unless you would rather put it in here:
I have that written against 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. |
|
Tested on NVIDIA / Windows: both new tests pass, including the offline two-process split reuse test that fails on @SlopTart's Wine/RADV lane.
So the exit-5 child on the RADV lane looks specific to that stack (the access violation inside 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. |
|
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 AI use: Google Antigravity (Gemini 4 Neon) drafted this reply. |
|
amd-win test report for Tested
Regression run (own test title
Not tested
AI use
|
|
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 In a thread dump during the stop, one title thread waits 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 Setup: RTX 4070 SUPER 12 GB, driver 616.92, Windows 10 19045, release; a test tree of AI use: Claude Code (Claude Opus 5.5) made the runs and wrote this; posted with my OK. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Code review on
One open item before merge: |
|
@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):
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. |
|
Merging at Read in full: the pieces are built with the chain root signature and the runtime's Tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug, on AI use: Claude Code (Claude Opus 5.5) read the diff, ran the tests and wrote this on the maintainer's behalf. |
Follow-up to #2080 (
Part of #1833,Part of #2088):xcl shaders --precompile --pipelinesnow prebuilds and caches every piece of a split direct-DXIL compute program (.chain.pso) underdispatch_chain_root_signature, instead of compiling the unused unsplit whole container underabi_root_signature_with(.pso).When direct DXIL translation splits a large compute program into a
DispatchChain(underXCL_DIRECT_DXIL=1, or automatically forenormouscompute shaders on default settings), the runtime (dispatch_chain::build) builds each piece withdispatch_chain_root_signatureand looks up<hash>-<len>-<flags>.chain.psoon disk; even the lazyChain::whole()fallback useschained = true(.chain.pso). Previously,Pipelines::makeignoredCompiled::dispatch_chainand compiled onlyc.dxilto<whole>.pso, leaving 0.chain.psoblobs for the runtime and hitting the slow unsplit compile (orXCL_PIPELINE_MAX_KBcap) 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: adddriver_cache::name_foranddriver_cache::path_forsoreal::compute_containerand offline precompile share the exact.pso/.chain.psonaming; extenddriver_cache::tests::a_file_is_named_after_its_dxil_and_flags.crates/xcl/src/shaders.rs: keyPipelines::signaturesby(chained, samplers)usingpso::dispatch_chain_root_signaturefor chained pieces; updatePipelines::make_with_cache_path/make_oneto build and cache each piece of a splitDispatchChain(pieces.len() >= 2) as.chain.psoacross up toXCL_PIPELINE_THREADSworkers with per-pieceXCL_PIPELINE_MAX_KBcapping; printsplit compute programs: N (M pieces)when non-zero; add GPU testsplit_compute_program_prebuilds_and_caches_chain_pieces(compilesspace2pieces that onlydispatch_chain_root_signatureaccepts, verifies.chain.psowrite/reuse, runtimeCreateComputePipelineStateacceptance, and per-piece cap enforcement).crates/xcl/tests/gpu_compute_e2e.rs: addoffline_split_compute_pipeline_is_reused_by_a_second_processexercisingxcl shaders --precompile --pipelinesend-to-end on a synthetic wave32 multi-block console CS container (XCL_DIRECT_DXIL=1,XCL_DIRECT_SPLIT_INSTRUCTIONS=12), verifying only.chain.psoblobs are written, warm reuse across processes, and recovery from a corrupted.chain.pso.Tested
32.0.16.1714, wave32 only), Intel Core i5-10400F, 15.9 GB RAM, Windows 11 Pro Build 26200, Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11(Windows SDK10.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 commit2228be7: 1274 passed, 0 failed, 46 ignored. Both new GPU tests (split_compute_program_prebuilds_and_caches_chain_piecesandoffline_split_compute_pipeline_is_reused_by_a_second_process) ran and passed on RTX 3060.SKIPPEDGPU tests (26 notices, unchanged frommain): 21 wave64/no-wave64 tests (dispatch_chain_native_wave64_builds_whole, 4lower::tests, 14lower_dxil::testswave64 cases,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware), 3 wave32 per-lane unsupported-op refusals inlower_dxil::tests(f16 arithmetic,f16 packed,f32 conversions),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows), andpso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache (Windows Developer Mode is required)).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, freshXCL_DXIL_CACHE, NVIDIA implicit cache at OS default, measured on base06c9f55before rebasing onto0829441):main06c9f55:117.0 s(117.18 swall) —2unused unsplit.psofiles written,0 / 16.chain.psofiles.9.2 s(9.50 swall) —16 / 16.chain.psofiles written,0refused,0unsplit.psofiles.0.4 s(0.44 swall) —16 / 16loaded 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 (main0829441then PR head2228be7):main:
PR:
Not tested
--pipelines).0829441(which wideneddispatch_chain_root_signatureroot constants from 4 to 8 dwords ine9ddf17; the unit and e2e GPU tests and smoke run above all ran on2228be7over0829441).XCL_HEAP_WINDOWS=1andXCL_SAMPLE_*test suites.AI use