perf: Killzone: Liberation (PPSA11142) gameplay at ~6 FPS on Intel Meteor Lake: the PSP vertex mesh program routes 1,730 direct VGPR accesses through a 152-register relative-addressing window #27373

Closed
opened 2026-11-26 00:23:41 +00:00 by Mouad-Scriptz-0 · 0 comments
Mouad-Scriptz-0 commented 2026-11-26 00:23:41 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-11-26T00:23:41Z.


Title and scene

PPSA11142 (Killzone: Liberation, Sony's PSP emulator), first mission after the first checkpoint, gameplay with the camera moving

What is slow or what changed

Gameplay runs at ~6 FPS (frame p50 156 ms) and the GPU is the limit: the trace shows the GPU busy 154.5 ms per present (97 %), while the queue worker is busy 27 % and the presenter waits 151.6 ms per frame on the render fence. Menus run at ~20 FPS.

In separate runs with APS5_PROFILE_GPU=1 APS5_PROFILE_GPU_DRAWS=1 APS5_PROFILE_GPU_DRAW_STAGES=1 (not the traced run), draws took 9.86 s of GPU time per 10 s. Two drawsets took 85 % of it, and both use the mesh program 0xae0900 with fragment 0xada700:

[drawstages] drawset 0x9 7:0x119 5:0x11b     ~3.5 s per 10 s, ~7,000 draws
[drawstages] drawset 0xa 7:0x11e 5:0x11b     ~4.9 s per 10 s, ~7,100 draws
[drawvariant] 0x119 stage 7 code 0xae0900
[drawvariant] 0x11e stage 7 code 0xae0900

This is the PSP vertex program (2 linked programs merged into a mesh stage, wave64, 256 threads, 3,176 code words). Its request is attached (shader_555f81514900.req, dumped with APS5_DUMP_SHADERS on an earlier build; it replays on 63b2e14). On 63b2e14 it recompiles to 267,438 SPIR-V words, and ANV compiles that to:

SIMD32 shader: 263808 instructions. 114 loops. 100239056 cycles. 7915:30655 spills:fills, 5970 sends, scheduled with mode lifo. Promoted 18 constants. GRF registers: 128. Compacted 5504816 to 4660224 bytes (15%)

That is a 4.66 MB binary. It takes 166 s to compile.

Where the size comes from (APS5_DUMP_IR=all agc_shader_replay shader_555f81514900.req):

  • The module has two Function-storage u32[152] arrays. These are the relative-addressing vector windows (v0..v151), one per linked program. At SIMD32 one array needs 152 GRFs, more than the 128 available, so ANV most likely lowers it to scratch. I did not confirm this in the assembly.
  • After resources, the window accesses are 1,730 with a constant index (1,090 LoadVectorWindow, 640 StoreVectorWindow) and 114 with a dynamic index (104 loads, 10 stores). The constant-index accesses are ordinary VGPR reads and writes that land in the window range.
  • The dynamic indices are UMin32(IAdd32(0x39 | 0x3a | 0, ReadFirstLane(<window register>)), 0x97), so the indexed range is data-dependent and the window has to cover v0..v151.
  • #4120 keeps direct accesses in SSA when the window has only relative reads. This program also has relative writes (10 dynamic StoreVectorWindow), so it doesn't qualify. #15520 already limits the window to the blocks between relative accesses.
  • SPIR-V totals: 60,445 instructions, 4,896 blocks, 4,803 OpAccessChain, 5,691 OpSelect, 5,538 OpBitwiseAnd.

Possible direction (not tried): keep direct VGPR accesses in SSA even when the window has relative writes. Copy the live window range into the array just before each relative access and read it back after, so the 1,730 constant-index accesses stop going through Function storage.

I could not test a narrower dispatch. INTEL_SIMD_DEBUG=ms16/ms8 still produce SIMD32, even with the module compiled without requiredSubgroupSize and with ALLOW_VARYING_SUBGROUP_SIZE.

Setup notes:

  • Mesa is main 799db94 with two fixes this title needs. !46233 lets this program compile at all (register allocator 32-bit index, Mesa #16557). The other takes a 64-bit size in anv_device_import_bo_from_host_ptr (Mesa #17014), because the title imports a 4 GiB host range.
  • The AnyPS5 build has one local change outside the shader path: libSceVideodec2 skips a packet that FFmpeg rejects as invalid data instead of throwing.
  • The machine is an Intel Core Ultra 5 135U with its Intel Graphics (Xe-LPG, 8086:7d45) iGPU and 15 GiB RAM.
  • During the traced run, the launch script wrote stdout/stderr to a file. No other switch was set.

AI-assisted: yes (Claude Code).

Summary lines

{"commit":"63b2e14408f9","dirty":false,"env":{"APS5_TRACE_SECONDS":"120:20"},"gpu":"Intel(R) Graphics (MTL)","driver":"Intel open-source Mesa driver Mesa 27.0.0-devel (git-35ba262983)","os":"Linux 7.3.4-300.fc45.x86_64","cpu":"Intel(R) Core(TM) Ultra 5 135U","cpu_threads":14,"memory_mib":15407,"title_id":"PPSA11142","title":"Killzone: Liberation","content_version":"01.000.004","resolution":"1920x1080","window":{"spec":"seconds 120:20","first_present":1206,"ms":20015.210},"presents":126,"frame_ms":{"p50":156.040,"p90":165.145,"p99":311.841,"max":450.285},"gpu_busy_ms_per_present":154.530,"worker_busy_pct":{"queue worker 0x0":29.015},"phase_totals_ms":{"Driver.Completion":0.072,"Driver.Dispatch":1.965,"Driver.Draw":2427.221,"Driver.Draw.device_setup":26.931,"Driver.Draw.draw_enqueued":2048.913,"Driver.Draw.post_compile_prepare":15.804,"Driver.Draw.prepare":107.058,"Driver.Draw.shader_compile_and_link":220.259,"Driver.EndSubmission":0.373,"Driver.Packet":5806.873,"Driver.Packet.device_lock":5.588,"Driver.Packet.dispatch":2.382,"Driver.Packet.draw":2432.017,"Driver.Packet.execute":365.646,"Driver.Packet.flip_flush":26.817,"Driver.Packet.flush_between_packets":16.134,"Driver.Packet.pipeline_drain":2631.016,"Driver.Packet.pipeline_prepare":9.283,"Driver.Packet.prepare_memory":9.174,"Driver.Packet.rendering_wait":0.219,"Driver.Present":19733.456,"Driver.Present.acquire_image":4.911,"Driver.Present.device_setup":0.190,"Driver.Present.gpu_mutex_wait":0.224,"Driver.Present.inflight_wait":0.317,"Driver.Present.present_display_buffer":615.853,"Driver.Present.queue_present":5.242,"Driver.Present.release_and_callback":0.275,"Driver.Present.render_fence_wait":19105.877,"Driver.Present.resize":0.303,"Driver.Present.validate":0.082,"Driver.Suspend":0.010,"GpuMutex.wait.draw":1.803,"GpuMutex.wait.end":0.164,"GpuMutex.wait.fill":395.459,"GpuMutex.wait.label":0.215,"GpuMutex.wait.present":0.004,"GpuMutex.wait.wait":406.720,"Graphics.Draw":3645.730,"Graphics.Draw.draw_and_resource_release":3597.922,"Graphics.Draw.index_upload":6.124,"Graphics.Draw.validate":34.899,"Graphics.Draw.vertex_upload":2.627,"Graphics.DrawWithRecipe":940.325,"Graphics.DrawWithRecipe.draw_and_resource_release":938.052,"Graphics.DrawWithRecipe.index_upload":0.233,"Graphics.DrawWithRecipe.validate":1.072,"Graphics.DrawWithRecipe.vertex_upload":0.398,"Recorder.Reap":222.211,"Recorder.Submit":539.557,"Recorder.WaitSerial":17653.913,"Resources.Complete":34.560,"Resources.Prepare":30.699,"Shader.DrawStage":35.380,"Shader.DrawStage.capture_resources":19.668,"Shader.DrawStage.materialize":12.234,"Shader.DrawStage.prepared_invocation":3.244,"Shader.ResolveAbi":57.989,"Shader.ResolveGraphicsAbi":11.177,"Shader.ResolveGraphicsStagesAbi":53.700,"VideoOut.Flip":19624.435,"VideoOut.Flip.completion_mutex_wait":0.190,"VideoOut.Flip.config_mutex_wait":0.018,"VideoOut.Flip.frame_limit":0.038,"VideoOut.Flip.notify_game":2.311,"VideoOut.Flip.present":19587.047,"VideoOut.Flip.validate":0.092,"VideoOut.Flip.vblank_wait":0.094,"VideoOut.Flip.window_prepare":0.212,"VideoOut.Flip.window_title":34.343,"VideoOut.Readiness":0.482,"VideoOut.Readiness.locks_validate":0.266,"Vulkan.Acquire":4.539,"Vulkan.Acquire.acquire_fence_wait":0.212,"Vulkan.Acquire.acquire_image":3.631,"Vulkan.Acquire.fence_reset":0.607,"Vulkan.Acquire.retired_swapchains":0.051,"Vulkan.DrawFromRecipe":941.760,"Vulkan.Present":479.074,"Vulkan.Present.command_record_scale":6.534,"Vulkan.Present.pixel_upload":1.022,"Vulkan.Present.queue_submit":471.330,"Vulkan.QueuePresent":4.904,"Vulkan.QueuePresent.queue_present":4.812,"Vulkan.Retire":19105.433,"Vulkan.Retire.wait":19101.836},"top_phases_ms_per_frame":{"Driver.Present":156.615,"VideoOut.Flip":155.749,"VideoOut.Flip.present":155.453,"Driver.Present.render_fence_wait":151.634,"Vulkan.Retire":151.630,"Vulkan.Retire.wait":151.602,"Recorder.WaitSerial":140.110,"Driver.Packet":46.086},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.draw":6266,"Graphics.Barrier.fill":2,"Graphics.Barrier.fill-clear":252,"Graphics.Barrier.label-run":4202,"Graphics.Barrier.present-blit":504,"Graphics.Barrier.storage-upload":6,"Graphics.BarrierMerged.fill":2,"Graphics.BarrierMerged.label-run":354,"Graphics.RenderPass":4413,"Graphics.RenderPass.Close.command":4,"Graphics.RenderPass.Close.image":1245,"Graphics.RenderPass.Close.key":1413,"Graphics.RenderPass.Close.label":354,"Graphics.RenderPass.Close.new-batch":1397,"Graphics.RenderPass.Continued":22219},"trace_dropped":false,"trace":"aps5-trace-63b2e14408f9-268019.json.gz"}

Traces

aps5-trace-63b2e14408f9-268019.json.gz, plus shader_555f81514900.req (the PSP vertex program's request) and mesh-stats.txt (ANV compile statistics), attached in the first comment below.

Digest

seconds 120:20 from present 1206: 126 presents, frame p50 156.0 / p90 165.1 / p99 311.8 / max 450.3 ms, GPU busy 154.5 ms per present
Intel(R) Graphics (MTL), Intel open-source Mesa driver Mesa 27.0.0-devel (git-35ba262983), Linux 7.3.4-300.fc45.x86_64, 1920x1080, commit 63b2e14408, dropped: no

{"commit":"63b2e14408f9","dirty":false,"env":{"APS5_TRACE_SECONDS":"120:20"},"gpu":"Intel(R) Graphics (MTL)","driver":"Intel open-source Mesa driver Mesa 27.0.0-devel (git-35ba262983)","os":"Linux 7.3.4-300.fc45.x86_64","cpu":"Intel(R) Core(TM) Ultra 5 135U","cpu_threads":14,"memory_mib":15407,"title_id":"PPSA11142","title":"Killzone: Liberation","content_version":"01.000.004","resolution":"1920x1080","window":{"spec":"seconds 120:20","first_present":1206,"ms":20015.21},"presents":126,"frame_ms":{"p50":156.04,"p90":165.145,"p99":311.841,"max":450.285},"gpu_busy_ms_per_present":154.53,"worker_busy_pct":{"queue worker 0x0":29.015},"phase_totals_ms":{"Driver.Completion":0.072,"Driver.Dispatch":1.965,"Driver.Draw":2427.221,"Driver.Draw.device_setup":26.931,"Driver.Draw.draw_enqueued":2048.913,"Driver.Draw.post_compile_prepare":15.804,"Driver.Draw.prepare":107.058,"Driver.Draw.shader_compile_and_link":220.259,"Driver.EndSubmission":0.373,"Driver.Packet":5806.873,"Driver.Packet.device_lock":5.588,"Driver.Packet.dispatch":2.382,"Driver.Packet.draw":2432.017,"Driver.Packet.execute":365.646,"Driver.Packet.flip_flush":26.817,"Driver.Packet.flush_between_packets":16.134,"Driver.Packet.pipeline_drain":2631.016,"Driver.Packet.pipeline_prepare":9.283,"Driver.Packet.prepare_memory":9.174,"Driver.Packet.rendering_wait":0.219,"Driver.Present":19733.456,"Driver.Present.acquire_image":4.911,"Driver.Present.device_setup":0.19,"Driver.Present.gpu_mutex_wait":0.224,"Driver.Present.inflight_wait":0.317,"Driver.Present.present_display_buffer":615.853,"Driver.Present.queue_present":5.242,"Driver.Present.release_and_callback":0.275,"Driver.Present.render_fence_wait":19105.877,"Driver.Present.resize":0.303,"Driver.Present.validate":0.082,"Driver.Suspend":0.01,"GpuMutex.wait.draw":1.803,"GpuMutex.wait.end":0.164,"GpuMutex.wait.fill":395.459,"GpuMutex.wait.label":0.215,"GpuMutex.wait.present":0.004,"GpuMutex.wait.wait":406.72,"Graphics.Draw":3645.73,"Graphics.Draw.draw_and_resource_release":3597.922,"Graphics.Draw.index_upload":6.124,"Graphics.Draw.validate":34.899,"Graphics.Draw.vertex_upload":2.627,"Graphics.DrawWithRecipe":940.325,"Graphics.DrawWithRecipe.draw_and_resource_release":938.052,"Graphics.DrawWithRecipe.index_upload":0.233,"Graphics.DrawWithRecipe.validate":1.072,"Graphics.DrawWithRecipe.vertex_upload":0.398,"Recorder.Reap":222.211,"Recorder.Submit":539.557,"Recorder.WaitSerial":17653.913,"Resources.Complete":34.56,"Resources.Prepare":30.699,"Shader.DrawStage":35.38,"Shader.DrawStage.capture_resources":19.668,"Shader.DrawStage.materialize":12.234,"Shader.DrawStage.prepared_invocation":3.244,"Shader.ResolveAbi":57.989,"Shader.ResolveGraphicsAbi":11.177,"Shader.ResolveGraphicsStagesAbi":53.7,"VideoOut.Flip":19624.435,"VideoOut.Flip.completion_mutex_wait":0.19,"VideoOut.Flip.config_mutex_wait":0.018,"VideoOut.Flip.frame_limit":0.038,"VideoOut.Flip.notify_game":2.311,"VideoOut.Flip.present":19587.047,"VideoOut.Flip.validate":0.092,"VideoOut.Flip.vblank_wait":0.094,"VideoOut.Flip.window_prepare":0.212,"VideoOut.Flip.window_title":34.343,"VideoOut.Readiness":0.482,"VideoOut.Readiness.locks_validate":0.266,"Vulkan.Acquire":4.539,"Vulkan.Acquire.acquire_fence_wait":0.212,"Vulkan.Acquire.acquire_image":3.631,"Vulkan.Acquire.fence_reset":0.607,"Vulkan.Acquire.retired_swapchains":0.051,"Vulkan.DrawFromRecipe":941.76,"Vulkan.Present":479.074,"Vulkan.Present.command_record_scale":6.534,"Vulkan.Present.pixel_upload":1.022,"Vulkan.Present.queue_submit":471.33,"Vulkan.QueuePresent":4.904,"Vulkan.QueuePresent.queue_present":4.812,"Vulkan.Retire":19105.433,"Vulkan.Retire.wait":19101.836},"top_phases_ms_per_frame":{"Driver.Present":156.615,"VideoOut.Flip":155.749,"VideoOut.Flip.present":155.453,"Driver.Present.render_fence_wait":151.634,"Vulkan.Retire":151.63,"Vulkan.Retire.wait":151.602,"Recorder.WaitSerial":140.11,"Driver.Packet":46.086},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.draw":6266,"Graphics.Barrier.fill":2,"Graphics.Barrier.fill-clear":252,"Graphics.Barrier.label-run":4202,"Graphics.Barrier.present-blit":504,"Graphics.Barrier.storage-upload":6,"Graphics.BarrierMerged.fill":2,"Graphics.BarrierMerged.label-run":354,"Graphics.RenderPass":4413,"Graphics.RenderPass.Close.command":4,"Graphics.RenderPass.Close.image":1245,"Graphics.RenderPass.Close.key":1413,"Graphics.RenderPass.Close.label":354,"Graphics.RenderPass.Close.new-batch":1397,"Graphics.RenderPass.Continued":22219},"trace_dropped":false,"trace":"aps5-trace-63b2e14408f9-268019.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 1219: 450.3 ms at 1959 ms: Driver.Packet (queue worker 0x0) 432.7, Driver.Packet.draw (queue worker 0x0) 413.4, Driver.Draw (queue worker 0x0) 413.4, Driver.Draw.draw_enqueued (queue worker 0x0) 412.9
  • present 1248: 311.8 ms at 6659 ms: batch (gpu) 306.6, Driver.Packet (queue worker 0x0) 294.1, Graphics.Draw (draw committer) 280.4, Graphics.Draw.draw_and_resource_release (draw committer) 280.0
  • present 1324: 173.4 ms at 18682 ms: VideoOut.Flip (presenter) 173.4, VideoOut.Flip.present (presenter) 173.4, Driver.Present (presenter) 173.3, Driver.Present.render_fence_wait (presenter) 171.3
  • present 1327: 169.6 ms at 19186 ms: VideoOut.Flip (presenter) 169.5, VideoOut.Flip.present (presenter) 169.5, Driver.Present (presenter) 169.5, batch (gpu) 168.9
  • present 1314: 168.3 ms at 17032 ms: VideoOut.Flip (presenter) 168.2, VideoOut.Flip.present (presenter) 168.2, Driver.Present (presenter) 168.2, batch (gpu) 167.5

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

  • present 1219: 450.3 ms at 1959 ms, persistence 409.8 ms
  • present 1248: 311.8 ms at 6659 ms, persistence 168.4 ms
  • present 1324: 173.4 ms at 18682 ms, persistence 132.9 ms
  • present 1266: 163.0 ms at 9519 ms, persistence 13.6 ms
  • present 1214: 155.5 ms at 1198 ms, persistence 12.1 ms
  • present 1240: 160.7 ms at 5416 ms, persistence 11.0 ms
  • present 1276: 161.9 ms at 11099 ms, persistence 10.8 ms
  • present 1306: 160.0 ms at 15772 ms, persistence 10.3 ms
  • present 1252: 162.7 ms at 7306 ms, persistence 8.9 ms
  • present 1314: 168.3 ms at 17032 ms, persistence 8.0 ms

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 43.2 (27 %) 111.4 (70 %) 4.3 11.5 Driver.Packet 43.2, Recorder.Reap 0.0
title 0.0 (0 %) 143.3 (90 %) 15.5 0.9 Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0
draw committer 40.4 (25 %) 3.2 (2 %) 115.3 0.9 Graphics.Draw 28.9, Vulkan.DrawFromRecipe 7.4
presenter 5.3 (3 %) 151.6 (95 %) 1.9 0.0 VideoOut.Flip 155.7, Driver.Present 1.2
gpu 153.5 (97 %) 0.0 (0 %) 5.3 0.0 batch 153.5

Largest slices (ms per frame, inclusive, all threads): Driver.Present 156.6, VideoOut.Flip 155.7, VideoOut.Flip.present 155.5, batch 153.5, Driver.Present.render_fence_wait 151.6, Vulkan.Retire 151.6, Vulkan.Retire.wait 151.6, Recorder.WaitSerial 140.1, Driver.WorkerWait 111.4, Driver.WorkerWait.idle_and_completion_poll 111.4

Longest waits

  • GpuMutex.wait.fill (draw committer) 394.1 ms at 1973 ms, present 1219
  • GpuMutex.wait.wait (title) 256.9 ms at 2114 ms, present 1219
  • Driver.Present.render_fence_wait (presenter) 171.3 ms at 18684 ms, present 1324
  • Driver.Present.render_fence_wait (presenter) 167.6 ms at 19188 ms, present 1327
  • Driver.Present.render_fence_wait (presenter) 166.4 ms at 17034 ms, present 1314
  • Driver.Present.render_fence_wait (presenter) 166.1 ms at 18188 ms, present 1321
  • Driver.Present.render_fence_wait (presenter) 164.8 ms at 19850 ms, present 1331
  • Driver.Present.render_fence_wait (presenter) 164.7 ms at 17365 ms, present 1316
  • Driver.Present.render_fence_wait (presenter) 164.3 ms at 16868 ms, present 1313
  • Driver.Present.render_fence_wait (presenter) 164.1 ms at 17695 ms, present 1318

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

  • batch 1532: 147.0 ms at 18682 ms, present 1323: GPU no ranges; recorded by Graphics.Draw (draw committer) 24.8, Graphics.Draw.draw_and_resource_release (draw committer) 24.5, Vulkan.DrawFromRecipe (draw committer) 0.9, Graphics.DrawWithRecipe (draw committer) 0.9
  • batch 1573: 144.0 ms at 19186 ms, present 1326: GPU no ranges; recorded by Graphics.Draw (draw committer) 24.4, Graphics.Draw.draw_and_resource_release (draw committer) 24.1, Vulkan.DrawFromRecipe (draw committer) 1.4, Graphics.DrawWithRecipe (draw committer) 1.4
  • batch 1402: 144.0 ms at 17032 ms, present 1313: GPU no ranges; recorded by Graphics.Draw (draw committer) 24.5, Graphics.Draw.draw_and_resource_release (draw committer) 24.1, Vulkan.DrawFromRecipe (draw committer) 1.2, Graphics.DrawWithRecipe (draw committer) 1.2
  • batch 171: 143.2 ms at 2396 ms, present 1219: GPU no ranges; recorded by Graphics.Draw (draw committer) 22.8, Graphics.Draw.draw_and_resource_release (draw committer) 22.5, GpuMutex.wait.draw (draw committer) 1.7, Vulkan.DrawFromRecipe (draw committer) 0.9
  • batch 1428: 142.4 ms at 17363 ms, present 1315: GPU no ranges; recorded by Graphics.Draw (draw committer) 24.7, Graphics.Draw.draw_and_resource_release (draw committer) 24.4, Vulkan.DrawFromRecipe (draw committer) 1.1, Graphics.DrawWithRecipe (draw committer) 1.1

Worker stacks

No response

Capture

  • The caches were warm (the scene ran once and the title was restarted)
  • No other APS5_TRACE_* or APS5_PROFILE_* switch was set and the log was not redirected
  • Captures compared here come from the same machine, scene and settings

aps5-trace-63b2e14408f9-268019.json.gz

shader_555f81514900.req.txt

mesh-stats.txt

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6616611773 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/27373). Originally posted by [Mouad-Scriptz-0](https://github.com/Mouad-Scriptz-0) on 2026-11-26T00:23:41Z. --- ### Title and scene PPSA11142 (Killzone: Liberation, Sony's PSP emulator), first mission after the first checkpoint, gameplay with the camera moving ### What is slow or what changed Gameplay runs at ~6 FPS (frame p50 156 ms) and the GPU is the limit: the trace shows the GPU busy 154.5 ms per present (97 %), while the queue worker is busy 27 % and the presenter waits 151.6 ms per frame on the render fence. Menus run at ~20 FPS. In separate runs with `APS5_PROFILE_GPU=1 APS5_PROFILE_GPU_DRAWS=1 APS5_PROFILE_GPU_DRAW_STAGES=1` (not the traced run), draws took 9.86 s of GPU time per 10 s. Two drawsets took 85 % of it, and both use the mesh program `0xae0900` with fragment `0xada700`: ``` [drawstages] drawset 0x9 7:0x119 5:0x11b ~3.5 s per 10 s, ~7,000 draws [drawstages] drawset 0xa 7:0x11e 5:0x11b ~4.9 s per 10 s, ~7,100 draws [drawvariant] 0x119 stage 7 code 0xae0900 [drawvariant] 0x11e stage 7 code 0xae0900 ``` This is the PSP vertex program (2 linked programs merged into a mesh stage, wave64, 256 threads, 3,176 code words). Its request is attached (`shader_555f81514900.req`, dumped with `APS5_DUMP_SHADERS` on an earlier build; it replays on 63b2e14). On 63b2e14 it recompiles to 267,438 SPIR-V words, and ANV compiles that to: ``` SIMD32 shader: 263808 instructions. 114 loops. 100239056 cycles. 7915:30655 spills:fills, 5970 sends, scheduled with mode lifo. Promoted 18 constants. GRF registers: 128. Compacted 5504816 to 4660224 bytes (15%) ``` That is a 4.66 MB binary. It takes 166 s to compile. Where the size comes from (`APS5_DUMP_IR=all agc_shader_replay shader_555f81514900.req`): - The module has two Function-storage `u32[152]` arrays. These are the relative-addressing vector windows (v0..v151), one per linked program. At SIMD32 one array needs 152 GRFs, more than the 128 available, so ANV most likely lowers it to scratch. I did not confirm this in the assembly. - After `resources`, the window accesses are 1,730 with a constant index (1,090 `LoadVectorWindow`, 640 `StoreVectorWindow`) and 114 with a dynamic index (104 loads, 10 stores). The constant-index accesses are ordinary VGPR reads and writes that land in the window range. - The dynamic indices are `UMin32(IAdd32(0x39 | 0x3a | 0, ReadFirstLane(<window register>)), 0x97)`, so the indexed range is data-dependent and the window has to cover v0..v151. - #4120 keeps direct accesses in SSA when the window has only relative reads. This program also has relative writes (10 dynamic `StoreVectorWindow`), so it doesn't qualify. #15520 already limits the window to the blocks between relative accesses. - SPIR-V totals: 60,445 instructions, 4,896 blocks, 4,803 `OpAccessChain`, 5,691 `OpSelect`, 5,538 `OpBitwiseAnd`. Possible direction (not tried): keep direct VGPR accesses in SSA even when the window has relative writes. Copy the live window range into the array just before each relative access and read it back after, so the 1,730 constant-index accesses stop going through Function storage. I could not test a narrower dispatch. `INTEL_SIMD_DEBUG=ms16`/`ms8` still produce SIMD32, even with the module compiled without `requiredSubgroupSize` and with `ALLOW_VARYING_SUBGROUP_SIZE`. Setup notes: - Mesa is main 799db94 with two fixes this title needs. !46233 lets this program compile at all (register allocator 32-bit index, Mesa #16557). The other takes a 64-bit size in `anv_device_import_bo_from_host_ptr` (Mesa #17014), because the title imports a 4 GiB host range. - The AnyPS5 build has one local change outside the shader path: libSceVideodec2 skips a packet that FFmpeg rejects as invalid data instead of throwing. - The machine is an Intel Core Ultra 5 135U with its Intel Graphics (Xe-LPG, 8086:7d45) iGPU and 15 GiB RAM. - During the traced run, the launch script wrote stdout/stderr to a file. No other switch was set. AI-assisted: yes (Claude Code). ### Summary lines ```json {"commit":"63b2e14408f9","dirty":false,"env":{"APS5_TRACE_SECONDS":"120:20"},"gpu":"Intel(R) Graphics (MTL)","driver":"Intel open-source Mesa driver Mesa 27.0.0-devel (git-35ba262983)","os":"Linux 7.3.4-300.fc45.x86_64","cpu":"Intel(R) Core(TM) Ultra 5 135U","cpu_threads":14,"memory_mib":15407,"title_id":"PPSA11142","title":"Killzone: Liberation","content_version":"01.000.004","resolution":"1920x1080","window":{"spec":"seconds 120:20","first_present":1206,"ms":20015.210},"presents":126,"frame_ms":{"p50":156.040,"p90":165.145,"p99":311.841,"max":450.285},"gpu_busy_ms_per_present":154.530,"worker_busy_pct":{"queue worker 0x0":29.015},"phase_totals_ms":{"Driver.Completion":0.072,"Driver.Dispatch":1.965,"Driver.Draw":2427.221,"Driver.Draw.device_setup":26.931,"Driver.Draw.draw_enqueued":2048.913,"Driver.Draw.post_compile_prepare":15.804,"Driver.Draw.prepare":107.058,"Driver.Draw.shader_compile_and_link":220.259,"Driver.EndSubmission":0.373,"Driver.Packet":5806.873,"Driver.Packet.device_lock":5.588,"Driver.Packet.dispatch":2.382,"Driver.Packet.draw":2432.017,"Driver.Packet.execute":365.646,"Driver.Packet.flip_flush":26.817,"Driver.Packet.flush_between_packets":16.134,"Driver.Packet.pipeline_drain":2631.016,"Driver.Packet.pipeline_prepare":9.283,"Driver.Packet.prepare_memory":9.174,"Driver.Packet.rendering_wait":0.219,"Driver.Present":19733.456,"Driver.Present.acquire_image":4.911,"Driver.Present.device_setup":0.190,"Driver.Present.gpu_mutex_wait":0.224,"Driver.Present.inflight_wait":0.317,"Driver.Present.present_display_buffer":615.853,"Driver.Present.queue_present":5.242,"Driver.Present.release_and_callback":0.275,"Driver.Present.render_fence_wait":19105.877,"Driver.Present.resize":0.303,"Driver.Present.validate":0.082,"Driver.Suspend":0.010,"GpuMutex.wait.draw":1.803,"GpuMutex.wait.end":0.164,"GpuMutex.wait.fill":395.459,"GpuMutex.wait.label":0.215,"GpuMutex.wait.present":0.004,"GpuMutex.wait.wait":406.720,"Graphics.Draw":3645.730,"Graphics.Draw.draw_and_resource_release":3597.922,"Graphics.Draw.index_upload":6.124,"Graphics.Draw.validate":34.899,"Graphics.Draw.vertex_upload":2.627,"Graphics.DrawWithRecipe":940.325,"Graphics.DrawWithRecipe.draw_and_resource_release":938.052,"Graphics.DrawWithRecipe.index_upload":0.233,"Graphics.DrawWithRecipe.validate":1.072,"Graphics.DrawWithRecipe.vertex_upload":0.398,"Recorder.Reap":222.211,"Recorder.Submit":539.557,"Recorder.WaitSerial":17653.913,"Resources.Complete":34.560,"Resources.Prepare":30.699,"Shader.DrawStage":35.380,"Shader.DrawStage.capture_resources":19.668,"Shader.DrawStage.materialize":12.234,"Shader.DrawStage.prepared_invocation":3.244,"Shader.ResolveAbi":57.989,"Shader.ResolveGraphicsAbi":11.177,"Shader.ResolveGraphicsStagesAbi":53.700,"VideoOut.Flip":19624.435,"VideoOut.Flip.completion_mutex_wait":0.190,"VideoOut.Flip.config_mutex_wait":0.018,"VideoOut.Flip.frame_limit":0.038,"VideoOut.Flip.notify_game":2.311,"VideoOut.Flip.present":19587.047,"VideoOut.Flip.validate":0.092,"VideoOut.Flip.vblank_wait":0.094,"VideoOut.Flip.window_prepare":0.212,"VideoOut.Flip.window_title":34.343,"VideoOut.Readiness":0.482,"VideoOut.Readiness.locks_validate":0.266,"Vulkan.Acquire":4.539,"Vulkan.Acquire.acquire_fence_wait":0.212,"Vulkan.Acquire.acquire_image":3.631,"Vulkan.Acquire.fence_reset":0.607,"Vulkan.Acquire.retired_swapchains":0.051,"Vulkan.DrawFromRecipe":941.760,"Vulkan.Present":479.074,"Vulkan.Present.command_record_scale":6.534,"Vulkan.Present.pixel_upload":1.022,"Vulkan.Present.queue_submit":471.330,"Vulkan.QueuePresent":4.904,"Vulkan.QueuePresent.queue_present":4.812,"Vulkan.Retire":19105.433,"Vulkan.Retire.wait":19101.836},"top_phases_ms_per_frame":{"Driver.Present":156.615,"VideoOut.Flip":155.749,"VideoOut.Flip.present":155.453,"Driver.Present.render_fence_wait":151.634,"Vulkan.Retire":151.630,"Vulkan.Retire.wait":151.602,"Recorder.WaitSerial":140.110,"Driver.Packet":46.086},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.draw":6266,"Graphics.Barrier.fill":2,"Graphics.Barrier.fill-clear":252,"Graphics.Barrier.label-run":4202,"Graphics.Barrier.present-blit":504,"Graphics.Barrier.storage-upload":6,"Graphics.BarrierMerged.fill":2,"Graphics.BarrierMerged.label-run":354,"Graphics.RenderPass":4413,"Graphics.RenderPass.Close.command":4,"Graphics.RenderPass.Close.image":1245,"Graphics.RenderPass.Close.key":1413,"Graphics.RenderPass.Close.label":354,"Graphics.RenderPass.Close.new-batch":1397,"Graphics.RenderPass.Continued":22219},"trace_dropped":false,"trace":"aps5-trace-63b2e14408f9-268019.json.gz"} ``` ### Traces `aps5-trace-63b2e14408f9-268019.json.gz`, plus `shader_555f81514900.req` (the PSP vertex program's request) and `mesh-stats.txt` (ANV compile statistics), attached in the first comment below. ### Digest **seconds 120:20** from present 1206: 126 presents, frame p50 156.0 / p90 165.1 / p99 311.8 / max 450.3 ms, GPU busy 154.5 ms per present Intel(R) Graphics (MTL), Intel open-source Mesa driver Mesa 27.0.0-devel (git-35ba262983), Linux 7.3.4-300.fc45.x86_64, 1920x1080, commit 63b2e14408f9, dropped: no ```json {"commit":"63b2e14408f9","dirty":false,"env":{"APS5_TRACE_SECONDS":"120:20"},"gpu":"Intel(R) Graphics (MTL)","driver":"Intel open-source Mesa driver Mesa 27.0.0-devel (git-35ba262983)","os":"Linux 7.3.4-300.fc45.x86_64","cpu":"Intel(R) Core(TM) Ultra 5 135U","cpu_threads":14,"memory_mib":15407,"title_id":"PPSA11142","title":"Killzone: Liberation","content_version":"01.000.004","resolution":"1920x1080","window":{"spec":"seconds 120:20","first_present":1206,"ms":20015.21},"presents":126,"frame_ms":{"p50":156.04,"p90":165.145,"p99":311.841,"max":450.285},"gpu_busy_ms_per_present":154.53,"worker_busy_pct":{"queue worker 0x0":29.015},"phase_totals_ms":{"Driver.Completion":0.072,"Driver.Dispatch":1.965,"Driver.Draw":2427.221,"Driver.Draw.device_setup":26.931,"Driver.Draw.draw_enqueued":2048.913,"Driver.Draw.post_compile_prepare":15.804,"Driver.Draw.prepare":107.058,"Driver.Draw.shader_compile_and_link":220.259,"Driver.EndSubmission":0.373,"Driver.Packet":5806.873,"Driver.Packet.device_lock":5.588,"Driver.Packet.dispatch":2.382,"Driver.Packet.draw":2432.017,"Driver.Packet.execute":365.646,"Driver.Packet.flip_flush":26.817,"Driver.Packet.flush_between_packets":16.134,"Driver.Packet.pipeline_drain":2631.016,"Driver.Packet.pipeline_prepare":9.283,"Driver.Packet.prepare_memory":9.174,"Driver.Packet.rendering_wait":0.219,"Driver.Present":19733.456,"Driver.Present.acquire_image":4.911,"Driver.Present.device_setup":0.19,"Driver.Present.gpu_mutex_wait":0.224,"Driver.Present.inflight_wait":0.317,"Driver.Present.present_display_buffer":615.853,"Driver.Present.queue_present":5.242,"Driver.Present.release_and_callback":0.275,"Driver.Present.render_fence_wait":19105.877,"Driver.Present.resize":0.303,"Driver.Present.validate":0.082,"Driver.Suspend":0.01,"GpuMutex.wait.draw":1.803,"GpuMutex.wait.end":0.164,"GpuMutex.wait.fill":395.459,"GpuMutex.wait.label":0.215,"GpuMutex.wait.present":0.004,"GpuMutex.wait.wait":406.72,"Graphics.Draw":3645.73,"Graphics.Draw.draw_and_resource_release":3597.922,"Graphics.Draw.index_upload":6.124,"Graphics.Draw.validate":34.899,"Graphics.Draw.vertex_upload":2.627,"Graphics.DrawWithRecipe":940.325,"Graphics.DrawWithRecipe.draw_and_resource_release":938.052,"Graphics.DrawWithRecipe.index_upload":0.233,"Graphics.DrawWithRecipe.validate":1.072,"Graphics.DrawWithRecipe.vertex_upload":0.398,"Recorder.Reap":222.211,"Recorder.Submit":539.557,"Recorder.WaitSerial":17653.913,"Resources.Complete":34.56,"Resources.Prepare":30.699,"Shader.DrawStage":35.38,"Shader.DrawStage.capture_resources":19.668,"Shader.DrawStage.materialize":12.234,"Shader.DrawStage.prepared_invocation":3.244,"Shader.ResolveAbi":57.989,"Shader.ResolveGraphicsAbi":11.177,"Shader.ResolveGraphicsStagesAbi":53.7,"VideoOut.Flip":19624.435,"VideoOut.Flip.completion_mutex_wait":0.19,"VideoOut.Flip.config_mutex_wait":0.018,"VideoOut.Flip.frame_limit":0.038,"VideoOut.Flip.notify_game":2.311,"VideoOut.Flip.present":19587.047,"VideoOut.Flip.validate":0.092,"VideoOut.Flip.vblank_wait":0.094,"VideoOut.Flip.window_prepare":0.212,"VideoOut.Flip.window_title":34.343,"VideoOut.Readiness":0.482,"VideoOut.Readiness.locks_validate":0.266,"Vulkan.Acquire":4.539,"Vulkan.Acquire.acquire_fence_wait":0.212,"Vulkan.Acquire.acquire_image":3.631,"Vulkan.Acquire.fence_reset":0.607,"Vulkan.Acquire.retired_swapchains":0.051,"Vulkan.DrawFromRecipe":941.76,"Vulkan.Present":479.074,"Vulkan.Present.command_record_scale":6.534,"Vulkan.Present.pixel_upload":1.022,"Vulkan.Present.queue_submit":471.33,"Vulkan.QueuePresent":4.904,"Vulkan.QueuePresent.queue_present":4.812,"Vulkan.Retire":19105.433,"Vulkan.Retire.wait":19101.836},"top_phases_ms_per_frame":{"Driver.Present":156.615,"VideoOut.Flip":155.749,"VideoOut.Flip.present":155.453,"Driver.Present.render_fence_wait":151.634,"Vulkan.Retire":151.63,"Vulkan.Retire.wait":151.602,"Recorder.WaitSerial":140.11,"Driver.Packet":46.086},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.draw":6266,"Graphics.Barrier.fill":2,"Graphics.Barrier.fill-clear":252,"Graphics.Barrier.label-run":4202,"Graphics.Barrier.present-blit":504,"Graphics.Barrier.storage-upload":6,"Graphics.BarrierMerged.fill":2,"Graphics.BarrierMerged.label-run":354,"Graphics.RenderPass":4413,"Graphics.RenderPass.Close.command":4,"Graphics.RenderPass.Close.image":1245,"Graphics.RenderPass.Close.key":1413,"Graphics.RenderPass.Close.label":354,"Graphics.RenderPass.Close.new-batch":1397,"Graphics.RenderPass.Continued":22219},"trace_dropped":false,"trace":"aps5-trace-63b2e14408f9-268019.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 1219: 450.3 ms at 1959 ms: Driver.Packet (queue worker 0x0) 432.7, Driver.Packet.draw (queue worker 0x0) 413.4, Driver.Draw (queue worker 0x0) 413.4, Driver.Draw.draw_enqueued (queue worker 0x0) 412.9 - present 1248: 311.8 ms at 6659 ms: batch (gpu) 306.6, Driver.Packet (queue worker 0x0) 294.1, Graphics.Draw (draw committer) 280.4, Graphics.Draw.draw_and_resource_release (draw committer) 280.0 - present 1324: 173.4 ms at 18682 ms: VideoOut.Flip (presenter) 173.4, VideoOut.Flip.present (presenter) 173.4, Driver.Present (presenter) 173.3, Driver.Present.render_fence_wait (presenter) 171.3 - present 1327: 169.6 ms at 19186 ms: VideoOut.Flip (presenter) 169.5, VideoOut.Flip.present (presenter) 169.5, Driver.Present (presenter) 169.5, batch (gpu) 168.9 - present 1314: 168.3 ms at 17032 ms: VideoOut.Flip (presenter) 168.2, VideoOut.Flip.present (presenter) 168.2, Driver.Present (presenter) 168.2, batch (gpu) 167.5 **Persistent spikes** (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame) - present 1219: 450.3 ms at 1959 ms, persistence 409.8 ms - present 1248: 311.8 ms at 6659 ms, persistence 168.4 ms - present 1324: 173.4 ms at 18682 ms, persistence 132.9 ms - present 1266: 163.0 ms at 9519 ms, persistence 13.6 ms - present 1214: 155.5 ms at 1198 ms, persistence 12.1 ms - present 1240: 160.7 ms at 5416 ms, persistence 11.0 ms - present 1276: 161.9 ms at 11099 ms, persistence 10.8 ms - present 1306: 160.0 ms at 15772 ms, persistence 10.3 ms - present 1252: 162.7 ms at 7306 ms, persistence 8.9 ms - present 1314: 168.3 ms at 17032 ms, persistence 8.0 ms **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 43.2 (27 %) | 111.4 (70 %) | 4.3 | 11.5 | Driver.Packet 43.2, Recorder.Reap 0.0 | | title | 0.0 (0 %) | 143.3 (90 %) | 15.5 | 0.9 | Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0 | | draw committer | 40.4 (25 %) | 3.2 (2 %) | 115.3 | 0.9 | Graphics.Draw 28.9, Vulkan.DrawFromRecipe 7.4 | | presenter | 5.3 (3 %) | 151.6 (95 %) | 1.9 | 0.0 | VideoOut.Flip 155.7, Driver.Present 1.2 | | gpu | 153.5 (97 %) | 0.0 (0 %) | 5.3 | 0.0 | batch 153.5 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Present 156.6, VideoOut.Flip 155.7, VideoOut.Flip.present 155.5, batch 153.5, Driver.Present.render_fence_wait 151.6, Vulkan.Retire 151.6, Vulkan.Retire.wait 151.6, Recorder.WaitSerial 140.1, Driver.WorkerWait 111.4, Driver.WorkerWait.idle_and_completion_poll 111.4 **Longest waits** - GpuMutex.wait.fill (draw committer) 394.1 ms at 1973 ms, present 1219 - GpuMutex.wait.wait (title) 256.9 ms at 2114 ms, present 1219 - Driver.Present.render_fence_wait (presenter) 171.3 ms at 18684 ms, present 1324 - Driver.Present.render_fence_wait (presenter) 167.6 ms at 19188 ms, present 1327 - Driver.Present.render_fence_wait (presenter) 166.4 ms at 17034 ms, present 1314 - Driver.Present.render_fence_wait (presenter) 166.1 ms at 18188 ms, present 1321 - Driver.Present.render_fence_wait (presenter) 164.8 ms at 19850 ms, present 1331 - Driver.Present.render_fence_wait (presenter) 164.7 ms at 17365 ms, present 1316 - Driver.Present.render_fence_wait (presenter) 164.3 ms at 16868 ms, present 1313 - Driver.Present.render_fence_wait (presenter) 164.1 ms at 17695 ms, present 1318 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 1532: 147.0 ms at 18682 ms, present 1323: GPU no ranges; recorded by Graphics.Draw (draw committer) 24.8, Graphics.Draw.draw_and_resource_release (draw committer) 24.5, Vulkan.DrawFromRecipe (draw committer) 0.9, Graphics.DrawWithRecipe (draw committer) 0.9 - batch 1573: 144.0 ms at 19186 ms, present 1326: GPU no ranges; recorded by Graphics.Draw (draw committer) 24.4, Graphics.Draw.draw_and_resource_release (draw committer) 24.1, Vulkan.DrawFromRecipe (draw committer) 1.4, Graphics.DrawWithRecipe (draw committer) 1.4 - batch 1402: 144.0 ms at 17032 ms, present 1313: GPU no ranges; recorded by Graphics.Draw (draw committer) 24.5, Graphics.Draw.draw_and_resource_release (draw committer) 24.1, Vulkan.DrawFromRecipe (draw committer) 1.2, Graphics.DrawWithRecipe (draw committer) 1.2 - batch 171: 143.2 ms at 2396 ms, present 1219: GPU no ranges; recorded by Graphics.Draw (draw committer) 22.8, Graphics.Draw.draw_and_resource_release (draw committer) 22.5, GpuMutex.wait.draw (draw committer) 1.7, Vulkan.DrawFromRecipe (draw committer) 0.9 - batch 1428: 142.4 ms at 17363 ms, present 1315: GPU no ranges; recorded by Graphics.Draw (draw committer) 24.7, Graphics.Draw.draw_and_resource_release (draw committer) 24.4, Vulkan.DrawFromRecipe (draw committer) 1.1, Graphics.DrawWithRecipe (draw committer) 1.1 ### Worker stacks _No response_ ### Capture - [X] The caches were warm (the scene ran once and the title was restarted) - [X] No other APS5_TRACE_* or APS5_PROFILE_* switch was set and the log was not redirected - [ ] Captures compared here come from the same machine, scene and settings [aps5-trace-63b2e14408f9-268019.json.gz](https://github.com/user-attachments/files/35438507/aps5-trace-63b2e14408f9-268019.json.gz) [shader_555f81514900.req.txt](https://github.com/user-attachments/files/35438518/shader_555f81514900.req.txt) [mesh-stats.txt](https://github.com/user-attachments/files/35438530/mesh-stats.txt)
Sign in to join this conversation.
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#27373
No description provided.