Skip to content

fix(recompiler): give a dynamic-mip storage image a slot for every level - #7238

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
gjonn:fix/recompiler-dynamic-storage-mip-slots
Oct 18, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
gjonn:fix/recompiler-dynamic-storage-mip-slots

Conversation

@gjonn

@gjonn gjonn commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What

A dynamic-mip storage image reserved RuntimeAbi::StorageMipSlots = 4 mip slots, so a compute shader whose storage T# spans more levels was poisoned with runtime storage image mip capacity exceeded.

On PPSA01317 a compute T# over a 512x512 surface with ten mip levels hits this on boot and the title aborts with that message; with this change it gets past it on main.

An RDNA T# addresses at most sixteen levels (4-bit BASE_LEVEL and LAST_LEVEL), so a dynamic-mip storage image now reserves sixteen slots. StorageHeapCapacity goes from 16 to 64 so four such images still share one typed storage class, as before. Heap arrays keep their compact length. RuntimeAbi::Version goes to 14, so existing shader caches are invalidated.

The new verifyDynamicStorageMipChain case in agc_shader_memory selects a runtime mode for a ten-level and a sixteen-level 2D storage T#. It fails on main with a dynamic-mip storage image of a 512x512 surface with ten levels was rejected and passes with the change.

Tested

Windows 11, MinGW GCC Release build with BUILD_TESTING=ON.

  • agc_shader_memory fails on main (with only the test applied) and passes with the change.
  • Every ctest registered on agc_shader_memory_tests, agc_shader_device_profile_tests and agc_driver_graphics_tests (22 tests) passes.
  • python tools/check_conventions.py --base origin/main passes; tools/check_test_registration.py reports no unregistered tests.
  • PPSA01317: the boot abort runtime storage image mip capacity exceeded no longer occurs and the title continues past it.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA01317 Gran Turismo 7 (PPSA01317) #4697
  • GPUs tested: NVIDIA GeForce RTX 5090 Laptop GPU, driver 616.92, Windows 11
  • AI-assisted: yes

A dynamic-mip storage image reserved four mip slots, so a compute shader
whose T# spans more levels failed with "runtime storage image mip capacity
exceeded". PPSA01317 hits it on boot with a 512x512 surface of ten levels
and aborts. An RDNA T# addresses at most sixteen levels (4-bit BASE_LEVEL
and LAST_LEVEL), so a dynamic-mip image now reserves sixteen slots, and a
typed storage heap holds 64 elements so four such images still share one
class. Heap arrays keep their compact length. The runtime ABI goes to 14,
so existing shader caches are invalidated.

AI-assisted: yes
@github-actions

github-actions Bot commented Oct 17, 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 6881 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L5755, L5884

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 1341 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 5371 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/RuntimeAbi.hpp
PR 5500 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6094 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6177 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6222 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6232 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6412 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6503 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6645 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6674 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6941 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6946 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6947 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/RuntimeAbi.hpp
PR 6989 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6995 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 7002 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 7332 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp

@akkadbakkad89

Copy link
Copy Markdown

Independent hardware run, head 4aaf276999, Windows 11, MinGW (WinLibs GCC 15.2.0), Release: agc_shader_memory (incl. the dynamic-mip storage-image cases), agc_shader_device_profile, agc_driver_graphics all pass on NVIDIA RTX 3070 (driver 617.42); agc_driver_graphics also passes on Intel UHD 630 (ANYPS5_GPU=UHD, igvk64).

@ps54all

ps54all commented Oct 17, 2026

Copy link
Copy Markdown

Tested on God of War Ragnarök (PPSA08330, 06.006.000): the runtime storage image mip capacity exceeded abort is gone.

LLM assistance used (Claude); runs on our machine.

alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
@frankea

frankea commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

RTX 4090 data point on PPSA01317, following my #7243 run from earlier tonight, where the title stopped on runtime storage image mip capacity exceeded. Short version: with this PR on top of that stack the mip-capacity abort is gone on this GPU too, 3 of 3 completed runs plus a cold-cache rerun, and the next stop is the unnormalized-sampler refusal that #7240 covers. One run of four stalled on the splash for the whole 900 s cap; a cold rerun did not reproduce that.

