D3D12.X: defer driver cache path hashing on compute RAM hits #2998

Closed
SalmanBarkat wants to merge 1 commit from upstream-pr/2998 into main
SalmanBarkat commented 2026-11-27 10:15:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SalmanBarkat on 2026-11-27T10:15:24Z.


Defers driver_cache::path_for / driver_cache::path (and its full-buffer fnv64 DXIL hash) until after compute_blob(key) misses in RAM or when a newly compiled blob needs to be stored on disk. On compute PSO RAM cache hits where the driver accepts the cached blob, the fnv64 pass over the DXIL bytecode is skipped completely.

Fixes #2883

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs:
    • compute_container: compute driver_cache::path_for(dxil, copy.Flags.0, mode == ComputeBuild::Chain) only when compute_blob(key) returns None, or right before driver_cache::keep(...) if a new blob is written back after compilation.
    • finish_two_pass: apply the same lazy driver_cache::path(&tp.cs, 0) deferral around the compute-pass compute_blob(ckey) lookup and writeback.
    • driver_cache::tests::deferred_path_is_deterministic: verify path_for and name_for are deterministic across calls and distinct for .chain.pso vs .pso.

Tested

  • NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1742), Windows, rustc 1.100.0 (0ef1bc386 2026-11-09), debug build.
  • cargo build --workspace: succeeded.
  • cargo test --workspace -- --test-threads=4: 1447 passed, 0 failed, 47 ignored (across all 38 workspace test binaries, including hle::d3d12x::real::driver_cache::tests::* and gpu_two_pass_cache_e2e).

Not tested

  • Retail title scripts/smoke.ps1 regression run (no retail game package available locally to produce xcl-smoke blocks).
  • AMD / wave64 GPUs.

AI use

  • Gemini 4 Hydrogen: implemented the change and unit test, ran the workspace build/tests, and drafted this description.
<!-- greyfinch-sync:ivall/xcl:issue:5524908805 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2998). Originally posted by [SalmanBarkat](https://github.com/SalmanBarkat) on 2026-11-27T10:15:24Z. --- Defers `driver_cache::path_for` / `driver_cache::path` (and its full-buffer `fnv64` DXIL hash) until after `compute_blob(key)` misses in RAM or when a newly compiled blob needs to be stored on disk. On compute PSO RAM cache hits where the driver accepts the cached blob, the `fnv64` pass over the DXIL bytecode is skipped completely. Fixes #2883 **What is in it** - `crates/xcl/src/hle/d3d12x/real.rs`: - `compute_container`: compute `driver_cache::path_for(dxil, copy.Flags.0, mode == ComputeBuild::Chain)` only when `compute_blob(key)` returns `None`, or right before `driver_cache::keep(...)` if a new blob is written back after compilation. - `finish_two_pass`: apply the same lazy `driver_cache::path(&tp.cs, 0)` deferral around the compute-pass `compute_blob(ckey)` lookup and writeback. - `driver_cache::tests::deferred_path_is_deterministic`: verify `path_for` and `name_for` are deterministic across calls and distinct for `.chain.pso` vs `.pso`. **Tested** - NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1742), Windows, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug build. - `cargo build --workspace`: succeeded. - `cargo test --workspace -- --test-threads=4`: 1447 passed, 0 failed, 47 ignored (across all 38 workspace test binaries, including `hle::d3d12x::real::driver_cache::tests::*` and `gpu_two_pass_cache_e2e`). **Not tested** - Retail title `scripts/smoke.ps1` regression run (no retail game package available locally to produce `xcl-smoke` blocks). - AMD / wave64 GPUs. **AI use** - Gemini 4 Hydrogen: implemented the change and unit test, ran the workspace build/tests, and drafted this description.
ettehn commented 2026-11-27 10:23:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ettehn on 2026-11-27T10:23:56Z.


Tested on clean 3071230e616a25ce66b215dd741a7a87ec6b94dc. Windows 11 26200.9974, Rust 1.97.1 MSVC, debug. cargo test --offline --locked -j 2 -p xcl --lib driver_cache::tests -- --test-threads=1 passed 5/5 with XCL_PSO_DISK_CACHE=1. The same test binary in a fresh process with XCL_PSO_DISK_CACHE=0 passed 4/5. Only deferred_path_is_deterministic failed: path_for correctly returns None for both paths with caching disabled, and the test expects them to differ. Enabling the cache again returned to 5/5.

I also compared the exact heads with #2909 67c26e28. Both cover the same RAM-hit fast path in compute_container and the compute half of finish_two_pass, on the same parent 8b957bec. Both merge individually into main 623d02e4 and conflict with each other in real.rs. #2909’s callback tests exercise whether the disk path/load runs. #2998’s new test exercises path identity. No GPU timing or retail run.

AI use: OpenAI Codex (GPT-6) ran the Windows tests, compared the diffs, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7215837431 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2998#issuecomment-7215837431). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-27T10:23:56Z. --- **Tested on clean `3071230e616a25ce66b215dd741a7a87ec6b94dc`.** Windows 11 26200.9974, Rust 1.97.1 MSVC, debug. `cargo test --offline --locked -j 2 -p xcl --lib driver_cache::tests -- --test-threads=1` passed 5/5 with `XCL_PSO_DISK_CACHE=1`. The same test binary in a fresh process with `XCL_PSO_DISK_CACHE=0` passed 4/5. Only `deferred_path_is_deterministic` failed: `path_for` correctly returns `None` for both paths with caching disabled, and the test expects them to differ. Enabling the cache again returned to 5/5. I also compared the exact heads with #2909 `67c26e28`. Both cover the same RAM-hit fast path in `compute_container` and the compute half of `finish_two_pass`, on the same parent `8b957bec`. Both merge individually into `main` `623d02e4` and conflict with each other in `real.rs`. #2909’s callback tests exercise whether the disk path/load runs. #2998’s new test exercises path identity. No GPU timing or retail run. **AI use:** OpenAI Codex (GPT-6) ran the Windows tests, compared the diffs, and drafted this report.
throny commented 2026-11-30 20:19:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-30T20:19:07Z.


Closing: it is the same change as #2909 (older, with the helper and tests), which stays open as the one to rebase; note that both no longer apply because main reworked that code. Checked against current main (ff0c364b), hunk by hunk. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5) checked this; part of the duplicate sweep on #3041.

<!-- greyfinch-sync:ivall/xcl:comment:7290726668 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2998#issuecomment-7290726668). Originally posted by [throny](https://github.com/throny) on 2026-11-30T20:19:07Z. --- Closing: it is the same change as #2909 (older, with the helper and tests), which stays open as the one to rebase; note that both no longer apply because `main` reworked that code. Checked against current `main` (`ff0c364b`), hunk by hunk. If something here is still missing on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5) checked this; part of the duplicate sweep on #3041.

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!2998
No description provided.