Repository navigation
Shaders: a title's preparation workers build split programs' whole forms - #2794
Conversation
The workers that build a title's compute pipelines before it starts (pipelines_in_workers) run precompile without a startup state, and only with one does it build a split program's whole form. The title then built each whole form at the program's first ExecuteIndirect, on its own thread (Chain::whole): 15 - 25 s a program cold, 750 KB - 1.1 MB of DXIL. A retail title froze in its world load for minutes on them (RTX 5090, RTX 4070 Ti; KDenKC's finding and change, xcl-dev#2624). precompile now builds the whole form in a preparation worker too (XCL_PRECOMPILE_PARENT set). The first preparation takes longer; the title then finds the whole forms in the driver cache. Assisted-by: Claude Code (Claude Opus 5.5)
|
Independent Windows check of warm-cache reuse and recovery on
All four runs reported zero refused pipelines. On Windows 11 build 26200, Ryzen 9 8945HX, RTX 5070 Ti Laptop 12 GB (621.24), Rust 1.97.1 MSVC debug, DXC 1.8.2502.11, 4 passed, 0 failed, 0 ignored, no reported skips. This covers the worker CLI cache path with a synthetic shader. A retail title’s first ExecuteIndirect and the full workspace suite were outside this run. OpenAI Codex assisted with the test and verification. The exact model identifier was unavailable in this session. |
|
Independent RTX 4060 Laptop (8 GB, DXC Tested
Diff Check (
|
|
Test report: on an RTX 4080 16 GB this removes the no-frame stretch at world entry. This is the stall I measured on Tested
Not tested
AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report. |
|
RTX 5080 16 GB on a small PC (i7-7700K, 16 GB RAM),
The table, the settings and what else differed between the two arms are in #2551 (comment). Not tested: this PR's own commit and its new test; more than one run per arm. AI use Claude Code with Claude Fable 5.2 wrote the local change, ran the passes and the runs and wrote this text. |
|
Independent test report under Wine/Proton (not native Windows) for head Tested
Retail title (release build, 2 preparation workers,
The head's cached run reused the partial cache its killed cold run left behind. The two cached runs therefore started from different cache histories, and their preparation times are not a clean comparison. Neither cached run crashed or lost the device. Chained split dispatches: 50 on base, 252 on head. Not tested
AI use
|
|
AMD Windows test report for head Tested
The one extra pass is the new
Not tested
AI use: Claude Code (Claude Sonnet 5.5) ran the tests and drafted this report. |
|
8 GB desktop NVIDIA, one run of Tested
Results
Not tested: warm-cache runs, repeats, the full suite, AMD. AI use: run, analysis and this report by Claude Code (Claude Opus 5.5), reviewed for accuracy against the run log. |
|
Thanks @3L1A5-1. A silent AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
Test observation on AMD Ryzen 5 5500 (6C/12T) + NVIDIA RTX 3060 Ti (8 GB) ( Startup preparation impact
Note on the 180 s smoke run |
|
Test report on an RTX 3070 Laptop 8 GB: #2794 fixes the freeze when a retail title's 3D world starts loading on Tested tree (local merge, not pushed)
Tested
Not tested
AI use
|
|
Independent Windows check of 3c4891dd against its exact
The Windows CI log ends after a Correction to my earlier wording: |
|
merge-check Not tested here: a retail-title run, AMD, Intel, or the frame-time effect of a cold preparation. This merge check is a local trial merge; it is not a new clean-head smoke block. |
|
merge-check claim |
|
merge-check |
…chain The mandatory preparation path (prepare_compiled_compute: xcl run's startup preparation and its workers, the PSO corpus and milestones) built every split compute program three ways: the whole DXIL under the ABI root (.pso), every piece under the chain root(s) (.chain.pso), and the whole DXIL again under each chain root. Since ec80c07 the runtime first loads the ABI whole blob (CachedWhole) and builds no chain when it loads, so the pieces and the chain-root whole were never used. In a full preparation of a retail game the chain-root wholes were ~37 % of the driver work (size-weighted) and the pieces ~11.5 %. Now the whole is built first, and the chain only when the runtime would not find the whole (chain_needed): it was refused or over the cap, or its driver blob is not on disk. A record whose whole failed is prepared when its pieces are built; the chain-root whole is not tried then (the same DXIL under another root). The non-mandatory --pipelines path (make_selected) is unchanged. The e2e test a_preparation_worker_also_builds_a_split_programs_whole_form (xcl-dev#2794) now expects the worker's whole blob and no piece blobs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chain The mandatory preparation path (prepare_compiled_compute: xcl run's startup preparation and its workers, the PSO corpus and milestones) built every split compute program three ways: the whole DXIL under the ABI root (.pso), every piece under the chain root(s) (.chain.pso), and the whole DXIL again under each chain root. Since ec80c07 the runtime first loads the ABI whole blob (CachedWhole) and builds no chain when it loads, so the pieces and the chain-root whole were never used. In a full preparation of a retail game the chain-root wholes were ~37 % of the driver work (size-weighted) and the pieces ~11.5 %. Now the whole is built first, and the chain only when the runtime would not find the whole (chain_needed): it was refused or over the cap, or its driver blob is not on disk. A record whose whole failed is prepared when its pieces are built; the chain-root whole is not tried then (the same DXIL under another root). The non-mandatory --pipelines path (make_selected) is unchanged. The e2e test a_preparation_worker_also_builds_a_split_programs_whole_form (xcl-dev#2794) expected the old pieces plus whole. It becomes a_preparation_worker_keeps_a_split_programs_abi_whole, by andrewDoing: the program splits into >= 2 pieces, the worker writes exactly its ABI whole, a warm worker run builds nothing, and a fresh runtime process loads that blob and dispatches it correctly. His part was written with OpenAI Codex (GPT-6.2 Sol). Co-Authored-By: andrewDoing <18390227+andrewDoing@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chain The mandatory preparation path (prepare_compiled_compute: xcl run's startup preparation and its workers, the PSO corpus and milestones) built every split compute program three ways: the whole DXIL under the ABI root (.pso), every piece under the chain root(s) (.chain.pso), and the whole DXIL again under each chain root. Since ec80c07 the runtime first loads the ABI whole blob (CachedWhole) and builds no chain when it loads, so the pieces and the chain-root whole were never used. In a full preparation of a retail game the chain-root wholes were ~37 % of the driver work (size-weighted) and the pieces ~11.5 %. Now the whole is built first, and the chain only when the runtime would not find the whole (chain_needed): it was refused or over the cap, or its driver blob is not on disk. A record whose whole failed is prepared when its pieces are built; the chain-root whole is not tried then (the same DXIL under another root). The non-mandatory --pipelines path (make_selected) is unchanged. The e2e test a_preparation_worker_also_builds_a_split_programs_whole_form (xcl-dev#2794) expected the old pieces plus whole. It becomes a_preparation_worker_keeps_a_split_programs_abi_whole, by andrewDoing: the program splits into >= 2 pieces, the worker writes exactly its ABI whole, a warm worker run builds nothing, and a fresh runtime process loads that blob and dispatches it correctly. His part was written with OpenAI Codex (GPT-6.2 Sol). Co-Authored-By: andrewDoing <18390227+andrewDoing@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chain The mandatory preparation path (prepare_compiled_compute: xcl run's startup preparation and its workers, the PSO corpus and milestones) built every split compute program three ways: the whole DXIL under the ABI root (.pso), every piece under the chain root(s) (.chain.pso), and the whole DXIL again under each chain root. Since ec80c07 the runtime first loads the ABI whole blob (CachedWhole) and builds no chain when it loads, so the pieces and the chain-root whole were never used. In a cold full preparation of a retail game, size-weighted, the chain-root wholes are ~40 % of the compute driver work and the pieces ~12 %: ~52 % in all (51-53 % for size^1.5 to size^1.7). Now the whole is built first, and the chain only when the runtime would not find the whole (chain_needed): it was refused or over the cap, or its driver blob is not on disk. A record whose whole failed is prepared when its pieces are built; the chain-root whole is not tried then (the same DXIL under another root). The non-mandatory --pipelines path (make_selected) is unchanged. The e2e test a_preparation_worker_also_builds_a_split_programs_whole_form (xcl-dev#2794) expected the old pieces plus whole. It becomes a_preparation_worker_keeps_a_split_programs_abi_whole, by andrewDoing: the program splits into >= 2 pieces, the worker writes exactly its ABI whole, a warm worker run builds nothing, and a fresh runtime process loads that blob and dispatches it correctly. His part was written with OpenAI Codex (GPT-6.2 Sol). Co-Authored-By: andrewDoing <18390227+andrewDoing@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chain The mandatory preparation path (prepare_compiled_compute: xcl run's startup preparation and its workers, the PSO corpus and milestones) built every split compute program three ways: the whole DXIL under the ABI root (.pso), every piece under the chain root(s) (.chain.pso), and the whole DXIL again under each chain root. Since ec80c07 the runtime first loads the ABI whole blob (CachedWhole) and builds no chain when it loads, so the pieces and the chain-root whole were never used. In a full preparation of a retail game the chain-root wholes were ~37 % of the driver work (size-weighted) and the pieces ~11.5 %. Now the whole is built first, and the chain only when the runtime would not find the whole (chain_needed): it was refused or over the cap, or its driver blob is not on disk. A record whose whole failed is prepared when its pieces are built; the chain-root whole is not tried then (the same DXIL under another root). The non-mandatory --pipelines path (make_selected) is unchanged. The e2e test a_preparation_worker_also_builds_a_split_programs_whole_form (xcl-dev#2794) now expects the worker's whole blob and no piece blobs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 178241b)
The workers that build a title's compute pipelines before it starts (
pipelines_in_workers) never build split programs' whole forms.precompilebuilds a whole form only when it has astartupstate, and the workers run it without one. The title then builds each whole form at the program's first ExecuteIndirect, on its own thread (Chain::whole): 15–25 s a program cold, for 750 KB – 1.1 MB of DXIL. With that, the newer retail title froze in its world load for minutes. @KDenKC found it and posted this change on #2624 as a suggestion, not a PR. This is that change, with a test.What is in it (one commit)
crates/xcl/src/shaders.rs:precompilealso builds the whole form of a split program in a preparation worker (XCL_PRECOMPILE_PARENTset, asworker_commandsets it).crates/xcl/tests/gpu_compute_e2e.rs:a_preparation_worker_also_builds_a_split_programs_whole_form. It runs the split program ofoffline_split_compute_pipeline_is_reused_by_a_second_processas a worker would. The precompile must make one pipeline more than the program has pieces, and keep a driver blob for each. Without the change it fails: "the whole form was not built" (7 pipelines with it, 6 without, for 6 pieces).What it does in the title (one run per arm each)
used-*lists (xcl run: shader preparation in worker processes, only what earlier runs used; upstream main; sampler fix #2624):xcl nvprofileputs xcl.exe in an NVIDIA profile with a bigger shader heap (#2403) #2590):Chain::whole(symbolized thread dumps).The cost is a longer first preparation. Later launches find the whole forms in the driver cache.
Tested
XCL_ADAPTER=Radeon. Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11. Debug builds for the tests, release for the runs.cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4, on this PR's head3c4891ddand on its baseaf2cecc4:texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_staystexture_upload::tests::pieces_hold_the_texels_of_their_levelsconsole_ms_in_as_slot_and_ms_with_as_are_refused_cleanlyasync_compute_pso_registers_real_pso_and_not_standintwo_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs(RTX 4070 Ti, twice)fuzz_validate_and_gpu_1(RDNA2, 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)... ok).Regression run
RTX 4070 Ti (driver 621.40), release builds, 60 s each,
scripts/smoke.ps1 -Game <folder> -Title retail-titleon the newer retail title, with the same settings. All three ran with the NVIDIA shader-heap profile (#2590, 1 GiB) installed on this machine. The game reaches no ExecuteIndirect of a split program in 60 s, so this checks that nothing else changes. Base and PR ran one after the other; the base's run shared the GPU with a test suite of mine for part of it.main (
b49be183, merge base ofmainandnvidia-dev):nvidia-dev (
af2cecc4, this PR's base):PR:
Not tested
af2cecc4together with my memory-report commits (D3D12.X: a memory line by owner, against DXGI's budget #2697, D3D12.X: count the resources XCL makes for itself, by where it makes them #2750).AI use