perf(shader): eliminate redundant GetSrtResource and ReadConst in RVE #8727

Merged
hamb3r merged 2 commits from upstream-pr/8727 into main 2026-10-23 19:54:52 +00:00
hamb3r commented 2026-10-20 22:36:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-20T22:36:40Z.


What

  • Mark IrOpcode::GetSrtResource and IrOpcode::ReadConst as recomputable in RedundantValueEliminator so redundant SRT descriptor and flattened-SRT constant reads with identical arguments in the same or dominated basic blocks are eliminated before SPIR-V emission.
  • Track CFG memory epochs (ValueKey::memoryEpoch) across buffer/address writes, atomics, and barriers (ClobbersReadConst) via a reverse-post-order fixed-point pass so ReadConst instructions separated by a memory clobber on intra-block, branch-merge, or loop-backedge paths are not merged.
  • Add unit tests in RedundantValueElimination.cpp covering dominated-block merging of GetSrtResource and ReadConst, intra-block store separation on the table address, branch-merge clobber propagation while preserving clean sibling-branch reuse, single-loop backedge store invalidation, and nested-loop fixed-point store propagation.

Tested

  • Windows 10.0.19045 (x86_64), NVIDIA GeForce RTX 3080 (driver 617.14):
    • Focused tests on origin/main (0c6a5bd5938f) and this PR (f2a0dc0b746b) with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:
      • ctest --test-dir build-portable -R "^agc_(redundant_value_elimination|shader_memory)$" -V: 2/2 Passed on both main and this PR.
      • Confirmed neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS and 0 VUID- validation errors are logged.
    • Demon's Souls (PPSA01341 v01.007.000, steady-state window after the first present with APS5_TRACE_SECONDS=10:5, 2 repeats on main and 2 repeats on this PR):

tools/trace_digest.py — main (0c6a5bd5938f, run 1, aps5-trace-0c6a5bd5938f-49564.json.gz)

seconds 10:5 from present 43: 152 presents, frame p50 31.5 / p90 35.2 / p99 80.0 / max 97.0 ms, GPU busy 8.9 ms per present
NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit 0c6a5bd593, dropped: no

{"commit":"0c6a5bd5938f","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_SECONDS":"10:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 10:5","first_present":43,"ms":5021.695},"presents":152,"frame_ms":{"p50":31.516,"p90":35.22,"p99":79.959,"max":96.956},"gpu_busy_ms_per_present":8.851,"worker_busy_pct":{"queue worker 0x0":98.856,"queue worker 0x20":98.774,"queue worker 0x28":96.226,"queue worker 0x30":99.279,"queue worker 0x48":95.739,"queue worker 0x50":98.865,"queue worker 0x38":95.845,"queue worker 0x40":99.118},"top_phases_ms_per_frame":{"Driver.Packet":256.294,"Driver.Packet.memory_wait":217.258,"Driver.Packet.dispatch":32.924,"Driver.Dispatch":28.978,"Vulkan.Dispatch":15.435,"Vulkan.Dispatch.shader_resources":13.825,"Resources.Complete":9.629,"Resources.Prepare":2.944},"trace_dropped":false,"trace":"aps5-trace-0c6a5bd5938f-49564.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 55: 97.0 ms at 436 ms: Driver.Packet (queue worker 0x30) 96.8, Driver.Packet (queue worker 0x50) 96.7, Driver.Packet (queue worker 0x40) 96.6, Driver.Packet.memory_wait (queue worker 0x50) 96.4
  • present 43: 80.0 ms at 0 ms: Driver.Packet (queue worker 0x0) 77.9, Driver.Packet (queue worker 0x48) 77.8, Driver.Packet.memory_wait (queue worker 0x48) 77.8, Driver.Packet (queue worker 0x20) 77.8
  • present 63: 60.2 ms at 761 ms: Driver.Packet (queue worker 0x30) 60.1, Driver.Packet (queue worker 0x40) 60.0, Driver.Packet (queue worker 0x20) 60.0, Driver.Packet (queue worker 0x50) 59.2
  • present 65: 51.3 ms at 866 ms: Driver.Packet (queue worker 0x30) 51.2, Driver.Packet (queue worker 0x40) 51.1, Driver.Packet (queue worker 0x50) 51.0, Driver.Packet (queue worker 0x20) 50.8
  • present 93: 47.4 ms at 1834 ms: Driver.Packet (queue worker 0x30) 47.2, Driver.Packet (queue worker 0x40) 47.2, Driver.Packet (queue worker 0x20) 47.1, Driver.Packet (queue worker 0x50) 46.7

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 33.0 0.0 Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0
queue worker 0x0 27.1 (82 %) 4.2 (13 %) 1.8 6.6 Driver.Packet 31.2, Driver.EndSubmission 0.0
presenter 0.5 (2 %) 0.5 (1 %) 32.0 0.1 VideoOut.Flip 1.0, Driver.Present 0.0
draw committer 2.6 (8 %) 1.1 (3 %) 29.3 0.5 Vulkan.DispatchRecipe 1.2, Graphics.Draw 1.2
queue worker 0x20 1.6 (5 %) 31.1 (94 %) 0.3 0.5 Driver.Packet 32.4, Driver.EndSubmission 0.1
queue worker 0x28 1.1 (3 %) 31.7 (96 %) 0.3 1.0 Driver.Packet 31.1, Driver.EndSubmission 0.5
queue worker 0x30 1.4 (4 %) 31.4 (95 %) 0.3 0.2 Driver.Packet 32.5, Driver.EndSubmission 0.2
queue worker 0x48 0.0 (0 %) 32.9 (100 %) 0.1 0.0 Driver.Packet 31.3, Driver.EndSubmission 0.3
queue worker 0x50 0.9 (3 %) 31.8 (96 %) 0.4 0.5 Driver.Packet 32.0, Driver.EndSubmission 0.5
queue worker 0x38 1.6 (5 %) 31.2 (95 %) 0.2 0.3 Driver.Packet 31.2, Driver.EndSubmission 0.4
queue worker 0x40 0.7 (2 %) 32.0 (97 %) 0.3 0.5 Driver.Packet 32.5, Driver.EndSubmission 0.1
gpu 8.9 (27 %) 0.0 (0 %) 24.2 0.0 batch 8.9

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 254.2, Driver.Packet.memory_wait 217.2, Driver.Packet.dispatch 32.4, Driver.Dispatch 28.2, Vulkan.Dispatch 14.8, Vulkan.Dispatch.shader_resources 13.5, Resources.Complete 9.6, batch 8.9, Driver.WorkerWait 4.2, Driver.WorkerWait.idle_and_completion_poll 4.1

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x50) 93.5 ms at 440 ms, present 55
  • Driver.Packet.memory_wait (queue worker 0x40) 92.3 ms at 441 ms, present 55
  • Driver.Packet.memory_wait (queue worker 0x20) 92.1 ms at 441 ms, present 55
  • Driver.Packet.memory_wait (queue worker 0x30) 91.5 ms at 442 ms, present 55
  • Driver.Packet.memory_wait (queue worker 0x38) 85.5 ms at 447 ms, present 55
  • Driver.Packet.memory_wait (queue worker 0x48) 75.0 ms at 2 ms, present 43
  • Driver.Packet.memory_wait (queue worker 0x28) 74.9 ms at 2 ms, present 43
  • Driver.Packet.memory_wait (queue worker 0x48) 67.9 ms at 465 ms, present 55
  • Driver.Packet.memory_wait (queue worker 0x28) 66.2 ms at 467 ms, present 55
  • Driver.Packet.memory_wait (queue worker 0x50) 57.5 ms at 765 ms, present 63

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

  • batch 962: 2.6 ms at 1130 ms, present 72: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.6, Graphics.Draw.draw_and_resource_release (draw committer) 0.6, Resources.Prepare (draw committer) 0.1, Resources.Complete (draw committer) 0.1
  • batch 708: 2.4 ms at 865 ms, present 64: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0
  • batch 3651: 2.2 ms at 3864 ms, present 156: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0
  • batch 771: 2.2 ms at 947 ms, present 66: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0
  • batch 3402: 2.2 ms at 3614 ms, present 148: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0

tools/trace_digest.py — main (0c6a5bd5938f, run 2, aps5-trace-0c6a5bd5938f-47980.json.gz)

seconds 10:5 from present 68: 163 presents, frame p50 30.6 / p90 33.1 / p99 38.9 / max 43.7 ms, GPU busy 8.8 ms per present
NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit 0c6a5bd593, dropped: no

