perf(agc): keep draw pipeline for satisfied waits #7153
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7153"
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 MarcZX10 on 2026-10-17T14:12:56Z.
What
When the draw pipeline is busy, retain it across WAIT_REG_MEM only if the awaited guest range does not overlap pending pipeline writes and the wait predicate is already satisfied. The wait range is validated before the unchecked read, matching the normal wait path. Overlapping or unsatisfied waits still drain the pipeline.
Adds an execution regression that blocks unrelated queued work, submits an already-satisfied WAIT_REG_MEM, and verifies that a following label can queue behind the blocker instead of forcing a drain.
The predicate follows the fix proposal in #7138 by @utajum; this PR adds a current-main implementation and execution regression. This addresses the wait-drain finding in #7138 only. The shader, GPU, and other CPU findings in that report are outside this change.
Tested
git diff --check— pass.python3 tools/check_conventions.py --base upstream/main— pass.BUILD_TESTING=ON; configuration stopped because the SDL2 submodule has noCMakeLists.txtand SDL XRandR support is unavailable. The changed C++ target and runtime regression were not built or run locally.e09dbc2b4 + #6842: packet0x3cdrains fell from 12,304 to 0, and their untraced scene result changed from 26.4 ms to 24.5 ms. Those measurements are from the issue report, not a run of this PR head. Traces and full summary lines are attached at https://github.com/utajum/AnyPS5/releases/tag/perf-ppsa28997.Checklist
main(47a266cf9); no other open PR implements this wait predicateNotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T14:35:06Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/tests/execution/PipelinedFill.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T14:41:52Z.
@MarcZX100 full CI on
f558cade3fails on Linux in this PR's own test,agc_driver_pipelined_fill(run 39040576371; Windows skips it without a device):tests/execution/PipelinedFill.cppbuilds both WAIT_REG_MEM packets (around lines 173 and 201) with header0xc0063c00, which declares 8 dwords, but writes only 7.Pm4.cpprequires exactly 7 for WAIT_REG_MEM, so the following packet's header gets read as the 8th dword and the submission is rejected. Every other test uses0xc0053c00. The first site was already there ind934a0dce, so the test's assertions haven't run on a device yet.Ask: change
0xc0063c00uto0xc0053c00uat both sites and confirm the test passes on a real device (Passed, not Skipped). We'll run full CI on the new head. The production change in PacketExecution.cpp is unaffected; its review still stands.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T14:49:07Z.
Fixed both WAIT_REG_MEM headers in
PipelinedFill.cppfrom0xc0063c00to0xc0053c00in commit903f380ba. Each packet now declares the seven dwords it actually contains, so the following label packet is no longer consumed as an eighth WAIT_REG_MEM dword.git diff --checkpasses. I could not run the AGC test locally: CMake configuration stops because this checkout lacks the SDL2 submodule and XRandR development support, and this environment has no GPU for the requested device run. I have not claimed a passing runtime result; please rerun the Linux test and, if available, the device-backed test on this head.Imported from boykopovar/AnyPS5. Originally posted by TheSovietWaffle on 2026-10-17T15:22:10Z.
First build and run of this head, since the description has none: head
903f380baas-is, Release, Windows 10 Pro 22H2 (19045), WinLibs GCC 15.2.0 r7, NVIDIA GeForce RTX 3080 (617.42) chosen withANYPS5_GPU.agc_driver_pipelined_fillbuilds and passes 5 of 5 (not skipped).PacketExecution.cppreverted to the merge-base47a266cf9(test kept) fails 3 of 3 witha satisfied WAIT_REG_MEM drained unrelated queued work, so the new cases cover the change.Not checked: the rest of the AGC suite, titles, the #7138 timings on this head.
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T15:24:51Z.
Thanks for testing the latest head on the RTX 3080. That confirms
agc_driver_pipelined_fillruns on a real device and passes 5/5; the negative control also confirms the test catches the behavior change. The remaining gap is the #7138 timing comparison, which your note correctly leaves unchecked.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-17T16:23:26Z.
Review: COMMENTED
A Linux run of
903f380baon lavapipe, the CI device wheref558cade3failed, and on NVIDIA. It also checks the overlap half of the predicate, which the negative control above (the wholePacketExecution.cppreverted) does not separate.Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same host. Head903f380bamerged ontomain84b0d2f24(clean).ANYPS5_NO_SHADER_CACHE=1,-j1 --timeout 30.agc_driver_pipelined_fill-V: "pipelined fill tests passed")PacketExecution.cppfrommaina satisfied WAIT_REG_MEM drained unrelated queued workif (DrawPipeline::Queue0().Overlaps(awaited, bytes)) return false;removeda satisfied WAIT_REG_MEM skipped an overlapping queued write^agc(649 tests)main: 649/649)main: 648/649; the failure is a CPU timing flake inagc_async_log_fatalthat passes 5/5 alone)So each of the two new checks fails on its own: the first one without the change, the second one when a satisfied wait keeps the pipeline over an overlapping queued write.
Not run: Windows, AMD, any title, the #7138 timings.
GPUs tested: lavapipe (Mesa 26.0.3) and NVIDIA GeForce RTX 3070 (595.99.02), Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T16:40:21Z.
Thanks for the Linux retest and the two isolated controls. This confirms the focused test passes on lavapipe and NVIDIA, fails against main when the optimization is absent, and fails when only the overlap guard is removed. That directly validates both sides of the predicate; the #7138 title timing comparison remains unverified.
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-17T22:08:27Z.
Tested on Onimusha's menu: no measurable change in this scene.
Setup: Onimusha: Way of the Sword (PPSA27836), boot to the language menu with no input,
APS5_TRACE_SECONDS=60:30, warm cache. Windows 11 26200, RTX 5070 (617.42), 3840x2160. Basemain84b0d2f24+ #6557 #6727 #6762 (5c521efea), 6 runs (3 before and 3 after the PR runs). The PR is merged on top of it (clean merge), 3 runs.This scene may simply not exercise the path this PR speeds up. Summary lines and traces available on request. AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T00:14:04Z.
Thanks for the controlled Onimusha comparison. I’ve recorded this as a no-measurable-change result for that menu scene: the three PR p50 runs (82.4–82.5 ms) are within the six-run base range (77.9–84.5 ms). It does not establish whether this scene exercises the satisfied-wait path, so I will keep the PR’s performance claim limited to the predicate regression and the #7138 capture evidence.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T05:37:39Z.
Thanks for the matched lavapipe and RTX 3070 runs. The negative controls isolate both cases: the unchanged packet path drains unrelated queued work, and removing the overlap predicate skips an overlapping queued write. The full AGC suite results and the main-only timing flake are clearly distinguished.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T21:12:18Z.
This pull request is labeled
perf, so it needs the summary line of a capture onmainand one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste bothaps5-summary.jsonllines, attach the two traces and add the output oftools/trace_digest.py.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T03:22:00Z.
Hi @MarcZX10,
agc_driver_pipelined_fillfails occasionally on Linux CI with "a satisfied WAIT_REG_MEM skipped an overlapping queued write" (CI 39040576371 on 18 Oct, 39353294932 attempt 2 on 20 Oct, both on unrelated PRs). Reading main, I can't find a path where an overlapping queued write is skipped:Overlapsincludes the running commit, andDrainwaits foritems.empty(). So I suspect the observation rather than the driver. Could you split that Require into its two halves (drain observed within the window / label queued before the release) and printDrainRequestsByOpcode(0x3c)andOutstanding()when it fails? Then the next occurrence shows which one it is. If it's the 3 s window, waiting on the drain counter without a deadline (the 20 s submit check already bounds it) would remove the load sensitivity.