AGC: on a first run, one ps5-opengl pixel shader takes ~20 s to link on AMD's Windows driver, and Homebrew UI Lab and Surround Sound Studio quit after 2 s #4399

Closed
opened 2026-10-12 09:20:54 +00:00 by LeandroLP23 · 10 comments
LeandroLP23 commented 2026-10-12 09:20:54 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T09:20:54Z.


On main 8c4a295ff on Windows, Homebrew UI Lab (PPSA99050) and Surround Sound Studio (PPSA99051) quit about 18 s after start, at their third draw. The title logs this to its own log (download0/hui/dev/app.log), and the exit code is 1:

[ps5-agc] submission retirement failed; terminating application before cleanup

Cause. Both titles use the ps5-opengl native runtime. It polls the end-of-pipe marker of each submission for at most 2000 × sceKernelUsleep(1000), about 2 s (runtime_completion_pause, runtime_require_retirement in src/platform/ps5_agc_native_runtime.c). It then calls _Exit(EXIT_FAILURE). At the third draw, the AGC worker is still compiling the pipeline for the runtime's large pixel shader (compile-shader stage=5 bytes=21652 hash=f8d1fab9, the same shader in both titles):

  • The recompiled SPIR-V is 496,697 words (about 2 MB) for 21,652 bytes of guest code.
  • SpecializeSpirv takes 0.09 s on that module in a standalone harness and 0.2 s in the process, so it is not the cost.
  • LinkPipelineFromLibraries → CachedPipeline takes 19.8 s on a Radeon 860M (RDNA 3.5, AMD driver 32.0.13058.8001). To measure it I ran a local libkernel build whose sceKernelUsleep sleeps 20× longer; that change is not part of any PR.
  • APS5_NO_PIPELINE_LTO=1 and APS5_NO_GPL=1 do not change the outcome.

