Skip to content

perf(agc): hold 65536 draw-cache entries by default - #21467

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
klosixgaming-arch:perf/agc-draw-cache-entries
Nov 17, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
klosixgaming-arch:perf/agc-draw-cache-entries

Conversation

@klosixgaming-arch

Copy link
Copy Markdown
Contributor

What

The draw cache is bounded twice: by entry count (APS5_DRAW_CACHE_ENTRIES, default 4096) and, since #9129, by the bytes its variants hold (APS5_DRAW_CACHE_BYTES, 256 MiB). A title that cycles through more than 4096 distinct draw keys before a key repeats evicts each entry under LRU before it is used again, so its draws are captured, recompiled and prepared again every frame while the byte budget is mostly unused.

This raises the default entry count to 65536. The byte budget is unchanged and still bounds what the cache holds; APS5_DRAW_CACHE_ENTRIES=4096 restores the previous default. Entries hold host memory only (decodes, captured words, recompile results; recipes keep weak_ptrs to Vulkan objects), so the larger count adds no GPU memory. Things that scale with the count:

  • the key and shape sighting tables used for admission are sized entries * 4 keys: 2 MiB each instead of 128 KiB;
  • the donor age limit in Draw.cpp and DrawLookup.cpp (drawCacheEntries() / 8 hits) goes from 512 to 8192 hits.

Anger Foot (PPSA29043), first level, about 7,800 draws per frame (APS5_PROFILE_DRAW=1 with APS5_TRACE_DRAW_CACHE=1, 10 s lines, warm run; same main binary, the second line with APS5_DRAW_CACHE_ENTRIES=65536):

entries 4096 entries 65536
draw-cache hits 13150 of 176789 (7.4 %) 121209 of 213556 (56.8 %)
misses: evicted / seen but never inserted 15378 / 71953 2 / 335
entries held 4096, ~9 MiB 65536, ~145 MiB
queue worker per draw packet 47.1 us 37.4 us

ENVIRONMENT.md's row gives the new default. New execution test agc_driver_draw_cache_capacity: 4352 distinct draws submitted three times (the first pass sights each key, the second inserts it, the third must hit all 4352 under the default cap).

Tested

Ubuntu 26.04.1 (Linux 7.0.0-43), NVIDIA GeForce RTX 2080 Ti (595.99.02), Xeon E5-2699 v3, GCC 15.2.0 Release. main e04bd77 and this branch 96e5323 built in separate trees.

Speed. Anger Foot (PPSA29043 01.000.000), run with tools/title_run.py --runs 2 --seconds 170 and APS5_TRACE_SECONDS=120:10, relinked with --registry --module-dir Media/Modules --module-dir Media/Plugins, Cross pressed at 32, 40 and 48 s. In the warm run the presses reach the first level and the player stands still; the window starts 120 s after the first present. In the cold run the third press falls into a load and the run stays on the main menu. Rounds in order base, change, change, base:

round build warm run, first level (window) warm run, level intervals 112-155 s (presents / 10 s) cold run, main menu (window)
1 main 25 presents, p50 409.0, p90 427.6, p99 435.3 ms, GPU 95.2 ms 25 25 26 26 26 63 presents, p50 158.9 ms
2 this PR 26 presents, p50 405.1, p90 444.7, p99 467.4 ms, GPU 94.4 ms 27 28 30 28 28 78 presents, p50 127.3 ms
3 this PR 29 presents, p50 360.8, p90 434.0, p99 455.8 ms, GPU 79.0 ms 31 29 29 30 31 77 presents, p50 126.5 ms
4 main 25 presents, p50 407.7, p90 428.8, p99 491.5 ms, GPU 101.7 ms 26 25 26 26 26 55 presents, p50 183.6 ms
  • First level: the two main windows agree within 2 ms. The change's round 2 window is within that noise (26 presents, p50 405.1 ms); round 3 has 29 presents and a p50 12 % lower. The cache keeps filling during the level: every 10 s interval of the change from 112 s on (27 to 31 presents) is above every main interval (24 to 26), about +10 to +17 %.
  • Main menu: 77 and 78 presents per 10 s against 55 and 63, p50 127 ms against 159 and 184 ms.
  • The queue worker's trace buffer filled 3.4 s into each 10 s window (trace_dropped), so the digests' slice tables cover the retained part; the summary numbers are complete.

Traces, every window's summary line and the digests: https://github.com/klosixgaming-arch/AnyPS5/releases/tag/perf-captures-2026-11-16

