feat(libSceAgcDriver): pin draw committer thread on hybrid architectures #7246
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7246"
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 al3w0f205 on 2026-10-17T19:11:50Z.
What
Pins the background draw committer thread to worker affinity via
PinWorkerThread("draw_committer")at worker start inDrawPipeline.cpp. This aligns the draw committer with hybrid CPU performance scheduling (whenAPS5_WORKER_AFFINITYis active) and avoids thread migration latency spikes during draw queue processing.The flip completion latency changes in
Presentation.cpphave been reverted to preserve GPU completion guarantees and keepvideo_out_flip_tests aftergpupassing.Tested
tools/check_conventions.py --base origin/mainpasses.agc_driver_pm4_tests.exeandagc_driver_graphics_tests.exepass on Windows.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 oneandonlydean on 2026-10-17T19:46:51Z.
Thanks for looking at flip latency. The Presentation.cpp change can't go in: the
trailingFinishPresent()is the fix fromd9632d552("complete a flip only once the frame's GPU work has finished"). Without it the flip completes as soon as the blit is queued, titles reuse the frame's memory while the GPU still reads it, and PPSA21564 produced runaway shader loops and wrong matrices that way. The wait already happens outside the GPU mutex, after QueuePresent. If flip latency is the target, please open an issue with frame-time captures (APS5_PROFILE_DRAW) and a title, and any change to when the flip completes needs to keepvideo_out_flip_tests aftergpupassing on a real GPU. The draw-committer pin is reasonable on its own; please submit it as a separate PR with a measurement on a hybrid CPU, where the pin actually applies (it is a no-op on Windows without APS5_WORKER_AFFINITY).Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-17T20:00:03Z.
Ran the VideoOut flip tests with a real window, which CI skips (offscreen SDL has no Vulkan surface): with this PR, flips complete before the GPU work submitted ahead of them.
Windows 11 10.0.26200.9711, RTX 5070 Ti (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release. Head 700b4bcd7 merged onto main
f3263dfbf(clean merge, no new build errors). All 20video_out_flip_testscases, run directly frombuild\core\libs\prx\libSceVideoOut, main vs this PR, one run each:pacingaftergpueop,eop_main,eop_aftergpu,unavailableunavailableexpects no display)aftergputiming line:So the flip is reported complete ~155 ms before the dispatch queued ahead of it finishes, which is what
aftergpu'sflipped + 20000 >= landedcheck guards against.This looks like the removed
trailingblock inDriver::Present: withinFlight != 0, the frame is queued withQueuePresent()andgpuReady(context)is then called without the trailingFinishPresent(), so VideoOut counts the flip (flipStatus.count,flipPendingNum) before the frame's GPU work is done. I haven't tested thePinWorkerThread("draw_committer")part on its own.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by al3w0f205 on 2026-10-17T23:30:55Z.
Thanks for the detailed verification and testing. I have reverted the Presentation.cpp changes to preserve the trailing FinishPresent() GPU completion guarantee and keep video_out_flip_tests (aftergpu and pacing) passing. This PR is now focused strictly on pinning the draw committer thread on hybrid CPU topologies.
Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-18T15:13:46Z.
Rechecked 8dbd8de with a real window, same setup as my earlier comment (Windows 11 26200, RTX 5070 Ti, NVIDIA 617.42, WinLibs GCC 15.2.0 r7, Release), merged onto main
9f25d0b:aftergpupasses:GPU work landed at 176.6 ms, flip completed at 177.0 ms. The early flip completion I reported is gone.pacingfails (the next flip is not paced from the vblank this flip was released at), but it fails the same way on main9f25d0bwithout this PR, 3 of 3 runs each. It passed on mainf3263dfin my earlier run, so it comes from main, not from this PR. I'm looking into that separately.Not tested: the draw-committer pin itself. This machine is a Ryzen 7 9800X3D (no hybrid cores), and
APS5_WORKER_AFFINITYwas unset.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T15:41:25Z.
Coordination note from new issue #7581: the
pacingcase now fails 3/3 on main as well as on the PR's tested base. I inspected currenttestReleaseVblankandVideoOutDriver::processFlip: the test submits only one flip, whileprocessFlipwaits for the configured interval before release and updateslastFlipVblankimmediately before presentation. The test then expects another three vblanks before that same flip's completion, although the configured interval is used to pace a subsequent flip. I posted the source-based reasoning and a possible second-flip regression shape on #7581. This may explain the baseline test failure independently of the pinning change; I have not run the RTX setup.Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-18T15:59:34Z.
Rechecked 8dbd8de with a real window, same setup as my earlier comment (Windows 11 26200, RTX 5070 Ti, NVIDIA 617.42, WinLibs GCC 15.2.0 r7, Release), merged onto main
9f25d0b:aftergpupasses:GPU work landed at 176.6 ms, flip completed at 177.0 ms. The early flip completion I reported is gone.pacingfails (the next flip is not paced from the vblank this flip was released at), but it fails the same way on main9f25d0bwithout this PR, 3 of 3 runs each, so it is not from this PR. It is tracked in #7581, and #7583 changes the test's assertion.Correction to my earlier comment: I listed
pacingas passing on mainf3263df. That run used a test binary left over from the older output folder; rebuilt fromf3263dfit fails too.Not tested: the draw-committer pin itself. This machine is a Ryzen 7 9800X3D (no hybrid cores), and
APS5_WORKER_AFFINITYwas unset.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by al3w0f205 on 2026-10-18T16:01:35Z.
Thanks for verifying the
aftergpupass with the real window and for tracking down thepacingbaseline failure on main via #7581 and #7583.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T13:20:14Z.
Review: CHANGES_REQUESTED
Thanks for reverting the Presentation.cpp part. Two things left:
perfPR but has no before/after numbers. Please post them from a hybrid CPU withAPS5_WORKER_AFFINITY=1vs unset (e.g.APS5_PROFILE_DRAWframe times or draw committer stall counters, several runs, title/PPSA named). Pinning is off by default, so without data it is unclear what it improves.main:DrawPipeline::run()begins withPerformanceTrace::BindThread("draw committer");and there is a newPerformanceTrace.hppinclude. Rebase and keep both (PinWorkerThread("draw_committer")after theBindThreadline, theWorkerAffinity.hppinclude alongside).Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T17:30:30Z.
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 adriadam10 on 2026-10-24T01:58:51Z.
Review: CHANGES_REQUESTED
Thanks for reverting the Presentation.cpp part; the rebase onto
mainis clean now. One point is left, and only you can provide it:perfPR but has no measurements. Please post theaps5-summary.jsonlline of a capture onmainand one with the change (APS5_WORKER_AFFINITY=1vs unset), from the same title (PPSA named), scene and hybrid-CPU machine, several runs, the two traces and thetools/trace_digest.pyoutput, as thepr-labels-perfbot asks. Pinning is off by default, so without numbers it is unclear what this improves.We can't produce this ourselves (no hybrid CPU or title here). Without data we'll close this as stale later; feel free to reopen with it.
Pull request closed