With the pipeline cache warm from that run, both titles pass the third draw at the normal budget. They then stop on last provoking vertex with explicit per-vertex flat interpolation is unsupported (#3581, #4030), as in #3581's run on a11c8f7f. So on this machine the timeout only blocks a first run, but it blocks it every time: the process exits before the pipeline is saved.

Not established:

  • whether other drivers link this module much faster. @screamm's RTX 4070 runs in #3581 reach the flat interpolation stop, which suggests they do. lavapipe stops earlier, on subgroup capability 61, so I could not compare there;
  • whether a 23× expansion from guest code to SPIR-V is expected for this shader.

Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release. Measured under gdb with _NO_DEBUG_HEAP=1; Windows's debug heap otherwise inflates the allocation-heavy steps.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5811333638 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-12T09:20:54Z. --- On `main` `8c4a295ff` on Windows, Homebrew UI Lab (PPSA99050) and Surround Sound Studio (PPSA99051) quit about 18 s after start, at their third draw. The title logs this to its own log (`download0/hui/dev/app.log`), and the exit code is 1: ``` [ps5-agc] submission retirement failed; terminating application before cleanup ``` **Cause.** Both titles use the ps5-opengl native runtime. It polls the end-of-pipe marker of each submission for at most 2000 × `sceKernelUsleep(1000)`, about 2 s (`runtime_completion_pause`, `runtime_require_retirement` in `src/platform/ps5_agc_native_runtime.c`). It then calls `_Exit(EXIT_FAILURE)`. At the third draw, the AGC worker is still compiling the pipeline for the runtime's large pixel shader (`compile-shader stage=5 bytes=21652 hash=f8d1fab9`, the same shader in both titles): - The recompiled SPIR-V is 496,697 words (about 2 MB) for 21,652 bytes of guest code. - `SpecializeSpirv` takes 0.09 s on that module in a standalone harness and 0.2 s in the process, so it is not the cost. - `LinkPipelineFromLibraries` → `CachedPipeline` takes **19.8 s** on a Radeon 860M (RDNA 3.5, AMD driver 32.0.13058.8001). To measure it I ran a local libkernel build whose `sceKernelUsleep` sleeps 20× longer; that change is not part of any PR. - `APS5_NO_PIPELINE_LTO=1` and `APS5_NO_GPL=1` do not change the outcome. With the pipeline cache warm from that run, both titles pass the third draw at the normal budget. They then stop on `last provoking vertex with explicit per-vertex flat interpolation is unsupported` (#3581, #4030), as in #3581's run on `a11c8f7f`. So on this machine the timeout only blocks a first run, but it blocks it every time: the process exits before the pipeline is saved. **Not established:** - whether other drivers link this module much faster. @screamm's RTX 4070 runs in #3581 reach the flat interpolation stop, which suggests they do. lavapipe stops earlier, on subgroup capability 61, so I could not compare there; - whether a 23× expansion from guest code to SPIR-V is expected for this shader. Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release. Measured under gdb with `_NO_DEBUG_HEAP=1`; Windows's debug heap otherwise inflates the allocation-heavy steps. AI-assisted: yes (Claude Code).
LeandroLP23 commented 2026-10-12 19:07:55 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T19:07:55Z.


A third ps5-opengl title now hits the same stop on a first run: PS5 OpenGL Showcase (PPSA99005, catalog v1.0.1). Windows 11 (26300), Radeon 860M (driver 32.0.13058.8001), relinked with --windows. Each run starts from a fresh output directory, so the emulator's own shader_cache is empty every time; only AMD's driver cache under %LOCALAPPDATA%\AMD\VkCache carries over between runs.

Build Run Result
main 8c4a295ff 1 runs 60 s
main d592d54e1 + #4445 3 (one with APS5_NO_PIPELINE_LTO=1) exit 1 after 20 to 34 s
main 1b92f7f5d 1st exit 1 after 21 s
main 1b92f7f5d 2nd runs 60 s, 7.3 FPS

In every failing run, the last line of the title's own log (download0/ps5-opengl.log) is [ps5-agc] submission retirement failed; terminating application before cleanup.

The second run on 1b92f7f5d passes once the driver cache is warm, as Homebrew UI Lab and Surround Sound Studio do. So this looks like the same ~2 s submission wait in the ps5-opengl runtime, not a separate bug.

I started a bisect between 8c4a295ff and d592d54e1 but stopped it: whether a step passes depends on what the driver cache already holds, so single runs don't give a reliable good/bad verdict.

Yamagi Quake II (PPSA99007, built on the same runtime) also quits early on this machine, with eglSwapBuffers failed: 0x300d / PS5 presentation failed after about 30 s. It does so on 8c4a295ff too, and I haven't traced it, so I'm not counting it here.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6130822609 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6130822609). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-12T19:07:55Z. --- A third ps5-opengl title now hits the same stop on a first run: PS5 OpenGL Showcase (PPSA99005, catalog v1.0.1). Windows 11 (26300), Radeon 860M (driver 32.0.13058.8001), relinked with `--windows`. Each run starts from a fresh output directory, so the emulator's own `shader_cache` is empty every time; only AMD's driver cache under `%LOCALAPPDATA%\AMD\VkCache` carries over between runs. | Build | Run | Result | |---|---|---| | `main` `8c4a295ff` | 1 | runs 60 s | | `main` `d592d54e1` + #4445 | 3 (one with `APS5_NO_PIPELINE_LTO=1`) | exit 1 after 20 to 34 s | | `main` `1b92f7f5d` | 1st | exit 1 after 21 s | | `main` `1b92f7f5d` | 2nd | runs 60 s, 7.3 FPS | In every failing run, the last line of the title's own log (`download0/ps5-opengl.log`) is `[ps5-agc] submission retirement failed; terminating application before cleanup`. The second run on `1b92f7f5d` passes once the driver cache is warm, as Homebrew UI Lab and Surround Sound Studio do. So this looks like the same ~2 s submission wait in the ps5-opengl runtime, not a separate bug. I started a bisect between `8c4a295ff` and `d592d54e1` but stopped it: whether a step passes depends on what the driver cache already holds, so single runs don't give a reliable good/bad verdict. Yamagi Quake II (PPSA99007, built on the same runtime) also quits early on this machine, with `eglSwapBuffers failed: 0x300d` / `PS5 presentation failed` after about 30 s. It does so on `8c4a295ff` too, and I haven't traced it, so I'm not counting it here. AI-assisted: yes (Claude Code)
simonbbby commented 2026-10-12 19:21:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-12T19:21:24Z.


The timeout also reproduces on NVIDIA/Linux, from the saved 2026-10-12 verification batch at main 2a5eca11.

Homebrew UI Lab (PPSA99050 01.000.010) and Surround Sound Studio (PPSA99051 01.000.003), from the open-source homebrew catalog:

Normal-budget cold runs, both titles combined RADV gfx1036 RTX 3090
First swap reached; survives to the 40 s test timeout 6/6 0/6

Every NVIDIA failure exits 1 with submission retirement failed, after compiling pixel shader f8d1fab9 (21,652 guest bytes). Fresh ANYPS5_SHADER_CACHE_DIR, MESA_SHADER_CACHE_DISABLE=true, and __GL_SHADER_DISK_CACHE=0 isolate cold runs. Both ANYPS5_GPU and VK_DRIVER_FILES pin the device.

A local timer build with sceKernelUsleep extended 20× lets the pipeline build finish for measurement; that modification is not proposed for merging. At load average ≤4, with SPIRV-Tools ON:

Pipeline build RADV gfx1036, Mesa 25.2.8 RTX 3090, NVIDIA 595.99.02
Median (range) 389.9 ms (379.8–396.7), 14 runs 2189.6 ms (2149.6–2286.9), 11 runs

Draw-time specialization/optimization adds approximately 0.48–0.49 s. With SPIRV-Tools OFF, NVIDIA still takes 2250–2261 ms to build and fails the normal wait. Disabling LTO or GPL does not rescue NVIDIA.

Reusing the AnyPS5 cache from a failed run still fails (0/2); reusing the cache from a completed 20×-budget run passes (2/2). Enabling NVIDIA's disk cache did not rescue repeated launches in this batch. Thus a failed launch need not leave the pipeline cached for the next one.

Ubuntu 24.04, Linux 7.0, Ryzen 9 9950X, GCC 13.3, Release. These are results at the stated revision, not a retest of newer main. Windows and the newly reported PPSA99005 were not tested here; gfx1036 is RDNA2, not PS5 gfx1013.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6131041039 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6131041039). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-12T19:21:24Z. --- The timeout also reproduces on NVIDIA/Linux, from the saved 2026-10-12 verification batch at `main` `2a5eca11`. Homebrew UI Lab (PPSA99050 01.000.010) and Surround Sound Studio (PPSA99051 01.000.003), from the open-source homebrew catalog: | Normal-budget cold runs, both titles combined | RADV gfx1036 | RTX 3090 | |---|---|---| | First swap reached; survives to the 40 s test timeout | 6/6 | 0/6 | Every NVIDIA failure exits 1 with `submission retirement failed`, after compiling pixel shader `f8d1fab9` (21,652 guest bytes). Fresh `ANYPS5_SHADER_CACHE_DIR`, `MESA_SHADER_CACHE_DISABLE=true`, and `__GL_SHADER_DISK_CACHE=0` isolate cold runs. Both `ANYPS5_GPU` and `VK_DRIVER_FILES` pin the device. A local timer build with `sceKernelUsleep` extended 20× lets the pipeline build finish for measurement; that modification is not proposed for merging. At load average ≤4, with SPIRV-Tools ON: | Pipeline build | RADV gfx1036, Mesa 25.2.8 | RTX 3090, NVIDIA 595.99.02 | |---|---|---| | Median (range) | 389.9 ms (379.8–396.7), 14 runs | 2189.6 ms (2149.6–2286.9), 11 runs | Draw-time specialization/optimization adds approximately 0.48–0.49 s. With SPIRV-Tools OFF, NVIDIA still takes 2250–2261 ms to build and fails the normal wait. Disabling LTO or GPL does not rescue NVIDIA. Reusing the AnyPS5 cache from a failed run still fails (0/2); reusing the cache from a completed 20×-budget run passes (2/2). Enabling NVIDIA's disk cache did not rescue repeated launches in this batch. Thus a failed launch need not leave the pipeline cached for the next one. Ubuntu 24.04, Linux 7.0, Ryzen 9 9950X, GCC 13.3, Release. These are results at the stated revision, not a retest of newer main. Windows and the newly reported PPSA99005 were not tested here; gfx1036 is RDNA2, not PS5 gfx1013.
MarcZX10 commented 2026-10-12 20:00:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T20:00:11Z.