Summary line, round 1, main, warm
{"commit":"e04bd77e7f6c","dirty":false,"env":{"APS5_DUMP_FRAMES":"100000","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"8","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz","cpu_threads":36,"memory_mib":124344,"title_id":"PPSA29043","title":"Anger Foot","content_version":"01.000.000","resolution":"1920x1080","window":{"spec":"seconds 120:10","first_present":922,"ms":10148.578},"presents":25,"frame_ms":{"p50":408.958,"p90":427.565,"p99":435.341,"max":435.341},"gpu_busy_ms_per_present":95.205,"worker_busy_pct":{"queue worker 0x0":96.263},"phase_totals_ms":{"Driver.Completion":0.059,"Driver.Dispatch":447.856,"Driver.Dispatch.capture_resources":42.922,"Driver.Dispatch.decode_key_device_setup":48.854,"Driver.Dispatch.lookup_cache":22.456,"Driver.Dispatch.materialize":8.008,"Driver.Dispatch.prepared_invocation":8.01,"Driver.Draw":8319.892,"Driver.Draw.device_setup":724.569,"Driver.Draw.draw_enqueued":1097.628,"Driver.Draw.post_compile_prepare":108.854,"Driver.Draw.prepare":913.646,"Driver.Draw.shader_compile_and_link":5325.758,"Driver.EndSubmission":0.113,"Driver.Packet":9769.159,"Driver.Packet.device_lock":30.19,"Driver.Packet.dispatch":576.827,"Driver.Packet.draw":8456.787,"Driver.Packet.execute":198.825,"Driver.Packet.flip_flush":0.909,"Driver.Packet.flush_between_packets":125.156,"Driver.Packet.memory_wait":1.488,"Driver.Packet.pipeline_drain":62.66,"Driver.Packet.pipeline_prepare":112.186,"Driver.Packet.prepare_memory":88.751,"Driver.Packet.rendering_wait":0.031,"Driver.Present":65.963,"Driver.Present.acquire_image":2.764,"Driver.Present.device_setup":0.038,"Driver.Present.gpu_mutex_wait":0.101,"Driver.Present.inflight_wait":0.183,"Driver.Present.present_display_buffer":4.99,"Driver.Present.queue_present":13.521,"Driver.Present.release_and_callback":0.063,"Driver.Present.render_fence_wait":44.168,"Driver.Present.resize":0.077,"Driver.Present.validate":0.023,"Driver.Suspend":0.018,"GpuMutex.wait.draw":4.241,"GpuMutex.wait.end":0.006,"GpuMutex.wait.flush":0.022,"GpuMutex.wait.label":0.006,"GpuMutex.wait.present":0.005,"GpuMutex.wait.wait":0.208,"Graphics.Draw":5927.552,"Graphics.Draw.draw_and_resource_release":4372.149,"Graphics.Draw.index_upload":420.676,"Graphics.Draw.validate":590.617,"Graphics.Draw.vertex_upload":453.858,"Graphics.DrawWithRecipe":322.538,"Graphics.DrawWithRecipe.draw_and_resource_release":237.715,"Graphics.DrawWithRecipe.index_upload":30.665,"Graphics.DrawWithRecipe.validate":16.35,"Graphics.DrawWithRecipe.vertex_upload":32.167,"Recorder.Reap":27.147,"Recorder.Submit":54.014,"Recorder.WaitSerial":0.261,"Resources.Complete":55.411,"Resources.Prepare":41.331,"Shader.DrawStage":3501.42,"Shader.DrawStage.capture_resources":1360.562,"Shader.DrawStage.materialize":1375.354,"Shader.DrawStage.prepared_invocation":720.19,"Shader.ResolveAbi":214.066,"Shader.ResolveGraphicsAbi":75.21,"Shader.ResolveGraphicsStagesAbi":203.391,"VideoOut.Flip":1101.479,"VideoOut.Flip.completion_mutex_wait":0.185,"VideoOut.Flip.config_mutex_wait":0.013,"VideoOut.Flip.frame_limit":0.064,"VideoOut.Flip.notify_game":0.972,"VideoOut.Flip.present":66.992,"VideoOut.Flip.validate":0.067,"VideoOut.Flip.vblank_wait":0.038,"VideoOut.Flip.window_prepare":0.077,"VideoOut.Flip.window_title":1033.018,"VideoOut.Readiness":0.084,"VideoOut.Readiness.locks_validate":0.049,"Vulkan.Acquire":2.623,"Vulkan.Acquire.acquire_fence_wait":0.419,"Vulkan.Acquire.acquire_image":1.726,"Vulkan.Acquire.fence_reset":0.426,"Vulkan.Acquire.retired_swapchains":0.025,"Vulkan.Dispatch":194.235,"Vulkan.Dispatch.command_record":91.664,"Vulkan.Dispatch.shader_resources":99.793,"Vulkan.DispatchRecipe":0.257,"Vulkan.DispatchRecipe.command_record":0.253,"Vulkan.DrawFromRecipe":332.137,"Vulkan.Present":3.854,"Vulkan.Present.command_record_scale":2.617,"Vulkan.Present.pixel_upload":0.121,"Vulkan.Present.queue_submit":1.066,"Vulkan.QueuePresent":13.347,"Vulkan.QueuePresent.queue_present":13.245,"Vulkan.Retire":44.089,"Vulkan.Retire.dump":0.116,"Vulkan.Retire.wait":43.27},"top_phases_ms_per_frame":{"Driver.Packet":390.766,"Driver.Packet.draw":338.271,"Driver.Draw":332.796,"Graphics.Draw":237.102,"Driver.Draw.shader_compile_and_link":213.03,"Graphics.Draw.draw_and_resource_release":174.886,"Shader.DrawStage":140.057,"Shader.DrawStage.materialize":55.014},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":8,"Graphics.Barrier.dispatch-lead":2191,"Graphics.Barrier.dispatch-trail":4720,"Graphics.Barrier.draw":4652,"Graphics.Barrier.fill":919,"Graphics.Barrier.label-run":20322,"Graphics.Barrier.present-blit":50,"Graphics.Barrier.staging-in":6318,"Graphics.Barrier.staging-out":1870,"Graphics.Barrier.storage-upload":120,"Graphics.Barrier.storage-writeback":1445,"Graphics.BarrierMerged.copy":4,"Graphics.BarrierMerged.dispatch-lead":2529,"Graphics.BarrierMerged.fill":281,"Graphics.BarrierMerged.staging-in":3592,"Graphics.BarrierMerged.staging-out":1870,"Graphics.BarrierMerged.storage-writeback":471,"Graphics.Copy":5838,"Graphics.Copy.bytes":284480048,"Graphics.RenderPass":2109,"Graphics.RenderPass.Close.command":623,"Graphics.RenderPass.Close.image":381,"Graphics.RenderPass.Close.key":351,"Graphics.RenderPass.Close.new-batch":754,"Graphics.RenderPass.Continued":196951},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.436,"events_lost":508140,"totals_full":false},"draw committer":{"events_full_after_s":9.715,"events_lost":11532,"totals_full":false}},"trace":"aps5-trace-e04bd77e7f6c-430717.json.gz"}
Summary line, round 3, this PR, warm
{"commit":"96e5323f46d8","dirty":false,"env":{"APS5_DUMP_FRAMES":"100000","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"8","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz","cpu_threads":36,"memory_mib":124344,"title_id":"PPSA29043","title":"Anger Foot","content_version":"01.000.000","resolution":"1920x1080","window":{"spec":"seconds 120:10","first_present":869,"ms":10213.481},"presents":29,"frame_ms":{"p50":360.766,"p90":434.029,"p99":455.838,"max":455.838},"gpu_busy_ms_per_present":78.973,"worker_busy_pct":{"queue worker 0x0":96.395},"phase_totals_ms":{"Driver.Completion":0.064,"Driver.Dispatch":504.479,"Driver.Dispatch.capture_resources":43.708,"Driver.Dispatch.decode_key_device_setup":55.685,"Driver.Dispatch.lookup_cache":26.297,"Driver.Dispatch.materialize":9.625,"Driver.Dispatch.prepared_invocation":8.272,"Driver.Draw":8204.835,"Driver.Draw.device_setup":693.684,"Driver.Draw.draw_enqueued":1717.904,"Driver.Draw.post_compile_prepare":102.119,"Driver.Draw.prepare":881.264,"Driver.Draw.shader_compile_and_link":4644.342,"Driver.EndSubmission":0.43,"Driver.Packet":9844.777,"Driver.Packet.device_lock":36.423,"Driver.Packet.dispatch":710.743,"Driver.Packet.draw":8326.545,"Driver.Packet.execute":213.194,"Driver.Packet.flip_flush":1.182,"Driver.Packet.flush_between_packets":133.139,"Driver.Packet.memory_wait":0.727,"Driver.Packet.pipeline_drain":70.535,"Driver.Packet.pipeline_prepare":118.898,"Driver.Packet.prepare_memory":89.97,"Driver.Packet.rendering_wait":0.035,"Driver.Present":45.468,"Driver.Present.acquire_image":3.452,"Driver.Present.device_setup":0.043,"Driver.Present.gpu_mutex_wait":0.15,"Driver.Present.inflight_wait":0.181,"Driver.Present.present_display_buffer":6.078,"Driver.Present.queue_present":14.959,"Driver.Present.release_and_callback":0.064,"Driver.Present.render_fence_wait":20.382,"Driver.Present.resize":0.087,"Driver.Present.validate":0.027,"Driver.Suspend":0.024,"GpuMutex.wait.draw":2.496,"GpuMutex.wait.flush":0.009,"GpuMutex.wait.label":0.006,"GpuMutex.wait.wait":0.344,"Graphics.Draw":4334.885,"Graphics.Draw.draw_and_resource_release":3228.956,"Graphics.Draw.index_upload":278.481,"Graphics.Draw.validate":449.646,"Graphics.Draw.vertex_upload":313.057,"Graphics.DrawWithRecipe":2315.72,"Graphics.DrawWithRecipe.draw_and_resource_release":1695.69,"Graphics.DrawWithRecipe.index_upload":231.29,"Graphics.DrawWithRecipe.validate":113.516,"Graphics.DrawWithRecipe.vertex_upload":239.477,"Recorder.Reap":28.955,"Recorder.Submit":62.861,"Recorder.WaitSerial":0.288,"Resources.Complete":59.894,"Resources.Prepare":43.444,"Shader.DrawStage":2511.001,"Shader.DrawStage.capture_resources":1109.387,"Shader.DrawStage.materialize":879.872,"Shader.DrawStage.prepared_invocation":487.927,"Shader.ResolveAbi":243.637,"Shader.ResolveGraphicsAbi":86.721,"Shader.ResolveGraphicsStagesAbi":235.639,"VideoOut.Flip":1253.368,"VideoOut.Flip.completion_mutex_wait":0.263,"VideoOut.Flip.config_mutex_wait":0.014,"VideoOut.Flip.frame_limit":0.061,"VideoOut.Flip.notify_game":1.149,"VideoOut.Flip.present":46.503,"VideoOut.Flip.validate":0.075,"VideoOut.Flip.vblank_wait":0.055,"VideoOut.Flip.window_prepare":0.092,"VideoOut.Flip.window_title":1205.065,"VideoOut.Readiness":0.089,"VideoOut.Readiness.locks_validate":0.043,"Vulkan.Acquire":3.264,"Vulkan.Acquire.acquire_fence_wait":0.556,"Vulkan.Acquire.acquire_image":2.134,"Vulkan.Acquire.fence_reset":0.51,"Vulkan.Acquire.retired_swapchains":0.029,"Vulkan.Dispatch":214.778,"Vulkan.Dispatch.command_record":101.583,"Vulkan.Dispatch.shader_resources":110.222,"Vulkan.DispatchRecipe":0.616,"Vulkan.DispatchRecipe.command_record":0.607,"Vulkan.DrawFromRecipe":2384.225,"Vulkan.Present":4.642,"Vulkan.Present.command_record_scale":3.127,"Vulkan.Present.pixel_upload":0.135,"Vulkan.Present.queue_submit":1.324,"Vulkan.QueuePresent":14.815,"Vulkan.QueuePresent.queue_present":14.708,"Vulkan.Retire":20.304,"Vulkan.Retire.dump":0.103,"Vulkan.Retire.wait":19.42},"top_phases_ms_per_frame":{"Driver.Packet":339.475,"Driver.Packet.draw":287.122,"Driver.Draw":282.925,"Driver.Draw.shader_compile_and_link":160.15,"Graphics.Draw":149.479,"Graphics.Draw.draw_and_resource_release":111.343,"Shader.DrawStage":86.586,"Vulkan.DrawFromRecipe":82.215},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":8,"Graphics.Barrier.dispatch-lead":2545,"Graphics.Barrier.dispatch-trail":5480,"Graphics.Barrier.draw":5348,"Graphics.Barrier.fill":1075,"Graphics.Barrier.label-run":23587,"Graphics.Barrier.present-blit":58,"Graphics.Barrier.staging-in":7322,"Graphics.Barrier.staging-out":2174,"Graphics.Barrier.storage-upload":174,"Graphics.Barrier.storage-writeback":1680,"Graphics.BarrierMerged.copy":8,"Graphics.BarrierMerged.dispatch-lead":2935,"Graphics.BarrierMerged.fill":317,"Graphics.BarrierMerged.staging-in":4188,"Graphics.BarrierMerged.staging-out":2174,"Graphics.BarrierMerged.storage-writeback":541,"Graphics.Copy":6773,"Graphics.Copy.bytes":331008624,"Graphics.RenderPass":2442,"Graphics.RenderPass.Close.command":696,"Graphics.RenderPass.Close.image":470,"Graphics.RenderPass.Close.key":408,"Graphics.RenderPass.Close.new-batch":868,"Graphics.RenderPass.Continued":228607},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.844,"events_lost":420996,"totals_full":false},"draw committer":{"events_full_after_s":9.641,"events_lost":14568,"totals_full":false}},"trace":"aps5-trace-96e5323f46d8-437470.json.gz"}
Summary lines, rounds 2 and 4, warm
{"commit":"96e5323f46d8","dirty":false,"env":{"APS5_DUMP_FRAMES":"100000","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"8","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz","cpu_threads":36,"memory_mib":124344,"title_id":"PPSA29043","title":"Anger Foot","content_version":"01.000.000","resolution":"1920x1080","window":{"spec":"seconds 120:10","first_present":879,"ms":10192.336},"presents":26,"frame_ms":{"p50":405.099,"p90":444.655,"p99":467.352,"max":467.352},"gpu_busy_ms_per_present":94.407,"worker_busy_pct":{"queue worker 0x0":96.21},"phase_totals_ms":{"Driver.Completion":0.076,"Driver.Dispatch":459.134,"Driver.Dispatch.capture_resources":41.386,"Driver.Dispatch.decode_key_device_setup":56.78,"Driver.Dispatch.lookup_cache":23.289,"Driver.Dispatch.materialize":8.597,"Driver.Dispatch.prepared_invocation":7.956,"Driver.Draw":8264.987,"Driver.Draw.device_setup":658.764,"Driver.Draw.draw_enqueued":1470.733,"Driver.Draw.post_compile_prepare":102.391,"Driver.Draw.prepare":845.557,"Driver.Draw.shader_compile_and_link":5026.356,"Driver.EndSubmission":0.393,"Driver.Packet":9805.599,"Driver.Packet.device_lock":30.92,"Driver.Packet.dispatch":667.209,"Driver.Packet.draw":8387.287,"Driver.Packet.execute":202.974,"Driver.Packet.flip_flush":0.991,"Driver.Packet.flush_between_packets":120.908,"Driver.Packet.memory_wait":1.382,"Driver.Packet.pipeline_drain":65.797,"Driver.Packet.pipeline_prepare":108.606,"Driver.Packet.prepare_memory":85.498,"Driver.Packet.rendering_wait":0.031,"Driver.Present":72.718,"Driver.Present.acquire_image":3.029,"Driver.Present.device_setup":0.045,"Driver.Present.gpu_mutex_wait":0.165,"Driver.Present.inflight_wait":0.168,"Driver.Present.present_display_buffer":4.89,"Driver.Present.queue_present":15.412,"Driver.Present.release_and_callback":0.054,"Driver.Present.render_fence_wait":48.784,"Driver.Present.resize":0.085,"Driver.Present.validate":0.042,"Driver.Suspend":0.02,"GpuMutex.wait.draw":2.602,"GpuMutex.wait.flush":0.024,"GpuMutex.wait.label":0.031,"GpuMutex.wait.present":0.061,"GpuMutex.wait.wait":0.328,"Graphics.Draw":5776.382,"Graphics.Draw.draw_and_resource_release":4254.119,"Graphics.Draw.index_upload":398.535,"Graphics.Draw.validate":589.17,"Graphics.Draw.vertex_upload":446.684,"Graphics.DrawWithRecipe":971.077,"Graphics.DrawWithRecipe.draw_and_resource_release":713.537,"Graphics.DrawWithRecipe.index_upload":96.336,"Graphics.DrawWithRecipe.validate":47.58,"Graphics.DrawWithRecipe.vertex_upload":98.485,"Recorder.Reap":29.376,"Recorder.Submit":60.349,"Recorder.WaitSerial":0.34,"Resources.Complete":54.161,"Resources.Prepare":40.273,"Shader.DrawStage":3008.446,"Shader.DrawStage.capture_resources":1184.934,"Shader.DrawStage.materialize":1173.346,"Shader.DrawStage.prepared_invocation":606.771,"Shader.ResolveAbi":220.019,"Shader.ResolveGraphicsAbi":76.278,"Shader.ResolveGraphicsStagesAbi":201.48,"VideoOut.Flip":1030.775,"VideoOut.Flip.completion_mutex_wait":0.195,"VideoOut.Flip.config_mutex_wait":0.007,"VideoOut.Flip.frame_limit":0.066,"VideoOut.Flip.notify_game":1.004,"VideoOut.Flip.present":73.704,"VideoOut.Flip.validate":0.055,"VideoOut.Flip.vblank_wait":0.045,"VideoOut.Flip.window_prepare":0.091,"VideoOut.Flip.window_title":955.546,"VideoOut.Readiness":0.086,"VideoOut.Readiness.locks_validate":0.043,"Vulkan.Acquire":2.877,"Vulkan.Acquire.acquire_fence_wait":0.471,"Vulkan.Acquire.acquire_image":1.886,"Vulkan.Acquire.fence_reset":0.45,"Vulkan.Acquire.retired_swapchains":0.042,"Vulkan.Dispatch":192.783,"Vulkan.Dispatch.command_record":91.087,"Vulkan.Dispatch.shader_resources":98.916,"Vulkan.DrawFromRecipe":999.488,"Vulkan.Present":3.829,"Vulkan.Present.command_record_scale":2.606,"Vulkan.Present.pixel_upload":0.133,"Vulkan.Present.queue_submit":1.029,"Vulkan.QueuePresent":15.297,"Vulkan.QueuePresent.queue_present":15.202,"Vulkan.Retire":48.688,"Vulkan.Retire.dump":0.234,"Vulkan.Retire.wait":47.716},"top_phases_ms_per_frame":{"Driver.Packet":377.138,"Driver.Packet.draw":322.588,"Driver.Draw":317.884,"Graphics.Draw":222.169,"Driver.Draw.shader_compile_and_link":193.321,"Graphics.Draw.draw_and_resource_release":163.62,"Shader.DrawStage":115.709,"Driver.Draw.draw_enqueued":56.567},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":6,"Graphics.Barrier.dispatch-lead":2274,"Graphics.Barrier.dispatch-trail":4914,"Graphics.Barrier.draw":4800,"Graphics.Barrier.fill":960,"Graphics.Barrier.label-run":21144,"Graphics.Barrier.present-blit":52,"Graphics.Barrier.staging-in":6570,"Graphics.Barrier.staging-out":1949,"Graphics.Barrier.storage-upload":104,"Graphics.Barrier.storage-writeback":1509,"Graphics.BarrierMerged.copy":6,"Graphics.BarrierMerged.dispatch-lead":2640,"Graphics.BarrierMerged.fill":288,"Graphics.BarrierMerged.staging-in":3749,"Graphics.BarrierMerged.staging-out":1949,"Graphics.BarrierMerged.storage-writeback":482,"Graphics.Copy":6072,"Graphics.Copy.bytes":295993064,"Graphics.RenderPass":2196,"Graphics.RenderPass.Close.command":622,"Graphics.RenderPass.Close.image":434,"Graphics.RenderPass.Close.key":365,"Graphics.RenderPass.Close.new-batch":775,"Graphics.RenderPass.Continued":205959},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.504,"events_lost":470606,"totals_full":false},"draw committer":{"events_full_after_s":9.519,"events_lost":19113,"totals_full":false}},"trace":"aps5-trace-96e5323f46d8-434043.json.gz"}
{"commit":"e04bd77e7f6c","dirty":false,"env":{"APS5_DUMP_FRAMES":"100000","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"8","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz","cpu_threads":36,"memory_mib":124344,"title_id":"PPSA29043","title":"Anger Foot","content_version":"01.000.000","resolution":"1920x1080","window":{"spec":"seconds 120:10","first_present":940,"ms":10182.942},"presents":25,"frame_ms":{"p50":407.735,"p90":428.76,"p99":491.469,"max":491.469},"gpu_busy_ms_per_present":101.734,"worker_busy_pct":{"queue worker 0x0":96.175},"phase_totals_ms":{"Driver.Completion":0.046,"Driver.Dispatch":469.573,"Driver.Dispatch.capture_resources":39.057,"Driver.Dispatch.decode_key_device_setup":48.693,"Driver.Dispatch.lookup_cache":22.938,"Driver.Dispatch.materialize":7.746,"Driver.Dispatch.prepared_invocation":7.493,"Driver.Draw":8326.414,"Driver.Draw.device_setup":734.483,"Driver.Draw.draw_enqueued":1104.913,"Driver.Draw.post_compile_prepare":106.741,"Driver.Draw.prepare":917.666,"Driver.Draw.shader_compile_and_link":5317.835,"Driver.EndSubmission":0.142,"Driver.Packet":9793.194,"Driver.Packet.device_lock":30.293,"Driver.Packet.dispatch":599.203,"Driver.Packet.draw":8460.484,"Driver.Packet.execute":200.567,"Driver.Packet.flip_flush":0.907,"Driver.Packet.flush_between_packets":126.522,"Driver.Packet.memory_wait":0.847,"Driver.Packet.pipeline_drain":61.535,"Driver.Packet.pipeline_prepare":112.954,"Driver.Packet.prepare_memory":89.118,"Driver.Packet.rendering_wait":0.03,"Driver.Present":85.255,"Driver.Present.acquire_image":2.768,"Driver.Present.device_setup":0.047,"Driver.Present.gpu_mutex_wait":0.105,"Driver.Present.inflight_wait":0.157,"Driver.Present.present_display_buffer":4.924,"Driver.Present.queue_present":12.867,"Driver.Present.release_and_callback":0.06,"Driver.Present.render_fence_wait":64.198,"Driver.Present.resize":0.072,"Driver.Present.validate":0.024,"Driver.Suspend":0.014,"GpuMutex.wait.draw":4.216,"GpuMutex.wait.flush":0.019,"GpuMutex.wait.label":0.004,"GpuMutex.wait.present":0.003,"GpuMutex.wait.wait":0.299,"Graphics.Draw":6060.161,"Graphics.Draw.draw_and_resource_release":4463.352,"Graphics.Draw.index_upload":428.739,"Graphics.Draw.validate":605.915,"Graphics.Draw.vertex_upload":467.283,"Graphics.DrawWithRecipe":209.282,"Graphics.DrawWithRecipe.draw_and_resource_release":154.982,"Graphics.DrawWithRecipe.index_upload":19.513,"Graphics.DrawWithRecipe.validate":10.227,"Graphics.DrawWithRecipe.vertex_upload":20.835,"Recorder.Reap":28.1,"Recorder.Submit":54.555,"Recorder.WaitSerial":0.239,"Resources.Complete":60.431,"Resources.Prepare":56.678,"Shader.DrawStage":3550.462,"Shader.DrawStage.capture_resources":1378.399,"Shader.DrawStage.materialize":1410.501,"Shader.DrawStage.prepared_invocation":716.008,"Shader.ResolveAbi":222.128,"Shader.ResolveGraphicsAbi":77.133,"Shader.ResolveGraphicsStagesAbi":207.166,"VideoOut.Flip":1070.04,"VideoOut.Flip.completion_mutex_wait":0.202,"VideoOut.Flip.config_mutex_wait":0.005,"VideoOut.Flip.frame_limit":0.056,"VideoOut.Flip.notify_game":0.997,"VideoOut.Flip.present":86.311,"VideoOut.Flip.validate":0.078,"VideoOut.Flip.vblank_wait":0.07,"VideoOut.Flip.window_prepare":0.078,"VideoOut.Flip.window_title":982.167,"VideoOut.Readiness":0.102,"VideoOut.Readiness.locks_validate":0.06,"Vulkan.Acquire":2.634,"Vulkan.Acquire.acquire_fence_wait":0.434,"Vulkan.Acquire.acquire_image":1.736,"Vulkan.Acquire.fence_reset":0.42,"Vulkan.Acquire.retired_swapchains":0.025,"Vulkan.Dispatch":205.237,"Vulkan.Dispatch.command_record":94.823,"Vulkan.Dispatch.shader_resources":107.613,"Vulkan.DispatchRecipe":0.185,"Vulkan.DispatchRecipe.command_record":0.182,"Vulkan.DrawFromRecipe":215.743,"Vulkan.Present":3.825,"Vulkan.Present.command_record_scale":2.645,"Vulkan.Present.pixel_upload":0.119,"Vulkan.Present.queue_submit":1.01,"Vulkan.QueuePresent":12.769,"Vulkan.QueuePresent.queue_present":12.687,"Vulkan.Retire":64.041,"Vulkan.Retire.dump":0.104,"Vulkan.Retire.wait":63.194},"top_phases_ms_per_frame":{"Driver.Packet":391.728,"Driver.Packet.draw":338.419,"Driver.Draw":333.057,"Graphics.Draw":242.406,"Driver.Draw.shader_compile_and_link":212.713,"Graphics.Draw.draw_and_resource_release":178.534,"Shader.DrawStage":142.018,"Shader.DrawStage.materialize":56.42},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":6,"Graphics.Barrier.dispatch-lead":2237,"Graphics.Barrier.dispatch-trail":4794,"Graphics.Barrier.draw":4616,"Graphics.Barrier.fill":926,"Graphics.Barrier.label-run":20572,"Graphics.Barrier.present-blit":50,"Graphics.Barrier.staging-in":6432,"Graphics.Barrier.staging-out":1909,"Graphics.Barrier.storage-upload":116,"Graphics.Barrier.storage-writeback":1443,"Graphics.BarrierMerged.copy":6,"Graphics.BarrierMerged.dispatch-lead":2557,"Graphics.BarrierMerged.fill":274,"Graphics.BarrierMerged.staging-in":3645,"Graphics.BarrierMerged.staging-out":1909,"Graphics.BarrierMerged.storage-writeback":474,"Graphics.Copy":5928,"Graphics.Copy.bytes":287674792,"Graphics.RenderPass":2109,"Graphics.RenderPass.Close.command":601,"Graphics.RenderPass.Close.image":418,"Graphics.RenderPass.Close.key":348,"Graphics.RenderPass.Close.new-batch":742,"Graphics.RenderPass.Continued":198386},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.443,"events_lost":513226,"totals_full":false},"draw committer":{"events_full_after_s":9.908,"events_lost":7868,"totals_full":false}},"trace":"aps5-trace-e04bd77e7f6c-440841.json.gz"}
trace_digest.py, round 1 main and round 3 this PR, warm
**seconds 120:10** from present 922: 25 presents, frame p50 409.0 / p90 427.6 / p99 435.3 / max 435.3 ms, GPU busy 95.2 ms per present
NVIDIA GeForce RTX 2080 Ti, NVIDIA 595.99.02, Linux 7.0.0-43-generic, 1920x1080, commit e04bd77e7f6c, dropped: yes

