feat(agc): link calls through the AGC FS table #6160
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6160"
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 fma-rc on 2026-10-14T23:53:29Z.
What
1348 Ex Voto (PPSA24249) stops on current
main2559e9623when a compute shader calls through libSceAgc's FS table:The shader builds the constant address
0xF_E0040000with twos_mov_b32, loads slot 0 there as a V#, reads a call target at +0x20 and skips thes_swappc_b64when it is zero. Issue #6117 reports the same shape in MXGP 26 and asks what a console keeps at that address.On the PS5 12.00 modules, libSceAgc's init gets a block from libSceAgcDriver, aborts unless the table lands at
0xF_E0040000, zeroes six 16-byte slots, and makes slot 0 a V# (stride 16, eight records) over a buffer of eight {routine address, 0} records. This PR:0xF_E0000000once per process when the driver is created (MAP_FIXED_NOREPLACEon Linux, a commit inside the guest arena on Windows), fills the table that way and registers the block withGuestAllocations;s_setpc_b64 s[14:15]); Sony's routines are not modeled (TechnicalDebt);s_mov_b32of constants, and lets the writer search cross a conditional branch that jumps past the call (the null check).Refs #6117 (same call; its unaligned atomic stays open).
Tested
Linux, current
main2559e9623plus this PR:mainRebased onto
main452494439(2026-10-16):agc_driver_compute_fs_table_callspasses on RTX 5080 (NVIDIA 615.78.08), Radeon 610M (RADV) and lavapipe. Ex Voto, warm cache, 300 s:mainstops at 53.1 s with the sames_swappc_b64line; with this PR no stop, frame 851 at 300 s, on the title screen.With the PR and a warm cache, pressing Cross at the title screen reaches the main menu (Play / Options / Credits) with no stop in 390 s.
MXGP 26 (PPSA30839), tested by milescoviello on Linux (RTX 4070 Ti,
maind92a8dad3merged with d1a68c4ae, comment):mainstops at 135 s with the issue'ss_swappc_b64line; with this PR 2 of 2 runs reach the 180 s limit without it.Silent Hill: Townfall (PPSA33286), tested by tv7 on Windows (RTX 3070,
mainff23657f3merged with d1a68c4ae, comment):mainstops on thes_swappc_b64line in 3 of 3 runs after about 2.5 min; with this PR it appears in none of 5 runs and 4 of 5 reach the 900 s limit (the fifth hits a render-thread timeout tv7 has seen before without this PR).Hot Wheels Infinite Rush (PPSA22408), tested by mrfelek on Linux (RTX 3080 Ti,
main5d9dcc42dmerged with d1a68c4ae, comment):mainaborts on the sames_swappc_b64line at PC 0x134 after the boot screens; with this PR none of 3 runs shows it (one reaches the loading screen, one stops on a storage-image write-watch error also seen once without it, one runs out of device memory while storage images grow).agc_driver_compute_fs_table_calls(the Ex Voto shape: the marker store runs only after the call returns) andscalar_callfail withGraphBuilder.cppandLifecycle.cppfrommain(FS table at 0xfe0040000 is not mapped,scalar call regression; NVIDIA) and pass with the PR on NVIDIA RTX 5080 (615.78.08), RADV (Ryzen 7 7800X3D iGPU) and lavapipe. Windows (WinLibs GCC 15.2, VM): the full suite passes exceptguest_kernel_stack_protectandguest_kqueue, which fail the same way onmainthere.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)Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-15T06:57:47Z.
MXGP 26 (PPSA30839), the title in #6117, with this PR on Linux.
Setup: Ubuntu 24.04, GCC 13.3, Release, RTX 4070 Ti (NVIDIA 595.99),
maind92a8dad3merged with this headd1a68c4ae(clean merge), relinked with--to-intel, 180 s runs with pad input (a button every 1.5 s from 8 s).mainalone: stops at 135 s withcomputed/data-dependent s_swappc_b64 call target at program counter 0x00000134 is not statically resolvable, the #6117 shader.buffer_atomic_orfaults (BDA access failed: ... bytes=4 stage=4 reason=7) remain, 36 and 70 per run; #6094 is for those.6c188638a): 2 of 2 runs reach the limit with no BDA fault. A third run with screenshots goes through the publisher splash and the title screen to the "Welcome to MXGP26" account prompt; the FPS counter reads 0.2–0.5 there.Not checked on Windows.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:15:45Z.
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.
main)core/shader/recompiler/ControlFlow/src/GraphBuilder.cppL1454docs/dev/debt/libSceAgcDriver.mdL170core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppL139Some 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.
docs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/tests/ScalarCall.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/shader/recompiler/ControlFlow/src/GraphBuilder.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-15T16:31:50Z.
Silent Hill: Townfall (PPSA33286) on Windows, real hardware, before and after this PR, as promised on #4706.
Setup: Windows 11, WinLibs GCC 15.2, Release, RTX 3070 8 GB (NVIDIA), i7-11700KF. Before =
mainff23657f3. After = the samemainmerged with this head d1a68c4ae (clean merge). Same build directory,ANYPS5_NO_SHADER_CACHE=1, 900 s limit, no input.mainff23657f3main+ this PRBefore, every run ends with:
followed by
terminate/ SIGABRT. The shader address changes between runs (0x16402c0500, 0x16402c0000, 0x16402d0000), always program counter 0x134. With the PR,not statically resolvabledoes not appear in any of the 5 runs.The one failing run with the PR: after about 4.5 min a
WAIT_REG_MEM_64on queue 0x20 times out, thenGameThread timed out waiting for RenderThread after 120.00 secs(frame 462), then an access violation in libc while the title writes that error. I have seen the same render-thread timeout on this title before, on an older stack with #5176, and it did not come back in the other 4 runs, so I don't think it comes from this PR.The runs that reach 900 s log about 500-650
deferred write-back failed: BDA access failed ... instruction=0x7bc ... reason=7at unaligned addresses. These look like the unaligned atomic faults from #6117 and are outside this PR.ctest on the merge: all pass except
agc_driver_store_over_untrackedandguest_kqueue, which fail the same way on plainmainff23657f3on this machine.agc_driver_compute_fs_table_callsandscalar_callpass.Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-16T14:16:47Z.
Hot Wheels Infinite Rush (PPSA22408), another Milestone title: same abort as #6117, gone with this PR
Setup
main5d9dcc42d. After: the samemainmerged with this headd1a68c4ae(clean merge)prx/modules (eossdk-ps5-shipping.prxand thekittmodules). X pressed every 2 s from start-up.Before (without this PR)
After (with this PR)
s_swappc_b64abortstoring storage image results pending over memory outside the write watch ... is not implemented(also seen once onmainwithout this PR)APS5_STORE_AT_FLIP=1)vkAllocateMemory device buffer ... Vulkan result -2) while storage images kept growingThe two failures after the PR are storage-image memory problems, not related to this change. The
s_swappc_b64abort did not appear in any run with this PR.AI-assisted: this comment was drafted with the help of Claude Code and checked against the logs by us.
Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-18T05:34:55Z.
Tested on God of War Ragnarök (PPSA08330, 06.006.000): the computed
s_swappc_b64stop is gone.82f0c9aec+ #6946 + #6958 + #7238 + #7223 + #6277 + #6417 + #7300 and a few open picks), with and without this PR; cold shader cache in both.computed/data-dependent s_swappc_b64 call target at program counter 0x00004044 is not statically resolvable(compute shader0x10527b8200).ds_ordered_count at pc 16504: ordered swap is not modeled, a separate gap (we have a local change for it and will open a PR). With both, alive for the full 720 s run. Four other shaders still logcould not be prepared at registration (its s_swappc_b64 at program counter 0x74 calls a computed target); preparing it when it is used, and none of them stops the run.Tested and written with Claude Code (AI assistant) on a contributor's machine.
Generated by Claude Code