Thanks for the second independent driver report. It changes the evidence: the cold compile timeout is not limited to the Radeon driver; the RTX 3090 median is about 2.19 s against the runtime’s ~2 s retirement wait, while RADV is below it. The next useful implementation evidence would be a profile of the f8d1fab9 pipeline stages on the failing NVIDIA path (including whether the 496k-word SPIR-V reaches Vulkan unchanged) and a semantics-preserving optimization benchmark. I don’t see a safe AnyPS5 patch from the timing data alone yet, since the measured threshold is imposed by the external ps5-opengl runtime and the expected shader expansion is still unknown.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6131646050 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6131646050). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T20:00:11Z. --- Thanks for the second independent driver report. It changes the evidence: the cold compile timeout is not limited to the Radeon driver; the RTX 3090 median is about 2.19 s against the runtime’s ~2 s retirement wait, while RADV is below it. The next useful implementation evidence would be a profile of the `f8d1fab9` pipeline stages on the failing NVIDIA path (including whether the 496k-word SPIR-V reaches Vulkan unchanged) and a semantics-preserving optimization benchmark. I don’t see a safe AnyPS5 patch from the timing data alone yet, since the measured threshold is imposed by the external ps5-opengl runtime and the expected shader expansion is still unknown.
simonbbby commented 2026-10-12 20:21:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-12T20:21:09Z.


