feat(agc): count why a template's collect was refused #11550
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11550"
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 johandavidcm on 2026-10-26T18:24:34Z.
What
A template's fast proof (
ShaderResources::fastRevalidate) leaves the object to the full walk whenGuestMemory::CollectWritesreturns 0 for one of its surfaces, which the[rescache]line counts as the fast-fail reasoncollect. In Yakuza 0 Director's Cut (PPSA31327) that reason sends 23,700 of 31,400 full walks per 10 s, and the revalidation total is 1,700 ms per 10 s of the draw committer, but the line says nothing about why the collect was refused, how many surfaces are behind it, or what the full walks that follow cost.CollectWritesreturns 0 only when the page walk fails: the range has pages that are not committed, or pages the arena compares instead of watching.With
APS5_PROFILE_DRAW=1, no behaviour change:GuestMemory::Accessibleis false), it is outside the write tracker (GuestMemory::Watchedis false), or neither (other); the distinct surfaces refused in the report window and their bytes are counted too (at most 65,536 distinct addresses are kept per window).[rescache] revalidateline gainsfull walk ms by reason: ...andcollect refusals: sampled N, storage M (uncommitted pages U, unwatched W, other O) over S surfaces, X MiB. Tests read the same counters throughShaderResources::CollectRefusalCounts()andShaderResources::FullWalkNanoseconds().Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON, head49eecbcc8onmainf1efa4ddc.New test
agc_driver_resource_cache_collect_refusals(tests/execution/SampledCacheBudget.cpp, modecollect-refusals): a sampled template and a storage-image template over a surface whose last page is reserved but not committed take the full walk; the counters must show two sampled refusals and one storage refusal, all three asuncommitted pages, one surface of the surface's bytes, and a non-zero full-walk time undercollect; a sampled template over a surface the test allocated outside the guest arena (VirtualAlloc) must count one more sampled refusal asunwatchedand a second surface; once the page is committed the proofs count no refusal.two collect refusals of a sampled surface were not counted.--repeat until-fail:20.Pass with the change (and on
main):agc_driver_resource_cache_storage_admission,agc_driver_resource_cache_oversized_storage_admission,agc_driver_resource_cache_storage_clear,agc_driver_resource_cache_replaced_texture,agc_driver_resource_cache_lookup_changed,agc_driver_resource_cache_growth,agc_driver_sampled_cache_budget,agc_driver_sampled_cache_budget_memory,agc_driver_sampled_cache_budget_without_storage_image_multisample,agc_driver_lookup_log_fits_build,agc_driver_partially_resident_snapshot,agc_driver_partially_resident_pending_stores,agc_driver_draw_cache_reuseand its_draw_pipeline,_entry_verify,_inline,_offand_verifyvariants,agc_driver_graphics.With
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(VK_LOADER_DEBUG=layershowing the layer inserted),ctest -R <those tests> -Vpasses onmainf1efa4ddc(19 of 19) and on this head (20 of 20, with the new test); both logs show the layer inserted, neither containswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither contains aVUID-line (0 onmain, 0 on the head).PPSA31327 01.015.000, gameplay in Kamurocho, scripted boot through the first dialogue, 1920x1080,
APS5_DRAW_PIPELINE=1 APS5_DRAW_INPUTS_IN_PLACE=1 APS5_PROFILE_DRAW=1, one run of 270 s onmainf616a1397+ #8098 (the title's audio fix) with this PR's driver (a reading of the counters, not a timing claim); means of the last 15[rescache]windows (steady gameplay, 49 presents and 403,000 draws per 10 s):So every refused collect in this title is a sampled surface that lies outside the write tracker: on Windows the tracker covers the whole arena span, so
unwatchedmeans the surface overlaps a host region, memory the title obtained outside the guest arena. About 500 draws per frame sample one of some 123 such surfaces, the fast proof cannot stamp them, and each of those draws repeats the lookups: 627 ms per 10 s, 6 % of the draw committer's time, with the sampled cache itself already keeping these snapshots by the write-watch hint ([textures]: 294,000 untracked snapshots kept by the hint, 100 compared, over the run). A follow-up can give the fast proof the same hint for untracked surfaces; this PR only makes the numbers visible.One steady window as printed
tools/check_conventions.py --base origin/mainpasses.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T18:49:28Z.
Review: APPROVED
Reviewed the profiling-only counters and the new focused test. Refusal classification follows
AccessiblethenWatched, sampled/storage paths are counted separately, full-walk timing is indexed by the triggering fast-fail reason, and the distinct-address table is mutex-protected and explicitly capped as described. The regression test checks uncommitted, unwatched, same-surface aggregation, elapsed full-walk time, and recovery after committing the missing page. I did not rerun the Windows/Vulkan tests locally; the author reports the focused test passes 20 repeats and 20 other focused tests pass with validation on both main and this head, with no VUIDs. Current required eligibility, conventions, labels, and report checks pass. Intake returned HTTP 502 from GitHub Search, not a limit decision; I independently checked the current author queue (4 open, 4 merged), within the repository’s 20-open allowance.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T18:51:56Z.
Review: CHANGES_REQUESTED
A new overlap report identifies two still-open PRs touching lines changed here: #9884 overlaps the sampled-cache test insertion, and #10894 overlaps
ShaderResources.hpp/ShaderResources.cpp. Both still declareDepends on: none.CONTRIBUTING.mdrequires the authors to agree on merge order for reported overlaps and record the dependency where one PR must land first. Please coordinate with those authors and update the order/dependency before this is merge-ready. The functional review above remains positive; my earlier approval is superseded until this repository requirement is resolved.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T08:41:58Z.
Review: CHANGES_REQUESTED
Read the diff: the counters are profile-only (
APS5_PROFILE_DRAW), the refused-surface table is bounded and locked, the full-walk time is indexed by the triggering fast-fail reason, andagc_driver_resource_cache_collect_refusalsis registered and reads counters that only exist with this change. No code changes needed from our side.