Shaders: gate offline --pipelines large DXIL builds on commit headroom #2179

Open
github-bot wants to merge 1 commit from github-bot/gh-2179 into main AGit
Owner

@⁠O5-7 on GitHub · 2026-11-25 07:54 UTC · original
O5-7:shaders/offline-pipelines-memory-gate → main · +195 −16 · 2 files · 1 commits · open

Part of #1598

What is in it

  • Expose huge_pso_bytes, huge_pso_concurrency, GIANT_DRIVER_COMPILE, ig_compile_headroom, and ig_compile_commit_free as pub(crate) in crates/xcl/src/hle/d3d12x/real.rs without changing runtime behavior.
  • Add OfflineGate in crates/xcl/src/shaders.rs so cold (uncached) xcl shaders --precompile --pipelines builds follow the same huge-DXIL concurrency cap, giant-DXIL serialization, and GlobalMemoryStatusEx commit-headroom wait policy as runtime xcl-pso* workers while keeping cached-blob loads ungated and avoiding deadlock when no other cold compile is in flight.
  • Add RAII guards for both OfflineGate and Pipelines::running plus unit tests in shaders::offline_gate_tests.

Tested

  • Hardware / toolchain: NVIDIA GeForce RTX 5080 (driver 32.0.15.9579), AMD Ryzen 7 9700X, Windows 11 Pro 10.0.26100,
    ustc 1.100.0 (0ef1bc386 2026-11-09), debug tests & release smoke run, DXC 1.8.2502.11 (D:\Windows Kits\10\bin\10.0.26100.0\x64).
  • cargo test -p xcl pipeline_cap -- --nocapture: 2 passed, 0 failed, 0 ignored.
  • cargo test -p xcl offline_gate -- --nocapture: 3 passed, 0 failed, 0 ignored.
  • cargo test --workspace -- --test-threads=4: 1157 passed, 0 failed, 46 ignored.

Regression run
xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1680 (PresentX 1680) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 13673 MB
xcl-smoke v1 commit: 7bc00bc1ef3d94ad1e5367046028b5ec5aedb56e gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1684 (PresentX 1684) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13624 MB

Not tested

  • No full retail shader-pack xcl shaders --precompile --pipelines peak-commit A/B run was performed here.

AI use

  • Antigravity (Gemini 4 Neon) wrote the OfflineGate implementation, unit tests, PR description, and ran the test suite and smoke test.
**@⁠O5-7** on GitHub · 2026-11-25 07:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2179) `O5-7:shaders/offline-pipelines-memory-gate` → `main` · +195 −16 · 2 files · 1 commits · open Part of #1598 **What is in it** - Expose huge_pso_bytes, huge_pso_concurrency, GIANT_DRIVER_COMPILE, ig_compile_headroom, and ig_compile_commit_free as pub(crate) in crates/xcl/src/hle/d3d12x/real.rs without changing runtime behavior. - Add OfflineGate in crates/xcl/src/shaders.rs so cold (uncached) xcl shaders --precompile --pipelines builds follow the same huge-DXIL concurrency cap, giant-DXIL serialization, and GlobalMemoryStatusEx commit-headroom wait policy as runtime xcl-pso* workers while keeping cached-blob loads ungated and avoiding deadlock when no other cold compile is in flight. - Add RAII guards for both OfflineGate and Pipelines::running plus unit tests in shaders::offline_gate_tests. **Tested** - Hardware / toolchain: NVIDIA GeForce RTX 5080 (driver 32.0.15.9579), AMD Ryzen 7 9700X, Windows 11 Pro 10.0.26100, ustc 1.100.0 (0ef1bc386 2026-11-09), debug tests & release smoke run, DXC 1.8.2502.11 (D:\Windows Kits\10\bin\10.0.26100.0\x64). - cargo test -p xcl pipeline_cap -- --nocapture: 2 passed, 0 failed, 0 ignored. - cargo test -p xcl offline_gate -- --nocapture: 3 passed, 0 failed, 0 ignored. - cargo test --workspace -- --test-threads=4: 1157 passed, 0 failed, 46 ignored. **Regression run** ` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1680 (PresentX 1680) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 13673 MB ` ` xcl-smoke v1 commit: 7bc00bc1ef3d94ad1e5367046028b5ec5aedb56e gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1684 (PresentX 1684) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13624 MB ` **Not tested** - No full retail shader-pack xcl shaders --precompile --pipelines peak-commit A/B run was performed here. **AI use** - Antigravity (Gemini 4 Neon) wrote the OfflineGate implementation, unit tests, PR description, and ran the test suite and smoke test.
Share the runtime big-compile thresholds and commit-headroom helpers from
hle::d3d12x::real with offline xcl shaders --precompile --pipelines
builds in shaders.rs via OfflineGate, keeping cached-blob loads ungated
while serializing giant DXIL builds, capping huge DXIL concurrency, and
waiting for commit headroom whenever another cold build is in flight.

