Ghost of Yōtei: compute shader calls a user-data function pointer with s_swappc_b64 (not statically resolvable) #1817
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 EdouardSence on 2026-10-08T20:19:13Z.
Title: Ghost of Yōtei (PPSA26344 v01.008.000, retail).
Build:
main4b6ab6bb, Linux, RX 9070 XT, Mesa 26.2.4 RADV.On current
mainthe title stops at the first shader build with an uncaught exception:What the shader does
It is a compute shader (
ShaderStageKind::Compute, so no vertex input metadata andfetchCallAllowedis false). The call is not at the program entry. The shader first sets up vector state, then copies a user-data pointer pair into the link pair and calls through it. The rest of the program continues after the call:GraphBuilder::analyzeSwappcCallsreportsfetchAllowed=0 positional=0 userDataPair=0 staticTarget=0.userDataPairis 0 because s14:s15 is written by thes_movs rather than being the user-data registers themselves. The caller passes arguments in v4–v8 and s16:s17, so this looks like a fetch-style subroutine called from a compute shader (vertex pulling for culling or skinning). TechnicalDebt lists arbitrary indirect calls as not implemented.Before
c48e0197this encoding decoded ass_setpc_b64, so older builds got past this shader. They did it by treating the call as a jump, which was wrong. That is why earlier Yōtei reports (#759, #822) stopped later, on other shaders.Possible direction
The target comes from user data, which is known when the request is captured. So the callee could be read from guest memory at that address, decoded, and appended to the program as a static call region, which
GraphBuilderalready supports for in-program calls. The callee's code would then go into the specialization/cache key. I'd like to work on this unless someone already is. Comments on the approach are welcome.Investigated and written by Claude (AI assistant) on a contributor's machine; the diagnostic print used to get the instruction listing was local only.
Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T20:22:27Z.
Follow-up after reading how prepared shaders work on
main(4b6ab6bb). The direction I suggested above doesn't fit as-is:PrepareShaderbuilds one program per source code (Recompiler.cpp,findOrCompileVariant). Variants change specialization constants, push data and bindings, but never the program. Here the program depends on the callee, and its address is only known fromrequest.context.userDataat dispatch.A version that works with the current design would probably need these pieces:
s_mov s14, s4/s_mov s15, s5thens_swappc_b64 s[14:15], s[14:15]) and defer the shader instead of throwing.GraphBuilderthen handles it as an ordinary static call region. Keying the source on that combined code makes the cache follow the callee by itself.ShaderRegistry(InvocationFor), route such shaders to the dispatch-time path, the way unregistered compute shaders already are.This touches the prepared-shader flow in the driver, not just the recompiler. So I'd rather hear whether this shape is acceptable, or whether there is a preferred way, before writing it.
Analysis by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T20:31:19Z.
Same stop on a second title, which makes this a regression on
main.Astro Bot (PPSA21567 v01.019.000, retail), current
main4b6ab6bb, same machine. No frame is presented, and the run ends with:The program counter (0x74) is the same as in Ghost of Yōtei, so this is probably the same SDK-generated compute shader in both titles.
Yesterday's builds (
main6b573862+ #759) took Astro Bot through boot, the title screen and into the intro cutscene. Those builds predatec48e0197, which now decodess_swappc_b64instead of treating it ass_setpc_b64. So since that commit, Astro Bot stops before its first frame onmain.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T20:35:06Z.
Correction to my previous comment:
c48e0197is not where this started. I built the commits around it and #639 and ran Astro Bot (PPSA21567) on each, with the same scripted input, headless, 240 s:main2b297842(just before #639)compute shader 0x5005f6100: AGC driver: guest memory is not readable at 0x30(the null-SRT read that #759 handles)main23941235(#639 merged)unsupported SOP1 opcode 33, raised while shaders are prepared, with nocompute shader 0x…prefixmain6b56175a(just before #1217)unsupported SOP1 opcode 33main4b6ab6bb(current)computed/data-dependent s_swappc_b64 call target at program counter 0x00000074 is not statically resolvableYesterday's build that reached the intro cutscene was
main6b573862+ #759, which predates #639.So the
s_swappc_b64compute shader was already unsupported before #1217, but it was only built when dispatched, and in my runs that came after the title screen. Since #639 prepares registered shaders up front, the shader now fails at boot. #1217 only changed the message.That suggests a smaller first step than the call-inlining work above: a shader that cannot be prepared could be deferred instead of ending the run, and fail only if it is actually dispatched. #639's own path for unregistered compute shaders already prepares at dispatch.
Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T21:09:19Z.
The deferral suggested above is now #1836. With it, Astro Bot on
maingets past its 132 unpreparable shaders. The next stop was a separate header-copy check, now #1837. After both, it stops on #1789. Thes_swappc_b64call itself stays unimplemented: a shader that really dispatches it still fails, now at dispatch time.Written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T23:33:57Z.
Confirmation from a run, plus what it takes to reach this wall.
Reproduced with PPSA26344 (Ghost of Yōtei 01.008), decrypted
eboot.binrelinked, staged runtime layout, RTX 3080 Ti, Linux:One thing worth recording for whoever picks this up: the title only reaches this wall with #757 applied (image/sampler tables at runtime offsets). On
mainalone it dies earlier, at presentation, withGetImageResource dword 0 is not a valid runtime value— so #757 is a prerequisite for reproducing this, and this issue is the second of two consecutive walls rather than the first.Also worth noting: the title had already compiled 53 shaders (17.4 MiB written to the shader disk cache) before this abort, so the failure is a specific compute shader whose call target comes from user data — not a general shader-preparation failure.
Log kept. Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T23:45:16Z.
Follow-up from the same title run — good news and the honest limit.
With #1836 applied (on top of #757), PPSA26344 no longer aborts on this: the shaders whose call target is data-dependent are deferred and the title keeps running (29 threads, ~100% CPU, GPU active two minutes in, no
terminate).So the deferral takes the abort out of the way — but it does not implement the missing capability: those 20 shaders are still unprepared when the title first needs them. This issue stays open on its own merits; #1836 only removes the startup crash, and the first use of one of these shaders is presumably where the next symptom will appear.
Runs measured on
main+ #757 + #1836, RTX 3080 Ti, Linux. Log kept. Written with AI assistance.Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-09T06:49:53Z.
A third title hits this: Disney Epic Mickey: Rebrushed (PPSA15657 v01.000.000, retail, UE4). It fails with the same message at program counter
0x74. Measured on RX 7600 (gfx1102), Linux, withmainf1451396plus a local stack of open import PRs.Same shader shape, with a detail that matters for the inlining design. The whole program at
0x74is a compute AABB reduction. It makes four calls, all through the same link pair, to two different user-data targets:So appending one callee as a single static call region is not enough by itself:
analyzeSwappcCallsrejects a link register shared by several calls ("link register s[14] is shared with another call").s[8:9]callee is called from three places.Either each call site gets its own copy of its callee, or the return has to pick the right call site.
s[16:17](the upper half of the user-data quad) is also set before each call, so the callees probably read a buffer descriptor froms[16:19].With #1836 (conflict in
ShaderRegistry.cppresolved locally):0x40to0xd8. So it's a family of SDK-generated shaders, not one.Happy to test an implementation on this title. Raw words of the
0x74program are available if useful.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T06:25:44Z.
#1836 is merged: a shader whose
s_swappc_b64target is computed is now prepared at its first dispatch instead of failing at registration. Could you retest on current main?Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-10T08:05:34Z.
Retested on
maina29bae31(Linux, GCC, Release, RX 9070 XT, RADV / Mesa 26.2.4, headless gamescope, cold shader cache): the registration stop is gone in both titles I have.its s_swappc_b64 at program counter … calls a computed target, and start-up continues. About 12 s in it stops onunsupported scalar source operand code 235 at program counter 856, which is #1920 (fixed by #1940, still open).shader image heap capacity exceeded, which is #1789.In neither run is one of the deferred shaders dispatched before that next stop. So these runs don't exercise the call itself, which stays unimplemented on
main(#2302 resolves user-data targets). Closing this one, since its stop is gone. If a deferred shader is dispatched later and fails, I'll open a new issue with that log line.Tested and written by Claude (AI assistant) on a contributor's machine.