perf(agc): join a buffer bound from inside a range larger than the import window into the small ranges after it #15658
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15658"
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 mrfelek on 2026-11-04T00:42:38Z.
What
A buffer bound from inside a registered range that is larger than the import window, running into the ranges after it, had no import:
importRunBoundsreturns the containing range alone, because it is larger than the window, sorunCoversfails at its end andimportAccessreturns beforeimportAllocation.joinedRun(theimportJoinedpre-pass inUploadFinish) joins only when every range in the run is larger than the window, or when the binding starts at the run's base.So such a buffer was copied on the CPU on every bind, and the copy waited for any GPU work pending over it.
joinedRunnow also returns the run when its first range is larger than the window and the ranges after it are, together, no larger than the window. The part a join adds beyond the large range stays within one window. The host-imports entry indocs/dev/debt/libSceAgcDriver.mdgains one clause for this case.PPSA22408 (Hot Wheels Infinite Rush) hits this every frame in its garage menu. A dispatch's build reads a 648,000-byte buffer that starts inside a 12 MiB range and ends 123 to 189 KiB into the 2 MiB range after it (same flags, no gap), while GPU work is pending over it. The CPU copy in
GuestBufferMemory::copyRegion, underUploadFinish, waited about 16 ms per frame in a pending-write sync.Overlap: #5372 changes the same line of
joinedRun(run.bytes <= window). The two conditions are disjoint: #5372's holds only when the whole run fits the window, this one only when the first range alone is larger than it. #5372 also adds a cap inimportJoinedthat refuses a widened run larger than the window unless the old rule gave the same run from its first range's start, and that cap would refuse this case. If #5372 lands first, I'll rebase this and exempt the case from the cap. No other open PR changesjoinedRun(#6197, #6918, #7457 and #10442 touch the import code around it).Tested
Unit test (
agc_driver_graphics,BdaResources.cpp, next toimportJoinTests): 128 KiB window, a 192 KiB range followed by 64 KiB ranges.joinedRunline removed, the suite fails ata buffer bound from inside a range larger than the import window into the small range after it was not imported over both.Focused suites:
agc_driver_graphics,agc_driver_recorderandagc_driver_host_import_{at_map,proofs,teardown,windows}, onmain1c8c0efc8cand on this head, both GPUs below.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1: 6 of 6 pass on each side, noVUID-messages on either side, no missing-layer line.tools/check_conventions.py --base origin/mainpasses.PPSA22408 garage menu: Linux 7.3, Ryzen 9 5950X, RTX 3080 Ti (NVIDIA 615.71.09), 3840x2160, the game's default settings, the same input route into the garage each run.
main1c8c0efc8c+ #11346 (4143f1b4a0), the stack this title's garage runs on. This PR does not depend on #11346. A =a14e471883, B =d8ccb992ac(A + this head).APS5_TRACE_SUMMARY_EVERY=10andAPS5_PROFILE_GPU=1.APS5_TRACE_SECONDS=150:10 APS5_TRACE_EVENTS=2097152, no otherAPS5_TRACE_*/APS5_PROFILE_*. The game's output went to a file (headless run).Traces: A · B
Summary lines (aps5-summary.jsonl)
trace_digest.py
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)AI-assisted.