Shaders: count reused compute shaders as cache hits #1232

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

@⁠alpz1000 on GitHub · 2026-11-24 13:26 UTC · original
alpz1000:shaders/compute-cache-count → main · +28 −9 · 2 files · 1 commits · open

xcl shaders --precompile counted every successful compute shader lookup as a fresh compile, including when it reused cached DXIL. This change reports fresh compiles and cache hits separately.

What is in it

  • Carry cache status through the compute shader translation path.
  • Count each result correctly in the precompile summary. Pipeline creation still runs when requested.

Tested

  • Windows 11 Home 26200.9974, Intel Core i5-8400, RTX 3060 12 GB, driver 610.88, Rust 1.100.0 MSVC, DXC 1.9.2602.17. Release for the CLI check and debug for the workspace suite.
  • Cold cache: 43 compiled, 0 cached, 0 errors.
  • Warm cache: 0 compiled, 43 cached, 0 errors, also with the translation cache disabled.
  • cargo test --locked --workspace --no-fail-fast -- --test-threads=4: 741 passed, 0 failed, 41 ignored. Two tests counted as passed reported no wave64: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware.

Regression run

Paired 60-second startup runs on the same title with fresh XCL data and caches per build.

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 3060
title: Retail title
seconds: 60
exit: 0x0
frames shown: 277 (PresentX 278)
presents per 2 s (last 3): 15 16 15
device removals: 0
crashes: 0
peak commit: 15443 MB
xcl-smoke v1
commit: 9af37dc2466a1cbe82b4f232852340cccc6efc4f
gpu: NVIDIA GeForce RTX 3060
title: Retail title
seconds: 60
exit: 0x0
frames shown: 255 (PresentX 255)
presents per 2 s (last 3): 15 16 15
device removals: 0
crashes: 0
peak commit: 15381 MB

Not tested

Gameplay beyond the 60-second startup run, other adapters, and the full shader corpus.

AI use

OpenAI Codex (GPT-6) implemented the change, ran the local checks, and drafted the description.

**@⁠alpz1000** on GitHub · 2026-11-24 13:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1232) `alpz1000:shaders/compute-cache-count` → `main` · +28 −9 · 2 files · 1 commits · open xcl shaders --precompile counted every successful compute shader lookup as a fresh compile, including when it reused cached DXIL. This change reports fresh compiles and cache hits separately. **What is in it** - Carry cache status through the compute shader translation path. - Count each result correctly in the precompile summary. Pipeline creation still runs when requested. **Tested** - Windows 11 Home 26200.9974, Intel Core i5-8400, RTX 3060 12 GB, driver 610.88, Rust 1.100.0 MSVC, DXC 1.9.2602.17. Release for the CLI check and debug for the workspace suite. - Cold cache: 43 compiled, 0 cached, 0 errors. - Warm cache: 0 compiled, 43 cached, 0 errors, also with the translation cache disabled. - cargo test --locked --workspace --no-fail-fast -- --test-threads=4: 741 passed, 0 failed, 41 ignored. Two tests counted as passed reported no wave64: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware. **Regression run** Paired 60-second startup runs on the same title with fresh XCL data and caches per build. ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 3060 title: Retail title seconds: 60 exit: 0x0 frames shown: 277 (PresentX 278) presents per 2 s (last 3): 15 16 15 device removals: 0 crashes: 0 peak commit: 15443 MB ``` ``` xcl-smoke v1 commit: 9af37dc2466a1cbe82b4f232852340cccc6efc4f gpu: NVIDIA GeForce RTX 3060 title: Retail title seconds: 60 exit: 0x0 frames shown: 255 (PresentX 255) presents per 2 s (last 3): 15 16 15 device removals: 0 crashes: 0 peak commit: 15381 MB ``` **Not tested** Gameplay beyond the 60-second startup run, other adapters, and the full shader corpus. **AI use** OpenAI Codex (GPT-6) implemented the change, ran the local checks, and drafted the description.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:55 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 13:47 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib shaders: 13 passed, 0 failed.

Note: the full d3d12x lib filter currently aborts with 0xc0000005 on unmodified main too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.

**@⁠DavidM1911** on GitHub · 2026-11-24 13:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1232#issuecomment-7133341107) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib shaders: 13 passed, 0 failed. Note: the full `d3d12x` lib filter currently aborts with 0xc0000005 on unmodified `main` too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.
Author
Owner

@⁠ettehn on GitHub · 2026-11-25 10:04 UTC · original

This accounting also matters for #2120. On its exact head, a second process reused the rerouted DXIL but still printed compiled 1, already cached 0 (check). I tested a local adaptation of #1232 on 8dcc56d: carry a per-lookup DXIL reuse flag separately from the reroute flag, so it does not depend on process-wide counter deltas.

Native Windows CLI, no --pipelines, tested three cases: (1) a rerouted large record, cold and then a separate warm process, reported 1/0 then 0/1 (compiled/cached). (2) a smaller record with the translation cache disabled still reported 1/0 then 0/1 by reusing the DXC cache. (3) two identical inputs with workers enabled and a fresh cache emitted one reroute and reported 1/1. All runs exited 0 with zero reported errors under a 2 GiB job commit cap. No title or hardware GPU exercised. I have the local integration patch if useful when the conflict is resolved.

AI use — OpenAI Codex (GPT-6) adapted the code and ran the checks.

**@⁠ettehn** on GitHub · 2026-11-25 10:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/1232#issuecomment-7159175973) This accounting also matters for #2120. On its exact head, a second process reused the rerouted DXIL but still printed `compiled 1, already cached 0` ([check](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2120)). I tested a local adaptation of #1232 on `8dcc56d`: carry a per-lookup DXIL reuse flag separately from the reroute flag, so it does not depend on process-wide counter deltas. Native Windows CLI, no `--pipelines`, tested three cases: (1) a rerouted large record, cold and then a separate warm process, reported 1/0 then 0/1 (compiled/cached). (2) a smaller record with the translation cache disabled still reported 1/0 then 0/1 by reusing the DXC cache. (3) two identical inputs with workers enabled and a fresh cache emitted one reroute and reported 1/1. All runs exited 0 with zero reported errors under a 2 GiB job commit cap. No title or hardware GPU exercised. I have the local integration patch if useful when the conflict is resolved. AI use — OpenAI Codex (GPT-6) adapted the code and ran the checks.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:17 UTC · original

Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-26 04:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/1232#issuecomment-7182465074) Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/gpu/recomp/pso.rs
  • crates/xcl/src/shaders.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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