perf(agc): run queue-0 REWIND segments from a validated packet table and hand draw lookup and vertex decode to the finishers under APS5_LEAN_FRONT #22434
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22434"
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 Nesyth on 2026-11-17T15:38:59Z.
What
On
mainthe queue-0 worker binds draw-heavy frames: in themaincapture below it is busy 92% of the time (worker_busy_pct) while the draw committer is busy 46%, and its largest item is the per-draw preparation. With this change the worker is busy 79% and the finisher takes the moved work (20% -> 36% busy).APS5_LEAN_FRONT(a runtime switch, off by default, read once per segment soAPS5_ABcan toggle it within one run) gives that worker a leaner front end on the pipelined draw path:RegisterLists), with a cache for static lists;APS5_LEAN_LIST_DIRECTreads every list of a tail directly instead.execute()does per packet happens in the lean loop as well: flips and flip readying, indirect segments, read points, wait epochs with store ordering, label flushes on the same deadlines, predication, and draws whose compile is pending.APS5_VERIFY_LEAN_FRONT=Nruns every N-th item of each kind (segments' switch reads, REWIND tails, register lists, draw jobs) through today's path, which is what executes, and compares the lean answer with it.With the switch unset nothing changes. It needs the draw finisher, so this PR sits on #15456.
Tested
Windows 11 Pro 26300, Radeon RX 7900 XTX (AMD Software 26.10.1), Ryzen 7 7800X3D, Release, MinGW-w64 GCC 15.2. This head is
02f1afce80:main14deacc1f3merged into #15456's head, plus this change.PPSA04264 (v01.011.001), Performance graphics mode, a story save in the city (about 3,000 draws and 95 compute dispatches per frame), the player standing still, warm caches; every run sets
APS5_DRAW_PIPELINE=1APS5_PIPELINED_DRAWS=32APS5_PIPELINE_DISPATCH=1.In-run A/B (
APS5_AB=30:APS5_LEAN_FRONT+APS5_LEAN_LIST_DIRECT, phases of 30 s from 260 s after the first present; each B phase against its neighbouring A phases, the first pair left out while the scene settles): gain +13.91 +- 0.90 presents per 10 s (+11.1%, 5 pairs, the first pair left out: the scene settles).Captures,
mainand this PR one after the other in the same session (mainat 16:14, this PR at 16:22), the log not redirected,APS5_TRACE_SECONDS=240:60, both withAPS5_LEAN_FRONT=1APS5_LEAN_LIST_DIRECT=1(maindoes not read them; they are set in both arms so both summary lines carry the same environment):main14deacc1f302f1afce80)+8.4% FPS between the captures. The
mainarm runs without #15456's finisher default but withAPS5_DRAW_PIPELINE=1, so both arms run the finisher.Verify boot of this head,
APS5_VERIFY_LEAN_FRONT=64: every 64th item checked against today's path over 226 s in game (14.68 FPS with the checks on): 5485 segments, 1188802 packets, 213754 draws compared, 0 differences, 0 fatal errors. Register lists were read directly (APS5_LEAN_LIST_DIRECT), so none came from the list cache.On this machine
mainshows the frame's top half mirrored into its bottom half (the viewport control default of #16053, #20835; #20827 fixes it); both arms carry it.Traces, both captured on the same machine in one session: main 14deacc1f3, this PR. Summary lines and
tools/trace_digest.pyoutput below.tools/check_conventions.pypasses._lean_frontvariants of the graphics, Pm4, submit-progress and runtime-switch tests.agc_driver_target_memo(and its_lean_fronttwin) fails on #15456's head merged with today'smainwhatever this switch says: it passes withAPS5_NO_DRAW_PIPELINE=1, so it comes from #15456's finisher default meeting #17738's test, not from this change.Submission.cppandPm4.cppfor other work; whichever lands second adapts.trace_digest: main
14deacc1f3seconds 240:60 from present 4373: 814 presents, frame p50 73.4 / p90 77.7 / p99 85.4 / max 115.5 ms, GPU busy 25.8 ms per present
AMD Radeon RX 7900 XTX, AMD proprietary driver 26.10.1 (LLPC), Windows 10.0.26300, 3840x2160, commit
14deacc1f3, dropped: noSlowest frames (largest slices inside each, inclusive)
Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.Packet 28.8, batch 25.8, Graphics.Draw 25.4, Graphics.Draw.draw_and_resource_release 22.2, Driver.Packet.draw 15.9, Driver.Draw 15.6, Driver.DrawFinish 14.9, Driver.Draw.prepare 9.6, Driver.Packet.dispatch 9.2, Driver.Dispatch 9.2
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
trace_digest: this PR
02f1afce80seconds 240:60 from present 4510: 879 presents, frame p50 67.7 / p90 71.5 / p99 80.1 / max 93.3 ms, GPU busy 24.6 ms per present
AMD Radeon RX 7900 XTX, AMD proprietary driver 26.10.1 (LLPC), Windows 10.0.26300, 3840x2160, commit
02f1afce80, dropped: noSlowest frames (largest slices inside each, inclusive)
Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.Packet 26.6, Graphics.Draw 25.4, batch 24.6, Driver.DrawFinish 24.4, Graphics.Draw.draw_and_resource_release 22.0, Driver.Packet.draw 11.1, Driver.DrawFinish.draw_enqueued 9.7, Driver.Packet.dispatch 9.1, Driver.Dispatch 9.0, Driver.DrawFinish.shader_compile_and_link 5.9
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
Main merged (2026-11-18):
mained1a01d035merged ase0fcc58ccb(one conflict, the Pm4 test table: this PR's rewind tests beside main'sorder-signal). Every target builds, 127 of 128 focused tests pass (the sameagc_driver_target_memo_lean_frontas above),tools/check_conventions.pypasses. The measurements above are from02f1afce80.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T01:01:00Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected execution paths show no verified blocking defect, but this review is incomplete and does not justify approval.
What I ran
e0fcc58ccbc7b0730381d14776990b16c5510f8a; no commands or tests were run.repo_read.py.Results
Findings
Blocking
None in the code inspected.
Non-blocking
None.
Not verified
This was a partial review of the broad change. I read
core/libs/prx/libSceAgc/CMakeLists.txt,core/libs/prx/libSceAgc/Patch/src/Rewind.cpp,core/libs/prx/libSceAgc/tests/RewindPatch.cpp,core/libs/prx/libSceAgcDriver/CMakeLists.txtexcerpts, and selected portions ofSegmentLoop.cpp,LeanFront.cpp,LeanDraw.cpp,RegisterLists.cpp,RewindKick.cpp,Submission.cpp, andLeanTails.cpp. I did not read every changed file or every changed hunk.docs/dev/debt/libSceAgcDriver.mdwas excluded from the review folder because it was too large. Builds, tests, performance captures, and physical-console behavior were not independently verified.To get this to a good state
Nothing is required. The optional point is to complete review of the remaining changed files before treating this as a merge recommendation.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T13:36:22Z.
Review: COMMENTED
Reviewed — comments
The change adds a queue-0 packet loop and finisher draw path; this review is incomplete because I inspected only selected implementation files and did not run checks.
What I ran
No build or tests were run. I read the prepared description, commit list, manifest, diff, and targeted code at head
b0041a72bfc2c801a7c7f281f821e34ab5180f68usingrepo_read.py.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
No specific code change is requested from this partial inspection.
Not verified
The review folder lists 64 changed repository files. I read selected sections of
SegmentLoop.cpp,LeanDraw.cpp,LeanFront.cpp,LeanTails.cpp, andRewindKick.cpp, plus the prepared description, commits, manifest, and diff. I did not read every changed file, including the full contents of the large implementation files, or verify the performance and test claims in the description. The manifest listsdocs/dev/debt/libSceAgcDriver.mdanddocs/user/USAGE.mdas excluded from the review folder; these files were not read. No build, test suite, negative control, or physical-console behavior was verified.To get this to a good state
Nothing is required. Optional: complete a full inspection of the changed files and run the relevant checks before making a merge decision.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:09:51Z.
Review: COMMENTED
The head still conflicts with
maina1b75b0947in the submission, rewind and draw-finisher paths. Please rebase the validated packet table and the finisher handoff together. The key controls are retaining the taken tail when guest bytes change and preserving the fallback packet path when the table cannot prove a segment. Same-machine trace summaries should identify the exact rebased main and candidate if the busy-time changes are retained as a claim. Paired execution is pending the merge resolution.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.