Recompiler: validate DXIL containers and split pieces in translated cache #2530

Open
ramon-victor wants to merge 1 commit from upstream-pr/2540 into main
ramon-victor commented 2026-11-25 22:18:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ramon-victor on 2026-11-25T22:18:11Z.


Enforces DXIL container and split dispatch_chain validation in translated::cached_rerouted, translated::cached_in, and translated::store_in, matching the invariants already enforced by translated::load_in.

Previously, the production path translated::cached_rerouted skipped dxc::valid_dxil_container(&c.dxil) (unlike the test-only cached_in), and none of store_in, cached_in, or cached_rerouted validated c.dispatch_chain (dwords_per_group > 0, pieces.len() >= 2, and valid_dxil_container(piece) for every piece). A corrupt or truncated whole container or split piece could therefore be returned directly to D3D12 and persisted to disk (where load_in later rejected it).

Part of #2463 (specifically item 3's container/piece validation; direct_output() already tracks compact_nest_tag() on main).

What is in it

  • crates/xcl/src/gpu/recomp/pso.rs:
    • Add translated::valid_compiled(c: &Compiled) -> bool verifying dxc::valid_dxil_container(&c.dxil) and, when dispatch_chain is Some, dwords_per_group > 0, pieces.len() >= 2, and valid_dxil_container on every piece.
    • Enforce valid_compiled in store_in, cached_in, and cached_rerouted (returning an error without writing .bin or a permanent .err marker when validation fails).
    • Add shader_cache_tests::translated_cache_rejects_invalid_dxil_and_split_pieces covering invalid whole DXIL in cached_rerouted, malformed dispatch_chain cases (bad piece bytes, < 2 pieces, 0 dwords per group) across cached_rerouted, cached_in, and store_in, plus a valid 2-piece round-trip.

Tested

  • Hardware / toolchain: NVIDIA GeForce RTX 3070 8 GiB (driver 621.24, wave32), AMD Ryzen 7 5700X, 32 GiB RAM, Windows 11 Pro (26300), rustc 1.99.0 (x86_64-pc-windows-msvc), DXC/DXIL 1.8.2502.11 (Windows SDK 10.0.26100.0).
  • Failing-first before fix: cargo test -p xcl --lib translated_cache_rejects_invalid_dxil_and_split_pieces -- --nocapture failed (0 passed, 1 failed: cached_rerouted must reject invalid whole DXIL).
  • After fix: cargo test -p xcl --lib gpu::recomp::pso:: -- --test-threads=1: 25 passed, 0 failed, 1 ignored (repeated_pso_shader_compile benchmark).
  • Full workspace suite (.\scripts\test.ps1, debug): 1424 passed, 0 failed, 46 ignored (skipped on this adapter: wave64-only GPU tests, unsupported per-lane semantics variants, no heap windows).
  • Release build (cargo build --release -p xcl) and clean 60 s retail smoke run (.\scripts\smoke.ps1).

Regression run

Baseline (main):

xcl-smoke v1
commit: f087b998d0d51a9f11bbfa0761967a63e778edd9
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14467 MB

PR (f5cb7ea):

xcl-smoke v1
commit: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1619 (PresentX 1619)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14024 MB

Not tested

  • Corrupting an on-disk retail cache during a live title run (covered deterministically by the unit tests on translated::cached_rerouted, cached_in, and store_in).
  • AMD / Intel GPUs and Wine / macOS hosts.

