perf(memory): skip 4 MiB runs no write stamped since a range check #6266
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6266"
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 meh7an on 2026-10-15T08:29:14Z.
What
GuestMemory::UnchangedSinceandUnchangedSinceAllanswer whether any 64 KiB block of a range was stamped after a generation. #1310 made that a tight scan of the block stamps, but the scan still reads every block of the range. Render targets are checked this way on every draw (StorageTexture::refreshProved, fromrefreshResidentTarget), and a 4K surface spans hundreds of blocks.The write tracker now also keeps the newest stamp of each run of 64 blocks (4 MiB), and
stampraises it with the block's stamp.unchangedskips a whole run whose newest stamp is not after the generation. It scans the other runs, and the partial runs at either end, block by block as before.initializeandstampwrite block stamps, so a run's stamp cannot fall behind its blocks.LeafBlocks.On the S2 page of Sonic Origins Plus's main menu,
UnchangedSincecost the queue worker (APS5 sampler, 15 s):Per frame that is 0.76 to 0.44 samples. That is about 0.6% of the worker's frame, so the frame times below move within run-to-run noise.
Tested
Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (UCRT), Release, NVIDIA GeForce RTX 2080 Ti, driver 617.14.
db81992c5with this change, the full ctest suite passes: 1253 of 1254 tests. The other one,agc_driver_draw_program_trace, is not run, because its test executable does not link under MinGW on main itself (__gxx_personality_v0is undefined); it does not contain the code changed here.agc_write_trackinghas a new check,CheckCoarseRuns, over a range of 192 blocks. A driver store inside whole runs and a CPU store into the last block must both be seen, and blocks outside the stored one must stay unchanged.stampleaves the run stamp alone.APS5_TRACE_SECONDS=200:15on the same machine in one session, caches warm. Traces attached.The median frame did not move. The mean and p90 differences come mostly from a few slow frames in the baseline's window (p99 160.8 against 135.1 ms), which is run-to-run noise at this size.
The FPS shown in the title went from 7.91 to 8.34 (median of six readings). The sampled pair, run an hour earlier, showed 7.55 and 7.51, so neither pair moves beyond run-to-run noise.
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)Traces and summary lines (baseline b593e36eccba, this change b8acbb0d6, whose summary says a38ad5e9fc89):
coarse-traces.zip
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:17:46Z.
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/src/GuestMemory.cppL808-820, L825, L859-860, L1056-1065, L1070, L1085-1093Some 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/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.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/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.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/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T19:35:54Z.
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.