Shaders: a title's preparation workers build split programs' whole forms #2784
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2794"
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?
Imported from ivall/xcl. Originally posted by joeypercia on 2026-11-26T13:34:56Z.
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 (#2624):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, #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 (#2697, #2750).AI use
Imported from ivall/xcl. Originally posted by ettehn on 2026-11-26T13:40:01Z.
Independent Windows check of warm-cache reuse and recovery on
3c4891dd4cf7d249d7f818aec05c7150a347504a. The only local change was a synthetic test extending the six-piece fixture. Each row launched a freshxcl shadersprocess. The ordinary and worker arms began with separate empty XCL caches.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,
XCL_ADAPTER=NVIDIA XCL_REQUIRE_GPU=wave64: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.
Imported from ivall/xcl. Originally posted by retrope13 on 2026-11-26T13:53:02Z.
Independent RTX 4060 Laptop (8 GB, DXC
1.9.2602.17) full-suite verification and diff check of#2794(3c4891dd) against basenvidia-dev(af2cecc4): full workspace suite passes with zero new failures. No title was run.Tested
32.0.16.2140, wave32), Intel Core i5-14500HX (14C/20T), 24 GB RAM, Windows 11 26H2 (build26300.9818),rustc 1.100.0(stable-x86_64-pc-windows-msvc), Windows SDK10.0.26100.0DXC1.9.2602.17,XCL_ADAPTER=NVIDIA.gpu_compute_e2e, debug):cargo test --locked -p xcl --test gpu_compute_e2e -- a_preparation_worker_also_builds_a_split_programs_whole_form offline_split_compute_pipeline_is_reused_by_a_second_process split_compute_prefers_the_offline_whole_pipeline --test-threads=1 --nocapture: 3 passed, 0 failed, 0 skipped (4.40 s).XCL_ADAPTER=Intel(Intel UHD Graphics, driver32.0.101.7092): all 3 cleanly reportedSKIPPED: no wave32 GPU.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4:af2cecc4: 1748 passed, 6 failed, 48 ignored#2794(3c4891dd): 1749 passed, 6 failed, 48 ignored (+1 new test, 0 regressions)nvidia-devfailures listed in the PR description).Diff Check (
af2cecc4..3c4891dd)recomp::pso::console_to_dxil_inroutes both cold translations andXCL_DXIL_CACHEhits through the sameOk(c)path inshaders.rs:2168-2178, wherep.make(&c)builds only the split pieces andp.make_one(&c.dxil, &c.samplers, true, None)builds the whole form againstdispatch_chain_root_signature.std::env::var_os("XCL_PRECOMPILE_PARENT").is_some()check atshaders.rs:2175matches the existing worker check atshaders.rs:2097.Not Tested
#[ignore]/SKIPPEDtests.AI disclosure: Antigravity (Gemini 4 Neon, XHigh) ran the builds/tests, checked the diff, and drafted this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-26T14:50:25Z.
Test report: on an RTX 4080 16 GB this removes the no-frame stretch at world entry. This is the stall I measured on
nvidia-devthis morning (#2688, comment 7184950679, updates 3–5: two title threads inExecuteIndirect→Chain::whole, 13–20 s a program).Tested
git apply, as it is) onnvidia-devaf2cecc4+ #684 + #2697 + #2749 + #2729 + the two-pass stack #2817. The retail title of #505, Series X profile, the data folder of the earlier runs (so the used-program list holds the world's programs).Not tested
AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report.
Imported from ivall/xcl. Originally posted by imnicho on 2026-11-26T16:02:09Z.
RTX 5080 16 GB on a small PC (i7-7700K, 16 GB RAM),
nvidia-devaf2cecc4, one run per arm. Not this PR's commit: a local change with the same test onXCL_PRECOMPILE_PARENTinprecompile.The table, the settings and what else differed between the two arms are in https://github.com/xcl-dev/xcl/pull/2551#issuecomment-7195509026.
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.
Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-26T15:33:48Z.
Exact-head preparation-worker check on an RTX 5090 using a slice of a retail shader pack. I ran clean
nvidia-devaf2cecc40886a8682ecf3267f5328c6dc4b66ad7and clean PR head3c4891dd4cf7d249d7f818aec05c7150a347504aon Windows 11 26200, Ryzen 7 9800X3D, 32 GB RAM, and RTX 5090 32 GB.All three processed the same 20 used compute programs. Comparing the cache directories showed exactly four extra chain PSO blobs on the PR, one whole form per split program. The warm repeat loaded all 63 from XCL's driver cache.
I ran
xcl shaders <pack> --precompile --only cs --pipelines --windows 4 --used-onlyin separate processes withXCL_PRECOMPILE_PARENTset to the harness PID,XCL_PRECOMPILE_SLICE=7/48,XCL_ADAPTER=RTX 5090,XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=1,XCL_DXC_THREADS=2,XCL_PIPELINE_THREADS=1, and separateXCL_DXIL_CACHEdirectories copied from the same snapshot. These were seeded-cache runs, one per configuration. The full baseline title launch was stopped during preparation after nearly six minutes with two workers. World-load time and gameplay remain unmeasured in this check.AI use — Codex ran the comparison, checked the cache files, and summarized the logs.
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-26T17:24:27Z.
Independent test report under Wine/Proton (not native Windows) for head
3c4891dd, compared with basenvidia-dev(af2cecc4).Tested
AMD Radeon RX 9070 (RDNA4, RADV GFX1201, Mesa 26.3.1), Ryzen 5 9600X, CachyOS Linux 7.3.5
Proton Experimental
experimental-11.0-20261112, DXVKv3.1.1-209, DXC1.9.2609.5, Rust 1.96.0, targetx86_64-pc-windows-gnu, debug build for testsvkd3d-protonmasterec207194(dxil-spirvb540c8a2) with a local patch that drops thelpVtblidentity checks ind3d12_command_allocator_from_iface/d3d12_command_list_from_iface, loaded withWINEDLLOVERRIDES=d3d12,d3d12core,dxgi=n,b,VKD3D_CONFIG=ignore_shared_fence,XCL_DIRECT_DXIL=1cargo test -p xcl --test gpu_compute_e2e offline_split_compute_pipeline_is_reused_by_a_second_process a_preparation_worker_also_builds_a_split_programs_whole_form -- --test-threads=1: head 2 passed, 0 failed.Control: the head's test binary run against the base's
xcl.exefailsa_preparation_worker_also_builds_a_split_programs_whole_formwiththe whole form was not built … split compute programs: 1 (6 pieces). So the test catches the missing whole-form build, and the head fixes it.Retail title (release build, 2 preparation workers,
XCL_PREPARE_GRAPHICS=0, same seededused-pipelines.txton both runs, scripted input)af2cecc40xc0000005inucrtbase.dllwhile the title loaded3c4891ddThe 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
nvidia-dev), stock Protonvkd3d-protonAI use
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-26T19:12:53Z.
AMD Windows test report for head
3c4891dd4cf7d249d7f818aec05c7150a347504a(exact head, clean detached checkout, no local changes). Base:nvidia-devaf2cecc40886a8682ecf3267f5328c6dc4b66ad7. This answers the request for an AMD run on this PR.Tested
stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (Windows Kit 10.0.26100.0).XCL_ADAPTERunset, so the physical GPU was used, not WARP. Own target dir, rebuilt from scratch for each tree.cargo build --workspace -j 4: ok on both.cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4 --nocapture(debug):nvidia-devaf2cecc43c4891ddThe one extra pass is the new
a_preparation_worker_also_builds_a_split_programs_whole_form. The failures are the same on the base and on this head, so they are not caused by the PR:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722,res[30] = 0x1, CPU 0x7fffffff, the known AMD failure in #2115),hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_staysandpieces_hold_the_texels_of_their_levels(attempt to multiply with overflow, texture_upload.rs:1002), and the e2e testsconsole_ms_in_as_slot_and_ms_with_as_are_refused_cleanly,async_compute_pso_registers_real_pso_and_not_standinandtwo_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs(the last one counts in two test binaries, which is why 6 names make 7 failures). The 8 SKIPPED lines are the same on both: six f16/f32 per-lanerefusedcases and twono heap windows.scripts/smoke.ps1, release builds, title run from a local copy). Order matters here: the first base run did the whole startup shader preparation cold (26503 records; about 2.5 h of wall time in two starts, because my first start's timeout cut it off and the cache carried over). Every later run, including this head's, started with that cache complete, so this smoke does not exercise the cold-cache preparation path the PR changes. It only shows that the head does not regress a warm run.af2cecc4, run 1 (cold preparation first)3c4891d(warm cache)af2cecc4, run 2 (warm cache)title:isretail-title(the-Titleoption ofsmoke.ps1).Not tested
main: the PR targetsnvidia-devand was tested against it only.AI use: Claude Code (Claude Sonnet 5.5) ran the tests and drafted this report.
Imported from ivall/xcl. Originally posted by 3L1A5-1 on 2026-11-26T20:18:04Z.
8 GB desktop NVIDIA, one run of
3c4891dd: more title time than base, but the run still ends in device removal (0x887a0005) at title 266 s. Adds the 8 GB class to the 16 GB reports above.Tested
3c4891dd, clean detached worktree, release build.cargo test -p xcl --lib dispatch_chain10 passed,pso_async39 passed. Full suite not run (retrope13 covered it above).XCL_NETWORK=0. One run only: it shows the end state, not timing.Results
af2cecc4(our earlier runs, same PC)3c4891ddcompute PSO ... driver blob supplied, huge, ungated here. They come from blobs and are short (median ~70–100 ms, max 265 ms, 13.6 s in total). So the long cold compiles on the title threads are gone, but these 161 builds come in one burst. Presents drop to 0 over the same ~20 s, then the device is removed (raised by aCreatePlacedResourceXon a title thread). This matches imnicho's 168 pipelines after the world start.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.
Imported from ivall/xcl. Originally posted by joeypercia on 2026-11-26T20:18:22Z.
Thanks @3L1A5-1. A silent
0x887a0005right after a burst of new compute pipelines is what #2403 describes: NVIDIA's shader-code heap (512 MB by default) running out. If the run did not have it,xcl nvprofile install --mb 2048(#2590, needs an elevated prompt once) may be worth one run: on a 12 GB RTX 4070 Ti the removals went from 10 of 10 runs at the default to none in 2 of 2 at 2 GiB (https://github.com/xcl-dev/xcl/issues/2403). With 11 GB of local video memory against a 7.2 GB budget, the run may still end for another reason, as you say.AI use: Claude Code (Claude Opus 5.5) wrote this reply.
Imported from ivall/xcl. Originally posted by LocranKing on 2026-11-27T04:49:25Z.
Test observation on AMD Ryzen 5 5500 (6C/12T) + NVIDIA RTX 3060 Ti (8 GB) (
3c4891ddmerged withnvidia-devecc0bb57, Series S /lockhartprofile, starting from our warmlockhartcache snapshot with1,296used pipelines /3,206driver blobs).Startup preparation impact
nvidia-dev(ecc0bb57), startup compute pipeline preparation finished in 22–24 s (31–33 stotal pre-launch).#2794(3c4891dd+ecc0bb57), startup compute pipeline preparation jumped to 487 s (495.1 stotal pre-launch,0 of 8 workers failed) because the preparation workers built all split programs'wholeforms upfront.Note on the 180 s smoke run
Because
XCL_PRESS_AT(18:A..74:A) counts from host start rather than guest entry, all scriptedApresses fired during the495 sstartup preparation, so the title remained in the menus (5,147frames,60 60 60,peak commit: 14,615 MB,0crashes,0device removals) and did not enter world load during that 180 s run. World-load behavior with#2794after a487 swarm/whole-form prep is therefore Not tested here; the measured data point is the 487 s startup preparation cost on 6C/12T when splitwholeforms are not yet cached.Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-11-27T11:27:39Z.
Test report on an RTX 3070 Laptop 8 GB: #2794 fixes the freeze when a retail title's 3D world starts loading on
nvidia-dev. Tested together with #2905, #2967, #2815, #2816, #2817 and #684.Tested tree (local merge, not pushed)
nvidia-dev3f39671d, plus:3c4891ddd900644df058e4ea42ae60519ae803e3a2c10b4ae56dbc3f, cherry-picked)Tested
cargo test --release -p xcl --lib -- --test-threads=4, on the same stack before3f39671dwas merged in: 1731 passed, 4 failed, 28 ignored.--exact. Another test run was using the GPU at the same time; one of them failed withE_OUTOFMEMORY.a_reset_that_puts_the_allocator_aside_keeps_what_the_gpu_still_reads,a_split_after_kickoff_does_not_take_the_segment_just_submitted,cross_queue_wait64_before_signal_does_not_deadlock_submit_thread,d32s8_targets_take_their_own_size_of_video_memory.XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_WATCH_HOT=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=60000.nvidia-deve0821b12memcpyfromxg::copy_fromat 123 s, while the world loads. It is #477/#662; #684 fixes it.e0821b12+ #684waited N ms for a graphics pipeline being built(1–12 s each). After ~430 s, no more submits until the end.e0821b12+ #684XCL_DEVICE_TYPE=lockhartXCL_TEXTURE_LEVEL_PAGES=1 XCL_SPARSE_LAZY=1page fault at GPU VA 0x0(DRED is populated now thanks to #2967). 21 s earlier, a 915 KB DXIL compute PSO compile had finished; it took 21.5 s.Not tested
xcl nvprofile(#2590). Run 6 may be the #2403 shader-heap case.--libran).AI use
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-27T16:16:29Z.
Independent Windows check of 3c4891dd against its exact
nvidia-devparent af2cecc. RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1, DXC 1.8.2502.11.a_preparation_worker_also_builds_a_split_programs_whole_formtest passed on the RTX 3080 Ti:cargo test --offline --locked -j 4 -p xcl --test gpu_compute_e2e -- a_preparation_worker_also_builds_a_split_programs_whole_form --nocapture --test-threads=1— 1 passed, 0 failed, 0 ignored, 0 skips.cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 --quieton the PR head: 1,745 passed, 7 failed, 48 ignored; 26 GPU skip notices. The same command on the exact parent: 1,741 passed, 10 failed, 48 ignored; 26 GPU skip notices. Every failing test on the head also failed on the parent. Three additionale2etests failed only in the parent run; this comparison does not establish why they differed.XCL_TEST_WARP=1andXCL_ADAPTER=warpand built the revisions in separate target directories.cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::sparse::tests::a_gpu_write_into_a_gpu_view_lands_in_its_cpu_view -- --exact --test-threads=1 --nocapturepassed 1/1 on each. The four-thread lib suite (cargo test --offline --locked -j 4 -p xcl --lib -- --test-threads=4 --nocapture) finished without device removal on each: head 1,617 passed, 3 failed, 28 ignored; parent 1,616 passed, 4 failed, 28 ignored; 350 software-adapter skip notices on each. The three head failures also occurred on the parent; its fourth wasmid_list_write64_wait64_split_avoids_cycle_and_reuses_spares.The Windows CI log ends after a
0x3b0000GPU-view reservation and a 256-byte upload-bufferMapreturning0x887a0005. Those details matcha_gpu_write_into_a_gpu_view_lands_in_its_cpu_view, butMapis only where device removal was observed; the operation that caused it is unknown. A matched run of that exact test, then the four-thread lib suite, on CI'swindows-2025image at both commits would distinguish an isolated failure from a concurrent or baseline failure. CapturingGetDeviceRemovedReasonbefore and after its tile submit and beforeMapwould narrow the trigger if it reproduces.Correction to my earlier wording:
XCL_ADAPTER=warpalone did not force this sparse test onto WARP; its helper checksXCL_TEST_WARP. The CI failure remains unresolved. Not tested: retail title, paired smoke, AMD or Intel GPU. AI use: Codex (GPT-6.2 Sol) ran the tests, checked the CI path and wrote this report.Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-27T21:08:07Z.
merge-check
base: d1be8103644791b7a65f068954324e93d4b1b565 (
nvidia-dev)head: 3c4891dd4cf7d249d7f818aec05c7150a347504a
merge: clean trial merge into the current
nvidia-devtip; two intended files, 57 insertions and 1 deletion.build:
cargo build --locked --workspace-> ok.tests:
cargo test --locked --workspace --no-fail-fast -- --test-threads=4-> 1,824 passed, 9 failed, 48 ignored; 27 GPU skip notices.a_preparation_worker_also_builds_a_split_programs_whole_formpassed on the RTX 3080 Ti without a skip. The same command on untouchednvidia-devat this exact base reported 1,823 passed, 9 failed, 48 ignored, with the same 27 skip notices and the same nine failing test instances (base comparison). No new suite failure in the trial merge.review: none found after reading the whole merged diff and tracing the preparation-worker call, whole-pipeline root signature and driver-cache key. The worker is identified by
XCL_PRECOMPILE_PARENT; the extra whole build goes through the existing pipeline concurrency and size limits.performance: by code path, cold title preparation builds an additional whole PSO for each eligible split program, so it can take longer before play and use more transient compiler memory. It moves that work out of the first
ExecuteIndirect; I did not measure local preparation or frame times. Whole DXIL over the worker's default 8 MiB cap can still be left for runtime.verdict: safe to merge for this diff against this
nvidia-devtip. The branch's existing CI failures remain to be fixed before its normal merge gate is green.hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (NVIDIA 621.35), rustc 1.99.1 MSVC, SDK DXC 1.8.2502.11. Codex (GPT-6.2 Sol) ran the merge, build, and tests and wrote this check; Codex (GPT-6.2 Astra) independently reviewed the shader and cache path.
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.
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T23:42:07Z.
merge-check claim
head:
3c4891dd4cImported from ivall/xcl. Originally posted by throny on 2026-11-28T00:04:27Z.
merge-check
base:
d1be8103(nvidia-dev)head:
3c4891dd4cmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1825 passed, 8 failed, 48 ignored (27 SKIPPED lines). The 8 failures are the base's own on this GPU, the same six names with and without the PR (async_compute_pso_registers_real_pso_and_not_standin, split_compute_prefers_the_offline_whole_pipeline, two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, two texture_upload tests; #2771 and #2788 fix three of them). Base alone: 1824 passed, 8 failed, 48 ignored.
review: none. The worker switch it keys on is the one the existing worker command sets; the test starts the xcl binary on its own temp folder and fails without the change (it asserts one pipeline more).
performance: no frame cost; it takes whole-form builds of split programs off the title's threads (the stalls reported in the thread). The first cold preparation gets longer (figures in the thread, not measured here). To watch together with #2705: workers are sized at 3 GB each there, and a tester measured 6.7–10.9 GB per worker when whole forms are built.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).