AI use

  • Antigravity (Gemini 4 Neon): analyzed #2463 item 3 against main, implemented valid_compiled across store_in/cached_in/cached_rerouted and its failing-first unit tests, ran .\scripts\test.ps1, release build, and the 60 s smoke.ps1 run, and drafted this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5500139723 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2540). Originally posted by [ramon-victor](https://github.com/ramon-victor) on 2026-11-25T22:18:11Z. --- Enforces DXIL container and split `dispatch_chain` validation in `translated::cached_rerouted`, `translated::cached_in`, and `translated::store_in`, matching the invariants already enforced by `translated::load_in`. Previously, the production path `translated::cached_rerouted` skipped `dxc::valid_dxil_container(&c.dxil)` (unlike the test-only `cached_in`), and none of `store_in`, `cached_in`, or `cached_rerouted` validated `c.dispatch_chain` (`dwords_per_group > 0`, `pieces.len() >= 2`, and `valid_dxil_container(piece)` for every piece). A corrupt or truncated whole container or split piece could therefore be returned directly to D3D12 and persisted to disk (where `load_in` later rejected it). Part of #2463 (specifically item 3's container/piece validation; `direct_output()` already tracks `compact_nest_tag()` on `main`). **What is in it** - `crates/xcl/src/gpu/recomp/pso.rs`: - Add `translated::valid_compiled(c: &Compiled) -> bool` verifying `dxc::valid_dxil_container(&c.dxil)` and, when `dispatch_chain` is `Some`, `dwords_per_group > 0`, `pieces.len() >= 2`, and `valid_dxil_container` on every piece. - Enforce `valid_compiled` in `store_in`, `cached_in`, and `cached_rerouted` (returning an error without writing `.bin` or a permanent `.err` marker when validation fails). - Add `shader_cache_tests::translated_cache_rejects_invalid_dxil_and_split_pieces` covering invalid whole DXIL in `cached_rerouted`, malformed `dispatch_chain` cases (bad piece bytes, `< 2` pieces, `0` dwords per group) across `cached_rerouted`, `cached_in`, and `store_in`, plus a valid 2-piece round-trip. **Tested** - Hardware / toolchain: NVIDIA GeForce RTX 3070 8 GiB (driver `621.24`, wave32), AMD Ryzen 7 5700X, 32 GiB RAM, Windows 11 Pro (`26300`), `rustc 1.99.0` (`x86_64-pc-windows-msvc`), DXC/DXIL `1.8.2502.11` (Windows SDK `10.0.26100.0`). - Failing-first before fix: `cargo test -p xcl --lib translated_cache_rejects_invalid_dxil_and_split_pieces -- --nocapture` failed (`0 passed, 1 failed`: `cached_rerouted must reject invalid whole DXIL`). - After fix: `cargo test -p xcl --lib gpu::recomp::pso:: -- --test-threads=1`: `25 passed, 0 failed, 1 ignored` (`repeated_pso_shader_compile` benchmark). - Full workspace suite (`.\scripts\test.ps1`, debug): `1424 passed, 0 failed, 46 ignored` (skipped on this adapter: wave64-only GPU tests, unsupported per-lane semantics variants, `no heap windows`). - Release build (`cargo build --release -p xcl`) and clean 60 s retail smoke run (`.\scripts\smoke.ps1`). **Regression run** Baseline (`main`): ``` xcl-smoke v1 commit: f087b998d0d51a9f11bbfa0761967a63e778edd9 gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14467 MB ``` PR (`f5cb7ea`): ``` xcl-smoke v1 commit: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49 gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1619 (PresentX 1619) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14024 MB ``` **Not tested** - Corrupting an on-disk retail cache during a live title run (covered deterministically by the unit tests on `translated::cached_rerouted`, `cached_in`, and `store_in`). - AMD / Intel GPUs and Wine / macOS hosts. **AI use** - Antigravity (Gemini 4 Neon): analyzed #2463 item 3 against `main`, implemented `valid_compiled` across `store_in`/`cached_in`/`cached_rerouted` and its failing-first unit tests, ran `.\scripts\test.ps1`, release build, and the 60 s `smoke.ps1` run, and drafted this PR description.
DavidM1911 commented 2026-11-25 23:09:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T22:26:53Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7176373717 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2540#issuecomment-7176373717). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T22:26:53Z. --- 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!
emirduran707 commented 2026-11-25 23:09:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T22:37:57Z.


