perf(agc): scope an image table's write stamp to mapping changes of its own range #18390
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18390"
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 simnJS on 2026-11-11T13:17:07Z.
What
The stamp that lets a captured image table be reused without reading its words again (
ShaderMemory::stampWrites/Vouched) recorded the registry generation. That generation moves on every guest allocation, release, map and protection change. A title that allocates every frame therefore lost the unwritten reuse every frame, and compared or rebuilt each table instead.The stamp now records the forget serial, and a vouch asks whether the table's own range was forgotten since. This is what #16879 does for draw input snapshots; this PR uses its unconditional invalidator and its range reports for image registration.
Not changed: the image-view identity (
normalizeImageView) andCurrentTableStatestill follow the registry generation. It is recorded in the debt file.Three existing tests encoded the old contract and were updated:
table snapshot reuseandtable vouchexpected a range registered elsewhere to end the reuse. They now expect it to be kept, and an invalidation of the table's own first page to end it.agc_driver_image_table_vouch_queued_drawsbuilt its stamp by hand from the registry generation; it now uses the forget serial.Tested
maina57e435a53merged with #16879) and this branch, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, 23 tests (agc_shader_*fromagc_shader_memory_tests,agc_driver_image_table*,agc_driver_recorder):agc_driver_image_tableandagc_driver_image_table_packed. Those two fail on anyVUID-in their output, and lavapipe reportsVUID-VkDeviceCreateInfo-pNext-pNextat device creation on both sides.table snapshot reusetest fails withthe table after a range was registered elsewhere: an unwritten table was read again.table edge storesetup (a table with an unwatched tail), a range registered and removed elsewhere still ended the vouch on this branch, although the mapping check passed. I did not find which other check refuses it, so that configuration may not gain.APS5_PROFILE_DRAW, and thetrace_digestsummaries, between the base and this branch.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-11-12T14:25:15Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
1536b2d6d5(base main). No merged-preview check was run.repo_read.py(catandsearch).Results
Findings
Blocking
None.
Non-blocking
ForgetStamp, which walks the blocks of the range (core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp:1177). A 256 MiB range is 4096 atomic loads per candidate, where the old check was one generation compare. Not measured.ForgetPages, even with no arena, image or write-index cache. This is needed for the stamp to be correct, but its cost is not measured.--forget-stampstest is registered only under WIN32 (core/libs/prx/libSceAgcDriver/tests/cmake/agc_page_state_tests.cmake:9). A Linux regression in these two calls would not be caught by this diff.Sources
Not verified
UnwrittenDrawSnapshotwas not read, so whether that reuse still ends on any allocation is not verified.To get this to a good state
Nothing is required.
Optional: a Linux test for image registration, and a measurement of the range walk in
ForgetStampon a large range, as the description already asks for on a title.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T04:39:40Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed code supports the range-scoped invalidation described in the PR, and no verified blocking defect was found.
What I ran
390bd3d2c2b9dcb6236cb2afec7951eede5afafd; no commands or tests were run. The author reports lavapipe tests and a negative control in the PR description.description.md,commits.md,manifest.json, anddiff.patch. Read the changed source and test files listed below throughrepo_read.py; three changed files were excluded as too large for the review folder and read only at the relevant diff hunks.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp,core/libs/prx/libSceAgcDriver/tests/Recorder.cpp, andcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas excluded by the review-folder size rule; I inspected their changed hunks indiff.patch.To get this to a good state
Nothing is required.
Pull request closed