{"commit":"0c6a5bd5938f","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_SECONDS":"10:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 10:5","first_present":68,"ms":5023.09},"presents":163,"frame_ms":{"p50":30.593,"p90":33.102,"p99":38.905,"max":43.708},"gpu_busy_ms_per_present":8.827,"worker_busy_pct":{"queue worker 0x0":98.814,"queue worker 0x20":98.819,"queue worker 0x28":96.389,"queue worker 0x30":99.46,"queue worker 0x38":95.874,"queue worker 0x40":99.376,"queue worker 0x48":95.561,"queue worker 0x50":99.146},"top_phases_ms_per_frame":{"Driver.Packet":239.406,"Driver.Packet.memory_wait":204.09,"Driver.Packet.dispatch":29.369,"Driver.Dispatch":25.554,"Vulkan.Dispatch":14.472,"Vulkan.Dispatch.shader_resources":12.957,"Resources.Complete":9.201,"Resources.Prepare":2.802},"trace_dropped":false,"trace":"aps5-trace-0c6a5bd5938f-47980.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 116: 43.7 ms at 1504 ms: Driver.Packet (queue worker 0x30) 43.6, Driver.Packet (queue worker 0x40) 43.5, Driver.Packet (queue worker 0x20) 43.4, Driver.Packet (queue worker 0x50) 43.4
  • present 80: 38.9 ms at 389 ms: Driver.Packet (queue worker 0x30) 38.8, Driver.Packet (queue worker 0x50) 38.6, Driver.Packet (queue worker 0x40) 38.2, Driver.Packet.memory_wait (queue worker 0x50) 37.9
  • present 75: 38.3 ms at 223 ms: Driver.Packet (queue worker 0x30) 38.1, Driver.Packet (queue worker 0x40) 38.1, Driver.Packet (queue worker 0x50) 38.0, Driver.Packet.memory_wait (queue worker 0x40) 37.5
  • present 191: 37.1 ms at 3814 ms: Driver.Packet (queue worker 0x30) 36.6, Driver.Packet (queue worker 0x40) 36.5, Driver.Packet.memory_wait (queue worker 0x40) 35.7, Driver.Packet.memory_wait (queue worker 0x30) 35.6
  • present 157: 35.9 ms at 2790 ms: Driver.Packet (queue worker 0x30) 35.7, Driver.Packet (queue worker 0x40) 35.7, Driver.Packet (queue worker 0x50) 35.2, Driver.Packet (queue worker 0x20) 35.1

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0
queue worker 0x0 25.1 (81 %) 4.0 (13 %) 1.7 6.6 Driver.Packet 29.0, Driver.EndSubmission 0.0
presenter 0.6 (2 %) 0.5 (2 %) 29.8 0.1 VideoOut.Flip 1.1, Driver.Present 0.0
draw committer 2.6 (9 %) 1.0 (3 %) 27.1 0.5 Vulkan.DispatchRecipe 1.3, Graphics.Draw 1.1
queue worker 0x20 1.7 (6 %) 28.8 (93 %) 0.3 0.5 Driver.Packet 30.1, Driver.EndSubmission 0.2
queue worker 0x28 0.9 (3 %) 29.6 (96 %) 0.3 1.0 Driver.Packet 28.9, Driver.EndSubmission 0.5
queue worker 0x30 1.0 (3 %) 29.6 (96 %) 0.2 0.2 Driver.Packet 30.4, Driver.EndSubmission 0.2
queue worker 0x38 1.2 (4 %) 29.4 (95 %) 0.2 0.3 Driver.Packet 29.1, Driver.EndSubmission 0.4
queue worker 0x40 0.7 (2 %) 29.8 (97 %) 0.3 0.5 Driver.Packet 30.4, Driver.EndSubmission 0.1
queue worker 0x48 0.0 (0 %) 30.7 (100 %) 0.1 0.0 Driver.Packet 29.2, Driver.EndSubmission 0.3
queue worker 0x50 0.8 (2 %) 29.7 (96 %) 0.3 0.5 Driver.Packet 30.2, Driver.EndSubmission 0.2
title 0.0 (0 %) 0.0 (0 %) 30.8 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
gpu 8.8 (29 %) 0.0 (0 %) 22.0 0.0 batch 8.8

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 237.3, Driver.Packet.memory_wait 204.0, Driver.Packet.dispatch 28.8, Driver.Dispatch 24.8, Vulkan.Dispatch 13.9, Vulkan.Dispatch.shader_resources 12.6, Resources.Complete 9.2, batch 8.8, Driver.WorkerWait 3.8, Driver.WorkerWait.idle_and_completion_poll 3.7

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x50) 40.0 ms at 1508 ms, present 116
  • Driver.Packet.memory_wait (queue worker 0x20) 39.6 ms at 1509 ms, present 116
  • Driver.Packet.memory_wait (queue worker 0x40) 39.2 ms at 1509 ms, present 116
  • Driver.Packet.memory_wait (queue worker 0x48) 39.0 ms at 1506 ms, present 116
  • Driver.Packet.memory_wait (queue worker 0x28) 38.9 ms at 1506 ms, present 116
  • Driver.Packet.memory_wait (queue worker 0x30) 38.6 ms at 1510 ms, present 116
  • Driver.Packet.memory_wait (queue worker 0x50) 36.0 ms at 392 ms, present 80
  • Driver.Packet.memory_wait (queue worker 0x50) 35.6 ms at 226 ms, present 75
  • Driver.Packet.memory_wait (queue worker 0x40) 35.3 ms at 226 ms, present 75
  • Driver.Packet.memory_wait (queue worker 0x40) 35.2 ms at 393 ms, present 80

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

  • batch 2233: 2.4 ms at 2195 ms, present 137: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0
  • batch 1136: 2.1 ms at 1115 ms, present 103: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 2.7, Driver.Packet.device_lock (queue worker 0x0) 2.2, Vulkan.Dispatch.shader_resources (queue worker 0x0) 2.0, Driver.Packet.dispatch (queue worker 0x0) 0.5
  • batch 516: 2.0 ms at 522 ms, present 83: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0
  • batch 4772: 2.0 ms at 4615 ms, present 217: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4, Resources.Complete (draw committer) 0.1, Resources.Prepare (draw committer) 0.1
  • batch 4734: 2.0 ms at 4577 ms, present 216: GPU no ranges; recorded by GpuMutex.wait.label (draw committer) 0.4

tools/trace_digest.py — PR (f2a0dc0b746b, run 1, aps5-trace-f2a0dc0b746b-48664.json.gz)

seconds 10:5 from present 57: 165 presents, frame p50 29.9 / p90 32.8 / p99 45.9 / max 48.6 ms, GPU busy 8.6 ms per present
NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit f2a0dc0b74, dropped: no

{"commit":"f2a0dc0b746b","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_SECONDS":"10:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 10:5","first_present":57,"ms":5014.237},"presents":165,"frame_ms":{"p50":29.866,"p90":32.776,"p99":45.885,"max":48.558},"gpu_busy_ms_per_present":8.562,"worker_busy_pct":{"queue worker 0x0":98.922,"queue worker 0x20":99.492,"queue worker 0x28":96.395,"queue worker 0x30":99.88,"queue worker 0x38":96.133,"queue worker 0x40":99.752,"queue worker 0x48":95.717,"queue worker 0x50":99.408},"top_phases_ms_per_frame":{"Driver.Packet":236.767,"Driver.Packet.memory_wait":201.316,"Driver.Packet.dispatch":29.519,"Driver.Dispatch":25.642,"Vulkan.Dispatch":14.363,"Vulkan.Dispatch.shader_resources":12.833,"Resources.Complete":9.047,"Resources.Prepare":2.656},"trace_dropped":false,"trace":"aps5-trace-f2a0dc0b746b-48664.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 195: 48.6 ms at 4187 ms: Driver.Packet (queue worker 0x40) 48.3, Driver.Packet (queue worker 0x20) 48.2, Driver.Packet (queue worker 0x50) 48.1, Driver.Packet (queue worker 0x30) 47.9
  • present 133: 45.9 ms at 2314 ms: Driver.Packet (queue worker 0x30) 45.7, Driver.Packet (queue worker 0x20) 45.6, Driver.Packet (queue worker 0x40) 45.5, Driver.Packet (queue worker 0x50) 45.2
  • present 139: 38.8 ms at 2517 ms: Driver.Packet (queue worker 0x30) 38.6, Driver.Packet (queue worker 0x40) 38.6, Driver.Packet (queue worker 0x50) 38.6, Driver.Packet (queue worker 0x20) 38.5
  • present 76: 35.7 ms at 585 ms: Driver.Packet (queue worker 0x40) 35.5, Driver.Packet (queue worker 0x20) 35.2, Driver.Packet (queue worker 0x50) 34.6, Driver.Packet.memory_wait (queue worker 0x40) 34.0
  • present 97: 35.4 ms at 1227 ms: Driver.Packet (queue worker 0x30) 35.3, Driver.Packet (queue worker 0x40) 35.2, Driver.Packet (queue worker 0x50) 35.1, Driver.Packet (queue worker 0x20) 35.1

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
queue worker 0x0 24.7 (81 %) 3.9 (13 %) 1.7 6.7 Driver.Packet 28.6, Driver.EndSubmission 0.0
presenter 0.6 (2 %) 0.4 (1 %) 29.4 0.1 VideoOut.Flip 1.0, Driver.Present 0.0
draw committer 2.7 (9 %) 1.3 (4 %) 26.5 0.5 Graphics.Draw 1.2, Vulkan.DispatchRecipe 1.2
queue worker 0x20 1.6 (5 %) 28.7 (94 %) 0.1 0.5 Driver.Packet 30.0, Driver.EndSubmission 0.2
queue worker 0x28 1.0 (3 %) 29.1 (96 %) 0.3 1.0 Driver.Packet 28.6, Driver.EndSubmission 0.4
queue worker 0x30 1.1 (4 %) 29.2 (96 %) 0.1 0.2 Driver.Packet 30.0, Driver.EndSubmission 0.3
queue worker 0x38 1.4 (4 %) 28.9 (95 %) 0.1 0.3 Driver.Packet 28.8, Driver.EndSubmission 0.4
queue worker 0x40 0.8 (3 %) 29.4 (97 %) 0.1 0.5 Driver.Packet 30.1, Driver.EndSubmission 0.1
queue worker 0x48 0.1 (0 %) 30.3 (100 %) 0.1 0.0 Driver.Packet 28.8, Driver.EndSubmission 0.3
queue worker 0x50 0.9 (3 %) 29.3 (96 %) 0.2 0.5 Driver.Packet 29.8, Driver.EndSubmission 0.2
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 30.4 0.0 Shader.ResolveGraphicsStagesAbi 0.0
gpu 8.5 (28 %) 0.0 (0 %) 21.8 0.0 batch 8.5

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 234.7, Driver.Packet.memory_wait 201.2, Driver.Packet.dispatch 29.0, Driver.Dispatch 24.9, Vulkan.Dispatch 13.8, Vulkan.Dispatch.shader_resources 12.5, Resources.Complete 9.0, batch 8.5, Driver.WorkerWait 3.8, Driver.WorkerWait.idle_and_completion_poll 3.7

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x40) 45.1 ms at 4190 ms, present 195
  • Driver.Packet.memory_wait (queue worker 0x50) 44.9 ms at 4190 ms, present 195
  • Driver.Packet.memory_wait (queue worker 0x20) 44.2 ms at 4191 ms, present 195
  • Driver.Packet.memory_wait (queue worker 0x30) 43.5 ms at 4191 ms, present 195
  • Driver.Packet.memory_wait (queue worker 0x48) 43.0 ms at 4188 ms, present 195
  • Driver.Packet.memory_wait (queue worker 0x28) 42.9 ms at 4188 ms, present 195
  • Driver.Packet.memory_wait (queue worker 0x50) 42.1 ms at 2318 ms, present 133
  • Driver.Packet.memory_wait (queue worker 0x48) 40.9 ms at 2316 ms, present 133
  • Driver.Packet.memory_wait (queue worker 0x28) 40.9 ms at 2316 ms, present 133
  • Driver.Packet.memory_wait (queue worker 0x20) 40.9 ms at 2319 ms, present 133

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

  • batch 4242: 2.5 ms at 4013 ms, present 189: GPU no ranges; recorded by GpuMutex.wait.fill (draw committer) 0.3, Vulkan.DispatchRecipe (draw committer) 0.3, Vulkan.DispatchRecipe.command_record (draw committer) 0.3, GpuMutex.wait.dispatch (draw committer) 0.0
  • batch 628: 2.3 ms at 594 ms, present 76: GPU no ranges; recorded by GpuMutex.wait.label (draw committer) 0.4, Vulkan.DispatchRecipe (draw committer) 0.1, Vulkan.DispatchRecipe.command_record (draw committer) 0.1, Recorder.Reap (draw committer) 0.1
  • batch 1972: 2.2 ms at 1861 ms, present 118: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.5, Graphics.Draw.draw_and_resource_release (draw committer) 0.5, Resources.Complete (draw committer) 0.1, Resources.Prepare (draw committer) 0.1
  • batch 951: 2.1 ms at 912 ms, present 86: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4, Vulkan.DispatchRecipe (draw committer) 0.1, Vulkan.DispatchRecipe.command_record (draw committer) 0.1
  • batch 2979: 2.0 ms at 2846 ms, present 149: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.3, Graphics.Draw.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.0

