perf(shader): reuse an unwritten image table snapshot read through a pointer #15655
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15655"
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:11:10Z.
What
An image table snapshot is remembered per column (
ColumnMemos). It is reused without reading the table again only when it carries a write stamp that the write watch still vouches for. Otherwise each capture reads and compares every record of the table. In two cases a column never got a usable stamp:column.address). Only base-addressed columns took a stamp before the compare.ShaderMemory::stampWritesrefused any range with a page the capture had fetched, because a write between that fetch and the collect would go unseen.Now:
pendingSpan, which the driver always does),stampWritestakes the stamp after the collect and then checks each page the capture already read: every valid word must still equal guest memory. A page read word by word, a page that differs, or a span with a pending GPU write still refuses the stamp. A write between the fetch and the collect therefore shows up as a difference.stampWritesrefuses as before.PPSA18653 reads its bindless table (about 2 MiB) through a pointer, from the page that holds the root. Every draw compared the whole table, about 5e9 word reads over a run, even though the table changes about once per frame. With this change, 2617 of 2625 table snapshots in a 10 s window were reused unwritten, against 0 of about 2250 before.
The new step
pointer table unwritten reuseinagc_shader_memorysets up a pointer-addressed table on a write-watched root page, then captures it with an explicit span query that reports nothing pending:On
mainit fails witha pointer-addressed table nothing wrote was compared again instead of reused. It also fails with either half of the change reverted.Tested
ctest -V -R "shader_memory|image_table|snapshot|capture|bindless|srt|shader_replay|table"withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1, on the same machine. The image table and capture execution tests were built. Each log starts with its tested revision and these variables, and the build settings are attached.05584f417d): 105/105 passed.main1c8c0efc8c, with the new test. 103/105 passed; onlyagc_shader_memoryandagc_shader_bindlessfail, both on the new step (agc_shader_bindlessruns the same binary).VUID-error. The same 7 tests skip in both.VUID-error.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 (APS5_FAIL_UNKNOWN_CLOCKS=1), #15563, #15611 and two local speed changes. The base is58d69707d7and the change is462334bc76: the same tree plus this commit. Traces attached.Driver.Draw.shader_compile_and_linkper frameShader.DrawStageper frametools/check_conventions.pypasses.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-58d69707d7c1-30700.json.gz
aps5-trace-462334bc769d-20744.json.gz
table-stamp-build-settings.txt
table-stamp-change-05584f417d-ctest.log
table-stamp-main-1c8c0efc8c-control-ctest.log
🤖 Generated with Claude Code