Repository navigation
Description
What happens
The recompiler stops on a pixel shader that loads its S# and T# from a descriptor table at a runtime offset: shader resource tracking: hash=0x4937508ca7e6a749 stage=pixel pc=0x00000318 GetSamplerResource dword 0 is not a valid runtime value (ResourceTracking.cpp, GetHandle), and the title exits with 122.
Title, test or build step
Grand Theft Auto V, PPSA38500 01.002.001
AnyPS5 commit
AnyKyty 7de61e3451, with the two fixes it took to get this far on top (pull requests to follow): red-zone framing kept away from fs: accesses (relinker), and a fixed MAP_NO_OVERWRITE reserve inside an existing reservation (libkernel).
System
Windows 10 22H2 (19045), RTX 2070 SUPER, NVIDIA 617.42, WinLibs GCC 15.2.0 + LLVM 21.1.8
Host report
AnyPS5 host report (format 1)
commit: 7de61e3451c5
[system]
os: Windows 10.0.19045
cpu: AMD Ryzen 7 5800X3D 8-Core Processor
cpu_threads: 16
memory_mib: 32669
cpu_gate: passed
[sdl]
linked: 2.33.0
compiled: 2.33.0
[gpu]
device: NVIDIA GeForce RTX 2070 SUPER
type: discrete
vulkan_api: 1.4.351
driver: NVIDIA
driver_version: 617.42.0.0
subgroup_size: 32
device_local_mib: 7989
Steps to reproduce
relinker --windows --registry eboot.elf app.exe (with sce_module/), then APS5_NO_WGI=1 ./app.exe. The title renders for about 30 s (around 30 frames/s, 908 flips), then this shader is compiled and the run stops.
Log
--- Error ---
shader resource tracking: hash=0x4937508ca7e6a749 stage=pixel pc=0x00000318 GetSamplerResource dword 0 is not a valid runtime value in core/kyty/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp:772
The shape of the code before the sample (from KYTY_SHADER_LOG_DIRECTION=File):
0x2d4: S_MUL_I32 vcc_hi, s26, 0x130
0x2e4: S_BUFFER_LOAD_DWORD vcc_lo, s32, vcc_hi ; offset=88
0x2ec: S_BUFFER_LOAD_DWORD vcc_hi, s32, vcc_hi ; offset=0
0x2fc: S_LSHL_B32 vcc_lo, vcc_lo, 4
0x300: S_LSHL_B32 vcc_hi, vcc_hi, 5
0x304: S_BUFFER_LOAD_DWORDX4 s8, s16, vcc_lo ; S# from table s16..s19 at index*16
0x30c: S_BUFFER_LOAD_DWORDX8 s0, s20, vcc_hi ; T# from table s20..s23 at index*32
0x318: image_sample_a v4, v4, s0, s8
The sampler and image indices are read from a constant buffer (record s26 * 0x130), scaled to the descriptor size, and used as the s_buffer_load offset into two descriptor tables. Both indices are uniform (SGPR) but not known at translation time, so the descriptor words have no static source for resource tracking to intern. This is bindless indexing of samplers and images, not a lane-dependent descriptor.
What was checked
- Same stop on every run (four runs), same hash and pc.
- It is the first shader that does this in the run; about 50 other shaders compiled before it without errors.
- What I think it needs: descriptor sources that are a load from a descriptor-table buffer at a runtime SGPR offset, resolved at draw time (like the existing GPU-selected buffer path) or through a descriptor-indexed binding, instead of a fixed user-data or immediate-offset source. I have not tried a fix; the recompiler is outside what I know well, so help is welcome.
Activity
Ryongen commentedon Nov 25, 2026
The two fixes mentioned above are now #295 (relinker) and #296 (libkernel).
KYTY_FALLBACKS=1does not get past this shader on Windows. The failing translation is a compile-ahead job, andFallback::Containable()is false on Windows, so it is not guarded and the stop ends the run as before. ForcingContainable()to true (local experiment only) turns it intoterminate called after throwing an instance of 'Common::SoftExitError': the throw goes through the guestlibc.prx__cxa_throw, whose unwinder does not find the handler inlibSceAgcDriver.prx. So skipping the draw is not an option there until exceptions cross the guest libc, and the title needs this shape handled in resource tracking.simnJS commentedon Nov 25, 2026
@Ryongen thanks for the very complete report and for #295 / #296 (both in review). We're taking this one: the shape you decoded (sampler and image indices read from a constant buffer, scaled to the descriptor size and used as a uniform
s_buffer_loadoffset into two descriptor tables) is a generic bindless pattern, so it belongs in the recompiler, not in a per-title fix. We're building it against a synthetic test with that exact shape, then we'll ask you to try the branch on your setup, since you have the title and the Windows path. Your note onKYTY_FALLBACKSnot containing the stop on Windows (the soft exit going through the guest__cxa_throw) is useful too: that's a separate issue, and we'll open it so it doesn't get lost.simnJS commentedon Nov 25, 2026
@Ryongen a first fix is on AnyKyty:
7bdcb4bad7lets an adjusted image sample (image_sample_a) take its S# from the descriptor table at a runtime offset, through the existing indirect sampler path. A synthetic shader with your exact shape (two tables, record indices read from a constant buffer, scaled offsets) reproduced the stop and now passes. Your #295 and #296 are in too. Could you try the current AnyKyty on your title and tell us whether it gets past that shader?Ryongen commentedon Nov 25, 2026
Tested 7bdcb4b on PPSA38500 01.002.001 (Windows, RTX 2070 SUPER, AnyKyty at 441382e). The GetSamplerResource stop in PS 0x4937508ca7e6a749 is gone. The game now runs about 55 s and stops on the next bindless case, a buffer this time:
It's one of the ray-tracing compute shaders (the log also has
[RT] cs 0x95b4ea51e43c1825: 8 of 8 BVH intersections run empty).Ryongen commentedon Nov 25, 2026
Tested AnyKyty
441382ef20(with7bdcb4bad7) on Grand Theft Auto V PPSA38500 01.002.001, Windows 10, RTX 2070 SUPER.0x4937508ca7e6a749now compiles and the title gets further: about 900 flips instead of the old stop at the same point, with a new pipeline manifest of 155 modules and 132 pipelines and no failures. Runs stop in one of two shaders, whichever comes first:0x3716055a6324671b, pc0x580, same message:GetSamplerResource dword 0 is not a valid runtime value. Same tables and the sameimage_sample_a, but the record index comes out of a waterfall loop instead of a fixed constant-buffer offset:The record is
v_readlane(v47) * 16 + s98into the constant buffers44, so the index is uniform inside each loop iteration but read from a lane. The sample at0x540in the same shader, whose S# is at the fixed offset 1312 ofs56, is accepted.0x95b4ea51e43c1825, pc0x5514, as in the earlier comment above (the ray-tracing one).Before the stop, these fallbacks show up (
KYTY_FALLBACKSat its Windows default):The frame rate also drops as these start: 26, 30 and 19 frames/s in the first three 10 s windows, then 139 frames in the 19.5 s before the stop. The picture is still at a quarter size in the top-left (#298).
simnJS commentedon Nov 25, 2026
@Ryongen great, thanks for testing so fast. Both new stops are on us: the waterfall-selected record index (
S_FF1+V_READLANEloop) for the sampler, and the GPU-selected buffer descriptor in the compute shader at0x5514. We're on it now and will post a branch here. If you can, the instructions around0x5514in that compute shader (how its V# is loaded and the access that uses it) would save us a guess.simnJS commentedon Nov 25, 2026
@Ryongen both cases are on AnyKyty now (
8bf7cc52cf):0x580):1ee757719fkeeps the texture/sampler selection inside the waterfall loop, so each iteration samples with its own record. A synthetic shader whose even and odd lanes select different pairs reproduced your stop and now passes.0x5514: the same commit handles typed buffer loads (tbuffer_load_format_*) through a GPU-selected V#, which produced exactly that diagnostic in a synthetic shader. We can't be sure it's your instruction, so if it still stops there, the disassembly around0x5514would settle it: the instruction at that PC with its operands and format flags, the instructions that last wrote its four V# registers, and how the table offset is computed. A future stop of this kind also prints the IR opcode, width and format flags now.Could you retry the same scene on the current AnyKyty?
Ryongen commentedon Nov 25, 2026
With #299 (Windows
KYTY_FALLBACKSfix for #297) andKYTY_FALLBACKS=1, one run of PPSA38500 01.002.001 gets past these stops and lists every shader it reaches that fails, instead of ending at the first one.441382ef20plus the #299 change, Windows 10, RTX 2070 SUPER, about 2 minutes. 27 compute shaders fail; 14 of them were also needed at draw time, so those dispatches were skipped.26 stop in resource tracking with the same message as
0x95b4ea51e43c1825(buffer descriptor is not a valid runtime value; GPU-selected access requires ... from a user-data base):Several share a pc (
0x1e80three times,0x1ab8and0x1acctwice each), so they look like variants of a few programs.One stops earlier, in the CFG build:
0x10b76d3854f99f9eat pc0x2324,unsupported family=VOPC opcode=0xec raw=[0x7dd900f9 0x8606000f] reason=VOPC SDWA modifier is not supported for opcode.The pixel shader
0x3716055a6324671b(the waterfall-indexed S#) was not reached in this run.After about 2 minutes the title ends itself on purpose in a worker thread (
mov dword ptr [0], 0x21atapp.exe+0x8be3a40), probably because of the skipped dispatches.simnJS commentedon Nov 25, 2026
@Ryongen that list is gold, thank you, and thanks for #299 (reviewing it now). Your run was on
441382ef20+ #299, so it doesn't have1ee757719fyet (typed loads through a GPU-selected V#, now on AnyKyty8bf7cc52cf): on our side several of those 26 compute shaders already translate with it. Could you redo the same run on the current AnyKyty + #299? Whatever still fails there is what's left. TheVOPC SDWAopcode0xecin0x10b76d3854f99f9eis on our list too. Good catch on the deliberate stop after ~2 min: skipped dispatches clearly aren't an option for this title.Ryongen commentedon Nov 25, 2026
Redid it on
8bf7cc52cf+ #299 (ce1c67df6a), sameKYTY_FALLBACKS=1run, three times (the last two with the Vulkan pipeline cache already warm).Of the 27 compute shaders from the last list, 26 now translate. The only one still failing is the VOPC SDWA one:
No "buffer descriptor is not a valid runtime value" stops at all.
The title still ends itself at the same place (
mov dword ptr [0], 0x21atapp.exe+0x8be3a40), about 3 minutes in. But in every run it comes right after a long wait on one ray-tracing compute dispatch:(28.0 s in the first run.) It happens with the pipeline cache warm too, so it's the GPU work, not a compile. So I think the stop is the title's own hang watchdog firing after that wait, not a reaction to skipped dispatches.
0x95b4ea51e43c1825also stalls 3.4 s just before the crash.simnJS commentedon Nov 25, 2026
@Ryongen thanks, that pins it down. Same picture on our side:
0x9d22ec1f658c72a8keeps the GPU busy for ~26 s in its emulated BVH walk, the title's own hang watchdog then fires, and with the watchdog out of the way the main thread just waits on it. We're now on making that walk fast (getting its BVH served by native ray queries, and the 6 intersections that run empty). TheVOPC SDWAopcode0xecis next on the decoder side. FYI, on our NVIDIA 595 Linux driver that shader also crashed the driver's compiler; the fix for that is in CI (fix(kyty): read the first lane with a subgroup reduction instead of a shuffle).Ryongen commentedon Nov 25, 2026
An offline pass over the title's
shaders.rpf(15,394 programs, each one run throughPrepareShaderSourceandTranslateProgramwith its own compute registers, on AnyKytyce1c67df6a) finds the sameVOPC SDWAstop in two more shaders, all three from the same material:It also finds 15 ray-tracing shaders that make resource tracking recurse forever, filed as #300.
Every shader from the earlier lists, including
0x9d22ec1f658c72a8behind the 26 s stall, is on the title's ray-tracing path (the program names in the archive areCS_RaytracingResolve_*per material,CS_RaytraceVBuffer_RayBinning_*, the light-probe gathers andCS_DummyResolve). I'll try a run in the title's graphics mode without ray tracing next and report what it reaches.Offline results for resource tracking itself are not reliable (they need the descriptor tables the SRT walker reads at run time), so only the decoder and CFG stops above and the recursion are reported from it.
simnJS commentedon Nov 26, 2026
@Ryongen
V_CMP_NLE_F16(theVOPC SDWAopcode0xecin the threebillboard_nobumpresolve shaders) is decoded on AnyKyty now (4401877673), and #300 is fixed too (180b1a9cbe). Next on our side: the title's own BVH build pass that Kyty skipped as "unresolvable resources", which leaves the following refit running on unwritten data.simnJS commentedon Nov 26, 2026
Closing this one: the stop it reports is fixed on
AnyKyty, and you confirmed it on your setup, @Ryongen.7bdcb4bad7: an adjusted image sample takes its S# from a descriptor table at a runtime offset (the stop at0x318).1ee757719f: the same when the record index comes out of a waterfall loop, and typed buffer loads through a GPU-selected V# (26 of the 27 compute shaders of your later list).4401877673:V_CMP_NLE_F16in its SDWA form (theVOPC SDWAstop).180b1a9cbe: register copy cycles in descriptor tracking (kyty: resource tracking recurses forever through register copies (stack overflow in 15 Grand Theft Auto V ray-tracing shaders) #300).ce1c67df6a(fix(kyty): catch compile-ahead translation stops on Windows #299): on Windows, a translation stop in a compile-ahead job is contained byKYTY_FALLBACKS(kyty: on Windows, a translation stop in a compile-ahead job is not contained by KYTY_FALLBACKS #297).What is left on that title is no longer resource tracking: a ray-tracing compute dispatch that keeps the GPU busy for about 26 s, after which the title's own watchdog fires. We are working on that one. If a new stop shows up on the current
AnyKyty, a new issue with this level of detail is the fastest way to get it fixed. Thanks again for #295, #296 and #299.