Independent AMD RDNA4 (native wave64) test report on exact head f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49 (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1422 passed, 2 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.
    • The PR's test passed: gpu::recomp::pso::shader_cache_tests::translated_cache_rejects_invalid_dxil_and_split_pieces.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722 and fuzz_validate_and_gpu_3 seed 1599) are pre-existing on unmodified main on this GPU.

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release)

xcl-smoke v1
commit: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1597 (PresentX 1597)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13963 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7176601857 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2540#issuecomment-7176601857). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-25T22:37:57Z. --- Independent AMD RDNA4 (native wave64) test report on exact head `f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49` (clean detached checkout, no local changes). **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2602.17; tests debug, smoke release. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: **1422 passed, 2 failed, 46 ignored; 8 SKIPPED** (6 in `lower_dxil::tests::{f16,f32}_programs_on_the_gpu` refused by per-lane form; `heap_window_out_of_memory_falls_back_to_the_switch_form`; `pso_measurement_compiles_an_exact_synthetic_record`). All native wave64 GPU tests ran and passed. - The PR's test passed: `gpu::recomp::pso::shader_cache_tests::translated_cache_rejects_invalid_dxil_and_split_pieces`. - The 2 failures (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` seed 722 and `fuzz_validate_and_gpu_3` seed 1599) are pre-existing on unmodified `main` on this GPU. **Regression run** (60 s retail-title smoke, `XCL_NETWORK=0`, release) ``` xcl-smoke v1 commit: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49 gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1597 (PresentX 1597) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13963 MB ``` (Matched `main` `68a284a` baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.) **Not tested** - D3D12 debug layer; Intel GPUs. **AI use** - Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
SlopTart commented 2026-11-26 00:05:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T23:24:54Z.


Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of translated_cache_rejects_invalid_dxil_and_split_pieces: 2 passed.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7177527741 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2540#issuecomment-7177527741). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-25T23:24:54Z. --- **Tested**: current PR head merged onto current `origin/main` (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target `x86_64-pc-windows-gnu` run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29). `gpu_` suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. Targeted run of `translated_cache_rejects_invalid_dxil_and_split_pieces`: 2 passed. **Not tested**: retail titles (no title data on this lane, counts only). **AI use**: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
Decodere commented 2026-11-27 01:41:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T01:41:54Z.


Independent desktop NVIDIA verification of PR #2540 at head f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49 (1 commit; exact parent & merge-base: e1d84b7d9153f86a97d2ec5d209d196046fc0bea, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted release tests & build (f5cb7eaa)

Command Result
cargo test --release -p xcl --lib translated_cache_rejects_invalid_dxil_and_split_pieces -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.00s × 3, 0 skipped)
cargo test --release -p xcl --lib gpu::recomp::pso:: (3 consecutive runs) 25 passed; 0 failed; 1 ignored; 1299 filtered out × 3 (0.08s, 0.10s, 0.08s, 0 skipped)
cargo build --release -p xcl Clean build (1m 13s, exit 0, 0 new warnings)

Paired quiet 60 s retail smoke (title: 29640639)