Part of #1598

Assisted-by: Antigravity (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:22:13 +00:00
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-25 07:59 UTC · original

Heads-up from #2098, which changes huge_pso_concurrency()'s default in the same lines. git merge-tree of this head against #2098's 55eafb2 gives a conflict in real.rs at that function: this PR changes its visibility, and #2098 changes its body to default_huge_pso_concurrency(cpus). The conflict is only textual, and whichever lands second needs a one-line rebase. With #2098, this PR's offline gate would get its CPU-scaled default too: one slot per four logical CPUs, from 1 to 7, unless XCL_HUGE_PSO_CONCURRENCY is set. #2130 (the commit-wait bound) merges cleanly with this PR.

AI use: Claude Code (Claude Opus 5.5) ran the merge check and wrote this note.

**@⁠Kalmarv** on GitHub · 2026-11-25 07:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/2179#issuecomment-7156486848) Heads-up from #2098, which changes `huge_pso_concurrency()`'s default in the same lines. `git merge-tree` of this head against #2098's `55eafb2` gives a conflict in `real.rs` at that function: this PR changes its visibility, and #2098 changes its body to `default_huge_pso_concurrency(cpus)`. The conflict is only textual, and whichever lands second needs a one-line rebase. With #2098, this PR's offline gate would get its CPU-scaled default too: one slot per four logical CPUs, from 1 to 7, unless `XCL_HUGE_PSO_CONCURRENCY` is set. #2130 (the commit-wait bound) merges cleanly with this PR. AI use: Claude Code (Claude Opus 5.5) ran the merge check and wrote this note.
Author
Owner

@⁠itsSio on GitHub · 2026-11-25 09:54 UTC · original

Tested

Independent verification on clean head 864698ab2158d5e02f026112ddeae10646a703b7. Both PCs: Windows 11 Pro build 26200, NVIDIA driver 610.88, debug MSVC. cargo build --workspace --locked -j 4 exited 0 on both. cargo test -p xcl --locked -j 4 offline_gate -- --nocapture was 3 passed, 0 failed, 0 ignored, 0 skips on each (huge/giant serialization and injected commit-headroom policy).

cargo test --workspace --locked -j 4 --no-fail-fast -- --test-threads=4 --nocapture:

GPU and system Workspace result Runtime skips
RTX 5080 16 GB, Ryzen 7 9800X3D, 32 GiB, Rust 1.97.0, DXC 1.9.2609.5 1157 passed, 0 failed, 46 ignored 25: 20 no wave64, 3 unsupported per-lane cases, no heap windows, cache-off unavailable
RTX 2080 SUPER 8 GB, Ryzen 5 5600X, 16 GiB, Rust 1.99.1, DXC 1.8.2502.11 1156 passed, 1 failed, 46 ignored 26: same reasons plus no D3D12 debug layer for the root-signature test

The 2080 SUPER run failed hle::xgameruntime::gamesave::tests::case_insensitive_blob_and_container_matching_on_ntfs: XGameSaveSubmitUpdate returned E_FAIL (0x80004005) in gamesave.rs:1029. Isolated reruns (cargo test -p xcl --lib --locked -j 4 case_insensitive_blob_and_container_matching_on_ntfs -- --nocapture --test-threads=1) were 1 passed, 0 failed, 0 ignored, 0 skips per GPU and revision on both the head above and base cbc296ab65a2661a61e3e2da109134bcd5319f60. The full-suite failure did not reproduce in isolation; this comparison does not establish its cause.

Not tested: Full suite on the base, paired retail smoke, retail offline peak commit, or actual low-memory driver compilation. The gate tests inject headroom values rather than exhausting system memory.

AI use

Ran via Samaritan:

  • OpenCode (GPT-6.2 Sol): ran and audited both PC test runs and isolated comparisons, and wrote this report.
**@⁠itsSio** on GitHub · 2026-11-25 09:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2179#issuecomment-7158961498) **Tested** Independent verification on clean head `864698ab2158d5e02f026112ddeae10646a703b7`. Both PCs: Windows 11 Pro build 26200, NVIDIA driver 610.88, debug MSVC. `cargo build --workspace --locked -j 4` exited 0 on both. `cargo test -p xcl --locked -j 4 offline_gate -- --nocapture` was **3 passed, 0 failed, 0 ignored, 0 skips** on each (huge/giant serialization and injected commit-headroom policy). `cargo test --workspace --locked -j 4 --no-fail-fast -- --test-threads=4 --nocapture`: | GPU and system | Workspace result | Runtime skips | |---|---|---| | RTX 5080 16 GB, Ryzen 7 9800X3D, 32 GiB, Rust 1.97.0, DXC 1.9.2609.5 | 1157 passed, 0 failed, 46 ignored | 25: 20 no wave64, 3 unsupported per-lane cases, no heap windows, cache-off unavailable | | RTX 2080 SUPER 8 GB, Ryzen 5 5600X, 16 GiB, Rust 1.99.1, DXC 1.8.2502.11 | 1156 passed, 1 failed, 46 ignored | 26: same reasons plus no D3D12 debug layer for the root-signature test | The 2080 SUPER run failed `hle::xgameruntime::gamesave::tests::case_insensitive_blob_and_container_matching_on_ntfs`: `XGameSaveSubmitUpdate` returned `E_FAIL` (`0x80004005`) in `gamesave.rs:1029`. Isolated reruns (`cargo test -p xcl --lib --locked -j 4 case_insensitive_blob_and_container_matching_on_ntfs -- --nocapture --test-threads=1`) were **1 passed, 0 failed, 0 ignored, 0 skips** per GPU and revision on both the head above and base `cbc296ab65a2661a61e3e2da109134bcd5319f60`. The full-suite failure did not reproduce in isolation; this comparison does not establish its cause. **Not tested:** Full suite on the base, paired retail smoke, retail offline peak commit, or actual low-memory driver compilation. The gate tests inject headroom values rather than exhausting system memory. **AI use** Ran via Samaritan: - OpenCode (GPT-6.2 Sol): ran and audited both PC test runs and isolated comparisons, and wrote this report.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 10:45 UTC · original

Code review on 864698a:

  • OfflineGate cleanly applies huge_pso_bytes / huge_pso_concurrency / GIANT_DRIVER_COMPILE and big_compile_headroom commit-headroom gating to cold --pipelines builds while avoiding low-commit deadlock when active_cold == 0, with RunningSlot / OfflineGateGuard RAII cleanup and 3 unit tests.
  • Diff audited and CI workflow approved (running).

Remaining before merge: Build and test finishing green plus dual-vendor (AMD + NVIDIA) verification on 864698a.

**@⁠raylitebull** on GitHub · 2026-11-25 10:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/2179#issuecomment-7160120885) Code review on `864698a`: - `OfflineGate` cleanly applies `huge_pso_bytes` / `huge_pso_concurrency` / `GIANT_DRIVER_COMPILE` and `big_compile_headroom` commit-headroom gating to cold `--pipelines` builds while avoiding low-commit deadlock when `active_cold == 0`, with `RunningSlot` / `OfflineGateGuard` RAII cleanup and 3 unit tests. - Diff audited and CI workflow approved (running). **Remaining before merge:** `Build and test` finishing green plus dual-vendor (**AMD** + **NVIDIA**) verification on `864698a`.
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 12:02 UTC · original

Regression run of 54a7d2d4 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 568e7db7, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1566 (PresentX 1566)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14592 MB
xcl-smoke v1
commit: 54a7d2d40577e014eb17b00828e63a49308a9d8f
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1631 (PresentX 1631)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14562 MB

Against the limits in CONTRIBUTING.md: 104 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.

**@⁠Toons29** on GitHub · 2026-11-25 12:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/2179#issuecomment-7161829515) Regression run of `54a7d2d4` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `568e7db7`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1566 (PresentX 1566) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14592 MB ``` ``` xcl-smoke v1 commit: 54a7d2d40577e014eb17b00828e63a49308a9d8f gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1631 (PresentX 1631) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14562 MB ``` Against the limits in CONTRIBUTING.md: 104 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; a script posted this right after the run, with both blocks exactly as printed.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 15:39 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 15:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/2179#issuecomment-7167184838) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 18:28 UTC · original

Code review on 54a7d2d (crates/xcl/src/shaders.rs): offline_gate / free_commit gating for large DXIL --pipelines builds looks clean, and CI is green.

Remaining before merge: Independent AMD and NVIDIA test passes on 54a7d2d exercising shaders::tests (offline_gate), since earlier NVIDIA test coverage was on 864698a and smoke runs do not exercise xcl shaders.

**@⁠raylitebull** on GitHub · 2026-11-25 18:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/2179#issuecomment-7170961553) Code review on `54a7d2d` (`crates/xcl/src/shaders.rs`): `offline_gate` / `free_commit` gating for large DXIL `--pipelines` builds looks clean, and CI is green. **Remaining before merge:** Independent **AMD** and **NVIDIA** test passes on `54a7d2d` exercising `shaders::tests` (`offline_gate`), since earlier NVIDIA test coverage was on `864698a` and smoke runs do not exercise `xcl shaders`.
Author
Owner

@⁠tiagonleal on GitHub · 2026-11-25 18:58 UTC · original

Verification on NVIDIA RTX 5070 Ti (Windows 11), head 54a7d2d40577e014eb17b00828e63a49308a9d8f: shaders::tests and offline_gate pass

Tested

  • Head 54a7d2d40577e014eb17b00828e63a49308a9d8f (git rev-parse HEAD of a clean detached worktree, no local changes, built as is, not merged with main). The PR was open and the head unchanged when I started and again before writing this. The earlier NVIDIA run in the thread was on 864698a.
  • Windows 11 Pro 10.0.26300 (Developer Mode on), NVIDIA GeForce RTX 5070 Ti 16 GB (driver 617.42, 32.0.16.1742), AMD Ryzen 7 9800X3D, 32 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), cargo 1.100.0, release profile.
  • cargo test --release --locked -p xcl --lib shaders::tests -j 8 -- --nocapture: 7 passed, 0 failed, 0 ignored (1196 filtered out). retail_pack_sample printed XCL_SAMPLE_RPF not set - skipping and counts as passed.
  • cargo test --release --locked -p xcl --lib offline_gate -j 8 -- --nocapture --test-threads=1: 3 passed, 0 failed, 0 ignored. Tests: offline_gate_runs_giant_compile_alone_even_with_higher_huge_concurrency, offline_gate_serializes_huge_compiles_while_small_compiles_proceed, offline_gate_waits_for_headroom_while_another_compile_is_active_and_avoids_deadlock_when_alone.
  • cargo test --release --locked -p xcl --lib shaders:: -j 8 -- --nocapture (both modules together): 12 passed, 0 failed, 0 ignored. No SKIPPED lines other than the XCL_SAMPLE_RPF one above. git status --short was empty afterwards.