```json
{"commit":"e04bd77e7f6c","dirty":false,"env":{"APS5_DUMP_FRAMES":"100000","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"8","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz","cpu_threads":36,"memory_mib":124344,"title_id":"PPSA29043","title":"Anger Foot","content_version":"01.000.000","resolution":"1920x1080","window":{"spec":"seconds 120:10","first_present":922,"ms":10148.578},"presents":25,"frame_ms":{"p50":408.958,"p90":427.565,"p99":435.341,"max":435.341},"gpu_busy_ms_per_present":95.205,"worker_busy_pct":{"queue worker 0x0":96.263},"phase_totals_ms":{"Driver.Completion":0.059,"Driver.Dispatch":447.856,"Driver.Dispatch.capture_resources":42.922,"Driver.Dispatch.decode_key_device_setup":48.854,"Driver.Dispatch.lookup_cache":22.456,"Driver.Dispatch.materialize":8.008,"Driver.Dispatch.prepared_invocation":8.01,"Driver.Draw":8319.892,"Driver.Draw.device_setup":724.569,"Driver.Draw.draw_enqueued":1097.628,"Driver.Draw.post_compile_prepare":108.854,"Driver.Draw.prepare":913.646,"Driver.Draw.shader_compile_and_link":5325.758,"Driver.EndSubmission":0.113,"Driver.Packet":9769.159,"Driver.Packet.device_lock":30.19,"Driver.Packet.dispatch":576.827,"Driver.Packet.draw":8456.787,"Driver.Packet.execute":198.825,"Driver.Packet.flip_flush":0.909,"Driver.Packet.flush_between_packets":125.156,"Driver.Packet.memory_wait":1.488,"Driver.Packet.pipeline_drain":62.66,"Driver.Packet.pipeline_prepare":112.186,"Driver.Packet.prepare_memory":88.751,"Driver.Packet.rendering_wait":0.031,"Driver.Present":65.963,"Driver.Present.acquire_image":2.764,"Driver.Present.device_setup":0.038,"Driver.Present.gpu_mutex_wait":0.101,"Driver.Present.inflight_wait":0.183,"Driver.Present.present_display_buffer":4.99,"Driver.Present.queue_present":13.521,"Driver.Present.release_and_callback":0.063,"Driver.Present.render_fence_wait":44.168,"Driver.Present.resize":0.077,"Driver.Present.validate":0.023,"Driver.Suspend":0.018,"GpuMutex.wait.draw":4.241,"GpuMutex.wait.end":0.006,"GpuMutex.wait.flush":0.022,"GpuMutex.wait.label":0.006,"GpuMutex.wait.present":0.005,"GpuMutex.wait.wait":0.208,"Graphics.Draw":5927.552,"Graphics.Draw.draw_and_resource_release":4372.149,"Graphics.Draw.index_upload":420.676,"Graphics.Draw.validate":590.617,"Graphics.Draw.vertex_upload":453.858,"Graphics.DrawWithRecipe":322.538,"Graphics.DrawWithRecipe.draw_and_resource_release":237.715,"Graphics.DrawWithRecipe.index_upload":30.665,"Graphics.DrawWithRecipe.validate":16.35,"Graphics.DrawWithRecipe.vertex_upload":32.167,"Recorder.Reap":27.147,"Recorder.Submit":54.014,"Recorder.WaitSerial":0.261,"Resources.Complete":55.411,"Resources.Prepare":41.331,"Shader.DrawStage":3501.42,"Shader.DrawStage.capture_resources":1360.562,"Shader.DrawStage.materialize":1375.354,"Shader.DrawStage.prepared_invocation":720.19,"Shader.ResolveAbi":214.066,"Shader.ResolveGraphicsAbi":75.21,"Shader.ResolveGraphicsStagesAbi":203.391,"VideoOut.Flip":1101.479,"VideoOut.Flip.completion_mutex_wait":0.185,"VideoOut.Flip.config_mutex_wait":0.013,"VideoOut.Flip.frame_limit":0.064,"VideoOut.Flip.notify_game":0.972,"VideoOut.Flip.present":66.992,"VideoOut.Flip.validate":0.067,"VideoOut.Flip.vblank_wait":0.038,"VideoOut.Flip.window_prepare":0.077,"VideoOut.Flip.window_title":1033.018,"VideoOut.Readiness":0.084,"VideoOut.Readiness.locks_validate":0.049,"Vulkan.Acquire":2.623,"Vulkan.Acquire.acquire_fence_wait":0.419,"Vulkan.Acquire.acquire_image":1.726,"Vulkan.Acquire.fence_reset":0.426,"Vulkan.Acquire.retired_swapchains":0.025,"Vulkan.Dispatch":194.235,"Vulkan.Dispatch.command_record":91.664,"Vulkan.Dispatch.shader_resources":99.793,"Vulkan.DispatchRecipe":0.257,"Vulkan.DispatchRecipe.command_record":0.253,"Vulkan.DrawFromRecipe":332.137,"Vulkan.Present":3.854,"Vulkan.Present.command_record_scale":2.617,"Vulkan.Present.pixel_upload":0.121,"Vulkan.Present.queue_submit":1.066,"Vulkan.QueuePresent":13.347,"Vulkan.QueuePresent.queue_present":13.245,"Vulkan.Retire":44.089,"Vulkan.Retire.dump":0.116,"Vulkan.Retire.wait":43.27},"top_phases_ms_per_frame":{"Driver.Packet":390.766,"Driver.Packet.draw":338.271,"Driver.Draw":332.796,"Graphics.Draw":237.102,"Driver.Draw.shader_compile_and_link":213.03,"Graphics.Draw.draw_and_resource_release":174.886,"Shader.DrawStage":140.057,"Shader.DrawStage.materialize":55.014},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":8,"Graphics.Barrier.dispatch-lead":2191,"Graphics.Barrier.dispatch-trail":4720,"Graphics.Barrier.draw":4652,"Graphics.Barrier.fill":919,"Graphics.Barrier.label-run":20322,"Graphics.Barrier.present-blit":50,"Graphics.Barrier.staging-in":6318,"Graphics.Barrier.staging-out":1870,"Graphics.Barrier.storage-upload":120,"Graphics.Barrier.storage-writeback":1445,"Graphics.BarrierMerged.copy":4,"Graphics.BarrierMerged.dispatch-lead":2529,"Graphics.BarrierMerged.fill":281,"Graphics.BarrierMerged.staging-in":3592,"Graphics.BarrierMerged.staging-out":1870,"Graphics.BarrierMerged.storage-writeback":471,"Graphics.Copy":5838,"Graphics.Copy.bytes":284480048,"Graphics.RenderPass":2109,"Graphics.RenderPass.Close.command":623,"Graphics.RenderPass.Close.image":381,"Graphics.RenderPass.Close.key":351,"Graphics.RenderPass.Close.new-batch":754,"Graphics.RenderPass.Continued":196951},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.436,"events_lost":508140,"totals_full":false},"draw committer":{"events_full_after_s":9.715,"events_lost":11532,"totals_full":false}},"trace":"aps5-trace-e04bd77e7f6c-430717.json.gz"}
```