Exact parent & merge-base (e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13982 MB

PR #2540 (f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49):

xcl-smoke v1
commit: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1587 (PresentX 1587)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14018 MB

Runtime log observations (xcl.log)

  • 9222 log lines, 0 [ERROR] / device-removal / panic lines.
  • Final draw/memory telemetry in log: 19438 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample 14018 MB committed by the process; video memory 6116 MB local, 4683 MB non-local.

Limits of coverage

  • Rejection of invalid DXIL containers and malformed split pieces on translated-cache load was verified via translated_cache_rejects_invalid_dxil_and_split_pieces (3/3) and gpu::recomp::pso:: (25/0/1 × 3).
  • The 60 s retail smoke ran against our intact warm shader cache on title: 29640639, confirming zero false rejections or runtime regression (frame-count and commit deltas vs. cached parent reflect single-run startup variance, not this PR).

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

<!-- greyfinch-sync:ivall/xcl:comment:7207504507 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2540#issuecomment-7207504507). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T01:41:54Z. --- Independent desktop NVIDIA verification of **PR #2540** at head `f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49` (`1` commit; exact parent & merge-base: `e1d84b7d9153f86a97d2ec5d209d196046fc0bea`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted release tests & build (`f5cb7eaa`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib translated_cache_rejects_invalid_dxil_and_split_pieces -- --nocapture` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 1324 filtered out` × 3 (`0.00s` × 3, `0` skipped) | | `cargo test --release -p xcl --lib gpu::recomp::pso::` (3 consecutive runs) | `25 passed; 0 failed; 1 ignored; 1299 filtered out` × 3 (`0.08s`, `0.10s`, `0.08s`, `0` skipped) | | `cargo build --release -p xcl` | Clean build (`1m 13s`, exit `0`, `0` new warnings) | ### Paired quiet 60 s retail smoke (`title: 29640639`) Exact parent & merge-base (`e1d84b7d9153f86a97d2ec5d209d196046fc0bea`, cached baseline on the same machine): ``` xcl-smoke v1 commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1531 (PresentX 1531) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13982 MB ``` PR #2540 (`f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49`): ``` xcl-smoke v1 commit: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1587 (PresentX 1587) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14018 MB ``` ### Runtime log observations (`xcl.log`) - `9222` log lines, `0` `[ERROR]` / device-removal / panic lines. - Final draw/memory telemetry in log: `19438 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped)`; last memory sample `14018 MB committed by the process; video memory 6116 MB local, 4683 MB non-local`. ### Limits of coverage - Rejection of invalid DXIL containers and malformed split pieces on translated-cache load was verified via `translated_cache_rejects_invalid_dxil_and_split_pieces` (`3/3`) and `gpu::recomp::pso::` (`25/0/1` × 3). - The 60 s retail smoke ran against our intact warm shader cache on `title: 29640639`, confirming zero false rejections or runtime regression (frame-count and commit deltas vs. cached parent reflect single-run startup variance, not this PR). *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
thehollowedone commented 2026-11-28 09:53:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T09:53:07Z.


merge-check
base: e429936c10
head: f5cb7eaa1c
merge: clean text merge, but the exact merged head does not compile
build: cargo test --offline --locked -j 4 -p xcl --lib translated_cache_rejects_invalid_dxil_and_split_pieces -- --nocapture -> failed to compile with four E0063 errors: the PR's new Compiled test fixtures omit dispatch_remap, added on current main. With the four test-only additions below, cargo build --offline --locked -j 4 --workspace -> ok.
tests: On that uncommitted test-only candidate, the focused regression passed (1 passed, 0 failed, 0 ignored, 0 skipped). cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 -> 2,126 passed, 10 failed, 48 ignored; 25 GPU skip notices. The same ten failed on untouched main at this base: dispatch_chain_oversized_loop_matches_whole, dispatch_chain_wave32_live_loops, dispatch_chain_wave64_live_loops_and_exchange, gpu_heap_flat_reads_match_guarded_and_root_output, console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, gpu_compute_mode_dispatch_abi, gpu_float_cas_uses_ieee_equality, and the three test_title_* e2e cases. The exact PR head's test target did not compile, so these counts are not head-only results.
review: the build break above is the blocker. I read the full diff and traced the enabled cache miss through validation, RAM insertion and disk write; the new check rejects malformed whole and split containers before side effects. XCL_TRANSLATED_CACHE=0 retains its existing bypass. #2535 was closed in favor of this PR. The four-field rebase fix preserves the current test intent:

Test-only diff against the #2540 + current-main trial merge
diff --git a/crates/xcl/src/gpu/recomp/pso.rs b/crates/xcl/src/gpu/recomp/pso.rs
index 4cc5aff6..e6e124e0 100644
--- a/crates/xcl/src/gpu/recomp/pso.rs
+++ b/crates/xcl/src/gpu/recomp/pso.rs
@@ -2707,7 +2707,7 @@
         //    write neither `.bin` nor `.err`, and allow a valid translation afterward.
         let blob1 = b"console-bad-whole-dxil";
         let err = translated::cached_rerouted(&dir, ident, 7, blob1, Stage::Compute, 0, 1, false, || {
-            Ok((Compiled { dxil: bad_bytes.clone(), samplers: Vec::new(), dispatch_chain: None }, true))
+            Ok((Compiled { dxil: bad_bytes.clone(), samplers: Vec::new(), dispatch_chain: None, dispatch_remap: None }, true))
         })
         .err()
         .expect("cached_rerouted must reject invalid whole DXIL");
@@ -2728,7 +2728,7 @@
         for (i, chain) in bad_chains.into_iter().enumerate() {
             let blob = format!("console-bad-chain-{i}");
             let err = translated::cached_rerouted(&dir, ident, 7, blob.as_bytes(), Stage::Compute, 0, 1, false, || {
-                Ok((Compiled { dxil: valid_piece.clone(), samplers: Vec::new(), dispatch_chain: Some(std::sync::Arc::new(chain)) }, true))
+                Ok((Compiled { dxil: valid_piece.clone(), samplers: Vec::new(), dispatch_chain: Some(std::sync::Arc::new(chain)), dispatch_remap: None }, true))
             })
             .err()
             .expect("cached_rerouted must reject invalid dispatch_chain");
@@ -2749,6 +2749,7 @@
             dispatch_chain: Some(std::sync::Arc::new(crate::gpu::dxil::kernel::DispatchChain {
                 dwords_per_group: 4,
                 pieces: vec![valid_piece.clone(), bad_bytes.clone()],
             })),
+            dispatch_remap: None,
         };
         translated::store_in(&path_store, ident, blob_store, &bad_compiled);
         assert!(!path_store.exists(), "store_in must refuse to write invalid dispatch_chain pieces");
@@ -2763,6 +2764,7 @@
             dispatch_chain: Some(std::sync::Arc::new(crate::gpu::dxil::kernel::DispatchChain {
                 dwords_per_group: 8,
                 pieces: vec![valid_piece.clone(), compiled(22).dxil],
             })),
+            dispatch_remap: None,
         };
         let r1 = translated::cached_rerouted(&dir, ident, 7, blob_ok, Stage::Compute, 0, 1, false, || Ok((good.clone(), true))).unwrap();
         let r2 = translated::cached_rerouted(&dir, ident, 7, blob_ok, Stage::Compute, 0, 1, false, || panic!("must hit cache")).unwrap();

