feat(shader): split and continue table calls that cannot be linked #22359
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22359"
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 Remi-Bon on 2026-11-17T12:47:50Z.
What
A compute shader that calls through a table is linked today by copying every callee at the call site. That fails for two kinds of program in PPSA01317 (Gran Turismo 7):
The second case makes the game lose the device. The skipped dispatch, material writer 0x120aed7f00, leaves its classifier records zero. A counter program then writes 1.41 M threads into an indirect argument slot, and the waterfall dispatch 0x120aea4f00 that reads it never converges. In the photo scenes the game shows after a few minutes idle on the world map, the image freezes, then Windows resets the GPU (TDR) and the game ends.
With
APS5_SPLIT_TABLE_CALLS, such a program runs as several compute pipelines instead:SplitTableCall,BuildSplitTableCallPrograms), for a call in an LLVM-style waterfall loop. An entry part runs to the end of the loop and saves each lane's target and registers instead of calling. One part per callee replays the loop with only that callee linked. A resume part reloads the end state and runs the rest.ContinueTableCall,BuildTableCallContinuation), for a call in any other loop that no branch enters from before it. The entry part stops each wave at the call and stores its target. Callee parts replay the code before the loop, reload the saved state, run the callee and save again. The driver repeats rounds until no lane calls, at most 2^12 rounds.SplitStatefault instead of running on (new IR opSplitStateGuard).SplitStateAbi. Dispatches run in slices ofAPS5_SPLIT_STATE_LANESlanes (default 2^18). An indirect dispatch runsAPS5_SPLIT_SLICESslices (default 8), with counts copied from the GPU argument buffer.A program that qualifies for neither path keeps the linked path. Without the variable nothing changes. Limits are listed under Split table calls and Continued table calls in
docs/dev/debt/libSceAgcDriver.md.Known limits:
Tested
Windows 11 Pro 26300, RX 9070.
scalar_call: split and continuation structure, IR and refusals.agc_split_table_call_tests: full recompilation of every part, with SPIR-V validated.agc_driver_split_table_call_run: a wave32 waterfall with 3 callees, run linked, split direct with slices, and split indirect including an empty slice.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer,ctest -R "^(agc_driver_(dispatch|indirect|compute|table|user_data|storage_flush)[a-z_]*|agc_driver_split_table_call_run|scalar_call)$" -V: main 35/35 passed (noagc_driver_split_table_call_runthere); this PR, rebased on main9504fbb964, 36/36 passed. Both logs show the loader insertingVK_LAYER_KHRONOS_validation, neither haswas not found but was requested, and neither has aVUID-error.main'sReadTableCalleesdependencies argument. Onmainalone the title stops before its menu (layered rendering with a depth target is unsupported, which #7256 handles), so it was not rerun on this branch. The material writer runs, the counter writes 0 groups, and the waterfall gets no lanes.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T10:14:50Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this review from a formal decision, but the review is incomplete because most changed files were not read.
What I ran
20c99cc94d89acbf2e3503d0090897bbc01764a6.Results
Findings
Blocking
None verified in the portions inspected.
Non-blocking
None.
Not verified
The review is incomplete. Only the description, commits, first 599 lines of the diff, and one line of the oversized
VulkanDevice.cppwere read. The remaining diff and most changed code were not inspected; therefore no conclusion about their correctness is supported. The description's test and game-run results are author-reported, not independently run. The prepared file listing indicates the changed file set, butreview/files.jsonwas unavailable through the reader.To get this to a good state
Complete inspection of the remaining changed code and run applicable checks before a formal review decision.