Skip to content

perf(agc): queue occlusion counter dumps behind pipelined draws instead of draining - #6501

Merged
oneandonlydean merged 4 commits into
boykopovar:mainfrom
Nesyth:perf/agc-pipelined-sample-dumps
Nov 4, 2026
Merged

oneandonlydean merged 4 commits into
boykopovar:mainfrom
Nesyth:perf/agc-pipelined-sample-dumps

Conversation

@Nesyth

@Nesyth Nesyth commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

With pipelined draws, queue 0 drains the draw pipeline before every occlusion counter dump (EVENT_WRITE event 0x39): it waits until the committer has recorded every queued draw, then records the dump itself. A title that wraps its draws in occlusion queries pays that wait hundreds of times per frame.

This change queues the dump as an ordered commit item, as labels and DMA stores already are, so the committer records it right after the draws before it and queue 0 moves on.

  • The item runs what the drained path runs: deferred labels first, then DumpSamplesOnGpu. When that refuses, the item idles the device under the GPU mutex (as commitDmaStore does, instead of the drain's unlocked wait) and writes the counters on the CPU.
  • The item declares the 248 bytes it writes, so a later packet that reads them waits for it as for any queued store.
  • Stays on the drain path: a predicated dump, a dump while deferred labels are pending, and a dump to memory that is not accessible. APS5_PIPELINE_DRAIN_SAMPLE_DUMPS=1 drains for every dump, as before.
  • A new [sync] counter shows how many dumps were queued.
  • With APS5_DRAW_PIPELINE=1 (perf(agc): draw finisher pipeline (APS5_DRAW_PIPELINE) #6946) a dump still drains the draw finisher before it is queued, as every packet outside the finisher's list does. Queueing it through the finisher, as labels are, is a follow-up.

Tested

Windows 11 Pro 10.0.22631, Ryzen 7 7800X3D, RX 7900 XTX, WinLibs GCC 15.2.0, Release, on main aeeaefa.

  • New test tests/execution/PipelinedSampleDump.cpp. One DCB holds a DMA fill over the dump slots, a begin dump, a draw, an end dump, a second query with no draw in it, and a fill over the last slot. The end dump has to count the draw's samples and the empty query none, every slot has to show the ready bit over the first fill, and the last fill has to land on top; all four dumps have to go through the queue. agc_driver_pipelined_sample_dump_drained runs it with the switch set and requires the same values with no dump queued. Recording the dump at once instead of in order makes the test fail. The cases that stay on the drain path are not covered by a test.
  • ctest -V of the pipeline, label, finisher and occlusion query tests (agc_driver_(pipelined|finisher_label|same_queue_label|draw_pipeline_trace|unimported_label|alias_copy_label), agc_sample_dumps, agc_predication_tests, agc_instrumentation_query_size_tests) with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (SDK 1.4.363.0), ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1: 28 of 28 pass with this change and 26 of 26 on main aeeaefa, the two new tests being the difference. Neither log reports the layer missing or a VUID-. agc_driver_pipelined_sample_dump also passes 10 runs in a row, and 3 runs with APS5_DRAW_PIPELINE=1.
  • The wider ctest -R "agc|shader" run (603 of 606) is from the previous base fa9365c and was not repeated on aeeaefa.

Linux: not run.

Ready or Not (PPSA18605)

The station lobby after Continue, standing still, 3840x2160. main aeeaefa against aeeaefa with this commit, only libSceAgcDriver swapped, caches warm, APS5_TRACE_SECONDS=80:15 with APS5_TRACE_EVENTS=1048576 and APS5_NO_PAD_INPUT=1, no other APS5_TRACE_* or APS5_PROFILE_* switch, log not redirected, nothing dropped. The window is earlier than the 160:10 used for this scene before: main aeeaefa aborts here 60 to 130 s after the station loads, in both builds, with storing storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented (as in #7017).

Six captures in the order main, change, change, main, main, change; captures 1, 4 and 6 are reruns of runs that aborted before their window closed:

capture build presents / 15 s frame p50 / p90 / p99 (ms) GPU busy per present (ms)
1 main 68 220.7 / 251.4 / 274.4 112.9
2 change 62 244.4 / 263.5 / 275.6 120.2
3 change 77 189.1 / 223.1 / 240.5 111.7
4 main 76 190.8 / 230.9 / 244.5 112.1
5 main 95 148.4 / 194.4 / 218.7 106.8
6 change 62 238.5 / 265.3 / 311.1 106.5

Queue worker 0x0 is 99 % busy in every capture. The sessions of this scene land in states that differ more than the two builds do: capture 1 shows the colour cast, in capture 2 the committer takes 161 ms per frame against about 100 and queue 0 waits 101 ms per frame for it in pipeline_drain, in capture 5 draws take 53 ms per frame against about 85, and in capture 6 Resources.Complete takes 86 ms per frame. Captures 3 and 4 landed in the same state: 77 against 76 presents, frame p50 189.1 against 190.8 ms, the same GPU time. An earlier batch, run without APS5_NO_PAD_INPUT so that host input could reach the title, gave 77 and 77 presents with this change against 74 and 74 on main in that state. So in this scene the change is worth a few percent at most, within the spread between sessions; the title stays bound by queue 0.

Summary lines of captures 4 (main) and 3 (this change):

{"commit":"aeeaefad9861","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"80:15"},"gpu":"AMD Radeon RX 7900 XTX","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.22631","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":32373,"title_id":"PPSA18605","title":"Ready or Not","content_version":"01.001.008","resolution":"3840x2160","window":{"spec":"seconds 80:15","first_present":363,"ms":15046.637},"presents":76,"frame_ms":{"p50":190.821,"p90":230.904,"p99":244.505,"max":244.505},"gpu_busy_ms_per_present":112.133,"worker_busy_pct":{"queue worker 0x0":99.202,"queue worker 0x28":55.432},"top_phases_ms_per_frame":{"Driver.Packet":295.301,"Graphics.Draw":100.898,"Driver.Packet.memory_wait":91.445,"Graphics.Draw.draw_and_resource_release":89.841,"Driver.Packet.draw":84.155,"Driver.Draw":83.850,"Driver.Packet.dispatch":81.076,"Driver.Dispatch":75.728},"trace_dropped":false,"trace":"aps5-trace-aeeaefad9861-15348.json.gz"}
{"commit":"63555394784d","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"80:15"},"gpu":"AMD Radeon RX 7900 XTX","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.22631","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":32373,"title_id":"PPSA18605","title":"Ready or Not","content_version":"01.001.008","resolution":"3840x2160","window":{"spec":"seconds 80:15","first_present":397,"ms":15090.547},"presents":77,"frame_ms":{"p50":189.057,"p90":223.123,"p99":240.484,"max":240.484},"gpu_busy_ms_per_present":111.664,"worker_busy_pct":{"queue worker 0x0":99.170,"queue worker 0x28":54.908},"top_phases_ms_per_frame":{"Driver.Packet":298.305,"Graphics.Draw":100.024,"Driver.Packet.memory_wait":95.833,"Graphics.Draw.draw_and_resource_release":88.919,"Driver.Packet.draw":85.473,"Driver.Draw":85.141,"Driver.Packet.dispatch":73.550,"Driver.Dispatch":68.578},"trace_dropped":false,"trace":"aps5-trace-63555394784d-34412.json.gz"}

Traces:
aps5-trace-aeeaefad9861-15348.json.gz
aps5-trace-63555394784d-34412.json.gz

tools/trace_digest.py, capture 4 (main)

seconds 80:15 from present 363: 76 presents, frame p50 190.8 / p90 230.9 / p99 244.5 / max 244.5 ms, GPU busy 112.1 ms per present
AMD Radeon RX 7900 XTX, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.22631, 3840x2160, commit aeeaefa, dropped: no

{"commit":"aeeaefad9861","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"80:15"},"gpu":"AMD Radeon RX 7900 XTX","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.22631","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":32373,"title_id":"PPSA18605","title":"Ready or Not","content_version":"01.001.008","resolution":"3840x2160","window":{"spec":"seconds 80:15","first_present":363,"ms":15046.637},"presents":76,"frame_ms":{"p50":190.821,"p90":230.904,"p99":244.505,"max":244.505},"gpu_busy_ms_per_present":112.133,"worker_busy_pct":{"queue worker 0x0":99.202,"queue worker 0x28":55.432},"top_phases_ms_per_frame":{"Driver.Packet":295.301,"Graphics.Draw":100.898,"Driver.Packet.memory_wait":91.445,"Graphics.Draw.draw_and_resource_release":89.841,"Driver.Packet.draw":84.155,"Driver.Draw":83.85,"Driver.Packet.dispatch":81.076,"Driver.Dispatch":75.728},"trace_dropped":false,"trace":"aps5-trace-aeeaefad9861-15348.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 407: 244.5 ms at 8637 ms: Driver.Packet (queue worker 0x0) 224.8, Graphics.Draw (draw committer) 136.6, Driver.Packet (queue worker 0x28) 131.0, Graphics.Draw.draw_and_resource_release (draw committer) 126.8
  • present 386: 242.5 ms at 4486 ms: Driver.Packet (queue worker 0x0) 224.2, Driver.Packet (queue worker 0x28) 128.4, batch (gpu) 116.8, Driver.Packet.draw (queue worker 0x0) 108.1
  • present 365: 235.5 ms at 374 ms: Driver.Packet (queue worker 0x0) 217.3, Driver.Packet (queue worker 0x28) 122.2, batch (gpu) 116.7, Graphics.Draw (draw committer) 103.0
  • present 438: 233.6 ms at 14813 ms: Driver.Packet (queue worker 0x0) 213.0, batch (gpu) 120.7, Graphics.Draw (draw committer) 119.8, Graphics.Draw.draw_and_resource_release (draw committer) 110.1
  • present 428: 233.0 ms at 12786 ms: Driver.Packet (queue worker 0x0) 215.0, Graphics.Draw (draw committer) 118.4, Driver.Packet (queue worker 0x28) 113.2, batch (gpu) 113.2

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 162.1 (82 %) 18.2 (9 %) 17.7 85.5 Driver.Packet 179.8, Driver.EndSubmission 0.5
draw committer 91.9 (46 %) 2.4 (1 %) 103.7 22.7 Graphics.Draw 90.1, Recorder.Submit 1.7
presenter 1.7 (1 %) 8.1 (4 %) 188.2 0.1 VideoOut.Flip 9.7, Driver.Present 0.1
queue worker 0x28 3.4 (2 %) 194.4 (98 %) 0.2 0.6 Driver.Packet 99.2, Driver.EndSubmission 10.3
gpu 112.2 (57 %) 0.0 (0 %) 85.8 0.0 batch 112.2

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 279.0, batch 112.2, Graphics.Draw 96.1, Driver.Packet.memory_wait 91.4, Driver.WorkerWait 88.2, Driver.WorkerWait.dequeue_order 88.2, Graphics.Draw.draw_and_resource_release 86.2, Driver.Packet.dispatch 80.8, Driver.Packet.draw 79.9, Driver.Draw 79.6

Longest waits

  • Driver.WorkerWait (queue worker 0x28) 108.7 ms at 14937 ms, present 438
  • Driver.WorkerWait (queue worker 0x28) 106.1 ms at 6382 ms, present 395
  • Driver.WorkerWait (queue worker 0x28) 105.7 ms at 1896 ms, present 372
  • Driver.WorkerWait (queue worker 0x28) 105.5 ms at 11516 ms, present 421
  • Driver.WorkerWait (queue worker 0x28) 104.8 ms at 13880 ms, present 433
  • Driver.WorkerWait (queue worker 0x28) 104.4 ms at 4623 ms, present 386
  • Driver.WorkerWait (queue worker 0x28) 104.0 ms at 14300 ms, present 435
  • Driver.WorkerWait (queue worker 0x28) 103.9 ms at 8776 ms, present 407
  • Driver.WorkerWait (queue worker 0x28) 103.1 ms at 7382 ms, present 400
  • Driver.WorkerWait (queue worker 0x28) 102.7 ms at 916 ms, present 367

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 4553: 33.2 ms at 9410 ms, present 410: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 33.5, Driver.Packet (queue worker 0x0) 7.4, Driver.Packet.dispatch (queue worker 0x0) 7.2, Driver.Dispatch (queue worker 0x0) 7.2
  • batch 653: 33.1 ms at 1369 ms, present 369: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 33.4, Driver.Packet (queue worker 0x0) 7.1, Driver.Packet.dispatch (queue worker 0x0) 6.9, Driver.Dispatch (queue worker 0x0) 6.9
  • batch 7227: 33.1 ms at 15006 ms, present 438: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 33.3, Driver.Packet (queue worker 0x0) 7.6, Driver.Packet.dispatch (queue worker 0x0) 7.4, Driver.Dispatch (queue worker 0x0) 7.4
  • batch 4645: 33.1 ms at 9597 ms, present 411: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 33.3, Driver.Packet (queue worker 0x0) 7.4, Driver.Packet.dispatch (queue worker 0x0) 7.2, Driver.Dispatch (queue worker 0x0) 7.2
  • batch 4738: 33.0 ms at 9789 ms, present 412: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 33.2, Driver.Packet (queue worker 0x0) 7.6, Driver.Packet.dispatch (queue worker 0x0) 7.3, Driver.Dispatch (queue worker 0x0) 7.3
tools/trace_digest.py, capture 3 (this change)

seconds 80:15 from present 397: 77 presents, frame p50 189.1 / p90 223.1 / p99 240.5 / max 240.5 ms, GPU busy 111.7 ms per present
AMD Radeon RX 7900 XTX, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.22631, 3840x2160, commit 6355539, dropped: no

{"commit":"63555394784d","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"80:15"},"gpu":"AMD Radeon RX 7900 XTX","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.22631","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":32373,"title_id":"PPSA18605","title":"Ready or Not","content_version":"01.001.008","resolution":"3840x2160","window":{"spec":"seconds 80:15","first_present":397,"ms":15090.547},"presents":77,"frame_ms":{"p50":189.057,"p90":223.123,"p99":240.484,"max":240.484},"gpu_busy_ms_per_present":111.664,"worker_busy_pct":{"queue worker 0x0":99.17,"queue worker 0x28":54.908},"top_phases_ms_per_frame":{"Driver.Packet":298.305,"Graphics.Draw":100.024,"Driver.Packet.memory_wait":95.833,"Graphics.Draw.draw_and_resource_release":88.919,"Driver.Packet.draw":85.473,"Driver.Draw":85.141,"Driver.Packet.dispatch":73.55,"Driver.Dispatch":68.578},"trace_dropped":false,"trace":"aps5-trace-63555394784d-34412.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 432: 240.5 ms at 6890 ms: Driver.Packet (queue worker 0x0) 224.2, Driver.Packet (queue worker 0x28) 137.7, batch (gpu) 113.7, Driver.Packet.draw (queue worker 0x0) 111.5
  • present 453: 235.9 ms at 10970 ms: Driver.Packet (queue worker 0x0) 219.9, Driver.Packet (queue worker 0x28) 137.9, batch (gpu) 111.9, Driver.Packet.draw (queue worker 0x0) 111.6
  • present 411: 235.5 ms at 2754 ms: Driver.Packet (queue worker 0x0) 219.7, Driver.Packet (queue worker 0x28) 123.1, Graphics.Draw (draw committer) 118.0, batch (gpu) 115.7
  • present 425: 233.3 ms at 5519 ms: Driver.Packet (queue worker 0x0) 218.1, Driver.Packet (queue worker 0x28) 120.4, batch (gpu) 118.6, Driver.WorkerWait (queue worker 0x28) 111.0
  • present 418: 230.4 ms at 4127 ms: Driver.Packet (queue worker 0x0) 215.1, Driver.Packet (queue worker 0x28) 128.6, Driver.Packet.memory_wait (queue worker 0x28) 122.6, batch (gpu) 122.5

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 155.0 (79 %) 25.4 (13 %) 15.6 79.5 Driver.Packet 180.0, Driver.EndSubmission 0.5
draw committer 91.2 (47 %) 2.9 (1 %) 101.9 22.7 Graphics.Draw 89.2, Recorder.Submit 1.9
title 0.0 (0 %) 0.0 (0 %) 195.9 0.0
presenter 1.7 (1 %) 1.7 (1 %) 192.6 0.1 VideoOut.Flip 3.4, Driver.Present 0.0
queue worker 0x28 4.8 (2 %) 190.8 (97 %) 0.4 0.6 Driver.Packet 104.3, Driver.EndSubmission 3.2
gpu 111.6 (57 %) 0.0 (0 %) 84.4 0.0 batch 111.6

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 284.2, batch 111.6, Driver.Packet.memory_wait 95.8, Graphics.Draw 95.3, Driver.WorkerWait 88.2, Driver.WorkerWait.dequeue_order 88.2, Graphics.Draw.draw_and_resource_release 85.2, Driver.Packet.draw 80.4, Driver.Draw 80.1, Driver.Packet.dispatch 73.3

Longest waits

  • Driver.WorkerWait (queue worker 0x28) 111.0 ms at 5630 ms, present 425
  • Driver.WorkerWait (queue worker 0x28) 106.3 ms at 14424 ms, present 470
  • Driver.WorkerWait (queue worker 0x28) 106.0 ms at 500 ms, present 399
  • Driver.WorkerWait (queue worker 0x28) 102.9 ms at 14209 ms, present 469
  • Driver.WorkerWait (queue worker 0x28) 102.8 ms at 12421 ms, present 460
  • Driver.WorkerWait (queue worker 0x28) 102.7 ms at 13789 ms, present 467
  • Driver.WorkerWait (queue worker 0x28) 101.9 ms at 1494 ms, present 404
  • Driver.WorkerWait (queue worker 0x28) 101.6 ms at 2277 ms, present 408
  • Driver.WorkerWait (queue worker 0x28) 101.3 ms at 9739 ms, present 446
  • Driver.WorkerWait (queue worker 0x28) 100.9 ms at 7019 ms, present 432

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 2667: 34.0 ms at 5701 ms, present 425: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 34.0, Driver.Packet (queue worker 0x0) 9.2, Driver.Packet.dispatch (queue worker 0x0) 8.2, Driver.Dispatch (queue worker 0x0) 8.2
  • batch 5906: 33.0 ms at 12484 ms, present 460: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 33.2, Driver.Packet (queue worker 0x0) 7.5, Driver.Packet.dispatch (queue worker 0x0) 7.3, Driver.Dispatch (queue worker 0x0) 7.3
  • batch 1282: 33.0 ms at 2714 ms, present 410: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 33.2, Driver.Packet (queue worker 0x0) 7.2, Driver.Packet.dispatch (queue worker 0x0) 7.0, Driver.Dispatch (queue worker 0x0) 7.0
  • batch 5541: 32.9 ms at 11714 ms, present 456: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 33.1, Driver.Packet (queue worker 0x0) 7.6, Driver.Packet.dispatch (queue worker 0x0) 7.4, Driver.Dispatch (queue worker 0x0) 7.4
  • batch 915: 32.9 ms at 1945 ms, present 406: GPU no ranges; recorded by Recorder.Sync (queue worker 0x0) 33.1, Driver.Packet (queue worker 0x0) 7.8, Driver.Packet.dispatch (queue worker 0x0) 7.6, Driver.Dispatch (queue worker 0x0) 7.6

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 7900 XTX, AMD Software Adrenalin 26.8.1 (driver 32.0.31041.1004), Windows 11 Pro 10.0.22631
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 7978 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp L297

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.

Pull request Shared files not compared
PR 1896 docs/dev/ENVIRONMENT.md
PR 4472 docs/dev/ENVIRONMENT.md
PR 5609 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
PR 6186 docs/dev/ENVIRONMENT.md
PR 6188 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
PR 6804 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6924 docs/dev/ENVIRONMENT.md
PR 7275 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 7449 docs/dev/ENVIRONMENT.md
PR 7457 docs/dev/ENVIRONMENT.md
PR 7464 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Synchronization/SynchronizationStatistics.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Synchronization/SynchronizationStatistics.cpp
PR 7514 docs/dev/ENVIRONMENT.md
PR 7604 docs/dev/ENVIRONMENT.md
PR 7642 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
docs/dev/ENVIRONMENT.md
PR 7963 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp
PR 8004 docs/dev/ENVIRONMENT.md
PR 8246 docs/dev/ENVIRONMENT.md
PR 8484 docs/dev/ENVIRONMENT.md
PR 9012 docs/dev/ENVIRONMENT.md
PR 9335 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
PR 9345 docs/dev/ENVIRONMENT.md
PR 9356 docs/dev/ENVIRONMENT.md
PR 9387 docs/dev/ENVIRONMENT.md
PR 9712 docs/dev/ENVIRONMENT.md
PR 9852 docs/dev/ENVIRONMENT.md
PR 9898 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp
docs/dev/ENVIRONMENT.md
PR 10193 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
docs/dev/ENVIRONMENT.md
PR 10359 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 10442 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Synchronization/SynchronizationStatistics.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Synchronization/SynchronizationStatistics.cpp
docs/dev/ENVIRONMENT.md
PR 10757 docs/dev/ENVIRONMENT.md
PR 10894 docs/dev/ENVIRONMENT.md
PR 11351 docs/dev/ENVIRONMENT.md
PR 11435 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
docs/dev/ENVIRONMENT.md
PR 11436 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
docs/dev/ENVIRONMENT.md
PR 12120 docs/dev/ENVIRONMENT.md
PR 12323 docs/dev/ENVIRONMENT.md
PR 12324 docs/dev/ENVIRONMENT.md
PR 12544 docs/dev/ENVIRONMENT.md
PR 12565 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 12567 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
docs/dev/ENVIRONMENT.md
PR 12746 docs/dev/ENVIRONMENT.md
PR 12863 docs/dev/ENVIRONMENT.md
PR 12921 docs/dev/ENVIRONMENT.md
PR 12930 docs/dev/ENVIRONMENT.md
PR 12970 docs/dev/ENVIRONMENT.md
PR 13646 docs/dev/ENVIRONMENT.md
PR 13707 docs/dev/ENVIRONMENT.md
PR 13863 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
docs/dev/ENVIRONMENT.md
PR 13920 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
docs/dev/ENVIRONMENT.md
PR 13928 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
docs/dev/ENVIRONMENT.md
PR 13929 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
docs/dev/ENVIRONMENT.md
PR 14262 docs/dev/ENVIRONMENT.md
PR 14264 docs/dev/ENVIRONMENT.md
PR 14299 docs/dev/ENVIRONMENT.md
PR 14311 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
PR 14344 docs/dev/ENVIRONMENT.md
PR 14943 docs/dev/ENVIRONMENT.md
PR 15059 docs/dev/ENVIRONMENT.md

@Pacuka

Pacuka commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Linux data point (the PR says Linux was not run): The Smurfs - Dreams (PPSA21607, Unreal Engine), CachyOS, RX 6650 XT / RADV Mesa 26.2.4, main 9f25d0b + this PR + #6208 (APS5_PIPELINE_DMA=1) + unrelated local rendering fixes. Same spot in the Smurfs' Village, standing still, APS5_PROFILE_DRAW=1, A/B with APS5_PIPELINE_DRAIN_SAMPLE_DUMPS=1:

  • Drained: 14.5k packet drains per 10 s (3.6 s), 7.7k of them EVENT_WRITE (0x46); 79–81 presents per 10 s.
  • This PR: 6.7k drains (3.3–3.4 s), no EVENT_WRITE drains left; 75–78 presents per 10 s.

So it works here: no rendering differences, no aborts, and every dump drain is gone. There is no frame-rate win in this title, though. The draw pipeline is committer-bound (~110k commits per 10 s at ~79 us each), and the remaining drains (DISPATCH_DIRECT x3.8k, WAIT_REG_MEM x2.2k) wait for the same committer. The GPU is busy ~42 ms and idle ~85 ms per frame.

AI-assisted (Claude Code).

@teepean

teepean commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

@Nesyth a Linux and NVIDIA data point, from a title that wraps most of its draws in occlusion queries: Stray (PPSA02100, Unreal Engine 4) at the same save, standing still. Linux 7.2 (CachyOS, scx_lavd scheduler), Ryzen 9 9950X, RTX 3090 (NVIDIA 615.78.08), GCC 16.2.1, Release, 3840x2160; main 864729d with and without this PR (327a2bb), stock settings, one run at a time, alternating.

With APS5_PROFILE_DRAW=1, one run each, mean of the last 8 windows of 10 s:

0x46 drains / 10 s all packet drains / 10 s (wait) commits / 10 s, µs each on the committer
main 117,776 125,500 (1,713 ms) 370k, 18.1
this PR 0 8,085 (697 ms) 503k, 14.8

Frame p50 from trace summaries (APS5_TRACE_SECONDS=185:20, no other variables): main 170.5, 172.6, 165.0 and 171.2 ms; this PR 167.8, 171.1 and 157.7 ms. A fourth run of this PR hit the #5372 import race (about 1 fps for the whole window) and is left out. The profiled pair above: 168.4 and 155.3 ms.

So queue 0 no longer drains for the dumps, and its drain wait falls by about 1 s per 10 s, but the frame time falls by less than that (about 2.5 %, within the spread between runs). In this scene queue worker 0 is about 97 % busy and the committer, which now also records the dumps, goes from about 67 to 74 % busy, so the two threads still pace each other. I didn't compare frame dumps for this PR.

With #6946 on top, the queued dumps drain that PR's draw finisher instead, because its keepsDrawPipeline still treats 0x46 sample dumps as drains. The numbers are on #6946: #6946 (comment)

AI-assisted: yes (analysis and text with Claude Code; the runs are from my machine).

@JJenkx

JJenkx commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Linux validation of #6501 at 327a2bb7f7ed36b3d2d02d1221a72ece2bad4918, integrated into a local Crimson Spires composition based on main c8e3fcb703852e0b256f708fdf47360ee895625a (also includes existing title prerequisites and #6616). This is not a clean main-versus-PR comparison.

Both agc_driver_pipelined_sample_dump variants pass without skips on RX 6650 XT/RADV and lavapipe (2/2 per driver). Two warm native runs also reach the first driving/dialogue scene and close normally. Their sampled screenshots show no obvious new rendering issue; this does not establish full gameplay correctness.

Same compiled integration 328ecb92f21f885e706ebf7f3f57b1163569c07f, 3840×2160 internal rendering, same scripted input, official 20-second trace at 90 seconds after first present. A sets APS5_PIPELINE_DRAIN_SAMPLE_DUMPS=1; B leaves it unset. Linux 7.2.9, RADV Mesa 26.2.4, RX 6650 XT. No trace events dropped.

Measurement A: drained B: queued
Presents 173 184
Capture (ms) 20026.672 20036.923
Frame p50 (ms) 83.907 84.684
Frame p90 (ms) 287.949 239.905
Frame p99 (ms) 337.433 282.557
GPU busy per present (ms) 83.393 84.089

One sequential pair only: median and GPU time are essentially unchanged, with lower tail times in B. This is exploratory evidence, not a repeatable FPS improvement claim. Screenshots have the same dialogue/scene, but the animated road/camera are not frame-identical. Windows and other titles were not tested here.

Official trace_digest summary records
{"commit": "328ecb92f21f", "dirty": false, "env": {"APS5_DRAW_CACHE_ENTRIES": "4096", "APS5_HOST_IMPORT_MIB": "16384", "APS5_PAD_INPUT_FILE": "<path>", "APS5_PIPELINED_DRAWS": "1", "APS5_PIPELINE_DRAIN_SAMPLE_DUMPS": "1", "APS5_PLAYGO_UNLISTED_CHUNKS": "installed", "APS5_TRACE_EVENTS": "524288", "APS5_TRACE_SECONDS": "90:20"}, "gpu": "AMD Radeon RX 6650 XT (RADV NAVI23)", "driver": "radv Mesa 26.2.4-arch1.1", "os": "Linux 7.2.9-arch1-1", "resolution": "3840x2160", "window": {"spec": "seconds 90:20", "first_present": 1443, "ms": 20026.672}, "presents": 173, "frame_ms": {"p50": 83.907, "p90": 287.949, "p99": 337.433, "max": 338.387}, "gpu_busy_ms_per_present": 83.393, "worker_busy_pct": {"queue worker 0x0": 95.946, "queue worker 0x20": 80.474}, "top_phases_ms_per_frame": {"Driver.Packet": 203.751, "Driver.Packet.memory_wait": 88.588, "Driver.Packet.prepare_memory": 45.645, "Graphics.Draw": 44.02, "Graphics.Draw.draw_and_resource_release": 41.747, "Driver.Packet.device_lock": 29.938, "Driver.Packet.draw": 25.95, "Driver.Draw": 25.805}, "trace_dropped": false, "trace": "aps5-trace-328ecb92f21f-3903990.json.gz"}
{"commit": "328ecb92f21f", "dirty": false, "env": {"APS5_DRAW_CACHE_ENTRIES": "4096", "APS5_HOST_IMPORT_MIB": "16384", "APS5_PAD_INPUT_FILE": "<path>", "APS5_PIPELINED_DRAWS": "1", "APS5_PLAYGO_UNLISTED_CHUNKS": "installed", "APS5_TRACE_EVENTS": "524288", "APS5_TRACE_SECONDS": "90:20"}, "gpu": "AMD Radeon RX 6650 XT (RADV NAVI23)", "driver": "radv Mesa 26.2.4-arch1.1", "os": "Linux 7.2.9-arch1-1", "resolution": "3840x2160", "window": {"spec": "seconds 90:20", "first_present": 1207, "ms": 20036.923}, "presents": 184, "frame_ms": {"p50": 84.684, "p90": 239.905, "p99": 282.557, "max": 295.386}, "gpu_busy_ms_per_present": 84.089, "worker_busy_pct": {"queue worker 0x0": 95.924, "queue worker 0x20": 86.563}, "top_phases_ms_per_frame": {"Driver.Packet": 198.278, "Driver.Packet.memory_wait": 88.679, "Driver.Packet.prepare_memory": 45.905, "Graphics.Draw": 36.954, "Graphics.Draw.draw_and_resource_release": 34.672, "Driver.Packet.device_lock": 24.974, "Driver.Packet.draw": 23.21, "Driver.Draw": 23.063}, "trace_dropped": false, "trace": "aps5-trace-328ecb92f21f-3948830.json.gz"}

AI-assisted: yes.

@m335671

m335671 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Windows / NVIDIA / Unreal Engine 5 data point: Sword of the Sea (PPSA25344), Windows 11 26200, RTX 4070 12 GB, NVIDIA 617.42, Ryzen 9 7900, 3840x2160.

Build: main 36f60df9e + #6763 + this PR (327a2bb7f), merged locally. There were two textual conflicts with current main, and I kept both sides of each:

  • PacketExecution.cpp: main's !submission.flips.contains(cursor) and this PR's enqueueSampleDumpPacket(...), in the same condition;
  • CMakeLists.txt: two independent test registrations.

On that merge agc_driver_pipelined_sample_dump and agc_driver_pipelined_sample_dump_drained pass. A/B on the same binary:

  • baseline: APS5_PIPELINE_DRAIN_SAMPLE_DUMPS=1;
  • candidate: this PR's default.

Both runs used APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1 APS5_TRACE_SUMMARY_EVERY=10 APS5_THREAD_PRIORITY=high and a warm shader cache, over the same path: title screen, opening cinematic, then about 1 min in game. Both had a Discord stream running.

The mechanism works. This title issues a sample dump about every draw. In the opening cinematic ([draw] pipelined, per 10 s):

drained (baseline) queued (this PR)
packet drains ~147 000 (~2.3 s) ~8 700 (~1.5 s)
of which 0x46 (sample dumps) ~140 000 0
commits ~190 000 at ~19 µs ~344 000 at ~13 µs

But the frame time does not move, because this title stays CPU-bound on queue 0. The figures are medians over each scene's 10 s summary intervals:

Scene frame p50 (drained → queued) queue worker 0x0 busy
Title screen 72.4 → 72.8 ms ~98 % in both
Opening cinematic 234.6 → 254.4 ms ~99 % in both
In game 418.0 → 406.0 ms ~98 % in both

Between identical runs of this title I measure about ±6 % of noise in the cinematic, so all three rows are within noise. In the summaries, the worker time the drains no longer take reappears in Driver.Packet.draw: +11.6 ms per frame in the cinematic and +19.5 ms in game. Driver.Packet.dispatch drops by 9.7 ms in the cinematic. My guess is that queue 0 and the committer now meet on the same locks more often, but I have not traced that.

tools/performance_compare.py, in-game interval (baseline = drained, candidate = queued)
Metric Baseline Candidate Change Change (%)
frame_ms.p50 417.978 405.986 -11.992 -2.869
frame_ms.p90 437.835 421.754 -16.081 -3.673
gpu_busy_ms_per_present 161.773 173.682 +11.909 +7.362
Driver.Packet 725.609 713.618 -11.991 -1.653
Driver.Packet.draw 179.815 199.323 +19.508 +10.849
Driver.Packet.dispatch 141.742 139.234 -2.508 -1.769
Driver.Packet.memory_wait 262.408 271.092 +8.684 +3.309

So on this title the PR removes a real serialization point (sample-dump drains go from ~140k to 0 per 10 s). The frame rate is bound by the single queue-0 worker plus the single committer. I'll post the wider picture in #5436.

AI-assisted: yes (Claude Code). The build, the runs and this comment were done and written by Claude Code on my machine.

@Rajkamalcode

Copy link
Copy Markdown
Contributor

Windows / NVIDIA / SWAG data point (Squirrel with a Gun, PPSA22102, Unreal Engine, RTX 3070 8 GB, Windows 11)

Build: cherry-pick of 327a2bb7f onto a local base (448cf78c6, the AGC storage write-back fix #7912 - the same base my other SWAG runs used), not a rebase to main. The same two conflicts as @m335671, resolved the same way (kept both sides in PacketExecution.cpp, both test registrations in CMakeLists.txt).

Tests: agc_driver_pipelined_sample_dump and agc_driver_pipelined_sample_dump_drained pass on Windows/NVIDIA (2/2, no skip, RTX 3070).

A/B: same save and scripted input; 6-minute runs in the title's heavy state (~1 FPS, 0.9-1.1 s frames); APS5_PROFILE_DRAW=1 only. Baseline is the driver build this title had been running on (same source base, pre-PR); the steady-state baseline band across three earlier runs on this save is 9-12 presents/10 s.

per 10 s, steady baseline (pre-PR) this PR (queued)
presents 9-10 9-10
[draw] commits 16.5-17k at ~250-260 us 17.9-19.4k at ~210-247 us
Enqueue room wait / draw 96-105 us 71-115 us
packet drains 7.7-8.2k (2.1-2.2 s) 3.7-4.0k (2.1-2.3 s)
of which 0x46 3.3-3.4k 0
GPU busy / idle per frame 487 / 579 ms 543 / 643 ms

The mechanism works here too: 0x46 drains go to zero and packet drains drop by about half, with no correctness issue seen in the run. Frame time stays in the same 9-10 presents band - this title's heavy state is bound by the single committer's recording chain (readTarget ~1,020 ms and resource builds ~945 ms per 10 s of a ~0.9 s frame), not by sample-dump drains, so no FPS change was expected. Commit count per 10 s rises while per-commit cost falls, consistent with @m335671's observation that queue 0 and the committer meet on the same locks more often.

Run environment

Profile logs from APS5_PROFILE_DRAW=1, 360 s each, steady windows from the 2nd-6th minute:

  • [draw] PR window: 19424 commits at 214.9 us each ... waiting 74.3 us per draw for room; drains: packet 3962 (2339.6 ms); packet drains by opcode: 0x50 x1603 0x15 x1111 0x3c x954 0x16 x241 0x10 x26
  • [draw] baseline window: 16640 commits at 251.2 us each ... waiting 96.6 us per draw for room; drains: packet 7798 (2176.4 ms); packet drains by opcode: 0x46 x3384 0x50 x1728 0x15 x1183 ...
  • [draws] PR window: 7668 draws over 10 s ... readTarget=1016.5ms (8999 resident lookups, 193 of them >= 1 ms = 852.4 ... pages walked 3750210), resources=945.0ms, record=233.7ms
  • [sync] PR tail: 786 device drains by packet: DMA_DATA=786 (this counter is device drains; the 0x46 sample dumps are what stopped draining).

AI-assisted: yes (the build, the runs and this text were produced by an AI-assisted workflow on the reporter's machine).

moong15 added a commit to moong15/AnyPS5 that referenced this pull request Oct 20, 2026
… pipelined draws

Ports boykopovar#6501 (Nesyth, 327a2bb) onto the perf branch.
A queue-0 EVENT_WRITE ZPASS_DONE dump is enqueued in the draw pipeline as
an ordered item that declares its 248-byte write, instead of draining the
pipeline. APS5_PIPELINE_DRAIN_SAMPLE_DUMPS=1 restores the drain.

Port changes: kept the flip-cursor guard on the enqueue condition, kept
copiesBehindPendingSources next to the new sampleDumpsQueued counter, and
added the missing %llu so the [sync] line prints the queued dump count.
Added the ENVIRONMENT.md row for the switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milescoviello

Copy link
Copy Markdown
Contributor

An Unreal title data point on Linux: Super Meat Boy 3D (PPSA31162), level 1-1, RTX 4070 Ti (NVIDIA 595.99.02), Ubuntu 24.04, Release.

Setup: main 30fda0a against the same main with this PR merged (327a2bb7f). I resolved the conflicts by keeping both sides: the extra flips check in PacketExecution.cpp, both test registrations, both counters. Each run starts from a fresh boot. A script waits for the game's own Load map complete lines (menu, slot 1, world map, level 1), settles for 30 s in the level and then counts presents for 60 s with APS5_PROFILE_DRAW=1. Each build had its own shader cache, and the second run of each is warm.

Build Presents per 10 s in the level EVENT_WRITE 0x39 drains per 10 s Draw commits on the committer
main (2 runs) 16–19 48,000–57,000 63–75 µs each
main + this PR (2 runs) 45–52 0 10.5 µs each

That's about 2.9×. With this PR the GPU is busy about 100 ms per frame, out of about 190 ms. On main it's 135 ms out of 590 ms, and the draw pipeline averages 1.3 items queued, against about 5 with the PR.

One note for comparison. This title bundles its own libc.prx, and #7897 alone gives about the same gain here (51 presents per 10 s), through a different cost: it brings the per-commit time down to 16 µs while the dumps still drain. With both PRs merged I measured 48 and 32 presents per 10 s in two runs, so I saw no further gain from combining them. I haven't explained the lower second run.

AI-assisted: yes (Claude Code)

@oneandonlydean oneandonlydean self-assigned this Oct 20, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Nesyth thanks for this. It now conflicts with current main in code, not just adjacent lines: SynchronizationStatistics.hpp/.cpp and PacketExecution.cpp (plus CMakeLists.txt). Could you rebase it onto current main? Once it's rebased we'll run CI and measure it against main.

@xXPBSXx

xXPBSXx commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

@Nesyth: the maintainer asked on 20.10. for a rebase onto current main, since the branch conflicts in SynchronizationStatistics.hpp/.cpp, PacketExecution.cpp and CMakeLists.txt. I prepared a branch with that rebase, so you can take it over or drop it: carry/6501-occlusion in xXPBSXx/AnyPS5, two commits on main 0db47b263d. Your commit keeps your authorship; the second commit is mine.

How the conflicts were resolved (both sides kept):

  • CMakeLists.txt: main added the agc_driver_image_srgb_sample_copy_forced and agc_driver_graphics_maps_fallback tests next to your agc_driver_pipelined_sample_dump_drained; all three stay.
  • SynchronizationStatistics.hpp/.cpp: main added copiesBehindPendingSources; it stays, sampleDumpsQueued is appended to the counters and to the [sync] arguments.
  • PacketExecution.cpp: main added !submission.flips.contains(cursor) to the queue condition and, since perf(agc): draw finisher pipeline (APS5_DRAW_PIPELINE) #6946, declares predicated earlier in the loop; both stay, your second declaration of predicated is dropped, and enqueueSampleDumpPacket(...) is appended to the || chain.
  • The second commit adds the row for APS5_PIPELINE_DRAIN_SAMPLE_DUMPS to docs/dev/ENVIRONMENT.md; tools/check_conventions.py reports its absence as an error on your commit.

Measured on Windows 10 19045, WinLibs GCC 15.2.0, Release, GPU from the log line Selected GPU name=NVIDIA GeForce RTX 4080 SUPER vendor=0x10de device=0x2702 (ANYPS5_GPU=4080): the 25 tests of ctest -R "agc_driver_(pipelined|finisher_label|same_queue_label|draw_pipeline_trace|unimported_label|alias_copy_label)" pass in 3 of 3 runs, among them agc_driver_pipelined_sample_dump and agc_driver_pipelined_sample_dump_drained. tools/check_conventions.py --base upstream/main passes.

Also run in a separate run on WSL2 Ubuntu 24.04 (virtualised kernel, not bare-metal), GCC 13.3, Release, with Selected GPU name=llvmpipe (LLVM 20.1.2, 256 bits) vendor=0x10005 device=0x0 (a software rasteriser, not a real GPU): agc_driver_pipelined_sample_dump, agc_driver_pipelined_sample_dump_drained, agc_driver_draw_pipeline_trace and agc_driver_draw_pipeline_trace_disabled pass, 4 of 4. Without the five source files of your commit and with your test kept, the test build stops with the compiler error 'sampleDumpsQueued' is not a member of 'AgcDriver::DriverDetail'; that is a compile failure, not a failed assertion.

Not measured: any change in speed (the perf label needs two summary lines with different commits in the description), macOS, a second real GPU, the rest of the agc test family, and a failing assertion without the change.
One observation, left as it is: the [sync] format string has no placeholder for sampleDumpsQueued, so the new counter is passed but not printed.

Your PR stays yours: if you push the rebase, I will drop mine. Otherwise I can open mine as "based on its head" after 24 h without an answer.
AI-assisted (Claude Code).

@Nesyth
Nesyth force-pushed the perf/agc-pipelined-sample-dumps branch from 327a2bb to 6355539 Compare October 24, 2026 09:01
@github-actions

Copy link
Copy Markdown

This pull request is labeled perf, so it needs the summary line of a capture on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

@Nesyth
Nesyth marked this pull request as ready for review October 24, 2026 09:02
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@blawesom

Copy link
Copy Markdown
Contributor

Static review plus an independent Linux/AMD run on both trees per the repo AGENTS AGC protocol (CachyOS, kernel 7.2.10, GCC 16.2.1, Ninja 1.13.2, Release, BUILD_TESTING=ON, Ryzen 7 9800X3D). No findings.

What I checked

  • The change moves the occlusion-counter dump onto the pipelined-draw path so the queue isn't drained to service a dump request. SynchronizationStatistics/PacketExecution/PacketMemory additions follow the existing pipelined-pass enqueue pattern; the Driver.hpp shape change is additive.
  • The two dump fixtures in tests/execution/PipelinedSampleDump.cpp cover both orders: dumps behind pipelined draws (queue drains only at real sync points) and the not-drained path staying synchronous. The ENVIRONMENT.md entry documents the new knob with the same table format as its neighbours.

Paired test runs (AGENTS AGC protocol, VVL env)

The PR's own fixtures don't exist at main's base, so the paired surface is the pre-existing pipelined fixtures (agc_driver_pipelined_dispatch, agc_driver_pipelined_dma, agc_driver_pipelined_dma_draw_pipeline, agc_driver_pipelined_dispatch_item), which exercise the same queue/enqueue path the change touches:

test this head 6355539478 main bb04a4f1ea
agc_driver_pipelined_dispatch Passed (0.48s) Passed (0.47s)
agc_driver_pipelined_dma Passed (0.01s) Passed (0.01s)
agc_driver_pipelined_dma_draw_pipeline Passed (0.01s) Passed (0.01s)
agc_driver_pipelined_dispatch_item Passed (0.07s) Passed (0.07s)
agc_driver_pipelined_sample_dump (new) Passed (0.50s) (new in this PR)
agc_driver_pipelined_sample_dump_drained (new) Passed (0.06s) (new in this PR)

All three logs (head pair, main pair, and the new fixtures): 0 was not found but was requested by env var VK_INSTANCE_LAYERS, 0 VUID-. Comparing logs, no new errors introduced by this change.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 30, 2026
@fogydes

fogydes commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

stale+rebase

1. Freshness Envelope

  • Head SHA: 63555394784d60204669acaa94c66f8bec45feb2
  • Merge-base SHA: aeeaefad98613c63a49ea2daae4d4558304b14cd
  • Behind origin/main: 6,748 commits
  • Merge-tree status: exit code 1 (conflict against origin/main in core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp)

2. Findings

  1. [verified] Merge conflict requires rebase: git merge-tree --write-tree origin/main 63555394784d60204669acaa94c66f8bec45feb2 exits with code 1 due to a conflict in core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp.
  2. [verified] Conventions clean against merge-base: python tools/check_conventions.py --base aeeaefad98613c63a49ea2daae4d4558304b14cd in an isolated scratch worktree reported 0 findings.
  3. [read-only] Missing checklist line: The PR description omits the required Fixes: line from .github/pull_request_template.md.
  4. [author-reported] Thorough performance evidence providing both aps5-summary.jsonl lines and tools/trace_digest.py summaries on Ready or Not (PPSA18605).
  5. [author-reported] Validation layer evidence reported across 28 focused pipeline/query tests under VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, confirming 0 new VUID- errors.

3. Cross-PR Ledger

@JJenkx

JJenkx commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Prepared a linear rebase of 63555394784d60204669acaa94c66f8bec45feb2 onto main ed1e0ed08fc2452192df91793a33dd0cc7ad5212 for review:

  • Help branch, exact commit 245adae02763bf531a921c1168972f6b38f85c50; one commit on main, original Nesyth author/date/message preserved.
  • The retained manual resolution in PacketExecution.cpp keeps main's if (!predicated) noteLabelIssue(packet, submission.queue);, then appends enqueueSampleDumpPacket(...) to the admission condition. This replay onto ed1e0ed applied cleanly; conventions against the latest observed main and whitespace pass.
  • Pinned-main build and GPU checks: fresh independent Release source/dependency checkouts; libSceAgcDriver and the focused dispatch/DMA executables build and link on main. The change additionally builds the sample-dump executable. On the same RX 6650 XT/RADV host, four shared Vulkan cases pass on both arms, plus both added sample-dump cases on the change: main 4/4, change 6/6, zero skips/failures/VUIDs. Khronos validation and real-GPU selection are verified in the logs (4/8 instance-layer insertions); shader caches are disabled. SPIRV-Tools and timing logs are disabled on both arms. This qualifies these selected production/test targets, rather than an all-target build; no native-title/Windows performance result on this rebased head is claimed.
git fetch https://github.com/JJenkx/AnyPS5.git help/occlusion6501-mained1-20261030
git switch -c review-6501 FETCH_HEAD

The tested branch also has a clean source-only merge preview onto subsequently observed main 556547da71c5e25b742f17b1ed9b27253b6e9d4d (tree 4acf87534732da511b7b093b6c1fb304efdc18d4); that is not runtime qualification on that later main.

Fresh pinned-main build logs, both verbose Vulkan/JUnit results, source replay/range-diff, commands and excluded setup receipts, SHA-256 d9474d464d70e1f0b27561cf440c254c43db6f766687a938307a66f0f2d70a5c (download verified). The initial invalid-target and missing-layer-path attempts are retained as excluded host setup failures; only the corrected runs above count.

Separate earlier Ikai PPSA06584 diagnostics used private baseline f3d92877371bf3cc3f61618da912ce24c1561338 (main f7f03daf52f11191174b1be089a56e268390a707 plus #6959/capture diagnostics) against e52a675f435eee87deb9c059cc51cf9d71ce2796 (same stack plus this exact topic). All 270-second native runs closed normally; the paper/brush scene was reviewed, including matching compositor/X11 captures on the repeat. This is a private-stack diagnostic, distinct from the current-main rebase above.

Run, 180:30 window Presents Window ms FPS p50 / p99 ms GPU busy ms/present
Baseline repeat 644 30035.924 21.441 46.376 / 53.625 31.529
Topic, first run 653 30019.309 21.753 45.423 / 56.874 31.227
Topic, repeat 724 30025.458 24.113 41.329 / 47.876 30.646
Reverse-order baseline 720 30007.060 23.994 41.602 / 46.209 30.739

Same RX 6650 XT / RADV Mesa 26.2.4 / Linux 7.2.9, 3840×2160, fresh saves/config seed/cache controls, no dropped traces. The older private stack also passed four shared focused Vulkan tests on both arms and the two added sample-dump cases on the topic, with Khronos validation loaded and no VUIDs. Native timing runs had validation disabled after that gate. The reverse-order baseline completed at 23.994 FPS, essentially matching the 24.113 FPS candidate repeat (about 0.5% apart). No reproducible Ikai FPS improvement is established by this comparison; the current-main source rebase above remains useful independently.

Earlier historical da026 source replay/syntax and separately scoped numeric diagnostic evidence, SHA-256 6a310fa87dfc0e2c42fe6916e840d2538dfa8751bf02fde221f71d71656a16bc (download verified). Raw game assets, screenshots, memory/shader dumps, and private profiler data are excluded.

AI-assisted rebase and qualification: Codex. Original public branch is unchanged; no replacement PR opened.

Reverse-order baseline digest and post-window CPU-profile metadata, SHA-256 e2ca51daa287ef0cb2e07ade5e2d576fde79a7449a7af37713cc59ca412b94fb (download verified). The ten-second CPU recording began at 235.34 s after native PID detection, after the 180:30 trace had flushed; native exit remained 0. Raw private profiler data is excluded.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Nesyth we merged current main into this branch (fast-forward, no force push) so it can be tested against today's main. The one conflict was in Driver/Packets/PacketExecution.cpp near line 277: we kept main's if (!predicated) noteLabelIssue(...) line together with your pipelined label, DMA and sample-dump condition; please check that resolution reads as you intended.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head b37c98c merged onto main 9f748f4 · tested 2026-10-30 18:45 UTC · 24 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,396 passed · 4 failed (0 new, 2 also fail on main, 2 unstable on main) · 42 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,442 of 3,021 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (912 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 47.1 s, ⚠️ agc_driver_graphics_maps_fallback 30.9 s
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)
agc_submit_progress: failed in 5 of the last 9 main runs
agc_submit_progress_no_timeline: failed in 7 of the last 9 main runs
Failing on main too (2, not counted against this PR)
guest_mmap_executable
guest_socket_options_multicast
Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_job_manager_compute_capacity: Failed in the parallel run; also passed only on retry in 125 other runs in the last 7 days
Validated but not compared (1, not in the main baseline's validation pass)
agc_driver_pipelined_sample_dump_drained
Validation IDs already present on main (4 IDs in 425 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (425 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_array_layer_target_cpu, agc_driver_bda_span_reads_draw_pipeline, agc_driver_bitfield_mask, agc_driver_buffer_atomic_csub, and 417 more
VUID-vkCmdCopyImage-srcImage-01548 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-vkCmdCopyImage-srcImage-01551 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (42)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fresh: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or plat
Reproduce
git fetch origin b37c98cdddf9bd18abefd1ef84519b33125399a9 9f748f4d8e36ce3714f3b95f3386316e110a9b22
git checkout 9f748f4d8e36ce3714f3b95f3386316e110a9b22 && git merge --no-ff b37c98cdddf9bd18abefd1ef84519b33125399a9
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 30, 2026
@JJenkx

JJenkx commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Windows measurement of this PR's exact head on a second title, which issues hundreds of occlusion counter dumps per frame. Afterimage (PPSA14053, UE4), intro cinematic at 3840x2160. Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, Radeon RX 6700 XT, AMD proprietary driver 26.10.1, WinLibs GCC 15.2.0 UCRT r7, Release.

Why this title: on a main-based build, the APS5_PROFILE_DRAW [draw] pipelined line showed about 58,000 packet drains per 10 s for opcode 0x46, all with event 0x39. They cost about 1.45 s per 10 s on the queue worker.

Setup:

  • Arms: main 1edecd693c (this PR's base) and this PR's head b37c98cddd.
  • Every library in both arms is built at 1edecd693c; only libSceAgcDriver.prx differs (diff -rq of the two library folders lists only that file).
  • Each run starts from a fresh save with the same scripted presses, with shader caches warmed by a run per arm, and the runs alternated main, PR, main, PR.
  • APS5_TRACE_SECONDS=120:5 is the only APS5_TRACE_*/APS5_PROFILE_* switch.
  • Both arms move through the intro at the same rate, and the screenshots inside the window show the same shot and caption in both arms ("Souls once flowing in the Stream are now lost beyond.").
  • No trace dropped events.

python tools/performance_compare.py --require-matching-context:

pair metric main this PR change
1 frame p50 / p90 ms 84.3 / 89.8 79.2 / 82.7 −6.0 % / −8.0 %
1 mean frame ms 85.1 79.6 −6.4 %
1 Driver.Packet ms per frame 83.1 77.6 −6.7 %
1 GPU busy ms per present 34.9 35.5 +1.7 %
2 frame p50 / p90 ms 86.2 / 90.8 82.3 / 86.6 −4.6 % / −4.7 %
2 mean frame ms 86.0 81.7 −5.0 %
2 Driver.Packet ms per frame 84.0 79.7 −5.2 %
2 GPU busy ms per present 36.1 35.5 −1.7 %

The gain is on the queue worker (Driver.Packet), with GPU time unchanged. Each pair covers 59–63 presents, so these are short windows. The intro rendered the same in both arms, and no run crashed.

Summary lines (pair 1 main, pair 1 PR, pair 2 main, pair 2 PR):

{"commit":"1edecd693c36","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:5"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"seconds 120:5","first_present":1937,"ms":5018.256},"presents":59,"frame_ms":{"p50":84.273,"p90":89.791,"p99":93.427,"max":93.427},"gpu_busy_ms_per_present":34.892,"worker_busy_pct":{"queue worker 0x0":97.765},"top_phases_ms_per_frame":{"Driver.Packet":83.109,"Graphics.Draw":50.231,"Graphics.Draw.draw_and_resource_release":47.714,"Driver.Packet.pipeline_drain":33.607,"Driver.Packet.draw":25.396,"Driver.Draw":25.156,"Driver.Draw.shader_compile_and_link":20.181,"Shader.DrawStage":17.860},"trace_dropped":false,"trace":"aps5-trace-1edecd693c36-857172.json.gz"}
{"commit":"b37c98cdddf9","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:5"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"seconds 120:5","first_present":1935,"ms":5013.598},"presents":63,"frame_ms":{"p50":79.202,"p90":82.652,"p99":86.150,"max":86.150},"gpu_busy_ms_per_present":35.486,"worker_busy_pct":{"queue worker 0x0":97.585},"top_phases_ms_per_frame":{"Driver.Packet":77.580,"Graphics.Draw":53.197,"Graphics.Draw.draw_and_resource_release":50.513,"Driver.Packet.pipeline_drain":27.119,"Driver.Packet.draw":24.873,"Driver.Draw":24.618,"Driver.Draw.shader_compile_and_link":19.588,"Shader.DrawStage":17.065},"trace_dropped":false,"trace":"aps5-trace-b37c98cdddf9-130396.json.gz"}
{"commit":"1edecd693c36","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:5"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"seconds 120:5","first_present":1877,"ms":5073.954},"presents":59,"frame_ms":{"p50":86.218,"p90":90.844,"p99":97.423,"max":97.423},"gpu_busy_ms_per_present":36.119,"worker_busy_pct":{"queue worker 0x0":97.860},"top_phases_ms_per_frame":{"Driver.Packet":84.042,"Graphics.Draw":55.940,"Graphics.Draw.draw_and_resource_release":53.185,"Driver.Packet.pipeline_drain":34.163,"Driver.Packet.draw":25.270,"Driver.Draw":25.025,"Driver.Draw.shader_compile_and_link":20.504,"Shader.DrawStage":18.121},"trace_dropped":false,"trace":"aps5-trace-1edecd693c36-795152.json.gz"}
{"commit":"b37c98cdddf9","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:5"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"seconds 120:5","first_present":1958,"ms":5063.319},"presents":62,"frame_ms":{"p50":82.255,"p90":86.588,"p99":88.444,"max":88.444},"gpu_busy_ms_per_present":35.489,"worker_busy_pct":{"queue worker 0x0":97.620},"top_phases_ms_per_frame":{"Driver.Packet":79.654,"Graphics.Draw":54.544,"Graphics.Draw.draw_and_resource_release":51.808,"Driver.Packet.pipeline_drain":28.506,"Driver.Packet.draw":25.919,"Driver.Draw":25.667,"Driver.Draw.shader_compile_and_link":20.412,"Shader.DrawStage":17.919},"trace_dropped":false,"trace":"aps5-trace-b37c98cdddf9-204176.json.gz"}

Traces, summaries, digests, comparisons, screenshots, library hashes, the arm diff and the build and run scripts: afterimage-pr6501-ab-20261031.tar.gz, SHA-256 62055c5008d785d10c8ff6eff06f29cd502ba27a27bca58a543ac59f906882ed.

AI-assisted: yes (Claude Code).

@Nesyth
Nesyth force-pushed the perf/agc-pipelined-sample-dumps branch from 55f8363 to 2a66fdf Compare November 2, 2026 15:32
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
@Nesyth

Nesyth commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@oneandonlydean, an in-run A/B of this change in Ready or Not (PPSA18605), the measurement the separate sessions in the description could not resolve.

The build is this head 2a66fdf784 (main 92d2fdc343 merged in) plus a local change that registers APS5_PIPELINE_DRAIN_SAMPLE_DUMPS as an APS5_AB runtime switch; that change is not part of this PR. One boot then alternates this PR's queued dumps (A) with the drained path (B, main's behaviour) every 60 s: APS5_AB=60:APS5_PIPELINE_DRAIN_SAMPLE_DUMPS APS5_AB_START=120s, about 12 minutes in one scene per boot, no trace or profile switch.

boot presents / 10 s, A (this PR) B (drained) B vs neighbouring A, tools/ab_split.py frame ms, A / B
1 130.60 128.29 -2.63 ± 0.50 (SD 1.11, n 5) 76.58 / 77.95
2 85.39 83.11 -2.55 ± 0.49 (SD 1.09, n 5) 117.16 / 120.32
  • Queuing the dumps gives +2.0 % and +3.1 % presents, about five standard errors each, at the two speeds the scene ran at in these boots (about 13 and 8.5 presents per second).
  • In the same scene, main 92d2fdc343 drains the draw pipeline about 68,000 times per 10 s (APS5_PROFILE_DRAW=1, [draw] pipelined), 56,000 of them for 0x46 sample dumps.

Windows 11 Pro build 26300, AMD Radeon RX 7900 XTX (AMD Software 26.10.1, driver 32.0.32015.7029), Ryzen 7 7800X3D, WinLibs GCC 15.2.0, Release, 3840x2160.

Your 10-30 resolution in PacketExecution.cpp reads as intended. Today's merge of main only moves the agc_driver_pipelined_sample_dump_drained registration into tests/cmake/agc_driver_pipelined_sample_dump_tests.cmake.

CPritch pushed a commit to CPritch/AnyPS5 that referenced this pull request Nov 2, 2026
CPritch added a commit to CPritch/AnyPS5 that referenced this pull request Nov 2, 2026
With boykopovar#6501 an occlusion counter dump (EVENT_WRITE 0x39) that can be queued goes into the queue-0 pipeline as an
item, but the packet loop still drained a busy draw finisher first, as for every packet outside the finisher's
list (boykopovar#6501's follow-up). A dump that sampleDumpQueues accepts is now beside the finisher, like a queued label,
and its item reaches the pipeline through the finisher behind the draws it holds. The committer counts the items
as "occlusion dump".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5PfRVDY7NuVGTkA5jhVce
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 2a66fdf merged onto main 1d91f29 · tested 2026-11-02 21:13 UTC · 33 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,677 passed · 6 failed (0 new, 3 also fail on main, 3 unstable on main) · 45 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,728 of 3,544 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (985 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ agc_driver_graphics_maps_fallback 31.7 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 3 of the last 10 main runs
agc_submit_progress: failed in 8 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 7 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validated but not compared (2, not in the main baseline's validation pass)
agc_driver_pipelined_sample_dump
agc_driver_pipelined_sample_dump_drained
Validation IDs already present on main (4 IDs in 512 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (512 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 504 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
Skipped (45)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fps_limit: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_o
Reproduce
git fetch origin 2a66fdf784f77f28d104402e0f1c4bad14616748 1d91f2966d0eef82a021628a7aa8e78e615ac807
git checkout 1d91f2966d0eef82a021628a7aa8e78e615ac807 && git merge --no-ff 2a66fdf784f77f28d104402e0f1c4bad14616748
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 3, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 0d55ab0 merged onto main 1c8c0ef · tested 2026-11-04 05:59 UTC · 30 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,784 passed · 7 failed (0 new, 3 also fail on main, 4 unstable on main) · 50 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,841 of 3,842 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (953 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.3 s, ⚠️ public_headers 30.9 s
Unstable on main (4, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 4 of the last 10 main runs
agc_driver_submit_progress: failed in 4 of the last 10 main runs
agc_submit_progress: failed in 5 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 4 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (8 IDs in 529 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (529 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 521 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
VUID-VkSamplerCreateInfo-addressModeU-01079 (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeU-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeV-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeW-parameter (1 test): agc_driver_image_gather_volume
Skipped (50)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
vide
Reproduce
git fetch origin 0d55ab0a9a1dc0e9925bafe5b2d397792fc13157 1c8c0efc8c41314402e6966da5bef6ea3d639d10
git checkout 1c8c0efc8c41314402e6966da5bef6ea3d639d10 && git merge --no-ff 0d55ab0a9a1dc0e9925bafe5b2d397792fc13157
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build perf Performance change

Projects

None yet

Development

Successfully merging this pull request may close these issues.