Skip to content

Shaders: count reused compute shaders as cache hits - #1232

Open
alpz1000 wants to merge 1 commit into
xcl-dev:mainfrom
alpz1000:shaders/compute-cache-count
Open

alpz1000 wants to merge 1 commit into
xcl-dev:mainfrom
alpz1000:shaders/compute-cache-count

Conversation

@alpz1000

@alpz1000 alpz1000 commented Nov 24, 2026 •

Copy link
Copy Markdown

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.

Assisted-by: OpenAI Codex (GPT-6)
@DavidM1911

Copy link
Copy Markdown
Contributor

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.

@alpz1000
alpz1000 marked this pull request as ready for review November 24, 2026 13:49
@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@ettehn

ettehn commented Nov 25, 2026

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants