Shader store: KYTY_SHADER_CACHE_STAMP=N keeps the cache across rebuilds #2178
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2178
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2178"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ew-sudo on GitHub · 2026-11-08 14:24 UTC · original
ew-sudo:pr-shader-cache-stamp→main· +10 −0 · 1 files · 1 commits · openThe 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=Nreplaces the build time with N: a rebuild that does not change howshaders 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.
@coderabbitai[bot] on GitHub · 2026-11-08 14:28 UTC · original
Walkthrough
BuildStampnow checksKYTY_SHADER_CACHE_STAMPbefore 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,thecruzChange: Feature
Merge Risk:
Low · up to
52f71Invalid cache stamps can silently reuse old shaders after a recompiler change. Validate stamps before relying on the override.
Pre-merge checks:
5
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.
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
@ -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);@coderabbitai[bot] on GitHub · 2026-11-08 14:28 UTC · original
Reject stamps that are not complete unsigned decimal numbers.
If an operator changes
KYTY_SHADER_CACHE_STAMPfrom7ato7bafter a recompiler change,std::strtoullreturns7for both values.StoreHeaderthen matches the old header, andWarmUpreuses 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 · reviewed
Actionable comments posted: 1
3b237d59-69f2-4c87-8945-81b6cd0494f3Reviewing files that changed from the base of the PR and between
8dbee86359and52f71aa1d7.src/graphics/host_gpu/renderer/pipeline/pipelineSerialization.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.