perf(agc): wait once per unit run when a storage image captures its guest bytes #4468
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4468"
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 GustavoGamarra95 on 2026-10-12T12:44:42Z.
What
StorageTexture::captureGuestBytesread the image's guest bytes with oneReadCommittedper tracked unit. Each call runs the flush hook, so for a block-unit image every 64 KiB unit published its unit shadows and waited for that copy on its own (SyncThrough), one batch per unit.The capture now runs the flush hook once per contiguous run of the selected units, then copies the units with the new
GuestMemory::ReadCommittedUnsynced, which isReadCommittedwithout the hook (the counterpart ofEqualsCommittedUnsynced).compareUntrackedalready flushes once and compares unsynced the same way. What is published and waited for is unchanged: the same units, in one hook call per run.Found on Beast of Reincarnation (PPSA29343): a backtrace of the hook's recorded-store syncs put about 98% of them under
ShaderResources::buildComplete/Revalidate->lookupStorageTexture->StorageTexture::Refresh->upload->captureGuestBytes, about 35 per upload.Tested
Linux (CachyOS, kernel 7.2), Ryzen 5 7535HS, RTX 3050 Laptop 4 GB (NVIDIA 615.78.08), GCC, Release.
main;tools/check_conventions.pypasses.cteston the RTX 3050: 950 of 950 pass (6 of them skipped: 5video_out_flip/frame_dumptests andagc_driver_stencil_ref_export); the storage, unit shadow, guest memory, pending write, upload and import tests are 324 of them.APS5_PROFILE_DRAW=1, on a local branch that also carries the title's rendering fixes: recorded-store syncs from about 23000 to about 890 per 10 s, presents from 8 to 15-16 per 10 s (1.1 to 1.56 FPS from frame dump timestamps). The title frame is the same as before the change.APS5_NO_UNIT_SHADOW=1without this change gives the same rate.No automated test is added: the change keeps what is published and read and only drops the repeated hook calls; the existing unit shadow and storage tests cover the paths.
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)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:20:30Z.
ReadCommittedUnsyncedalso skips the read guard thatReadCommittedruns before the flush hook (GuestMemory.cpp:1786), so a capture over a multisampled target's range no longer throws. Please run the guard inReadCommittedUnsyncedtoo, or once per run next to theFlushGpuWritescall incaptureGuestBytes. The rest is fine.Imported from boykopovar/AnyPS5. Originally posted by GustavoGamarra95 on 2026-10-13T00:52:15Z.
@oneandonlydean good catch.
fa28772makesReadCommittedUnsyncedrun the read guard asReadCommitteddoes (which still runs it before its flush hook); both now share the copy.e260f24extendsagc_multisample_guest_accessto read the target's memory through both and expect both to throw; the unsynced one did not throw before this change.