perf(agc): store write-back changes sixteen bytes at a time #2481
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2481"
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 johnmaia on 2026-10-09T22:52:38Z.
What
GuestMemory::WriteChangedstores only the bytes the GPU changed in a mirrored buffer, so that CPU writes to the bytes around them survive. It found those bytes one at a time inside every changed 256-byte block and stored each run withmemcpy. When changed and unchanged bytes interleave (for example, only the low bytes of floats change), every run is a few bytes long, so each costs a byte loop and amemcpycall.Each 16-byte chunk is now compared with SSE2:
_mm_storeu_si128);MASKMOVDQU(_mm_maskmoveu_si128), which writes only the bytes its mask selects.An
SFENCEafter the loop orders the non-temporal masked stores before the stores that follow. A tail shorter than 16 bytes still goes byte by byte. Bytes the GPU did not change are never written, as before, and the reported changed range is the same.Tested
Linux (Ubuntu 24.04, GCC 13.3), i3-12100, RX 7600 (RADV).
New
testWriteChangedStoresExactlyTheChangedRuns(agc_driver_pm4_tests): 1037 bytes of random runs (changed, unchanged, and changed with some bytes left equal) over guest bytes that differ from both copies. Checks that exactly the changed bytes are stored and that the 13-byte tail is handled.Full
ctest: 553/554. The failure isguest_video_out_resolution_status, which needs a Vulkan-capable SDL display and fails over SSH (offscreen driver) without this change too.tools/check_conventions.pyandtools/check_test_registration.pypass.Microbenchmark, 1 MiB, best of 30, one core:
Disney Epic Mickey: Rebrushed (PPSA15657, UE4), first level, on its testing stack (#2255) with
APS5_NO_HOST_IMPORT=1, so the level's compute buffers are mirrored:WriteChangedtook 43% of the GPU submission thread, the bottleneck thread here (the GPU was ~1.4% busy), at about 1.0 ms per MiB written back.Windows (MinGW) is covered by CI only; SSE2 is part of the x86-64 baseline.
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-09T23:07:43Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-10T02:28:50Z.
Windows run: Windows 11 (26200), i7-13700K, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.
agc_driver_pm4andagc_driver_pm4_failurepass through ctest, includingtestWriteChangedStoresExactlyTheChangedRuns.Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-10T22:57:59Z.
Reopened as #3137 (rebased onto current
main; the description now says the Epic Mickey numbers were measured over the intro movie stretch, not level rendering).Pull request closed