Repository navigation
fix(agc): keep hundreds of raw shader snapshots cached - #10174
Conversation
ReadRawShader evicted snapshots past 64 entries or 8 MiB. A snapshot owns its prepared artifacts, so an evicted unregistered shader was recompiled on its next use. PS4 titles do not register their shaders: Knowledge is Power cycles through 383 of them in its menus and recompiled them 341 136 times in 240 s. Raise the limit to 4096 entries or 64 MiB. 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.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head e284395f586dda6808250210cb225aef4df8021e. The snapshot list is refreshed on equal-content hits, so the raised limits preserve the existing LRU behavior; the updated test checks both retention through 401 programs and eviction after crossing 4096. The author also reports controlled before/after Windows GPU runs and that the new test fails when the old 64-entry limit is restored. Eligibility, conventions, intake, labels and report pass, while hosted product jobs are skipped by path policy. I commented separately on #10103 because its 80-entry churn will no longer force eviction after this limit change; that is a coverage interaction for the stacked change, not a correctness blocker in this PR.
|
Measured on Knowledge is Power: Decades (CUSA12435) as well, the title of #9718. Two builds on today's
These are profile-log numbers from a local stack, not a 🤖 Generated with Claude Code |
What
ReadRawShadercaches snapshots of unregistered shader programs and evicts the least recently used one past 64 entries or 8 MiB. Each snapshot owns its prepared artifacts (snapshot.prepared), so an evicted program loses them, and its next use reads a new snapshot and prepares it again (was not registered; preparing its artifact at first use).PS4 titles never register their shaders, so every program they draw with goes through this cache. Knowledge is Power (CUSA09558) uses 383 programs in its menus: with 64 entries the cache cycled through all of them and prepared them 341 136 times in a 240 s run, about 890 per program.
This raises the limit to 4096 entries or 64 MiB. The existing eviction check in
tests/Submit.cppnow reads 400 more programs and requires the first one to keep its snapshot, then reads past 4096 and requires it to be evicted. The new check fails with the old limit.Related open PRs, neither of which changes the limit:
ReadRawShader's range check and memoizes user-data callee links. It merges cleanly with this branch.Tested
Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 2080, driver 617.14.
agc_driver,agc_driver_readonly_resummarize,agc_driver_eop_interrupts,agc_driver_small_copy_synconmain(8eb8e39) and on this branch withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andctest -V: all pass on both, neither log reportswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither has anyVUID-error.agc_driverfails withraw shader cache evicted a program while a title used only 401.APS5_PAD_INPUT_FILEinto the menus, 240 s, with and without this change. It needs open PRs thatmaindoes not have yet (see Knowledge is Power: Decades (CUSA12435) #9718), so both runs used the same local stack and onlylibSceAgcDriver.prxdiffered:preparing its artifact at first use/dispatchlinesAPS5_PROFILE_GPU)These are profile-log numbers from that stack, not a performance trace of
main, so this is not aperfclaim. One of two runs with the change stopped presenting after about 30 s (no crash event, ended by the timeout); the repeat ran the full 240 s. I don't know the cause or whether the run without the change can do the same.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)