The saved Linux profile already narrows the stage breakdown, although it is not a semantics-preserving optimization benchmark.

At main 2a5eca11, SPIRV-Tools ON, the NVIDIA draw-path log reports 449,084 fragment words, not 496,697. With SPIRV-Tools OFF it reports 492,201. These are the module-size readings at draw-time pipeline construction; I have not added a separate capture at the vkCreateShaderModule boundary, so I would not claim that boundary is independently audited.

One low-load extended-budget run on RTX 3090/NVIDIA 595.99.02 records:

register-prepare stage=5 code_dwords=5413 ms=1273.6
register-prepare stage=5 code_dwords=5413 ms=1207.2
pipeline draw libraries=1 words=1:930,5:449084 prep_ms=0.6 create_ms=2149.6

Those two registration variants finish before the normal-budget retirement failure. Across the saved detailed profiles, draw-time specialization takes 39–53 ms and the subsequent SPIRV-Tools pass about 449 ms on NVIDIA; pipeline creation then takes about 2.19 s. The prep_ms field above measures the later pipeline preparation step, not the preceding specialization/optimization. NVIDIA's LTO policy is disabled in these runs (optimize=0); monolithic creation with GPL disabled still takes 2184–2204 ms.

Thus the driver build alone exceeds the title's wait here, and disabling SPIRV-Tools does not rescue it. I agree this does not establish a safe patch by itself. The #4322 experiment posted on that PR grows the module and worsens this workload; no successful semantics-preserving size reduction has been established by this batch. These remain measurements at the stated older main, not a newer-main retest.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6131956775 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6131956775). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-12T20:21:09Z. --- The saved Linux profile already narrows the stage breakdown, although it is not a semantics-preserving optimization benchmark. At `main` `2a5eca11`, SPIRV-Tools ON, the NVIDIA draw-path log reports **449,084 fragment words**, not 496,697. With SPIRV-Tools OFF it reports 492,201. These are the module-size readings at draw-time pipeline construction; I have not added a separate capture at the `vkCreateShaderModule` boundary, so I would not claim that boundary is independently audited. One low-load extended-budget run on RTX 3090/NVIDIA 595.99.02 records: ```text register-prepare stage=5 code_dwords=5413 ms=1273.6 register-prepare stage=5 code_dwords=5413 ms=1207.2 pipeline draw libraries=1 words=1:930,5:449084 prep_ms=0.6 create_ms=2149.6 ``` Those two registration variants finish before the normal-budget retirement failure. Across the saved detailed profiles, draw-time specialization takes 39–53 ms and the subsequent SPIRV-Tools pass about 449 ms on NVIDIA; pipeline creation then takes about 2.19 s. The `prep_ms` field above measures the later pipeline preparation step, not the preceding specialization/optimization. NVIDIA's LTO policy is disabled in these runs (`optimize=0`); monolithic creation with GPL disabled still takes 2184–2204 ms. Thus the driver build alone exceeds the title's wait here, and disabling SPIRV-Tools does not rescue it. I agree this does not establish a safe patch by itself. The #4322 experiment posted on that PR grows the module and worsens this workload; no successful semantics-preserving size reduction has been established by this batch. These remain measurements at the stated older main, not a newer-main retest.
MarcZX10 commented 2026-10-12 20:31:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T20:31:29Z.


Thanks, this profile changes the diagnosis from my earlier note. The two registration-prepare variants finish before the normal-budget failure; specialization is 39–53 ms and the SPIRV-Tools pass is about 449 ms, while NVIDIA pipeline creation alone is about 2.15–2.20 s. Disabling SPIRV-Tools therefore does not bring this workload under the roughly 2 s wait, and the current data does not establish a safe semantics-preserving fix. I agree we should leave the timeout unchanged and treat the issue as unresolved until a measured pipeline-time reduction is available. I will keep the timings tied to the reported 2a5eca11 base rather than present them as a current-main result.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132107771 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6132107771). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T20:31:29Z. --- Thanks, this profile changes the diagnosis from my earlier note. The two registration-prepare variants finish before the normal-budget failure; specialization is 39–53 ms and the SPIRV-Tools pass is about 449 ms, while NVIDIA pipeline creation alone is about 2.15–2.20 s. Disabling SPIRV-Tools therefore does not bring this workload under the roughly 2 s wait, and the current data does not establish a safe semantics-preserving fix. I agree we should leave the timeout unchanged and treat the issue as unresolved until a measured pipeline-time reduction is available. I will keep the timings tied to the reported `2a5eca11` base rather than present them as a current-main result.
LeandroLP23 commented 2026-10-12 21:18:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T21:18:20Z.


