Recompiler: a deferred compute shader is dispatched and aborts: s_swappc_b64 through a per-lane function table (Ratchet & Clank: Rift Apart) #3274
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 Tamalero on 2026-10-11T04:49:14Z.
This is the follow-up @EdouardSence mentioned in #1817: a shader deferred by #1836 that a title actually dispatches. In Ratchet & Clank: Rift Apart, 98 shaders are deferred with "calls a computed target". Once the title gets far enough (frame ~437, see #3272), one of them is dispatched and the run aborts:
The call is not a user-data target like #1817 or #2302. It is a function table: each lane reads a 16-byte record from a buffer, takes the 64-bit code address in it, and calls it in a waterfall loop, one group of lanes per distinct entry. This works like a ray-tracing shader binding table or a material function table: the code that runs is chosen per lane at run time. That is the "arbitrary indirect calls" entry in TechnicalDebt.md, so I am filing it as data for that design rather than proposing a patch.
Details
Title: Ratchet & Clank: Rift Apart (PPSA01474, content 01.005.003)
Where it stops: frame ~437, 1 of 1 runs with
APS5_EAGER_WRITEBACK=1. Without it the title instead freezes at frame 456 (#3272) and never dispatches this shader. AnyPS5f1ae427bplus local patches (listed in #3272). CachyOS, RTX 4090, driver 615.78.The call site (described, not the game's code)
The shader is 0x5980 bytes and has one computed call. The block before it does this:
s_getpcplus a constant, not a user-data pair, and not a code-resident jump table.s[14:15]), and the call returns with the callee'ss_setpc_b64.s_call_b64at 0x8ec, 0x4168 and 0x416c that share the link pairs[64:65]. Those may hit the one-call-per-link-pair limit once this one is handled.What I don't know
APS5_TRACE_DISPATCH_IO/user data for this dispatch if that helps choose between a per-dispatch callee set and a registered-callee switch.Related: #1817, #1836, #2062, #2749 (Stray, same message at many PCs), #2302 (closed: per-dispatch inlining).
Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T18:11:08Z.
The dispatch trace would be useful for deciding whether this can be implemented and tested safely. Could you share the
APS5_TRACE_DISPATCH_IOoutput or equivalent user-data dump for the failing dispatch, especially the function-table entries (target addresses) and which callees are registered or reached? That should clarify the call targets and give us a concrete regression case.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T20:02:08Z.
This blocker now has a merged fix: PR #4706 implements linking for table-loaded
s_swappc_b64targets, including the per-dispatch table callee set. The in-game follow-up on that PR reports Ratchet & Clank no longer aborts with this issue’scomputed/data-dependent s_swappc_b64error and reaches a later descriptor-materialization stop. That later stop is separate from the function-table call covered here. Based on that mainline run, #3274 appears resolved by #4706.