pipeline cache: version the driver cache file by format, not git revision #982
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!982
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/982/head"
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?
@wuboo on GitHub · 2026-10-02 19:24 UTC · original
wuboo:pr/pipeline-cache-format→main· +8 −14 · 1 files · 1 commits · closed without mergingProblem
The driver pipeline cache file (
_PipelineCache/<title>.bin) is keyed byKYTY_GIT_REVISION. Any new build, including one that does not touch the renderer, discards the whole cache, and the next start recompiles every pipeline. Builds with an unknown revision or a dirty tree have the cache disabled entirely, so local development builds never get a warm cache.On macOS/MoltenVK with Astro Bot this costs about 16 s of pipeline compilation (275 pipelines) in the first minutes of the game after every rebuild. Much of that shows up as hitches.
Change
kPipelineCacheFormatplus the driver identity it already had (vendor, device, driver version,pipelineCacheUUID) instead of the git revision. The prefix becomesKytyPC2, so existing files are invalidated once.This is safe because the payload is the driver's own
vkGetPipelineCacheDatablob. The driver validates its header and keys entries by pipeline content (SPIR-V and state), so pipelines whose shaders or state changed simply miss and get compiled. The file holds nothing emulator-specific besides the signature and payload hash. If the emulator-side layout of the file ever changes, bumpkPipelineCacheFormat.Trade-off: entries for shaders that no longer exist are kept until the format is bumped or the driver identity changes, so the file can grow across many builds.
Testing
Vulkan pipeline cache: loaded 60931195 bytes). Pipeline compile time in a short Astro Bot run dropped to 0.11 s, from about 16 s with the revision key.@coderabbitai[bot] on GitHub · 2026-10-02 19:31 UTC · original · edited 2026-10-02 19:43 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
80839596-1b81-4b40-ad16-c07ad3c5ce78📥 Commits
Reviewing files that changed from the base of the PR and between
e317465d8aand cadf1a3d33678f40419640e2d75fa95fe7f32baa.📒 Files selected for processing (1)
src/graphics/host_gpu/renderer/pipeline/pipelineCache.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Walkthrough
The pipeline cache format is now version 2. Its signature uses the format version and physical-device identifiers instead of the emulator Git revision. Git-version checks that disabled cache initialization were removed. The invalidation message now refers to driver, format, or data mismatches.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
cadf1Different Release builds can now reuse the versioned driver cache; incompatible data should reduce to cache misses, with possible cache growth. No actionable merge-blocking risk is established.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
cadf1The change preserves device matching, corruption checks, and empty-cache recovery. No exploitable regression was established, but trusting stored cache files and reusing them across builds still depend on the launch environment and driver behavior.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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
Comment
@coderabbitai helpto get the list of available commands.@Nmzik on GitHub · 2026-10-03 13:25 UTC · original
@wuboo the problem is that we now need to bump kPipelineCacheFormat each time renderer/shader recompiler changes "manually". That was the point of NOT doing it in first place
@wuboo on GitHub · 2026-10-03 13:55 UTC · original
Thanks for looking at this. I don't think a manual bump is needed when the renderer or recompiler changes. Here is why, so you can tell me if I'm missing a case:
vkGetPipelineCacheDatablob. The driver, and MoltenVK on macOS, key every entry by the full pipeline create info: the SPIR-V itself plus all state.kPipelineCacheFormatonly needs a bump if our wrapper around the blob changes (the header or signature layout), which should be rare.What the change gives up is pruning: entries for pipelines that no longer exist stay in the file until the driver identity or the format changes.
If you would rather keep automatic invalidation, a middle ground is to key the file by a hash of the renderer and recompiler sources, computed at build time, instead of the git revision. #988 already does this for the recompiler cache (
KYTY_RECOMPILER_SIGNATURE). The cache would then survive commits that don't touch those sources (docs, CI, HLE, loader…) and still reset on any renderer or recompiler change, with nothing to bump by hand. I can switch this PR to that if you prefer.@Nmzik on GitHub · 2026-10-08 14:46 UTC · original
Lets leave it as it is. With this change users need to manually delete their caches in future full precompilation
Pull request closed