tools/trace_digest.py — PR (f2a0dc0b746b, run 2, aps5-trace-f2a0dc0b746b-55396.json.gz)

seconds 10:5 from present 64: 153 presents, frame p50 30.9 / p90 39.7 / p99 56.0 / max 81.1 ms, GPU busy 8.4 ms per present
NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit f2a0dc0b74, dropped: no

{"commit":"f2a0dc0b746b","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_SECONDS":"10:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 10:5","first_present":64,"ms":5036.183},"presents":153,"frame_ms":{"p50":30.914,"p90":39.681,"p99":55.983,"max":81.075},"gpu_busy_ms_per_present":8.411,"worker_busy_pct":{"queue worker 0x0":98.749,"queue worker 0x20":98.611,"queue worker 0x28":96.382,"queue worker 0x40":99.133,"queue worker 0x48":95.804,"queue worker 0x30":99.354,"queue worker 0x38":96.114,"queue worker 0x50":99.593},"top_phases_ms_per_frame":{"Driver.Packet":255.495,"Driver.Packet.memory_wait":217.194,"Driver.Packet.dispatch":31.864,"Driver.Dispatch":27.956,"Vulkan.Dispatch":15.315,"Vulkan.Dispatch.shader_resources":13.668,"Resources.Complete":9.538,"Resources.Prepare":3.356},"trace_dropped":false,"trace":"aps5-trace-f2a0dc0b746b-55396.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 193: 81.1 ms at 4073 ms: Driver.Packet (queue worker 0x40) 80.9, Driver.Packet (queue worker 0x50) 80.7, Driver.Packet.memory_wait (queue worker 0x40) 80.2, Driver.Packet (queue worker 0x20) 80.1
  • present 210: 56.0 ms at 4752 ms: Driver.Packet (queue worker 0x30) 55.8, Driver.Packet (queue worker 0x40) 55.8, Driver.Packet (queue worker 0x50) 55.7, Driver.Packet (queue worker 0x20) 55.4
  • present 188: 55.8 ms at 3836 ms: Driver.Packet (queue worker 0x30) 55.6, Driver.Packet (queue worker 0x50) 55.6, Driver.Packet (queue worker 0x40) 55.6, Driver.Packet (queue worker 0x20) 55.6
  • present 204: 50.5 ms at 4503 ms: Driver.Packet (queue worker 0x40) 50.3, Driver.Packet (queue worker 0x30) 50.3, Driver.Packet (queue worker 0x20) 50.2, Driver.Packet (queue worker 0x50) 50.1
  • present 154: 49.0 ms at 2726 ms: Driver.Packet (queue worker 0x30) 48.9, Driver.Packet (queue worker 0x40) 48.8, Driver.Packet (queue worker 0x50) 48.7, Driver.Packet.memory_wait (queue worker 0x50) 48.6

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
queue worker 0x0 27.3 (83 %) 3.9 (12 %) 1.8 6.8 Driver.Packet 31.0, Driver.EndSubmission 0.0
presenter 0.6 (2 %) 0.5 (1 %) 31.9 0.1 VideoOut.Flip 1.0, Driver.Present 0.0
draw committer 2.7 (8 %) 1.2 (4 %) 29.0 0.5 Vulkan.DispatchRecipe 1.2, Graphics.Draw 1.2
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
queue worker 0x20 1.4 (4 %) 31.1 (95 %) 0.3 0.6 Driver.Packet 32.2, Driver.EndSubmission 0.2
queue worker 0x28 1.0 (3 %) 31.6 (96 %) 0.3 1.0 Driver.Packet 30.8, Driver.EndSubmission 0.7
queue worker 0x40 0.8 (2 %) 31.8 (97 %) 0.4 0.5 Driver.Packet 32.4, Driver.EndSubmission 0.1
queue worker 0x48 0.1 (0 %) 32.8 (100 %) 0.1 0.0 Driver.Packet 31.1, Driver.EndSubmission 0.4
queue worker 0x30 1.0 (3 %) 31.7 (96 %) 0.2 0.2 Driver.Packet 32.4, Driver.EndSubmission 0.3
queue worker 0x38 1.3 (4 %) 31.4 (95 %) 0.2 0.3 Driver.Packet 31.1, Driver.EndSubmission 0.5
queue worker 0x50 0.9 (3 %) 31.8 (97 %) 0.2 0.5 Driver.Packet 32.4, Driver.EndSubmission 0.2
title 0.0 (0 %) 0.0 (0 %) 32.9 0.0 Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0
gpu 8.5 (26 %) 0.0 (0 %) 24.5 0.0 batch 8.5

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 253.4, Driver.Packet.memory_wait 217.1, Driver.Packet.dispatch 31.3, Driver.Dispatch 27.2, Vulkan.Dispatch 14.7, Vulkan.Dispatch.shader_resources 13.2, Resources.Complete 9.4, batch 8.5, Driver.WorkerWait 3.9, Driver.WorkerWait.idle_and_completion_poll 3.9

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x50) 78.5 ms at 4076 ms, present 193
  • Driver.Packet.memory_wait (queue worker 0x40) 77.1 ms at 4077 ms, present 193
  • Driver.Packet.memory_wait (queue worker 0x20) 76.2 ms at 4078 ms, present 193
  • Driver.Packet.memory_wait (queue worker 0x48) 75.2 ms at 4075 ms, present 193
  • Driver.Packet.memory_wait (queue worker 0x28) 75.2 ms at 4075 ms, present 193
  • Driver.Packet.memory_wait (queue worker 0x30) 73.2 ms at 4081 ms, present 193
  • Driver.Packet.memory_wait (queue worker 0x38) 69.4 ms at 4085 ms, present 193
  • Driver.Packet.memory_wait (queue worker 0x40) 51.2 ms at 4757 ms, present 210
  • Driver.Packet.memory_wait (queue worker 0x28) 50.7 ms at 4754 ms, present 210
  • Driver.Packet.memory_wait (queue worker 0x50) 50.7 ms at 4758 ms, present 210

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

  • batch 4265: 2.9 ms at 4240 ms, present 196: GPU no ranges; recorded by GpuMutex.wait.fill (draw committer) 0.5, Vulkan.DispatchRecipe (draw committer) 0.1, Vulkan.DispatchRecipe.command_record (draw committer) 0.1, GpuMutex.wait.dispatch (draw committer) 0.1
  • batch 3975: 2.4 ms at 3834 ms, present 187: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1, Recorder.Reap (draw committer) 0.0
  • batch 4766: 2.3 ms at 4845 ms, present 211: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1
  • batch 4497: 2.2 ms at 4502 ms, present 203: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0
  • batch 3138: 2.2 ms at 2992 ms, present 161: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 7.5, Driver.Packet.dispatch (queue worker 0x0) 4.7, Driver.Dispatch (queue worker 0x0) 4.7, Vulkan.Dispatch.shader_resources (queue worker 0x0) 3.3

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080, driver 617.14, Windows 10.0.19045
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4943450034 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8727). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-20T22:36:40Z. --- ### What - Mark `IrOpcode::GetSrtResource` and `IrOpcode::ReadConst` as recomputable in `RedundantValueEliminator` so redundant SRT descriptor and flattened-SRT constant reads with identical arguments in the same or dominated basic blocks are eliminated before SPIR-V emission. - Track CFG memory epochs (`ValueKey::memoryEpoch`) across buffer/address writes, atomics, and barriers (`ClobbersReadConst`) via a reverse-post-order fixed-point pass so `ReadConst` instructions separated by a memory clobber on intra-block, branch-merge, or loop-backedge paths are not merged. - Add unit tests in `RedundantValueElimination.cpp` covering dominated-block merging of `GetSrtResource` and `ReadConst`, intra-block store separation on the table address, branch-merge clobber propagation while preserving clean sibling-branch reuse, single-loop backedge store invalidation, and nested-loop fixed-point store propagation. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Windows 10.0.19045 (`x86_64`), NVIDIA GeForce RTX 3080 (driver `617.14`): - Focused tests on `origin/main` (`0c6a5bd5938f`) and this PR (`f2a0dc0b746b`) with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: - `ctest --test-dir build-portable -R "^agc_(redundant_value_elimination|shader_memory)$" -V`: `2/2 Passed` on both `main` and this PR. - Confirmed neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS` and `0` `VUID-` validation errors are logged. - Demon's Souls (`PPSA01341` v01.007.000, steady-state window after the first present with `APS5_TRACE_SECONDS=10:5`, 2 repeats on `main` and 2 repeats on this PR): - `gpu_busy_ms_per_present`: `8.851` and `8.827` ms on `main` (mean `8.839` ms) vs `8.562` and `8.411` ms on this PR (mean `8.487` ms, `-4.0%`). - `frame_ms.p50`: `31.516` and `30.593` ms on `main` vs `29.866` and `30.914` ms on this PR. - Attached raw trace files: - `main` (`0c6a5bd5938f`, run 1): [`aps5-trace-0c6a5bd5938f-49564.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-0c6a5bd5938f-49564.json.gz) - `main` (`0c6a5bd5938f`, run 2): [`aps5-trace-0c6a5bd5938f-47980.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-0c6a5bd5938f-47980.json.gz) - PR (`f2a0dc0b746b`, run 1): [`aps5-trace-f2a0dc0b746b-48664.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-f2a0dc0b746b-48664.json.gz) - PR (`f2a0dc0b746b`, run 2): [`aps5-trace-f2a0dc0b746b-55396.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-f2a0dc0b746b-55396.json.gz) #### `tools/trace_digest.py` — `main` (`0c6a5bd5938f`, run 1, [`aps5-trace-0c6a5bd5938f-49564.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-0c6a5bd5938f-49564.json.gz)) **seconds 10:5** from present 43: 152 presents, frame p50 31.5 / p90 35.2 / p99 80.0 / max 97.0 ms, GPU busy 8.9 ms per present NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit 0c6a5bd5938f, dropped: no ```json {"commit":"0c6a5bd5938f","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_SECONDS":"10:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 10:5","first_present":43,"ms":5021.695},"presents":152,"frame_ms":{"p50":31.516,"p90":35.22,"p99":79.959,"max":96.956},"gpu_busy_ms_per_present":8.851,"worker_busy_pct":{"queue worker 0x0":98.856,"queue worker 0x20":98.774,"queue worker 0x28":96.226,"queue worker 0x30":99.279,"queue worker 0x48":95.739,"queue worker 0x50":98.865,"queue worker 0x38":95.845,"queue worker 0x40":99.118},"top_phases_ms_per_frame":{"Driver.Packet":256.294,"Driver.Packet.memory_wait":217.258,"Driver.Packet.dispatch":32.924,"Driver.Dispatch":28.978,"Vulkan.Dispatch":15.435,"Vulkan.Dispatch.shader_resources":13.825,"Resources.Complete":9.629,"Resources.Prepare":2.944},"trace_dropped":false,"trace":"aps5-trace-0c6a5bd5938f-49564.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 55: 97.0 ms at 436 ms: Driver.Packet (queue worker 0x30) 96.8, Driver.Packet (queue worker 0x50) 96.7, Driver.Packet (queue worker 0x40) 96.6, Driver.Packet.memory_wait (queue worker 0x50) 96.4 - present 43: 80.0 ms at 0 ms: Driver.Packet (queue worker 0x0) 77.9, Driver.Packet (queue worker 0x48) 77.8, Driver.Packet.memory_wait (queue worker 0x48) 77.8, Driver.Packet (queue worker 0x20) 77.8 - present 63: 60.2 ms at 761 ms: Driver.Packet (queue worker 0x30) 60.1, Driver.Packet (queue worker 0x40) 60.0, Driver.Packet (queue worker 0x20) 60.0, Driver.Packet (queue worker 0x50) 59.2 - present 65: 51.3 ms at 866 ms: Driver.Packet (queue worker 0x30) 51.2, Driver.Packet (queue worker 0x40) 51.1, Driver.Packet (queue worker 0x50) 51.0, Driver.Packet (queue worker 0x20) 50.8 - present 93: 47.4 ms at 1834 ms: Driver.Packet (queue worker 0x30) 47.2, Driver.Packet (queue worker 0x40) 47.2, Driver.Packet (queue worker 0x20) 47.1, Driver.Packet (queue worker 0x50) 46.7 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 33.0 | 0.0 | Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0 | | queue worker 0x0 | 27.1 (82 %) | 4.2 (13 %) | 1.8 | 6.6 | Driver.Packet 31.2, Driver.EndSubmission 0.0 | | presenter | 0.5 (2 %) | 0.5 (1 %) | 32.0 | 0.1 | VideoOut.Flip 1.0, Driver.Present 0.0 | | draw committer | 2.6 (8 %) | 1.1 (3 %) | 29.3 | 0.5 | Vulkan.DispatchRecipe 1.2, Graphics.Draw 1.2 | | queue worker 0x20 | 1.6 (5 %) | 31.1 (94 %) | 0.3 | 0.5 | Driver.Packet 32.4, Driver.EndSubmission 0.1 | | queue worker 0x28 | 1.1 (3 %) | 31.7 (96 %) | 0.3 | 1.0 | Driver.Packet 31.1, Driver.EndSubmission 0.5 | | queue worker 0x30 | 1.4 (4 %) | 31.4 (95 %) | 0.3 | 0.2 | Driver.Packet 32.5, Driver.EndSubmission 0.2 | | queue worker 0x48 | 0.0 (0 %) | 32.9 (100 %) | 0.1 | 0.0 | Driver.Packet 31.3, Driver.EndSubmission 0.3 | | queue worker 0x50 | 0.9 (3 %) | 31.8 (96 %) | 0.4 | 0.5 | Driver.Packet 32.0, Driver.EndSubmission 0.5 | | queue worker 0x38 | 1.6 (5 %) | 31.2 (95 %) | 0.2 | 0.3 | Driver.Packet 31.2, Driver.EndSubmission 0.4 | | queue worker 0x40 | 0.7 (2 %) | 32.0 (97 %) | 0.3 | 0.5 | Driver.Packet 32.5, Driver.EndSubmission 0.1 | | gpu | 8.9 (27 %) | 0.0 (0 %) | 24.2 | 0.0 | batch 8.9 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 254.2, Driver.Packet.memory_wait 217.2, Driver.Packet.dispatch 32.4, Driver.Dispatch 28.2, Vulkan.Dispatch 14.8, Vulkan.Dispatch.shader_resources 13.5, Resources.Complete 9.6, batch 8.9, Driver.WorkerWait 4.2, Driver.WorkerWait.idle_and_completion_poll 4.1 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x50) 93.5 ms at 440 ms, present 55 - Driver.Packet.memory_wait (queue worker 0x40) 92.3 ms at 441 ms, present 55 - Driver.Packet.memory_wait (queue worker 0x20) 92.1 ms at 441 ms, present 55 - Driver.Packet.memory_wait (queue worker 0x30) 91.5 ms at 442 ms, present 55 - Driver.Packet.memory_wait (queue worker 0x38) 85.5 ms at 447 ms, present 55 - Driver.Packet.memory_wait (queue worker 0x48) 75.0 ms at 2 ms, present 43 - Driver.Packet.memory_wait (queue worker 0x28) 74.9 ms at 2 ms, present 43 - Driver.Packet.memory_wait (queue worker 0x48) 67.9 ms at 465 ms, present 55 - Driver.Packet.memory_wait (queue worker 0x28) 66.2 ms at 467 ms, present 55 - Driver.Packet.memory_wait (queue worker 0x50) 57.5 ms at 765 ms, present 63 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 962: 2.6 ms at 1130 ms, present 72: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.6, Graphics.Draw.draw_and_resource_release (draw committer) 0.6, Resources.Prepare (draw committer) 0.1, Resources.Complete (draw committer) 0.1 - batch 708: 2.4 ms at 865 ms, present 64: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 - batch 3651: 2.2 ms at 3864 ms, present 156: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 - batch 771: 2.2 ms at 947 ms, present 66: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 - batch 3402: 2.2 ms at 3614 ms, present 148: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 #### `tools/trace_digest.py` — `main` (`0c6a5bd5938f`, run 2, [`aps5-trace-0c6a5bd5938f-47980.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-0c6a5bd5938f-47980.json.gz)) **seconds 10:5** from present 68: 163 presents, frame p50 30.6 / p90 33.1 / p99 38.9 / max 43.7 ms, GPU busy 8.8 ms per present NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit 0c6a5bd5938f, dropped: no ```json {"commit":"0c6a5bd5938f","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_SECONDS":"10:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 10:5","first_present":68,"ms":5023.09},"presents":163,"frame_ms":{"p50":30.593,"p90":33.102,"p99":38.905,"max":43.708},"gpu_busy_ms_per_present":8.827,"worker_busy_pct":{"queue worker 0x0":98.814,"queue worker 0x20":98.819,"queue worker 0x28":96.389,"queue worker 0x30":99.46,"queue worker 0x38":95.874,"queue worker 0x40":99.376,"queue worker 0x48":95.561,"queue worker 0x50":99.146},"top_phases_ms_per_frame":{"Driver.Packet":239.406,"Driver.Packet.memory_wait":204.09,"Driver.Packet.dispatch":29.369,"Driver.Dispatch":25.554,"Vulkan.Dispatch":14.472,"Vulkan.Dispatch.shader_resources":12.957,"Resources.Complete":9.201,"Resources.Prepare":2.802},"trace_dropped":false,"trace":"aps5-trace-0c6a5bd5938f-47980.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 116: 43.7 ms at 1504 ms: Driver.Packet (queue worker 0x30) 43.6, Driver.Packet (queue worker 0x40) 43.5, Driver.Packet (queue worker 0x20) 43.4, Driver.Packet (queue worker 0x50) 43.4 - present 80: 38.9 ms at 389 ms: Driver.Packet (queue worker 0x30) 38.8, Driver.Packet (queue worker 0x50) 38.6, Driver.Packet (queue worker 0x40) 38.2, Driver.Packet.memory_wait (queue worker 0x50) 37.9 - present 75: 38.3 ms at 223 ms: Driver.Packet (queue worker 0x30) 38.1, Driver.Packet (queue worker 0x40) 38.1, Driver.Packet (queue worker 0x50) 38.0, Driver.Packet.memory_wait (queue worker 0x40) 37.5 - present 191: 37.1 ms at 3814 ms: Driver.Packet (queue worker 0x30) 36.6, Driver.Packet (queue worker 0x40) 36.5, Driver.Packet.memory_wait (queue worker 0x40) 35.7, Driver.Packet.memory_wait (queue worker 0x30) 35.6 - present 157: 35.9 ms at 2790 ms: Driver.Packet (queue worker 0x30) 35.7, Driver.Packet (queue worker 0x40) 35.7, Driver.Packet (queue worker 0x50) 35.2, Driver.Packet (queue worker 0x20) 35.1 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0 | | queue worker 0x0 | 25.1 (81 %) | 4.0 (13 %) | 1.7 | 6.6 | Driver.Packet 29.0, Driver.EndSubmission 0.0 | | presenter | 0.6 (2 %) | 0.5 (2 %) | 29.8 | 0.1 | VideoOut.Flip 1.1, Driver.Present 0.0 | | draw committer | 2.6 (9 %) | 1.0 (3 %) | 27.1 | 0.5 | Vulkan.DispatchRecipe 1.3, Graphics.Draw 1.1 | | queue worker 0x20 | 1.7 (6 %) | 28.8 (93 %) | 0.3 | 0.5 | Driver.Packet 30.1, Driver.EndSubmission 0.2 | | queue worker 0x28 | 0.9 (3 %) | 29.6 (96 %) | 0.3 | 1.0 | Driver.Packet 28.9, Driver.EndSubmission 0.5 | | queue worker 0x30 | 1.0 (3 %) | 29.6 (96 %) | 0.2 | 0.2 | Driver.Packet 30.4, Driver.EndSubmission 0.2 | | queue worker 0x38 | 1.2 (4 %) | 29.4 (95 %) | 0.2 | 0.3 | Driver.Packet 29.1, Driver.EndSubmission 0.4 | | queue worker 0x40 | 0.7 (2 %) | 29.8 (97 %) | 0.3 | 0.5 | Driver.Packet 30.4, Driver.EndSubmission 0.1 | | queue worker 0x48 | 0.0 (0 %) | 30.7 (100 %) | 0.1 | 0.0 | Driver.Packet 29.2, Driver.EndSubmission 0.3 | | queue worker 0x50 | 0.8 (2 %) | 29.7 (96 %) | 0.3 | 0.5 | Driver.Packet 30.2, Driver.EndSubmission 0.2 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.8 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | gpu | 8.8 (29 %) | 0.0 (0 %) | 22.0 | 0.0 | batch 8.8 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 237.3, Driver.Packet.memory_wait 204.0, Driver.Packet.dispatch 28.8, Driver.Dispatch 24.8, Vulkan.Dispatch 13.9, Vulkan.Dispatch.shader_resources 12.6, Resources.Complete 9.2, batch 8.8, Driver.WorkerWait 3.8, Driver.WorkerWait.idle_and_completion_poll 3.7 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x50) 40.0 ms at 1508 ms, present 116 - Driver.Packet.memory_wait (queue worker 0x20) 39.6 ms at 1509 ms, present 116 - Driver.Packet.memory_wait (queue worker 0x40) 39.2 ms at 1509 ms, present 116 - Driver.Packet.memory_wait (queue worker 0x48) 39.0 ms at 1506 ms, present 116 - Driver.Packet.memory_wait (queue worker 0x28) 38.9 ms at 1506 ms, present 116 - Driver.Packet.memory_wait (queue worker 0x30) 38.6 ms at 1510 ms, present 116 - Driver.Packet.memory_wait (queue worker 0x50) 36.0 ms at 392 ms, present 80 - Driver.Packet.memory_wait (queue worker 0x50) 35.6 ms at 226 ms, present 75 - Driver.Packet.memory_wait (queue worker 0x40) 35.3 ms at 226 ms, present 75 - Driver.Packet.memory_wait (queue worker 0x40) 35.2 ms at 393 ms, present 80 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 2233: 2.4 ms at 2195 ms, present 137: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 - batch 1136: 2.1 ms at 1115 ms, present 103: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 2.7, Driver.Packet.device_lock (queue worker 0x0) 2.2, Vulkan.Dispatch.shader_resources (queue worker 0x0) 2.0, Driver.Packet.dispatch (queue worker 0x0) 0.5 - batch 516: 2.0 ms at 522 ms, present 83: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 - batch 4772: 2.0 ms at 4615 ms, present 217: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4, Resources.Complete (draw committer) 0.1, Resources.Prepare (draw committer) 0.1 - batch 4734: 2.0 ms at 4577 ms, present 216: GPU no ranges; recorded by GpuMutex.wait.label (draw committer) 0.4 #### `tools/trace_digest.py` — PR (`f2a0dc0b746b`, run 1, [`aps5-trace-f2a0dc0b746b-48664.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-f2a0dc0b746b-48664.json.gz)) **seconds 10:5** from present 57: 165 presents, frame p50 29.9 / p90 32.8 / p99 45.9 / max 48.6 ms, GPU busy 8.6 ms per present NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit f2a0dc0b746b, dropped: no ```json {"commit":"f2a0dc0b746b","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_SECONDS":"10:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 10:5","first_present":57,"ms":5014.237},"presents":165,"frame_ms":{"p50":29.866,"p90":32.776,"p99":45.885,"max":48.558},"gpu_busy_ms_per_present":8.562,"worker_busy_pct":{"queue worker 0x0":98.922,"queue worker 0x20":99.492,"queue worker 0x28":96.395,"queue worker 0x30":99.88,"queue worker 0x38":96.133,"queue worker 0x40":99.752,"queue worker 0x48":95.717,"queue worker 0x50":99.408},"top_phases_ms_per_frame":{"Driver.Packet":236.767,"Driver.Packet.memory_wait":201.316,"Driver.Packet.dispatch":29.519,"Driver.Dispatch":25.642,"Vulkan.Dispatch":14.363,"Vulkan.Dispatch.shader_resources":12.833,"Resources.Complete":9.047,"Resources.Prepare":2.656},"trace_dropped":false,"trace":"aps5-trace-f2a0dc0b746b-48664.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 195: 48.6 ms at 4187 ms: Driver.Packet (queue worker 0x40) 48.3, Driver.Packet (queue worker 0x20) 48.2, Driver.Packet (queue worker 0x50) 48.1, Driver.Packet (queue worker 0x30) 47.9 - present 133: 45.9 ms at 2314 ms: Driver.Packet (queue worker 0x30) 45.7, Driver.Packet (queue worker 0x20) 45.6, Driver.Packet (queue worker 0x40) 45.5, Driver.Packet (queue worker 0x50) 45.2 - present 139: 38.8 ms at 2517 ms: Driver.Packet (queue worker 0x30) 38.6, Driver.Packet (queue worker 0x40) 38.6, Driver.Packet (queue worker 0x50) 38.6, Driver.Packet (queue worker 0x20) 38.5 - present 76: 35.7 ms at 585 ms: Driver.Packet (queue worker 0x40) 35.5, Driver.Packet (queue worker 0x20) 35.2, Driver.Packet (queue worker 0x50) 34.6, Driver.Packet.memory_wait (queue worker 0x40) 34.0 - present 97: 35.4 ms at 1227 ms: Driver.Packet (queue worker 0x30) 35.3, Driver.Packet (queue worker 0x40) 35.2, Driver.Packet (queue worker 0x50) 35.1, Driver.Packet (queue worker 0x20) 35.1 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | queue worker 0x0 | 24.7 (81 %) | 3.9 (13 %) | 1.7 | 6.7 | Driver.Packet 28.6, Driver.EndSubmission 0.0 | | presenter | 0.6 (2 %) | 0.4 (1 %) | 29.4 | 0.1 | VideoOut.Flip 1.0, Driver.Present 0.0 | | draw committer | 2.7 (9 %) | 1.3 (4 %) | 26.5 | 0.5 | Graphics.Draw 1.2, Vulkan.DispatchRecipe 1.2 | | queue worker 0x20 | 1.6 (5 %) | 28.7 (94 %) | 0.1 | 0.5 | Driver.Packet 30.0, Driver.EndSubmission 0.2 | | queue worker 0x28 | 1.0 (3 %) | 29.1 (96 %) | 0.3 | 1.0 | Driver.Packet 28.6, Driver.EndSubmission 0.4 | | queue worker 0x30 | 1.1 (4 %) | 29.2 (96 %) | 0.1 | 0.2 | Driver.Packet 30.0, Driver.EndSubmission 0.3 | | queue worker 0x38 | 1.4 (4 %) | 28.9 (95 %) | 0.1 | 0.3 | Driver.Packet 28.8, Driver.EndSubmission 0.4 | | queue worker 0x40 | 0.8 (3 %) | 29.4 (97 %) | 0.1 | 0.5 | Driver.Packet 30.1, Driver.EndSubmission 0.1 | | queue worker 0x48 | 0.1 (0 %) | 30.3 (100 %) | 0.1 | 0.0 | Driver.Packet 28.8, Driver.EndSubmission 0.3 | | queue worker 0x50 | 0.9 (3 %) | 29.3 (96 %) | 0.2 | 0.5 | Driver.Packet 29.8, Driver.EndSubmission 0.2 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 30.4 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0 | | gpu | 8.5 (28 %) | 0.0 (0 %) | 21.8 | 0.0 | batch 8.5 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 234.7, Driver.Packet.memory_wait 201.2, Driver.Packet.dispatch 29.0, Driver.Dispatch 24.9, Vulkan.Dispatch 13.8, Vulkan.Dispatch.shader_resources 12.5, Resources.Complete 9.0, batch 8.5, Driver.WorkerWait 3.8, Driver.WorkerWait.idle_and_completion_poll 3.7 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x40) 45.1 ms at 4190 ms, present 195 - Driver.Packet.memory_wait (queue worker 0x50) 44.9 ms at 4190 ms, present 195 - Driver.Packet.memory_wait (queue worker 0x20) 44.2 ms at 4191 ms, present 195 - Driver.Packet.memory_wait (queue worker 0x30) 43.5 ms at 4191 ms, present 195 - Driver.Packet.memory_wait (queue worker 0x48) 43.0 ms at 4188 ms, present 195 - Driver.Packet.memory_wait (queue worker 0x28) 42.9 ms at 4188 ms, present 195 - Driver.Packet.memory_wait (queue worker 0x50) 42.1 ms at 2318 ms, present 133 - Driver.Packet.memory_wait (queue worker 0x48) 40.9 ms at 2316 ms, present 133 - Driver.Packet.memory_wait (queue worker 0x28) 40.9 ms at 2316 ms, present 133 - Driver.Packet.memory_wait (queue worker 0x20) 40.9 ms at 2319 ms, present 133 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 4242: 2.5 ms at 4013 ms, present 189: GPU no ranges; recorded by GpuMutex.wait.fill (draw committer) 0.3, Vulkan.DispatchRecipe (draw committer) 0.3, Vulkan.DispatchRecipe.command_record (draw committer) 0.3, GpuMutex.wait.dispatch (draw committer) 0.0 - batch 628: 2.3 ms at 594 ms, present 76: GPU no ranges; recorded by GpuMutex.wait.label (draw committer) 0.4, Vulkan.DispatchRecipe (draw committer) 0.1, Vulkan.DispatchRecipe.command_record (draw committer) 0.1, Recorder.Reap (draw committer) 0.1 - batch 1972: 2.2 ms at 1861 ms, present 118: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.5, Graphics.Draw.draw_and_resource_release (draw committer) 0.5, Resources.Complete (draw committer) 0.1, Resources.Prepare (draw committer) 0.1 - batch 951: 2.1 ms at 912 ms, present 86: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4, Vulkan.DispatchRecipe (draw committer) 0.1, Vulkan.DispatchRecipe.command_record (draw committer) 0.1 - batch 2979: 2.0 ms at 2846 ms, present 149: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.3, Graphics.Draw.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.0 #### `tools/trace_digest.py` — PR (`f2a0dc0b746b`, run 2, [`aps5-trace-f2a0dc0b746b-55396.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-f2a0dc0b746b-55396.json.gz)) **seconds 10:5** from present 64: 153 presents, frame p50 30.9 / p90 39.7 / p99 56.0 / max 81.1 ms, GPU busy 8.4 ms per present NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit f2a0dc0b746b, dropped: no ```json {"commit":"f2a0dc0b746b","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_SECONDS":"10:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 10:5","first_present":64,"ms":5036.183},"presents":153,"frame_ms":{"p50":30.914,"p90":39.681,"p99":55.983,"max":81.075},"gpu_busy_ms_per_present":8.411,"worker_busy_pct":{"queue worker 0x0":98.749,"queue worker 0x20":98.611,"queue worker 0x28":96.382,"queue worker 0x40":99.133,"queue worker 0x48":95.804,"queue worker 0x30":99.354,"queue worker 0x38":96.114,"queue worker 0x50":99.593},"top_phases_ms_per_frame":{"Driver.Packet":255.495,"Driver.Packet.memory_wait":217.194,"Driver.Packet.dispatch":31.864,"Driver.Dispatch":27.956,"Vulkan.Dispatch":15.315,"Vulkan.Dispatch.shader_resources":13.668,"Resources.Complete":9.538,"Resources.Prepare":3.356},"trace_dropped":false,"trace":"aps5-trace-f2a0dc0b746b-55396.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 193: 81.1 ms at 4073 ms: Driver.Packet (queue worker 0x40) 80.9, Driver.Packet (queue worker 0x50) 80.7, Driver.Packet.memory_wait (queue worker 0x40) 80.2, Driver.Packet (queue worker 0x20) 80.1 - present 210: 56.0 ms at 4752 ms: Driver.Packet (queue worker 0x30) 55.8, Driver.Packet (queue worker 0x40) 55.8, Driver.Packet (queue worker 0x50) 55.7, Driver.Packet (queue worker 0x20) 55.4 - present 188: 55.8 ms at 3836 ms: Driver.Packet (queue worker 0x30) 55.6, Driver.Packet (queue worker 0x50) 55.6, Driver.Packet (queue worker 0x40) 55.6, Driver.Packet (queue worker 0x20) 55.6 - present 204: 50.5 ms at 4503 ms: Driver.Packet (queue worker 0x40) 50.3, Driver.Packet (queue worker 0x30) 50.3, Driver.Packet (queue worker 0x20) 50.2, Driver.Packet (queue worker 0x50) 50.1 - present 154: 49.0 ms at 2726 ms: Driver.Packet (queue worker 0x30) 48.9, Driver.Packet (queue worker 0x40) 48.8, Driver.Packet (queue worker 0x50) 48.7, Driver.Packet.memory_wait (queue worker 0x50) 48.6 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | queue worker 0x0 | 27.3 (83 %) | 3.9 (12 %) | 1.8 | 6.8 | Driver.Packet 31.0, Driver.EndSubmission 0.0 | | presenter | 0.6 (2 %) | 0.5 (1 %) | 31.9 | 0.1 | VideoOut.Flip 1.0, Driver.Present 0.0 | | draw committer | 2.7 (8 %) | 1.2 (4 %) | 29.0 | 0.5 | Vulkan.DispatchRecipe 1.2, Graphics.Draw 1.2 | | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | queue worker 0x20 | 1.4 (4 %) | 31.1 (95 %) | 0.3 | 0.6 | Driver.Packet 32.2, Driver.EndSubmission 0.2 | | queue worker 0x28 | 1.0 (3 %) | 31.6 (96 %) | 0.3 | 1.0 | Driver.Packet 30.8, Driver.EndSubmission 0.7 | | queue worker 0x40 | 0.8 (2 %) | 31.8 (97 %) | 0.4 | 0.5 | Driver.Packet 32.4, Driver.EndSubmission 0.1 | | queue worker 0x48 | 0.1 (0 %) | 32.8 (100 %) | 0.1 | 0.0 | Driver.Packet 31.1, Driver.EndSubmission 0.4 | | queue worker 0x30 | 1.0 (3 %) | 31.7 (96 %) | 0.2 | 0.2 | Driver.Packet 32.4, Driver.EndSubmission 0.3 | | queue worker 0x38 | 1.3 (4 %) | 31.4 (95 %) | 0.2 | 0.3 | Driver.Packet 31.1, Driver.EndSubmission 0.5 | | queue worker 0x50 | 0.9 (3 %) | 31.8 (97 %) | 0.2 | 0.5 | Driver.Packet 32.4, Driver.EndSubmission 0.2 | | title | 0.0 (0 %) | 0.0 (0 %) | 32.9 | 0.0 | Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0 | | gpu | 8.5 (26 %) | 0.0 (0 %) | 24.5 | 0.0 | batch 8.5 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 253.4, Driver.Packet.memory_wait 217.1, Driver.Packet.dispatch 31.3, Driver.Dispatch 27.2, Vulkan.Dispatch 14.7, Vulkan.Dispatch.shader_resources 13.2, Resources.Complete 9.4, batch 8.5, Driver.WorkerWait 3.9, Driver.WorkerWait.idle_and_completion_poll 3.9 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x50) 78.5 ms at 4076 ms, present 193 - Driver.Packet.memory_wait (queue worker 0x40) 77.1 ms at 4077 ms, present 193 - Driver.Packet.memory_wait (queue worker 0x20) 76.2 ms at 4078 ms, present 193 - Driver.Packet.memory_wait (queue worker 0x48) 75.2 ms at 4075 ms, present 193 - Driver.Packet.memory_wait (queue worker 0x28) 75.2 ms at 4075 ms, present 193 - Driver.Packet.memory_wait (queue worker 0x30) 73.2 ms at 4081 ms, present 193 - Driver.Packet.memory_wait (queue worker 0x38) 69.4 ms at 4085 ms, present 193 - Driver.Packet.memory_wait (queue worker 0x40) 51.2 ms at 4757 ms, present 210 - Driver.Packet.memory_wait (queue worker 0x28) 50.7 ms at 4754 ms, present 210 - Driver.Packet.memory_wait (queue worker 0x50) 50.7 ms at 4758 ms, present 210 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 4265: 2.9 ms at 4240 ms, present 196: GPU no ranges; recorded by GpuMutex.wait.fill (draw committer) 0.5, Vulkan.DispatchRecipe (draw committer) 0.1, Vulkan.DispatchRecipe.command_record (draw committer) 0.1, GpuMutex.wait.dispatch (draw committer) 0.1 - batch 3975: 2.4 ms at 3834 ms, present 187: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1, Recorder.Reap (draw committer) 0.0 - batch 4766: 2.3 ms at 4845 ms, present 211: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1 - batch 4497: 2.2 ms at 4502 ms, present 203: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 - batch 3138: 2.2 ms at 2992 ms, present 161: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 7.5, Driver.Packet.dispatch (queue worker 0x0) 4.7, Driver.Dispatch (queue worker 0x0) 4.7, Vulkan.Dispatch.shader_resources (queue worker 0x0) 3.3 ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3080, driver 617.14, Windows 10.0.19045 - [x] AI-assisted: yes
MarcZX10 commented 2026-10-20 22:49:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T22:49:35Z.