performance: reasoned only. Validation reads DXIL container headers/chunk ranges on enabled-cache misses and valid cold writes; warm cache hits add no new check. No frame-time or memory benchmark was run.
verdict: not yet: rebase the four fixtures, push a new head, rerun the PR's required clean-head smoke, and recheck CI. The local candidate passes the focused test and build; the exact current head does not compile against main.
hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, DXC 1.8.2502.11; Codex (GPT-6.2 Sol) ran the tests and drafted this check. Codex (GPT-6.2 Astra) independently traced the cache path.

<!-- greyfinch-sync:ivall/xcl:comment:7237529843 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2540#issuecomment-7237529843). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-28T09:53:07Z. --- merge-check base: e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd head: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49 merge: clean text merge, but the exact merged head does not compile build: `cargo test --offline --locked -j 4 -p xcl --lib translated_cache_rejects_invalid_dxil_and_split_pieces -- --nocapture` -> failed to compile with four E0063 errors: the PR's new `Compiled` test fixtures omit `dispatch_remap`, added on current main. With the four test-only additions below, `cargo build --offline --locked -j 4 --workspace` -> ok. tests: On that uncommitted test-only candidate, the focused regression passed (1 passed, 0 failed, 0 ignored, 0 skipped). `cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4` -> 2,126 passed, 10 failed, 48 ignored; 25 GPU skip notices. The same ten failed on untouched main at this base: `dispatch_chain_oversized_loop_matches_whole`, `dispatch_chain_wave32_live_loops`, `dispatch_chain_wave64_live_loops_and_exchange`, `gpu_heap_flat_reads_match_guarded_and_root_output`, `console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk`, `gpu_compute_mode_dispatch_abi`, `gpu_float_cas_uses_ieee_equality`, and the three `test_title_*` e2e cases. The exact PR head's test target did not compile, so these counts are not head-only results. review: the build break above is the blocker. I read the full diff and traced the enabled cache miss through validation, RAM insertion and disk write; the new check rejects malformed whole and split containers before side effects. `XCL_TRANSLATED_CACHE=0` retains its existing bypass. [#2535](https://github.com/xcl-dev/xcl/pull/2535) was closed in favor of this PR. The four-field rebase fix preserves the current test intent: <details><summary>Test-only diff against the #2540 + current-main trial merge</summary> ```diff diff --git a/crates/xcl/src/gpu/recomp/pso.rs b/crates/xcl/src/gpu/recomp/pso.rs index 4cc5aff6..e6e124e0 100644 --- a/crates/xcl/src/gpu/recomp/pso.rs +++ b/crates/xcl/src/gpu/recomp/pso.rs @@ -2707,7 +2707,7 @@ // write neither `.bin` nor `.err`, and allow a valid translation afterward. let blob1 = b"console-bad-whole-dxil"; let err = translated::cached_rerouted(&dir, ident, 7, blob1, Stage::Compute, 0, 1, false, || { - Ok((Compiled { dxil: bad_bytes.clone(), samplers: Vec::new(), dispatch_chain: None }, true)) + Ok((Compiled { dxil: bad_bytes.clone(), samplers: Vec::new(), dispatch_chain: None, dispatch_remap: None }, true)) }) .err() .expect("cached_rerouted must reject invalid whole DXIL"); @@ -2728,7 +2728,7 @@ for (i, chain) in bad_chains.into_iter().enumerate() { let blob = format!("console-bad-chain-{i}"); let err = translated::cached_rerouted(&dir, ident, 7, blob.as_bytes(), Stage::Compute, 0, 1, false, || { - Ok((Compiled { dxil: valid_piece.clone(), samplers: Vec::new(), dispatch_chain: Some(std::sync::Arc::new(chain)) }, true)) + Ok((Compiled { dxil: valid_piece.clone(), samplers: Vec::new(), dispatch_chain: Some(std::sync::Arc::new(chain)), dispatch_remap: None }, true)) }) .err() .expect("cached_rerouted must reject invalid dispatch_chain"); @@ -2749,6 +2749,7 @@ dispatch_chain: Some(std::sync::Arc::new(crate::gpu::dxil::kernel::DispatchChain { dwords_per_group: 4, pieces: vec![valid_piece.clone(), bad_bytes.clone()], })), + dispatch_remap: None, }; translated::store_in(&path_store, ident, blob_store, &bad_compiled); assert!(!path_store.exists(), "store_in must refuse to write invalid dispatch_chain pieces"); @@ -2763,6 +2764,7 @@ dispatch_chain: Some(std::sync::Arc::new(crate::gpu::dxil::kernel::DispatchChain { dwords_per_group: 8, pieces: vec![valid_piece.clone(), compiled(22).dxil], })), + dispatch_remap: None, }; let r1 = translated::cached_rerouted(&dir, ident, 7, blob_ok, Stage::Compute, 0, 1, false, || Ok((good.clone(), true))).unwrap(); let r2 = translated::cached_rerouted(&dir, ident, 7, blob_ok, Stage::Compute, 0, 1, false, || panic!("must hit cache")).unwrap(); ``` </details> performance: reasoned only. Validation reads DXIL container headers/chunk ranges on enabled-cache misses and valid cold writes; warm cache hits add no new check. No frame-time or memory benchmark was run. verdict: not yet: rebase the four fixtures, push a new head, rerun the PR's required clean-head smoke, and recheck CI. The local candidate passes the focused test and build; the exact current head does not compile against main. hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, DXC 1.8.2502.11; Codex (GPT-6.2 Sol) ran the tests and drafted this check. Codex (GPT-6.2 Astra) independently traced the cache path.
throny commented 2026-11-28 13:38:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T13:38:54Z.


