perf(agc): the presenter takes the newest collect epoch, so an untracked display image keeps its comparison memo #6210
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6210"
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 TheAggie on 2026-10-15T03:11:58Z.
What
Before a flip shows a resident display image, the presenter checks that the CPU wrote nothing over it since the image matched guest memory (
UnchangedSinceagainst the image's generation) and refreshes it otherwise. Over untracked memory (on Windows, every host-pointer import of the guest mapping, #1441) the generation is 0, so every present refreshes, and the refresh'scompareUntrackedcannot use its memo: the presenter never bumps a collect epoch, and a thread with epoch 0 is never memoized (docs/dev/ARCHITECTURE.md, "Untracked storage image comparisons"). Each present then compares the whole display surface while holding the GPU mutex.In RetroArch's Flycast core (PPSA99169) on Windows: every one of about 8,500 presents per 10 s refreshed first, and the presenter held the GPU mutex 1.5 s per 10 s (about 1.1 ms per present), during which the draw committer could not record.
BumpCollectEpochalso records the newest epoch any thread has started (lastBumpedEpoch).AdoptLatestCollectEpochmoves the calling thread to that epoch when it is newer than its own; a thread is never moved back.APS5_NO_PRESENT_EPOCH=1keeps the presenter at epoch 0, as before.The change is independent of #6187, but most of its gain needs that PR: without it the comparison memo is dropped by every unrelated forget anyway.
Tested
Windows 11, NVIDIA GeForce RTX 5070 Ti, MinGW-w64 GCC 15.2.0, on main
8cd937e29.ctest: 1231 of 1247 pass, 14 skipped.guest_call_trace_abortandwindows_backtrace_reportfail, and fail the same way on plain main here.agc_driver_prepared_graphics_prebuild_0/_1andundeliverable_host_exceptionfail under my test runner because it skips their environment changes and pass pattern; run with those, they pass.agc_write_trackinggainsCheckAdoptLatestEpoch: a thread that never bumped has epoch 0 and takes the newest bumped epoch when it adopts; a thread with its own newer epoch keeps it. WithAdoptLatestCollectEpochreduced to nothing the test fails with "a thread that never bumped did not take the newest bumped collect epoch".ANYPS5_PRESENT_MODE=immediate, unprofiled, on the local stack described in #6187 with #6187, #6192, #6209 and a local descriptor-set reuse change included. Same build,APS5_NO_PRESENT_EPOCH=1against unset, alternated, two runs each: audio produced at 66.5% and 66.6% of real time against 76.7% and 73.8%. Presenter time holding the GPU mutex, from profiled runs just before and after the change: 1,521 ms against 191 ms per 10 s. A frame dumped with the change renders correctly. I have no measurement ofmainalone.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T11:31:36Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppL102core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppL102Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/ARCHITECTURE.mddocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/ARCHITECTURE.mddocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/ARCHITECTURE.mddocs/dev/ENVIRONMENT.mdImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T19:26:48Z.
This pull request is labeled
perf, so it needs the summary line of a capture onmainand one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste bothaps5-summary.jsonllines, attach the two traces and add the output oftools/trace_digest.py.