Skip to content

fix(shader): link table calls whose descriptor comes from another buffer - #14296

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
ycbuzi:fix/shader-nested-call-table
Nov 14, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
ycbuzi:fix/shader-nested-call-table

Conversation

@ycbuzi

@ycbuzi ycbuzi commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

What

FindTableCalls links a compute shader's s_swappc_b64 when its target comes from a call table, but only when the table's descriptor is loaded through a pointer with s_load_dword*. Marvel's Spider-Man Remastered (PPSA01467) loads that descriptor one level deeper, from another buffer, so the call stayed unlinked and the shader was refused (#14168):

s_load_dwordx4        s8,  s[12:13], 0x220   (descriptor A, through the pointer)
s_buffer_load_dwordx4 s72, s[8:11],  0x40    (descriptor B, from A's buffer)
s_lshl_b32            vcc_lo, s8, 4
s_buffer_load_dwordx4 s8,  s[72:75], vcc_lo  (the record)
s_swappc_b64          s[14:15], s[14:15]
  • FindTableCalls now follows that one extra level and records its offset in TableCall::nestedDescriptorOffset. The nested load needs an immediate, dword-aligned offset and no register offset; anything else stays refused as before.
  • ReadTableCallees reads descriptor A, checks that the offset fits inside A's buffer, and reads descriptor B from it. The rest of the linking is unchanged.

The limits are in docs/dev/debt/libSceAgcDriver.md: one level only, and the descriptor is read once at link time.

This is not a full fix for the title. It moves past this stop to later ones, listed under Tested.

Tested

Windows 11, Ryzen 9 7900, Release, WinLibs GCC 15.2.0.

Tests on the commit before this PR and on this PR, same machine, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, run through ctest -V from a non-elevated process. A control test (agc_driver_vertex_fetch) proved the layer loaded on both sides (43 layer log lines), and no log has the missing-layer line.

Tests: agc_driver_compute_fs_table_calls, agc_driver_compute_table_calls, agc_driver_compute_nested_table_call, agc_driver_prepared_shaders, scalar_call. The new execution test was kept on the base side as a negative control.

GPU Base, without the source change This PR VUID- lines, both sides
NVIDIA RTX 4070 SUPER 4 of 5 pass; agc_driver_compute_nested_table_call fails 5 of 5 pass 0
AMD Radeon iGPU 4 of 5 pass; agc_driver_compute_nested_table_call fails 5 of 5 pass 0

These ran before a final rebase onto current main. After the rebase I reran the same five tests with ANYPS5_REQUIRE_VULKAN=1 on the 4070 only, without the layer, and they pass.

Marvel's Spider-Man Remastered (PPSA01467, 01.008.001), RTX 4070 SUPER, NVIDIA 616.92, APS5_PLAYGO_UNLISTED_CHUNKS=installed, a backport's fake-signed eboot.bin with the game's own data. A script pressed the buttons and nobody played. The only library swapped is libSceAgcDriver.prx.

Run End Frames
Without this PR 60 s: computed/data-dependent s_swappc_b64 call target at program counter 0x0000136c is not statically resolvable 6
This PR, first run 180 s: read-write alias of shared guest memory 0xb126960000+0x40000: a resident run of direct memory extends outside the range 176
This PR, second run 60 s: GetImageResource dword 0 is not a valid runtime value 16

The s_swappc_b64 refusal does not appear in either run with this PR, and it was logged in every earlier run without it. Those two later stops are different from each other, and I have not looked into either. I did not check the picture, and the frame rate is still under 4 FPS.

The game's table contents were not inspected beyond linking succeeding, and no other title with this shape was tested.

Checklist

#8140 changes the same call-linking code (FindTableCalls, LinkCalls and ShaderRegistry.cpp) for a different refusal, a callee that reads its program counter. Whichever lands second will need a small merge.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 18139 core/shader/recompiler/ControlFlow/src/GraphBuilder.cpp L1636

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6186 docs/dev/debt/libSceAgcDriver.md
PR 6188 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6804 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7682 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 8592 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9335 docs/dev/debt/libSceAgcDriver.md
PR 9356 docs/dev/debt/libSceAgcDriver.md
PR 9387 docs/dev/debt/libSceAgcDriver.md
PR 9895 docs/dev/debt/libSceAgcDriver.md
PR 9950 docs/dev/debt/libSceAgcDriver.md
PR 10049 docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10359 docs/dev/debt/libSceAgcDriver.md
PR 11442 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 11551 docs/dev/debt/libSceAgcDriver.md
PR 11825 docs/dev/debt/libSceAgcDriver.md
PR 12904 docs/dev/debt/libSceAgcDriver.md
PR 13928 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13929 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
docs/dev/debt/libSceAgcDriver.md
PR 14944 docs/dev/debt/libSceAgcDriver.md
PR 15456 docs/dev/debt/libSceAgcDriver.md
PR 15548 docs/dev/debt/libSceAgcDriver.md
PR 15621 docs/dev/debt/libSceAgcDriver.md
PR 17056 docs/dev/debt/libSceAgcDriver.md
PR 17611 docs/dev/debt/libSceAgcDriver.md
PR 17796 docs/dev/debt/libSceAgcDriver.md
PR 18029 docs/dev/debt/libSceAgcDriver.md
PR 18390 docs/dev/debt/libSceAgcDriver.md
PR 18515 docs/dev/debt/libSceAgcDriver.md

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 46dc30e merged onto main e6f5730 · tested 2026-11-01 15:01 UTC · 21 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,430 passed · 7 failed (0 new, 3 also fail on main, 4 unstable on main) · 45 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,482 of 3,148 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (932 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.0 s, ⚠️ agc_driver_lookup_log_fits_build 88.8 s
Intermittent validation messages (1, seen once in the parallel run, not reproduced when the test was re-run alone 2 times; not counted against this PR)
agc_driver_depth_clear_hle: VUID-vkCmdCopyBuffer-commonparent (6x)
Unstable on main (4, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_depth_clear_hle: failed in 2 of the last 10 main runs
agc_driver_pipeline_journal: failed in 1 of the last 10 main runs
agc_submit_progress: failed in 6 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 8 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validated but not compared (1, not in the main baseline's validation pass)
agc_driver_compute_nested_table_call
Validation IDs already present on main (5 IDs in 481 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (481 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 473 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
VUID-VkShaderModuleCreateInfo-pCode-08737 (1 test): agc_driver_image_sample_derivatives
Skipped (45)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fps_limit: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_o
Reproduce
git fetch origin 46dc30ea75b06c5f56ba5486c0119d53c7996181 e6f57307fa7f47165d7fc1bee945abdb2f6816e7
git checkout e6f57307fa7f47165d7fc1bee945abdb2f6816e7 && git merge --no-ff 46dc30ea75b06c5f56ba5486c0119d53c7996181
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

Table calls whose descriptor is loaded from a buffer, which itself came through the table pointer, are now followed one level: the recompiler's FindTableCalls records a nested descriptor offset, and ReadTableCallees reads the nested descriptor once at link time. The bounds checks I read come before each read. The new unit check and the execution test did not run on this head, so the behaviour is not verified by any run.

What I ran

  • Head 46dc30ea75b06c5f56ba5486c0119d53c7996181; base b41526345185943c53af0c6eee97863df4389c9e. 6 files, +148/-3: ShaderRegistry.cpp (+5: the nested read in ReadTableCallees), ControlFlow/src/GraphBuilder.cpp (+21/-3: the nested descriptor search in FindTableCalls), ControlFlow/include/ControlFlow/GraphBuilder.hpp (+1: a nestedDescriptorOffset field), core/libs/tests/ScalarCall.cpp (+17: CheckNestedTableCall), tests/execution/ComputeNestedTableCall.cpp (+106, not read in full), and docs/dev/debt/libSceAgcDriver.md (+1).
  • Read the production diffs in full. Checked the new bounds: descriptor < innerLoaded is tested before descriptor - innerLoaded; the inner load's size and offset are checked; the outer pointer must be 4-dword aligned; the nested offset is inner.memoryOffset + (descriptor - innerLoaded) * 4; and ReadTableCallees checks that offset against the outer descriptor's size before it reads.
  • Read the new scalar unit check (CheckNestedTableCall) and the debt entry.
  • Not read: findLastWriter, reachingWriter, sameBlock and the execution test. The analysis is not traced beyond the lines in the diff.
  • Hosted: Build, windows and both relinker jobs passed. The Windows CTest run reports one case (100% tests passed, 0 tests failed out of 1), so CheckNestedTableCall and the execution test did not run.
  • Read-only checks from the trusted main checkout: diff check, conventions and PR template, and the stack check all passed. The ABI audit is not applicable.
  • No MarcZX10 review at this head.

Results

Check Result Note
Diff check passed
Conventions and PR template passed conventions check from the main checkout
Mergeability and dependencies passed stack check passed; no declared dependencies
Bounds of the inner load and the outer pointer (read) passed by reading checked before each read or index
Nested descriptor offset and its read in ReadTableCallees (read) passed by reading the offset is checked against the outer descriptor's size
The analysis helpers (findLastWriter, reachingWriter, sameBlock) not verified not read; the nested path relies on them
CheckNestedTableCall (scalar unit check) not run the Windows CTest run reports one case
ComputeNestedTableCall (execution test) not run not in the Windows execution list; not read in full
ABI audit not applicable no export changed
Build and runtime tests (Linux) not run Linux is skipped on pull requests
Negative controls not run no local build
Hosted CI passed (build) Build, windows (one case), both relinker jobs, Conventions, PR intake, PR labels, Progress report and the Emscripten portability job succeeded
Read-only check output

Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: not applicable. Stack check: passed. Hosted: gh api repos/boykopovar/AnyPS5/commits/46dc30ea75b06c5f56ba5486c0119d53c7996181/check-runs, and the Windows job log.

Negative control

Not run here. A negative control needs a local build and run, and code from this head is not run here.

Findings

Blocking

None, as far as the code read here goes.

Non-blocking

  • No run covers the nested path. CheckNestedTableCall and ComputeNestedTableCall did not run on Windows, and this head has no Linux run. A run of the ScalarCall test (which calls CheckNestedTableCall) and of the execution test on a GPU host would show whether the path works.
  • The debt entry says a deeper chain is refused as not statically resolvable. That claim depends on the analysis helpers, which were not read here.

Sources

Not verified

  • The analysis helpers (findLastWriter, reachingWriter, sameBlock) and whether the nested search is sound on every path.
  • The execution test ComputeNestedTableCall (not read in full).
  • Any run of the nested path.

To get this to a good state

  • Run the scalar unit check and the execution test on a host that runs them, and post the result.

@bunbeans2-arch

Copy link
Copy Markdown
Contributor

Shows the fix on RDNA 4 with AMD's Windows driver: agc_driver_compute_nested_table_call fails 5 of 5 without this PR's source changes and passes 5 of 5 with them, on an RX 9070 XT ✅

Windows 11 Pro 10.0.22631, AMD Radeon RX 9070 XT (driver 32.0.32015.7029), MSYS2 UCRT64 g++ 16.1.0, Release, 46dc30ea75 merged onto main 4569fe654a. ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.

  • With the PR: agc_driver_compute_nested_table_call and scalar_call passed 5 of 5, with no VUID- line.
  • With the PR's tests but its 3 source files (GraphBuilder.hpp, GraphBuilder.cpp, ShaderRegistry.cpp) put back to main: agc_driver_compute_nested_table_call failed 5 of 5 with computed/data-dependent s_swappc_b64 call target at program counter 0x00000040 is not statically resolvable. Only that test was built for this side, because the updated ScalarCall.cpp needs the PR's new TableCall member.
  • The loader logs Insert instance layer "VK_LAYER_KHRONOS_validation" in every run of agc_driver_compute_nested_table_call. scalar_call never opens a Vulkan device here, so it runs on the CPU only.

AI-assisted: yes (Claude Code)

@crastinator

Copy link
Copy Markdown

AMD RDNA 2 on RADV, which the Tested section and the later runs here don't cover (NVIDIA, and AMD on Windows). No regression, and the fix does what it says on this GPU.

Setup: RX 6700 XT (1002:73df, NAVI22), Mesa 26.2.5 (RADV), Linux 7.3.1 (CachyOS), GCC 16.2.1, Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON, VK_LAYER_KHRONOS_validation 1.4.363. VK_LOADER_DEBUG=layer shows the layer inserted on a run of agc_driver_compute_nested_table_call, and the log shows this GPU selected.

Commits: head 46dc30ea75 merged locally onto main a4eca2a056 (merge 92cd4e3f1a, clean), against main a4eca2a056.

tools/vulkan_validation_gate.py, exit 0, 3 iterations per side, 11 tests: agc_driver_compute_fs_table_calls, agc_driver_compute_table_calls, agc_driver_compute_user_data_calls, agc_driver_compute_user_data_calls_registered, agc_driver_compute_pipeline_outside_gpu_mutex, agc_driver_compute_prebuild_share, agc_driver_prepared_shaders, agc_driver_vertex_fetch, agc_shader_disk_cache, guest_shader_link, scalar_call. All pass on both sides, with no new VUID or sync-hazard IDs. Neither side reported any.

New test: agc_driver_compute_nested_table_call isn't on main, so the gate can't compare it. It ran separately with the same environment.

  • At the merge it passes 3 of 3, with no VUID- lines.
  • main with only this PR's ComputeNestedTableCall.cpp fails 3 of 3:
ShaderRecompiler::Recompile: computed/data-dependent s_swappc_b64 call target at program counter 0x00000040 is not statically resolvable

Not tested: Marvel's Spider-Man Remastered or any other title, and Windows. Synchronization validation wasn't turned on, so these runs can't rule out sync hazards.

AI-assisted: yes

@zaryabzip

Copy link
Copy Markdown
Contributor

I read the dump from #14168 (shader_115299f500_failed.req.code, the .req SHA-256 starting 2b86a52b248fdd80) against this diff. The title's chain is the shape the new branch in FindTableCalls accepts. I walked the 0x277c-byte program's instruction lengths, and they land on the issue's listed offsets.

PC Words Instruction
0x127c f4080206 fa000220 s_load_dwordx4 s[8:11], s[12:13], 0x220
0x12ac f4281204 fa000040 s_buffer_load_dwordx4 s[72:75], s[8:11], 0x40
0x1348 8f6a8408 s_lshl_b32 vcc_lo, s8, 4
0x1350 f4280224 d4000000 s_buffer_load_dwordx4 s[8:11], s[72:75], vcc_lo
0x136c be8e210e s_swappc_b64 s[14:15], s[14:15]
  • The nested load at 0x12ac has an immediate, dword-aligned offset and soffset null (0x7d). So nestedDescriptorOffset is 0x40, and the outer descriptorOffset is 0x220.
  • Nothing in the program writes s12 or s13, so the pointer is the unchanged user-data pair.
  • 0x12ac is the only writer of s[72:75] that reaches the waterfall loop. The 0x5d0–0x5e0 writes come earlier, and 0x12ac overwrites them.

I haven't run this PR; this is a static read of the dump only.

AI-assisted: yes (Claude Code)

@ycbuzi

ycbuzi commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @bunbeans2-arch and @crastinator for the RDNA 4 / Windows and RDNA 2 / RADV runs, @MarcZX10 for the review, and @zaryabzip for reading the #14168 dump against this diff. Sorry it took me days to answer.

Marvel's Spider-Man Remastered (PPSA01467), the title in #14168, gets past the stop with this PR. Same machine, game folder and main, one run each, nobody playing:

Stop Run
main b11c7bf84f computed/data-dependent s_swappc_b64 call target at program counter 0x0000136c is not statically resolvable aborted after 124 s, 130 frames
46dc30ea75 merged onto b11c7bf84f (= 23fc217391), libSceAgcDriver.prx swapped in no s_swappc_b64 message; it stops later in another compute shader: GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x000156a0(GetBufferResource(ReadConstBuffer@pc=0x00015624(...LoadAddressU32@pc=0x00015614(GetAddressResource(Phi(Phi(ReadConstBuffer@pc=0x00005df8, ... aborted after 175 s, 178 frames

The new stop is a T# read through a pointer chain with a Phi, the shape of #6191 and #7459, not something this PR changes. Windows 11, Ryzen 9 7900, RTX 4070 SUPER (NVIDIA 616.92), WinLibs GCC 15.2.0, Release, APS5_PLAYGO_UNLISTED_CHUNKS=installed.

AI-assisted (Claude Code); the stops above are the what() lines from the two runs' anyps5.log.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@Tamalero

Tamalero commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

A Linux/NVIDIA confirmation for Marvel's Spider-Man Remastered (PPSA01467, 01.008.001) on current main: this PR gets it past the s_swappc_b64 stop from #14168, and it then stops on the same pointer-chain T# @ycbuzi found on Windows.

Build Stop
main 58da5de7af + #9749 52 s, 34 frames: computed/data-dependent s_swappc_b64 call target at program counter 0x0000136c is not statically resolvable
main 210676ad86 + #9749 + this PR 89 s, 48 frames: GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x000156a0(GetBufferResource(ReadConstBuffer@pc=0x00015624(GetBufferResource(LoadAddressU32@pc=0x00015614(GetAddressResource(Phi(…

The PR now conflicts with main because #15478 changed the same code. My resolution, in case it helps the rebase:

  • TableCall keeps both new fields: feat(shader): link a table call through a user-data buffer descriptor #15478's bool descriptorInUserData and this PR's std::optional<std::uint32_t> nestedDescriptorOffset, in that order.
  • ReadTableCallees reads the descriptor from user data or through the pointer, as main does now, and then applies the nested step to whichever descriptor it got.
  • In FindTableCalls this PR's calls.push_back({…, stride, constantPointer, nestedDescriptorOffset}) fills the struct by position, so with feat(shader): link a table call through a user-data buffer descriptor #15478's field in between it needs …, constantPointer, false, nestedDescriptorOffset}. Otherwise the optional lands in the bool and the build fails.
  • scalar_call passes with both CheckUserDataDescriptorTableCall and CheckNestedTableCall.
Details

Tested and written by Claude (AI assistant) on a contributor's machine.

@ycbuzi

ycbuzi commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @Tamalero for the Linux/NVIDIA confirmation, which matches the Windows stop, and for working out the conflict with #15478. I'll rebase onto main along those lines (both fields kept, the nested step applied to whichever descriptor ReadTableCallees got, and the positional push_back fixed) and push it here.

AI-assisted: yes (Claude Code)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 8, 2026
@oneandonlydean
oneandonlydean merged commit ca333e1 into boykopovar:main Nov 14, 2026
15 checks passed
liskeee added a commit to liskeee/AnyPS5 that referenced this pull request Nov 14, 2026
Merge origin/main 7b49bad into
fix/agc-linked-code-deps.

Conflicts resolved:
- Execution/include/Driver/Shaders/ShaderRegistry.hpp: keep the linking
  out-parameter of InvocationFor and CaptureInvocation, add main's
  StageLinksUserDataCallees declaration.
- Execution/src/Driver/Shaders/ShaderRegistry.cpp: keep the UserDataLink
  dependency methods and the InvocationFor signature, add main's
  StageLinksUserDataCallees next to them.
- docs/dev/debt/libSceAgcDriver.md: main's entries, without the two
  sentences on callees and table rows not being re-read on a dispatch-cache
  hit, which this branch fixes.

Adaptations to main:
- ShaderRegistry.cpp, ReadTableCallees: the nested call table descriptor
  read added by boykopovar#14296 passes the dependency list. ReadGuestBytes takes it
  as a required argument on this branch, so main's call does not compile
  without it, and the read is recorded as a linking dependency like the
  first-level descriptor.
- docs/dev/debt/libSceAgcDriver.md, nested table descriptors: drop the
  clause that a descriptor changed later is not seen.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs fix error Closes an issue (Fixes #N) shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Marvel's Spider-Man Remastered (PPSA01467): a compute shader's waterfall call through a 16-byte table record is not statically resolvable

8 participants