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

Open
github-bot wants to merge 1 commit from github-bot/gh-2998 into main AGit
Owner

@⁠SalmanBarkat on GitHub · 2026-11-27 10:15 UTC · original
SalmanBarkat:perf/defer-compute-driver-cache-hash → main · +43 −9 · 1 files · 1 commits · draft

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.
**@⁠SalmanBarkat** on GitHub · 2026-11-27 10:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/2998) `SalmanBarkat:perf/defer-compute-driver-cache-hash` → `main` · +43 −9 · 1 files · 1 commits · draft 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 10:47:16 +00:00
Author
Owner

@⁠ettehn on GitHub · 2026-11-27 10:23 UTC · original

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.

**@⁠ettehn** on GitHub · 2026-11-27 10:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2998#issuecomment-7215837431) **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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2998/head:github-bot/gh-2998'
git switch 'github-bot/gh-2998'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2998'
git switch 'github-bot/gh-2998'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2998'
git switch 'github-bot/gh-2998'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2998'
git switch 'main'
git merge --squash 'github-bot/gh-2998'
git switch 'main'
git merge --ff-only 'github-bot/gh-2998'
git switch 'main'
git merge 'github-bot/gh-2998'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.