fix(shader): follow a table call's descriptor through a v_writelane/v_readlane spill #24232
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24232"
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 almarzn on 2026-11-20T11:29:29Z.
What
FindTableCallstraced a table call's buffer descriptor back only through scalar writes. When the shader compiler spilled the descriptor to VGPR lanes and restored it withv_readlane_b32before the call, the call stayed unresolved and the program was refused withcomputed/data-dependent s_swappc_b64 call target ... is not statically resolvable.With this change, when the descriptor's writer is a
v_readlane_b32,FindTableCallsfollows each of the four registers back to thev_writelane_b32that saved it. From there it continues to the scalar load that produced the value, and the rest of the table-call checks run unchanged from that load. It gives up whenever any of these holds:v_writelane_b32reaches a restore;v_movrel*/v_swaprel, or a VALU or memory destination whose width covers the register; the memory width includes a TFE dword);The backward walk of
reachingWriterbecomesreachingDefinition, a template that takes the definition test;reachingWriterkeeps its behaviour on top of it.The shape, from PPSA24913 (Ace Combat 8, UE5), compute shader with 5220 code words, wave32,
APS5_DUMP_SHADERS=1:The program has four such calls (0x91c, 0xe64, 0x2114, 0x2608);
FindTableCallsnow returns all four as 16-byte table calls through user datas[0:1].A second shader of the same title (4664 code words, table calls at 0x8c0, 0x1490 and 0x17e8) was refused on
mainat 0x1490, where the descriptor is spilled the same way. With this changeFindTableCallsfinds all three calls, and in a later PPSA24913 run the shader was prepared and dumped as an ordinary request with no skipped dispatch.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, on
mainatc8eb2aac70.scalar_call_tests: a new case adds a lane spill to the hoisted waterfall shape, for wave32 and wave64. It now finds the call, links it and translates it. Two variants are still refused, both byFindTableCallsand byGraphBuilder(not statically resolvable): restoring from other lanes, and av_mov_b32to the spill VGPR inside the loop. Negative control: withGraphBuilder.cppfrommainthe test fails (scalar call regression).ctest -R "scalar_call|agc_linked_code|table_call"withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1: 47/47 pass. Before the rebase I built three GPU execution tests with-DANYPS5_AGC_EXECUTION_TESTS=ComputeTableCalls;ComputeNestedTableCall;ComputeFsTableCalls; they are among the 47.Validation layer: the LunarG SDK installer needs elevation, which was not available on this machine. I used
VkLayer_khronos_validationbuilt from Vulkan-ValidationLayersvulkan-sdk-1.4.363.1with the same MinGW toolchain, loaded throughVK_ADD_LAYER_PATH. I ranscalar_call|agc_linked_code|agc_shader_memory|agc_driver_compute_fs_table_calls|agc_driver_compute_nested_table_call|agc_driver_compute_table_callswithANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layeronmain(e825fa1492) and on this change. In both logs:Insert instance layer "VK_LAYER_KHRONOS_validation");was not found but was requested by env var VK_INSTANCE_LAYERS;VUID-lines;unhandled exception 0xc0000005.The three pass on both without the layer, so I read the crash as coming from this MinGW build of the layer, not from the change. A run with an MSVC-built or SDK layer would settle it; I could not do one here.
python3 tools/check_conventions.py --base origin/main: passes.PPSA24913 (relinked with
--to-intel, Intel i5-12600KF), withAPS5_SKIP_REFUSED_DISPATCHES=1:main(0626a8334f), the run logged a skipped dispatch for this shader at program counter 0x91c and one for the 0x1490 shader.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-20T11:39:47Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
3f7058bf1ee2100b50a3a59223197e61f97af4fbusing the prepared diff andrepo_read.pyfor targeted source ranges. I did not run tests or builds; the test results in the PR description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
core/libs/tests/ScalarCall.cpp(changed lines 516–548, 670) andcore/shader/recompiler/ControlFlow/src/GraphBuilder.cpp(changed code and relevant helpers/call site).manifest.jsonlists both changed files as included, and the review file listing confirms both are available.To get this to a good state
Nothing is required.