**Incomplete trace:** recorded data was lost. Slice-based timings, waits and batch inventories cover retained events only; missing slices are not idle time. Summary statistics are reported separately.
- queue worker 0x0: 508140 events lost; buffer full at 3436.2 ms
- draw committer: 11532 events lost; buffer full at 9714.7 ms

**Slowest frames** (largest slices inside each, inclusive)

- present 937: 435.3 ms at 6057 ms: Graphics.Draw (draw committer) 251.3, Graphics.Draw.draw_and_resource_release (draw committer) 114.6, batch (gpu) 76.0, VideoOut.Flip (presenter) 42.8
- present 945: 433.6 ms at 9312 ms: Graphics.Draw (draw committer) 234.3, batch (gpu) 112.2, Graphics.Draw.draw_and_resource_release (draw committer) 99.3, VideoOut.Flip (presenter) 55.9
- present 932: 427.6 ms at 4072 ms: Graphics.Draw (draw committer) 251.7, batch (gpu) 152.6, Graphics.Draw.draw_and_resource_release (draw committer) 110.6, VideoOut.Flip (presenter) 48.6

**Persistent spikes** (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)

- present 937: 435.3 ms at 6057 ms, persistence 70.1 ms
- present 932: 427.6 ms at 4072 ms, persistence 62.4 ms
- present 945: 433.6 ms at 9312 ms, persistence 55.8 ms
- present 934: 411.7 ms at 4885 ms, persistence 26.0 ms
- present 925: 416.5 ms at 1198 ms, persistence 15.2 ms
- present 929: 418.7 ms at 2837 ms, persistence 11.7 ms
- present 922: 392.7 ms at 0 ms, persistence 3.1 ms
- present 941: 409.4 ms at 7735 ms, persistence 3.0 ms