Review: COMMENTED


The implementation and reported focused runtime/performance results look plausible, but the optimizer regression suite does not appear to exercise the two opcodes newly made recomputable. Could you add a small IR test proving duplicate GetSrtResource and ReadConst expressions with identical operands merge in a dominated block, while a different ReadConst slot (and a sibling-only expression) remains distinct? That would directly guard the new opcode classifications instead of relying on the general BitCast recomputation case. I have not approved pending that coverage.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5592765022 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8727#pullrequestreview-5592765022). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T22:49:35Z. **Review:** COMMENTED --- The implementation and reported focused runtime/performance results look plausible, but the optimizer regression suite does not appear to exercise the two opcodes newly made recomputable. Could you add a small IR test proving duplicate `GetSrtResource` and `ReadConst` expressions with identical operands merge in a dominated block, while a different `ReadConst` slot (and a sibling-only expression) remains distinct? That would directly guard the new opcode classifications instead of relying on the general BitCast recomputation case. I have not approved pending that coverage.
hamb3r commented 2026-10-20 23:56:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-20T23:56:18Z.


Added the requested RVE unit test in 6c57cc3631 (test(shader): cover GetSrtResource and ReadConst deduplication in RVE) and merged origin/main in 54bd2da7e0:

  1. Merge conflict resolution with origin/main (54bd2da7e0):
    • Upstream commits c9e38be258 and c76299f217 replaced RecordBdaFaultWords in EmitReadConst (SpirvMemoryInstructions.cpp) with an inline OpAtomicStore to BdaAbi::SrtGuardWord inside main (and added verifyGuardedNullPointers in ShaderMemory.cpp asserting one OpAtomicStore per guard in main), so 54bd2da7e0 adopts upstream SpirvMemoryInstructions.cpp / SpirvEmitterState.hpp and keeps this PR scoped to RedundantValueEliminator.cpp (pr_overlap.py now reports No overlap with open pull requests).
  2. GetSrtResource and ReadConst RVE regression test (6c57cc3631 in core/libs/prx/libSceAgcDriver/tests/RedundantValueElimination.cpp):
    • Verifies that duplicate GetSrtResource(0) and ReadConst(srt, 2) instructions in dominated blocks (then and merge) merge into the head definitions (b.eliminate() == 4u, !srtDominated.HasUses(), !readDominated.HasUses(), !srtMerge.HasUses(), !readMerge.HasUses()).
    • Verifies that ReadConst(srt, 3) with a different constant slot in the dominated block stays distinct while reusing the deduplicated srtHead operand (srtHead.UseCount() == 4u), and that sibling-only GetSrtResource(1) / ReadConst(..., 4) expressions in then and otherwise remain distinct (AllUsed({&readOtherSlot, &srtThenOnly, &readThenOnly, &srtSibling, &readSibling})).
  3. Line-by-line gcov coverage:
    • RedundantValueEliminator.cpp achieves 100.00% line coverage (119 / 119 executable lines):
      text File 'E:/AnyPS5_original/core/shader/recompiler/Optimization/src/RedundantValueEliminator.cpp' Lines executed:100.00% of 119 ... 2563 : 17 : bool Recomputable(IrOpcode opcode) { 2563 : 18 : switch (opcode) { 1697 : 19 : case IrOpcode::BitCastU16F16: ... - : 125 : case IrOpcode::GetSrtResource: - : 126 : case IrOpcode::ReadConst: 1697 : 127 : return true; 866 : 128 : default: 866 : 129 : return false;

cc @MarcZX10

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304490314 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8727#issuecomment-6304490314). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-20T23:56:18Z. --- Added the requested RVE unit test in `6c57cc3631` (`test(shader): cover GetSrtResource and ReadConst deduplication in RVE`) and merged `origin/main` in `54bd2da7e0`: 1. **Merge conflict resolution with `origin/main`** (`54bd2da7e0`): - Upstream commits `c9e38be258` and `c76299f217` replaced `RecordBdaFaultWords` in `EmitReadConst` (`SpirvMemoryInstructions.cpp`) with an inline `OpAtomicStore` to `BdaAbi::SrtGuardWord` inside `main` (and added `verifyGuardedNullPointers` in `ShaderMemory.cpp` asserting one `OpAtomicStore` per guard in `main`), so `54bd2da7e0` adopts upstream `SpirvMemoryInstructions.cpp` / `SpirvEmitterState.hpp` and keeps this PR scoped to `RedundantValueEliminator.cpp` (`pr_overlap.py` now reports `No overlap with open pull requests`). 2. **`GetSrtResource` and `ReadConst` RVE regression test** (`6c57cc3631` in `core/libs/prx/libSceAgcDriver/tests/RedundantValueElimination.cpp`): - Verifies that duplicate `GetSrtResource(0)` and `ReadConst(srt, 2)` instructions in dominated blocks (`then` and `merge`) merge into the `head` definitions (`b.eliminate() == 4u`, `!srtDominated.HasUses()`, `!readDominated.HasUses()`, `!srtMerge.HasUses()`, `!readMerge.HasUses()`). - Verifies that `ReadConst(srt, 3)` with a different constant slot in the dominated block stays distinct while reusing the deduplicated `srtHead` operand (`srtHead.UseCount() == 4u`), and that sibling-only `GetSrtResource(1)` / `ReadConst(..., 4)` expressions in `then` and `otherwise` remain distinct (`AllUsed({&readOtherSlot, &srtThenOnly, &readThenOnly, &srtSibling, &readSibling})`). 3. **Line-by-line `gcov` coverage**: - `RedundantValueEliminator.cpp` achieves `100.00%` line coverage (`119 / 119` executable lines): ``text File 'E:/AnyPS5_original/core/shader/recompiler/Optimization/src/RedundantValueEliminator.cpp' Lines executed:100.00% of 119 ... 2563 : 17 : bool Recomputable(IrOpcode opcode) { 2563 : 18 : switch (opcode) { 1697 : 19 : case IrOpcode::BitCastU16F16: ... - : 125 : case IrOpcode::GetSrtResource: - : 126 : case IrOpcode::ReadConst: 1697 : 127 : return true; 866 : 128 : default: 866 : 129 : return false; `` cc @MarcZX10
xXPBSXx commented 2026-10-21 05:44:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T05:44:53Z.


Independent Windows run of this PR (data only).

Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against main is clean. I built only agc_redundant_value_elimination_tests; ctest -N -R agc_redundant_value_elimination lists exactly one test.

Results (3 runs each):

  • PR head: agc_redundant_value_elimination passes 3/3.
  • Baseline: I kept the PR's test and replaced only core/shader/recompiler/Optimization/src/RedundantValueEliminator.cpp with the version from the PR's merge base (5b59fbc553), then rebuilt. The test fails 3/3 (Failed). I restored the PR's files afterwards.

GPU: the run output has no Selected GPU line; no GPU claim is made.

Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309013789 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8727#issuecomment-6309013789). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-21T05:44:53Z. --- Independent Windows run of this PR (data only). **Environment:** Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against `main` is clean. I built only `agc_redundant_value_elimination_tests`; `ctest -N -R agc_redundant_value_elimination` lists exactly one test. **Results (3 runs each):** - PR head: `agc_redundant_value_elimination` passes 3/3. - Baseline: I kept the PR's test and replaced only `core/shader/recompiler/Optimization/src/RedundantValueEliminator.cpp` with the version from the PR's merge base (`5b59fbc553`), then rebuilt. The test fails 3/3 (Failed). I restored the PR's files afterwards. **GPU:** the run output has no `Selected GPU` line; no GPU claim is made. **Not run:** other platforms, the other tests in the same family, the full repository CTest, and any title or console run. AI-assisted (Claude Code).
CnRJay commented 2026-10-21 18:05:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-21T18:05:54Z.

Review: COMMENTED


The change is two clean ideas (treat ReadConst and GetSrtResource with identical arguments as recomputable; outline the guarded SRT check into a non-inlined helper so it is not repeated at every read site), and GPU busy per present falling 51.6 to 43.2 ms is a real result. The headline number in the description is not one.

  • "frame_ms.p50 decreased from 970 to 160 ms (-83.55%) and window.ms from 181,523 to 8,382 ms". The base capture's first present took 178 s (present 1: 178158.2 ms, every queue worker in Driver.Packet for 178 s), the change's did not. That is a boot-time compile or load stall that differs between the two runs, not an effect of two shader passes, and p50 over five presents is dominated by it. Please report the GPU busy figure and a window taken after the first present (a steady stretch, APS5_TRACE_SECONDS=...), with a repeat of each, and drop the -83% from the description.
  • Outlining the guard with DontInline puts a function call on every guarded ReadConst instead of an inline branch. It reduced code size and busy time on this GPU; the cost of a call depends on the driver's inlining and register allocation. Please run the same pair on an AMD card (and note the driver), since the NVIDIA compiler is the least likely to care.
  • The description lists no test. Add one that the elimination keeps two ReadConsts whose arguments are identical but separated by a store the table can see (they are not redundant), so the recomputable marking cannot become a wrong deduplication later.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5604097417 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8727#pullrequestreview-5604097417). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-21T18:05:54Z. **Review:** COMMENTED --- The change is two clean ideas (treat `ReadConst` and `GetSrtResource` with identical arguments as recomputable; outline the guarded SRT check into a non-inlined helper so it is not repeated at every read site), and GPU busy per present falling 51.6 to 43.2 ms is a real result. The headline number in the description is not one. - "`frame_ms.p50` decreased from 970 to 160 ms (-83.55%) and `window.ms` from 181,523 to 8,382 ms". The base capture's first present took 178 s (`present 1: 178158.2 ms`, every queue worker in `Driver.Packet` for 178 s), the change's did not. That is a boot-time compile or load stall that differs between the two runs, not an effect of two shader passes, and p50 over five presents is dominated by it. Please report the GPU busy figure and a window taken after the first present (a steady stretch, `APS5_TRACE_SECONDS=...`), with a repeat of each, and drop the -83% from the description. - Outlining the guard with `DontInline` puts a function call on every guarded `ReadConst` instead of an inline branch. It reduced code size and busy time on this GPU; the cost of a call depends on the driver's inlining and register allocation. Please run the same pair on an AMD card (and note the driver), since the NVIDIA compiler is the least likely to care. - The description lists no test. Add one that the elimination keeps two `ReadConst`s whose arguments are identical but separated by a store the table can see (they are not redundant), so the recomputable marking cannot become a wrong deduplication later.
hamb3r commented 2026-10-21 21:25:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-21T21:25:33Z.


Thanks for the detailed review @CnRJay! All three points have been addressed in the rebased branch (f2a0dc0b746b on top of 0c6a5bd5938f):

  1. Steady-state performance traces (APS5_TRACE_SECONDS=10:5)

    • You were right about the original frames 0:5 numbers: present 1 in the main trace included a 178 s cold shader-compilation stall while the branch trace ran with a warm cache.
    • We wiped logs/ and shader_cache/, warmed up the shader cache for each build, and captured two steady-state repeats (APS5_TRACE_SECONDS=10:5 after the first present, "dirty": false) on origin/main (0c6a5bd5938f) and two on this PR (f2a0dc0b746b) in Demon's Souls (PPSA01341 v01.007.000):
    • The PR description has been updated with the attached .json.gz trace links and the full tools/trace_digest.py summaries for all four runs.
  2. DontInline helper removal & AMD GPU check

    • After c9e38be258 landed on main (shrinking the inline guarded SRT check in EmitReadConst to a single OpAtomicStore to SrtGuardWord), the out-of-line DontInline GuardedSrtFunction helper was already dropped in 54bd2da7e0, leaving stale mentions in the PR title and description.
    • We rebased cleanly onto origin/main without the obsolete DontInline commit and updated the PR title and body so they reflect the RVE-only change.
    • Because the DontInline helper is no longer part of the diff, the AMD GPU check for out-of-line DontInline call overhead does not apply to the current RVE-only change.
  3. Memory-clobber invalidation for ReadConst & unit tests

    • Added CFG memory-epoch tracking (ValueKey::memoryEpoch, separate from flags) in RedundantValueEliminator.cpp:
      • ClobbersReadConst(IrOpcode) checks BufferAccessOf (Write/Atomic), AddressOpcodeInfoOf (Write/Atomic), and IrOpcode::Barrier.
      • A reverse-post-order fixed-point pass propagates entryEpoch and exitEpoch across CFG predecessors, assigning a stable merge epoch when predecessor epochs differ and advancing the epoch at each clobber instruction.
      • ReadConst keys include memoryEpoch, preventing CSE across intra-block, branch-merge, or loop-backedge writes/atomics/barriers while preserving CSE before a store and on clean sibling branches.
    • Added unit tests in RedundantValueElimination.cpp (with program.srtReads linking ReadConst to a LoadAddressU32 on the table address and storing via StoreAddressU32 to the same address and offset):
      • Dominated-block merging of GetSrtResource and ReadConst while another slot or sibling block stays.
      • Intra-block StoreAddressU32 between two ReadConst instructions of the same slot prevents merging (b.eliminate() == 0u).
      • Store on the then branch only before merge: clean otherwise sibling reuses the head read, while the post-store read in then and the read in merge are not merged (b.eliminate() == 1u).
      • Store on a single-loop backedge (body -> header) prevents reusing the pre-loop ReadConst in header (b.eliminate() == 2u).
      • Store in an inner loop propagates across multiple fixed-point iterations to invalidate the outer loop header ReadConst (b.eliminate() == 2u).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6326903706 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8727#issuecomment-6326903706). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-21T21:25:33Z. --- Thanks for the detailed review @CnRJay! All three points have been addressed in the rebased branch (`f2a0dc0b746b` on top of `0c6a5bd5938f`): 1. **Steady-state performance traces (`APS5_TRACE_SECONDS=10:5`)** - You were right about the original `frames 0:5` numbers: `present 1` in the `main` trace included a 178 s cold shader-compilation stall while the branch trace ran with a warm cache. - We wiped `logs/` and `shader_cache/`, warmed up the shader cache for each build, and captured two steady-state repeats (`APS5_TRACE_SECONDS=10:5` after the first present, `"dirty": false`) on `origin/main` (`0c6a5bd5938f`) and two on this PR (`f2a0dc0b746b`) in Demon's Souls (`PPSA01341` v01.007.000): - `main` (`0c6a5bd5938f`): `gpu_busy_ms_per_present` = `8.851` ms and `8.827` ms (mean `8.839` ms); `frame_ms.p50` = `31.516` ms and `30.593` ms. - Run 1: [`aps5-trace-0c6a5bd5938f-49564.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-0c6a5bd5938f-49564.json.gz) - Run 2: [`aps5-trace-0c6a5bd5938f-47980.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-0c6a5bd5938f-47980.json.gz) - PR (`f2a0dc0b746b`): `gpu_busy_ms_per_present` = `8.562` ms and `8.411` ms (mean `8.487` ms, `-4.0%`); `frame_ms.p50` = `29.866` ms and `30.914` ms. - Run 1: [`aps5-trace-f2a0dc0b746b-48664.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-f2a0dc0b746b-48664.json.gz) - Run 2: [`aps5-trace-f2a0dc0b746b-55396.json.gz`](https://github.com/hamb3r/AnyPS5/releases/download/pr-8727-traces/aps5-trace-f2a0dc0b746b-55396.json.gz) - The PR description has been updated with the attached `.json.gz` trace links and the full `tools/trace_digest.py` summaries for all four runs. 2. **`DontInline` helper removal & AMD GPU check** - After `c9e38be258` landed on `main` (shrinking the inline guarded SRT check in `EmitReadConst` to a single `OpAtomicStore` to `SrtGuardWord`), the out-of-line `DontInline` `GuardedSrtFunction` helper was already dropped in `54bd2da7e0`, leaving stale mentions in the PR title and description. - We rebased cleanly onto `origin/main` without the obsolete `DontInline` commit and updated the PR title and body so they reflect the RVE-only change. - Because the `DontInline` helper is no longer part of the diff, the AMD GPU check for out-of-line `DontInline` call overhead does not apply to the current RVE-only change. 3. **Memory-clobber invalidation for `ReadConst` & unit tests** - Added CFG memory-epoch tracking (`ValueKey::memoryEpoch`, separate from `flags`) in `RedundantValueEliminator.cpp`: - `ClobbersReadConst(IrOpcode)` checks `BufferAccessOf` (`Write`/`Atomic`), `AddressOpcodeInfoOf` (`Write`/`Atomic`), and `IrOpcode::Barrier`. - A reverse-post-order fixed-point pass propagates `entryEpoch` and `exitEpoch` across CFG predecessors, assigning a stable merge epoch when predecessor epochs differ and advancing the epoch at each clobber instruction. - `ReadConst` keys include `memoryEpoch`, preventing CSE across intra-block, branch-merge, or loop-backedge writes/atomics/barriers while preserving CSE before a store and on clean sibling branches. - Added unit tests in `RedundantValueElimination.cpp` (with `program.srtReads` linking `ReadConst` to a `LoadAddressU32` on the table address and storing via `StoreAddressU32` to the same address and offset): - Dominated-block merging of `GetSrtResource` and `ReadConst` while another slot or sibling block stays. - Intra-block `StoreAddressU32` between two `ReadConst` instructions of the same slot prevents merging (`b.eliminate() == 0u`). - Store on the `then` branch only before `merge`: clean `otherwise` sibling reuses the `head` read, while the post-store read in `then` and the read in `merge` are not merged (`b.eliminate() == 1u`). - Store on a single-loop backedge (`body -> header`) prevents reusing the pre-loop `ReadConst` in `header` (`b.eliminate() == 2u`). - Store in an inner loop propagates across multiple fixed-point iterations to invalidate the outer loop header `ReadConst` (`b.eliminate() == 2u`).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8727
No description provided.