Repository navigation
fix(shader): share resource plans loaded from the same disk cache payload - #10496
Merged
adriadam10 merged 1 commit intoOct 24, 2026
Merged
Conversation
…load A shader source loading its resource plan from the disk cache decoded its own copy, also when another source had already loaded the same plan: the same code registered under another plan key (another host subgroup size or interface) stores byte-identical plan entries. In Ghost of Tsushima's cache, 14,043 plan entries hold 8,170 distinct payloads. Loaded plans now go through a table of weak references keyed by two hashes of the payload, its size and the shader address the plan carries, so equal payloads for one shader decode once and share the plan, its compact form and its compiled SRT tape while any source uses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
Collaborator
|
Checked |
12 tasks done
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A shader source whose resource plan comes from the disk cache decodes its own copy of it (
getSource→ShaderDiskCache::LoadPlan), including when another source has already decoded the same plan. The same code registered under another plan key (another host subgroup size or interface) stores byte-identical plan entries, so a warm run holds the same decoded plan, its compact form and its compiled SRT tape several times.DecodePlanandbuildCompactPlanhold about 720 MiB of live memory. The title is killed by its 20 GB memory cap in its opening.How
LoadSharedPlan(key, shaderHash)replaces the load ingetSource. A loaded payload is looked up in a table of weak references, keyed by twoHashBytesof the payload (two seeds), its size and the shader address the plan is given. An equal entry that a source still uses is returned as is. Otherwise the payload is decoded, given the address and published. The table only refers to plans and never keeps one alive; expired slots are dropped every 1,024 inserts.IrResourcePlanisconstonce loaded (source->plan), and its SRT tape is compiled from its content, so sources sharing a plan share the tape too.Tested
Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, NVIDIA 615.71.09. The commit was tested as
a428c3ab4fonmain379b1dc and is unchanged (git range-diff) on the current head38ac888dbb, rebased ontomain6c52b64.verifySharedPlansinagc_shader_disk_cache. It writes one plan's entry under two keys, then checks that loading both for one shader address gives the same plan, equal to a fresh decode of the payload with that address. Another address gets its own plan. Once both references are dropped, the plan is released, and a later load decodes it again.test/planshare-mut), it fails 3 of 3:two plan entries with the same payload for one shader decoded into separate plans.^agc_shader_disk_cache|^agc_shader_memory$|^agc_shader_|resource_plan|^agc_driver_graphics$pass 3 of 3 onmain379b1dc and ona428c3ab4f.^agc_shader_disk_cache|^agc_shader_memory$|^request_serializer$pass 3 of 3 onmainat the merge base and ona428c3ab4f.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1on the 5 tests matching^agc_shader_disk_cache$|^agc_shader_memory$|^agc_driver_graphics$|^agc_driver_pipeline_journal$|^request_serializer$: 5 of 5 onmain379b1dc and ona428c3ab4f. Neither log reports the layer missing, and neither has a VUID.RssAnonat 2 / 4 / 6 / 8 / 10 / 12 min was 3,756 / 4,497 / 5,720 / 6,929 / 7,067 / 6,821 MB against 3,964 / 4,413 / 5,351 / 6,351 / 6,843 / 7,464 MB. That is within this title's run-to-run spread, which other runs show at over 1 GB in its opening, so this title doesn't resolve the saving. The disk cache duplication above is the direct measure.Not checked by me: AMD, Intel, macOS.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code