Repository navigation
fix(shader): link table calls whose descriptor comes from another buffer - #14296
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.
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.
|
✅ NVIDIA GPU test: passedPR head
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)Unstable on main (4, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (5 IDs in 481 tests)Skipped (45)ReproduceAutomated 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
left a comment
There was a problem hiding this comment.
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; baseb41526345185943c53af0c6eee97863df4389c9e. 6 files, +148/-3:ShaderRegistry.cpp(+5: the nested read inReadTableCallees),ControlFlow/src/GraphBuilder.cpp(+21/-3: the nested descriptor search inFindTableCalls),ControlFlow/include/ControlFlow/GraphBuilder.hpp(+1: anestedDescriptorOffsetfield),core/libs/tests/ScalarCall.cpp(+17:CheckNestedTableCall),tests/execution/ComputeNestedTableCall.cpp(+106, not read in full), anddocs/dev/debt/libSceAgcDriver.md(+1). - Read the production diffs in full. Checked the new bounds:
descriptor < innerLoadedis tested beforedescriptor - innerLoaded; the inner load's size and offset are checked; the outer pointer must be 4-dword aligned; the nested offset isinner.memoryOffset + (descriptor - innerLoaded) * 4; andReadTableCalleeschecks 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,sameBlockand the execution test. The analysis is not traced beyond the lines in the diff. - Hosted:
Build,windowsand bothrelinkerjobs passed. The Windows CTest run reports one case (100% tests passed, 0 tests failed out of 1), soCheckNestedTableCalland 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.
CheckNestedTableCallandComputeNestedTableCalldid not run on Windows, and this head has no Linux run. A run of theScalarCalltest (which callsCheckNestedTableCall) 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
- Registry: https://github.com/boykopovar/AnyPS5/blob/46dc30ea75b06c5f56ba5486c0119d53c7996181/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
- Graph builder: https://github.com/boykopovar/AnyPS5/blob/46dc30ea75b06c5f56ba5486c0119d53c7996181/core/shader/recompiler/ControlFlow/src/GraphBuilder.cpp
- Scalar unit check: https://github.com/boykopovar/AnyPS5/blob/46dc30ea75b06c5f56ba5486c0119d53c7996181/core/libs/tests/ScalarCall.cpp
- Debt entry: https://github.com/boykopovar/AnyPS5/blob/46dc30ea75b06c5f56ba5486c0119d53c7996181/docs/dev/debt/libSceAgcDriver.md
- Windows job log: check-run
windowson 46dc30e
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.
|
Shows the fix on RDNA 4 with AMD's Windows driver: Windows 11 Pro 10.0.22631, AMD Radeon RX 9070 XT (driver 32.0.32015.7029), MSYS2 UCRT64 g++ 16.1.0, Release,
AI-assisted: yes (Claude Code) |
|
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 ( Commits: head
New test:
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 |
|
I read the dump from #14168 (
I haven't run this PR; this is a static read of the dump only. AI-assisted: yes (Claude Code) |
|
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
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, AI-assisted (Claude Code); the stops above are the |
|
A Linux/NVIDIA confirmation for Marvel's Spider-Man Remastered (PPSA01467, 01.008.001) on current
The PR now conflicts with
Details
Tested and written by Claude (AI assistant) on a contributor's machine. |
|
Thanks @Tamalero for the Linux/NVIDIA confirmation, which matches the Windows stop, and for working out the conflict with #15478. I'll rebase onto AI-assisted: yes (Claude Code) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
What
FindTableCallslinks a compute shader'ss_swappc_b64when its target comes from a call table, but only when the table's descriptor is loaded through a pointer withs_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):FindTableCallsnow follows that one extra level and records its offset inTableCall::nestedDescriptorOffset. The nested load needs an immediate, dword-aligned offset and no register offset; anything else stays refused as before.ReadTableCalleesreads 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 throughctest -Vfrom 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.VUID-lines, both sidesagc_driver_compute_nested_table_callfailsagc_driver_compute_nested_table_callfailsThese ran before a final rebase onto current
main. After the rebase I reran the same five tests withANYPS5_REQUIRE_VULKAN=1on 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-signedeboot.binwith the game's own data. A script pressed the buttons and nobody played. The only library swapped islibSceAgcDriver.prx.computed/data-dependent s_swappc_b64 call target at program counter 0x0000136c is not statically resolvableread-write alias of shared guest memory 0xb126960000+0x40000: a resident run of direct memory extends outside the rangeGetImageResource dword 0 is not a valid runtime valueThe
s_swappc_b64refusal 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
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.mdfiles or images added to the repository (attach them to this PR)#8140 changes the same call-linking code (
FindTableCalls,LinkCallsandShaderRegistry.cpp) for a different refusal, a callee that reads its program counter. Whichever lands second will need a small merge.🤖 Generated with Claude Code