Setup. Gran Turismo 7 PPSA01317 01.000.001 (base package), Windows 11 (26200), RTX 4090 (NVIDIA 616.92), AMD Ryzen 7 5800X, MinGW-w64 GCC 15.2.0 r7 (UCRT), Release libs target only (no tests built). app.exe is the relink from main 31cbb55 (--windows --registry --module-dir .); only libs/ is swapped between runs. Tree: main e1041f6 + #7137 2aa6bfc + #7207 ec28b6b + #7175 555b7e8 + #5958 87a9b8d + #7243 da158d6 (f76397990, the set that stopped on the mip capacity) + #7238 4aaf276 cherry-picked (clean, 1be778eea; RuntimeAbi.hpp and ResourceMaterializer.cpp rebuilt). The libSceSsl.prx is the one from #7319 (1f26755), because the title calls sceSslConnect after its save-data mount and the stock export throws there. Current main is not usable as the base for this title since #7323 (sceHmd2ReprojectionQueryBufferSizeAlign not implemented 5 s in, see the #7243 comment). No controller, no input, nobody at the keyboard; one-shot interactive task per run, box otherwise idle.

Result. The ABI bump invalidates the shader cache, so run 1 recompiled all 1,785 shaders (793 MiB written). Runs 2 and 3 (warm) and a fourth run with the shader and pipeline caches moved aside (cold again, 1,785 misses) all get past the mip-capacity throw: splash, then the black loading screen with the GT spinner (title-bar counter 15 to 60 FPS, about 490 frames at the last capture), save data mounted, three sceNetResolverStartNtoa -> host DNS lookup failed, 26 new shaders compiled, and then, identically in all three:

[gpu] driver failure: shader 0x1258d04700 stage 5: DescriptorBindingBuilder::Populate unnormalized guest sampler is used by an implicit-LOD sample, which is not implemented
[videoout] presentation failed: shader 0x1258d04700 stage 5: DescriptorBindingBuilder::Populate unnormalized guest sampler is used by an implicit-LOD sample, which is not implemented
terminate called after throwing an instance of 'std::runtime_error'
  what():  shader 0x1258d04700 stage 5: DescriptorBindingBuilder::Populate unnormalized guest sampler is used by an implicit-LOD sample, which is not implemented
FATAL: abort() (SIGABRT) on thread 15036

That is the bind-time refusal #7240 describes for this title (image_sample_o through an unnormalized point S#), so #7243 + #7238 + #7240 is the next combination here. Nothing else new appears in between: no partial writes, no color export format refusal, no device loss.

run shader cache exit after stop
stack without #7238 (earlier tonight, 3 runs) warm 32 to 53 s compute shader 0x1258d58300: runtime storage image mip capacity exceeded
1 cold (1,785 misses) killed at 900 s none: stalled on the splash, see below
2 warm 37 s shader 0x1258d04700 stage 5: ... unnormalized guest sampler is used by an implicit-LOD sample
3 warm 33 s same
4, caches moved aside cold (1,785 misses) 36 s same

The stalled run. Run 1 wrote its 1,785 cache entries in the first two 10 s windows, mounted the save data and opened the same files as the other runs (/download0/gt7save.tmp, /temp0/vegas_downloads/temp/d_5.tmp, /app0/cs), then stopped presenting: the title-bar counter froze at 63 frames (3.1 FPS) 56 s after launch and still read 63 at 15 min, the splash stayed on screen, no further log line of any kind (no resolver lookups, no shader-cache summary), and the process kept about two cores busy (685 CPU-seconds at 6 min). It was killed at the cap, so there is no abort block. The cold rerun with the shader cache and the Vulkan pipeline cache both moved aside went through the same point in 36 s, so I cannot tie the stall to the first compile after the ABI bump; I am noting it in case someone else sees a first run hang after this PR.

