perf(agc): bind the address space's BDA table for writes inside writable imports #4979
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4979"
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 AlxcBTW on 2026-10-13T07:09:18Z.
What
GuestBufferMemory::CachedAddressTable()returns the cached address space's own BDA table (its serial and ranges) for a build whose writes all land in ranges that already have write permission, instead of building and keying a table per set of written addresses.AddressRanges()splits only the space's ranges without write permission around the written intervals. When no written interval overlaps such a range, its result is the space's own ranges, so the build binds the space's table by the space serial, as a build without writes does. The check is a bisection per written interval over the space's sorted, disjoint ranges. A write that overlaps a range without write permission (a writable image mirror inside a read-only import) keeps the per-writes table as before.No environment switch: the path is always on and exact.
Why
A build that maps only the cached space but writes through V#s got a table keyed by its writes: a new key for nearly every set of written addresses, so each such build merged the space's imported ranges (about 9000 in Sword of the Sea gameplay), stored them, then hashed and compared them in
BdaResources. In a CPU sample of the lab line (Sword of the Sea gameplay, RTX 5070)CachedAddressTableandhashRangeswere about 4 % of the q0 thread.This is independent of the read-list change and has no dependency on it. I did not measure it in isolation on
main; the figure above is a sampling share on the lab line, not a measured FPS gain.Tested
tests/BdaResources.cppspaceWritableWritesTests(inagc_driver_graphics), with a writable and a read-only import registered: builds with one write and with two writes inside the writable import bind the serial of the build without writes, and the cached ranges equalAddressRanges()(the full walk) and the ranges of the build without writes; the read-only import stays without write permission. Onmainthe serial differs per set of writes, so the test fails there.tools/check_conventions.py --base origin/main: passed.build.yml): Linux and Windows green, 0 failures (https://github.com/AlxcBTW/AnyPS5/actions/runs/38357743201), run before a rebase onto amainthat only addedtests/ShaderMemory.cppChecklist
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T09:41:54Z.
Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built on main
2a2a3dc65together with nine other open GPU PRs (their own commits applied, no merge commits; one further PR, #5024, conflicted with them and was left out), so only the tests that belong to this PR say something about it:tests/BdaResources.cpp(targetagc_driver_graphics_tests):agc_driver_graphics10 of 10 (that test is known to fail sometimes on address layout, see #4660),agc_sparse_buffer_holes,agc_descriptor_pool_reset_failure,agc_compute_descriptor_layout_flags3 of 3 each.Not tested: no game run. The batch was built once, not per PR; nothing failed, so no bisect was needed.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-13T18:24:29Z.
Rebased onto current main. The only conflict was the test call list in
tests/BdaResources.cpp. Full ctest on the fork CI is green on Windows and Linux, apart from the host-libmguest_mathcase (#5154).Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T23:26:16Z.
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/Graphics/src/GuestBufferMemory.cppL3798-3799Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T11:15:42Z.
Checked the new path against
AddressRanges(): with no written interval overlapping a range without write permission, the split leaves the space's ranges unchanged, so binding the space's table and serial is equivalent. Built and ran the libSceAgcDriver tests on the PR merged onto main:agc_driver_graphics(withspaceWritableWritesTests) passes and fails withGuestBufferMemory.cppreverted. Also thanks to @xXPBSXx for the Windows run. Merging once the full Build is green.