Recompiler: count split shader pieces in the NVIDIA cache budget #3103

Closed
Prime1997 wants to merge 1 commit from upstream-pr/3103 into main
Prime1997 commented 2026-11-28 06:27:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-28T06:27:16Z.


Port main's split-shader cache admission repair to nvidia-dev. Insertion omitted dispatch-chain piece capacities while eviction subtracted them, allowing the retained payload to exceed its configured budget and making the accounting inconsistent.

What is in it

  • The narrow existing fix and regression from main commit f2cb30f8b99750d0d01bf3b2ca4ebfb006423621 by bmjask: count split-piece capacities on admission in gpu/recomp/pso.rs.
  • Duplicate/ownership check: #2475 already addresses this same accounting defect on main, using a shared size helper and a broader admission/eviction test. Main already contains the one-line repair ported here; checked NVIDIA base 54225f5884a94cd23b7aab3f703a7c975070aa77 does not. This PR is only the NVIDIA port, not a competing main implementation. Related issue #2508; stacked main provenance is associated with merged #2959.

Tested

  • Windows 11 Pro 26200, Intel i5-10400, NVIDIA RTX 3060 Ti (32.0.16.1714); Rust 1.100.0. CPU-only tests in debug/test profile with debug symbols disabled, two build jobs, isolated worktrees and output directories.
  • Before fix: the new shader_cache_charges_split_piece_capacity_on_insert regression on the unchanged NVIDIA runtime failed as expected: 0 passed, 1 failed, 0 ignored, 1,806 filtered; no SKIPPED messages. It admitted an oversized split shader.
  • After the exact source patch committed here: 5 passed, 0 failed, 0 ignored, 1,802 filtered; no SKIPPED messages. Both test binaries built successfully. These executions preceded committing the unchanged source tree; no clean-head retail run is claimed.
  • Command structure: cargo test --locked -p xcl --lib --target-dir <isolated-target> -- --exact --nocapture --test-threads=1, selecting gpu::recomp::pso::shader_cache_tests::{shader_cache_charges_split_piece_capacity_on_insert, shader_cache_skips_repeated_translation_and_disk_lookups, shader_cache_checks_context_and_blob_bytes, shader_cache_evicts_old_entries_and_skips_oversized_shaders, shader_cache_coalesces_concurrent_same_key_compiles} as separate fully qualified arguments. The before-fix control selects only the first test. Literal commands, patch hashes and logs are retained locally.

Regression run
Pending. No smoke block or gameplay result is claimed. Kept draft until current-head required validation is complete.

Not tested

  • Full workspace suite on this PR head; paired clean-head main/PR retail smoke; AMD/Intel GPU behavior.
  • Gameplay RAM savings or resolution of the missing-world symptom. Synthetic cache accounting does not establish either.

AI use

  • Codex (GPT-6) reviewed upstream provenance/overlap, ported the existing change, ran and checked the local controls, and prepared this PR. Original fix attribution is preserved above.

Optional temporary Discord for coordinating contributor work, helping test and comparing results: https://discord.gg/6B4TykyC4W

<!-- greyfinch-sync:ivall/xcl:issue:5537448626 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3103). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-28T06:27:16Z. --- Port main's split-shader cache admission repair to `nvidia-dev`. Insertion omitted dispatch-chain piece capacities while eviction subtracted them, allowing the retained payload to exceed its configured budget and making the accounting inconsistent. **What is in it** - The narrow existing fix and regression from main commit `f2cb30f8b99750d0d01bf3b2ca4ebfb006423621` by bmjask: count split-piece capacities on admission in `gpu/recomp/pso.rs`. - Duplicate/ownership check: #2475 already addresses this same accounting defect on **main**, using a shared size helper and a broader admission/eviction test. Main already contains the one-line repair ported here; checked NVIDIA base `54225f5884a94cd23b7aab3f703a7c975070aa77` does not. This PR is only the NVIDIA port, not a competing main implementation. Related issue #2508; stacked main provenance is associated with merged #2959. **Tested** - Windows 11 Pro 26200, Intel i5-10400, NVIDIA RTX 3060 Ti (32.0.16.1714); Rust 1.100.0. CPU-only tests in debug/test profile with debug symbols disabled, two build jobs, isolated worktrees and output directories. - Before fix: the new `shader_cache_charges_split_piece_capacity_on_insert` regression on the unchanged NVIDIA runtime failed as expected: **0 passed, 1 failed, 0 ignored, 1,806 filtered; no SKIPPED messages**. It admitted an oversized split shader. - After the exact source patch committed here: **5 passed, 0 failed, 0 ignored, 1,802 filtered; no SKIPPED messages**. Both test binaries built successfully. These executions preceded committing the unchanged source tree; no clean-head retail run is claimed. - Command structure: `cargo test --locked -p xcl --lib --target-dir <isolated-target> -- --exact --nocapture --test-threads=1`, selecting `gpu::recomp::pso::shader_cache_tests::{shader_cache_charges_split_piece_capacity_on_insert, shader_cache_skips_repeated_translation_and_disk_lookups, shader_cache_checks_context_and_blob_bytes, shader_cache_evicts_old_entries_and_skips_oversized_shaders, shader_cache_coalesces_concurrent_same_key_compiles}` as separate fully qualified arguments. The before-fix control selects only the first test. Literal commands, patch hashes and logs are retained locally. **Regression run** Pending. No smoke block or gameplay result is claimed. Kept draft until current-head required validation is complete. **Not tested** - Full workspace suite on this PR head; paired clean-head main/PR retail smoke; AMD/Intel GPU behavior. - Gameplay RAM savings or resolution of the missing-world symptom. Synthetic cache accounting does not establish either. **AI use** - Codex (GPT-6) reviewed upstream provenance/overlap, ported the existing change, ran and checked the local controls, and prepared this PR. Original fix attribution is preserved above. Optional temporary Discord for coordinating contributor work, helping test and comparing results: https://discord.gg/6B4TykyC4W
JJAutoCompare commented 2026-11-28 07:14:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T07:14:09Z.


Tested

Exact a161e6645c892f5cd2d12974a2de28e9d3cb496f on native Windows 11 x64 build 26200.9974, Ryzen 7 3800X, and Rust 1.100.1 MSVC debug. I reran the pinned libtest built from a verified Git archive with one private CPU fixture inserted in pso.rs. All 386 original files matched the commit's Git blobs when the fixture was excluded.

I ran <libtest.exe> <filter> --exact --nocapture --test-threads=1 separately for both filters under gpu::recomp::pso::shader_cache_tests.

  • shader_cache_evicts_oldest_split_and_retains_ordinary_entries charged 264 bytes for the split entry, including 166 bytes of dispatch-piece capacity. The split entry and a 98-byte ordinary entry filled the 362-byte budget. Inserting a second ordinary entry at 99 bytes evicted only the oldest split entry. The two ordinary entries remained retrievable and accounted for 197 bytes. Draining the cache returned the charge to zero.
  • The stock control shader_cache_charges_split_piece_capacity_on_insert confirmed the oversized split entry was not admitted.

2 passed, 0 failed, 0 ignored, 0 runtime skips. Both native processes exited 0, with 1,807 tests filtered out per invocation.

Not tested

GPU execution, actual driver-cache behavior, pre-fix failure reproduction, benchmarks, retail smoke, and the full suite.

AI use

T3 Code through the Codex harness (gpt-6.2-sol) verified the source and executable, ran the CPU tests, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7235803762 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3103#issuecomment-7235803762). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-28T07:14:09Z. --- **Tested** Exact `a161e6645c892f5cd2d12974a2de28e9d3cb496f` on native Windows 11 x64 build 26200.9974, Ryzen 7 3800X, and Rust 1.100.1 MSVC debug. I reran the pinned libtest built from a verified Git archive with one private CPU fixture inserted in `pso.rs`. All 386 original files matched the commit's Git blobs when the fixture was excluded. I ran `<libtest.exe> <filter> --exact --nocapture --test-threads=1` separately for both filters under `gpu::recomp::pso::shader_cache_tests`. - `shader_cache_evicts_oldest_split_and_retains_ordinary_entries` charged 264 bytes for the split entry, including 166 bytes of dispatch-piece capacity. The split entry and a 98-byte ordinary entry filled the 362-byte budget. Inserting a second ordinary entry at 99 bytes evicted only the oldest split entry. The two ordinary entries remained retrievable and accounted for 197 bytes. Draining the cache returned the charge to zero. - The stock control `shader_cache_charges_split_piece_capacity_on_insert` confirmed the oversized split entry was not admitted. **2 passed, 0 failed, 0 ignored, 0 runtime skips.** Both native processes exited 0, with 1,807 tests filtered out per invocation. **Not tested** GPU execution, actual driver-cache behavior, pre-fix failure reproduction, benchmarks, retail smoke, and the full suite. **AI use** T3 Code through the Codex harness (`gpt-6.2-sol`) verified the source and executable, ran the CPU tests, and wrote this report.
Aniseto commented 2026-11-28 08:44:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-28T08:44:12Z.


Ran the split-shader cache tests at a161e664 on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib shader_cache_tests -- --test-threads=1
26 passed; 0 failed; 0 ignored; 0 measured; 1781 filtered out      (exit 0)

All 26 tests matching shader_cache_tests pass, including shader_cache_charges_split_piece_capacity_on_insert. They are CPU-side cache-accounting tests; no shader was translated through the GPU here. The thread has one RTX 3060 Ti run and one Wine check, but no 5070 Ti.

Not tested: a retail title, a paired smoke run, the full workspace suite, release profile, AMD and Intel GPUs, native wave64 hosts, Wine, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

<!-- greyfinch-sync:ivall/xcl:comment:7236776320 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3103#issuecomment-7236776320). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-28T08:44:12Z. --- Ran the split-shader cache tests at `a161e664` on an NVIDIA Blackwell desktop part: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` XCL_ADAPTER=NVIDIA cargo test -p xcl --lib shader_cache_tests -- --test-threads=1 26 passed; 0 failed; 0 ignored; 0 measured; 1781 filtered out (exit 0) ``` All 26 tests matching `shader_cache_tests` pass, including `shader_cache_charges_split_piece_capacity_on_insert`. They are CPU-side cache-accounting tests; no shader was translated through the GPU here. The thread has one RTX 3060 Ti run and one Wine check, but no 5070 Ti. Not tested: a retail title, a paired smoke run, the full workspace suite, release profile, AMD and Intel GPUs, native wave64 hosts, Wine, game data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
andrewDoing commented 2026-11-28 20:53:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T20:53:25Z.


After #3203 integrated the NVIDIA branch, this PR now targets main. On main beeb81be, RAM admission and eviction both sum split-piece capacities; the shader_cache_charges_split_piece_capacity_on_insert test is identical to this PR's. The NVIDIA-only port appears superseded on its current base.

I also checked the boundary on Windows/Ryzen 7 5700X3D with the actual synthetic split input from #3213 (shader key fe8d45ddc5a9a563). A test-only harness translated it, round-tripped the production serialized record through disk, and offered the loaded shader to the production RAM cache. Its whole DXIL occupied 2,372 bytes and the four pieces occupied 9,276 bytes. The full charge was 12,034 bytes for this run, including the source blob and cache key path. At a 12,033-byte limit the entry was absent and the charge remained zero. At 12,034 it was retrievable and charged exactly that amount. The 11,720-byte serialized file remained unchanged in both cases. One test passed with zero skips. Physical VRAM and retail operation were outside this check.

AI assistance: OpenAI Codex (GPT-6) compared the two revisions, ran the CPU/disk boundary test, and wrote this note.

<!-- greyfinch-sync:ivall/xcl:comment:7245617766 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3103#issuecomment-7245617766). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-28T20:53:25Z. --- After #3203 integrated the NVIDIA branch, this PR now targets `main`. On `main` `beeb81be`, RAM admission and eviction both sum split-piece capacities; the `shader_cache_charges_split_piece_capacity_on_insert` test is identical to this PR's. The NVIDIA-only port appears superseded on its current base. I also checked the boundary on Windows/Ryzen 7 5700X3D with the actual synthetic split input from #3213 (shader key `fe8d45ddc5a9a563`). A test-only harness translated it, round-tripped the production serialized record through disk, and offered the loaded shader to the production RAM cache. Its whole DXIL occupied 2,372 bytes and the four pieces occupied 9,276 bytes. The full charge was 12,034 bytes for this run, including the source blob and cache key path. At a 12,033-byte limit the entry was absent and the charge remained zero. At 12,034 it was retrievable and charged exactly that amount. The 11,720-byte serialized file remained unchanged in both cases. One test passed with zero skips. Physical VRAM and retail operation were outside this check. AI assistance: OpenAI Codex (GPT-6) compared the two revisions, ran the CPU/disk boundary test, and wrote this note.
vasanex commented 2026-11-29 04:23:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vasanex on 2026-11-29T04:23:20Z.


merge-check
base: fa204595a488c60c6c5f905244f0172072c9c2a9
head: a161e6645c892f5cd2d12974a2de28e9d3cb496f
merge: clean
build: cargo build --workspace -> ok
tests: nothing to test: the merged tree is identical to the base
review: `git merge-tree fa204595 a161e664` gives tree e79c9fb4 and `git diff fa204595 e79c9fb4` is empty: the admission line and the test are already on main (f2cb30f8, came in with the nvidia-dev merge #3203). #1607 lists it with #2475 (D157).
performance: none (no change)
verdict: not yet: superseded - merging it changes nothing; close it
hardware / tool and model: RTX 3080 10 GB 621.40, Ryzen 9 7950X, Windows 11 26200 / Claude Code (Claude Opus 5.5, Claude Fable 5.2)

Checked with git only (plus a build of the merged tree); RTX 3080 / Windows 11.

AI use: Claude Code (Claude Opus 5.5 and Claude Fable 5.2) ran the builds, tests and title runs, reviewed the diff and wrote this; the code points cited were checked against the merged tree.

<!-- greyfinch-sync:ivall/xcl:comment:7250622229 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3103#issuecomment-7250622229). Originally posted by [vasanex](https://github.com/vasanex) on 2026-11-29T04:23:20Z. --- ```text merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: a161e6645c892f5cd2d12974a2de28e9d3cb496f merge: clean build: cargo build --workspace -> ok tests: nothing to test: the merged tree is identical to the base review: `git merge-tree fa204595 a161e664` gives tree e79c9fb4 and `git diff fa204595 e79c9fb4` is empty: the admission line and the test are already on main (f2cb30f8, came in with the nvidia-dev merge #3203). #1607 lists it with #2475 (D157). performance: none (no change) verdict: not yet: superseded - merging it changes nothing; close it hardware / tool and model: RTX 3080 10 GB 621.40, Ryzen 9 7950X, Windows 11 26200 / Claude Code (Claude Opus 5.5, Claude Fable 5.2) ``` Checked with git only (plus a build of the merged tree); RTX 3080 / Windows 11. AI use: Claude Code (Claude Opus 5.5 and Claude Fable 5.2) ran the builds, tests and title runs, reviewed the diff and wrote this; the code points cited were checked against the merged tree.
bmjask commented 2026-11-29 22:44:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:44:22Z.

Review: COMMENTED


Critical review of current head a161e664. This main-targeted PR appears redundant now. Current main already includes shader.dispatch_chain piece capacity in the admission byte calculation and in ShaderEntry::bytes, which is the same accounting repair in this diff. Please compare the PR against current main and close it if it adds no distinct behavior, or retarget/document an actual remaining gap. The added regression is useful, but merging an obsolete port can create churn and obscure which fix owns the cache budget. I checked current main's pso.rs source; no local Windows run.

<!-- greyfinch-sync:ivall/xcl:review:6105194495 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3103#pullrequestreview-6105194495). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T22:44:22Z. **Review:** COMMENTED --- Critical review of current head `a161e664`. **This main-targeted PR appears redundant now.** Current `main` already includes `shader.dispatch_chain` piece capacity in the admission byte calculation and in `ShaderEntry::bytes`, which is the same accounting repair in this diff. Please compare the PR against current main and close it if it adds no distinct behavior, or retarget/document an actual remaining gap. The added regression is useful, but merging an obsolete port can create churn and obscure which fix owns the cache budget. I checked current main's `pso.rs` source; no local Windows run.
throny commented 2026-11-30 19:54:19 +00:00 (Migrated from github.com)

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


Closing as a duplicate of #2959: its change is already on main through #2959: this PR's diff applies in reverse cleanly on main, so the capacity charge and the test are already there. I compared the diffs against current main (ff0c364b). If I got this wrong (something here is not in #2959), say so and reopen it, or ask and I will.

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

<!-- greyfinch-sync:ivall/xcl:comment:7290112238 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3103#issuecomment-7290112238). Originally posted by [throny](https://github.com/throny) on 2026-11-30T19:54:19Z. --- Closing as a duplicate of #2959: its change is already on `main` through #2959: this PR's diff applies in reverse cleanly on `main`, so the capacity charge and the test are already there. I compared the diffs against current `main` (`ff0c364b`). If I got this wrong (something here is not in #2959), say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5) checked the pair and wrote this; part of the duplicate sweep announced 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!3103
No description provided.