perf(agc): queue a flip submission before holding the title for earlier flip work #18072
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18072"
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 PrivacyOnion on 2026-11-10T09:38:25Z.
What
A queue-0 submission that carries a flip held the title in
Driver::holdFlipBehindWorkeruntil every earlier flip submission had run to its end and its recorded GPU work had completed and been reaped, and only then queued it. The worker had nothing to run during that wait. In a lossless trace of Sniper Ghost Warrior Contracts 2 (PPSA03131), the title waited about 9 ms a frame inRecorder.WaitSerialinsidewaitFlipWork, while the queue worker, the draw finisher and the draw committer were idle and only the GPU ran.The submission is now queued as soon as the worker has reached every earlier flip, which is the unchanged first stage of the hold. The title then waits for the earlier flip submissions' work as before, so
Submitstill returns only after that work completed and was reaped. Each flip submission carries aFlipWorkentry linked to the one before it, so the title waits for exactly the earlier submissions even when they finish out of order. CPU flips and thequeue0AwaitsTitleearly exit are unchanged.testFlipHoldQueuesHeldSubmissionintests/Flip.cppkeeps the first flip submission's work open and submits a second flip. It checks four things: the title stays held, the second submission is already queued, it does not run ahead of the first, and the title is released once the first completes. Againstmainit fails witha held flip submission was not queued while the title waited for the previous flip submission.The bubble only costs time when the GPU tail at the flip is not already covered by CPU waits. Before #15569 the storage flush waits before the flip covered it, and this change was neutral. #15569, now on
main, turns those waits into GPU ordering and exposes the bubble, which this change recovers.Tested
NVIDIA GeForce RTX 5070, driver 616.64, Windows 11 Pro 26200, Release build (GCC 15, Ninja).
Vulkan validation (Khronos validation 1.4.363 loaded), on
main164ac9b078and on this head:VUID-lines, nowas not found but was requested by env var VK_INSTANCE_LAYERSVUID-lines, nowas not found but was requested by env var VK_INSTANCE_LAYERSWith
VK_LOADER_DEBUG=layer, the loader log ofvideo_out_flip_presentshowsInsert instance layer "VK_LAYER_KHRONOS_validation".agc_driver_flipdrives a test video output and creates no Vulkan instance.Performance, for the
perflabel:APS5_TRACE_SECONDS=150:60, the same scripted input in every run, on the same machine.mainf439f7f3a0+ #17187 + #15569. #17187 is needed to reach the tutorial onmain, which otherwise stops ondual-source blending with a MIN or MAX operation is unsupported. #15569 is the change that exposes the bubble. It was merged intomainas07ae6afceeafter these runs.Mean presents in 60 s: 556.4 on the base, 568.2 with this PR (+2.1 %). Median p50: 107.4 ms against 104.2 ms (-3.0 %).
Every capture reports
trace_dropped, because the event buffer was 1024 events per thread. The summary numbers come from the totals and are complete.An earlier alternated series on
ea0a5cdfb4+ #17187 + #15569 gave 578.8 presents in 60 s on the base (6 runs) against 598.3 with this change (7 runs), +3.4 %.Without #15569, on
ea0a5cdfb4+ #17187, the change is neutral: 543, 540 and 502 presents in 60 s without it, against 540, 503 and 518 with it.tools/trace_digest.py summary lines, base
s13-a1
seconds 150:60 from present 5941: 556 presents, frame p50 107.4 / p90 115.0 / p99 124.3 / max 143.4 ms, GPU busy 24.6 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 01bbd2855755, dropped: yes
s13-a2
seconds 150:60 from present 5924: 556 presents, frame p50 106.6 / p90 116.6 / p99 136.2 / max 166.2 ms, GPU busy 26.7 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 01bbd2855755, dropped: yes
s13-a3
seconds 150:60 from present 5952: 553 presents, frame p50 107.7 / p90 111.5 / p99 125.4 / max 247.8 ms, GPU busy 27.1 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 01bbd2855755, dropped: yes
s13-a4
seconds 150:60 from present 6034: 566 presents, frame p50 105.8 / p90 109.4 / p99 116.3 / max 141.3 ms, GPU busy 25.9 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 01bbd2855755, dropped: yes
s13-a5
seconds 150:60 from present 6005: 551 presents, frame p50 108.5 / p90 111.9 / p99 128.8 / max 165.0 ms, GPU busy 26.6 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 01bbd2855755, dropped: yes
tools/trace_digest.py summary lines, this PR
s13-b1
seconds 150:60 from present 6170: 583 presents, frame p50 101.4 / p90 110.4 / p99 128.2 / max 139.7 ms, GPU busy 24.6 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 102c4050d89e, dropped: yes
s13-b2
seconds 150:60 from present 6156: 556 presents, frame p50 105.9 / p90 113.3 / p99 154.0 / max 220.2 ms, GPU busy 27.0 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 102c4050d89e, dropped: yes
s13-b3
seconds 150:60 from present 6146: 553 presents, frame p50 104.2 / p90 118.3 / p99 156.1 / max 751.6 ms, GPU busy 27.4 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 102c4050d89e, dropped: yes
s13-b4
seconds 150:60 from present 6147: 582 presents, frame p50 102.9 / p90 106.2 / p99 118.3 / max 143.4 ms, GPU busy 26.7 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 102c4050d89e, dropped: yes
s13-b5
seconds 150:60 from present 4116: 567 presents, frame p50 105.6 / p90 109.5 / p99 122.6 / max 165.9 ms, GPU busy 26.6 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 102c4050d89e, dropped: yes
Launch: the CI Games intro was captured frame by frame with
APS5_DUMP_FRAMES_EVERY=1in three launches with this change. None showed black or missing frames.mainshows intermittent fully black frames during that intro without this change, in 2 of 3 launches. That flicker is a separate issue that I did not investigate here. This PR does not claim to fix it.Overlap:
tools/pr_overlap.pyfails closed, because 54 open PRs that share these files conflict withmain. I compared their diffs by hand: none changesholdFlipBehindWorker,waitFlipWork,flipWorkOpen,flipWorkSerialorFlipHold. #17279 conflicts textually in four adjacent hunks: theFlipHoldstruct, theDriver.hppdeclarations and fields, andreleaseFlipHoldnext tofinishFlipWork. The two changes are independent. #17279 orders the direct CPU flip hand-over, and this one changes when a GPU flip submission is queued. Whichever lands second keeps both sides.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)