Shaders: --explain reports the HLSL path: HLSL, DXC per pass, DXIL #1947

Closed
sombraSoft wants to merge 6 commits from upstream-pr/1957 into main
sombraSoft commented 2026-11-24 23:51:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by sombraSoft on 2026-11-24T23:51:24Z.


Stacked on #1955 and #1956; the top two commits belong here. Part of #1269.

--explain reports the HLSL path too: the HLSL by the console instruction that wrote it, DXC's time per pass and peak commit, and the DXIL's structure, next to the direct path. --path both|hlsl|direct, --opt, --top.

Pass times need a process per compile: XCL's in-process DXC prints -ftime-report only at exit, summed over every compile. So each program is compiled by the SDK's dxc.exe next to the dxcompiler.dll XCL loads, with dxc::arguments (#1956), in a job object with a commit limit (--mem-gb, default 8) and stopped after --dxc-timeout (default 600 s). Without a limit, on main at c160d86 the pack's largest compute program (then 147 MB of HLSL, -O0) ran DXC for over 40 minutes up to 13 GB and grew the page file by about 88 GB. A compile past a limit is now stopped and reported as unfinished.

What is in it

  • Shaders: --size-by-op splits translated HLSL bytes by instruction – by @DTsordas (DTsordas/xcl@5529418, posted in #1269 and never opened as a PR), kept as their commit; shaders.rs
  • Shaders: --explain reports the HLSL path: HLSL, DXC per pass, DXIL – crates/xcl/src/shaders/explain/hlsl.rs, hooks in explain.rs, limits.rs; help and README

Tested

  • NVIDIA GeForce RTX 3060 Ti (driver 32.0.16.2124), AMD Ryzen 9 5900X, Windows 11 Pro 10.0.26300, rustc 1.97.1; tests in debug, smoke run in release; DXC 1.8.2502.11 (Windows SDK 10.0.26100)
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on b73a434: 987 passed, 0 failed, 45 ignored
  • SKIPPED (all from existing tests): 18 × no wave64, 1 × no heap windows, 1 × cannot disable the driver cache (Developer Mode off), 3 × per-lane form refused (f16 / VOP3 modifiers)
  • unit tests: the pass table of a timing report is summed by pass name; dxc.exe past its time limit or under a 1 MB commit limit is stopped with timeout: / memory:; the determinism test now covers both paths
  • retail pack, on fb2eeec (the top of this stack): 20 sampled programs (--sample 20 --seed 1) take 56 s, 54 s of it in DXC; two runs give the same portable digest. The largest compute program: 15 MB of HLSL, DXC -O0 120 s at 2.7 GB of commit (Loop-Closed SSA 24 %, DXIL Remove Dead Blocks 16 % of the pass time), 80 295 DXIL blocks; the direct path gives 36 818

Regression run

main:

xcl-smoke v1
commit: 689f2db477c3c062cf162649781640ef8a977c18
gpu: NVIDIA GeForce RTX 3060 Ti
title: 55118d47
seconds: 60
exit: 0x0
frames shown: 1075 (PresentX 1075)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15431 MB

this PR (b73a434):

xcl-smoke v1
commit: b73a4343dd8b096ecdb008b157b6161bd64a635f
gpu: NVIDIA GeForce RTX 3060 Ti
title: 55118d47
seconds: 60
exit: 0x0
frames shown: 1156 (PresentX 1157)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15341 MB

Not tested

  • AMD and Intel GPUs, GPUs with native wave64, DXC 1.9, Linux / vkd3d-proton
  • the title run does not use --explain; it checks only that nothing else changed
  • dxc.exe missing next to dxcompiler.dll (e.g. XCL_DXC_DIR with the DLLs only): the in-process fallback without pass times was run, but not on the pack

AI use

  • Claude Code with Claude Opus 5.5: wrote the code (except the --size-by-op commit), the tests and this description. The tests, the pack runs and the smoke runs were run on the hardware above.
<!-- greyfinch-sync:ivall/xcl:issue:5482353649 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1957). Originally posted by [sombraSoft](https://github.com/sombraSoft) on 2026-11-24T23:51:24Z. --- Stacked on #1955 and #1956; the top two commits belong here. Part of #1269. `--explain` reports the HLSL path too: the HLSL by the console instruction that wrote it, DXC's time per pass and peak commit, and the DXIL's structure, next to the direct path. `--path both|hlsl|direct`, `--opt`, `--top`. Pass times need a process per compile: XCL's in-process DXC prints `-ftime-report` only at exit, summed over every compile. So each program is compiled by the SDK's `dxc.exe` next to the `dxcompiler.dll` XCL loads, with `dxc::arguments` (#1956), in a job object with a commit limit (`--mem-gb`, default 8) and stopped after `--dxc-timeout` (default 600 s). Without a limit, on main at c160d86 the pack's largest compute program (then 147 MB of HLSL, `-O0`) ran DXC for over 40 minutes up to 13 GB and grew the page file by about 88 GB. A compile past a limit is now stopped and reported as unfinished. **What is in it** - `Shaders: --size-by-op splits translated HLSL bytes by instruction` – by @DTsordas (DTsordas/xcl@5529418, posted in #1269 and never opened as a PR), kept as their commit; `shaders.rs` - `Shaders: --explain reports the HLSL path: HLSL, DXC per pass, DXIL` – `crates/xcl/src/shaders/explain/hlsl.rs`, hooks in `explain.rs`, `limits.rs`; help and README **Tested** - NVIDIA GeForce RTX 3060 Ti (driver 32.0.16.2124), AMD Ryzen 9 5900X, Windows 11 Pro 10.0.26300, rustc 1.97.1; tests in debug, smoke run in release; DXC 1.8.2502.11 (Windows SDK 10.0.26100) - `cargo test --workspace --no-fail-fast -- --test-threads=4` on b73a434: 987 passed, 0 failed, 45 ignored - `SKIPPED` (all from existing tests): 18 × no wave64, 1 × no heap windows, 1 × cannot disable the driver cache (Developer Mode off), 3 × per-lane form refused (f16 / VOP3 modifiers) - unit tests: the pass table of a timing report is summed by pass name; `dxc.exe` past its time limit or under a 1 MB commit limit is stopped with `timeout:` / `memory:`; the determinism test now covers both paths - retail pack, on fb2eeec (the top of this stack): 20 sampled programs (`--sample 20 --seed 1`) take 56 s, 54 s of it in DXC; two runs give the same portable digest. The largest compute program: 15 MB of HLSL, DXC `-O0` 120 s at 2.7 GB of commit (Loop-Closed SSA 24 %, DXIL Remove Dead Blocks 16 % of the pass time), 80 295 DXIL blocks; the direct path gives 36 818 **Regression run** main: ``` xcl-smoke v1 commit: 689f2db477c3c062cf162649781640ef8a977c18 gpu: NVIDIA GeForce RTX 3060 Ti title: 55118d47 seconds: 60 exit: 0x0 frames shown: 1075 (PresentX 1075) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15431 MB ``` this PR (b73a434): ``` xcl-smoke v1 commit: b73a4343dd8b096ecdb008b157b6161bd64a635f gpu: NVIDIA GeForce RTX 3060 Ti title: 55118d47 seconds: 60 exit: 0x0 frames shown: 1156 (PresentX 1157) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15341 MB ``` **Not tested** - AMD and Intel GPUs, GPUs with native wave64, DXC 1.9, Linux / vkd3d-proton - the title run does not use --explain; it checks only that nothing else changed - `dxc.exe` missing next to `dxcompiler.dll` (e.g. `XCL_DXC_DIR` with the DLLs only): the in-process fallback without pass times was run, but not on the pack **AI use** - Claude Code with Claude Opus 5.5: wrote the code (except the --size-by-op commit), the tests and this description. The tests, the pack runs and the smoke runs were run on the hardware above.
DavidM1911 commented 2026-11-25 03:05:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T02:59:32Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main (README.md + crates/xcl/src/shaders.rs) — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7151475886 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1957#issuecomment-7151475886). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T02:59:32Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** (`README.md` + `crates/xcl/src/shaders.rs`) — needs a rebase before it can be tested.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1947
No description provided.