**Threads** (ms per frame)

| thread | busy | wait | untraced | in slices < 20 us | largest |
|---|---|---|---|---|---|
| queue worker 0x0 | 121.7 (30 %) | 2.7 (1 %) | 281.6 | 147.5 | Driver.Packet 121.7 |
| draw committer | 231.0 (57 %) | 0.1 (0 %) | 174.9 | 143.6 | Graphics.Draw 221.2, Vulkan.DrawFromRecipe 7.5 |
| presenter | 42.3 (10 %) | 1.8 (0 %) | 361.9 | 0.1 | VideoOut.Flip 44.1 |
| title | 3.6 (1 %) | 0.0 (0 %) | 402.3 | 15.4 | Shader.ResolveGraphicsStagesAbi 2.7, Shader.ResolveGraphicsAbi 0.9 |
| gpu | 91.8 (23 %) | 0.0 (0 %) | 314.2 | 0.0 | batch 91.8 |

**Largest slices** (ms per frame, inclusive, all threads): Graphics.Draw 221.2, Driver.Packet 121.7, Driver.Packet.draw 112.0, Driver.Draw 110.1, Graphics.Draw.draw_and_resource_release 101.0, batch 91.8, Driver.Draw.shader_compile_and_link 56.5, VideoOut.Flip 44.1