@MarcZX100 Here is the per-stage profile of f8d1fab9 on the AMD Windows path, plus an optimization comparison.

Setup. Homebrew UI Lab (PPSA99050), main 9ea71307a, Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Release. The instrumentation is local and not proposed: wall-clock timers around each stage, plus sceKernelUsleep/usleep scaled 40× so the runtime's ~2 s wait doesn't end the run. Each run had ANYPS5_NO_SHADER_CACHE=1 and APS5_NO_PIPELINE_CACHE=1, and I emptied %LOCALAPPDATA%\AMD\VkCache before it. Eight to ten files there could not be deleted while stuck processes from earlier runs were alive, so the driver cache was not fully cold. Numbers vary about 2× between batches; compare within a batch.

Stages (ms, one row per run):

Build / mode emit SPIRV-Tools optimize specialize + its optimize module words to Vulkan vkCreateShaderModule fragment-shader library part 2nd fragment part fast link background LTO link
default build (SPIRV-Tools OFF), batch 1 ×4 runs 120–200 — 250–410 + 0 491,067 480–660 20,522–22,594 1,360–1,690 <50 <80
SPIRV-Tools ON, default mode, batch 2 158 3,215 / 3,121 184 + 2,283 449,067 523 21,626 1,396 <50 21,721, 24,352
SPIRV-Tools ON, APS5_SPIRV_OPT=none, batch 2 133 273 / 530 (validation only) 327 + 3,046 449,772 615 21,255 1,490 <50 21,885, 22,697
SPIRV-Tools ON, full, batch 2 127 2,008 / 1,950 86 + 1,209 449,104 200 8,116 737 <50 11,843, 19,196
SPIRV-Tools ON, default, batch 3 ×2 ~150 1,595–1,694 119–125 + 1,043–1,151 449,067 246–248 10,689 / 11,091 797–820 <50 15,289–18,688
SPIRV-Tools ON, full, batch 3 ×2 ~150 2,071–2,514 112–116 + 1,436–1,462 449,104 245 10,409 / 10,676 785 <50 15,696–19,602

"SPIRV-Tools optimize" has two numbers because the shader is emitted twice: 497,759 and 497,667 words.

