Shaders: honor --precompile for a single shader file #637

Open
CallMeBrado wants to merge 1 commit from upstream-pr/642 into main
CallMeBrado commented 2026-11-24 02:49:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CallMeBrado on 2026-11-24T02:49:14Z.


What is in it

xcl shaders file.dxbc --precompile printed shader stats and exited successfully, but the cache stayed empty. The single-file path returned before the CLI checked --precompile.

  • A single shader now goes through the same precompiler as a directory or archive. It reuses the bytes the CLI already read. Running the command without --precompile still prints stats.
  • Added a CLI regression test with a synthetic DXBC file and a single-file example in the README.

Tested

  • RTX 5090, driver 621.24, Ryzen 9 9950X3D, Windows 11 Pro build 26200, Rust 1.96.0.
  • Debug workspace build passed. cargo test --workspace -- --test-threads=4 reported 687 passed, 0 failed, 41 ignored. Two GPU tests skipped internally for lack of wave64: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware.
  • The new CLI test failed on main and passed with this change in release mode. Starting with an empty cache, main wrote no files for a real compute shader. With the fix, the same shader produced 3,380 bytes of DXIL and one compute pipeline. Filtering for pixel shaders left the cache empty, as expected.

Regression run

Main

xcl-smoke v1
commit: 3db536ebe231418d76e8d6e52ccee0b47330a522
gpu: NVIDIA GeForce RTX 5090
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1420 (PresentX 1420)
presents per 2 s (last 3): 60 59 58
device removals: 0
crashes: 0
peak commit: 15293 MB

PR

xcl-smoke v1
commit: f1e90c149b5ff9e8a260c424d6dd53c0fe816031
gpu: NVIDIA GeForce RTX 5090
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1366 (PresentX 1366)
presents per 2 s (last 3): 46 47 53
device removals: 0
crashes: 0
peak commit: 15309 MB

Not tested

  • AMD and Intel GPUs. The 60-second game runs cover startup. Gameplay and loading-time effects were not measured.

AI use

  • Codex (GPT-6.2 Astra) reproduced the bug, wrote the fix and regression test, ran the checks, and drafted this description.
