perf(agc): write the frame-dump log line through the asynchronous profile output #9602
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9602"
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 thuanquang on 2026-10-22T04:01:44Z.
What
WriteFrameDump(Execution/src/VulkanDevice.cpp) logs each frame thatAPS5_DUMP_FRAMESdumps withstd::fprintf(stderr, "[gpu] frame_NNN.bmp: ..."). It runs on the presenter, insideDriver::Present, before the guest sees the flip complete. The path is the trailingFinishPresent, thenRetirePresents(0), thenRetireSlot, thenWriteFrameDump.VideoOutDriver::processFlipraises the FLIP event and stores the previous buffer's label only afterPresentreturns, so the guest waits for this write. The BMP itself is already written by the dump writer thread; only the log line was synchronous.The line now goes through
ProfilePrint_nid_no_patch, like the periodic reports since #798. Its text and timestamp are unchanged: the time is still taken when the frame is read back.Why
The CRT's stderr is unbuffered. When it is not a console, a printf-family call writes it one byte per
WriteFile, so this 67-character line costs 67 writes on every dumped frame. When stderr is a file redirected with Windows PowerShell'sStart-Process -RedirectStandardError(how our scripts start a title), that file is opened write-through, and one write costs 0.11 to 0.39 ms. The line then costs about 7 to 26 ms on the presenter per dumped frame. Every frame-time measurement made with frame dumps on showed it in p99 and max. #9373 does the same forAPS5_PROFILE_DRAW's draw reports.Tested
Rerun on
main048d0f9aa3(head1a9f8be3fc, the same one-line change), PPSA14363 (METAL GEAR SOLID Master Collection Vol. 1, own dump), RX 6700 XT: launcher title screen, 150 s,APS5_DUMP_FRAMES=400withAPS5_DUMP_FRAMES_EVERY=30,APS5_TRACE_SUMMARY_EVERY=10,APS5_TRACE_SECONDS=100:20; both sides built clean with onlylibSceAgcDriver.prxswapped; each run held the exclusive GPU lock and the build lock on an idle PC; two pairs, the second in the opposite order. Per 10 s window from 20 s on, without 110 to 120 s:main048d0f9aa3, pair 1main048d0f9aa3, pair 21a9f8be3fc, pair 11a9f8be3fc, pair 2Summary lines,
tools/performance_compare.pyandtools/trace_digest.pyoutput for these runs: this comment.Before the rebase, on
main3ca07d086dand head67a69f7d8e:PPSA14363 (METAL GEAR SOLID Master Collection Vol. 1, own dump), RX 6700 XT:
APS5_DUMP_FRAMES=400withAPS5_DUMP_FRAMES_EVERY=30,APS5_TRACE_SUMMARY_EVERY=10and a 20 s trace window at 100 s (APS5_TRACE_SECONDS=100:20), no profiler.main3ca07d086dand this PR's head67a69f7d8e, each with #9115's trophy fix (to get past stop 1), with onlylibSceAgcDriver.prxswapped.main.main3ca07d086d67a69f7d8eEarlier A/Bs showed the same direction: on
main7e2ba73e4c, 17.6-17.8 ms against 17.2-17.5 ms at p99 and 3 against 1 windows over 20 ms; onmain6ef5a1c4c9,mainread 17.8-24.0 ms at p99 and 18.2-208.0 ms at max, with 6 of 12 windows over 20 ms andVulkan.Retire.dumpat 0.6-1.1 ms per frame, while this PR read 17.2-17.4 ms and 17.5-23.0 ms. The cost of each write to the write-through log varies between runs.Summary lines of the trace window, 100 to 120 s. First
main, then this PR:tools/performance_compare.pyon these two lines and thetools/trace_digest.pytables of both runs are in this comment. Traces are not attached, because these runs come from a commercial title.Tests:
video_out_hdr_presentdumps frames, reads the BMPs back and prints the[gpu] frame_NNN.bmpline. It passes 3 of 3 together withvideo_out_hdr_probe, onmain048d0f9aa3and on this head (and before the rebase onmain3ca07d086dand67a69f7d8e).main048d0f9aa3and on this head (and before on3ca07d086d), both pass with 0VUID-lines on both sides.VK_LOADER_DEBUG=layershows the layer inserted in the one Vulkan test process, with no "was not found" line.video_out_frame_dump_queueis registered only off Windows, so it was not run here.tools/check_conventions.pypasses.Ordering and overload: like every line sent through
ProfilePrint_nid_no_patch, the frame-dump line now keeps its order only among the profile output: it can land after a later synchronous stderr line, and if the writer falls behind it can be dropped and counted on a[profile-output] dropped ...line instead of being printed.Not tested: other GPUs, Linux.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-22T04:01:57Z.
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 MarcZX10 on 2026-10-22T04:04:26Z.
Review: CHANGES_REQUESTED
The change is a one-line replacement on the presenter path; the reported improvement is plausible, and the PR reports focused frame-dump tests with the validation layer. Hosted conventions, eligibility, intake, labels and report checks pass; product/relinker jobs are skipped. I did not run tests locally.
The required
perfevidence is not complete yet. Both summary lines identify commit6ef5a1c4c922; the changed run is marked dirty, and the traces are neither attached nor digested. The repository requires distinctmainand change captures from the same title, scene and machine, the traces, andtools/trace_digest.pyoutput. Please rerun against currentmainand the clean PR head and add those artifacts.The AGC validation rule also requires the focused tests on both main and the change on the same machine/GPU with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1and the Khronos layer, confirming the layer was loaded and comparing VUIDs. The current report documents the PR side only. Finally, this branch is based on6ef5a1c4, while current upstream main isdce41a89; update the branch and rerun the report and focused validation on the resulting head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:04:32Z.
Review: CHANGES_REQUESTED
Correction to my preceding review: the PR branch is based on
d9c99c9, not6ef5a1c4; the report’s paired baseline is6ef5a1c4, and current upstreammainis nowdce41a89. Please update the branch and rerun the required captures/tests against current main and the PR head.The performance evidence remains incomplete: both summary lines identify commit
6ef5a1c4c922, the changed run is marked dirty, and the traces are neither attached nor digested. The repository requires distinct clean main/change captures from the same title, scene and machine, with both traces andtools/trace_digest.pyoutput.For this AGC change, the repository also requires the focused tests on main and the change on the same machine/GPU with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1and the Khronos layer, confirmation the layer loaded, and a VUID comparison. The current report documents PR-side checks, not the required paired baseline comparison. Hosted conventions, eligibility, intake, labels and report checks pass; product/relinker jobs are skipped. I did not run tests locally.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T09:30:55Z.
I rechecked exact head
52d1385bddf4: it remains a one-line switch from synchronousfprintftoProfilePrint_nid_no_patch;git diff --checkand current-main conventions pass. Hosted eligibility, conventions, labels, and report pass, while product/relinker jobs are skipped. The prior change request still applies: provide clean main/change performance captures, both traces plustrace_digest.pyoutput, and the paired validation-layer/no-shader-cache focused tests on the updated main and PR head before asking for re-review.Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-22T09:38:16Z.
Thanks. Rebased on
main7e2ba73e4c(head52d1385bdd), with the evidence refreshed:Clean captures, same title, scene and machine.
main7e2ba73e4cagainst this head, both built clean (dirty: false). Both sides have #9115's trophy fix, which gets the title past stop 1, and onlylibSceAgcDriver.prxis swapped between them. Launcher title, 150 s,APS5_DUMP_FRAMES=400withAPS5_DUMP_FRAMES_EVERY=30,APS5_TRACE_SUMMARY_EVERY=10and a 20 s trace window at 100 s (APS5_TRACE_SECONDS=100:20), with the GPU and build locks held. Per 10 s window from 20 s on, leaving out 110 to 120 s on both sides, because its last frame writes the trace (120.0 ms onmain, 109.1 ms with this PR):main7e2ba73e4c52d1385bddThe gap is smaller than in the description's first A/B on
main6ef5a1c4c9, wheremainhad 6 of 12 windows over 20 ms and one 208 ms frame. The cost of each write to the write-through log varies between runs (0.11 to 0.39 ms perWriteFilein the measurement under Why).The summary lines of the trace window (100 to 120 s),
mainfirst:tools/performance_compare.pyon these two lines. The only configuration difference it reports iswindow.first_present(5894 and 5947):mainframe_ms.p50frame_ms.p90frame_ms.p99frame_ms.maxmean_frame_msgpu_busy_ms_per_presentIn its top phases,
VideoOut.Flipgoes from 2.226 to 1.744 ms per frame andDriver.Presentfrom 1.890 to 1.663, whereWriteFrameDumpruns.tools/trace_digest.pyon both runs' summary filesmain7e2ba73e4c:14 intervals, 0.0 to 140.2 s, 8294 presents
AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1 (AMD proprietary shader compiler), Windows 10.0.26200, 1920x1080, commit
7e2ba73e4cThis PR
52d1385bdd:14 intervals, 0.0 to 140.1 s, 8346 presents
AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1 (AMD proprietary shader compiler), Windows 10.0.26200, 1920x1080, commit 52d1385bddf4
Traces. These runs come from a commercial title, so the trace files stay local. I asked the maintainers on #9373 whether summary lines plus the tools' output are enough for such a title.
Validation-layer A/B.
video_out_hdr_presentandvideo_out_hdr_proberan onmainand on this head, each 3 rounds without the layer and once with it (ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1, implicit layers disabled):VUID-linesmain7e2ba73e4c52d1385bddvideo_out_hdr_presentis the one Vulkan process: it writes six frame dumps throughWriteFrameDump, prints their[gpu] frame_NNN.bmplines and reads the BMPs back, with a largest difference of 0 on both sides. HDR10 presentation is not exercised on this display.video_out_hdr_proberuns without a Vulkan instance.video_out_frame_dump_queueis registered only off Windows.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T13:19:35Z.
Review: DISMISSED
The updated comment adds a useful paired Vulkan validation run: the focused tests ran on the reported baseline and this PR, the layer loaded, and both sides show zero
VUID-lines. The frame-dump test also passed three times on both sides and read back the BMPs. Exact-head whitespace and conventions pass against current main3ca07d086d5f44fbe3c00370e7f03953ab46ca1b; the current-main merge tree is clean. The author’s Windows RX 6700 XT results are reported; I did not run GPU tests locally, and hosted product jobs are skipped.The report still uses
main7e2ba73e4c(with only #9115) and PR head52d1385bdd, while this branch is based on7e2ba73e4c8c26b5d632b0d2f46166ffc1b8a29dand current main is now3ca07d086d5f44fbe3c00370e7f03953ab46ca1b. Please update the branch, then rerun the same title/scene/machine performance A/B and paired validation-layer checks against current main and the resulting clean PR head.The summaries and
trace_digest.pyoutput are now present, but the trace files remain local because the test uses a commercial title. I found no maintainer answer in #9373 approving summary-only evidence. Please get that exception confirmed there rather than posting commercial traces without approval; otherwise attach the required traces and digest as the repository performance form requests. Preserve the agreed overlap handling for #6946/#9508/#1896/#7642 when updating. This request is for current-main and performance/validation evidence only; no intake hold is being applied.