**Longest waits**

- Driver.Present.render_fence_wait (presenter) 7.4 ms at 4072 ms, present 932
- Driver.WorkerWait (queue worker 0x0) 6.8 ms at 2026 ms, present 927
- Driver.Present.render_fence_wait (presenter) 6.4 ms at 6493 ms, present 938
- Driver.Present.render_fence_wait (presenter) 6.3 ms at 6917 ms, present 939
- Driver.Present.render_fence_wait (presenter) 6.2 ms at 4500 ms, present 933
- Driver.Present.render_fence_wait (presenter) 5.9 ms at 8923 ms, present 944
- Driver.WorkerWait (queue worker 0x0) 5.7 ms at 784 ms, present 924
- Driver.Present.render_fence_wait (presenter) 5.7 ms at 2027 ms, present 927

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

- batch 9556: 16.0 ms at 1776 ms, present 926: GPU no ranges; recorded by Graphics.Draw (draw committer) 12.4, Graphics.Draw.draw_and_resource_release (draw committer) 3.8, Vulkan.DrawFromRecipe (draw committer) 1.6, Graphics.DrawWithRecipe (draw committer) 1.4
- batch 9866: 15.9 ms at 4238 ms, present 932: GPU no ranges; recorded by Graphics.Draw (draw committer) 14.4, Graphics.Draw.draw_and_resource_release (draw committer) 3.7, Recorder.Submit (draw committer) 0.0, Graphics.Draw.vertex_upload (draw committer) 0.0
- batch 10167: 15.8 ms at 6654 ms, present 938: GPU no ranges; recorded by Graphics.Draw (draw committer) 14.6, Graphics.Draw.draw_and_resource_release (draw committer) 4.3, Recorder.Submit (draw committer) 0.0, Graphics.Draw.index_upload (draw committer) 0.0
**seconds 120:10** from present 869: 29 presents, frame p50 360.8 / p90 434.0 / p99 455.8 / max 455.8 ms, GPU busy 79.0 ms per present
NVIDIA GeForce RTX 2080 Ti, NVIDIA 595.99.02, Linux 7.0.0-43-generic, 1920x1080, commit 96e5323f46d8, dropped: yes

```json
{"commit":"96e5323f46d8","dirty":false,"env":{"APS5_DUMP_FRAMES":"100000","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"8","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz","cpu_threads":36,"memory_mib":124344,"title_id":"PPSA29043","title":"Anger Foot","content_version":"01.000.000","resolution":"1920x1080","window":{"spec":"seconds 120:10","first_present":869,"ms":10213.481},"presents":29,"frame_ms":{"p50":360.766,"p90":434.029,"p99":455.838,"max":455.838},"gpu_busy_ms_per_present":78.973,"worker_busy_pct":{"queue worker 0x0":96.395},"phase_totals_ms":{"Driver.Completion":0.064,"Driver.Dispatch":504.479,"Driver.Dispatch.capture_resources":43.708,"Driver.Dispatch.decode_key_device_setup":55.685,"Driver.Dispatch.lookup_cache":26.297,"Driver.Dispatch.materialize":9.625,"Driver.Dispatch.prepared_invocation":8.272,"Driver.Draw":8204.835,"Driver.Draw.device_setup":693.684,"Driver.Draw.draw_enqueued":1717.904,"Driver.Draw.post_compile_prepare":102.119,"Driver.Draw.prepare":881.264,"Driver.Draw.shader_compile_and_link":4644.342,"Driver.EndSubmission":0.43,"Driver.Packet":9844.777,"Driver.Packet.device_lock":36.423,"Driver.Packet.dispatch":710.743,"Driver.Packet.draw":8326.545,"Driver.Packet.execute":213.194,"Driver.Packet.flip_flush":1.182,"Driver.Packet.flush_between_packets":133.139,"Driver.Packet.memory_wait":0.727,"Driver.Packet.pipeline_drain":70.535,"Driver.Packet.pipeline_prepare":118.898,"Driver.Packet.prepare_memory":89.97,"Driver.Packet.rendering_wait":0.035,"Driver.Present":45.468,"Driver.Present.acquire_image":3.452,"Driver.Present.device_setup":0.043,"Driver.Present.gpu_mutex_wait":0.15,"Driver.Present.inflight_wait":0.181,"Driver.Present.present_display_buffer":6.078,"Driver.Present.queue_present":14.959,"Driver.Present.release_and_callback":0.064,"Driver.Present.render_fence_wait":20.382,"Driver.Present.resize":0.087,"Driver.Present.validate":0.027,"Driver.Suspend":0.024,"GpuMutex.wait.draw":2.496,"GpuMutex.wait.flush":0.009,"GpuMutex.wait.label":0.006,"GpuMutex.wait.wait":0.344,"Graphics.Draw":4334.885,"Graphics.Draw.draw_and_resource_release":3228.956,"Graphics.Draw.index_upload":278.481,"Graphics.Draw.validate":449.646,"Graphics.Draw.vertex_upload":313.057,"Graphics.DrawWithRecipe":2315.72,"Graphics.DrawWithRecipe.draw_and_resource_release":1695.69,"Graphics.DrawWithRecipe.index_upload":231.29,"Graphics.DrawWithRecipe.validate":113.516,"Graphics.DrawWithRecipe.vertex_upload":239.477,"Recorder.Reap":28.955,"Recorder.Submit":62.861,"Recorder.WaitSerial":0.288,"Resources.Complete":59.894,"Resources.Prepare":43.444,"Shader.DrawStage":2511.001,"Shader.DrawStage.capture_resources":1109.387,"Shader.DrawStage.materialize":879.872,"Shader.DrawStage.prepared_invocation":487.927,"Shader.ResolveAbi":243.637,"Shader.ResolveGraphicsAbi":86.721,"Shader.ResolveGraphicsStagesAbi":235.639,"VideoOut.Flip":1253.368,"VideoOut.Flip.completion_mutex_wait":0.263,"VideoOut.Flip.config_mutex_wait":0.014,"VideoOut.Flip.frame_limit":0.061,"VideoOut.Flip.notify_game":1.149,"VideoOut.Flip.present":46.503,"VideoOut.Flip.validate":0.075,"VideoOut.Flip.vblank_wait":0.055,"VideoOut.Flip.window_prepare":0.092,"VideoOut.Flip.window_title":1205.065,"VideoOut.Readiness":0.089,"VideoOut.Readiness.locks_validate":0.043,"Vulkan.Acquire":3.264,"Vulkan.Acquire.acquire_fence_wait":0.556,"Vulkan.Acquire.acquire_image":2.134,"Vulkan.Acquire.fence_reset":0.51,"Vulkan.Acquire.retired_swapchains":0.029,"Vulkan.Dispatch":214.778,"Vulkan.Dispatch.command_record":101.583,"Vulkan.Dispatch.shader_resources":110.222,"Vulkan.DispatchRecipe":0.616,"Vulkan.DispatchRecipe.command_record":0.607,"Vulkan.DrawFromRecipe":2384.225,"Vulkan.Present":4.642,"Vulkan.Present.command_record_scale":3.127,"Vulkan.Present.pixel_upload":0.135,"Vulkan.Present.queue_submit":1.324,"Vulkan.QueuePresent":14.815,"Vulkan.QueuePresent.queue_present":14.708,"Vulkan.Retire":20.304,"Vulkan.Retire.dump":0.103,"Vulkan.Retire.wait":19.42},"top_phases_ms_per_frame":{"Driver.Packet":339.475,"Driver.Packet.draw":287.122,"Driver.Draw":282.925,"Driver.Draw.shader_compile_and_link":160.15,"Graphics.Draw":149.479,"Graphics.Draw.draw_and_resource_release":111.343,"Shader.DrawStage":86.586,"Vulkan.DrawFromRecipe":82.215},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":8,"Graphics.Barrier.dispatch-lead":2545,"Graphics.Barrier.dispatch-trail":5480,"Graphics.Barrier.draw":5348,"Graphics.Barrier.fill":1075,"Graphics.Barrier.label-run":23587,"Graphics.Barrier.present-blit":58,"Graphics.Barrier.staging-in":7322,"Graphics.Barrier.staging-out":2174,"Graphics.Barrier.storage-upload":174,"Graphics.Barrier.storage-writeback":1680,"Graphics.BarrierMerged.copy":8,"Graphics.BarrierMerged.dispatch-lead":2935,"Graphics.BarrierMerged.fill":317,"Graphics.BarrierMerged.staging-in":4188,"Graphics.BarrierMerged.staging-out":2174,"Graphics.BarrierMerged.storage-writeback":541,"Graphics.Copy":6773,"Graphics.Copy.bytes":331008624,"Graphics.RenderPass":2442,"Graphics.RenderPass.Close.command":696,"Graphics.RenderPass.Close.image":470,"Graphics.RenderPass.Close.key":408,"Graphics.RenderPass.Close.new-batch":868,"Graphics.RenderPass.Continued":228607},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.844,"events_lost":420996,"totals_full":false},"draw committer":{"events_full_after_s":9.641,"events_lost":14568,"totals_full":false}},"trace":"aps5-trace-96e5323f46d8-437470.json.gz"}
```

**Incomplete trace:** recorded data was lost. Slice-based timings, waits and batch inventories cover retained events only; missing slices are not idle time. Summary statistics are reported separately.
- queue worker 0x0: 420996 events lost; buffer full at 3843.5 ms
- draw committer: 14568 events lost; buffer full at 9641.3 ms

**Slowest frames** (largest slices inside each, inclusive)

- present 878: 455.8 ms at 3075 ms: Driver.Packet (queue worker 0x0) 414.2, Driver.Packet.draw (queue worker 0x0) 386.9, Driver.Draw (queue worker 0x0) 381.8, Graphics.Draw (draw committer) 256.5
- present 897: 445.1 ms at 9768 ms: batch (gpu) 99.3, VideoOut.Flip (presenter) 42.7, VideoOut.Flip.window_title (presenter) 41.8, Shader.ResolveGraphicsStagesAbi (title) 2.7
- present 874: 434.0 ms at 1663 ms: Driver.Packet (queue worker 0x0) 383.6, Driver.Packet.draw (queue worker 0x0) 356.9, Driver.Draw (queue worker 0x0) 351.8, Graphics.Draw (draw committer) 247.6

**Persistent spikes** (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)

- present 878: 455.8 ms at 3075 ms, persistence 173.5 ms
- present 897: 445.1 ms at 9768 ms, persistence 162.7 ms
- present 874: 434.0 ms at 1663 ms, persistence 146.7 ms
- present 871: 427.0 ms at 663 ms, persistence 142.2 ms
- present 890: 428.5 ms at 7243 ms, persistence 140.8 ms
- present 883: 390.0 ms at 4882 ms, persistence 106.3 ms
- present 869: 370.5 ms at 0 ms, persistence 78.1 ms
- present 887: 360.8 ms at 6177 ms, persistence 69.8 ms

**Threads** (ms per frame)

| thread | busy | wait | untraced | in slices < 20 us | largest |
|---|---|---|---|---|---|
| queue worker 0x0 | 107.7 (31 %) | 2.5 (1 %) | 242.0 | 144.5 | Driver.Packet 107.7, Driver.Packet.draw 0.0 |
| draw committer | 178.4 (51 %) | 0.0 (0 %) | 173.7 | 209.5 | Graphics.Draw 137.6, Vulkan.DrawFromRecipe 38.6 |
| presenter | 42.5 (12 %) | 0.7 (0 %) | 309.0 | 0.1 | VideoOut.Flip 43.2 |
| title | 3.8 (1 %) | 0.0 (0 %) | 348.4 | 15.3 | Shader.ResolveGraphicsStagesAbi 2.7, Shader.ResolveGraphicsAbi 1.0 |
| gpu | 80.4 (23 %) | 0.0 (0 %) | 271.8 | 0.0 | batch 80.4 |

**Largest slices** (ms per frame, inclusive, all threads): Graphics.Draw 137.6, Driver.Packet 107.7, Driver.Packet.draw 96.4, Driver.Draw 94.3, batch 80.4, Graphics.Draw.draw_and_resource_release 76.0, Driver.Draw.shader_compile_and_link 49.2, VideoOut.Flip 43.2

**Longest waits**

- Driver.Present.render_fence_wait (presenter) 6.9 ms at 3895 ms, present 880
- Driver.WorkerWait (queue worker 0x0) 6.8 ms at 1663 ms, present 874
- Driver.Present.render_fence_wait (presenter) 5.7 ms at 5878 ms, present 886
- Driver.WorkerWait (queue worker 0x0) 5.6 ms at 1092 ms, present 872
- Driver.WorkerWait (queue worker 0x0) 5.6 ms at 664 ms, present 871
- Driver.Present.render_fence_wait (presenter) 5.6 ms at 1664 ms, present 874
- Driver.WorkerWait (queue worker 0x0) 4.8 ms at 1670 ms, present 874
- Driver.WorkerWait (queue worker 0x0) 4.8 ms at 372 ms, present 870

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

- batch 10920: 14.2 ms at 8044 ms, present 892: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 7.1, Graphics.DrawWithRecipe (draw committer) 6.5, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 2.2, Recorder.Submit (draw committer) 0.0
- batch 10617: 14.1 ms at 5971 ms, present 886: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 6.2, Graphics.DrawWithRecipe (draw committer) 5.5, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 1.9, Graphics.Draw (draw committer) 1.1
- batch 10267: 13.4 ms at 3635 ms, present 879: GPU no ranges; recorded by Graphics.Draw (draw committer) 15.2, Graphics.Draw.draw_and_resource_release (draw committer) 11.0, Graphics.Draw.index_upload (draw committer) 0.1, Recorder.Submit (draw committer) 0.1

