Shaders: budget each DXC compile by the size of its source #1724

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

@⁠PracticalStudios on GitHub · 2026-11-24 19:55 UTC · original
PracticalStudios:dxc/size-aware-admission → main · +326 −19 · 1 files · 1 commits · open

DXC compiles now reserve memory by source size instead of a flat 1 GB, and a heavy compile (8 MB of HLSL or more) can no longer skip the budget. Part of #1269.

Why: programs over 8 MB take more than 12 GB each in DXC; several at once ran --precompile out of memory (@⁠Sergentval, @⁠LRF17 in #1269).

How it relates to #1774 (merged): that one admits driver compiles by DXIL size; this one admits the DXC step before it, by HLSL size.

What is in it

  • dxc.rs: a compile reserves 1 GB, or 1 GB per MB of HLSL from 8 MB. A heavy one runs when it fits, or alone. A heavy compile the title waits for briefly holds back background compiles so it is not starved. Unit tests for the rules.

Tested

  • RTX 3090 24 GB (driver 621.24), Ryzen 7 9800X3D, 62 GB RAM, Windows 11 26200, Rust 1.89.0, DXC 1.8.2502.11.
  • cargo test --workspace --no-fail-fast -- --test-threads=2: 870 passed, 1 failed, 42 ignored. The failure (kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory) fails the same way on main on this machine.
  • SKIPPED: 2 wave64 tests, 1 heap-window test.
  • DXC peak memory measured on the pack's programs: 0.1–0.6 GB for 0.5–7 MB of HLSL, so 1 GB below 8 MB is safe.

Regression run
.\scripts\smoke.ps1 -Game <retail title> -Seconds 60, no input, main first, same machine:

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: NVIDIA GeForce RTX 3090
title: GTA6
seconds: 60
exit: 0x0
frames shown: 1596 (PresentX 1596)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14924 MB
xcl-smoke v1
commit: 8e0cb77243cf696eec05de67f4092dbd799f0d4b
gpu: NVIDIA GeForce RTX 3090
title: GTA6
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1615)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14948 MB

Not tested

  • AMD, wave64, Linux, 16 GB machines.
  • Sources between 7 and 11 MB.
  • Overlaps the same function as #1364 / #1417.

AI use

  • Claude Code (Claude Opus 5.5, with Claude Sonnet subagents) wrote the code, tests and this text. The test runs are real runs on the hardware above.
