perf(agc): compare captured regions that share a page from one copy #28908
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28908"
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 JJenkx on 2026-12-04T15:06:17Z.
What
Driver::capturedMemoryChangedchecks whether a draw's captured guest memory still matches before the draw is reused. It compares every captured region separately, and each call does its own fault-safe copy of that region out of guest memory.A draw that walks a strided image table captures thousands of small regions on a few pages. In the first menu of PPSA01556, each draw carries several thousand 5–32-byte regions. This change copies the span of consecutive regions that share a 4 KiB page once, then compares each region against that copy:
NoteCompareMapped).CompareMappedgoes through the guest arena compare.Tested
Linux 7.3.6 (Arch), Ryzen 9 7950X, RX 6650 XT, RADV Mesa 26.3.1, GCC 16.2.1, Release.
main484b0368d32cand this branch105741d85c42were built the same way, with separate build directories.Tests:
agc_shader_memory_tests43/43, and theagc_compare_hook_*,agc_linked_code_dependencies_*andagc_driver_image_table_vouch*tests 50/50, all passing on this branch.The same tests under the Khronos validation layer 1.4.363 (
ANYPS5_REQUIRE_VULKAN=1), onmainand on this branch, give the same result. On both, 92 pass,agc_driver_image_table_vouched_lookupsis skipped, and there are 0VUID-and 0SYNC-HAZARDmessages.PPSA01556 (Resident Evil Village), first menu after boot: fresh private save, isolated display, Cross every 20 s from 40 s, 240 s runs under the host's performance quiet window. Order: branch, main, main, branch, branch, main.
main484b0368GPU busy per present is unchanged: 157.6 ms on
mainand 158.0 ms with this change. The saving is CPU time on queue worker 0x0. In the 8 s traces (APS5_TRACE_SECONDS=150:8), it is busy 359.5 ms per frame onmainand 290.7 ms with this change. The menu issues about 9,000 draws per frame, and each carries thousands of small captured image-table regions.During every run, the host was also sending about 270 MB/s of unrelated WireGuard traffic, whose kernel workers preempt the queue workers. Absolute FPS is therefore lower than on a quiet machine, but both arms ran under the same load.
Summary lines of the two traces:
Traces: main, this change.
Windows is not affected: it keeps the existing path, and I did not test it.
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.mdfiles or images added to the repository (attach them to this PR)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T15:14:24Z.
Review: COMMENTED
Actionable comments
c91c7b42-5524-4d65-a3a7-3b50be01ededReviewing files that changed from the base of the PR and between
7e4db5636eand105741d85c.core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Synchronization/DeferredLabels.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T15:38:38Z.
Review: COMMENTED
Actionable comments
39f02b37-42c2-474d-bddb-397b31e74424Reviewing files that changed from the base of the PR and between
105741d85cand4ab3486933.core/libs/prx/libSceAgcDriver/Execution/src/Driver/Synchronization/DeferredLabels.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T15:54:26Z.
Review: APPROVED
Reviewed — looks good
The reviewed change batches eligible same-page memory comparisons while retaining per-region comparisons when the span copy fails.
What I ran
Reviewed head
4ab348693386abe362950c530d39a9676c845d98. I inspected the prepared diff and manifest, then usedrepo_read.pyto search callers and read the changed comparison logic and mapped-memory helpers. The reader returned the requested source output, but could not append its read log because the run folder is read-only. No tests or builds were run.Results
Negative control
Not run; no test was run in this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
files.jsonunderreviewedwere inspected. No files were excluded by the stated rules.To get this to a good state
Nothing is required.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.