perf(agc): keep a reused image table's cache entries while nothing was erased #15659
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15659"
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 XatiX on 2026-11-04T00:48:25Z.
What
When an image table is reused (
FindReusedTable),CachedTableTexturesfirst proves that every kept element is still in the sampled texture cache, with onefindTexturehash lookup and one weak pointer lock per element. A table of about 14,000 entries repeats this on every draw that reuses it, even when nothing has left the cache since the previous reuse.The reused table now keeps the cache iterators it proved, together with the cache's
erasurescount at that time. While the count is unchanged, the next reuse takes those iterators instead of looking every element up again. A sampled cache entry leaves the cache only througheraseTexture, which bumpserasures, andstd::listiterators stay valid until their entry is erased, so the kept iterators still name the entries that were proved.findSampledEntryalready uses the same count for its memo. The entries are still touched and their textures returned as before.ImageTableReuseCountsreports the full lookups asentryLookups. Inagc_driver_image_table_reuse, three dispatches of one table in one epoch now expect exactly one full lookup for the two reuses. Onmainthis fails witha table reused twice while the texture cache dropped nothing looked its textures up again on the second reuse. The existing step for a kept table whose textures the cache dropped still covers the erasure path: with theerasurescheck removed, bothagc_driver_image_table_reusetests crash on stale iterators.Tested
ctest -V -R "table|texture|storage|sampled|bindless"withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1, on the same machine. The table, texture and storage execution tests were built. Each log starts with its tested revision and these variables, and the build settings are attached.d0cffb2567): 117/117 passed.ShaderResources.cppfrommain1c8c0efc8c, with the new test. 115/117 passed; onlyagc_driver_image_table_reuseandagc_driver_image_table_reuse_draw_pipelinefail, both at the new check.VUID-error. The same 4 tests skip in both (multisampled pass order and 3 packed16 storage formats). Logs attached.APS5_TRACE_SECONDS=20:60after a warm run, with no other trace or profile switch, and the log not redirected.maindoes not reach this screen on its own. Both builds carry #15327, the opt-in clock change (#15656), #15563, #15611, #15655 and a local change. The base is2e9401cb00, which is that stack with this commit reverted. The change is462334bc76, the same stack with it. Traces attached.Resources.Completeper frametools/check_conventions.pypasses.tools/pr_overlap.py --branchreports:ShaderResources.cppL2070-2076: the loop condition here iselement.rejected, and #15563 adds|| element.live. Whichever merges second keeps both.ShaderResources.hppL157, which adds an adjacent field. A merge keeps both.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)aps5-trace-2e9401cb0068-23068.json.gz
aps5-trace-462334bc769d-20744.json.gz
table-cache-entries-build-settings.txt
table-cache-entries-change-d0cffb2567-ctest.log
table-cache-entries-main-1c8c0efc8c-control-ctest.log
🤖 Generated with Claude Code
Pull request closed