Shaders: a title's preparation workers build split programs' whole forms #2794

Open
github-bot wants to merge 1 commit from github-bot/gh-2794 into nvidia-dev AGit
Owner

@⁠joeypercia on GitHub · 2026-11-26 13:34 UTC · original
joeypercia:shaders-worker-whole-forms → nvidia-dev · +57 −1 · 2 files · 1 commits · open

The workers that build a title's compute pipelines before it starts (pipelines_in_workers) never build split programs' whole forms. precompile builds a whole form only when it has a startup state, 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: precompile also builds the whole form of a split program in a preparation worker (XCL_PRECOMPILE_PARENT set, as worker_command sets it).
  • crates/xcl/tests/gpu_compute_e2e.rs: a_preparation_worker_also_builds_a_split_programs_whole_form. It runs the split program of offline_split_compute_pipeline_is_reused_by_a_second_process as 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)

  • KDenKC, RTX 5090, cold except one earlier run's used-* lists (#2624):
    • Bind waits on cold whole forms: 20 waits, 468.5 s, down to 0.
    • Preparation: 9.4 min, up to 32.3 min.
    • Draws / dispatches after +120 s: 582 / 547, up to 3,442 / 7,695.
  • RTX 4070 Ti 12 GB, 1 GiB shader heap (#2590):
    • Without the change, two runs froze from about 130 s, title threads in Chain::whole (symbolized thread dumps).
    • With it, the first preparation took 754 s. The next launch prepared in 17 s, and the title went through the world load with no freeze, to the 438 s cap.

The cost is a longer first preparation. Later launches find the whole forms in the driver cache.

Tested

  • NVIDIA GeForce RTX 4070 Ti (driver 621.40), and the AMD Radeon iGPU of a Ryzen 7 7800X3D (RDNA2) with 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, then cargo test --workspace --no-fail-fast -- --test-threads=4, on this PR's head 3c4891dd and on its base af2cecc4:
    • RTX 4070 Ti: head 1746 passed, 6 failed, 48 ignored; base 1745 passed, 6 failed, 48 ignored.
    • RDNA2: head 1746 passed, 5 failed, 48 ignored; base 1745 passed, 5 failed, 48 ignored.
    • The failures are the same tests on head and base:
      • texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays
      • texture_upload::tests::pieces_hold_the_texels_of_their_levels
      • console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly
      • async_compute_pso_registers_real_pso_and_not_standin
      • two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (RTX 4070 Ti, twice)
      • fuzz_validate_and_gpu_1 (RDNA2, #2115)
    • The new test ran on both adapters (... ok).

Regression run

RTX 4070 Ti (driver 621.40), release builds, 60 s each, scripts/smoke.ps1 -Game <folder> -Title retail-title on 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 of main and nvidia-dev):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4070 Ti
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1426 (PresentX 1426)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17542 MB

nvidia-dev (af2cecc4, this PR's base):

xcl-smoke v1
commit: af2cecc40886a8682ecf3267f5328c6dc4b66ad7
gpu: NVIDIA GeForce RTX 4070 Ti
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1454 (PresentX 1454)
presents per 2 s (last 3): 60 47 32
device removals: 0
crashes: 0
peak commit: 20359 MB

PR:

xcl-smoke v1
commit: 3c4891dd4cf7d249d7f818aec05c7150a347504a
gpu: NVIDIA GeForce RTX 4070 Ti
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1557 (PresentX 1557)
presents per 2 s (last 3): 60 60 59
device removals: 0
crashes: 0
peak commit: 18699 MB

Not tested

  • A title run on this exact commit. The 4070 Ti runs above had the same change on af2cecc4 together with my memory-report commits (#2697, #2750).
  • The preparation's length with the default worker count on a cold cache (KDenKC: 6 workers, 32 min; here: 12 workers, 754 s, with most translations already cached).
  • AMD in a title.

AI use

  • Claude Code with Claude Opus 5.5 wrote the test and this description, ran the tests and the runs on the hardware above, and applied the change @⁠KDenKC posted on #2624 (written there with Codex).
**@⁠joeypercia** on GitHub · 2026-11-26 13:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/2794) `joeypercia:shaders-worker-whole-forms` → `nvidia-dev` · +57 −1 · 2 files · 1 commits · open The workers that build a title's compute pipelines before it starts (`pipelines_in_workers`) never build split programs' whole forms. `precompile` builds a whole form only when it has a `startup` state, 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`: `precompile` also builds the whole form of a split program in a preparation worker (`XCL_PRECOMPILE_PARENT` set, as `worker_command` sets it). - `crates/xcl/tests/gpu_compute_e2e.rs`: `a_preparation_worker_also_builds_a_split_programs_whole_form`. It runs the split program of `offline_split_compute_pipeline_is_reused_by_a_second_process` as 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) - KDenKC, RTX 5090, cold except one earlier run's `used-*` lists (#2624): - Bind waits on cold whole forms: 20 waits, 468.5 s, down to 0. - Preparation: 9.4 min, up to 32.3 min. - Draws / dispatches after +120 s: 582 / 547, up to 3,442 / 7,695. - RTX 4070 Ti 12 GB, 1 GiB shader heap (#2590): - Without the change, two runs froze from about 130 s, title threads in `Chain::whole` (symbolized thread dumps). - With it, the first preparation took 754 s. The next launch prepared in 17 s, and the title went through the world load with no freeze, to the 438 s cap. The cost is a longer first preparation. Later launches find the whole forms in the driver cache. **Tested** - NVIDIA GeForce RTX 4070 Ti (driver 621.40), and the AMD Radeon iGPU of a Ryzen 7 7800X3D (RDNA2) with `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`, then `cargo test --workspace --no-fail-fast -- --test-threads=4`, on this PR's head `3c4891dd` and on its base `af2cecc4`: - RTX 4070 Ti: head **1746 passed, 6 failed, 48 ignored**; base 1745 passed, 6 failed, 48 ignored. - RDNA2: head **1746 passed, 5 failed, 48 ignored**; base 1745 passed, 5 failed, 48 ignored. - The failures are the same tests on head and base: - `texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays` - `texture_upload::tests::pieces_hold_the_texels_of_their_levels` - `console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly` - `async_compute_pso_registers_real_pso_and_not_standin` - `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` (RTX 4070 Ti, twice) - `fuzz_validate_and_gpu_1` (RDNA2, #2115) - The new test ran on both adapters (`... ok`). **Regression run** RTX 4070 Ti (driver 621.40), release builds, 60 s each, `scripts/smoke.ps1 -Game <folder> -Title retail-title` on 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 of `main` and `nvidia-dev`): ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 4070 Ti title: retail-title seconds: 60 exit: 0x0 frames shown: 1426 (PresentX 1426) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17542 MB ``` nvidia-dev (`af2cecc4`, this PR's base): ``` xcl-smoke v1 commit: af2cecc40886a8682ecf3267f5328c6dc4b66ad7 gpu: NVIDIA GeForce RTX 4070 Ti title: retail-title seconds: 60 exit: 0x0 frames shown: 1454 (PresentX 1454) presents per 2 s (last 3): 60 47 32 device removals: 0 crashes: 0 peak commit: 20359 MB ``` PR: ``` xcl-smoke v1 commit: 3c4891dd4cf7d249d7f818aec05c7150a347504a gpu: NVIDIA GeForce RTX 4070 Ti title: retail-title seconds: 60 exit: 0x0 frames shown: 1557 (PresentX 1557) presents per 2 s (last 3): 60 60 59 device removals: 0 crashes: 0 peak commit: 18699 MB ``` **Not tested** - A title run on this exact commit. The 4070 Ti runs above had the same change on `af2cecc4` together with my memory-report commits (#2697, #2750). - The preparation's length with the default worker count on a cold cache (KDenKC: 6 workers, 32 min; here: 12 workers, 754 s, with most translations already cached). - AMD in a title. **AI use** - Claude Code with Claude Opus 5.5 wrote the test and this description, ran the tests and the runs on the hardware above, and applied the change @⁠KDenKC posted on #2624 (written there with Codex).
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, #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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:37:22 +00:00
Author
Owner

@⁠ettehn on GitHub · 2026-11-26 13:40 UTC · original

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 fresh xcl shaders process. The ordinary and worker arms began with separate empty XCL caches.

Run Driver cache hits Result
Ordinary precompile, cold 0 Six piece blobs
Worker precompile, cold 0 Same six blob names plus one whole-form blob
Worker precompile, warm 7 All six pieces and the whole form reused
Worker precompile after replacing only the whole-form blob with invalid bytes 6 Each piece reused, whole-form blob rebuilt under its original name

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:

cargo test --locked --offline -p xcl --test gpu_compute_e2e -j 2 -- worker_reuses_and_recovers_the_whole_pipeline_blob 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

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.

**@⁠ettehn** on GitHub · 2026-11-26 13:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/2794#issuecomment-7193666519) 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 fresh `xcl shaders` process. The ordinary and worker arms began with separate empty XCL caches. | Run | Driver cache hits | Result | | --- | ---: | --- | | Ordinary precompile, cold | 0 | Six piece blobs | | Worker precompile, cold | 0 | Same six blob names plus one whole-form blob | | Worker precompile, warm | 7 | All six pieces and the whole form reused | | Worker precompile after replacing only the whole-form blob with invalid bytes | 6 | Each piece reused, whole-form blob rebuilt under its original name | 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`: ```text cargo test --locked --offline -p xcl --test gpu_compute_e2e -j 2 -- worker_reuses_and_recovers_the_whole_pipeline_blob 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 ``` 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.
Author
Owner

@⁠retrope13 on GitHub · 2026-11-26 13:53 UTC · original

Independent RTX 4060 Laptop (8 GB, DXC 1.9.2602.17) full-suite verification and diff check of #2794 (3c4891dd) against base nvidia-dev (af2cecc4): full workspace suite passes with zero new failures. No title was run.

Tested

  • Hardware / Env: NVIDIA GeForce RTX 4060 Laptop GPU (8 GB, Ada Lovelace, driver 32.0.16.2140, wave32), Intel Core i5-14500HX (14C/20T), 24 GB RAM, Windows 11 26H2 (build 26300.9818), rustc 1.100.0 (stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100.0 DXC 1.9.2602.17, XCL_ADAPTER=NVIDIA.
  • Targeted split-program tests (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).
    • Under XCL_ADAPTER=Intel (Intel UHD Graphics, driver 32.0.101.7092): all 3 cleanly reported SKIPPED: no wave32 GPU.
  • Full workspace (debug): cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4:
    • Base af2cecc4: 1748 passed, 6 failed, 48 ignored
    • PR #2794 (3c4891dd): 1749 passed, 6 failed, 48 ignored (+1 new test, 0 regressions)
    • The 6 failures are identical on both base and head (the same 6 known pre-existing nvidia-dev failures listed in the PR description).

Diff Check (af2cecc4..3c4891dd)

  • Confirmed recomp::pso::console_to_dxil_in routes both cold translations and XCL_DXIL_CACHE hits through the same Ok(c) path in shaders.rs:2168-2178, where p.make(&c) builds only the split pieces and p.make_one(&c.dxil, &c.samplers, true, None) builds the whole form against dispatch_chain_root_signature.
  • The std::env::var_os("XCL_PRECOMPILE_PARENT").is_some() check at shaders.rs:2175 matches the existing worker check at shaders.rs:2097.

Not Tested

  • Live retail title preparation/runtime runs, AMD GPUs, release builds, and the 48 #[ignore] / SKIPPED tests.

AI disclosure: Antigravity (Gemini 4 Neon, XHigh) ran the builds/tests, checked the diff, and drafted this report.

**@⁠retrope13** on GitHub · 2026-11-26 13:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/2794#issuecomment-7193969302) **Independent RTX 4060 Laptop (8 GB, DXC `1.9.2602.17`) full-suite verification and diff check of `#2794` (`3c4891dd`) against base `nvidia-dev` (`af2cecc4`): full workspace suite passes with zero new failures.** No title was run. ### Tested - **Hardware / Env:** NVIDIA GeForce RTX 4060 Laptop GPU (8 GB, Ada Lovelace, driver `32.0.16.2140`, wave32), Intel Core i5-14500HX (14C/20T), 24 GB RAM, Windows 11 26H2 (build `26300.9818`), `rustc 1.100.0` (`stable-x86_64-pc-windows-msvc`), Windows SDK `10.0.26100.0` DXC `1.9.2602.17`, `XCL_ADAPTER=NVIDIA`. - **Targeted split-program tests (`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`). - Under `XCL_ADAPTER=Intel` (Intel UHD Graphics, driver `32.0.101.7092`): all 3 cleanly reported `SKIPPED: no wave32 GPU`. - **Full workspace (debug):** `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`: - Base `af2cecc4`: **1748 passed, 6 failed, 48 ignored** - PR `#2794` (`3c4891dd`): **1749 passed, 6 failed, 48 ignored** (+1 new test, 0 regressions) - The 6 failures are identical on both base and head (the same 6 known pre-existing `nvidia-dev` failures listed in the PR description). ### Diff Check (`af2cecc4..3c4891dd`) - Confirmed `recomp::pso::console_to_dxil_in` routes both cold translations and `XCL_DXIL_CACHE` hits through the same `Ok(c)` path in `shaders.rs:2168-2178`, where `p.make(&c)` builds only the split pieces and `p.make_one(&c.dxil, &c.samplers, true, None)` builds the whole form against `dispatch_chain_root_signature`. - The `std::env::var_os("XCL_PRECOMPILE_PARENT").is_some()` check at `shaders.rs:2175` matches the existing worker check at `shaders.rs:2097`. ### Not Tested - Live retail title preparation/runtime runs, AMD GPUs, release builds, and the 48 `#[ignore]` / `SKIPPED` tests. *AI disclosure: Antigravity (Gemini 4 Neon, XHigh) ran the builds/tests, checked the diff, and drafted this report.*
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2794/head:github-bot/gh-2794'
git switch 'github-bot/gh-2794'

Merge

Merge the changes and update on Forgejo.
git switch 'nvidia-dev'
git merge --no-ff 'github-bot/gh-2794'
git switch 'github-bot/gh-2794'
git rebase 'nvidia-dev'
git switch 'nvidia-dev'
git merge --ff-only 'github-bot/gh-2794'
git switch 'github-bot/gh-2794'
git rebase 'nvidia-dev'
git switch 'nvidia-dev'
git merge --no-ff 'github-bot/gh-2794'
git switch 'nvidia-dev'
git merge --squash 'github-bot/gh-2794'
git switch 'nvidia-dev'
git merge --ff-only 'github-bot/gh-2794'
git switch 'nvidia-dev'
git merge 'github-bot/gh-2794'
git push origin 'nvidia-dev'
This discussion has been locked. Commenting is limited to contributors.
No description provided.