perf(agc): keep occlusion counter dumps inside the open render pass #2469
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2469"
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 oneandonlydean on 2026-10-09T22:25:28Z.
What
Occlusion counter dumps (
EVENT_WRITEPIXEL_PIPE_STAT_DUMP,Recorder::DumpSamples) no longer end the open render pass:vkCmdEndRenderPass. A pass whose pool has no free slot is not continued, so a new pool can be reset.DumpSamplesOnGpuno longer flushes the queued stores over the slot first.Submit, or earlier when later work reads or writes the queued bytes. It copies the segment results the dumps need (onevkCmdCopyQueryPoolResultsper contiguous slot range) and the dump list, then records the queue in groups: a group's stores, then one dispatch of the newSampleDumpskernel, which adds each dump's segments to the running total and stores its 16 counters in queue order. A store over bytes a dump of the current group writes starts a new group (Recorder::QueuedWriteGroups), so every byte ends with its last write in program order.Submit, segments no dump consumed are folded the same way once 64 are pending.Why
Each dump ended the open render pass, copied the batch query's result and ran the fold kernel (two barriers), and the store-run flush before it recorded the queued label stores (more barriers). A title that clears each query slot with
WRITE_DATAand brackets each bounding-box draw with a begin and an end dump gets a render pass, two copy barriers and a label run per draw.No reader sees a dump later than before: a CPU reader of the dumped bytes still syncs the batch (the dump notes them as a pending write) and
Submitrecords the run before the batch ends; a later label or store is queued after the dump in the same run; GPU work that reads or writes the queued bytes flushes the run first, as for queued labels. None sees it earlier: the dump is recorded after every draw whose samples it counts.Tested
Linux (CachyOS, GCC, RTX 4090, NVIDIA 610.57.04), on
main1c1c585722: ctest 501/501.tools/check_conventions.pypasses.agc_driver_recorder_tests(ctest builds it but does not run it; run by hand, also under the Khronos validation layer with no query or render pass errors):QueuedWriteGroupskeeps the program order's final bytes for 20,000 random sequences of stores and dumps.mainthe first dump ends the pass, soan occlusion dump ended the render passfails.Submit.importWindowTests"(w) a cache over the pages the import reported sees no change", which fails the same way onmain; with that test skipped every test passes.A heavier title, one level, frames per second over level start +30 to +150 s, warm caches, frame-clock windows. It does not reach the level on
mainalone, so this was measured with the fixes it needs to get there (boot fixes, #425, #1059, #1274, #1745 and two pending perf changes); "base" is that build. Per presented frame, fromAPS5_PROFILE_DRAW:In that level the GPU time was dominated by a depth-plane copy (#425's code, review input there), so pass breaks only show in frame rate once that is fixed: +11% (2.56 to 2.84 fps), GPU busy 142 to 102 ms per frame with it.
A lighter title that runs at 60 fps, on
main+ this: all screen checks pass, 60.0 fps menu and 59.9 fps gameplay, no skipped draws, no single-frame flashes.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 popcoder565 on 2026-10-09T22:46:58Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
8dac4e61, merged ontomain09a3462ein one build with #2473, which currentmainneeds to build on Windows, and 3 other new PRs.agc_driver_recorder_tests(not in ctest), which holds this PR's test change, passes 10 of 10, built explicitly. #2248 was merged too, becausemainfails that test for other reasons (#2155).No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-09T22:50:01Z.
Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at
8dac4e61:/tmp/anyps5_build) with zero warnings/errors.python3 tools/check_conventions.py --base origin/main --head HEAD-> PASS (0 errors).SampleDumps.compand occlusion query recorder inlibSceAgcDriver. Keeping occlusion counter dumps inside the active render pass prevents spurious render pass splits.LGTM!
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T23:01:42Z.
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/tests/shaders/Cover.fragcore/libs/prx/libSceAgcDriver/tests/shaders/Cover.vertcore/libs/prx/libSceAgcDriver/Graphics/shaders/SampleDumps.compcore/libs/prx/libSceAgcDriver/tests/shaders/Cover.fragcore/libs/prx/libSceAgcDriver/tests/shaders/Cover.vert