merge-check claim
head: f5cb7eaa1c

<!-- greyfinch-sync:ivall/xcl:comment:7240085023 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2540#issuecomment-7240085023). Originally posted by [throny](https://github.com/throny) on 2026-11-28T13:38:54Z. --- merge-check claim head: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49
throny commented 2026-11-28 13:55:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T13:55:05Z.


merge-check
base: e13d6250
head: f5cb7eaa1c
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> does not compile: 4 errors E0063. The test builds Compiled { dxil, samplers, dispatch_chain } four times and the struct on main now has a fourth field, dispatch_remap. No test ran. Base alone: 2130 passed, 10 failed, 48 ignored.
review: blocking: the test fixtures need the new field (the same point as the first check; the head is unchanged). Otherwise: a cache file is already validated when it is read on main (decode_entry checks the container, the group size and every piece and treats a bad entry as a miss); this PR adds the same checks for the translator output before it is stored. An invalid result becomes an error without a marker file, so it would be re-translated at every launch; and an invalid split piece now drops the whole shader (whether it fell back to the whole form before, I could not verify). The temp folder of the test is its own.
performance: nothing on a cache hit; one container parse per piece on a miss; no translator source change.
verdict: not yet: add dispatch_remap: None to the four fixtures and rebase; I will rerun on the new head.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7240277728 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2540#issuecomment-7240277728). Originally posted by [throny](https://github.com/throny) on 2026-11-28T13:55:05Z. --- merge-check base: e13d6250 head: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> does not compile: 4 errors E0063. The test builds `Compiled { dxil, samplers, dispatch_chain }` four times and the struct on main now has a fourth field, `dispatch_remap`. No test ran. Base alone: 2130 passed, 10 failed, 48 ignored. review: blocking: the test fixtures need the new field (the same point as the first check; the head is unchanged). Otherwise: a cache file is already validated when it is read on main (decode_entry checks the container, the group size and every piece and treats a bad entry as a miss); this PR adds the same checks for the translator output before it is stored. An invalid result becomes an error without a marker file, so it would be re-translated at every launch; and an invalid split piece now drops the whole shader (whether it fell back to the whole form before, I could not verify). The temp folder of the test is its own. performance: nothing on a cache hit; one container parse per piece on a miss; no translator source change. verdict: not yet: add `dispatch_remap: None` to the four fixtures and rebase; I will rerun on the new head. hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Foniass commented 2026-12-01 08:19:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:19:39Z.


Triage (#1607) – head f5cb7ea

#2535 made the same change (#2463 item 3: container checks in store_in and cached_rerouted) and was closed in favour of this one; this PR also checks cached_in and the chain's shape (dwords_per_group > 0, 2+ pieces), matching load_in. Not yet on main: cached_rerouted_for still stores without a container check and store_in checks only c.dxil. #2652 (dxc::wait_for_memory, another item of #2463) and #2475 (cache budget) are unrelated changes.
No problems found in the diff.
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:7305171866 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2540#issuecomment-7305171866). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:19:39Z. --- **Triage (#1607)** – head f5cb7ea #2535 made the same change (#2463 item 3: container checks in `store_in` and `cached_rerouted`) and was closed in favour of this one; this PR also checks `cached_in` and the chain's shape (`dwords_per_group > 0`, 2+ pieces), matching `load_in`. Not yet on main: `cached_rerouted_for` still stores without a container check and `store_in` checks only `c.dxil`. #2652 (`dxc::wait_for_memory`, another item of #2463) and #2475 (cache budget) are unrelated changes. No problems found in the diff. 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/2540:upstream-pr/2540'
git switch 'upstream-pr/2540'

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