<!-- greyfinch-sync:ivall/xcl:issue:5465144577 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/642). Originally posted by [CallMeBrado](https://github.com/CallMeBrado) on 2026-11-24T02:49:14Z. --- **What is in it** `xcl shaders file.dxbc --precompile` printed shader stats and exited successfully, but the cache stayed empty. The single-file path returned before the CLI checked `--precompile`. - A single shader now goes through the same precompiler as a directory or archive. It reuses the bytes the CLI already read. Running the command without `--precompile` still prints stats. - Added a CLI regression test with a synthetic DXBC file and a single-file example in the README. **Tested** - RTX 5090, driver 621.24, Ryzen 9 9950X3D, Windows 11 Pro build 26200, Rust 1.96.0. - Debug workspace build passed. `cargo test --workspace -- --test-threads=4` reported 687 passed, 0 failed, 41 ignored. Two GPU tests skipped internally for lack of wave64: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware`. - The new CLI test failed on main and passed with this change in release mode. Starting with an empty cache, main wrote no files for a real compute shader. With the fix, the same shader produced 3,380 bytes of DXIL and one compute pipeline. Filtering for pixel shaders left the cache empty, as expected. **Regression run** Main ``` xcl-smoke v1 commit: 3db536ebe231418d76e8d6e52ccee0b47330a522 gpu: NVIDIA GeForce RTX 5090 title: 419239bf seconds: 60 exit: 0x0 frames shown: 1420 (PresentX 1420) presents per 2 s (last 3): 60 59 58 device removals: 0 crashes: 0 peak commit: 15293 MB ``` PR ``` xcl-smoke v1 commit: f1e90c149b5ff9e8a260c424d6dd53c0fe816031 gpu: NVIDIA GeForce RTX 5090 title: 419239bf seconds: 60 exit: 0x0 frames shown: 1366 (PresentX 1366) presents per 2 s (last 3): 46 47 53 device removals: 0 crashes: 0 peak commit: 15309 MB ``` **Not tested** - AMD and Intel GPUs. The 60-second game runs cover startup. Gameplay and loading-time effects were not measured. **AI use** - Codex (GPT-6.2 Astra) reproduced the bug, wrote the fix and regression test, ran the checks, and drafted this description.
mdberkey commented 2026-11-24 03:02:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mdberkey on 2026-11-24T03:02:41Z.

Review: APPROVED


Verified

  • Windows 11 Pro 26200, Ryzen 5 5600X, 32 GB, RTX 3070; rustc 1.100.0 MSVC, DXC 1.9.2602.17 from SDK 26100.
  • cargo build --locked --workspace --jobs 3: passed (only the pre-existing fetch_update deprecation warning).
  • cargo test --locked --workspace --no-fail-fast --jobs 3 -- --test-threads=4 --show-output: 687 passed, 0 failed, 41 ignored. Skipped: 2 no wave64, 1 no d3d12SDKLayers.dll, 1 no D3D12 debug layer.
  • The new test passes on f1e90c1 and fails on 3db536e (exit 101) with the old stats output, so it catches the regression.
  • Real console PS from the e2e dump (44871e939431b2e3_ps.bin), empty cache: f1e90c1 → compiled 1, already cached 0, errors 0, one 2,860-byte DXIL cache entry; 3db536e → stats only, 0 cache files.

Not verified

  • The 60 s smoke runs in the description could not be independently reproduced (no title on this machine); the PR's blocks are the evidence there. AMD/Intel GPUs not tested.

Review
LGTM. Non-blocking: the new test checks that a single file reaches the precompile path, but with a part-less DXBC it cannot assert that a cache entry is written. A minimal valid console shader fixture with a cache-count assertion would pin the whole fix in CI; the real-shader run above covers it meanwhile.

AI use: OpenCode (DeepSeek V4.1 Flash Free) ran the checks and drafted this; I checked it.

<!-- greyfinch-sync:ivall/xcl:review:6033044902 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/642#pullrequestreview-6033044902). Originally posted by [mdberkey](https://github.com/mdberkey) on 2026-11-24T03:02:41Z. **Review:** APPROVED --- **Verified** - Windows 11 Pro 26200, Ryzen 5 5600X, 32 GB, RTX 3070; rustc 1.100.0 MSVC, DXC 1.9.2602.17 from SDK 26100. - `cargo build --locked --workspace --jobs 3`: passed (only the pre-existing `fetch_update` deprecation warning). - `cargo test --locked --workspace --no-fail-fast --jobs 3 -- --test-threads=4 --show-output`: **687 passed, 0 failed, 41 ignored**. Skipped: 2 no wave64, 1 no `d3d12SDKLayers.dll`, 1 no D3D12 debug layer. - The new test passes on `f1e90c1` and fails on `3db536e` (exit 101) with the old stats output, so it catches the regression. - Real console PS from the e2e dump (`44871e939431b2e3_ps.bin`), empty cache: `f1e90c1` → `compiled 1, already cached 0, errors 0`, one 2,860-byte DXIL cache entry; `3db536e` → stats only, 0 cache files. **Not verified** - The 60 s smoke runs in the description could not be independently reproduced (no title on this machine); the PR's blocks are the evidence there. AMD/Intel GPUs not tested. **Review** LGTM. Non-blocking: the new test checks that a single file reaches the precompile path, but with a part-less DXBC it cannot assert that a cache entry is written. A minimal valid console shader fixture with a cache-count assertion would pin the whole fix in CI; the real-shader run above covers it meanwhile. AI use: OpenCode (DeepSeek V4.1 Flash Free) ran the checks and drafted this; I checked it.
MesshM commented 2026-11-24 07:05:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T03:24:55Z.


Test run of f1e90c149b5ff9e8a260c424d6dd53c0fe816031 on AMD RDNA4. I merged it onto current main 91f9a5e locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 693 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 652 passed, 0 failed, 21 ignored
  • 0 SKIPPED; precompile_accepts_a_single_file passes.

Review: A single file now goes through the same precompiler as a directory or pack, reusing the bytes the CLI already read (Cow::Borrowed), and without --precompile it still prints stats. I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

<!-- greyfinch-sync:ivall/xcl:comment:7121066615 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/642#issuecomment-7121066615). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T03:24:55Z. --- Test run of `f1e90c149b5ff9e8a260c424d6dd53c0fe816031` on AMD RDNA4. I merged it onto current `main` `91f9a5e` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **693 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 652 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `precompile_accepts_a_single_file` passes. **Review:** A single file now goes through the same precompiler as a directory or pack, reusing the bytes the CLI already read (`Cow::Borrowed`), and without `--precompile` it still prints stats. I found nothing to change. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Alpha325 commented 2026-11-25 03:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Alpha325 on 2026-11-25T02:29:10Z.


I reused XCL’s synthetic compute shader builder to exercise single-file precompilation through DXC on Windows 11 with an RX 9060 XT and DXC 1.9.2602.17.

  • PR f1e90c1: shaders compute.dxbc --precompile --split 0 --only cs wrote one 3,080-byte .dxil file containing a DXIL part.
  • Parent 18c105a: the same command printed shader statistics and wrote zero cache entries. The new test failed as expected.
  • On the PR, switching to --only ps left a separate empty cache untouched.
  • Both shaders_e2e tests and both gpu_compute_e2e tests passed on the PR, with zero skips.

The patch shares the existing synthetic shader builder between the test suites. No runtime code changed. AI use — OpenAI Codex (GPT-6) wrote and ran the fixture and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7150785914 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/642#issuecomment-7150785914). Originally posted by [Alpha325](https://github.com/Alpha325) on 2026-11-25T02:29:10Z. --- I reused XCL’s synthetic compute shader builder to exercise single-file precompilation through DXC on Windows 11 with an RX 9060 XT and DXC 1.9.2602.17. - PR `f1e90c1`: `shaders compute.dxbc --precompile --split 0 --only cs` wrote one 3,080-byte `.dxil` file containing a DXIL part. - Parent `18c105a`: the same command printed shader statistics and wrote zero cache entries. The new test failed as expected. - On the PR, switching to `--only ps` left a separate empty cache untouched. - Both `shaders_e2e` tests and both `gpu_compute_e2e` tests passed on the PR, with zero skips. The patch shares the existing synthetic shader builder between the test suites. No runtime code changed. AI use — OpenAI Codex (GPT-6) wrote and ran the fixture and drafted this report.
JJAutoCompare commented 2026-11-25 03:05:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T02:54:03Z.


Test of XCL PR #642 at clean detached head f1e90c149b5ff9e8a260c424d6dd53c0fe816031. GitHub and refs/pull/642/head still matched the tested commit, and the PR was open at 2026-11-25T02:46:26.0766439Z. I found no Arc A770 report for this test and head in the PR discussion or issue #42.

Tested

  • Windows 11 Enterprise Evaluation 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust and Cargo 1.100.0 x86_64-pc-windows-msvc, unoptimized test profile. The configured DXC directory contained dxcompiler.dll and dxil.dll version 1.9.2609.5.

  • Process environment for the build and test used CARGO_TARGET_DIR=L:/XclTooling/pr2014-1c971de6/target, CARGO_INCREMENTAL=0, CARGO_PROFILE_DEV_DEBUG=0, CARGO_PROFILE_TEST_DEBUG=0, XCL_ADAPTER=A770, and XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64. TEMP and TMP were L:/XclTooling/pr642/temp for build and L:/XclTooling/pr642/temp/test for execution. The test process used XCL_DXIL_CACHE=L:/XclTooling/pr642/shader-cache and XCL_DATA_ROOT=L:/XclTooling/pr642/xcl-data. The DXIL directory also contains any on-disk translated-shader entries made by this path.

  • Prebuild command and exact prebuilt test invocation, expressed as PowerShell calls:

    & "$env:USERPROFILE/.cargo/bin/cargo.exe" test --locked -p xcl --test shaders_e2e --no-run --jobs 2
    & 'L:/XclTooling/pr2014-1c971de6/target\debug\build\xcl/2a253c9aa814b338\out\shaders_e2e-2a253c9aa814b338.exe' precompile_accepts_a_single_file --exact --nocapture --test-threads=1
    
  • Build exit 0. Test exit 0. Libtest reported test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.73s. GPU SKIPPED markers: 0.

  • The test invoked xcl shaders <fixture> --precompile --split 0 with XCL_DXC_THREADS=1 and asserted a successful child exit, precompiling 1 , and compiled 0, already cached 0, errors 0. The fixture is a 32-byte synthetic DXBC container with zero parts. A file watcher recorded creation, change, and deletion of xcl-single-shader-1440.dxbc under the private test temp directory. The watched temp, shader cache and data roots contained 0 entries before and 0 entries after, with 0 filesystem events in the cache and data roots during execution.

  • The explicit split argument bypassed GPU probing, and the fixture runs without --pipelines. This CLI check ran on the Arc host without acquiring the GPU lock.

Not tested

GPU execution, DXC compilation, shader or PSO cache population with a compilable program, baseline comparison on main, full workspace suite, release profile, other adapters, and retail-title smoke runs.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the checked-in test, inspected the local outputs, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7151333594 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/642#issuecomment-7151333594). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T02:54:03Z. --- Test of [XCL PR #642](https://github.com/xcl-dev/xcl/pull/642) at clean detached head `f1e90c149b5ff9e8a260c424d6dd53c0fe816031`. GitHub and `refs/pull/642/head` still matched the tested commit, and the PR was open at 2026-11-25T02:46:26.0766439Z. I found no Arc A770 report for this test and head in the PR discussion or issue #42. **Tested** - Windows 11 Enterprise Evaluation 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust and Cargo 1.100.0 x86_64-pc-windows-msvc, unoptimized test profile. The configured DXC directory contained `dxcompiler.dll` and `dxil.dll` version 1.9.2609.5. - Process environment for the build and test used `CARGO_TARGET_DIR=L:/XclTooling/pr2014-1c971de6/target`, `CARGO_INCREMENTAL=0`, `CARGO_PROFILE_DEV_DEBUG=0`, `CARGO_PROFILE_TEST_DEBUG=0`, `XCL_ADAPTER=A770`, and `XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64`. `TEMP` and `TMP` were `L:/XclTooling/pr642/temp` for build and `L:/XclTooling/pr642/temp/test` for execution. The test process used `XCL_DXIL_CACHE=L:/XclTooling/pr642/shader-cache` and `XCL_DATA_ROOT=L:/XclTooling/pr642/xcl-data`. The DXIL directory also contains any on-disk translated-shader entries made by this path. - Prebuild command and exact prebuilt test invocation, expressed as PowerShell calls: ```powershell & "$env:USERPROFILE/.cargo/bin/cargo.exe" test --locked -p xcl --test shaders_e2e --no-run --jobs 2 & 'L:/XclTooling/pr2014-1c971de6/target\debug\build\xcl/2a253c9aa814b338\out\shaders_e2e-2a253c9aa814b338.exe' precompile_accepts_a_single_file --exact --nocapture --test-threads=1 ``` - Build exit 0. Test exit 0. Libtest reported `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.73s`. GPU `SKIPPED` markers: 0. - The test invoked `xcl shaders <fixture> --precompile --split 0` with `XCL_DXC_THREADS=1` and asserted a successful child exit, `precompiling 1 `, and `compiled 0, already cached 0, errors 0`. The fixture is a 32-byte synthetic DXBC container with zero parts. A file watcher recorded creation, change, and deletion of `xcl-single-shader-1440.dxbc` under the private test temp directory. The watched temp, shader cache and data roots contained 0 entries before and 0 entries after, with 0 filesystem events in the cache and data roots during execution. - The explicit split argument bypassed GPU probing, and the fixture runs without `--pipelines`. This CLI check ran on the Arc host without acquiring the GPU lock. **Not tested** GPU execution, DXC compilation, shader or PSO cache population with a compilable program, baseline comparison on main, full workspace suite, release profile, other adapters, and retail-title smoke runs. **AI use** T3 Code / Codex (gpt-6.2-sol) ran the checked-in test, inspected the local outputs, and drafted this report.
DavidM1911 commented 2026-11-25 13:05:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T12:31:42Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7162495802 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/642#issuecomment-7162495802). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T12:31:42Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
github-actions[bot] commented 2026-11-29 07:42:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:42:46Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252643130 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/642#issuecomment-7252643130). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:42:46Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 03:51:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:51:50Z.


Triage (#1607) – head f1e90c1

No open or merged PR makes --precompile accept a single shader file. Main still ends a single non-RPF file in the analysis branch unless --export-hlsl / --measure-pso / the milestone option is given. #1816 does the same routing for --direct. It is a separate flag, but the two touch the same branch and will conflict.
The branch is based on a much older shaders.rs. On current main the smallest fix may be to add --precompile to the condition that already builds Input::Files(vec![path]) for a single file, rather than adding Input::Single.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300140029 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/642#issuecomment-7300140029). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:51:50Z. --- **Triage (#1607)** – head f1e90c1 No open or merged PR makes `--precompile` accept a single shader file. Main still ends a single non-RPF file in the analysis branch unless `--export-hlsl` / `--measure-pso` / the milestone option is given. #1816 does the same routing for `--direct`. It is a separate flag, but the two touch the same branch and will conflict. The branch is based on a much older shaders.rs. On current main the smallest fix may be to add `--precompile` to the condition that already builds `Input::Files(vec![path])` for a single file, rather than adding `Input::Single`. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/642:upstream-pr/642'
git switch 'upstream-pr/642'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/642'
git switch 'upstream-pr/642'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/642'
git switch 'upstream-pr/642'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/642'
git switch 'main'
git merge --squash 'upstream-pr/642'
git switch 'main'
git merge --ff-only 'upstream-pr/642'
git switch 'main'
git merge 'upstream-pr/642'
git push origin 'main'
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!637
No description provided.