stderr of run 3 (warm, box idle) from the second 10 s summary to the abort, per-shader ShaderRegistry lines removed
[log] 10.1 s: 177 lines (5 stdout, 172 stderr), 25.0 KiB written, 0 repeats coalesced; callers spent 0.48 ms queueing and formatting (0.005% of one thread), logger thread 69.70 ms, queue peak 2.3 KiB
[SAVEDATA:native] mount3 user=268435456 dir=DRFILEIV mode=0x1 blocks=673 -> 0x809f0008 point= status=0
[SAVEDATA:native] getMemory2 user=268435456 slot=0 -> 0x00000000
[shader-disk-cache] (10 s): 115 hits, 0 misses, 0 writes (0.0 MiB), 0 load failures, 0 write failures; resource plans: 110 hits, 0 misses, 0 writes, 0 load failures; 12.0 MiB read in 25.8 ms
[SOFT-NET] sceNetResolverStartNtoa -> host DNS lookup failed
[SOFT-NET] sceNetResolverStartNtoa -> host DNS lookup failed
[SOFT-NET] sceNetResolverStartNtoa -> host DNS lookup failed
[gpu] driver failure: shader 0x1258d04700 stage 5: DescriptorBindingBuilder::Populate unnormalized guest sampler is used by an implicit-LOD sample, which is not implemented
[videoout] presentation failed: shader 0x1258d04700 stage 5: DescriptorBindingBuilder::Populate unnormalized guest sampler is used by an implicit-LOD sample, which is not implemented
terminate called after throwing an instance of 'std::runtime_error'
  what():  shader 0x1258d04700 stage 5: DescriptorBindingBuilder::Populate unnormalized guest sampler is used by an implicit-LOD sample, which is not implemented
FATAL: abort() (SIGABRT) on thread 15036
    #0 0x00007fff70982bd8 libc.prx+0x12bd8
    #1 0x00007fff70a55af1 libc.prx+0xe5af1
    #2 0x00000000d44ef910
  stack return address candidates:
    [rsp+0x8] 0x00007fff70982df5 libc.prx+0x12df5
    [rsp+0x38] 0x00007fffd0d62139 ucrtbase.dll+0xc2139
    [rsp+0xb8] 0x00007fffd0d45261 ucrtbase.dll+0xa5261
    [rsp+0xe8] 0x00007fff709d4056 libc.prx+0x64056
    [rsp+0x120] 0x00007fffd0d13de0 ucrtbase.dll+0x73de0
    [rsp+0x138] 0x00007fff709cf0db libc.prx+0x5f0db
    [rsp+0x168] 0x00007fff709cf100 libc.prx+0x5f100
    [rsp+0x198] 0x00007fff709da039 libc.prx+0x6a039
    [rsp+0x1b8] 0x00007fffd0d13de0 ucrtbase.dll+0x73de0
    [rsp+0x1c8] 0x00007fffa304e76e libSceVideoOut.prx+0x3e76e
    [rsp+0x2b0] 0x00007fffa3040101 libSceVideoOut.prx+0x30101
    [rsp+0x538] 0x00007fffa301e422 libSceVideoOut.prx+0xe422
    [rsp+0x588] 0x00007fff70ead4cf libstdc++-6.dll+0x13d4cf
    [rsp+0x5c8] 0x00007fffb80a9f6a libwinpthread-1.dll+0x9f6a
    [rsp+0x5d8] 0x00007fffb80a8b31 libwinpthread-1.dll+0x8b31
    [rsp+0x618] 0x00007fffd0cccd30 ucrtbase.dll+0x2cd30
    [rsp+0x648] 0x00007fffd2b2dda7 KERNEL32.DLL+0x2dda7
    [rsp+0x678] 0x00007fffd39bee4c ntdll.dll+0x7ee4c

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit 4827d82 into boykopovar:main Oct 18, 2026
9 of 10 checks passed
@ps54all ps54all mentioned this pull request Oct 18, 2026
11 tasks done
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining regression coverage from Gjonn PRs boykopovar#7238, boykopovar#7243 and boykopovar#7256 while retaining the larger storage heap, packed float blending and shared depth arrays. The offset folding from boykopovar#7240 is already covered.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants