Shaders: bypass caches when DXIL optimization is disabled #2013

Manually merged
github merged 1 commit from gh-pr/2013/head into gh-pr/2013/base 2026-11-26 05:14:45 +00:00
Owner

@⁠luckyteagirl on GitHub · 2026-11-25 00:42 UTC · original
luckyteagirl:codex/dxil-no-opt-cache → main · +2 −2 · 1 files · 1 commits · merged 2026-11-25 10:42 UTC

Addresses item 2 of #1895.

XCL_DXIL_NO_OPT changes the Direct DXIL output while the translated shader cache still uses the normal identity. A debug run can therefore put unoptimized DXIL in the cache and serve it to later normal runs. This change bypasses both translated caches whenever the override is present.

What is in it

  • crates/xcl/src/gpu/recomp/pso.rs adds XCL_DXIL_NO_OPT to the existing cache bypass list.
  • The existing cache override test now checks the new variable for compute, vertex, and pixel stages.

Tested

  • Head 1512961b3e518a3cec275b6f85968eabff2a9bef on main 6567c5f. Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver 30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5, debug build.
  • The focused shader_cache_bypasses_debug_overrides test failed with the new case before the fix (0 passed, 1 failed), then passed after it (1 passed, 0 failed).
  • cargo build --locked --workspace -j 2 passed.
  • With XCL_ADAPTER=6800M and XCL_REQUIRE_GPU=1, cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output completed across 20 test binaries with 854 passed, 143 failed, and 45 ignored. Six explicit SKIPPED tests are included in the passed count: gpu_raw_window_view_reaches_its_top (no GPU), pso_measurement_compiles_an_exact_synthetic_record (device error), placed_title_textures_share_vram_and_preserve_pixels (no reserved cube with mips), test_title_draws_with_a_root_signature_under_the_debug_layer (missing d3d12SDKLayers.dll), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), and uploads_start_from_each_subresources_state (no D3D12 debug layer).
  • The suite was not green. Fuzz seed 5 suspended the GPU device during compute PSO creation (0x887A0005), followed by failures in other GPU tests.
  • Release cargo build --locked --release -p xcl -j 2 passed. A locally owned title ran for 7 seconds on this head and main 400e638869ee8e8f8238079db3b70fce2abd3c2b: each showed one frame, no crash, and no device removal. Peak process commit was 6,973 MB on this head versus 7,069 MB on main.

Regression run

main:

xcl-smoke v1
commit: 400e638869ee8e8f8238079db3b70fce2abd3c2b
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 1
device removals: 0
crashes: 0
peak commit: 7069 MB

PR head:

xcl-smoke v1
commit: 1512961b3e518a3cec275b6f85968eabff2a9bef
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 6973 MB

Not tested

The 7-second title run did not set XCL_DXIL_NO_OPT and logged zero draws, so it did not exercise the changed cache-bypass path. Longer title runs, other adapters, and newer AMD drivers.

AI use

OpenAI Codex (GPT-6, exact variant not exposed in this session) implemented the fix and test case, ran the checks, reviewed the diff, and drafted this description.

**@⁠luckyteagirl** on GitHub · 2026-11-25 00:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2013) `luckyteagirl:codex/dxil-no-opt-cache` → `main` · +2 −2 · 1 files · 1 commits · merged 2026-11-25 10:42 UTC Addresses item 2 of #1895. `XCL_DXIL_NO_OPT` changes the Direct DXIL output while the translated shader cache still uses the normal identity. A debug run can therefore put unoptimized DXIL in the cache and serve it to later normal runs. This change bypasses both translated caches whenever the override is present. **What is in it** - `crates/xcl/src/gpu/recomp/pso.rs` adds `XCL_DXIL_NO_OPT` to the existing cache bypass list. - The existing cache override test now checks the new variable for compute, vertex, and pixel stages. **Tested** - Head `1512961b3e518a3cec275b6f85968eabff2a9bef` on `main` `6567c5f`. Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver `30.0.13002.13003`, Rust 1.99.0 MSVC, DXC/DXIL `1.9.2609.5`, debug build. - The focused `shader_cache_bypasses_debug_overrides` test failed with the new case before the fix (0 passed, 1 failed), then passed after it (1 passed, 0 failed). - `cargo build --locked --workspace -j 2` passed. - With `XCL_ADAPTER=6800M` and `XCL_REQUIRE_GPU=1`, `cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output` completed across 20 test binaries with 854 passed, 143 failed, and 45 ignored. Six explicit `SKIPPED` tests are included in the passed count: `gpu_raw_window_view_reaches_its_top` (no GPU), `pso_measurement_compiles_an_exact_synthetic_record` (device error), `placed_title_textures_share_vram_and_preserve_pixels` (no reserved cube with mips), `test_title_draws_with_a_root_signature_under_the_debug_layer` (missing `d3d12SDKLayers.dll`), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows), and `uploads_start_from_each_subresources_state` (no D3D12 debug layer). - The suite was not green. Fuzz seed 5 suspended the GPU device during compute PSO creation (`0x887A0005`), followed by failures in other GPU tests. - Release `cargo build --locked --release -p xcl -j 2` passed. A locally owned title ran for 7 seconds on this head and main `400e638869ee8e8f8238079db3b70fce2abd3c2b`: each showed one frame, no crash, and no device removal. Peak process commit was 6,973 MB on this head versus 7,069 MB on main. **Regression run** main: ``` xcl-smoke v1 commit: 400e638869ee8e8f8238079db3b70fce2abd3c2b gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 1 device removals: 0 crashes: 0 peak commit: 7069 MB ``` PR head: ``` xcl-smoke v1 commit: 1512961b3e518a3cec275b6f85968eabff2a9bef gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 6973 MB ``` **Not tested** The 7-second title run did not set `XCL_DXIL_NO_OPT` and logged zero draws, so it did not exercise the changed cache-bypass path. Longer title runs, other adapters, and newer AMD drivers. **AI use** OpenAI Codex (GPT-6, exact variant not exposed in this session) implemented the fix and test case, ran the checks, reviewed the diff, and drafted this description.
XCL_DXIL_NO_OPT changes the emitted DXIL but is absent from the translated
cache identity. Avoid reading or writing the normal cache while this debug
override is set, and cover the bypass for compute, vertex, and pixel stages.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:14:43 +00:00
github manually merged commit 1512961b3e into gh-pr/2013/base 2026-11-26 05:14:45 +00:00
Author
Owner

@⁠anes66 on GitHub · 2026-11-25 00:46 UTC · original

CPU-only public-path check on exact head 1512961b3e518a3cec275b6f85968eabff2a9bef: the override bypasses populated normal disk and RAM entries for compute, vertex and pixel requests, preserving those entries. Optional test companion 23014df, directly on this head, adds one test only.

Tested

  • Windows 10 Pro 19045, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug. No GPU or retail inputs; no DXC shader compilation (the cache identity reads the installed DXC toolchain version).
  • A fresh child process gets XCL_DXIL_NO_OPT=all, XCL_DIRECT_DXIL=all, and an isolated scratch cache. It seeds a disk marker, then a different RAM marker, for each of Compute/Vertex/Pixel. The public console_to_dxil_in call must reject the deliberately invalid synthetic input instead of returning either marker. Subsequent direct cache probes must find both original entries unchanged. Parent environment is untouched.
  • Restoring only the old bypass list made the new test fail: the Compute request returned the normal disk marker rather than reaching translation. With the fix restored, the test passed.
  • cargo test --locked -p xcl --lib gpu::recomp::pso::shader_cache_tests:: -- --nocapture --test-threads=1: 15 passed / 0 failed / 0 ignored, no skips. The runtime control edit was removed before the final passing run and commit.

Not tested
Full workspace/GPU suite, valid-shader optimized/unoptimized output, mesh/geometry paths, release, retail regression or newer-main integration. Marker entries exercise routing and preservation; they are not executable shaders. No competing upstream PR.

AI use
Codex (GPT-6; exact variant unavailable) wrote the test and temporary control, ran CPU validation and prepared this report.

**@⁠anes66** on GitHub · 2026-11-25 00:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/2013#issuecomment-7148853143) CPU-only public-path check on exact head `1512961b3e518a3cec275b6f85968eabff2a9bef`: the override bypasses populated normal disk and RAM entries for compute, vertex and pixel requests, preserving those entries. Optional test companion [23014df](https://github.com/anes66/xcl/commit/23014df1badceea09123c55c0553c168dfe7a9cc), directly on this head, adds one test only. **Tested** - Windows 10 Pro 19045, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug. No GPU or retail inputs; no DXC shader compilation (the cache identity reads the installed DXC toolchain version). - A fresh child process gets `XCL_DXIL_NO_OPT=all`, `XCL_DIRECT_DXIL=all`, and an isolated scratch cache. It seeds a disk marker, then a different RAM marker, for each of Compute/Vertex/Pixel. The public `console_to_dxil_in` call must reject the deliberately invalid synthetic input instead of returning either marker. Subsequent direct cache probes must find both original entries unchanged. Parent environment is untouched. - Restoring only the old bypass list made the new test fail: the Compute request returned the normal disk marker rather than reaching translation. With the fix restored, the test passed. - `cargo test --locked -p xcl --lib gpu::recomp::pso::shader_cache_tests:: -- --nocapture --test-threads=1`: **15 passed / 0 failed / 0 ignored**, no skips. The runtime control edit was removed before the final passing run and commit. **Not tested** Full workspace/GPU suite, valid-shader optimized/unoptimized output, mesh/geometry paths, release, retail regression or newer-main integration. Marker entries exercise routing and preservation; they are not executable shaders. No competing upstream PR. **AI use** Codex (GPT-6; exact variant unavailable) wrote the test and temporary control, ran CPU validation and prepared this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 04:01 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 04:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/2013#issuecomment-7152457390) 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!
This discussion has been locked. Commenting is limited to contributors.
No description provided.