Tests.

  • agc_driver_draw_cache_capacity passes in 11.3 s. With the default put back to 4096 it fails: the third pass over 4352 distinct draws made 0 draw-cache hits and 4253 evictions; the default entry cap does not hold them.
  • ctest -R 'draw_cache|draw_recipe|address_draw|image_table_cache_bounds|draw_ahead' -V on main and on this branch with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer (validation layer 1.4.341): 27 of 27 pass on main, 28 of 28 on this branch. Both logs show Insert instance layer "VK_LAYER_KHRONOS_validation" and no was not found but was requested; neither has a VUID- line. Under the validation layer the new test takes 38 s; without it, 11.3 s.
  • tools/check_conventions.py --base origin/main and tools/env_reference.py --check pass.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 2080 Ti, driver 595.99.02, Ubuntu 26.04.1 (Linux 7.0.0-43)
  • AI-assisted: yes

@github-actions github-actions Bot added perf Performance change docs agc libSceAgc* labels Nov 16, 2026
@klosixgaming-arch

Copy link
Copy Markdown
Contributor Author

One more main round from the same session, run 70 minutes after round 4 with the same build, scene and settings (round 6; rounds 5 and 7 were another branch). It widens the main spread, so the level numbers in the description are weaker than they read:

round build warm run, first level (window) level intervals 112-155 s (presents / 10 s) cold run, main menu (window)
6 main e04bd77 27 presents, p50 381.9, p90 408.1, p99 414.5 ms, GPU 92.5 ms 27 27 27 27 27 55 presents, p50 182.7 ms
  • First level: across rounds 1, 4 and 6, main's window p50 is 382 to 409 ms and its intervals from 112 s are 25 to 27 presents per 10 s. This PR's rounds 2 and 3 are 361 and 405 ms, with intervals of 27 to 31. The two overlap at 27, so the level gain is smaller than the description's +10 to +17 %, and I can't call it clear from four main and two PR warm runs.
  • Main menu: main 63, 55 and 55 presents per 10 s against this PR's 78 and 77 (p50 159 to 184 ms against 127 ms). That gain is well outside the main spread.

Round 6's traces and summary lines are in the same release, aps5-trace-e04bd77e7f6c-489287.json.gz (cold) and aps5-trace-e04bd77e7f6c-490797.json.gz (warm) at https://github.com/klosixgaming-arch/AnyPS5/releases/tag/perf-captures-2026-11-16

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

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/src/Driver/Draw/DrawCache.cpp
PR 6186 docs/dev/ENVIRONMENT.md
PR 6188 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp
PR 6924 docs/dev/ENVIRONMENT.md
PR 7275 docs/dev/ENVIRONMENT.md
PR 7449 docs/dev/ENVIRONMENT.md
PR 7642 docs/dev/ENVIRONMENT.md
PR 7643 docs/dev/ENVIRONMENT.md
PR 8246 docs/dev/ENVIRONMENT.md
PR 9289 docs/dev/ENVIRONMENT.md
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 10193 docs/dev/ENVIRONMENT.md
PR 10442 docs/dev/ENVIRONMENT.md
PR 10443 docs/dev/ENVIRONMENT.md
PR 11435 docs/dev/ENVIRONMENT.md
PR 11436 docs/dev/ENVIRONMENT.md
PR 12324 docs/dev/ENVIRONMENT.md
PR 12746 docs/dev/ENVIRONMENT.md
PR 12849 docs/dev/ENVIRONMENT.md
PR 12863 docs/dev/ENVIRONMENT.md
PR 13809 docs/dev/ENVIRONMENT.md
PR 13863 docs/dev/ENVIRONMENT.md
PR 13920 docs/dev/ENVIRONMENT.md
PR 13928 docs/dev/ENVIRONMENT.md
PR 13929 docs/dev/ENVIRONMENT.md
PR 14262 docs/dev/ENVIRONMENT.md
PR 15529 docs/dev/ENVIRONMENT.md
PR 15548 docs/dev/ENVIRONMENT.md
PR 15570 docs/dev/ENVIRONMENT.md
PR 16793 docs/dev/ENVIRONMENT.md
PR 17259 docs/dev/ENVIRONMENT.md
PR 17557 docs/dev/ENVIRONMENT.md
PR 17558 docs/dev/ENVIRONMENT.md
PR 17611 docs/dev/ENVIRONMENT.md
PR 17729 docs/dev/ENVIRONMENT.md
PR 18173 docs/dev/ENVIRONMENT.md
PR 18226 docs/dev/ENVIRONMENT.md
PR 18515 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp
docs/dev/ENVIRONMENT.md
PR 18757 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp
PR 19445 docs/dev/ENVIRONMENT.md
PR 20187 docs/dev/ENVIRONMENT.md
PR 20248 docs/dev/ENVIRONMENT.md
PR 20315 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp
docs/dev/ENVIRONMENT.md

@ghost

ghost commented Nov 16, 2026

Copy link
Copy Markdown

A data point from a title where this is neutral, and why: GTA V (PPSA04264 01.005.000), Windows 11, RTX 5070 Ti (NVIDIA 621.01), Ryzen 7 5800X3D.

main 6dbb02e37e with 0x206 = 0x43f, North Yankton prologue, standing still, about 1,800 draws per frame, APS5_DRAW_PIPELINE=1 APS5_PIPELINE_DISPATCH=1, warm caches, one run per row:

presents per s
default (4096 entries) 20.6
APS5_DRAW_CACHE_ENTRIES=65536 19.8
APS5_NO_DRAW_KEY=1 (no draw cache) 20.5

One run each, so read the three as equal. The reason the entry count does not matter here is in the APS5_TRACE_DRAW_CACHE=1 line of the default run: of 273,147 lookups without an entry per 10 s, 237,711 are user words/pointers only, 14,536 evicted and 20,900 seen but never inserted. The keys do not repeat, because the user data moves every frame, so eviction is 5 % of the misses and a larger cache has little to keep. The shape of those draws does repeat (98 % of shapes seen within the last 4096 draws).

So no objection from this title: it neither gains nor loses. It is a case where the reuse has to come from the shape side (#20315's 83488a6232 and abaae73388 take stage reuse on data-only hits from 2 % to 65 % here) rather than from holding more exact keys.

AI-assisted: yes

@klosixgaming-arch

Copy link
Copy Markdown
Contributor Author

@rth9z thanks, that's a useful counterexample. It fits what Anger Foot shows from the other side: there, 72k of the misses per 10 s were keys seen but never inserted and 15k were evictions, and both nearly vanish at 65536 because the exact keys repeat after more than 4096 draws. In your trace 87 % of the misses are user words/pointers only, which no entry count can turn into hits. So the change only helps titles whose exact keys come back after the 4096 window, and it costs a title like GTA V nothing measurable. Shape-side reuse like #20315's is the right lever there.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

The reviewed change raises the draw cache’s default entry limit and adds a capacity regression test; the inspected code supports the stated behavior, while reported test results were not independently run.

What I ran

No commands were run. I inspected the prepared diff and changed files at head 96e5323f46d840d951c6391c51fa289d38dcc989 using repo_read.py.

Results

Check Result Note
Diff and changed files passed All three changed files were read
Reported checks not run Results below are author-reported
Negative control not run No independent test execution

Negative control

Could not run a negative control. The PR description reports that restoring the default to 4096 makes the new test fail, but I did not run it.

Findings

Blocking

None.

Non-blocking

None.

Sources

  • DrawCache.cpp changes the fallback entry limit to 65536 at the reviewed commit. The cache eviction loop still enforces both entry and byte limits.
  • DrawCacheCapacity.cpp adds a test that submits 4352 distinct draws three times and checks cache hits and retained entry count at the reviewed commit.
  • ENVIRONMENT.md documents the updated default and override at the reviewed commit.

Not verified

  • I did not run the reported build, execution tests, conventions check, environment reference check, or performance captures; those results are author-reported in the PR description.
  • I read all changed files marked reviewed in manifest.json: DrawCache.cpp, DrawCacheCapacity.cpp, and ENVIRONMENT.md. No changed files were excluded by the supplied manifest.
  • Runtime behavior and performance on other titles, hosts, GPUs, and memory limits were not independently verified.

To get this to a good state

Nothing is required.

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

Labels

agc libSceAgc* docs perf Performance change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants