Shader store: KYTY_SHADER_CACHE_STAMP=N keeps the cache across rebuilds #2178

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

@⁠ew-sudo on GitHub · 2026-11-08 14:24 UTC · original
ew-sudo:pr-shader-cache-stamp → main · +10 −0 · 1 files · 1 commits · open

The shader store is keyed on the executable's build time, so every rebuild discards the whole
cache. For Gran Turismo 7 that is 250 to 700 MB, and minutes of compile hitches to rebuild it.

KYTY_SHADER_CACHE_STAMP=N replaces the build time with N: a rebuild that does not change how
shaders are translated keeps the cache. N must change whenever the shader recompiler changes.
Unset, nothing changes.

Independent of the other open PRs. A change to the store's record layout (such as the pipeline keys
of the dynamic export mapping PR) should still bump the store header itself, so a kept stamp never
reads old records.

Testing

Gran Turismo 7 (PPSA01317), RTX 4070 Laptop: the cache (about 4,400 programs, 250 MB) survives
rebuilds of unrelated code and loads in about 9 s instead of being rebuilt.

**@⁠ew-sudo** on GitHub · 2026-11-08 14:24 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2178) `ew-sudo:pr-shader-cache-stamp` → `main` · +10 −0 · 1 files · 1 commits · open The shader store is keyed on the executable's build time, so every rebuild discards the whole cache. For Gran Turismo 7 that is 250 to 700 MB, and minutes of compile hitches to rebuild it. `KYTY_SHADER_CACHE_STAMP=N` replaces the build time with N: a rebuild that does not change how shaders are translated keeps the cache. N must change whenever the shader recompiler changes. Unset, nothing changes. Independent of the other open PRs. A change to the store's record layout (such as the pipeline keys of the dynamic export mapping PR) should still bump the store header itself, so a kept stamp never reads old records. ### Testing Gran Turismo 7 (PPSA01317), RTX 4070 Laptop: the cache (about 4,400 programs, 250 MB) survives rebuilds of unrelated code and loads in about 9 s instead of being rebuilt.
The shader store is keyed on the executable's build time, so every rebuild
throws the whole cache away (Gran Turismo 7: ~700 MB, minutes of compile
hitches to rebuild it). KYTY_SHADER_CACHE_STAMP=N replaces that time with N:
a rebuild that does not change how shaders are translated keeps the cache.
N must be changed whenever the shader recompiler changes. Unset, nothing
changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CM9KLt5uNWomVHfHUhCLFz
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:16:29 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-08 14:28 UTC · original

Explain Change →

Walkthrough

BuildStamp now checks KYTY_SHADER_CACHE_STAMP before checking the executable’s modification time. It returns the environment value when it is nonempty and parses to a nonzero unsigned integer. Otherwise, it uses the existing platform-specific timestamp lookup, which returns zero if the lookup fails.

Suggested reviewers: nmzik, thecruz

Change: Feature

Merge Risk: Low · up to 52f71

Invalid cache stamps can silently reuse old shaders after a recompiler change. Validate stamps before relying on the override.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the change accurately: an environment variable, KYTY_SHADER_CACHE_STAMP=N, that lets the shader store keep its cache across rebuilds. The raw summary confirms BuildStamp now honors thi…
Description check Passed The description matches the changeset. It explains that the shader store is keyed on the executable's build time, that KYTY_SHADER_CACHE_STAMP=N replaces that build time with N, and that unset behavio…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change accurately: an environment variable, KYTY_SHADER_CACHE_STAMP=N, that lets the shader store keep its cache across rebuilds. The raw summary confirms BuildStamp now honors this variable when it is set to a nonzero unsigned integer. The title is specific and matches the main change. It uses a colon-separated form with the variable name, which is clear to a teammate reading history.

Full details: Description check

Explanation

The description matches the changeset. It explains that the shader store is keyed on the executable's build time, that KYTY_SHADER_CACHE_STAMP=N replaces that build time with N, and that unset behavior is unchanged. This aligns with the BuildStamp change in pipelineSerialization.cpp. It also gives a testing note and a caveat about bumping the store header when record layout changes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

**@⁠coderabbitai[bot]** on GitHub · 2026-11-08 14:28 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2178#issuecomment-6722711171) <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/2178?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> `BuildStamp` now checks `KYTY_SHADER_CACHE_STAMP` before checking the executable’s modification time. It returns the environment value when it is nonempty and parses to a nonzero unsigned integer. Otherwise, it uses the existing platform-specific timestamp lookup, which returns zero if the lookup fails. **Suggested reviewers:** `nmzik`, `thecruz` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"52f71aa1d799d5cbf126120bf79267ec6ec167a9" --> <!-- change_assessment_priority:{"version":1,"urgency":"p3","manual":false} --> **Change:** Feature <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong> · up to <code>52f71</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🔵 Low** · up to `52f71` --> <!-- final_review_risk_coverage:{"sourceCommitId":"52f71aa1d799d5cbf126120bf79267ec6ec167a9","coveredCommitId":"52f71aa1d799d5cbf126120bf79267ec6ec167a9","kind":"reviewed"} --> Invalid cache stamps can silently reuse old shaders after a recompiler change. Validate stamps before relying on the override. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 5</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the change accurately: an environment variable, KYTY_SHADER_CACHE_STAMP=N, that lets the shader store keep its cache across rebuilds. The raw summary confirms BuildStamp now honors thi… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description matches the changeset. It explains that the shader store is keyed on the executable's build time, that KYTY_SHADER_CACHE_STAMP=N replaces that build time with N, and that unset behavio… | | Docstring Coverage | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the change accurately: an environment variable, KYTY_SHADER_CACHE_STAMP=N, that lets the shader store keep its cache across rebuilds. The raw summary confirms BuildStamp now honors this variable when it is set to a nonzero unsigned integer. The title is specific and matches the main change. It uses a colon-separated form with the variable name, which is clear to a teammate reading history. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description matches the changeset. It explains that the shader store is keyed on the executable's build time, that KYTY_SHADER_CACHE_STAMP=N replaces that build time with N, and that unset behavior is unchanged. This aligns with the BuildStamp change in pipelineSerialization.cpp. It also gives a testing note and a caveat about bumping the store header when record layout changes. </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> <br> **Explanation** Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- announcements_start --> > [!TIP] > <details> > <summary><strong>🎯 Customize your risk assessments</strong></summary> > <dl> > <dd> > <br> > > Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using **Merge Risk Instructions** and **Security Risk Instructions** in your review settings. Security architecture risk assessments require the **Advanced plan or above**. > > </dd> > </dl> > </details> > > <details> > <summary><strong>✅ Automatic approvals, with your rules</strong></summary> > <dl> > <dd> > <br> > > Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable **Automatic approvals** in review settings, with overrides for teams or file paths. > > </dd> > </dl> > </details> <!-- announcements_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2178)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end -->
@ -47,0 +49,4 @@
// shaders are translated keeps the cache. Change N whenever the shader recompiler changes
// (a main update, a shader patch), or the stored programs no longer match the code.
if (const char* env = std::getenv("KYTY_SHADER_CACHE_STAMP"); env != nullptr && env[0] != 0) {
const auto value = std::strtoull(env, nullptr, 10);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-08 14:28 UTC · original

Minor · Data Integrity & Integration · Quick win

Reject stamps that are not complete unsigned decimal numbers.

If an operator changes KYTY_SHADER_CACHE_STAMP from 7a to 7b after a recompiler change, std::strtoull returns 7 for both values. StoreHeader then matches the old header, and WarmUp reuses stale shader records. Negative values and overflowing decimals can also return nonzero values. Accept the override only after checking that conversion consumed the entire value without overflow or a sign; otherwise use the timestamp fallback. (man7.org)

**@⁠coderabbitai[bot]** on GitHub · 2026-11-08 14:28 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2178#discussion_r4506554906) <!-- coderabbit-ai-generated:v1 --> **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/amber-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minor** · **Data Integrity & Integration** · **Quick win** **Reject stamps that are not complete unsigned decimal numbers.** If an operator changes `KYTY_SHADER_CACHE_STAMP` from `7a` to `7b` after a recompiler change, `std::strtoull` returns `7` for both values. `StoreHeader` then matches the old header, and `WarmUp` reuses stale shader records. Negative values and overflowing decimals can also return nonzero values. Accept the override only after checking that conversion consumed the entire value without overflow or a sign; otherwise use the timestamp fallback. ([man7.org](https://man7.org/linux/man-pages/man3/strtoul.3.html?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:b0060977132d6ca4086b4126 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-08 14:28 UTC · original · reviewed

Actionable comments posted: 1

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8dbee86359 and 52f71aa1d7.

Files selected for processing: 1

  • src/graphics/host_gpu/renderer/pipeline/pipelineSerialization.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-08 14:28 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2178#pullrequestreview-5818256189) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 1** <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/8dbee8635990788cf7f5ebc5aedaf5511caf47c5/.coderabbit.yaml>) - **Commit**: [8dbee86](<https://github.com/KytyPS5/KytyPS5/commit/8dbee8635990788cf7f5ebc5aedaf5511caf47c5>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `3b237d59-69f2-4c87-8945-81b6cd0494f3` </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 8dbee8635990788cf7f5ebc5aedaf5511caf47c5 and 52f71aa1d799d5cbf126120bf79267ec6ec167a9. </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 1</summary> <dl> <dd> <br> * `src/graphics/host_gpu/renderer/pipeline/pipelineSerialization.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=139b2a9f-df0a-4aec-b46f-142e872f8700 attempt=47c5ef38-3bf2-4f65-af78-0f299b8e0586 batch=1/1 -->
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/2178/head:github-bot/gh-2178'
git switch 'github-bot/gh-2178'

Merge

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