fix(agc): keep stores after occlusion dumps after them in a queued run #5232
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5232"
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 johnmaia on 2026-10-13T15:18:41Z.
What
Fixes #5215.
Recorder::QueuedWriteGroupssplits a queued store run into groups. Each group records its plain stores first and its occlusion counter dumps after them. A store started a new group only when it overlapped an earlier dump, so a store after the dumps that touched other memory joined their group and was recorded before them. That's fine for the final memory contents, but a title polling that store sees it early. The usual case is the label it writes after its occlusion queries to say "results ready". The title then reads the counters before the dumps land.Now any store after a dump starts a new group, so a group's stores never follow its dumps in program order. The cost is one more dump dispatch per dump-to-store transition.
APS5_LABEL_RUNS_INLINE=1, which records every dump at once, was not slower on the title below.The
QueuedWriteGroupstests only ran in the recorder binary's full mode, which ctest doesn't register. They now also run asagc_queued_write_groups(--queued-write-groups-only, no device needed). Updated expectations:Tested
agc_queued_write_groupsfails without the change ("the clear of the next query slot did not wait for the dumps before it") and passes with it.ctest: 1059 of 1060. The failure isguest_math, the known Linux failure fixed by #5154.tools/check_conventions.pyandtools/check_test_registration.pypass.tools/pr_overlap.py: #4935 also adds tests to the sameCMakeLists.txtlines.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T16:03:37Z.
Thanks for the fix and for registering
queuedWriteGroupTestswith CTest. One thing I noticed in the updated expectations: the per-query-slot pattern in the test (clear, begin dump, end dump, next slot'sclear) was one group before (Groups{6}) and is nowGroups{3, 6}, so a run with N query slots now produces N groups, i.e. N dump dispatches instead of one. The description says the cost is one more dump dispatch per dump-to-store transition and thatAPS5_LABEL_RUNS_INLINE=1was not slower on the title used; a number for a title with many occlusion queries per frame would show whether the per-slot split matters.I only read the diff; I did not build or run it.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-14T01:12:32Z.
@xXPBSXx numbers from a title with many occlusion queries: Epic Mickey: Rebrushed in Dark Beauty Castle. Linux, RX 7600 (RADV, Mesa 25.2.8),
maince5c83953+ #5030, with and without this PR,APS5_PROFILE_DRAW=1. Per-10-s counters averaged over the last 15 reports (in level), FPS over 30-300 s after Continue:At about 48 frames per 10 s, the split adds about 100 label-run barriers per frame: each extra group is one barrier plus one fold dispatch. That is about 10% of all recorded barriers (39k-48k per 10 s). FPS moves within the run-to-run spread (0.23 between runs with the PR). The run without the PR is also the one where draws pop, so it isn't a like-for-like frame.
If the barriers become a cost on other titles, a narrower rule is possible: split only before a non-computed store that something later reads as a result. That needs knowing which store is the label, which the recorder doesn't track today. I'd keep it for a follow-up.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-14T04:02:41Z.
Tested on High on Life (PPSA15388, UE4), the title from #5488, at the same spot as my earlier traces there. This PR fixes most of that title's occlusion flicker on the normal GPU path, and makes it much faster.
Flicker. Walls, doors and windows in the home base and on the stairs now stay in place on the normal path (
DumpSamplesOnGpu, no workaround switch). Before, they flickered frame to frame. One thing is left: about once in 50 frames, a run of queries still reads 0 and a visible object drops out for one frame (see below).Speed, window-title FPS, same save and machine. The earlier numbers come from several runs, not a strict A/B, but the gap is large:
Trace at the upstairs window, with the same local
ZPASS_DONEtrace as on #5488 (begin dump atA, end atA + 8, sum of the 16 DB slots, all ready):In the one bad frame (#48 of the trace), the three largest queries read 0 together. Their begin and end dumps (#4965–#4980) all show the same total, so no samples were counted between them. The neighbouring frames read about 1.45 M, 0.62 M and 1.58 M. The video shows the matching symptom: an object vanishes for exactly one game frame and comes back. Which object varies from blink to blink: the purple window trim, the rug hung on the right wall, the wooden frames, or a cup on the far window sill. Sometimes it is a larger blink where the window trim and the rugs all vanish at once. That fits a run of queries dropping out together, with a varying length, not one bad query.
So #5232 fixes the ordering against the polled label, which was most of the flicker and most of the cost. What's left looks like the GPU dump/count path that @MarcZX100 pointed at. I'll try #5213 on top of this next.
Details
main18c438b10plus #4487, #5156, #5003, #5494, local diagnostics, and #5232's two commits (cherry-picked cleanly).agc_queued_write_groupspasses.APS5_OCCLUSION_*unset). Every dump in the trace is on the GPU path, queue 0.Tested and written by Claude (AI assistant) on a contributor's machine.
Video:
https://youtu.be/PUh-uERlvts
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-14T04:14:03Z.
Follow-up on the remaining blink: with #5213 on top of this PR, it's gone in High on Life. That's 55 of 55 traced frames correct, no visible dropouts, objects no longer vanish behind the weapon, and about 12 FPS at the window, so no cost over this PR alone. Details are on #5213. Together the two PRs fix this title's occlusion problem from #5488.
Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:45:24Z.
Rebased onto main to resolve the test-list conflict in
core/libs/prx/libSceAgcDriver/CMakeLists.txt(kept both entries); no other change.