**@⁠PracticalStudios** on GitHub · 2026-11-24 19:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1724) `PracticalStudios:dxc/size-aware-admission` → `main` · +326 −19 · 1 files · 1 commits · open DXC compiles now reserve memory by source size instead of a flat 1 GB, and a heavy compile (8 MB of HLSL or more) can no longer skip the budget. Part of #1269. Why: programs over 8 MB take more than 12 GB each in DXC; several at once ran `--precompile` out of memory (@⁠Sergentval, @⁠LRF17 in #1269). How it relates to #1774 (merged): that one admits *driver* compiles by DXIL size; this one admits the DXC step before it, by HLSL size. **What is in it** - `dxc.rs`: a compile reserves 1 GB, or 1 GB per MB of HLSL from 8 MB. A heavy one runs when it fits, or alone. A heavy compile the title waits for briefly holds back background compiles so it is not starved. Unit tests for the rules. **Tested** - RTX 3090 24 GB (driver 621.24), Ryzen 7 9800X3D, 62 GB RAM, Windows 11 26200, Rust 1.89.0, DXC 1.8.2502.11. - `cargo test --workspace --no-fail-fast -- --test-threads=2`: 870 passed, 1 failed, 42 ignored. The failure (`kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory`) fails the same way on `main` on this machine. - SKIPPED: 2 wave64 tests, 1 heap-window test. - DXC peak memory measured on the pack's programs: 0.1–0.6 GB for 0.5–7 MB of HLSL, so 1 GB below 8 MB is safe. **Regression run** `.\scripts\smoke.ps1 -Game <retail title> -Seconds 60`, no input, `main` first, same machine: ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: NVIDIA GeForce RTX 3090 title: GTA6 seconds: 60 exit: 0x0 frames shown: 1596 (PresentX 1596) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14924 MB ``` ``` xcl-smoke v1 commit: 8e0cb77243cf696eec05de67f4092dbd799f0d4b gpu: NVIDIA GeForce RTX 3090 title: GTA6 seconds: 60 exit: 0x0 frames shown: 1615 (PresentX 1615) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14948 MB ``` **Not tested** - AMD, wave64, Linux, 16 GB machines. - Sources between 7 and 11 MB. - Overlaps the same function as #1364 / #1417. **AI use** - Claude Code (Claude Opus 5.5, with Claude Sonnet subagents) wrote the code, tests and this text. The test runs are real runs on the hardware above.
A compile reserves 1 GB, or 1 GB per MB of HLSL from 8 MB, instead of a
flat 1 GB. A heavy one no longer skips the budget after 60 s or when the
title waits: it runs when it fits, or alone. Several of them at once ran
--precompile out of memory (#1269).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:02:45 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 22:28 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 22:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1724#issuecomment-7146281064) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. Thanks!
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 04:20 UTC · original

XCL PR #1724 verification

Clean detached head 8e0cb77243cf696eec05de67f4092dbd799f0d4b. The PR changes only crates/xcl/src/gpu/recomp/dxc.rs.

Tested

STOR-WINLAB ran Windows 11 build 26200 on an AMD Ryzen 7 3800X and Intel Arc A770 with driver 32.0.101.9175. DXC reported 1.9.2609.5. Rust was rustc 1.100.0 (0ef1bc386 2026-11-09) for x86_64-pc-windows-msvc. Builds used unoptimized profiles with debug info and incremental compilation disabled.

  • cargo build --workspace and cargo test --workspace --no-run succeeded outside the Arc lock. The latter built 19 test executables.
  • cargo test -p xcl --lib gpu::recomp::dxc::admission_tests ran outside the lock with XCL_ADAPTER=NONE_CPU_ONLY. All 13 passed, with 0 failed, 0 ignored, 0 skips and 831 filtered out. The tests check the 8 MiB source threshold and reservation sizes, commit and physical-memory admission, ordinary timeout and title priority, solo admission for heavy compiles, and reservation and wait-counter cleanup, including unwind. All 13 also passed in the workspace run.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once inside Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1. It exited 1. Summing every test result: line in pr1724-suite.log gives 853 passed, 18 failed and 42 ignored across 19 binaries and one doctest harness.

Workspace failures and skips

  • 17 library tests failed. In 13, CreateComputePipelineState returned 0x80070057. Four reported output mismatches in FMA overflow, mip sampling, 16-bit VALU and whole-wave pixel reductions.
  • The test title failed its RSSetDepthBiasX check. The top-right pixel was blue instead of green.
  • Six lines begin with SKIPPED . Two cite wave64, two cite unavailable debug-layer components, one cites tiled resource tier and one cites heap windows. These test paths did not provide coverage.

Not tested

Matched main baseline, retail-title smoke run, retail sample fixtures, large-shader compile stress and peak memory, and AMD or NVIDIA GPUs. The failures are observations at this PR head.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1724-suite.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 04:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/1724#issuecomment-7152750918) # XCL PR #1724 verification Clean detached head `8e0cb77243cf696eec05de67f4092dbd799f0d4b`. The PR changes only `crates/xcl/src/gpu/recomp/dxc.rs`. **Tested** STOR-WINLAB ran Windows 11 build 26200 on an AMD Ryzen 7 3800X and Intel Arc A770 with driver 32.0.101.9175. DXC reported 1.9.2609.5. Rust was `rustc 1.100.0 (0ef1bc386 2026-11-09)` for `x86_64-pc-windows-msvc`. Builds used unoptimized profiles with debug info and incremental compilation disabled. - `cargo build --workspace` and `cargo test --workspace --no-run` succeeded outside the Arc lock. The latter built 19 test executables. - `cargo test -p xcl --lib gpu::recomp::dxc::admission_tests` ran outside the lock with `XCL_ADAPTER=NONE_CPU_ONLY`. All 13 passed, with 0 failed, 0 ignored, 0 skips and 831 filtered out. The tests check the 8 MiB source threshold and reservation sizes, commit and physical-memory admission, ordinary timeout and title priority, solo admission for heavy compiles, and reservation and wait-counter cleanup, including unwind. All 13 also passed in the workspace run. - `cargo test --workspace --no-fail-fast -- --test-threads=4` ran once inside `Invoke-ArcTest.ps1` with `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`. It exited 1. Summing every `test result:` line in `pr1724-suite.log` gives 853 passed, 18 failed and 42 ignored across 19 binaries and one doctest harness. **Workspace failures and skips** - 17 library tests failed. In 13, `CreateComputePipelineState` returned `0x80070057`. Four reported output mismatches in FMA overflow, mip sampling, 16-bit VALU and whole-wave pixel reductions. - The test title failed its `RSSetDepthBiasX` check. The top-right pixel was blue instead of green. - Six lines begin with `SKIPPED `. Two cite wave64, two cite unavailable debug-layer components, one cites tiled resource tier and one cites heap windows. These test paths did not provide coverage. **Not tested** Matched `main` baseline, retail-title smoke run, retail sample fixtures, large-shader compile stress and peak memory, and AMD or NVIDIA GPUs. The failures are observations at this PR head. **AI use** T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1724-suite.log` and published.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/1724/head:github-bot/gh-1724'
git switch 'github-bot/gh-1724'

Merge

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