Not tested

  • An AMD host.
  • cargo test --workspace, a debug build, the retail game and xcl-smoke, a real xcl shaders --precompile --pipelines run, low-memory driver compilation (the gate tests inject headroom values).

Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5).

**@⁠tiagonleal** on GitHub · 2026-11-25 18:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/2179#issuecomment-7171651013) Verification on NVIDIA RTX 5070 Ti (Windows 11), head `54a7d2d40577e014eb17b00828e63a49308a9d8f`: `shaders::tests` and `offline_gate` pass **Tested** - Head `54a7d2d40577e014eb17b00828e63a49308a9d8f` (`git rev-parse HEAD` of a clean detached worktree, no local changes, built as is, not merged with `main`). The PR was open and the head unchanged when I started and again before writing this. The earlier NVIDIA run in the thread was on `864698a`. - Windows 11 Pro 10.0.26300 (Developer Mode on), NVIDIA GeForce RTX 5070 Ti 16 GB (driver 617.42, 32.0.16.1742), AMD Ryzen 7 9800X3D, 32 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), cargo 1.100.0, release profile. - `cargo test --release --locked -p xcl --lib shaders::tests -j 8 -- --nocapture`: 7 passed, 0 failed, 0 ignored (1196 filtered out). `retail_pack_sample` printed `XCL_SAMPLE_RPF not set - skipping` and counts as passed. - `cargo test --release --locked -p xcl --lib offline_gate -j 8 -- --nocapture --test-threads=1`: 3 passed, 0 failed, 0 ignored. Tests: `offline_gate_runs_giant_compile_alone_even_with_higher_huge_concurrency`, `offline_gate_serializes_huge_compiles_while_small_compiles_proceed`, `offline_gate_waits_for_headroom_while_another_compile_is_active_and_avoids_deadlock_when_alone`. - `cargo test --release --locked -p xcl --lib shaders:: -j 8 -- --nocapture` (both modules together): 12 passed, 0 failed, 0 ignored. No `SKIPPED` lines other than the `XCL_SAMPLE_RPF` one above. `git status --short` was empty afterwards. **Not tested** - An AMD host. - `cargo test --workspace`, a debug build, the retail game and `xcl-smoke`, a real `xcl shaders --precompile --pipelines` run, low-memory driver compilation (the gate tests inject headroom values). Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5).
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/2179/head:github-bot/gh-2179'
git switch 'github-bot/gh-2179'

Merge

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