What this shows:

  • The cost is in the driver. It is the VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT part, AMD compiling the fragment shader, not linking: the fast link is under 50 ms. The emulator's own stages add 0.5–1 s without SPIRV-Tools and about 3–6 s with it. The background LTO link compiles the shader again for 11–24 s, but it doesn't block the submission.
  • The SPIR-V reaches Vulkan unchanged. With the default build (ANYPS5_ENABLE_SPIRV_TOOLS=OFF), the module given to vkCreateShaderModule is exactly the specialization output: 491,067 words, the same FNV hash at both points, in every run. Specialization only trims the recompiler's 496,697 words. The APS5_SPIRV_OPT modes do nothing in that build. With SPIRV-Tools ON, the module shrinks to about 449,100 words (−9%).
  • Optimization doesn't change the driver's cost in a reproducible way. full gave 8.1 s once in batch 2, against 21–22 s for default and none. In batch 3, alternating default and full runs, it gave 10.4–10.7 s against 10.7–11.1 s. So the batch-2 difference doesn't reproduce: a 9% smaller module, or full's extra passes, don't move the AMD compile in a way I can separate from run-to-run variance. Even the best case stays far above the runtime's ~2 s wait on this GPU.
  • Expected expansion. I can't say whether ~23 SPIR-V words per guest byte is expected for this shader. The dumped modules (module-eb4859fbf5c6b4ee.spv, 1.96 MB, SPIRV-Tools OFF, and module-9cec7dbb9ebfc0df.spv, 1.80 MB, full) are available if someone wants to look at what dominates them.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132780531 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6132780531). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-12T21:18:20Z. --- @MarcZX100 Here is the per-stage profile of `f8d1fab9` on the AMD Windows path, plus an optimization comparison. **Setup.** Homebrew UI Lab (PPSA99050), `main` `9ea71307a`, Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Release. The instrumentation is local and not proposed: wall-clock timers around each stage, plus `sceKernelUsleep`/`usleep` scaled 40× so the runtime's ~2 s wait doesn't end the run. Each run had `ANYPS5_NO_SHADER_CACHE=1` and `APS5_NO_PIPELINE_CACHE=1`, and I emptied `%LOCALAPPDATA%\AMD\VkCache` before it. Eight to ten files there could not be deleted while stuck processes from earlier runs were alive, so the driver cache was not fully cold. Numbers vary about 2× between batches; compare within a batch. **Stages** (ms, one row per run): | Build / mode | emit | SPIRV-Tools optimize | specialize + its optimize | module words to Vulkan | `vkCreateShaderModule` | fragment-shader library part | 2nd fragment part | fast link | background LTO link | |---|---|---|---|---|---|---|---|---|---| | default build (SPIRV-Tools OFF), batch 1 ×4 runs | 120–200 | — | 250–410 + 0 | 491,067 | 480–660 | **20,522–22,594** | 1,360–1,690 | <50 | <80 | | SPIRV-Tools ON, default mode, batch 2 | 158 | 3,215 / 3,121 | 184 + 2,283 | 449,067 | 523 | **21,626** | 1,396 | <50 | 21,721, 24,352 | | SPIRV-Tools ON, `APS5_SPIRV_OPT=none`, batch 2 | 133 | 273 / 530 (validation only) | 327 + 3,046 | 449,772 | 615 | **21,255** | 1,490 | <50 | 21,885, 22,697 | | SPIRV-Tools ON, `full`, batch 2 | 127 | 2,008 / 1,950 | 86 + 1,209 | 449,104 | 200 | **8,116** | 737 | <50 | 11,843, 19,196 | | SPIRV-Tools ON, default, batch 3 ×2 | ~150 | 1,595–1,694 | 119–125 + 1,043–1,151 | 449,067 | 246–248 | **10,689 / 11,091** | 797–820 | <50 | 15,289–18,688 | | SPIRV-Tools ON, `full`, batch 3 ×2 | ~150 | 2,071–2,514 | 112–116 + 1,436–1,462 | 449,104 | 245 | **10,409 / 10,676** | 785 | <50 | 15,696–19,602 | "SPIRV-Tools optimize" has two numbers because the shader is emitted twice: 497,759 and 497,667 words. **What this shows:** - **The cost is in the driver.** It is the `VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT` part, AMD compiling the fragment shader, not linking: the fast link is under 50 ms. The emulator's own stages add 0.5–1 s without SPIRV-Tools and about 3–6 s with it. The background LTO link compiles the shader again for 11–24 s, but it doesn't block the submission. - **The SPIR-V reaches Vulkan unchanged.** With the default build (`ANYPS5_ENABLE_SPIRV_TOOLS=OFF`), the module given to `vkCreateShaderModule` is exactly the specialization output: 491,067 words, the same FNV hash at both points, in every run. Specialization only trims the recompiler's 496,697 words. The `APS5_SPIRV_OPT` modes do nothing in that build. With SPIRV-Tools ON, the module shrinks to about 449,100 words (−9%). - **Optimization doesn't change the driver's cost in a reproducible way.** `full` gave 8.1 s once in batch 2, against 21–22 s for default and `none`. In batch 3, alternating default and `full` runs, it gave 10.4–10.7 s against 10.7–11.1 s. So the batch-2 difference doesn't reproduce: a 9% smaller module, or `full`'s extra passes, don't move the AMD compile in a way I can separate from run-to-run variance. Even the best case stays far above the runtime's ~2 s wait on this GPU. - **Expected expansion.** I can't say whether ~23 SPIR-V words per guest byte is expected for this shader. The dumped modules (`module-eb4859fbf5c6b4ee.spv`, 1.96 MB, SPIRV-Tools OFF, and `module-9cec7dbb9ebfc0df.spv`, 1.80 MB, `full`) are available if someone wants to look at what dominates them. AI-assisted: yes (Claude Code)
LeandroLP23 commented 2026-10-12 21:21:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T21:21:26Z.


Reported the runtime's ~2 s retirement bound upstream: https://github.com/blackbearreloaded/ps5-opengl/issues/10 (asks for a longer or configurable wait before its fail-stop).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132831906 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6132831906). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-12T21:21:26Z. --- Reported the runtime's ~2 s retirement bound upstream: https://github.com/blackbearreloaded/ps5-opengl/issues/10 (asks for a longer or configurable wait before its fail-stop).
LeandroLP23 commented 2026-10-13 07:36:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T07:36:49Z.


