perf(agc): size the pipeline store to the title's working set #9401
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9401"
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?
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-21T20:47:54Z.
What
The graphics pipeline store kept a fixed bound of 1024 entries, and the pipeline journal replayed only its first 1024 records. On top of that, the replay skipped every record once the store was full. A title with more pipelines than that rebuilt the rest at the draw, under the GPU mutex. Each rebuild costs about 200 ms in GTA V and shows as a freeze.
APS5_PIPELINE_JOURNAL_ENTRIESstill sets the limit). A replayed pipeline that finds the store full doubles the bound instead of being skipped, up to 4096.PipelineStoreCanGrow()tells the replay whether the store can still grow, and the replay skips only when it cannot.APS5_PIPELINE_STORE_ENTRIESstill fixes the bound, and then nothing changes it.Overlap: #8542 also touches the journal entry bound in
PipelineJournal.cpp(one line here) and itsENVIRONMENT.mdrow, to count compute entries apart. The two compose. I proposed on #8542 that it goes first; I would then rebase this onto it and keep its per-kind counting, so only the graphics default changes. #9440 and #9835 (newest journal entries) are closed.Tested
Windows 11 26200, RTX 4090 (NVIDIA 616.92), i9-13900K, WinLibs GCC 15.2.0 r7, Release.
Unit tests (
agc_driver_graphics_tests, mock Vulkan), onmain3bbd2321d:agc_pipeline_store_growthcycles 1536 configurations six times. Onmainevery pass rebuilds all 1536 (the bound did not grow to 2048 while evicted pipelines kept coming back). With the change the bound reaches 2048 and the last pass builds nothing.agc_pipeline_store_fixed_bound: the same run withAPS5_PIPELINE_STORE_ENTRIES=1024keeps the bound and rebuilds every pass. It passes on both.agc_pipeline_store_replay_growthrecords 1032 pipelines, clears the store and replays the journal.mainkeeps 1024 (a replay of 1032 recorded pipelines kept 1024 in the store (bound 1024)). With the change all 1032 stay. It is excluded from the suite-wideAPS5_NO_PIPELINE_JOURNAL=1, like the other journal tests.agc_pipeline*tests pass, also withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1(no validation message).ad047899b(rebased onmainc8d34aa8f): the store and journal tests 7/7, theagc_pipeline_(cache|library|store|journal)set under the validation layer 14/14 with noVUID-message.^agcwith the same switches, same machine:main896 of 899 pass, this PR 899 of 902. The three failures are the same on both (agc_driver_sample_order,agc_driver_sample_order_grid_reference,agc_driver_sample_order_recipe_depth_locations). The three extra tests are this PR's.GTA V (PPSA04264), open world, resumed save, about seven minutes per run, on current
main3bbd2321d. The base ismainplus three fixes this title needs today: #9730 (sceVoiceSetThreadsParamsmode 1), and #9181 and #9159 (#9136, without them the open world crashes). The change is the same tree plus this PR. Counts come from warm runs withAPS5_PROFILE_DRAW=1. Builds in play are[pipecache]misses minus the pipelines the replay built:The 65 builds left on the PR row are pipelines no earlier run had recorded. Each run respawns in a slightly different place, and the journal grew from 914 to 1512 records over this session's runs. The journal keeps the new ones, so the next run replays them.
An earlier series on
main663de1ab2gave the same picture: base 80 and 153 builds in play with a full store, this PR 42 with no eviction.The frame summaries below are one 60 s window each, from separate runs without
APS5_PROFILE_DRAW. Frame times follow where the save spawns (2 to 11 FPS within a run), so the table above is the number to compare. In these two windows the longest frame went from 906 ms to 337 ms.Summary lines from the earlier head (cap 16384), base then this PR (same session, traces on the fork release perf-pipeline-store-20261022):
Memory (review of 2026-10-23). Head
ad047899b, rebased onmainc8d34aa8f.agc_driver_recorder_tests --benchmark-pipeline-store-memory 4096(opt-in, not in ctest) builds 4096 graphics pipelines throughCachedPipeline, each with its own fragment module, holds them, and reads process private bytes andVK_EXT_memory_budgetheap usage before and after. With the triangle test shaders this is a floor: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
https://claude.ai/code/session_017SNUYRd7sRKZrMYpquAsnU
Imported from boykopovar/AnyPS5. Originally posted by 00xDisaster on 2026-10-22T00:07:52Z.
Overlap note: #9440 changes the same bound line in
PipelineJournal.cpp— it keeps the last entries of the journal instead of the first, so the pipelines a title built last are the ones the replay builds, and it rewrites the file when it reachesAPS5_PIPELINE_JOURNAL_MAX_MIBinstead of refusing the record (it also touches the two bound rows ofdocs/dev/ENVIRONMENT.mdand the journal's debt entry).The changes compose: the bound and the store growth of this PR apply to the entries #9440 keeps. I will rebase onto whichever lands first.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T05:39:22Z.
Review: DISMISSED
The mock tests cover both automatic growth and the fixed-bound setting, and the GTA V measurements report a meaningful reduction in builds during play. The PR includes same-scene summaries and trace artifacts;
git diff --checkpasses and the current head merges cleanly withmain.I’m requesting changes for the remaining repository requirements:
663de1ab2plus additional fixes, while currentmainis4a17c71757(the branch is 425 commits behind). Please rebase onto currentmainand rerun the focused pipeline-store tests and required paired AGC validation on the same machine/GPU withVK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1, andANYPS5_REQUIRE_VULKAN=1. Refresh the performance comparison against current main so its summaries/traces describe the branch being proposed.PipelineJournal.cppbound line, and #9440 also changes that bound while retaining a different subset of journal entries. The checklist currently saysDepends on: none, while the body says you will rebase whichever lands first. Please agree with both authors on merge order and record the applicable prerequisite(s) on the checklist. The current overlap scan also finds shared documentation/test-registration lines; recheck those after rebasing and coordinate any actual same-line overlap.No local AGC test or GPU run was possible in this review environment. Hosted eligibility, conventions, intake, labels, and report checks pass; product build/test jobs are skipped. The older-base test and performance results are useful but need a current-main refresh before merge.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T20:59:05Z.
Review: CHANGES_REQUESTED
Thanks, the bound/eviction logic reads correctly and the new tests pin values that
maindoes not produce. One thing blocks this:Pipeline.cppPipelineStore::MaximumEntries,PipelineJournal.cpp:927). The store can now hold up to 16384 live Vulkan pipelines, and a journal replay builds up to 16384 of them at start-up whether or not the title draws them again; nothing frees them untilClearCachedPipelineson the device. Please add to the PR: peak RSS (and driver/VRAM memory if you can read it) before and after on the GTA V scene, for a run replaying a large journal, and say what frees the entries during a run. If the cost is real, scope the replay (e.g. replay only up to what the previous run kept resident) or state the cap you settle on.Everything else checked (docs, env table, debt entry, ctest registration, Conventions green). Overlap with #8542 on the journal-entries line is yours to sequence as you proposed.