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
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T09:20:54Z.
On
main8c4a295ffon 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: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_retirementinsrc/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):SpecializeSpirvtakes 0.09 s on that module in a standalone harness and 0.2 s in the process, so it is not the cost.LinkPipelineFromLibraries→CachedPipelinetakes 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 whosesceKernelUsleepsleeps 20× longer; that change is not part of any PR.APS5_NO_PIPELINE_LTO=1andAPS5_NO_GPL=1do 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 ona11c8f7f. 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:
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).
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 ownshader_cacheis empty every time; only AMD's driver cache under%LOCALAPPDATA%\AMD\VkCachecarries over between runs.main8c4a295ffmaind592d54e1+ #4445APS5_NO_PIPELINE_LTO=1)main1b92f7f5dmain1b92f7f5dIn 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
1b92f7f5dpasses 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
8c4a295ffandd592d54e1but 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 failedafter about 30 s. It does so on8c4a295fftoo, and I haven't traced it, so I'm not counting it here.AI-assisted: yes (Claude Code)
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
main2a5eca11.Homebrew UI Lab (PPSA99050 01.000.010) and Surround Sound Studio (PPSA99051 01.000.003), from the open-source homebrew catalog:
Every NVIDIA failure exits 1 with
submission retirement failed, after compiling pixel shaderf8d1fab9(21,652 guest bytes). FreshANYPS5_SHADER_CACHE_DIR,MESA_SHADER_CACHE_DISABLE=true, and__GL_SHADER_DISK_CACHE=0isolate cold runs. BothANYPS5_GPUandVK_DRIVER_FILESpin the device.A local timer build with
sceKernelUsleepextended 20× lets the pipeline build finish for measurement; that modification is not proposed for merging. At load average ≤4, with SPIRV-Tools ON: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.
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
f8d1fab9pipeline 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.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
main2a5eca11, 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 thevkCreateShaderModuleboundary, so I would not claim that boundary is independently audited.One low-load extended-budget run on RTX 3090/NVIDIA 595.99.02 records:
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_msfield 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.
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
2a5eca11base rather than present them as a current-main result.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T21:18:20Z.
@MarcZX100 Here is the per-stage profile of
f8d1fab9on the AMD Windows path, plus an optimization comparison.Setup. Homebrew UI Lab (PPSA99050),
main9ea71307a, 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, plussceKernelUsleep/usleepscaled 40× so the runtime's ~2 s wait doesn't end the run. Each run hadANYPS5_NO_SHADER_CACHE=1andAPS5_NO_PIPELINE_CACHE=1, and I emptied%LOCALAPPDATA%\AMD\VkCachebefore 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):
vkCreateShaderModuleAPS5_SPIRV_OPT=none, batch 2full, batch 2full, batch 3 ×2"SPIRV-Tools optimize" has two numbers because the shader is emitted twice: 497,759 and 497,667 words.
What this shows:
VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXTpart, 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.ANYPS5_ENABLE_SPIRV_TOOLS=OFF), the module given tovkCreateShaderModuleis 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. TheAPS5_SPIRV_OPTmodes do nothing in that build. With SPIRV-Tools ON, the module shrinks to about 449,100 words (−9%).fullgave 8.1 s once in batch 2, against 21–22 s for default andnone. In batch 3, alternating default andfullruns, 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, orfull'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.module-eb4859fbf5c6b4ee.spv, 1.96 MB, SPIRV-Tools OFF, andmodule-9cec7dbb9ebfc0df.spv, 1.80 MB,full) are available if someone wants to look at what dominates them.AI-assisted: yes (Claude Code)
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).
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T07:36:49Z.
Updates on the two runtimes involved:
radv/ps5: the GPU has not reached submission N in 10 sand lose the device, and Mortalfin runs normally once the driver cache is warm. Reported upstream as mihawk-99/PS5_Mesa#3 (10 sRADV_PS5_STALL_NS).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
mainhere: plainmainf87799aa3, Windows 11, RTX 4080 (driver 616.56), WinLibs GCC 15.2.0 Release, no relinker options, 60 s per run:ANYPS5_SHADER_CACHE_DIR,__GL_SHADER_DISK_CACHE_PATH) in new empty directoriesThe title now gets its 120 Hz output mode (
[ps5-output-mode] target=120 ... result=00000000). On this machine before #3886 (main3d8ffeb2, Oct 12) the same request returnedresult=ffffffffand the title quit after 20 s withPS5 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: onmain968d32686, with the build's new shader cache and a driver cache without this shader, it compiled pixel shaderf8d1fab9and quit 4 s in with[ps5-agc] submission retirement failed(exit 1). The earlier warm runs of the same title on31bfc4e86ran 45 s. I didn't time the pipeline build.AI-assisted: yes (Claude Code Opus 5.5)
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-21T10:22:44Z.
Two data points on the
f8d1fab9shader 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,
main27c88a8d7.[ps5-agc] submission retirement failedafter 12–21 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:
BitwiseAndSelectBitcastUGreaterThanAbout 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) andBitwiseOr. Those reads probably don't depend on the payload, but proving that per pattern is a much larger change.AI-assisted: yes