Updates on the two runtimes involved:

  • ps5-opengl merged a 30 s retirement wait (blackbearreloaded/ps5-opengl#12, SDK 1.0.2), so titles rebuilt with it shouldn't hit this.
  • The same first-run pattern shows up in titles on the PS5 RADV port: Mortalfin (PPSA99141) and ProsperoAI (PPSA99004) report radv/ps5: the GPU has not reached submission N in 10 s and lose the device, and Mortalfin runs normally once the driver cache is warm. Reported upstream as mihawk-99/PS5_Mesa#3 (10 s RADV_PS5_STALL_NS).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140691883 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6140691883). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-13T07:36:49Z. --- Updates on the two runtimes involved: - ps5-opengl merged a 30 s retirement wait ([blackbearreloaded/ps5-opengl#12](https://github.com/blackbearreloaded/ps5-opengl/pull/12), SDK 1.0.2), so titles rebuilt with it shouldn't hit this. - The same first-run pattern shows up in titles on the PS5 RADV port: Mortalfin (PPSA99141) and ProsperoAI (PPSA99004) report `radv/ps5: the GPU has not reached submission N in 10 s` and lose the device, and Mortalfin runs normally once the driver cache is warm. Reported upstream as [mihawk-99/PS5_Mesa#3](https://github.com/mihawk-99/PS5_Mesa/issues/3) (10 s `RADV_PS5_STALL_NS`).
orishamir commented 2026-10-14 06:47:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-14T06:47:59Z.


Yamagi Quake II (PPSA99007, catalog 0.2.0-alpha.1), mentioned above, runs without a stop on current main here: plain main f87799aa3, Windows 11, RTX 4080 (driver 616.56), WinLibs GCC 15.2.0 Release, no relinker options, 60 s per run:

Run Caches First frame Frames in 60 s Result
1 emulator shader/pipeline cache and NVIDIA's disk cache (ANYPS5_SHADER_CACHE_DIR, __GL_SHADER_DISK_CACHE_PATH) in new empty directories 1.73 s 6,720 main menu (Game, Multiplayer, Options, Video, Quit) at 119.9 FPS, no stop
2 the same directories again 1.57 s 6,480 same

The title now gets its 120 Hz output mode ([ps5-output-mode] target=120 ... result=00000000). On this machine before #3886 (main 3d8ffeb2, Oct 12) the same request returned result=ffffffff and the title quit after 20 s with PS5 presentation failed.

PS5 OpenGL Showcase (PPSA99005) on the same build, one run per version, each with its own empty cache directories (the driver wrote 1.2 MB into its directory in each run): catalog v1.0.1 and v1.0.2 (rebuilt with blackbearreloaded/ps5-opengl#12's 30 s wait) both run 60 s and render the full scene at about 6 FPS at 3840x2160. Neither logs submission retirement failed. On this GPU the old 2 s wait isn't hit by the showcase, even on a first run. Surround Sound Studio (PPSA99051, catalog 01.000.003, not rebuilt yet) does hit it, though. Edit, Oct 14 12:05Z: on main 968d32686, with the build's new shader cache and a driver cache without this shader, it compiled pixel shader f8d1fab9 and quit 4 s in with [ps5-agc] submission retirement failed (exit 1). The earlier warm runs of the same title on 31bfc4e86 ran 45 s. I didn't time the pipeline build.

AI-assisted: yes (Claude Code Opus 5.5)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6162621642 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6162621642). Originally posted by [orishamir](https://github.com/orishamir) on 2026-10-14T06:47:59Z. --- Yamagi Quake II (PPSA99007, catalog 0.2.0-alpha.1), mentioned above, runs without a stop on current `main` here: plain `main` f87799aa3, Windows 11, RTX 4080 (driver 616.56), WinLibs GCC 15.2.0 Release, no relinker options, 60 s per run: | Run | Caches | First frame | Frames in 60 s | Result | |---|---|---|---|---| | 1 | emulator shader/pipeline cache and NVIDIA's disk cache (`ANYPS5_SHADER_CACHE_DIR`, `__GL_SHADER_DISK_CACHE_PATH`) in new empty directories | 1.73 s | 6,720 | main menu (Game, Multiplayer, Options, Video, Quit) at 119.9 FPS, no stop | | 2 | the same directories again | 1.57 s | 6,480 | same | The title now gets its 120 Hz output mode (`[ps5-output-mode] target=120 ... result=00000000`). On this machine before #3886 (`main` 3d8ffeb2, Oct 12) the same request returned `result=ffffffff` and the title quit after 20 s with `PS5 presentation failed`. PS5 OpenGL Showcase (PPSA99005) on the same build, one run per version, each with its own empty cache directories (the driver wrote 1.2 MB into its directory in each run): catalog v1.0.1 and v1.0.2 (rebuilt with blackbearreloaded/ps5-opengl#12's 30 s wait) both run 60 s and render the full scene at about 6 FPS at 3840x2160. Neither logs `submission retirement failed`. On this GPU the old 2 s wait isn't hit by the showcase, even on a first run. Surround Sound Studio (PPSA99051, catalog 01.000.003, not rebuilt yet) does hit it, though. Edit, Oct 14 12:05Z: on `main` 968d32686, with the build's new shader cache and a driver cache without this shader, it compiled pixel shader `f8d1fab9` and quit 4 s in with `[ps5-agc] submission retirement failed` (exit 1). The earlier warm runs of the same title on 31bfc4e86 ran 45 s. I didn't time the pipeline build. AI-assisted: yes (Claude Code Opus 5.5)
DavidSamir commented 2026-10-21 10:22:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-21T10:22:44Z.


Two data points on the f8d1fab9 shader for whoever looks at this again. The catalog builds of Surround Sound Studio (PPSA99051) and Pulse (PPSA99993) still have ps5-opengl's 2 s retirement wait.

NVIDIA also misses the wait on a first run. Setup: RTX 3070 (driver 610.60), Windows 11, main 27c88a8d7.

  • With an empty shader cache, Surround Sound Studio exits with [ps5-agc] submission retirement failed after 12–21 s, in 4 of 4 runs.
  • With a warm cache it runs 60 s, in 4 of 4 runs.

Size of the recompiled module. It's 1,645,252 bytes of SPIR-V and 84,251 instructions. The most frequent opcodes:

Opcode Count
BitwiseAnd 17,241
Select 16,422
Bitcast 13,544
UGreaterThan 8,504

About 10k of the selects are the per-op NaN result choice (nanResultF32). The other large group is the f32 denormal and tiny-product fixups.

Open PRs barely move it. With #4287, #8958 or both merged locally, the count is 84,097, 84,143 and 83,989 instructions (−0.2%, −0.1%, −0.3%).

Skipping the NaN choice where its payload is unused wouldn't help much either. I ran a backward payload-liveness count over the module. It treats as not reading the payload: compares, conversions to int, the NaN and denormal tests, and sign-only reads. Only 9 of the 9,975 NaN choices have a payload that nothing reads afterwards. The rest are read by the recompiler's own raw-bit f32 fixups on the result: ISub (mostly the tiny-product check), ShiftRightLogical (exponent extraction) and BitwiseOr. Those reads probably don't depend on the payload, but proving that per pattern is a much larger change.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6313657415 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4399#issuecomment-6313657415). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-21T10:22:44Z. --- Two data points on the `f8d1fab9` shader for whoever looks at this again. The catalog builds of Surround Sound Studio (PPSA99051) and Pulse (PPSA99993) still have ps5-opengl's 2 s retirement wait. **NVIDIA also misses the wait on a first run.** Setup: RTX 3070 (driver 610.60), Windows 11, `main` 27c88a8d7. - With an empty shader cache, Surround Sound Studio exits with `[ps5-agc] submission retirement failed` after 12–21 s, in 4 of 4 runs. - With a warm cache it runs 60 s, in 4 of 4 runs. **Size of the recompiled module.** It's 1,645,252 bytes of SPIR-V and 84,251 instructions. The most frequent opcodes: | Opcode | Count | |---|---| | `BitwiseAnd` | 17,241 | | `Select` | 16,422 | | `Bitcast` | 13,544 | | `UGreaterThan` | 8,504 | About 10k of the selects are the per-op NaN result choice (`nanResultF32`). The other large group is the f32 denormal and tiny-product fixups. **Open PRs barely move it.** With #4287, #8958 or both merged locally, the count is 84,097, 84,143 and 83,989 instructions (−0.2%, −0.1%, −0.3%). **Skipping the NaN choice where its payload is unused wouldn't help much either.** I ran a backward payload-liveness count over the module. It treats as not reading the payload: compares, conversions to int, the NaN and denormal tests, and sign-only reads. Only 9 of the 9,975 NaN choices have a payload that nothing reads afterwards. The rest are read by the recompiler's own raw-bit f32 fixups on the result: `ISub` (mostly the tiny-product check), `ShiftRightLogical` (exponent extraction) and `BitwiseOr`. Those reads probably don't depend on the payload, but proving that per pattern is a much larger change. AI-assisted: yes
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#4399
No description provided.