perf(agc): import chunk-crossing shared ranges without a buffer object of their own #24555
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24555"
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-11-20T19:33:21Z.
What
On Linux, a shared-backed guest range inside one 64 MiB chunk of the direct-memory file is bound into that chunk's udmabuf import. A range of 64 MiB or less that is not inside one chunk gets a udmabuf buffer object of its own. That covers a single run across a chunk boundary, or a range of several runs. amdgpu validates every imported buffer object at every command submission, so each such range adds to the cost of every
vkQueueSubmit.#23272 sent all of those ranges through the sparse path. It was reverted in #24052 because In Sound Mind (PPSA04921) then corrupted its heap in 3 of 4 runs. I had traced that corruption to inside a 1 MiB single-run sparse import that straddled a chunk boundary.
This PR splits the cases:
A range the sparse path declines keeps a buffer object of its own, as before. That means one imported without the GPU lock and without a sparse queue of its own, or one whose backing it cannot bind.
Performance
Matched A/B in one build directory:
fbd98f83fdde) against its base,mainc8f72e905cce.libs/libSceAgcDriver.prxwas checked to be byte-identical to a freshnid_patcherrun of that build'sunpatchedlibrary.APS5_NO_COMMITTER_CORE=1.Spirit of the North (PPSA02306), mean FPS 150–235 s. CPU-bound here: GPU time was about 3.7 ms per frame.
mainThe branch is ahead in every round.
Under The Waves (PPSA08056), in a pair checked with a screenshot every 10 s so both runs show identical scenes, mean FPS 170–200 s: branch 7.53,
main4.90 (+54%). Details are in the comment below.The Smurfs Dreams (PPSA21607), mean FPS over the village-gameplay window both builds reach (200–235 s), two rounds: branch 13.97 / 13.66,
main10.80 / 11.11 (+26%; the round with identical screenshots alone is +23%).Infliction: Extended Cut (PPSA02688), mean FPS 60–175 s, forward-walk preset, two rounds: branch 4.54 / 6.08,
main4.14 / 4.16. The branch's second run is noisy.Where the gap came from: on
maind50640e26408, which still had #23272, Spirit of the North gave 11.37 FPS. A bisect with verified-fresh drivers put the first slow merge at #24052, the revert (8.47 FPS). With a temporary counter, this branch left 0 ranges importing a buffer object of their own in Spirit of the North. Before the multi-run part, 16 or more did.Safety
In Sound Mind (PPSA04921), with pristine save and Cross every 12 s, 150 s per run:
The counter showed the offset window bind used over 512 times per run in this title. The few ranges left on their own import were small multi-run ranges the sparse path declined.
Tested
Linux 7.2.14, Ryzen 9 7950X, RX 6650 XT, RADV (Mesa 26.2.7), Release,
/dev/udmabufaccessible (size_limit_mb64).New
agc_driver_dma_buf_chunk_window:VkDeviceMemoryof its own;It fails on
mainc8f72e905cce, which reports "a 2 MiB range across a chunk boundary was imported as a buffer object of its own", and passes here.All 97 import-related tests pass (
ctest -R 'host_import|dma_buf|sparse|scattered_runs|import|chunk_window').Merge check: the branch merges cleanly with current
main0af6acc89ea2.Checklist
main; no other open PR changes which ranges take the chunk imports or the sparse pathNotImplemented_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: yes
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T20:28:23Z.
Review: COMMENTED
Reviewed — no blocking findings
The diff’s chunk-window and sparse-path changes are consistent with the described routing; no verified blocking defect was found in the source inspected.
What I ran
Reviewed head
fbd98f83fddedeefcce045beb6f0543570a8dce5. Read the prepared diff and targeted source usingrepo_read.py; no tests or builds were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full changed source file was not read; only the functions around the changed hunks were inspected. The described hardware performance and safety runs, merge check, and reported test results were not independently verified. Files read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch,core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp(targeted ranges),core/libs/prx/libSceAgcDriver/tests/execution/DmaBufChunkWindow.cpp, anddocs/dev/debt/libSceAgcDriver.md(changed line context).files.jsonwas not available as a review document; manifest/listing showed three changed files, withGuestBufferMemory.cppexcluded from the prepared folder because it was too large.To get this to a good state
Nothing is required. The author’s reported Linux import tests and physical-console runs remain useful supporting evidence.