feat(agc): implement image and sampler tables indexed at runtime offsets #757

Merged
Celegans12 merged 1 commit from upstream-pr/757 into main 2026-10-14 15:48:32 +00:00
Celegans12 commented 2026-10-05 21:11:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-05T21:11:40Z.


What

Image and sampler descriptors that s_buffer_load reads at runtime key * stride + addend offsets fail planning (GetImageResource dword 0 is not a valid runtime value). This snapshots such tables per invocation and selects the entry in the shader; table contents stay out of shader, pipeline and disk-cache keys.

  • An entry that can't be bound exactly reads zeros and faults only when an active lane selects it: unsupported formats, MSAA, border/cube/ANISO_OVERRIDE pairings, and a T# whose surface has no mapped byte.
  • Reads of one heap with one record shape share a column, narrowed to the records its keys select when every key is a V#-relative read or an SRT-walker value (@SleglJan's changes); loop-carried, lane-reduced and (key << n) & mask keys (@tibzejoker's fix) keep the whole table. Records are read in runs (@SleglJan's ShaderMemory::readWords).
  • Fragment tables use the fragment set when pipeline libraries split it; empty tables reserve one descriptor.
  • The resource cache keeps at most 65,536 table elements and the dispatch cache 256 MiB of captured words, evicting least recently used (@tibzejoker's memory report).
  • Documented in docs/dev/ARCHITECTURE.md; runtime ABI 12, disk format 32 (stored plans carry table columns); limits in docs/dev/debt.

#758 adds tables loaded through 64-bit pointers. Table FMASK entries still fault. #5461 and #5472 also change the disk format, and #5620 extends the bindless-table path this replaces. #5550's T# that is both queried and sampled is one column here (its test is ported), as is #5188's T# read at a user-data offset, whose test now checks the record each key selects. #4783's key reservation and #5408's key-miss trace count the image shapes this adds to content keys.

Tested

Based on main 066b58fa. Windows 11 (MinGW-w64 GCC 15.2.0) and Linux: configure -DBUILD_TESTING=ON, full build, --target libs, ctest.

  • Windows, NVIDIA (with #758 on top): 1188/1189 tests pass; log_macros also fails on main here.
  • Linux (upstream's job on WSL, lavapipe), merged with main 84b01f9c: 1171/1173; agc_driver_bc_block_copy and agc_driver_depth_compare_copy also fail on main there.

agc_driver_image_table, _cache, _reuse, _cache_bounds (new: both bounds), agc_driver_bindless_images, agc_shader_bindless (new: shared keyed columns, masked offsets, #5550's queried and sampled T#), agc_driver_key_miss and agc_driver_graphics (new: table words and shapes in content keys) and agc_shader_disk_cache (plans with table columns and key domains round trip) pass on both. The table tests don't build on main; _cache_bounds fails without the two bounds.

Not tested: native RADV, Linux with write tracking, console behaviour.

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
  • Unblocks: PPSA26344 #675
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, driver 610.62, Windows 11; llvmpipe (Mesa 25.2.8), WSL Ubuntu 24.04
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4750810871 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-05T21:11:40Z. --- ### What Image and sampler descriptors that `s_buffer_load` reads at runtime `key * stride + addend` offsets fail planning (`GetImageResource dword 0 is not a valid runtime value`). This snapshots such tables per invocation and selects the entry in the shader; table contents stay out of shader, pipeline and disk-cache keys. - An entry that can't be bound exactly reads zeros and faults only when an active lane selects it: unsupported formats, MSAA, border/cube/`ANISO_OVERRIDE` pairings, and a T# whose surface has no mapped byte. - Reads of one heap with one record shape share a column, narrowed to the records its keys select when every key is a V#-relative read or an SRT-walker value (@SleglJan's changes); loop-carried, lane-reduced and `(key << n) & mask` keys (@tibzejoker's fix) keep the whole table. Records are read in runs (@SleglJan's `ShaderMemory::readWords`). - Fragment tables use the fragment set when pipeline libraries split it; empty tables reserve one descriptor. - The resource cache keeps at most 65,536 table elements and the dispatch cache 256 MiB of captured words, evicting least recently used (@tibzejoker's memory report). - Documented in `docs/dev/ARCHITECTURE.md`; runtime ABI 12, disk format 32 (stored plans carry table columns); limits in `docs/dev/debt`. #758 adds tables loaded through 64-bit pointers. Table FMASK entries still fault. #5461 and #5472 also change the disk format, and #5620 extends the bindless-table path this replaces. #5550's T# that is both queried and sampled is one column here (its test is ported), as is #5188's T# read at a user-data offset, whose test now checks the record each key selects. #4783's key reservation and #5408's key-miss trace count the image shapes this adds to content keys. ### Tested Based on `main` 066b58fa. Windows 11 (MinGW-w64 GCC 15.2.0) and Linux: configure -DBUILD_TESTING=ON, full build, --target libs, ctest. - Windows, NVIDIA (with #758 on top): 1188/1189 tests pass; `log_macros` also fails on `main` here. - Linux (upstream's job on WSL, lavapipe), merged with `main` 84b01f9c: 1171/1173; `agc_driver_bc_block_copy` and `agc_driver_depth_compare_copy` also fail on `main` there. `agc_driver_image_table`, `_cache`, `_reuse`, `_cache_bounds` (new: both bounds), `agc_driver_bindless_images`, `agc_shader_bindless` (new: shared keyed columns, masked offsets, #5550's queried and sampled T#), `agc_driver_key_miss` and `agc_driver_graphics` (new: table words and shapes in content keys) and `agc_shader_disk_cache` (plans with table columns and key domains round trip) pass on both. The table tests don't build on `main`; `_cache_bounds` fails without the two bounds. Not tested: native RADV, Linux with write tracking, console behaviour. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA26344 #675 - [x] GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, driver 610.62, Windows 11; llvmpipe (Mesa 25.2.8), WSL Ubuntu 24.04 - [x] AI-assisted: yes
oneandonlydean commented 2026-10-05 22:56:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T22:56:49Z.


Thanks for this. The Linux job fails in the new agc_driver_image_table test on all three of #757, #758 and #759 (run 37374351259):

AGC graphics: uint texels through a linear sampler: lane 0 is 0x00000001, expected 0x00001000

I don't think the table path is at fault here. The check just before it, that record 4 gives the same words as a direct binding of the same T# and S#, passed in that run, so the direct binding returns 0x00000001 on lavapipe too. Record 4 pairs LinearWrap with a 32_UINT image, and requiresPointSampler forces point filtering only for the signed integer class (and conversions and depth), so an unsigned integer image reaches Vulkan with a linear filter. R32_UINT has no SAMPLED_IMAGE_FILTER_LINEAR support, so the result is undefined: NVIDIA happens to return the point sample, lavapipe doesn't.

Either of these should make it pass everywhere:

  • treat the unsigned integer class like the signed one in requiresPointSampler (and in the table entries' point-filtered S# copy), so both paths give the point sample on every driver; or
  • keep the direct-binding comparison for record 4 and drop its absolute check, leaving the uint point result to record 1.

The first also fixes direct bindings on lavapipe, so I'd prefer it, but it's your call. The other rows pass, and Windows is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6004893127 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6004893127). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T22:56:49Z. --- Thanks for this. The Linux job fails in the new `agc_driver_image_table` test on all three of #757, #758 and #759 ([run 37374351259](https://github.com/boykopovar/AnyPS5/actions/runs/37374351259)): ``` AGC graphics: uint texels through a linear sampler: lane 0 is 0x00000001, expected 0x00001000 ``` I don't think the table path is at fault here. The check just before it, that record 4 gives the same words as a direct binding of the same T# and S#, passed in that run, so the direct binding returns 0x00000001 on lavapipe too. Record 4 pairs `LinearWrap` with a 32_UINT image, and `requiresPointSampler` forces point filtering only for the signed integer class (and conversions and depth), so an unsigned integer image reaches Vulkan with a linear filter. R32_UINT has no `SAMPLED_IMAGE_FILTER_LINEAR` support, so the result is undefined: NVIDIA happens to return the point sample, lavapipe doesn't. Either of these should make it pass everywhere: - treat the unsigned integer class like the signed one in `requiresPointSampler` (and in the table entries' point-filtered S# copy), so both paths give the point sample on every driver; or - keep the direct-binding comparison for record 4 and drop its absolute check, leaving the uint point result to record 1. The first also fixes direct bindings on lavapipe, so I'd prefer it, but it's your call. The other rows pass, and Windows is green.
Celegans12 commented 2026-10-06 00:20:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T00:20:09Z.


Thanks, that was it. I went with the first option. #757, #758 and #759 are force-pushed onto main cb33f858.

  • requiresPointSampler now covers the Uint class like Sint. The table paths (an S# column of a table entry, and a direct T# with a table S#) use the same rule, so every integer view reaches Vulkan with the point-filtered copy. This also changes main's direct binding path for Uint images, as the description now says.
  • A driver-independent check was added to agc_driver_image_table, because NVIDIA and the Intel iGPU here return the centre texel even with a linear sampler. The check asserts that word 2 of the sampler bound for the direct Uint + LinearWrap pair, and of each table entry's integer copy, is the point word (0x01000000, not 0x00500000).
    • It fails without the change.
    • New rows cover a Uint direct T# under a linear table S#.
  • The wave32 per-wave case now uses its neighbours' gate (subgroup size 32 only), since llvmpipe never reached it before.
  • The #639 overlap note now says that #639 moves this rule (Sint only), so whichever lands second has to keep Uint in it.

Windows: ctest 335/335 (#757), 335/335 (#758) and 336/336 (#759).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6006325206 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6006325206). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T00:20:09Z. --- Thanks, that was it. I went with the first option. #757, #758 and #759 are force-pushed onto `main` cb33f858. - `requiresPointSampler` now covers the Uint class like Sint. The table paths (an S# column of a table entry, and a direct T# with a table S#) use the same rule, so every integer view reaches Vulkan with the point-filtered copy. This also changes `main`'s direct binding path for Uint images, as the description now says. - A driver-independent check was added to `agc_driver_image_table`, because NVIDIA and the Intel iGPU here return the centre texel even with a linear sampler. The check asserts that word 2 of the sampler bound for the direct Uint + `LinearWrap` pair, and of each table entry's integer copy, is the point word (0x01000000, not 0x00500000). - It fails without the change. - New rows cover a Uint direct T# under a linear table S#. - The wave32 per-wave case now uses its neighbours' gate (subgroup size 32 only), since llvmpipe never reached it before. - The #639 overlap note now says that #639 moves this rule (Sint only), so whichever lands second has to keep Uint in it. Windows: ctest 335/335 (#757), 335/335 (#758) and 336/336 (#759).
oneandonlydean commented 2026-10-06 01:12:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T01:12:44Z.


Thanks. The Uint rule now covers direct bindings, table entries and both mixed pairings (direct S# with a table image, table S# with a direct image), and the sampler-word checks don't depend on the driver.

Two things:

  • The chain now conflicts with main after #668 landed (comparison sampling of color textures): IrMetadata/Resources.hpp, ResourceMaterializer.cpp, ShaderDiskCache.cpp and SpirvImageEmitter.cpp. It needs one more rebase.
  • A Uint image that shares an S# with a float image now takes a second sampler slot. A shader close to the 32-sampler limit (ResourceMaterializer.cpp:907) could therefore throw where main didn't. That seems unlikely to matter, but it may be worth a few words in the TechnicalDebt line.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6007249358 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6007249358). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T01:12:44Z. --- Thanks. The Uint rule now covers direct bindings, table entries and both mixed pairings (direct S# with a table image, table S# with a direct image), and the sampler-word checks don't depend on the driver. Two things: - The chain now conflicts with `main` after #668 landed (comparison sampling of color textures): `IrMetadata/Resources.hpp`, `ResourceMaterializer.cpp`, `ShaderDiskCache.cpp` and `SpirvImageEmitter.cpp`. It needs one more rebase. - A Uint image that shares an S# with a float image now takes a second sampler slot. A shader close to the 32-sampler limit (`ResourceMaterializer.cpp:907`) could therefore throw where main didn't. That seems unlikely to matter, but it may be worth a few words in the TechnicalDebt line.
Celegans12 commented 2026-10-06 02:51:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T02:51:15Z.


Rebased the chain onto main fe98276f, over #668. Windows: ctest 342/342 (#757), 342/342 (#758) and 343/343 (#759); #757 alone also passes with -DANYPS5_ENABLE_SPIRV_TOOLS=ON.

  • #668 for T#s outside tables: unchanged. agc_driver_emulated_color_compare passes as merged. The four conflicts were textual, and emulatedCompare is encoded next to tableView. FormatVersion stays 5, since #668 left main at 4.
  • Where the two meet, the PR now throws at record time instead of being silently wrong:
    • A compare-sampled color T# whose S# comes from a table: the zeroed table slot would have produced compare function NEVER, point filtering and wrap.
    • A compare-sampled color texture inside a table: before, it reached the driver's stale "requires an R32 float or R16 unorm depth texture".
    • R32 float and R16 unorm entries keep the native comparison. agc_shader_memory has rows for each case.
  • Sampler slots: added a TechnicalDebt line. An integer image's point-filtered copy takes its own sampler slot, so a shader that pairs one S# with float and integer images reaches ShaderInfo::MaxSamplers one slot sooner than on main.
  • lavapipe: the same builds also ran on Mesa 26.2.4 llvmpipe here (8-wide subgroups). Everything passes except agc_driver_flat_store. It needs about 6 minutes on Windows llvmpipe, which is past the 240 s limit, and it passes when given the time.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6008338757 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6008338757). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T02:51:15Z. --- Rebased the chain onto `main` fe98276f, over #668. Windows: ctest 342/342 (#757), 342/342 (#758) and 343/343 (#759); #757 alone also passes with `-DANYPS5_ENABLE_SPIRV_TOOLS=ON`. - **#668 for T#s outside tables:** unchanged. `agc_driver_emulated_color_compare` passes as merged. The four conflicts were textual, and `emulatedCompare` is encoded next to `tableView`. `FormatVersion` stays 5, since #668 left `main` at 4. - **Where the two meet**, the PR now throws at record time instead of being silently wrong: - A compare-sampled color T# whose S# comes from a table: the zeroed table slot would have produced compare function NEVER, point filtering and wrap. - A compare-sampled color texture inside a table: before, it reached the driver's stale "requires an R32 float or R16 unorm depth texture". - R32 float and R16 unorm entries keep the native comparison. `agc_shader_memory` has rows for each case. - **Sampler slots:** added a TechnicalDebt line. An integer image's point-filtered copy takes its own sampler slot, so a shader that pairs one S# with float and integer images reaches `ShaderInfo::MaxSamplers` one slot sooner than on `main`. - **lavapipe:** the same builds also ran on Mesa 26.2.4 llvmpipe here (8-wide subgroups). Everything passes except `agc_driver_flat_store`. It needs about 6 minutes on Windows llvmpipe, which is past the 240 s limit, and it passes when given the time.
Celegans12 commented 2026-10-06 03:09:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T03:09:57Z.


Correction to the lavapipe note above. Under identical load, with main's and this chain's test binaries running side by side on Mesa 26.2.4 llvmpipe, this chain is about 45% slower in both slow tests:

  • agc_driver_global_vcc_base: 94 s on main, 137 s here.
  • agc_driver_flat_store: 259 s on main, 365 s here.

NVIDIA shows no difference, and neither test uses image tables, so this is a per-dispatch or per-compile cost that #757 adds everywhere. It is not the environment. I'm tracking it down and will fix it on this branch before asking for another look.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6008538210 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6008538210). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T03:09:57Z. --- Correction to the lavapipe note above. Under identical load, with main's and this chain's test binaries running side by side on Mesa 26.2.4 llvmpipe, this chain is about 45% slower in both slow tests: - `agc_driver_global_vcc_base`: 94 s on main, 137 s here. - `agc_driver_flat_store`: 259 s on main, 365 s here. NVIDIA shows no difference, and neither test uses image tables, so this is a per-dispatch or per-compile cost that #757 adds everywhere. It is not the environment. I'm tracking it down and will fix it on this branch before asking for another look.
oneandonlydean commented 2026-10-06 03:27:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T03:27:17Z.


Thanks for the rebase. I went through the range-diff against the previous heads: the #668 merge keeps emulatedCompare next to the table view, FormatVersion 5 still invalidates the cache, and the new record-time errors only fire where a compare-sampled color texture meets a table (table S#, or a color entry inside a table), with R32 float and R16 unorm entries still comparing natively. Failing there is better than the silent NEVER/point/wrap sampler. The sampler-slot TechnicalDebt line covers the second point.

Thanks also for the lavapipe correction. It matches CI: #758's Linux job (run 37406080556) timed out in agc_driver_flat_store at 120 s, while main took 66 s for that test on its last run. I'll wait for the fix before running the chain in PPSA21564, since a per-dispatch or per-compile cost would show up in its frame rate too.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6008722122 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6008722122). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T03:27:17Z. --- Thanks for the rebase. I went through the range-diff against the previous heads: the #668 merge keeps `emulatedCompare` next to the table view, `FormatVersion` 5 still invalidates the cache, and the new record-time errors only fire where a compare-sampled color texture meets a table (table S#, or a color entry inside a table), with R32 float and R16 unorm entries still comparing natively. Failing there is better than the silent NEVER/point/wrap sampler. The sampler-slot TechnicalDebt line covers the second point. Thanks also for the lavapipe correction. It matches CI: #758's Linux job (run 37406080556) timed out in `agc_driver_flat_store` at 120 s, while `main` took 66 s for that test on its last run. I'll wait for the fix before running the chain in PPSA21564, since a per-dispatch or per-compile cost would show up in its frame rate too.
Celegans12 commented 2026-10-06 04:44:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T04:44:12Z.


Fixed and force-pushed. #757, #758 and #759 are on main 109a3281; the #685 rename in Dispatch.cpp was the only conflict.

  • Cause: RecordBdaFault computed the two fault-address words (OpUConvert of the address, and of the address shifted right by 32) before claiming the fault slot with OpAtomicCompareExchange, instead of inside the won block as on main.

    • The instruction count was unchanged, but this order reached about 1090 inlined fault-record sites in agc_driver_global_vcc_base.
    • llvmpipe's LLVM passes took about 50% longer on it. With GALLIVM_PERF=nopt both versions take the same time.
    • Shader execution, recompile counts, pipelines and per-dispatch work were unchanged.
  • Fix: both RecordBdaFault and RecordBdaFaultWords now claim the slot first and compute the words inside the won block. Callers of RecordBdaFault emit main's SPIR-V again: the wave32 module of agc_driver_global_vcc_base is byte-identical to main's.

    • agc_shader_memory gains a host-only check that the claim comes before any address conversion.
  • Side by side on llvmpipe (Mesa 26.2.4, same load):

    Test main this chain before the fix
    agc_driver_global_vcc_base 70.4 s 70.4 s 102.2 s
    agc_driver_flat_store 185 s 187 s 283 s
  • Tests: Windows ctest 354/354 (#757), 354/354 (#758) and 355/355 (#759), and the same on lavapipe.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6009501256 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6009501256). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T04:44:12Z. --- Fixed and force-pushed. #757, #758 and #759 are on `main` 109a3281; the #685 rename in `Dispatch.cpp` was the only conflict. - **Cause:** `RecordBdaFault` computed the two fault-address words (`OpUConvert` of the address, and of the address shifted right by 32) before claiming the fault slot with `OpAtomicCompareExchange`, instead of inside the `won` block as on `main`. - The instruction count was unchanged, but this order reached about 1090 inlined fault-record sites in `agc_driver_global_vcc_base`. - llvmpipe's LLVM passes took about 50% longer on it. With `GALLIVM_PERF=nopt` both versions take the same time. - Shader execution, recompile counts, pipelines and per-dispatch work were unchanged. - **Fix:** both `RecordBdaFault` and `RecordBdaFaultWords` now claim the slot first and compute the words inside the `won` block. Callers of `RecordBdaFault` emit `main`'s SPIR-V again: the wave32 module of `agc_driver_global_vcc_base` is byte-identical to `main`'s. - `agc_shader_memory` gains a host-only check that the claim comes before any address conversion. - **Side by side on llvmpipe** (Mesa 26.2.4, same load): | Test | `main` | this chain | before the fix | |---|---|---|---| | `agc_driver_global_vcc_base` | 70.4 s | 70.4 s | 102.2 s | | `agc_driver_flat_store` | 185 s | 187 s | 283 s | - **Tests:** Windows ctest 354/354 (#757), 354/354 (#758) and 355/355 (#759), and the same on lavapipe.
oneandonlydean commented 2026-10-06 05:33:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T05:33:59Z.


Thanks for tracking that down. The range-diff against the previous heads only moves the fault-word conversions into the won block (through the RecordFault template), adds verifyFaultSlotClaimedFirst, and keeps the #685 rename in Dispatch.cpp; #758 is unchanged. CI agrees with your numbers: agc_driver_flat_store took 67.5 s (#757), 74.4 s (#758) and 78.4 s (#759) on the new heads, against 88.2 s on main 109a3281's own run, and agc_driver_global_vcc_base 27.6 to 30.5 s against 32.1 s.

I'll run the chain through PPSA21564 next (cold and warm shader cache) and report back here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6010062175 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6010062175). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T05:33:59Z. --- Thanks for tracking that down. The range-diff against the previous heads only moves the fault-word conversions into the `won` block (through the `RecordFault` template), adds `verifyFaultSlotClaimedFirst`, and keeps the #685 rename in `Dispatch.cpp`; #758 is unchanged. CI agrees with your numbers: `agc_driver_flat_store` took 67.5 s (#757), 74.4 s (#758) and 78.4 s (#759) on the new heads, against 88.2 s on `main` 109a3281's own run, and `agc_driver_global_vcc_base` 27.6 to 30.5 s against 32.1 s. I'll run the chain through PPSA21564 next (cold and warm shader cache) and report back here.
Celegans12 commented 2026-10-06 09:49:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T09:49:26Z.


Rebased the chain onto main 88ca57d7 after #800 (TechnicalDebt.md context only). The code patches are identical to the previous heads 12198763 / 50de2e5e / 06645dd8, so a PPSA21564 run on those still applies. Windows ctest: 359 / 359 / 360.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6013694554 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6013694554). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T09:49:26Z. --- Rebased the chain onto `main` 88ca57d7 after #800 (TechnicalDebt.md context only). The code patches are identical to the previous heads 12198763 / 50de2e5e / 06645dd8, so a PPSA21564 run on those still applies. Windows ctest: 359 / 359 / 360.
adriadam10 commented 2026-10-07 06:37:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T06:37:38Z.


@boykopovar @oneandonlydean this one needs the maintainer's call before anyone merges it.

  • It adds a runtime image/sampler descriptor ABI: runtime-sized sampled-image and sampler arrays, a map buffer, runtimeDescriptorArray/descriptorBindingPartiallyBound. It also removes #5's bindless slots and changes the disk cache format. #639 is reworking the same thing ("image/sampler optimization remain incomplete") in the same files: ResourceMaterializer.cpp, DescriptorBindingBuilder.cpp, SpirvDescriptors.hpp, ShaderDiskCache.cpp, BindlessImages.cpp.
  • It also changes main's direct binding for Uint images (point-sampler copy, like Sint), and #639 moves that same rule.
  • Checked: merged onto main a9ec7be28, build + libs + ctest pass 385/385 on Linux (RADV).

Question for @boykopovar: should this land before #639 (and #639 adopt its table ABI), or wait and be redone on top of #639's runtime descriptors? #758, #759 and #920 are stacked on it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6032451767 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6032451767). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T06:37:38Z. --- @boykopovar @oneandonlydean this one needs the maintainer's call before anyone merges it. - It adds a runtime image/sampler descriptor ABI: runtime-sized sampled-image and sampler arrays, a map buffer, `runtimeDescriptorArray`/`descriptorBindingPartiallyBound`. It also removes #5's bindless slots and changes the disk cache format. #639 is reworking the same thing ("image/sampler optimization remain incomplete") in the same files: `ResourceMaterializer.cpp`, `DescriptorBindingBuilder.cpp`, `SpirvDescriptors.hpp`, `ShaderDiskCache.cpp`, `BindlessImages.cpp`. - It also changes `main`'s direct binding for Uint images (point-sampler copy, like Sint), and #639 moves that same rule. - Checked: merged onto `main` a9ec7be28, build + `libs` + ctest pass 385/385 on Linux (RADV). Question for @boykopovar: should this land before #639 (and #639 adopt its table ABI), or wait and be redone on top of #639's runtime descriptors? #758, #759 and #920 are stacked on it.
Celegans12 commented 2026-10-07 06:43:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T06:43:45Z.


Thanks for checking it on RADV, and for raising the ordering question. That's the right call to leave to @boykopovar.

Either order works for me. If #757 lands first, I'm happy to help #639 take over the table ABI. If #639 goes first, I'll redo #757, #758, #759 and #920 on top of its runtime descriptors rather than keep a parallel path. For context, these tables are what let PPSA26344's title load run: the Tiled Decals shaders and the other table-indexed shaders there dispatch only through them today, and #920 adds the image_load reads the menu packs use.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6032529679 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6032529679). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-07T06:43:45Z. --- Thanks for checking it on RADV, and for raising the ordering question. That's the right call to leave to @boykopovar. Either order works for me. If #757 lands first, I'm happy to help #639 take over the table ABI. If #639 goes first, I'll redo #757, #758, #759 and #920 on top of its runtime descriptors rather than keep a parallel path. For context, these tables are what let PPSA26344's title load run: the Tiled Decals shaders and the other table-indexed shaders there dispatch only through them today, and #920 adds the `image_load` reads the menu packs use.
adriadam10 commented 2026-10-07 11:40:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T11:40:36Z.

Review: CHANGES_REQUESTED


The new head (c3ba8653) fails its own test on Linux, independent of the ordering question above:

  • agc_shader_memory dies with a Bus error in CI (run 37611726687); Windows passes.
  • Reproduced locally (Linux, GCC, the PR merged onto main 0d3c1eec): SIGSEGV in verifyImageTableReduction. The stack is Recompile → its error path (recompileReporting) → RequestSerializer::Serialize, which reads through an invalid pointer. So one of the Recompile calls in that test throws, and serializing the request for the message then crashes. Either the throw is unexpected, or it is the expectFailure case and the request holds a span that Serialize can't read (context.memory regions or the shader code). Both need fixing.
  • The other new tests (agc_driver_image_table, agc_driver_image_table_cache, agc_shader_disk_cache) pass here.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5441725608 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#pullrequestreview-5441725608). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T11:40:36Z. **Review:** CHANGES_REQUESTED --- The new head (c3ba8653) fails its own test on Linux, independent of the ordering question above: - `agc_shader_memory` dies with a Bus error in CI ([run 37611726687](https://github.com/boykopovar/AnyPS5/actions/runs/37611726687)); Windows passes. - Reproduced locally (Linux, GCC, the PR merged onto `main` 0d3c1eec): SIGSEGV in `verifyImageTableReduction`. The stack is `Recompile` → its error path (`recompileReporting`) → `RequestSerializer::Serialize`, which reads through an invalid pointer. So one of the `Recompile` calls in that test throws, and serializing the request for the message then crashes. Either the throw is unexpected, or it is the `expectFailure` case and the request holds a span that `Serialize` can't read (`context.memory` regions or the shader code). Both need fixing. - The other new tests (`agc_driver_image_table`, `agc_driver_image_table_cache`, `agc_shader_disk_cache`) pass here.
Celegans12 commented 2026-10-07 15:57:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T15:57:19Z.


Thanks for reproducing it and pointing at verifyImageTableReduction, that was exactly it. The crash was a bug in the test, not in the recompiler: it assigned memory.Regions(), a temporary vector, to the request's context.memory span. When the expected-failure Recompile threw, recompileReporting serialized the request through that dangling span, and on glibc the freed memory gives a non-canonical pointer, hence the bus error. The test now keeps the regions in a local vector that outlives the call.

I've pushed 586892646, rebased on current main. Linux and Windows CI both pass, and so do #758, #759 and #920 on top of it. The rebase also brought in #866's sRGB loads (8_SRGB / 8_8_SRGB table entries are poisoned as a format conversion rather than sampled without the decode), #1043's shared fault function, and #1066's per-stage limits for the table bindings. The shader cache format is now 8.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6041643392 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6041643392). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-07T15:57:19Z. --- Thanks for reproducing it and pointing at `verifyImageTableReduction`, that was exactly it. The crash was a bug in the test, not in the recompiler: it assigned `memory.Regions()`, a temporary vector, to the request's `context.memory` span. When the expected-failure `Recompile` threw, `recompileReporting` serialized the request through that dangling span, and on glibc the freed memory gives a non-canonical pointer, hence the bus error. The test now keeps the regions in a local vector that outlives the call. I've pushed 586892646, rebased on current main. Linux and Windows CI both pass, and so do #758, #759 and #920 on top of it. The rebase also brought in #866's sRGB loads (8_SRGB / 8_8_SRGB table entries are poisoned as a format conversion rather than sampled without the decode), #1043's shared fault function, and #1066's per-stage limits for the table bindings. The shader cache format is now 8.
Celegans12 commented 2026-10-07 22:50:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T22:50:18Z.


@adriadam10 this is rebased onto current main (39fafc45a, with #285, #903 and #940 in), and the Linux job passes now. The bus error from your review was the test's dangling context.memory span I described above. When you have a moment, could you take another look?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6048455428 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6048455428). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-07T22:50:18Z. --- @adriadam10 this is rebased onto current `main` (39fafc45a, with #285, #903 and #940 in), and the Linux job passes now. The bus error from your review was the test's dangling `context.memory` span I described above. When you have a moment, could you take another look?
Dextroid17 commented 2026-10-08 23:33:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T23:33:56Z.


Title evidence — this PR clears the wall a real title hits.

PPSA26344 (Ghost of Yōtei, 01.008): decrypted eboot.bin relinked, staged runtime layout (libs/ refreshed from the rebuild, app0/ pointing at the dump's resources), RTX 3080 Ti on Linux.

main (f1451396) this PR merged onto main
outcome exit 134 (SIGABRT) at presentation exit 134 — but past it
error GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x590(GetBufferResource(ReadConst(GetSrtResource, Immediate)…), IMul32(ReadConstBuffer@pc=0x258(… ShiftLeftLogical32(Phi(…) …), IAdd32(Phi(…)))…)) gone

With this PR the title gets through shader preparation — 53 shaders compiled (17.4 MiB written to the disk cache) — and dies at the next wall, which is a different one and already tracked as #1817:

computed/data-dependent s_swappc_b64 call target at program counter 0x00000074 is not statically resolvable

So this PR removes the first of two consecutive walls; it is not blocked by #1817.

Merge note for the rebase: only Optimization/src/ResourceMaterializer.cpp conflicted (main's PCK2/PCK4 packed-image handling landed after this PR's base). I resolved it as main's packed logic and error text plus the sentinel this PR's Resources.hpp uses — base.tableView != NoTableView; main's older name for the same field, indirectRoot/ImageResource::NoIndirectImage, does not exist after the merge, so the guards have to stay in the tableView spelling.

Raw logs kept (before / after). Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6071136275 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6071136275). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-08T23:33:56Z. --- Title evidence — this PR clears the wall a real title hits. **PPSA26344 (Ghost of Yōtei, 01.008)**: decrypted `eboot.bin` relinked, staged runtime layout (`libs/` refreshed from the rebuild, `app0/` pointing at the dump's resources), RTX 3080 Ti on Linux. | | `main` (`f1451396`) | this PR merged onto `main` | | --- | --- | --- | | outcome | exit 134 (SIGABRT) at presentation | exit 134 — but **past it** | | error | `GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x590(GetBufferResource(ReadConst(GetSrtResource, Immediate)…), IMul32(ReadConstBuffer@pc=0x258(… ShiftLeftLogical32(Phi(…) …), IAdd32(Phi(…)))…))` | **gone** | With this PR the title gets through shader preparation — 53 shaders compiled (17.4 MiB written to the disk cache) — and dies at the *next* wall, which is a different one and already tracked as #1817: ``` computed/data-dependent s_swappc_b64 call target at program counter 0x00000074 is not statically resolvable ``` So this PR removes the first of two consecutive walls; it is not blocked by #1817. **Merge note for the rebase:** only `Optimization/src/ResourceMaterializer.cpp` conflicted (main's PCK2/PCK4 packed-image handling landed after this PR's base). I resolved it as main's packed logic and error text plus the sentinel this PR's `Resources.hpp` uses — `base.tableView != NoTableView`; main's older name for the same field, `indirectRoot`/`ImageResource::NoIndirectImage`, does not exist after the merge, so the guards have to stay in the `tableView` spelling. Raw logs kept (before / after). Written with AI assistance.
Celegans12 commented 2026-10-08 23:35:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-08T23:35:23Z.


Thanks for running it on Yōtei. It's good to see the GetImageResource wall gone on Linux too, and your merge note matches what we saw. Heads-up: following boykopovar's guidance after #639, I'm reworking this PR on #639's runtime descriptors. It will keep compilation at registration and per-invocation data out of the cache key, and it absorbs #920's image_load support. The rework will replace this head soon, and I'll mention it here when it's up, in case you want to rerun.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6071153131 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6071153131). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-08T23:35:23Z. --- Thanks for running it on Yōtei. It's good to see the `GetImageResource` wall gone on Linux too, and your merge note matches what we saw. Heads-up: following boykopovar's guidance after #639, I'm reworking this PR on #639's runtime descriptors. It will keep compilation at registration and per-invocation data out of the cache key, and it absorbs #920's `image_load` support. The rework will replace this head soon, and I'll mention it here when it's up, in case you want to rerun.
Celegans12 commented 2026-10-09 02:31:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-09T02:31:23Z.


@adriadam10 I've reworked this on top of #639's runtime descriptors, following boykopovar's guidance, so it looks quite different from the version you reviewed. Instead of adding a parallel mechanism, it turns the bindless path into the general case: any T# or S# that s_buffer_load reads at key * stride + addend becomes a table column, and the old r256 table at key * 32 is simply stride 32. Each entry takes its mode from the artifact's own runtime mode list, the same per-entry modes #639 uses. The shader reads the mode, swizzle and element from a small map buffer, and the entries bind through one variable-count array whose layout size is a device constant.

Shaders still compile at registration, and nothing per invocation goes into the plan, specialization, pipeline or disk-cache keys. A 3-entry and a 3,000-entry table share one variant, specialization and SPIR-V. image_load works through tables too, because #920 is folded in here, so #920 can be closed. Anything that can't be exact faults when an active lane uses it, never at registration.

Could you take another look when you have time?

Details
  • Head 3b752dc7c7 on main f1451396. Runtime ABI 11, disk cache format 22.
  • Faults on use instead of throwing: stores, atomics, packed and BY2/BY4 reads, MSAA entries, unmapped records and budget overflows.
  • Corpus sweep against main: 1,209 programs that throw at registration there now register, 404 more requests compile, and none regressed.
  • PlanBuilder::Collect walks iteratively now, because deep chains overflowed its stack on main too.
  • New or reworked tests: agc_shader_bindless, agc_driver_image_table, agc_driver_image_table_cache, agc_driver_image_table_reuse and agc_driver_bindless_images. The new ones don't build on main.
  • Not tested on the GPU yet: gather through a table.
  • Overlap with #759: the fault-buffer pieces are identical. Whichever of the two lands second also has to read the fault buffer for shaders with guarded SRT slots. This PR only reads it when a table fault is expected, so #759's faults would go unread in a shader that also has an image table. It must also combine both CacheableResult conditions.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6073058468 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6073058468). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-09T02:31:23Z. --- @adriadam10 I've reworked this on top of #639's runtime descriptors, following boykopovar's guidance, so it looks quite different from the version you reviewed. Instead of adding a parallel mechanism, it turns the bindless path into the general case: any T# or S# that `s_buffer_load` reads at `key * stride + addend` becomes a table column, and the old r256 table at `key * 32` is simply stride 32. Each entry takes its mode from the artifact's own runtime mode list, the same per-entry modes #639 uses. The shader reads the mode, swizzle and element from a small map buffer, and the entries bind through one variable-count array whose layout size is a device constant. Shaders still compile at registration, and nothing per invocation goes into the plan, specialization, pipeline or disk-cache keys. A 3-entry and a 3,000-entry table share one variant, specialization and SPIR-V. `image_load` works through tables too, because #920 is folded in here, so #920 can be closed. Anything that can't be exact faults when an active lane uses it, never at registration. Could you take another look when you have time? <details><summary>Details</summary> - Head 3b752dc7c7 on `main` f1451396. Runtime ABI 11, disk cache format 22. - Faults on use instead of throwing: stores, atomics, packed and BY2/BY4 reads, MSAA entries, unmapped records and budget overflows. - Corpus sweep against `main`: 1,209 programs that throw at registration there now register, 404 more requests compile, and none regressed. - `PlanBuilder::Collect` walks iteratively now, because deep chains overflowed its stack on `main` too. - New or reworked tests: `agc_shader_bindless`, `agc_driver_image_table`, `agc_driver_image_table_cache`, `agc_driver_image_table_reuse` and `agc_driver_bindless_images`. The new ones don't build on `main`. - Not tested on the GPU yet: gather through a table. - Overlap with #759: the fault-buffer pieces are identical. Whichever of the two lands second also has to read the fault buffer for shaders with guarded SRT slots. This PR only reads it when a table fault is expected, so #759's faults would go unread in a shader that also has an image table. It must also combine both `CacheableResult` conditions. </details>
Dextroid17 commented 2026-10-09 12:18:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-09T12:18:51Z.


A second, independent implementation reaches the same conclusion for this exact title, which is worth having on record here.

sharpemu/sharpemu#926 ("Ghost of Yōtei: rendering up to the gamma screen and difficulty menu") boots PPSA26344 to gameplay, and its first shader item describes the mechanism this PR implements:

Runtime pointer-dependent resource descriptors, read through a device-address page table with a fault bitmap

That is the same shape as the fix here: the image/sampler tables live at runtime offsets and must be read through the descriptor table rather than from a fixed location. Arriving at it independently, from the same game, on a different codebase (C#/Vulkan), is decent evidence that this is the title's actual blocker and not an artefact of one emulator's design.

For completenes, the measured effect on AnyPS5 side, from my earlier comment: on main the title dies at GetImageResource dword 0 is not a valid runtime value at presentation; with this PR merged onto main it compiles 53 shaders (17.4 MiB disk cache) instead, and the next wall is #1817's s_swappc_b64 one. Their list also names the failures that come after ours ("Shared-memory phase synchronisation in multi-block shaders", "guest LDS size passed to SPIR-V"), which matches what this project still has open.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6080729041 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6080729041). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-09T12:18:51Z. --- A second, independent implementation reaches the same conclusion for this exact title, which is worth having on record here. [sharpemu/sharpemu#926](https://github.com/sharpemu/sharpemu/pull/926) ("Ghost of Yōtei: rendering up to the gamma screen and difficulty menu") boots **PPSA26344** to gameplay, and its first shader item describes the mechanism this PR implements: > Runtime pointer-dependent resource descriptors, read through a device-address page table with a fault bitmap That is the same shape as the fix here: the image/sampler tables live at runtime offsets and must be read through the descriptor table rather than from a fixed location. Arriving at it independently, from the same game, on a different codebase (C#/Vulkan), is decent evidence that this is the title's actual blocker and not an artefact of one emulator's design. For completenes, the measured effect on AnyPS5 side, from my earlier comment: on `main` the title dies at `GetImageResource dword 0 is not a valid runtime value` at presentation; with this PR merged onto `main` it compiles 53 shaders (17.4 MiB disk cache) instead, and the next wall is #1817's `s_swappc_b64` one. Their list also names the failures that come after ours ("Shared-memory phase synchronisation in multi-block shaders", "guest LDS size passed to SPIR-V"), which matches what this project still has open. Written with AI assistance.
oneandonlydean commented 2026-10-09 19:09:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T19:09:15Z.


#759 is merged now, so this conflicts with main. Could you rebase it onto current main? A full build can run once it merges cleanly.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6087503853 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6087503853). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T19:09:15Z. --- #759 is merged now, so this conflicts with main. Could you rebase it onto current main? A full build can run once it merges cleanly.
oneandonlydean commented 2026-10-10 08:06:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T08:06:02Z.


This conflicts with main again after today's merges (#2133 and #2229 among them, 7 files); please rebase.

Also, on main b7bb2684ec plus 4854d588 (Linux, RTX 4090) the new agc_driver_image_table_reuse fails, with -j4 and alone:

AGC graphics: image table reuse: a CPU write collected after earlier entries of its 64 KiB block, then two dispatches: 2 reused and 1 resolved tables, expected 1 and 2
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095512225 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6095512225). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T08:06:02Z. --- This conflicts with main again after today's merges (#2133 and #2229 among them, 7 files); please rebase. Also, on main b7bb2684ec plus 4854d588 (Linux, RTX 4090) the new `agc_driver_image_table_reuse` fails, with `-j4` and alone: ``` AGC graphics: image table reuse: a CPU write collected after earlier entries of its 64 KiB block, then two dispatches: 2 reused and 1 resolved tables, expected 1 and 2 ```
adriadam10 commented 2026-10-10 08:10:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T08:10:10Z.

Review: CHANGES_REQUESTED


Following up on @oneandonlydean's request, this still needs work before it can land:

  • It conflicts with main (checked with a merge onto current upstream/main): DepthSurface.cpp, tests/ShaderMemory.cpp, ResourceMaterializer.cpp, ShaderDiskCache.cpp/.hpp, SpirvImageEmitter.cpp and docs/dev/TechnicalDebt.md. Please rebase; the ResourceMaterializer/disk cache ones need your judgement on the table layout and format version.
  • agc_driver_image_table_reuse fails where write tracking works, as Dean reported on an RTX 4090: a CPU write collected after earlier entries of its 64 KiB block, then two dispatches: 2 reused and 1 resolved tables, expected 1 and 2. It fails the same way for us on Linux with RADV, so it is not driver-specific. Either the expected counts or the reuse logic is wrong.
  • agc_driver_bindless_images (modified by this PR) fails on RADV with vkAllocateDescriptorSets: Vulkan result -12 (pool exhausted). Please check how the descriptor pool is sized for the variable-count image/sampler arrays.

Please say which hosts you ran them on after the fix (one with write tracking, and RADV or NVIDIA). I'll do the full pass once these are green.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5478274245 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#pullrequestreview-5478274245). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T08:10:10Z. **Review:** CHANGES_REQUESTED --- Following up on @oneandonlydean's request, this still needs work before it can land: - It conflicts with `main` (checked with a merge onto current `upstream/main`): `DepthSurface.cpp`, `tests/ShaderMemory.cpp`, `ResourceMaterializer.cpp`, `ShaderDiskCache.cpp`/`.hpp`, `SpirvImageEmitter.cpp` and `docs/dev/TechnicalDebt.md`. Please rebase; the `ResourceMaterializer`/disk cache ones need your judgement on the table layout and format version. - `agc_driver_image_table_reuse` fails where write tracking works, as Dean reported on an RTX 4090: `a CPU write collected after earlier entries of its 64 KiB block, then two dispatches: 2 reused and 1 resolved tables, expected 1 and 2`. It fails the same way for us on Linux with RADV, so it is not driver-specific. Either the expected counts or the reuse logic is wrong. - `agc_driver_bindless_images` (modified by this PR) fails on RADV with `vkAllocateDescriptorSets: Vulkan result -12` (pool exhausted). Please check how the descriptor pool is sized for the variable-count image/sampler arrays. Please say which hosts you ran them on after the fix (one with write tracking, and RADV or NVIDIA). I'll do the full pass once these are green.
ponhei9502 commented 2026-10-10 09:35:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ponhei9502 on 2026-10-10T09:35:21Z.


A real-title data point for this PR, in case it helps as a test case once it is rebased.

Title / setup: Demon's Souls (PPSA01341), Linux x86-64 (CachyOS), NVIDIA RTX 3080 10 GB. Tree: main at ddcb251a plus a few local Linux fixes, none in the recompiler's resource tracking.

Failure on main: three pixel programs (0x248a6e000, 0x248a7ad00, 0x248a7e800) fail planning with

ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain:
LoadAddressU32@pc=0x00000104(GetAddressResource(ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate)),
IAdd32(ShiftLeftLogical32(FindILsb32(Phi(BitwiseOr32(ReadLane(SelectU32(INotEqual32, BitwiseOr32, DppUpdateU32), Immediate),
ReadLane(SelectU32(INotEqual32, BitwiseOr32, DppUpdateU32), Immediate)), BitwiseXor32(ShiftLeftLogical32(Immediate,
BitwiseAnd32(FindILsb32, Immediate)), Phi(BitwiseOr32(ReadLane, ReadLane), BitwiseXor32(ShiftLeftLogical32, Phi))))),
Immediate), Immediate), Immediate, Immediate)

So the T# is loaded from an SRT buffer at base + (FindILsb(lane mask) << shift) + imm, with the mask walked bit by bit in a loop — the "descriptor read at a runtime key * stride + addend offset" shape this PR describes, with the key coming from a lane-mask bit scan.

Where it surfaces: not at a draw. The title calls sceAgcCreateInterpolantMapping, which goes Driver::ResolveShaderAbi -> PrepareRegistered -> PrepareShaderWithDiagnostics, and the exception leaves on the guest thread, so the process terminates (no [videoout] presentation failed line). If ResolveShaderAbi swallows it, the next failure is prepared shader artifact is missing for the requested static ABI at the first draw using the program.

Reproduction (about 6 minutes on a warm shader cache): +ds_enableDebugStartMenu=true in PackageCmdLineArgs.txt, then Cross on "Walk Through" and Cross on "(0-1) Nexus"; it dies as the loading fog starts. The same error also ends a normal new game at character creation.

Happy to run this route against the branch after the rebase and report what the fault buffer says for these programs. (Found with an automated test loop; the details above were checked against the logs and a host-side stack trace.)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6096177518 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6096177518). Originally posted by [ponhei9502](https://github.com/ponhei9502) on 2026-10-10T09:35:21Z. --- A real-title data point for this PR, in case it helps as a test case once it is rebased. **Title / setup:** Demon's Souls (PPSA01341), Linux x86-64 (CachyOS), NVIDIA RTX 3080 10 GB. Tree: `main` at ddcb251a plus a few local Linux fixes, none in the recompiler's resource tracking. **Failure on main:** three pixel programs (0x248a6e000, 0x248a7ad00, 0x248a7e800) fail planning with ``` ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x00000104(GetAddressResource(ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate)), IAdd32(ShiftLeftLogical32(FindILsb32(Phi(BitwiseOr32(ReadLane(SelectU32(INotEqual32, BitwiseOr32, DppUpdateU32), Immediate), ReadLane(SelectU32(INotEqual32, BitwiseOr32, DppUpdateU32), Immediate)), BitwiseXor32(ShiftLeftLogical32(Immediate, BitwiseAnd32(FindILsb32, Immediate)), Phi(BitwiseOr32(ReadLane, ReadLane), BitwiseXor32(ShiftLeftLogical32, Phi))))), Immediate), Immediate), Immediate, Immediate) ``` So the T# is loaded from an SRT buffer at `base + (FindILsb(lane mask) << shift) + imm`, with the mask walked bit by bit in a loop — the "descriptor read at a runtime `key * stride + addend` offset" shape this PR describes, with the key coming from a lane-mask bit scan. **Where it surfaces:** not at a draw. The title calls `sceAgcCreateInterpolantMapping`, which goes `Driver::ResolveShaderAbi` -> `PrepareRegistered` -> `PrepareShaderWithDiagnostics`, and the exception leaves on the guest thread, so the process terminates (no `[videoout] presentation failed` line). If `ResolveShaderAbi` swallows it, the next failure is `prepared shader artifact is missing for the requested static ABI` at the first draw using the program. **Reproduction (about 6 minutes on a warm shader cache):** `+ds_enableDebugStartMenu=true` in `PackageCmdLineArgs.txt`, then Cross on "Walk Through" and Cross on "(0-1) Nexus"; it dies as the loading fog starts. The same error also ends a normal new game at character creation. Happy to run this route against the branch after the rebase and report what the fault buffer says for these programs. (Found with an automated test loop; the details above were checked against the logs and a host-side stack trace.)
Dextroid17 commented 2026-10-10 10:58:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-10T10:58:41Z.


Thank you — that is a useful data point, and it lands on the path this PR generalizes: three pixel programs failing planning with GetImageResource dword 0 is not a valid runtime value, with a chain running through a runtime-computed address (SelectU32/DppUpdateU32 lanes feeding LoadAddressU32), is the case where the descriptor is only known per invocation.

Worth knowing before you retest: main has moved under this PR, but not in the file this depends on — ResourceTracker.cpp is unchanged since ddcb251a. The descriptor-web split (#1274, SRT Phi leaves) and the 2D/3D binding reads landed before ddcb251a, so they are already in the tree you tested. The PR does conflict with main right now — nine files, including DepthSurface.cpp and tests/ShaderMemory.cpp — so a rebase comes first.

If it still fails at the PR head, the detail that would settle it is whether those three programs' resource index is an SRT slot fixed at compile time or a runtime value, since that is the split this PR makes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6096788485 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6096788485). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-10T10:58:41Z. --- Thank you — that is a useful data point, and it lands on the path this PR generalizes: three pixel programs failing planning with `GetImageResource dword 0 is not a valid runtime value`, with a chain running through a runtime-computed address (`SelectU32`/`DppUpdateU32` lanes feeding `LoadAddressU32`), is the case where the descriptor is only known per invocation. Worth knowing before you retest: `main` has moved under this PR, but **not in the file this depends on** — `ResourceTracker.cpp` is unchanged since `ddcb251a`. The descriptor-web split (#1274, SRT `Phi` leaves) and the 2D/3D binding reads landed *before* `ddcb251a`, so they are already in the tree you tested. The PR does conflict with `main` right now — nine files, including `DepthSurface.cpp` and `tests/ShaderMemory.cpp` — so a rebase comes first. If it still fails at the PR head, the detail that would settle it is whether those three programs' resource index is an SRT slot fixed at compile time or a runtime value, since that is the split this PR makes.
tv7 commented 2026-10-10 13:20:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-10T13:20:10Z.


Tested on Windows with Marvel's Wolverine (PPSA03671). This PR removes the title's stop at its first presentation.

Setup: Windows 11 Pro (10.0.26200), RTX 3070, GCC 15.2.0 UCRT (WinLibs), Release. main b69270dd9 + #1940 (b7e32b364) + the fixes from #2747 and #2748, plus local placeholders (log, return 0) for two unnamed imports (GTfJ64qFCPw Acm, zBsgF0q8DIM Pad). Then this PR (d03a55d6c) merged on top: no conflicts.

Without this PR: 17 registered shaders are deferred with GetImageResource dword 0 is not a valid runtime value, and the first presentation ends the title:

[videoout] presentation failed: compute shader 0x11d0323c00: ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x00001140(GetBufferResource(ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate)), ShiftLeftLogical32(ReadFirstLane(SelectU32(...

With this PR: no GetImageResource failures at all (0 of the 17), and the compute shader above is prepared. The title gets further and stops on a different, later error:

AGC driver: prepared shader artifact is missing for the requested static ABI: address=76505542912 stage=5 wave=64 pushOffset=128 pushCapacity=128 preparedLayouts= [128,128] [128,0]

That is a pixel shader at 0x11d015f100. The message and stage match #2621 (a registered shader drawn under a context its registration did not prepare), but I haven't checked that the cause is the same here.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6097924665 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6097924665). Originally posted by [tv7](https://github.com/tv7) on 2026-10-10T13:20:10Z. --- Tested on Windows with Marvel's Wolverine (PPSA03671). This PR removes the title's stop at its first presentation. **Setup:** Windows 11 Pro (10.0.26200), RTX 3070, GCC 15.2.0 UCRT (WinLibs), Release. `main` b69270dd9 + #1940 (b7e32b364) + the fixes from #2747 and #2748, plus local placeholders (log, return 0) for two unnamed imports (`GTfJ64qFCPw` Acm, `zBsgF0q8DIM` Pad). Then this PR (d03a55d6c) merged on top: no conflicts. **Without this PR:** 17 registered shaders are deferred with `GetImageResource dword 0 is not a valid runtime value`, and the first presentation ends the title: ``` [videoout] presentation failed: compute shader 0x11d0323c00: ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x00001140(GetBufferResource(ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate)), ShiftLeftLogical32(ReadFirstLane(SelectU32(... ``` **With this PR:** no `GetImageResource` failures at all (0 of the 17), and the compute shader above is prepared. The title gets further and stops on a different, later error: ``` AGC driver: prepared shader artifact is missing for the requested static ABI: address=76505542912 stage=5 wave=64 pushOffset=128 pushCapacity=128 preparedLayouts= [128,128] [128,0] ``` That is a pixel shader at `0x11d015f100`. The message and stage match #2621 (a registered shader drawn under a context its registration did not prepare), but I haven't checked that the cause is the same here. *Tested and written by Claude (AI assistant) on a contributor's machine.*
Scramblrrrr commented 2026-10-10 17:41:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-10T17:41:15Z.


I am cross-testing this and #758 against 007 First Light (PPSA11386), coordinating on #2523. I have fetched exact heads 9e5fcf29 / c38d9ccd, now cleanly based on main 57f96fd2, and am building an isolated Windows / NVIDIA candidate. The local 18,960-key request and original export stay on this machine; no title data will be uploaded.

I had a narrower dense sampled-table WIP before seeing these updates (https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-wide-integration), but it retains static 16-slot expansion and does not solve all hidden static capacity failures. I am testing your broader runtime implementation before extending that overlap. I will report exact heads, configuration, focused tests, and the next game stop on #2523.

AI-assisted cross-test (Codex).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100368031 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6100368031). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-10T17:41:15Z. --- I am cross-testing this and #758 against 007 First Light (PPSA11386), coordinating on #2523. I have fetched exact heads **9e5fcf29 / c38d9ccd**, now cleanly based on main **57f96fd2**, and am building an isolated Windows / NVIDIA candidate. The local 18,960-key request and original export stay on this machine; no title data will be uploaded. I had a narrower dense sampled-table WIP before seeing these updates (https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-wide-integration), but it retains static 16-slot expansion and does not solve all hidden static capacity failures. I am testing your broader runtime implementation before extending that overlap. I will report exact heads, configuration, focused tests, and the next game stop on #2523. AI-assisted cross-test (Codex).
TheAggie commented 2026-10-10 19:06:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-10T19:06:42Z.


@Celegans12 Tested #757 (9e5fcf29) and #758 (c38d9ccd) with RetroArch's Dolphin core (homebrew RetroArch, PPSA99169) in ubershader mode (dolphin_shader_compilation_mode = 2), running the GameCube 240p Test Suite. On Windows 11, NVIDIA RTX 5070 Ti, MinGW-w64 GCC 15.2.

Without them: planning stops at

GetImageResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x0000020c(GetAddressResource(GetUserData(Void), Immediate), IMul32(ShiftRightLogical32(ShiftLeftLogical32(ShiftRightLogical32(ReadConstBuffer@pc=0x00000198(...), ...

That is, a T# read through a user-data pointer at an offset of key * stride, where the key is a bitfield of a constant-buffer value (the ubershader takes its texture slot from a uniform).

  • #757 alone: the same error.
  • #757 + #758: planning goes through.

One gap in sampler tables: with both PRs, every draw then stops at

AGC graphics: guest sampler descriptor requests a LOD bias beyond the device limit

from addSamplerTable → SamplerCache::Get → DecodeSamplerResource → Sampler::Sampler. The entry decodes to a LOD bias of 28.26; the device limit (maxSamplerLodBias) is 15 here.

  • Where it slips through: addSamplerTable's first pass rejects entries one by one inside its try (opaque-black border, non-seamless cube, ANISO_OVERRIDE). The device-limit checks are in the Sampler constructor, which runs in the second pass, outside it. So an entry with an out-of-range bias passes validation and then fails the whole draw, instead of becoming a per-entry rejection that faults only when a lane selects it.
  • Local fix: I added one line to the first pass:
    Require(resource.lodBias >= -context.limits.maxSamplerLodBias && resource.lodBias <= context.limits.maxSamplerLodBias, "a sampler table entry requests a LOD bias beyond the device limit");
    
    With it, two 100 s runs in ubershader mode had no stop, and the suite's intro screen renders through the ubershaders (very slowly, about 0.2 FPS; I haven't looked into that).
  • Same class: the other Sampler constructor checks (anisotropy support and ratio, unnormalized coordinates with comparison) probably belong in the first pass for the same reason. I only hit the LOD bias one.

Caveats:

  • Not current main: this is my integration branch, a main from 2026-10-07 plus my open PRs, #423 and local changes. RetroArch can't run the Dolphin core on main alone yet.
  • Merge: I cherry-picked both PRs. #757 conflicted in the ValidateShaders/Inspect parameter lists (next to #423's clip/cull flags; I kept your runtimeDescriptorArray position), the ShaderDiskCache sizes and format version (took yours), and its ShaderDiskCache.cpp test. That test compares bufferRead, which my older base doesn't have, so I dropped that one comparison locally. #758 applied cleanly on top.
  • Tests: agc_driver_graphics, shader_disk_cache, shader_memory and the clip/cull tests pass on that branch.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101135304 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6101135304). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-10T19:06:42Z. --- @Celegans12 Tested #757 (9e5fcf29) and #758 (c38d9ccd) with RetroArch's Dolphin core (homebrew RetroArch, PPSA99169) in ubershader mode (`dolphin_shader_compilation_mode = 2`), running the GameCube 240p Test Suite. On Windows 11, NVIDIA RTX 5070 Ti, MinGW-w64 GCC 15.2. **Without them:** planning stops at ``` GetImageResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x0000020c(GetAddressResource(GetUserData(Void), Immediate), IMul32(ShiftRightLogical32(ShiftLeftLogical32(ShiftRightLogical32(ReadConstBuffer@pc=0x00000198(...), ... ``` That is, a T# read through a user-data pointer at an offset of key * stride, where the key is a bitfield of a constant-buffer value (the ubershader takes its texture slot from a uniform). - **#757 alone:** the same error. - **#757 + #758:** planning goes through. **One gap in sampler tables:** with both PRs, every draw then stops at ``` AGC graphics: guest sampler descriptor requests a LOD bias beyond the device limit ``` from `addSamplerTable` → `SamplerCache::Get` → `DecodeSamplerResource` → `Sampler::Sampler`. The entry decodes to a LOD bias of 28.26; the device limit (`maxSamplerLodBias`) is 15 here. - **Where it slips through:** `addSamplerTable`'s first pass rejects entries one by one inside its `try` (opaque-black border, non-seamless cube, `ANISO_OVERRIDE`). The device-limit checks are in the `Sampler` constructor, which runs in the second pass, outside it. So an entry with an out-of-range bias passes validation and then fails the whole draw, instead of becoming a per-entry rejection that faults only when a lane selects it. - **Local fix:** I added one line to the first pass: ```cpp Require(resource.lodBias >= -context.limits.maxSamplerLodBias && resource.lodBias <= context.limits.maxSamplerLodBias, "a sampler table entry requests a LOD bias beyond the device limit"); ``` With it, two 100 s runs in ubershader mode had no stop, and the suite's intro screen renders through the ubershaders (very slowly, about 0.2 FPS; I haven't looked into that). - **Same class:** the other `Sampler` constructor checks (anisotropy support and ratio, unnormalized coordinates with comparison) probably belong in the first pass for the same reason. I only hit the LOD bias one. **Caveats:** - **Not current `main`:** this is my integration branch, a `main` from 2026-10-07 plus my open PRs, #423 and local changes. RetroArch can't run the Dolphin core on `main` alone yet. - **Merge:** I cherry-picked both PRs. #757 conflicted in the `ValidateShaders`/`Inspect` parameter lists (next to #423's clip/cull flags; I kept your `runtimeDescriptorArray` position), the `ShaderDiskCache` sizes and format version (took yours), and its `ShaderDiskCache.cpp` test. That test compares `bufferRead`, which my older base doesn't have, so I dropped that one comparison locally. #758 applied cleanly on top. - **Tests:** `agc_driver_graphics`, `shader_disk_cache`, `shader_memory` and the clip/cull tests pass on that branch. AI-assisted (Claude Code).
Dextroid17 commented 2026-10-10 19:40:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-10T19:40:02Z.

Review: COMMENTED


Following @TheAggie's run — the sampler wall it exposes is diagnosable from the code, so here is what the numbers mean.

The guest LOD bias is a 14-bit signed fixed-point 6.8 field: toSignedLodBias sign-extends the 14 bits and divides by 256 (Graphics/src/GuestSamplerResource.cpp:50, field extracted at :80), and the decoder test builds its fixtures from the same encoding (tests/GuestSamplerResource.cpp:54). So a reported bias of 28.26 is a raw value near 7236 — inside the field's own range, and decoded as designed.

That splits the next step in two, and the difference matters:

  1. Is that the right descriptor at all? A bias of 28 is enormous, and an ubershader that takes its texture slot from a uniform (key * stride) is exactly the place where a descriptor read from the wrong offset shows up as a plausible-looking number sitting in the wrong field. The cheap way to settle it: log the four raw S# dwords at the point of refusal and check they parse as a sampler descriptor at all — border colour, filters and min/max LOD sane. If they do not, the fix belongs in the descriptor lookup, not in the limit check.
  2. If it is the right descriptor, then it is a policy question rather than a decode bug. The console applies the bias; Vulkan cannot express one past maxSamplerLodBias (15 on this device), and Graphics/src/Sampler.cpp:12 refuses rather than silently changing the result. Clamping would draw something, but it would deviate from what the guest asked for without saying so — so that choice wants either a TechnicalDebt entry naming this title and this log line, or a decision from the maintainers.

Nothing here is a reason to hold #757 or #758: the wall is downstream of them, and their leaving planning is what exposes it.

Two limits on this: I cannot reproduce the run — no AMD hardware here (lavapipe only) and no Dolphin/RetroArch setup — and I have not found an issue covering this sampler wall. The closest existing work is merged #934 (LOD biases in colour-comparison sampling), which handles LOD biases on a different path and does not cover this refusal — so if point 1 turns out to be a misread, it is worth its own report with the title and log line.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5480549480 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#pullrequestreview-5480549480). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-10T19:40:02Z. **Review:** COMMENTED --- Following @TheAggie's run — the sampler wall it exposes is diagnosable from the code, so here is what the numbers mean. The guest LOD bias is a 14-bit signed fixed-point 6.8 field: `toSignedLodBias` sign-extends the 14 bits and divides by 256 (`Graphics/src/GuestSamplerResource.cpp:50`, field extracted at `:80`), and the decoder test builds its fixtures from the same encoding (`tests/GuestSamplerResource.cpp:54`). So a reported bias of 28.26 is a raw value near 7236 — inside the field's own range, and decoded as designed. That splits the next step in two, and the difference matters: 1. **Is that the right descriptor at all?** A bias of 28 is enormous, and an ubershader that takes its texture slot from a uniform (`key * stride`) is exactly the place where a descriptor read from the wrong offset shows up as a plausible-looking number sitting in the wrong field. The cheap way to settle it: log the four raw S# dwords at the point of refusal and check they parse as a sampler descriptor at all — border colour, filters and min/max LOD sane. If they do not, the fix belongs in the descriptor lookup, not in the limit check. 2. **If it is the right descriptor**, then it is a policy question rather than a decode bug. The console applies the bias; Vulkan cannot express one past `maxSamplerLodBias` (15 on this device), and `Graphics/src/Sampler.cpp:12` refuses rather than silently changing the result. Clamping would draw something, but it would deviate from what the guest asked for without saying so — so that choice wants either a TechnicalDebt entry naming this title and this log line, or a decision from the maintainers. Nothing here is a reason to hold #757 or #758: the wall is downstream of them, and their leaving planning is what exposes it. Two limits on this: I cannot reproduce the run — no AMD hardware here (lavapipe only) and no Dolphin/RetroArch setup — and I have not found an *issue* covering this sampler wall. The closest existing work is merged #934 (LOD biases in colour-comparison sampling), which handles LOD biases on a different path and does not cover this refusal — so if point 1 turns out to be a misread, it is worth its own report with the title and log line. Written with AI assistance.
EdouardSence commented 2026-10-10 20:00:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-10T20:00:05Z.


Tested with Ghost of Yōtei (PPSA26344) on RADV. This PR (through #758) gets past the analysis stop in #2715, then the same shader stops on a RADV descriptor allocation that looks fixable here.

Setup: CachyOS (kernel 7.2.9), RX 9070 XT (RDNA4), RADV / Mesa 26.2.4, Release, headless gamescope with scripted input. Main 4a747c487 + #1940 (operand 235) + #758 (which contains this PR's 9e5fcf29a) + Pipodi's 44a80d4f (relocated header copies, #1837).

Before (main + #1940 + 44a80d4f): about 26 s in, compute shader 0x80003aa700: GetImageResource dword 0 is not a valid runtime value (#2715).

With #757/#758: that analysis stop is gone. About 25 s in, the same shader stops on:

compute shader 0x80003aa700: AGC graphics: vkAllocateDescriptorSets: Vulkan result -1000069000

A local print (not pushed) in DescriptorCache::Allocate and before it:

main layout table=8 tableElements=0 planned sampled=6 storage=3: [b0 type7 count3] [b3 type2 count4] [b10 type2 count2] [b31 type3 count3] [b60 type7 count1] [b61 type7 count1] [b63 type0 count1024 flags0x4] [b64 type7 count1] [b260 type2 count262144 flags0xc]
dedicated alloc failed -1000069000 uab=0 variable=1/0 sizes: type7=6 type2=6 type3=3 type0=1024

So the 1024-sampler table pushes the set onto the dedicated, exactly-sized pool. The image table binding (b260, VARIABLE_DESCRIPTOR_COUNT, max 262144) is allocated with a variable count of 0, because this dispatch's table has no elements.

RADV does not shrink the set for a variable count of 0. In radv_descriptor_set_create (Mesa main, src/amd/vulkan/radv_descriptor_set.c):

uint32_t layout_size = layout->size;
if (variable_count) {
   ...
   layout_size = layout->binding[layout->binding_count - 1].offset + variable_count * stride;
}

A count of 0 takes layout->size, the size with all 262144 image descriptors, which the exactly-sized pool can't hold.

What I measured, one change at a time on the dedicated path:

change result
none VK_ERROR_OUT_OF_POOL_MEMORY
pool sizes +16 or +64 of every type same
pool created with FREE_DESCRIPTOR_SET_BIT VK_ERROR_FRAGMENTED_POOL
sampled-image pool size +262144 allocates
variable count max(1, n) and sampled-image pool size +1, nothing else allocates

With the last one the title goes on to the next shader, 0x8000265d00: unnormalized guest sampler is used with a texel offset, which is not implemented, which is what #822 targets. #822 conflicts with #758 in PipelineSpecialization.hpp and Resources.hpp, so I did not stack it.

So a small change here would avoid the RADV case: when the table has no elements, allocate the variable binding with a count of 1 and size the pool for it (one more sampled image). The same applies to the non-cached path that calls CreateSetPool with the same variableCount. I haven't checked other drivers' handling of a 0 count; on NVIDIA this path may never fail.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101612646 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6101612646). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-10T20:00:05Z. --- Tested with Ghost of Yōtei (PPSA26344) on RADV. This PR (through #758) gets past the analysis stop in #2715, then the same shader stops on a RADV descriptor allocation that looks fixable here. **Setup:** CachyOS (kernel 7.2.9), RX 9070 XT (RDNA4), RADV / Mesa 26.2.4, Release, headless gamescope with scripted input. Main `4a747c487` + #1940 (operand 235) + #758 (which contains this PR's `9e5fcf29a`) + Pipodi's `44a80d4f` (relocated header copies, #1837). **Before (main + #1940 + `44a80d4f`):** about 26 s in, `compute shader 0x80003aa700: GetImageResource dword 0 is not a valid runtime value` (#2715). **With #757/#758:** that analysis stop is gone. About 25 s in, the same shader stops on: ``` compute shader 0x80003aa700: AGC graphics: vkAllocateDescriptorSets: Vulkan result -1000069000 ``` A local print (not pushed) in `DescriptorCache::Allocate` and before it: ``` main layout table=8 tableElements=0 planned sampled=6 storage=3: [b0 type7 count3] [b3 type2 count4] [b10 type2 count2] [b31 type3 count3] [b60 type7 count1] [b61 type7 count1] [b63 type0 count1024 flags0x4] [b64 type7 count1] [b260 type2 count262144 flags0xc] dedicated alloc failed -1000069000 uab=0 variable=1/0 sizes: type7=6 type2=6 type3=3 type0=1024 ``` So the 1024-sampler table pushes the set onto the dedicated, exactly-sized pool. The image table binding (`b260`, `VARIABLE_DESCRIPTOR_COUNT`, max 262144) is allocated with a **variable count of 0**, because this dispatch's table has no elements. RADV does not shrink the set for a variable count of 0. In `radv_descriptor_set_create` (Mesa main, `src/amd/vulkan/radv_descriptor_set.c`): ```c uint32_t layout_size = layout->size; if (variable_count) { ... layout_size = layout->binding[layout->binding_count - 1].offset + variable_count * stride; } ``` A count of 0 takes `layout->size`, the size with all 262144 image descriptors, which the exactly-sized pool can't hold. What I measured, one change at a time on the dedicated path: | change | result | |---|---| | none | `VK_ERROR_OUT_OF_POOL_MEMORY` | | pool sizes +16 or +64 of every type | same | | pool created with `FREE_DESCRIPTOR_SET_BIT` | `VK_ERROR_FRAGMENTED_POOL` | | sampled-image pool size +262144 | allocates | | variable count `max(1, n)` and sampled-image pool size +1, nothing else | allocates | With the last one the title goes on to the next shader, `0x8000265d00`: `unnormalized guest sampler is used with a texel offset, which is not implemented`, which is what #822 targets. #822 conflicts with #758 in `PipelineSpecialization.hpp` and `Resources.hpp`, so I did not stack it. So a small change here would avoid the RADV case: when the table has no elements, allocate the variable binding with a count of 1 and size the pool for it (one more sampled image). The same applies to the non-cached path that calls `CreateSetPool` with the same `variableCount`. I haven't checked other drivers' handling of a 0 count; on NVIDIA this path may never fail. *Tested and written by Claude (AI assistant) on a contributor's machine.*
ponhei9502 commented 2026-10-10 20:25:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ponhei9502 on 2026-10-10T20:25:05Z.


Follow-up to my comment above, as promised: I ran the Demon's Souls (PPSA01341) debug-menu route against this branch after the rebase.

Tree: main 3cb317fc + this PR at 9e5fcf29 + #425 at d6088bed, plus local Linux fixes outside the recompiler's resource tracking. Linux x86-64, RTX 3080, NVIDIA 615.78.08, Release, ANYPS5_ENABLE_SPIRV_TOOLS=OFF. Cold shader cache, one run.

Result: the same three pixel programs still fail planning with the same text, so this shape is not covered yet:

ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain:
LoadAddressU32@pc=0x00000104(GetAddressResource(ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate)),
IAdd32(ShiftLeftLogical32(FindILsb32(Phi(BitwiseOr32(ReadLane(SelectU32(INotEqual32, BitwiseOr32, DppUpdateU32), Immediate),
ReadLane(...)), BitwiseXor32(ShiftLeftLogical32(Immediate, BitwiseAnd32(FindILsb32, Immediate)), Phi(...)))), Immediate), Immediate), Immediate, Immediate)

Counts for one run up to the level load: 97 failed preparations across the three programs (0x848a6e000: 39, 0x848a7e800: 38, 0x848a7ad00: 20), all through sceAgcCreateInterpolantMapping -> Driver::ResolveShaderAbi / ResolveGraphicsAbi.

What differs from the cases in the description, as far as I can read the chain: the table key is not a value read from a buffer but FindILsb32 of a lane mask that is built with ReadLane and consumed one bit per loop iteration (the Phi / BitwiseXor32(1 << bit) pair), and the heap offset is (key << shift) + immediate. On main before this PR (yesterday, not reached in today's run because it stops earlier now) a further program failed the same way at pc=0x00000288 with Phi(Immediate, IAdd32(Phi(...))) as the key, i.e. a plain loop counter; I have not re-tested that one on this branch.

I can capture whatever helps (the shader bytes, the SRT buffer contents at dispatch, a trace option) and re-run on request.

Pointer, in case it is useful (added later): SharpEmu handles this exact shape as a finite selector. src/SharpEmu.ShaderCompiler/Resources/ResourceTracker.DenseImages.cs (TryCreateWaveIndexedImageSelector, comment above it) describes it as "post-process kernels select a descriptor per active bit in a scalar mask: mask -> s_ff1 -> v_mov -> (bit * stride + table) -> global_load -> v_readfirstlane -> key << 5 -> s_load_dwordx8", and resolves the key set on the host from the mask and the index table (mask offset, index data offset, index stride), with WaveMaskSelectorBounds.cs proving the mask's range. Demon's Souls is one of the titles it was written for. GPL-2.0-or-later.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101827197 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6101827197). Originally posted by [ponhei9502](https://github.com/ponhei9502) on 2026-10-10T20:25:05Z. --- Follow-up to my comment above, as promised: I ran the Demon's Souls (PPSA01341) debug-menu route against this branch after the rebase. **Tree:** `main` 3cb317fc + this PR at 9e5fcf29 + #425 at d6088bed, plus local Linux fixes outside the recompiler's resource tracking. Linux x86-64, RTX 3080, NVIDIA 615.78.08, Release, `ANYPS5_ENABLE_SPIRV_TOOLS=OFF`. Cold shader cache, one run. **Result:** the same three pixel programs still fail planning with the same text, so this shape is not covered yet: ``` ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x00000104(GetAddressResource(ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate)), IAdd32(ShiftLeftLogical32(FindILsb32(Phi(BitwiseOr32(ReadLane(SelectU32(INotEqual32, BitwiseOr32, DppUpdateU32), Immediate), ReadLane(...)), BitwiseXor32(ShiftLeftLogical32(Immediate, BitwiseAnd32(FindILsb32, Immediate)), Phi(...)))), Immediate), Immediate), Immediate, Immediate) ``` Counts for one run up to the level load: 97 failed preparations across the three programs (0x848a6e000: 39, 0x848a7e800: 38, 0x848a7ad00: 20), all through `sceAgcCreateInterpolantMapping` -> `Driver::ResolveShaderAbi` / `ResolveGraphicsAbi`. What differs from the cases in the description, as far as I can read the chain: the table key is not a value read from a buffer but `FindILsb32` of a lane mask that is built with `ReadLane` and consumed one bit per loop iteration (the `Phi` / `BitwiseXor32(1 << bit)` pair), and the heap offset is `(key << shift) + immediate`. On `main` before this PR (yesterday, not reached in today's run because it stops earlier now) a further program failed the same way at `pc=0x00000288` with `Phi(Immediate, IAdd32(Phi(...)))` as the key, i.e. a plain loop counter; I have not re-tested that one on this branch. I can capture whatever helps (the shader bytes, the SRT buffer contents at dispatch, a trace option) and re-run on request. **Pointer, in case it is useful (added later):** SharpEmu handles this exact shape as a finite selector. `src/SharpEmu.ShaderCompiler/Resources/ResourceTracker.DenseImages.cs` (`TryCreateWaveIndexedImageSelector`, comment above it) describes it as "post-process kernels select a descriptor per active bit in a scalar mask: mask -> s_ff1 -> v_mov -> (bit * stride + table) -> global_load -> v_readfirstlane -> key << 5 -> s_load_dwordx8", and resolves the key set on the host from the mask and the index table (mask offset, index data offset, index stride), with `WaveMaskSelectorBounds.cs` proving the mask's range. Demon's Souls is one of the titles it was written for. GPL-2.0-or-later. AI-assisted: yes
Dextroid17 commented 2026-10-10 21:42:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-10T21:42:29Z.

Review: COMMENTED


Following @EdouardSence's report — the path he instrumented is in ShaderResources.cpp, and both halves of the mismatch are visible there.

  • The image table binding is declared with the layout's capacity as its descriptorCount, with VARIABLE_DESCRIPTOR_COUNT_BIT: line 1489 (context.imageTableCapacity, 262144 in his dump).
  • The pool is sized from the actual elements, not that capacity: line 1527 tableDescriptors = min(tableElements, imageTableCapacity) and line 1528 plannedSampledImages + tableDescriptors.
  • The allocation passes variableCount.value_or(0u) — line 1543, and line 2814 on the path he saw: a table with no elements passes a variable count of 0.
  • Line 2822 guards the dedicated pool from his "dedicated alloc failed" line (it is created at 2824): when a set does not fit a shared pool, it gets its own, sized exactly as above.

So the request is a variable binding of length 0 with a pool sized for 0, while RADV charges the layout's full size for that request. The request itself is legal: VkDescriptorSetVariableDescriptorCountAllocateInfo says "If descriptorSetCount is zero or this structure is not included in the pNext chain, then the variable lengths are considered to be zero" — a zero length is a defined state, and the spec does not forbid an implementation charging the layout's size for it. That is why it only bites on RADV: nothing here is invalid, and the pool is simply what runs out.

Two ways to close it, and his experiment already chose between them:

  • size the pool by the layout capacity for variable bindings — that is his "+262144" row, and it costs 262144 image descriptors per set;
  • pass max(1, variableCount) and add the matching +1 to the pool — his last row: allocates, and costs one descriptor.

The second is the one I would argue for: the declared capacity is an upper bound, not a demand, and a fix that depends on the driver shrinking the set for a zero count is the fragile one. His table shows the zero count is precisely the case that costs the full layout on RADV.

Whether Mesa's choice is worth a report on its own is a separate question — the request is legal either way, and this side can stop paying for it in one line.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5480904145 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#pullrequestreview-5480904145). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-10T21:42:29Z. **Review:** COMMENTED --- Following @EdouardSence's report — the path he instrumented is in `ShaderResources.cpp`, and both halves of the mismatch are visible there. - The image table binding is declared with the layout's capacity as its `descriptorCount`, with `VARIABLE_DESCRIPTOR_COUNT_BIT`: line **1489** (`context.imageTableCapacity`, 262144 in his dump). - The pool is sized from the **actual** elements, not that capacity: line **1527** `tableDescriptors = min(tableElements, imageTableCapacity)` and line **1528** `plannedSampledImages + tableDescriptors`. - The allocation passes `variableCount.value_or(0u)` — line **1543**, and line **2814** on the path he saw: a table with no elements passes a variable count of **0**. - Line **2822** guards the `dedicated` pool from his "dedicated alloc failed" line (it is created at **2824**): when a set does not fit a shared pool, it gets its own, sized exactly as above. So the request is a variable binding of length **0** with a pool sized for 0, while RADV charges the layout's full size for that request. The request itself is legal: `VkDescriptorSetVariableDescriptorCountAllocateInfo` says *"If descriptorSetCount is zero or this structure is not included in the pNext chain, then the variable lengths are considered to be zero"* — a zero length is a defined state, and the spec does not forbid an implementation charging the layout's size for it. That is why it only bites on RADV: nothing here is invalid, and the pool is simply what runs out. Two ways to close it, and his experiment already chose between them: - size the pool by the layout capacity for variable bindings — that is his "+262144" row, and it costs 262144 image descriptors per set; - pass `max(1, variableCount)` and add the matching +1 to the pool — his last row: allocates, and costs one descriptor. The second is the one I would argue for: the declared capacity is an upper bound, not a demand, and a fix that depends on the driver shrinking the set for a zero count is the fragile one. His table shows the zero count is precisely the case that costs the full layout on RADV. Whether Mesa's choice is worth a report on its own is a separate question — the request is legal either way, and this side can stop paying for it in one line. Written with AI assistance.
adriadam10 commented 2026-10-10 22:14:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:14:21Z.

Review: CHANGES_REQUESTED


The head now merges cleanly with main. Two test problems remain:

  • agc_driver_bindless_images fails on RADV (merged onto current main, Linux): vkAllocateDescriptorSets: Vulkan result -12. This PR modifies that test, and the description says the pool failure is unresolved. @EdouardSence's report on an RX 9070 XT points at the table binding declaring imageTableCapacity descriptors with VARIABLE_DESCRIPTOR_COUNT while the pool is sized from the actual elements (ShaderResources.cpp). Please fix it here or drop the test change, so the test is green on RADV.
  • agc_driver_image_table_reuse fails on @oneandonlydean's RTX 4090 (2 reused and 1 resolved tables, expected 1 and 2, alone and with -j4). It passes here on RADV with write tracking, so please check whether your current head still fails on NVIDIA and make the expectation not depend on the driver.

Please re-run both on the new head and post the result.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5480994978 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#pullrequestreview-5480994978). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T22:14:21Z. **Review:** CHANGES_REQUESTED --- The head now merges cleanly with `main`. Two test problems remain: - `agc_driver_bindless_images` fails on RADV (merged onto current `main`, Linux): `vkAllocateDescriptorSets: Vulkan result -12`. This PR modifies that test, and the description says the pool failure is unresolved. @EdouardSence's report on an RX 9070 XT points at the table binding declaring `imageTableCapacity` descriptors with `VARIABLE_DESCRIPTOR_COUNT` while the pool is sized from the actual elements (`ShaderResources.cpp`). Please fix it here or drop the test change, so the test is green on RADV. - `agc_driver_image_table_reuse` fails on @oneandonlydean's RTX 4090 (`2 reused and 1 resolved tables, expected 1 and 2`, alone and with `-j4`). It passes here on RADV with write tracking, so please check whether your current head still fails on NVIDIA and make the expectation not depend on the driver. Please re-run both on the new head and post the result.
Tamalero commented 2026-10-11 08:06:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-11T08:06:33Z.


Tested #757 + #758 on Marvel's Guardians of the Galaxy (PPSA01748), the second title I reported on #2715. They fix its stop: the three shaders that compute the T# index from a loop counter now prepare, including the one the title dispatches (pc=0x588), so that abort is gone. The run now ends at about the same time on something unrelated (CB metadata pass with depth or stencil work, an AGC check), so the PRs did their part.

Details

Setup: CachyOS (Linux 7.2), RTX 4090 (NVIDIA 615.78), GCC, Release. main f5c0fe00 plus my local integration patches. The ones Guardians needs to start are PlayGo chunk ids #3238, null indirect base #3239, sysmodule ids #3240/#2541 and offline sceNpGetUserIdByAccountId #2852; the others are for Ratchet (#3158, #3283). 9e5fcf29 and c38d9ccd are cherry-picked on top.

Rebasing onto current main: both commits conflict, all small:

  • ResourcePlan.hpp, ResourceTracker.cpp (members) and Recompiler.cpp: both sides added fields or code. I kept both, and kept main's + snapshot.nullRootReads in poisonedSrtReads.
  • ResourceMaterializer.cpp: EvaluateRuntimeSources now takes &snapshot.nullRootReads. In TryRuntimeImageMode I kept your reject(reason, …) structure and passed main's newer detailed incompatibility message (formats, modes, T# words) as the detail.
  • #758's ResourceTracker.cpp: main already has a newer MemoryIndexBelongsTo (with the m_memoryUsers index), so I kept that and added only ScalarAddressMemory. The member m_indirectImages had to go, since #757 replaces IndirectImagePlan.

The PR's tests pass on that tree: agc_driver_image_table, _image_table_cache, _image_table_reuse, agc_driver_runtime_images, agc_driver_bindless_images, agc_shader_bindless, agc_shader_memory.

Guardians, before → after:

main + local fixes + #757/#758
Shaders failing GetImageResource dword 0 is not a valid runtime value 6 3
Loop-counter index (pc=0x588, 0x5d4, 0x974) fail; 0x588 is dispatched and aborts prepared
Lane-waterfall index through an ImageRead (pc=0x4378, 0x4380 ×2) fail still fail (not dispatched)
End of run abort at ~74 s on pc=0x588 abort at ~71 s on CB metadata pass with depth or stencil work

The new stop is DecodeColorMetadataPass (State.cpp) requiring DB_DEPTH_CONTROL & 0xf and DB_RENDER_CONTROL & 0xf to be zero for an eliminate-fast-clear / DCC-decompress pass. That is unrelated to this PR. I have since fixed it and three later stops locally (an always-pass depth test in that pass, D16_UNORM_S8_UINT on NVIDIA, #2975, and BLEND_BYPASS). With those plus these two PRs, Guardians gets past its loading screen into its first UI screen.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106967414 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6106967414). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-11T08:06:33Z. --- Tested #757 + #758 on **Marvel's Guardians of the Galaxy** (PPSA01748), the second title I reported on #2715. They fix its stop: the three shaders that compute the T# index from a loop counter now prepare, including the one the title dispatches (`pc=0x588`), so that abort is gone. The run now ends at about the same time on something unrelated (`CB metadata pass with depth or stencil work`, an AGC check), so the PRs did their part. <details><summary>Details</summary> **Setup:** CachyOS (Linux 7.2), RTX 4090 (NVIDIA 615.78), GCC, Release. `main` `f5c0fe00` plus my local integration patches. The ones Guardians needs to start are PlayGo chunk ids #3238, null indirect base #3239, sysmodule ids #3240/#2541 and offline `sceNpGetUserIdByAccountId` #2852; the others are for Ratchet (#3158, #3283). 9e5fcf29 and c38d9ccd are cherry-picked on top. **Rebasing onto current `main`:** both commits conflict, all small: - `ResourcePlan.hpp`, `ResourceTracker.cpp` (members) and `Recompiler.cpp`: both sides added fields or code. I kept both, and kept `main`'s `+ snapshot.nullRootReads` in `poisonedSrtReads`. - `ResourceMaterializer.cpp`: `EvaluateRuntimeSources` now takes `&snapshot.nullRootReads`. In `TryRuntimeImageMode` I kept your `reject(reason, …)` structure and passed `main`'s newer detailed incompatibility message (formats, modes, T# words) as the detail. - #758's `ResourceTracker.cpp`: `main` already has a newer `MemoryIndexBelongsTo` (with the `m_memoryUsers` index), so I kept that and added only `ScalarAddressMemory`. The member `m_indirectImages` had to go, since #757 replaces `IndirectImagePlan`. The PR's tests pass on that tree: `agc_driver_image_table`, `_image_table_cache`, `_image_table_reuse`, `agc_driver_runtime_images`, `agc_driver_bindless_images`, `agc_shader_bindless`, `agc_shader_memory`. **Guardians, before → after:** | | `main` + local fixes | + #757/#758 | |---|---|---| | Shaders failing `GetImageResource dword 0 is not a valid runtime value` | 6 | 3 | | Loop-counter index (`pc=0x588`, `0x5d4`, `0x974`) | fail; `0x588` is dispatched and aborts | prepared | | Lane-waterfall index through an `ImageRead` (`pc=0x4378`, `0x4380` ×2) | fail | still fail (not dispatched) | | End of run | abort at ~74 s on `pc=0x588` | abort at ~71 s on `CB metadata pass with depth or stencil work` | The new stop is `DecodeColorMetadataPass` (`State.cpp`) requiring `DB_DEPTH_CONTROL & 0xf` and `DB_RENDER_CONTROL & 0xf` to be zero for an eliminate-fast-clear / DCC-decompress pass. That is unrelated to this PR. I have since fixed it and three later stops locally (an always-pass depth test in that pass, `D16_UNORM_S8_UINT` on NVIDIA, #2975, and `BLEND_BYPASS`). With those plus these two PRs, Guardians gets past its loading screen into its first UI screen. </details> *Tested and written by Claude (AI assistant) on a contributor's machine.*
tibzejoker commented 2026-10-11 13:13:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-11T13:13:21Z.


Data point from GTA V (PPSA04264): it is another title with the #2715 pattern. Windows 11, RTX 4090. This is a replay-only check with agc_shader_replay, not a game run.

Compute shader 0x25b40aa00 (wave64, 8x8x1) loads its T# from a buffer at a computed index.

  • On main (2220effbe), it stops in resource analysis:
    resource analysis failed: GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x000021f8(GetBufferResource(ReadConst(GetSrtResource, Immediate), ...
    
  • With this PR at 9e5fcf29 (alone, and with #758 at c38d9ccd on top), the resource analysis accepts it. The replay then stops at the step where the replay tool lacks guest memory:
    SrtWalker::EvaluateRuntimeSources failed to evaluate runtime sources: descriptor source 17 dword 0: ReadConst(GetSrtResource, Void(0)) where slot 0 = LoadAddressU32(GetAddressResource(GetUserData(Void), GetUserData(Void)), ...)
    
    The request does not capture the table that slot points to, so this is not a full confirmation.

I can't do an in-game run on this PR for now: the branch is about 1000 commits behind main and GTA needs several other branches to get that far. I'll report back once it is rebased if that helps. The request file is available if you want it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109394539 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6109394539). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-11T13:13:21Z. --- Data point from **GTA V (PPSA04264)**: it is another title with the #2715 pattern. Windows 11, RTX 4090. This is a replay-only check with `agc_shader_replay`, not a game run. Compute shader `0x25b40aa00` (wave64, 8x8x1) loads its T# from a buffer at a computed index. - **On `main` (2220effbe)**, it stops in resource analysis: ``` resource analysis failed: GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x000021f8(GetBufferResource(ReadConst(GetSrtResource, Immediate), ... ``` - **With this PR at 9e5fcf29** (alone, and with #758 at c38d9ccd on top), the resource analysis accepts it. The replay then stops at the step where the replay tool lacks guest memory: ``` SrtWalker::EvaluateRuntimeSources failed to evaluate runtime sources: descriptor source 17 dword 0: ReadConst(GetSrtResource, Void(0)) where slot 0 = LoadAddressU32(GetAddressResource(GetUserData(Void), GetUserData(Void)), ...) ``` The request does not capture the table that slot points to, so this is not a full confirmation. I can't do an in-game run on this PR for now: the branch is about 1000 commits behind `main` and GTA needs several other branches to get that far. I'll report back once it is rebased if that helps. The request file is available if you want it.
Celegans12 commented 2026-10-11 13:39:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-11T13:39:21Z.


I've prepared the rebase and the empty-table fix: one physical descriptor plus pool space, including draw snapshots, while the guest table stays empty. Sampler constraints are checked before Vulkan allocation without clamping bias or weakening the OS-specific reuse counts; unsupported border pairings fail conservatively. This still doesn't establish whether the reported sampler address was correct.

The parent passes all 16 focused tests and the three no-pipeline-library controls per platform, with all five CPU regressions failing before the fixes and passing afterward. Counted reuse ran on Windows; Linux omits it and two per-wave cases. Windows default Recorder passes with four watch-dependent omissions.

The full #758 stack merged with main still has failed CI. Exact main repeats all four Windows failures, plus Linux's R8 sRGB comparison and default Recorder depth-proof failures; later Recorder checks remain unrun.

Full merged results

NVIDIA/Windows: 830 passed, four failed, five expected skips; skip-policy check passed. Lavapipe/Linux: 804 passed, four failed, 33 skipped; the skip-policy check rejected missing agc_write_tracking coverage. No unexpected native-fatal markers were hidden in passing tests. These are failure results, not a full-suite pass.

Could you rerun agc_driver_bindless_images on RADV to confirm the allocation fix on the affected driver?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109621153 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6109621153). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-11T13:39:21Z. --- I've prepared the rebase and the empty-table fix: one physical descriptor plus pool space, including draw snapshots, while the guest table stays empty. Sampler constraints are checked before Vulkan allocation without clamping bias or weakening the OS-specific reuse counts; unsupported border pairings fail conservatively. This still doesn't establish whether the reported sampler address was correct. The parent passes all 16 focused tests and the three no-pipeline-library controls per platform, with all five CPU regressions failing before the fixes and passing afterward. Counted reuse ran on Windows; Linux omits it and two per-wave cases. Windows default Recorder passes with four watch-dependent omissions. The full #758 stack merged with main still has failed CI. Exact main repeats all four Windows failures, plus Linux's R8 sRGB comparison and default Recorder depth-proof failures; later Recorder checks remain unrun. <details><summary>Full merged results</summary> NVIDIA/Windows: 830 passed, four failed, five expected skips; skip-policy check passed. Lavapipe/Linux: 804 passed, four failed, 33 skipped; the skip-policy check rejected missing `agc_write_tracking` coverage. No unexpected native-fatal markers were hidden in passing tests. These are failure results, not a full-suite pass. </details> Could you rerun `agc_driver_bindless_images` on RADV to confirm the allocation fix on the affected driver?
SleglJan commented 2026-10-11 13:54:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-11T13:54:00Z.


@Celegans12 A cost measurement of this path with a large table, from 007 First Light (PPSA11386) on Linux.

Setup. RTX 3080, NVIDIA 615.71.09, Release, SPIRV-Tools off, warm shader and pipeline caches, APS5_PROFILE_DRAW=1. The stack is 57f96fd2 with #757/#758 at their previous heads (9e5fcf29 / c38d9ccd) plus 41 other commits: other open PRs and local patches, identical in both runs. TableSnapshotter is unchanged in your rebased heads.

The cost. 007's image table has 18,960 entries. TableSnapshotter reads it one dword at a time on every capture, about 190k word reads per snapshot. In steady state that's 3.3 ms per snapshot and 4.5 s of every 10 s on the draw thread, about half of the queue-0 draw-packet time.

A follow-up, which I'll open against main once #757/#758 are merged. I'm not suggesting it for this PR. It's SleglJan/AnyPS5 perf/image-table-snapshot-reuse (f9c2003d, on 1ff81c24):

  • It reads a column's dwords in bulk through a new ShaderMemory::readWords.
  • It keeps a per-thread memo of each column's plan and descriptor lookups, reused while the page-accessibility answers and the words are unchanged.
  • The reads still happen on every capture, so read marks, Regions() and tables.ranges come out the same.

Result. Two runs on that stack, differing only by this change. Values cover twenty 10 s windows in steady state: packet counts are means, times are medians. Frames per minute come from the window title:

before after
per snapshot 3.34 ms 0.29 ms
capture per draw packet 4,904 µs 650 µs
DRAW_INDEX_OFFSET_2 packets per 10 s 913 1,649
frames per minute (120–280 s) 10.9 19.9

The after run ended at about 289 s on vkAllocateMemory storage texture: Vulkan result -2, a separate issue (#3256).

Tests. The change adds two checks to agc_shader_memory_tests, which run in agc_shader_memory and agc_shader_bindless:

  • bulk reads against word-by-word reads: runs crossing pages, initial regions, pending-write pages, and a misaligned read that must throw;
  • repeated snapshots against a fresh snapshotter after a changed descriptor, a page made inaccessible and accessible again, and a changed key domain.

On f9c2003d, all 384 agc/shader/recompiler/spirv test targets pass on the RTX 3080.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109749178 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6109749178). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-11T13:54:00Z. --- @Celegans12 A cost measurement of this path with a large table, from 007 First Light (PPSA11386) on Linux. **Setup.** RTX 3080, NVIDIA 615.71.09, Release, SPIRV-Tools off, warm shader and pipeline caches, `APS5_PROFILE_DRAW=1`. The stack is 57f96fd2 with #757/#758 at their previous heads (9e5fcf29 / c38d9ccd) plus 41 other commits: other open PRs and local patches, identical in both runs. `TableSnapshotter` is unchanged in your rebased heads. **The cost.** 007's image table has 18,960 entries. `TableSnapshotter` reads it one dword at a time on every capture, about 190k word reads per snapshot. In steady state that's 3.3 ms per snapshot and 4.5 s of every 10 s on the draw thread, about half of the queue-0 draw-packet time. **A follow-up, which I'll open against main once #757/#758 are merged.** I'm not suggesting it for this PR. It's SleglJan/AnyPS5 `perf/image-table-snapshot-reuse` (f9c2003d, on 1ff81c24): - It reads a column's dwords in bulk through a new `ShaderMemory::readWords`. - It keeps a per-thread memo of each column's plan and descriptor lookups, reused while the page-accessibility answers and the words are unchanged. - The reads still happen on every capture, so read marks, `Regions()` and `tables.ranges` come out the same. **Result.** Two runs on that stack, differing only by this change. Values cover twenty 10 s windows in steady state: packet counts are means, times are medians. Frames per minute come from the window title: | | before | after | |---|---|---| | per snapshot | 3.34 ms | 0.29 ms | | capture per draw packet | 4,904 µs | 650 µs | | `DRAW_INDEX_OFFSET_2` packets per 10 s | 913 | 1,649 | | frames per minute (120–280 s) | 10.9 | 19.9 | The after run ended at about 289 s on `vkAllocateMemory storage texture: Vulkan result -2`, a separate issue (#3256). **Tests.** The change adds two checks to `agc_shader_memory_tests`, which run in `agc_shader_memory` and `agc_shader_bindless`: - bulk reads against word-by-word reads: runs crossing pages, initial regions, pending-write pages, and a misaligned read that must throw; - repeated snapshots against a fresh snapshotter after a changed descriptor, a page made inaccessible and accessible again, and a changed key domain. On f9c2003d, all 384 agc/shader/recompiler/spirv test targets pass on the RTX 3080. AI-assisted: yes (Claude Code)
tv7 commented 2026-10-11 14:29:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-11T14:29:29Z.


@Celegans12 A device-memory data point for the image table path, from Marvel's Wolverine (PPSA03671) on Windows.

Setup. RTX 3070 (8 GB), Windows 11, GCC 15.2.0 UCRT, Release. Main a11c8f7f7 + this PR at e904eb18c + #3588 (APR) + #3633 (array color views) + #3336 (unexported pixel inputs) + placeholders for 2 unresolved imports.

What happens. One of the title's tables is its whole bindless texture heap (2,493 entries, counted in an earlier run on an older head). resolveImageTables creates or looks up a texture for every entry below imageTableCapacity for that one dispatch, and keeps them all alive for it. On 8 GB that alone exceeds device memory: the first presentation stops with compute shader 0x11d032b100: AGC graphics: vkAllocateMemory texture: Vulkan result -2, preceded by many [textures] ... keeps the snapshot path: vkAllocateMemory storage texture: Vulkan result -2.

Check. Same build, with context.imageTableCapacity clamped to 150 by a local env var (so entries past 150 take the existing capacity fault): no out-of-memory, and the title runs 10 minutes without an error. I also tried each other memory change I had locally (kept-bytes accounting of new storage images, retiring signaled batches in BoundKeptBytes, APS5_HOST_IMPORT_MIB=9216); none of them changes the outcome on current main, only the table size does.

So a table whose entries add up to more than the texture budget fails on 8 GB cards. A byte budget for the textures one table materializes (faulting the rest like the capacity limit does), or creating entries only when a shader reads them, would avoid it. Your call whether that belongs here or in a follow-up; I can test either on this title.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110063268 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6110063268). Originally posted by [tv7](https://github.com/tv7) on 2026-10-11T14:29:29Z. --- @Celegans12 A device-memory data point for the image table path, from Marvel's Wolverine (PPSA03671) on Windows. **Setup.** RTX 3070 (8 GB), Windows 11, GCC 15.2.0 UCRT, Release. Main `a11c8f7f7` + this PR at `e904eb18c` + #3588 (APR) + #3633 (array color views) + #3336 (unexported pixel inputs) + placeholders for 2 unresolved imports. **What happens.** One of the title's tables is its whole bindless texture heap (2,493 entries, counted in an earlier run on an older head). `resolveImageTables` creates or looks up a texture for every entry below `imageTableCapacity` for that one dispatch, and keeps them all alive for it. On 8 GB that alone exceeds device memory: the first presentation stops with `compute shader 0x11d032b100: AGC graphics: vkAllocateMemory texture: Vulkan result -2`, preceded by many `[textures] ... keeps the snapshot path: vkAllocateMemory storage texture: Vulkan result -2`. **Check.** Same build, with `context.imageTableCapacity` clamped to 150 by a local env var (so entries past 150 take the existing capacity fault): no out-of-memory, and the title runs 10 minutes without an error. I also tried each other memory change I had locally (kept-bytes accounting of new storage images, retiring signaled batches in `BoundKeptBytes`, `APS5_HOST_IMPORT_MIB=9216`); none of them changes the outcome on current main, only the table size does. So a table whose entries add up to more than the texture budget fails on 8 GB cards. A byte budget for the textures one table materializes (faulting the rest like the capacity limit does), or creating entries only when a shader reads them, would avoid it. Your call whether that belongs here or in a follow-up; I can test either on this title. AI-assisted: yes (Claude Code)
EdouardSence commented 2026-10-11 14:48:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-11T14:48:27Z.


@Celegans12 @adriadam10, on the agc_driver_bindless_images failure on RADV: this is the change that makes it pass here (RX 9070 XT, Mesa 26.2.4 RADV, Linux). I tested it on main a11c8f7f with #758 merged, conflicts resolved as @Tamalero describes.

RADV's radv_descriptor_set_create sizes a set whose variable descriptor count is 0 at the layout binding's full descriptorCount. That is imageTableCapacity here, while the pool is sized from the table's actual elements, so a table with no elements gets VK_ERROR_OUT_OF_POOL_MEMORY (-1000069000). Allocating at least one element keeps the variable count and the pool size consistent:

-            const auto tableDescriptors = std::min(tableElements, context.imageTableCapacity);
+            auto tableDescriptors = std::min(tableElements, context.imageTableCapacity);
+            if (tableBinding != std::numeric_limits<std::size_t>::max() && tableDescriptors == 0) tableDescriptors = 1;

(in ShaderResources.cpp, where tableDescriptors feeds both the pool size and variableCount)

  • Without it: agc_driver_bindless_images fails with vkAllocateDescriptorSets: Vulkan result -1000069000.
  • With it: it passes, and the other agc and shader tests pass too, apart from one.
  • The one failure: agc_driver_graphics stops on a chained update-after-bind pool lost the variable image count. Its expectation (maxSets == 1024 and FREE_DESCRIPTOR_SET_BIT on the chained pool) predates main's current descriptor pool scheme, so it needs updating for the rebase rather than a code change.

I can't check agc_driver_image_table_reuse on NVIDIA. It passes here on RADV.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110233220 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6110233220). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-11T14:48:27Z. --- @Celegans12 @adriadam10, on the `agc_driver_bindless_images` failure on RADV: this is the change that makes it pass here (RX 9070 XT, Mesa 26.2.4 RADV, Linux). I tested it on `main` a11c8f7f with #758 merged, conflicts resolved as @Tamalero describes. RADV's `radv_descriptor_set_create` sizes a set whose variable descriptor count is 0 at the layout binding's full `descriptorCount`. That is `imageTableCapacity` here, while the pool is sized from the table's actual elements, so a table with no elements gets `VK_ERROR_OUT_OF_POOL_MEMORY` (`-1000069000`). Allocating at least one element keeps the variable count and the pool size consistent: ```diff - const auto tableDescriptors = std::min(tableElements, context.imageTableCapacity); + auto tableDescriptors = std::min(tableElements, context.imageTableCapacity); + if (tableBinding != std::numeric_limits<std::size_t>::max() && tableDescriptors == 0) tableDescriptors = 1; ``` (in `ShaderResources.cpp`, where `tableDescriptors` feeds both the pool size and `variableCount`) - Without it: `agc_driver_bindless_images` fails with `vkAllocateDescriptorSets: Vulkan result -1000069000`. - With it: it passes, and the other agc and shader tests pass too, apart from one. - The one failure: `agc_driver_graphics` stops on `a chained update-after-bind pool lost the variable image count`. Its expectation (`maxSets == 1024` and `FREE_DESCRIPTOR_SET_BIT` on the chained pool) predates `main`'s current descriptor pool scheme, so it needs updating for the rebase rather than a code change. I can't check `agc_driver_image_table_reuse` on NVIDIA. It passes here on RADV. *Tested and written by Claude (AI assistant) on a contributor's machine.*
adriadam10 commented 2026-10-11 21:23:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:23:01Z.


Checked the new head e904eb18 merged onto current main (Linux, RADV, libSceAgc + libSceAgcDriver scope): 409/409 ctest pass, including agc_driver_bindless_images (the vkAllocateDescriptorSets -12 is gone) and agc_driver_image_table_reuse (write tracking works here). The new tests need the PR's ImageTableAbi.hpp, so they can't be run against main for a negative check.

Not covered by us:

  • @oneandonlydean: agc_driver_image_table_reuse failed on your RTX 4090 at the previous head ("2 reused and 1 resolved tables, expected 1 and 2"). Could you rerun it on this head? If it still fails, that is the blocker.
  • Cost reports still open: @SleglJan (18,960-entry table read one dword at a time per snapshot) and @tv7 (resolveImageTables creating textures for every entry below imageTableCapacity). @Celegans12, please answer whether this head changes either.

Otherwise the real-title reports in the thread show the planning wall cleared.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113917368 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6113917368). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T21:23:01Z. --- Checked the new head e904eb18 merged onto current `main` (Linux, RADV, libSceAgc + libSceAgcDriver scope): 409/409 ctest pass, including `agc_driver_bindless_images` (the `vkAllocateDescriptorSets -12` is gone) and `agc_driver_image_table_reuse` (write tracking works here). The new tests need the PR's `ImageTableAbi.hpp`, so they can't be run against `main` for a negative check. Not covered by us: - @oneandonlydean: `agc_driver_image_table_reuse` failed on your RTX 4090 at the previous head ("2 reused and 1 resolved tables, expected 1 and 2"). Could you rerun it on this head? If it still fails, that is the blocker. - Cost reports still open: @SleglJan (18,960-entry table read one dword at a time per snapshot) and @tv7 (`resolveImageTables` creating textures for every entry below `imageTableCapacity`). @Celegans12, please answer whether this head changes either. Otherwise the real-title reports in the thread show the planning wall cleared.
fdfawef324 commented 2026-10-11 22:31:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-11T22:31:28Z.


Test on Demon's Souls (PPSA01342 v1.005, US), Windows, RTX 3060 (NVIDIA 591.86), MinGW-w64 GCC 15.2.0, Release. This covers the material-selected table that fisherjoey reported on #1184 for PPSA01341.

Tree: main a11c8f7f7 + #3871 + #425 + #2904 (needed to get this far) + this PR at e904eb18c. One textual conflict with #425 in ShaderResources::noteReusable; I kept #425's RefreshedPerUse() early return and this PR's ImageTableMap exclusion on the next line.

Without this PR, right after the brightness calibration screen:

[videoout] presentation failed: compute shader 0x248947300: bindless image table: 18 distinct keys exceed the 16 slots

With it, that stop is gone. The voice/subtitle settings screen and the opening cinematic render, with no table-related errors in the log; I watched the cinematic for several minutes. This was the first run of the build, so every shader was recompiled (about 6,350); I saw no descriptor allocation failures on NVIDIA with 12 GB.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114624701 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6114624701). Originally posted by [fdfawef324](https://github.com/fdfawef324) on 2026-10-11T22:31:28Z. --- Test on Demon's Souls (PPSA01342 v1.005, US), Windows, RTX 3060 (NVIDIA 591.86), MinGW-w64 GCC 15.2.0, Release. This covers the material-selected table that fisherjoey reported on #1184 for PPSA01341. Tree: `main` a11c8f7f7 + #3871 + #425 + #2904 (needed to get this far) + this PR at `e904eb18c`. One textual conflict with #425 in `ShaderResources::noteReusable`; I kept #425's `RefreshedPerUse()` early return and this PR's `ImageTableMap` exclusion on the next line. Without this PR, right after the brightness calibration screen: ``` [videoout] presentation failed: compute shader 0x248947300: bindless image table: 18 distinct keys exceed the 16 slots ``` With it, that stop is gone. The voice/subtitle settings screen and the opening cinematic render, with no table-related errors in the log; I watched the cinematic for several minutes. This was the first run of the build, so every shader was recompiled (about 6,350); I saw no descriptor allocation failures on NVIDIA with 12 GB. AI-assisted: yes (Claude Code)
oneandonlydean commented 2026-10-11 23:12:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:12:24Z.


Reran on the RTX 4090 (NVIDIA 610.57.04, Linux) at e904eb18, built on its own base: agc_driver_image_table_reuse passes 5 of 5, and agc_driver_bindless_images passes. ctest -R "agc|shader" is 375/381; the six failures (agc_driver_bda_device, agc_driver_flat_apertures_0/2/3/4/5) are the same six at the merge-base 0f863c10.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114964060 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6114964060). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T23:12:24Z. --- Reran on the RTX 4090 (NVIDIA 610.57.04, Linux) at e904eb18, built on its own base: `agc_driver_image_table_reuse` passes 5 of 5, and `agc_driver_bindless_images` passes. `ctest -R "agc|shader"` is 375/381; the six failures (`agc_driver_bda_device`, `agc_driver_flat_apertures_0/2/3/4/5`) are the same six at the merge-base 0f863c10.
oneandonlydean commented 2026-10-11 23:13:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:13:20Z.


Conflicts with main again in VulkanDevice.cpp, ShaderResources.cpp and tests/Graphics.cpp; please rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114972001 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6114972001). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T23:13:20Z. --- Conflicts with main again in `VulkanDevice.cpp`, `ShaderResources.cpp` and `tests/Graphics.cpp`; please rebase.
Celegans12 commented 2026-10-12 06:49:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-12T06:49:15Z.


I rebased this and #758 onto current main. The only real change is around #3717: main now enables the same three descriptor-indexing features for its replay devices, so this PR uses main's fields and layout-flag path instead of its own, which also feeds the pipeline capture. One table test now passes the update-after-bind flag itself to match that. The PR also gained coverage for table keys that come from a loop counter and from a set-bit loop (s_ff1/s_bitset0), the shapes Yōtei's terrain domain programs use; both fail with image tables switched off.

Two earlier points I couldn't confirm here: @adriadam10's RADV pool failure in agc_driver_bindless_images (the one-descriptor reservation for empty tables is meant to fix it, but I have no RADV device), and agc_driver_image_table_reuse with write tracking on Linux (WSL has no write watch). If either of you can run those, that would settle them.

Checks
  • Windows NVIDIA: 932/933 pass; log_macros also fails on main.
  • Linux (upstream's job in WSL), merged with main 2ccbd376: 937/938 pass; agc_driver_depth_compare_copy also fails on main.
  • #758 on top: the same results.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6119232720 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6119232720). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-12T06:49:15Z. --- I rebased this and #758 onto current `main`. The only real change is around #3717: `main` now enables the same three descriptor-indexing features for its replay devices, so this PR uses `main`'s fields and layout-flag path instead of its own, which also feeds the pipeline capture. One table test now passes the update-after-bind flag itself to match that. The PR also gained coverage for table keys that come from a loop counter and from a set-bit loop (`s_ff1`/`s_bitset0`), the shapes Yōtei's terrain domain programs use; both fail with image tables switched off. Two earlier points I couldn't confirm here: @adriadam10's RADV pool failure in `agc_driver_bindless_images` (the one-descriptor reservation for empty tables is meant to fix it, but I have no RADV device), and `agc_driver_image_table_reuse` with write tracking on Linux (WSL has no write watch). If either of you can run those, that would settle them. <details><summary>Checks</summary> - Windows NVIDIA: 932/933 pass; `log_macros` also fails on `main`. - Linux (upstream's job in WSL), merged with `main` 2ccbd376: 937/938 pass; `agc_driver_depth_compare_copy` also fails on `main`. - #758 on top: the same results. </details>
Mouhand-Kaddo commented 2026-10-12 09:34:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-12T09:34:47Z.


Tested this head (753c29396e4d0c790c6faae216f94fcdc5eda5ca) together with child #758 (cad61e9a744474d98b25ee2f2f35de864f31441d) on current main c36fd0a0eb57c01866befd370c88329ca42df759, Linux RX 6900 XT / RADV Mesa 26.2.4. This is a locally ported combined stack, not standalone validation of this PR head.

Nine of ten focused table/resource/cache/graphics/optimizer checks pass. agc_driver_image_table crashes at its first graphics-table draw, after the negative compute tests. A debugger-only experiment proves a current-main integration gap: the fragment shader references shared ImageTable set 0, while PipelineLibrary.cpp retains only set 1 for the fragment graphics pipeline library. Retaining both sets makes the entire test pass. The corresponding fragment-library cache key must also account for set 0.

The 17 Demon's Souls descriptor captures remain red because the pointer-table matcher rejects descriptors assembled from two adjacent four-dword loads. I posted the exact PCs, offset values, U32 wrapping concern, and separate GPL diagnosis on #758. No game/menu success is claimed, and no validation or fault assertions were disabled.

Testing performed with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6121596256 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6121596256). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-12T09:34:47Z. --- Tested this head (`753c29396e4d0c790c6faae216f94fcdc5eda5ca`) together with child #758 (`cad61e9a744474d98b25ee2f2f35de864f31441d`) on current main `c36fd0a0eb57c01866befd370c88329ca42df759`, Linux RX 6900 XT / RADV Mesa 26.2.4. This is a locally ported combined stack, not standalone validation of this PR head. Nine of ten focused table/resource/cache/graphics/optimizer checks pass. `agc_driver_image_table` crashes at its first graphics-table draw, after the negative compute tests. A debugger-only experiment proves a current-main integration gap: the fragment shader references shared ImageTable set 0, while `PipelineLibrary.cpp` retains only set 1 for the fragment graphics pipeline library. Retaining both sets makes the entire test pass. The corresponding fragment-library cache key must also account for set 0. The 17 Demon's Souls descriptor captures remain red because the pointer-table matcher rejects descriptors assembled from two adjacent four-dword loads. I posted the exact PCs, offset values, U32 wrapping concern, and separate GPL diagnosis on #758. No game/menu success is claimed, and no validation or fault assertions were disabled. Testing performed with AI assistance.
Mouhand-Kaddo commented 2026-10-12 12:20:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-12T12:20:50Z.


Linux follow-up for the tested head 753c29396e4d0c790c6faae216f94fcdc5eda5ca. Demon's Souls (PPSA01342) reached the main menu, with New Game and Settings visible in a native emulator frame and interaction confirmed by the user. Selecting New Game then produced a black screen; gameplay is not validated.

This was a combined integration stack: public-main snapshot c36fd0a0eb57c01866befd370c88329ca42df759, ported #757/#758, #4288, #3991, #4402, the descriptor-layout fix now in #4456, and a local split-descriptor-load correction. It is not an isolated success claim for this PR. The final menu run used GDB to investigate an earlier buffer descriptor uses an unsupported type abort. That earlier failure remains undiagnosed.

The table support still needed a local correction for eight-word image descriptors formed by two four-word raw-address loads. That follow-up remains separate from your implementation.

Reproduction detail: the title run temporarily raised Linux udmabuf size_limit_mb from 64 to 2048 because larger GPU imports failed at the default limit. The user restored 64 afterward and readback confirmed it. Default shader optimization remained enabled. RX 6900 XT/RADV was receiving GPU work; CPU shader compilation was a major startup bottleneck. Game assets were accessed through an enforced read-only view of the Windows gaming drive, without copying the game or changing its inputs. Disposable test caches have now been removed. AI-assisted testing/report.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6124152679 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6124152679). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-12T12:20:50Z. --- Linux follow-up for the tested head `753c29396e4d0c790c6faae216f94fcdc5eda5ca`. Demon's Souls (PPSA01342) reached the main menu, with New Game and Settings visible in a native emulator frame and interaction confirmed by the user. Selecting New Game then produced a black screen; gameplay is not validated. This was a combined integration stack: public-main snapshot `c36fd0a0eb57c01866befd370c88329ca42df759`, ported #757/#758, #4288, #3991, #4402, the descriptor-layout fix now in #4456, and a local split-descriptor-load correction. It is not an isolated success claim for this PR. The final menu run used GDB to investigate an earlier `buffer descriptor uses an unsupported type` abort. That earlier failure remains undiagnosed. The table support still needed a local correction for eight-word image descriptors formed by two four-word raw-address loads. That follow-up remains separate from your implementation. Reproduction detail: the title run temporarily raised Linux `udmabuf` `size_limit_mb` from 64 to 2048 because larger GPU imports failed at the default limit. The user restored 64 afterward and readback confirmed it. Default shader optimization remained enabled. RX 6900 XT/RADV was receiving GPU work; CPU shader compilation was a major startup bottleneck. Game assets were accessed through an enforced read-only view of the Windows gaming drive, without copying the game or changing its inputs. Disposable test caches have now been removed. AI-assisted testing/report.
tibzejoker commented 2026-10-12 14:58:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-12T14:58:29Z.


Windows data for head 753c2939 with GTA V (PPSA04264), Windows 11, RTX 4090, WinLibs GCC 15.2.0, Release.

I took this commit onto my GTA test tree (main 325e0a8bd plus a few open PRs: #425, #290, #637, #448, #423 and #2802). It conflicted only in the ValidateShaders/Inspect parameter lists, against #423's clip/cull distance flags. Same Story run before and after:

compute shader before with this PR
0x25b456800 bindless image table has 65536 entries (0 materials), limit 16 dispatches
0x25b458e00 same 65536-entry error dispatches
0x25b45a200 GetImageResource dword 0 is not a valid runtime value still fails

The prologue renders as before, and no other dispatch fails in order.

The remaining failure reads its T# through two constant buffer loads. The descriptor dword is ReadConstBuffer@0x13b8(V# from the SRT, offset), where offset is derived from ReadConstBuffer@0x135c(another V# from the SRT, ReadFirstLane(SelectU32(Phi …))). The index is a loop-carried, wave-uniform value that is itself loaded from memory, so it is probably outside what this PR covers. I'm noting it here only so the GTA case is on record. I can send the .req if it helps.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6126818651 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6126818651). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-12T14:58:29Z. --- Windows data for head `753c2939` with GTA V (PPSA04264), Windows 11, RTX 4090, WinLibs GCC 15.2.0, Release. I took this commit onto my GTA test tree (main 325e0a8bd plus a few open PRs: #425, #290, #637, #448, #423 and #2802). It conflicted only in the `ValidateShaders`/`Inspect` parameter lists, against #423's clip/cull distance flags. Same Story run before and after: | compute shader | before | with this PR | |---|---|---| | `0x25b456800` | `bindless image table has 65536 entries (0 materials), limit 16` | dispatches | | `0x25b458e00` | same 65536-entry error | dispatches | | `0x25b45a200` | `GetImageResource dword 0 is not a valid runtime value` | still fails | The prologue renders as before, and no other dispatch fails in order. The remaining failure reads its T# through two constant buffer loads. The descriptor dword is `ReadConstBuffer@0x13b8(V# from the SRT, offset)`, where `offset` is derived from `ReadConstBuffer@0x135c(another V# from the SRT, ReadFirstLane(SelectU32(Phi …)))`. The index is a loop-carried, wave-uniform value that is itself loaded from memory, so it is probably outside what this PR covers. I'm noting it here only so the GTA case is on record. I can send the `.req` if it helps. AI-assisted (Claude Code).
SleglJan commented 2026-10-12 20:32:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-12T20:32:58Z.


@Celegans12 A finding from 007 First Light (PPSA11386) on a stack that carries this PR (e904eb18; MatchKeyDomain and Narrow are identical at 753c29396), and a patch on the current head.

What we saw. We replayed 216 recorded shader requests from the game. No table in the 21 table-using shaders (95 traced tables) was narrowed: each one walked its whole domain (18,960 or 18,944 records) and bound every distinct entry. Per shader binding that is 335–339 elements in most shaders and 3,116–3,281 in the largest. Each bound element is a texture the driver looks up or creates for that draw or dispatch.

Cause. MatchKeyDomain only recognises keys read V#-relative (ReadConstBuffer). A key read through the SRT (ReadConst: a scalar load at an immediate offset that the SRT plan folds into a flat slot, from a user-data pointer or a V#) gets no key domain, so the snapshot keeps the whole domain. Across the 1,533 matcher calls in those 216 requests, these key shapes were rejected:

Key shape Count
ShiftRightLogical32 921
ReadFirstLane 266
BitwiseAnd32 220
Phi 65
IAdd32 36
ReadConst 21
SelectU32 1

3 V#-relative reads matched.

Patch: SleglJan/AnyPS5 fix/757-key-domain at 0a7d5dad7, one commit on 753c29396 (5 files, +95/−22).

  • New value key domain, used only when no V# or address read at a runtime offset is left in the key (no ReadConstBuffer or LoadAddressU32): user data, SRT reads, constants and arithmetic on them. The key then carries a one-dword descriptor source, and the snapshot evaluates it at dispatch time and narrows to that record.
  • Keys with a runtime-offset V# read keep the existing scan domain, with its written-buffer reset, table range and pending skip.
  • Fallback: a key the walker can't evaluate keeps the whole domain, as before.
  • New ShaderMemory case verifyImageTableSrtKey: a key read through the SRT pointer narrows the snapshot to that record. Recompiled with a different key value, only the snapshot codes change; the SPIR-V and the disk-cache key stay the same. On 753c29396 it fails with "image table SRT key: a key read through the SRT has no key domain".
  • TechnicalDebt.md: a key that is neither a V#-relative scalar read nor a value the SRT walker evaluates from user data, SRT reads and constants alone still binds the whole domain. Examples: a shifted or masked runtime-offset V# read, a per-lane value made uniform by v_readfirstlane, or a loop-carried phi.

Effect, measured on our game stack with the first revision of this change, before the V#/address check. Your replay tool can't read our stack's request dumps, so the patch's own effect is covered by its test. The 14 tables whose key is read through the SRT narrow to 1–2 bound elements; record 0 always stays. The other tables are unchanged. We're working on those next: phi leaves and shift/mask/add transforms of V# reads, and a bounded scan for keys taken from raw buffers.

Tested on Linux with lavapipe and SPIRV-Tools ON, from a clean tree:

  • 6/6 pass: agc_shader_memory, agc_shader_bindless, agc_driver_image_table, agc_driver_image_table_reuse, agc_driver_image_table_cache, agc_shader_disk_cache.
  • On the unpatched head with only the test added, agc_shader_bindless fails as above.
  • tools/check_conventions.py passes against the PR head.
  • Not run on a GPU at 753c29396.

The change keeps your narrowing design and adds a domain for keys the current matcher doesn't cover. Fold the commit into this PR or have it as a follow-up on top, whichever you prefer. #758 and #4475 build on the same MatchKeyDomain/Narrow, so they'd pick it up too.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132128989 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6132128989). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-12T20:32:58Z. --- @Celegans12 A finding from 007 First Light (PPSA11386) on a stack that carries this PR (e904eb18; `MatchKeyDomain` and `Narrow` are identical at 753c29396), and a patch on the current head. **What we saw.** We replayed 216 recorded shader requests from the game. No table in the 21 table-using shaders (95 traced tables) was narrowed: each one walked its whole domain (18,960 or 18,944 records) and bound every distinct entry. Per shader binding that is 335–339 elements in most shaders and 3,116–3,281 in the largest. Each bound element is a texture the driver looks up or creates for that draw or dispatch. **Cause.** `MatchKeyDomain` only recognises keys read V#-relative (`ReadConstBuffer`). A key read through the SRT (`ReadConst`: a scalar load at an immediate offset that the SRT plan folds into a flat slot, from a user-data pointer or a V#) gets no key domain, so the snapshot keeps the whole domain. Across the 1,533 matcher calls in those 216 requests, these key shapes were rejected: | Key shape | Count | |---|---| | `ShiftRightLogical32` | 921 | | `ReadFirstLane` | 266 | | `BitwiseAnd32` | 220 | | `Phi` | 65 | | `IAdd32` | 36 | | `ReadConst` | 21 | | `SelectU32` | 1 | 3 V#-relative reads matched. **Patch:** SleglJan/AnyPS5 `fix/757-key-domain` at 0a7d5dad7, one commit on 753c29396 (5 files, +95/−22). - **New `value` key domain**, used only when no V# or address read at a runtime offset is left in the key (no `ReadConstBuffer` or `LoadAddressU32`): user data, SRT reads, constants and arithmetic on them. The key then carries a one-dword descriptor source, and the snapshot evaluates it at dispatch time and narrows to that record. - **Keys with a runtime-offset V# read keep the existing scan domain,** with its written-buffer reset, table range and pending skip. - **Fallback:** a key the walker can't evaluate keeps the whole domain, as before. - **New `ShaderMemory` case `verifyImageTableSrtKey`:** a key read through the SRT pointer narrows the snapshot to that record. Recompiled with a different key value, only the snapshot codes change; the SPIR-V and the disk-cache key stay the same. On 753c29396 it fails with "image table SRT key: a key read through the SRT has no key domain". - **`TechnicalDebt.md`:** a key that is neither a V#-relative scalar read nor a value the SRT walker evaluates from user data, SRT reads and constants alone still binds the whole domain. Examples: a shifted or masked runtime-offset V# read, a per-lane value made uniform by `v_readfirstlane`, or a loop-carried phi. **Effect,** measured on our game stack with the first revision of this change, before the V#/address check. Your replay tool can't read our stack's request dumps, so the patch's own effect is covered by its test. The 14 tables whose key is read through the SRT narrow to 1–2 bound elements; record 0 always stays. The other tables are unchanged. We're working on those next: phi leaves and shift/mask/add transforms of V# reads, and a bounded scan for keys taken from raw buffers. **Tested** on Linux with lavapipe and SPIRV-Tools ON, from a clean tree: - 6/6 pass: `agc_shader_memory`, `agc_shader_bindless`, `agc_driver_image_table`, `agc_driver_image_table_reuse`, `agc_driver_image_table_cache`, `agc_shader_disk_cache`. - On the unpatched head with only the test added, `agc_shader_bindless` fails as above. - `tools/check_conventions.py` passes against the PR head. - Not run on a GPU at 753c29396. The change keeps your narrowing design and adds a domain for keys the current matcher doesn't cover. Fold the commit into this PR or have it as a follow-up on top, whichever you prefer. #758 and #4475 build on the same `MatchKeyDomain`/`Narrow`, so they'd pick it up too. AI-assisted: yes (Claude Code)
tv7 commented 2026-10-12 20:39:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-12T20:39:22Z.


Rebase handoff: rebased onto current main (44ab0c39e), authorship unchanged (one commit, 8945fe208).

Main's registration-module series (765ea6a10, 4d0b5c789, d7e0f27d6, e9def903f) touched the same code, so the conflicts were more than textual:

  • Registration modules: kept main's runtime image metadata, run-time image modes and compare state for direct images. Table images skip them (table != NoTable where main tested indirectRoot). The old indirectRoot / indirectResources / TableImageIndex paths are gone, as in this PR.
  • Fragment descriptor set: with pipeline libraries, a pixel shader's bindings are in set 1. The shared image table binding (260) is now one per set: tableBindings[2] and tableElements[2], a TableStage::set, and a Binding::set that setOf honours. Pool sizes and the variable descriptor count are per set too, in the draw build and in draw snapshots.
  • DescribeSetLayouts: describes the same table bindings and binding flags as the draw build: sampler table as SAMPLER x samplerTableCapacity partially bound, and the image table per set, partially bound with a variable count. So prebuilt libraries' set layouts match the draw's.
  • Small ones: ShaderValidation keeps main's per-stage set check and passes runtimeDescriptorArray. PreparedDescriptorBinding has both inactive and tableSamplerMasks. A table sampler's filter element also honours inactive. The Linux-only ShaderDiskCache size asserts now read CompiledShaderArtifact 200 and RecompileResult 384 (both sides' growth added; I can't build on Linux here, so please check). The 17 TechnicalDebt entries moved to docs/dev/debt/libSceAgcDriver.md (6) and docs/dev/debt/shader.md (11) after 342a8c459.

Verified on Windows 11, RTX 3070, GCC 15.2.0 UCRT, Release:

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 1009/1009
  • Marvel's Wolverine (PPSA03671), on the previous rebase of this branch (main 3e0e01f35) plus #3633, #3846 and #4702, with APS5_VERIFY_SET_LAYOUTS=1: no set layout mismatch. It runs until a separate stop: a pixel shader that exports the stencil reference now needs VK_EXT_shader_stencil_export, which this NVIDIA device lacks (22d662eda). Like my earlier runs, this one caps the table at 150 images locally, because the full 2493-entry table runs out of VRAM on 8 GB (see my earlier comment).

To pick it up:

git fetch https://github.com/tv7/AnyPS5 rebase/757
git checkout <your branch>
git reset --hard FETCH_HEAD

Head is 8945fe208.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132222771 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6132222771). Originally posted by [tv7](https://github.com/tv7) on 2026-10-12T20:39:22Z. --- **Rebase handoff**: rebased onto current `main` (`44ab0c39e`), authorship unchanged (one commit, `8945fe208`). Main's registration-module series (765ea6a10, 4d0b5c789, d7e0f27d6, e9def903f) touched the same code, so the conflicts were more than textual: - **Registration modules**: kept main's runtime image metadata, run-time image modes and compare state for direct images. Table images skip them (`table != NoTable` where main tested `indirectRoot`). The old `indirectRoot` / `indirectResources` / `TableImageIndex` paths are gone, as in this PR. - **Fragment descriptor set**: with pipeline libraries, a pixel shader's bindings are in set 1. The shared image table binding (260) is now one per set: `tableBindings[2]` and `tableElements[2]`, a `TableStage::set`, and a `Binding::set` that `setOf` honours. Pool sizes and the variable descriptor count are per set too, in the draw build and in draw snapshots. - **`DescribeSetLayouts`**: describes the same table bindings and binding flags as the draw build: sampler table as `SAMPLER` x `samplerTableCapacity` partially bound, and the image table per set, partially bound with a variable count. So prebuilt libraries' set layouts match the draw's. - **Small ones**: `ShaderValidation` keeps main's per-stage set check and passes `runtimeDescriptorArray`. `PreparedDescriptorBinding` has both `inactive` and `tableSamplerMasks`. A table sampler's filter element also honours `inactive`. The Linux-only `ShaderDiskCache` size asserts now read `CompiledShaderArtifact` 200 and `RecompileResult` 384 (both sides' growth added; I can't build on Linux here, so please check). The 17 TechnicalDebt entries moved to `docs/dev/debt/libSceAgcDriver.md` (6) and `docs/dev/debt/shader.md` (11) after 342a8c459. Verified on Windows 11, RTX 3070, GCC 15.2.0 UCRT, Release: - builds; `tools/check_conventions.py --base origin/main` passes - full suite: 1009/1009 - Marvel's Wolverine (PPSA03671), on the previous rebase of this branch (main `3e0e01f35`) plus #3633, #3846 and #4702, with `APS5_VERIFY_SET_LAYOUTS=1`: no set layout mismatch. It runs until a separate stop: a pixel shader that exports the stencil reference now needs `VK_EXT_shader_stencil_export`, which this NVIDIA device lacks (22d662eda). Like my earlier runs, this one caps the table at 150 images locally, because the full 2493-entry table runs out of VRAM on 8 GB (see my earlier comment). **To pick it up:** ``` git fetch https://github.com/tv7/AnyPS5 rebase/757 git checkout <your branch> git reset --hard FETCH_HEAD ``` Head is `8945fe208`.
Mouhand-Kaddo commented 2026-10-12 21:23:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-12T21:23:01Z.


Retest on Linux using updated #4456 head 4f5f6d671cdb0ffd3a9c43eedbdf03e433e80ebe as the integration base. Its six focused PR checks pass three times each; the previous null-shader-module mock failure is reproduced on its parent and fixed on this head.

The title support stack remains #757/#758/#4288/#3991/#4402 plus the local grouped split-load correction. Five integration shader/graphics checks pass. Demon's Souls PPSA01342 rendered language/display settings and the online/offline prompt, then aborted with exit 134:

[videoout] presentation failed: compute shader 0x2489fbb00: runtime image descriptor is invalid

This run did not verify main menu. The earlier c36-based integration did reach it. I have not isolated which rebased-stack change causes the descriptor failure, so this is not a regression attribution to this PR. No memory guard/OOM event stopped the run. One brief debugger snapshot was taken during startup, then detached.

The temporary Linux udmabuf limit was again 2048 MiB for the title run and is now verified back at 64. Assets were read directly through an enforced read-only view of the Windows gaming drive, without copying the game. Original input hashes and timestamps are unchanged. AI-assisted testing/report.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132857799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6132857799). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-12T21:23:01Z. --- Retest on Linux using updated #4456 head `4f5f6d671cdb0ffd3a9c43eedbdf03e433e80ebe` as the integration base. Its six focused PR checks pass three times each; the previous null-shader-module mock failure is reproduced on its parent and fixed on this head. The title support stack remains #757/#758/#4288/#3991/#4402 plus the local grouped split-load correction. Five integration shader/graphics checks pass. Demon's Souls PPSA01342 rendered language/display settings and the online/offline prompt, then aborted with exit 134: ```text [videoout] presentation failed: compute shader 0x2489fbb00: runtime image descriptor is invalid ``` This run did not verify main menu. The earlier c36-based integration did reach it. I have not isolated which rebased-stack change causes the descriptor failure, so this is not a regression attribution to this PR. No memory guard/OOM event stopped the run. One brief debugger snapshot was taken during startup, then detached. The temporary Linux udmabuf limit was again 2048 MiB for the title run and is now verified back at 64. Assets were read directly through an enforced read-only view of the Windows gaming drive, without copying the game. Original input hashes and timestamps are unchanged. AI-assisted testing/report.
tibzejoker commented 2026-10-12 21:25:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-12T21:25:05Z.


GTA V (PPSA04264) numbers for the table cost @SleglJan and @tv7 describe. Windows 11, RTX 4090, 64 GB RAM. Base: main 2a5eca11c plus the open PRs GTA needs. #757 is tv7's rebase/757 (8945fe208). Story prologue, same scene each time. FPS is frames counted over 120 s.

FPS process RAM
without #757 1.22 25-26 GB
with #757 0.65 30-31 GB
with #757 + SleglJan's fix/757-key-domain (0a7d5dad7) 0.77 32 GB
  • With #757, the two 65536-entry bindless tables now dispatch (0x25b456800, 0x25b458e00), and RAM levels off rather than growing.
  • The only in-order failure left is 0x25b45a200, which I posted earlier. Its T# index is loaded from a second constant buffer.
  • I couldn't test perf/image-table-snapshot-reuse (f9c2003df). It needs #758's 64-bit pointer tables (TableColumn::address, ScalarAddressDword), and this tree doesn't have #758.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132889688 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6132889688). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-12T21:25:05Z. --- GTA V (PPSA04264) numbers for the table cost @SleglJan and @tv7 describe. Windows 11, RTX 4090, 64 GB RAM. Base: main 2a5eca11c plus the open PRs GTA needs. #757 is tv7's `rebase/757` (8945fe208). Story prologue, same scene each time. FPS is frames counted over 120 s. | | FPS | process RAM | |---|---:|---:| | without #757 | 1.22 | 25-26 GB | | with #757 | 0.65 | 30-31 GB | | with #757 + SleglJan's `fix/757-key-domain` (0a7d5dad7) | 0.77 | 32 GB | - With #757, the two 65536-entry bindless tables now dispatch (`0x25b456800`, `0x25b458e00`), and RAM levels off rather than growing. - The only in-order failure left is `0x25b45a200`, which I posted earlier. Its T# index is loaded from a second constant buffer. - I couldn't test `perf/image-table-snapshot-reuse` (f9c2003df). It needs #758's 64-bit pointer tables (`TableColumn::address`, `ScalarAddressDword`), and this tree doesn't have #758. AI-assisted (Claude Code).
Tamalero commented 2026-10-12 23:17:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-12T23:17:25Z.


Marvel's Guardians of the Galaxy (PPSA01748) on tv7's rebase/757, with #758 on top: two findings about table materialization, alongside the table cost @SleglJan and @tibzejoker measured. One of them comes with a fix that took the title from 0.4 to about 4 FPS.

1. Garbage table slots get snapshotted every frame. Two elements of the title's table (226 and 255) hold a repeating byte pattern, not a T#. They decode to base 0x2dd20158000, 11125×6107, 65 layers, format 2: about 4.4 GB, far outside mapped guest memory. The table path builds that texture at every table use: ReadTextureSurface fills a 4.2 GB vector, it's uploaded, the cache refuses it for size, and the next frame does it again. That costs about 1.9 million minor faults per 5 s, a 4 GB host and driver mapping churning each frame, and the whole desktop stutters. The title never samples those slots.

Locally I poison an element whose memory isn't mapped. In the resolve loop, after DescribeSurface, if GuestMemory::Accessible(base, guestBytes) is false, the element is rejected like a decode failure. Results:

  • FPS: 0.4 → 3.5–4.5.
  • Page faults: down about 17×.
  • Poison faults: none reported, so nothing ever samples these slots.

Every T# I saw with MIN_LOD_WARN or MIP_STATS_CNT_EN set was one of these garbage slots, so the "texture streaming feedback is not reported" warning is a side effect of decoding them.

2. Table reuse never hits for this title, and can't with an exact-match key. A performance trace at about 4 FPS shows frames of about 210 ms (p50), with the GPU busy about 43 ms. About one table is resolved per frame, and that resolve costs about 25 ms in capture_resources plus about 20 ms in materialize. I traced the reuse misses step by step:

  • The TableState key changes between every pair of lookups. The collect epoch and the allocation generation both change each time, because the title allocates constantly.

  • Every table has unfit entries. Each one has about 36 entries that are views of storage images, plus a few with no write-watch generation, and any single unfit entry disqualifies the whole table.

  • Relaxing both still gives 0 hits. I relaxed both locally, as an experiment only:

    • I dropped epoch and allocation from the key.
    • In TableCurrent, I run CollectWrites over the table's ranges before UnchangedSinceAll. Without that, agc_driver_image_table_reuse correctly catches stale texels.
    • I resolve the storage-view and unwatched entries again at reuse.

    With that, tables are kept, but no lookup ever matches. The title builds a different table every frame: 214, 239, 243, 268, 328 and 345 entries in consecutive frames.

This looks like the whole-domain walk @SleglJan describes. Table sizes that change from frame to frame fit a table that isn't narrowed, so fix/757-key-domain may be the real fix here. I haven't tested it on this title yet. If narrowing doesn't cover Guardians' key shapes, the per-element cost is what's left, at about 150 µs per entry. A per-element memo keyed on the descriptor words and validated per range would help more than whole-table reuse. Finding 1 applies either way: a narrowed table can still land on a garbage slot.

Details and logs

Setup: Linux (CachyOS), RTX 4090 (NVIDIA 615.78), GCC 16, Release. Main 84659e16d, plus tv7's rebase of this PR (8945fe208), plus #758 (cad61e9a7), plus local fixes the title needs to reach its first UI:

  • a CB metadata pass with ZFUNC ALWAYS and no Z write while planes are bound;
  • BLEND_BYPASS;
  • sceNpGetUserIdByAccountId offline.

The title relinked with --to-intel.

#758 is needed for this title. Without it, the run aborts after about 97 s on GetImageResource dword 0 is not a valid runtime value (pc 0x588, the loop-counter shape). With it, pcs 0x588, 0x5d4 and 0x974 compile. Pcs 0x4378 and 0x4380 (the waterfall/ImageRead shape) still fail at registration but are not dispatched.

Cherry-picking #758 onto the rebase conflicts in two places:

  • the ShaderDiskCache size asserts, which become Artifact 200, Invocation 200, Result 408 (#758 adds one vector to each of the last two);
  • docs/dev/TechnicalDebt.md.

Slot 226/255 descriptor words:

dd201580 202dd202 f5f69add d0280e07 00000040 012a0000 da84a840 fedbedb8

Trace summary (APS5_TRACE_SECONDS=150:20, 93 presents):

frame_ms p50 210 / p90 295, gpu_busy_ms_per_present 43.4, queue worker 0 busy 48%
Driver.Packet 123.7, Driver.Draw 61.6, Driver.Draw.shader_compile_and_link 41.5,
Shader.DrawStage 40.9 (capture_resources 24.3, materialize 16.2), Driver.Dispatch 29.7,
Vulkan.Dispatch.shader_resources 23.5, Resources.Complete 28.0  (ms per frame)
capture_resources: p50 0.04 ms, p95 24.6 ms (one big one per frame)

Reuse miss breakdown (local counters, per 5 s at the same screen):

stock:                 hit 0, notfound 19-23; epoch and alloc changed between every lookup
relaxed key:           hit 0, notfound 19-24; first unfit element: storage-view (every table)
relaxed + re-resolve:  hit 0, notfound 22-23; kept 22; element counts 214/239/243/268/328/345

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134456500 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6134456500). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-12T23:17:25Z. --- Marvel's Guardians of the Galaxy (PPSA01748) on tv7's `rebase/757`, with #758 on top: two findings about table materialization, alongside the table cost @SleglJan and @tibzejoker measured. One of them comes with a fix that took the title from 0.4 to about 4 FPS. **1. Garbage table slots get snapshotted every frame.** Two elements of the title's table (226 and 255) hold a repeating byte pattern, not a T#. They decode to base `0x2dd20158000`, 11125×6107, 65 layers, format 2: about 4.4 GB, far outside mapped guest memory. The table path builds that texture at every table use: `ReadTextureSurface` fills a 4.2 GB vector, it's uploaded, the cache refuses it for size, and the next frame does it again. That costs about 1.9 million minor faults per 5 s, a 4 GB host and driver mapping churning each frame, and the whole desktop stutters. The title never samples those slots. Locally I poison an element whose memory isn't mapped. In the resolve loop, after `DescribeSurface`, if `GuestMemory::Accessible(base, guestBytes)` is false, the element is rejected like a decode failure. Results: - **FPS:** 0.4 → 3.5–4.5. - **Page faults:** down about 17×. - **Poison faults:** none reported, so nothing ever samples these slots. Every T# I saw with `MIN_LOD_WARN` or `MIP_STATS_CNT_EN` set was one of these garbage slots, so the "texture streaming feedback is not reported" warning is a side effect of decoding them. **2. Table reuse never hits for this title, and can't with an exact-match key.** A performance trace at about 4 FPS shows frames of about 210 ms (p50), with the GPU busy about 43 ms. About one table is resolved per frame, and that resolve costs about 25 ms in `capture_resources` plus about 20 ms in `materialize`. I traced the reuse misses step by step: - **The `TableState` key changes between every pair of lookups.** The collect epoch and the allocation generation both change each time, because the title allocates constantly. - **Every table has unfit entries.** Each one has about 36 entries that are views of storage images, plus a few with no write-watch generation, and any single unfit entry disqualifies the whole table. - **Relaxing both still gives 0 hits.** I relaxed both locally, as an experiment only: - I dropped epoch and allocation from the key. - In `TableCurrent`, I run `CollectWrites` over the table's ranges before `UnchangedSinceAll`. Without that, `agc_driver_image_table_reuse` correctly catches stale texels. - I resolve the storage-view and unwatched entries again at reuse. With that, tables are kept, but no lookup ever matches. The title builds a different table every frame: 214, 239, 243, 268, 328 and 345 entries in consecutive frames. This looks like the whole-domain walk @SleglJan describes. Table sizes that change from frame to frame fit a table that isn't narrowed, so `fix/757-key-domain` may be the real fix here. I haven't tested it on this title yet. If narrowing doesn't cover Guardians' key shapes, the per-element cost is what's left, at about 150 µs per entry. A per-element memo keyed on the descriptor words and validated per range would help more than whole-table reuse. Finding 1 applies either way: a narrowed table can still land on a garbage slot. <details><summary>Details and logs</summary> **Setup:** Linux (CachyOS), RTX 4090 (NVIDIA 615.78), GCC 16, Release. Main `84659e16d`, plus tv7's rebase of this PR (`8945fe208`), plus #758 (`cad61e9a7`), plus local fixes the title needs to reach its first UI: - a CB metadata pass with ZFUNC ALWAYS and no Z write while planes are bound; - `BLEND_BYPASS`; - `sceNpGetUserIdByAccountId` offline. The title relinked with `--to-intel`. **#758 is needed for this title.** Without it, the run aborts after about 97 s on `GetImageResource dword 0 is not a valid runtime value` (pc `0x588`, the loop-counter shape). With it, pcs `0x588`, `0x5d4` and `0x974` compile. Pcs `0x4378` and `0x4380` (the waterfall/ImageRead shape) still fail at registration but are not dispatched. Cherry-picking #758 onto the rebase conflicts in two places: - the `ShaderDiskCache` size asserts, which become Artifact 200, Invocation 200, Result 408 (#758 adds one vector to each of the last two); - `docs/dev/TechnicalDebt.md`. **Slot 226/255 descriptor words:** ``` dd201580 202dd202 f5f69add d0280e07 00000040 012a0000 da84a840 fedbedb8 ``` **Trace summary** (`APS5_TRACE_SECONDS=150:20`, 93 presents): ``` frame_ms p50 210 / p90 295, gpu_busy_ms_per_present 43.4, queue worker 0 busy 48% Driver.Packet 123.7, Driver.Draw 61.6, Driver.Draw.shader_compile_and_link 41.5, Shader.DrawStage 40.9 (capture_resources 24.3, materialize 16.2), Driver.Dispatch 29.7, Vulkan.Dispatch.shader_resources 23.5, Resources.Complete 28.0 (ms per frame) capture_resources: p50 0.04 ms, p95 24.6 ms (one big one per frame) ``` **Reuse miss breakdown** (local counters, per 5 s at the same screen): ``` stock: hit 0, notfound 19-23; epoch and alloc changed between every lookup relaxed key: hit 0, notfound 19-24; first unfit element: storage-view (every table) relaxed + re-resolve: hit 0, notfound 22-23; kept 22; element counts 214/239/243/268/328/345 ``` </details> *Tested and written by Claude (AI assistant) on a contributor's machine.*
Tamalero commented 2026-10-12 23:33:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-12T23:33:12Z.


Follow-up for @SleglJan: I tried fix/757-key-domain (0a7d5dad7, cherry-picked onto the stack above) on Guardians of the Galaxy (PPSA01748). It doesn't narrow this title's tables: they still bind 257–342 entries per frame, the same as without it. The relevant tests pass on the combined stack, including agc_shader_memory with the new SRT-key case.

The reason is the key shape. I logged every table key that ends up with no domain. All 12 in this title are the same loop-carried index:

Phi(<init>, IAdd32(Phi, <step>))

So the shader walks the table in a loop and samples each entry up to a bound. No key domain can narrow that to one record, because the shader may really read every entry below the bound. A domain bounded by the loop limit would still leave hundreds of entries here. For this title the remaining cost is per bound entry, at about 150 µs each, roughly 45 ms per frame at about 300 entries.

FPS on the same screen, no shader cache in either run:

  • With the patch: 2.5–3.8.
  • Without it: 3.5–6.

The difference may just be the uncached runs; I haven't separated it out.

Details

The diagnostic is local: it prints IrOpcodeName of the key and its first arguments when MatchKeyDomain returns no domain in TryMakeTableColumn. The two Void operands it printed are the loop's initial value and step, which aren't instructions.

These are the same shaders whose index chain shows up in the GetImageResource dword 0 failures this title had before #757 and #758: a loop-carried Phi/IAdd32 shifted left.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134642402 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6134642402). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-12T23:33:12Z. --- Follow-up for @SleglJan: I tried `fix/757-key-domain` (0a7d5dad7, cherry-picked onto the stack above) on Guardians of the Galaxy (PPSA01748). It doesn't narrow this title's tables: they still bind 257–342 entries per frame, the same as without it. The relevant tests pass on the combined stack, including `agc_shader_memory` with the new SRT-key case. The reason is the key shape. I logged every table key that ends up with no domain. All 12 in this title are the same loop-carried index: ``` Phi(<init>, IAdd32(Phi, <step>)) ``` So the shader walks the table in a loop and samples each entry up to a bound. No key domain can narrow that to one record, because the shader may really read every entry below the bound. A domain bounded by the loop limit would still leave hundreds of entries here. For this title the remaining cost is per bound entry, at about 150 µs each, roughly 45 ms per frame at about 300 entries. FPS on the same screen, no shader cache in either run: - With the patch: 2.5–3.8. - Without it: 3.5–6. The difference may just be the uncached runs; I haven't separated it out. <details><summary>Details</summary> The diagnostic is local: it prints `IrOpcodeName` of the key and its first arguments when `MatchKeyDomain` returns no domain in `TryMakeTableColumn`. The two `Void` operands it printed are the loop's initial value and step, which aren't instructions. These are the same shaders whose index chain shows up in the `GetImageResource dword 0` failures this title had before #757 and #758: a loop-carried `Phi`/`IAdd32` shifted left. </details> *Tested and written by Claude (AI assistant) on a contributor's machine.*
Dextroid17 commented 2026-10-13 00:12:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-13T00:12:12Z.


Rebase check, read-only. I did not touch this branch.

State. The PR head 753c29396 conflicts with main (1c5e62878). tv7's rebase/757 (8945fe208, one commit on 44ab0c39e) is 147 commits behind main now, and merging it into main conflicts in three files:

  • core/shader/recompiler/Optimization/src/ResourceTracker.cpp, in Run(): main now sets up m_blockSources and m_blockImages there, and the PR replaces PlanIndirectImages() with PlanTableColumns().
  • core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp, in noteReusable(): main added a RefreshedPerUse() texture check, and the PR changed the line after it to skip ImageTableMap allocations.
  • core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp, the test list and the test definitions.

How I resolved them (scratch merge of 8945fe208 into 1c5e62878, not pushed):

  • ResourceTracker.cpp: kept main's block-index setup and called PlanTableColumns().
  • ShaderResources.cpp: kept both, main's RefreshedPerUse() check and the PR's ImageTableMap exemption.
  • ShaderMemory.cpp: kept verifyGuardedDescriptorSources and the PR's verifyImageTableKeys, verifyImageTables and verifyImageTableRegistration. I dropped main's verifyBindlessTable, because it exercises the indirect-image path this PR removes.

Results. GCC 16.2.1, Release, Linux, lavapipe. agc_driver_image_table_tests, agc_driver_image_table_cache_tests, agc_driver_image_table_reuse_tests, agc_driver_bindless_images_tests and agc_shader_memory_tests all exit 0. tools/check_conventions.py --base upstream/main passes.

Not tested: native RADV, the full suite, and any title. A lavapipe pass says nothing about adriadam10's RADV vkAllocateDescriptorSets -12 (reviews of 10 Oct). He reported it gone at the earlier head e904eb18, but this head, 753c29396, has not been run on RADV.

Question for the author: should main's verifyBindlessTable be ported to the table design? I dropped it only because it depends on the removed path, and I can't judge the coverage it gave.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135085432 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6135085432). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-13T00:12:12Z. --- Rebase check, read-only. I did not touch this branch. **State.** The PR head `753c29396` conflicts with `main` (`1c5e62878`). tv7's `rebase/757` (`8945fe208`, one commit on `44ab0c39e`) is 147 commits behind `main` now, and merging it into `main` conflicts in three files: - `core/shader/recompiler/Optimization/src/ResourceTracker.cpp`, in `Run()`: `main` now sets up `m_blockSources` and `m_blockImages` there, and the PR replaces `PlanIndirectImages()` with `PlanTableColumns()`. - `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`, in `noteReusable()`: `main` added a `RefreshedPerUse()` texture check, and the PR changed the line after it to skip `ImageTableMap` allocations. - `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`, the test list and the test definitions. **How I resolved them** (scratch merge of `8945fe208` into `1c5e62878`, not pushed): - `ResourceTracker.cpp`: kept `main`'s block-index setup and called `PlanTableColumns()`. - `ShaderResources.cpp`: kept both, `main`'s `RefreshedPerUse()` check and the PR's `ImageTableMap` exemption. - `ShaderMemory.cpp`: kept `verifyGuardedDescriptorSources` and the PR's `verifyImageTableKeys`, `verifyImageTables` and `verifyImageTableRegistration`. I dropped `main`'s `verifyBindlessTable`, because it exercises the indirect-image path this PR removes. **Results.** GCC 16.2.1, Release, Linux, lavapipe. `agc_driver_image_table_tests`, `agc_driver_image_table_cache_tests`, `agc_driver_image_table_reuse_tests`, `agc_driver_bindless_images_tests` and `agc_shader_memory_tests` all exit 0. `tools/check_conventions.py --base upstream/main` passes. **Not tested:** native RADV, the full suite, and any title. A lavapipe pass says nothing about adriadam10's RADV `vkAllocateDescriptorSets` -12 (reviews of 10 Oct). He reported it gone at the earlier head `e904eb18`, but this head, `753c29396`, has not been run on RADV. **Question for the author:** should `main`'s `verifyBindlessTable` be ported to the table design? I dropped it only because it depends on the removed path, and I can't judge the coverage it gave.
Tamalero commented 2026-10-13 01:18:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-13T01:18:03Z.


@Celegans12 Why the remaining Guardians of the Galaxy (PPSA01748) shaders (pcs 0x4378/0x4380) don't become a table column, reproduced offline with agc_shader_replay on the stack above (#757 + #758):

The T# is loaded in two halves through the same pointer, but the two offsets are computed separately. Dwords 0–3 come from the load at 0x4378 and dwords 4–7 from the load at 0x4380. Both use the same GetAddressResource(ReadConst(SRT), ReadConst(SRT)) pointer. The second half's +16 is folded into its offset before the ReadFirstLane, instead of being an immediate:

dword 0 offset: ShiftLeftLogical32(ReadFirstLane(SelectU32(..., LogicalAnd(...))), Immediate)
dword 4 offset: ReadFirstLane(SelectU32(LogicalAnd(...), IAdd32(...)), LogicalAnd(Phi, FPOrdLessThan32))

So TryMakeTableColumn stops at the per-dword check: dword 4 reads immediate offset 0x0 where it expects first + 16 = 0x10. Even with that relaxed, EquivalentValue(offset, read->Argument(1)) can't hold, because the two offset values only agree at run time. Of the 111 image handles in the shader, this is the only one that gets this far; the rest are not table loads.

The index itself is a light-list walk: FindILsb32 over a mask from an ImageRead, made uniform with ReadFirstLane. So a key domain can't narrow it, and the column has to take the whole range behind the pointer.

Two possible ways to accept it, if this shape is in scope for #757/#758:

  • Prove offset4 == offset0 + 16 by walking both expressions together through ReadFirstLane/SelectU32/Phi, with the IAdd32(…, 16) on the dword-4 side.
  • Check at run time that both halves resolve to the same record and fault otherwise, using the poison path the table ABI already has.

Ratchet & Clank: Rift Apart (PPSA01474, see #4706) stops at a related shape: compute shader 0x116bb65f00, a T# through a pointer that is itself read from a V# (ReadConstBuffer@0x1aa8) at a ReadFirstLane waterfall index, at pc 0x6340. I haven't traced that one yet; its request isn't in the log.

Would you like us to take on some of this? I work with Claude Code on this machine, and either part is something we could try:

  • the two-halves case;
  • the Ratchet pointer-from-V# case;
  • the light-list key with no domain.

It would be a commit on top of your branch or a follow-up PR, whichever you prefer. I'd rather not start without your view on which approach fits #757's design. I can also run any branch you push on both titles and report back.

How it was traced

A local diagnostic in TryMakeTableColumn names which return false each GetImageResource handle takes:

  • 110 handles fail at "no scalar or address memory read" (not table loads);
  • 1 fails at the dword-4 offset check, which is the T# above.

It then prints both dwords' handle and offset IR, which is where the two expressions above come from. The request replays with agc_shader_replay (4824 code words, 14 user data, wave64, 4×4×4 threads). It's game code, so I'm not attaching it.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135969568 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6135969568). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-13T01:18:03Z. --- @Celegans12 Why the remaining Guardians of the Galaxy (PPSA01748) shaders (pcs `0x4378`/`0x4380`) don't become a table column, reproduced offline with `agc_shader_replay` on the stack above (#757 + #758): **The T# is loaded in two halves through the same pointer, but the two offsets are computed separately.** Dwords 0–3 come from the load at `0x4378` and dwords 4–7 from the load at `0x4380`. Both use the same `GetAddressResource(ReadConst(SRT), ReadConst(SRT))` pointer. The second half's +16 is folded into its offset before the `ReadFirstLane`, instead of being an immediate: ``` dword 0 offset: ShiftLeftLogical32(ReadFirstLane(SelectU32(..., LogicalAnd(...))), Immediate) dword 4 offset: ReadFirstLane(SelectU32(LogicalAnd(...), IAdd32(...)), LogicalAnd(Phi, FPOrdLessThan32)) ``` So `TryMakeTableColumn` stops at the per-dword check: dword 4 reads immediate offset `0x0` where it expects `first + 16 = 0x10`. Even with that relaxed, `EquivalentValue(offset, read->Argument(1))` can't hold, because the two offset values only agree at run time. Of the 111 image handles in the shader, this is the only one that gets this far; the rest are not table loads. The index itself is a light-list walk: `FindILsb32` over a mask from an `ImageRead`, made uniform with `ReadFirstLane`. So a key domain can't narrow it, and the column has to take the whole range behind the pointer. Two possible ways to accept it, if this shape is in scope for #757/#758: - **Prove** `offset4 == offset0 + 16` by walking both expressions together through `ReadFirstLane`/`SelectU32`/`Phi`, with the `IAdd32(…, 16)` on the dword-4 side. - **Check at run time** that both halves resolve to the same record and fault otherwise, using the poison path the table ABI already has. Ratchet & Clank: Rift Apart (PPSA01474, see #4706) stops at a related shape: compute shader `0x116bb65f00`, a T# through a pointer that is itself read from a V# (`ReadConstBuffer@0x1aa8`) at a `ReadFirstLane` waterfall index, at pc `0x6340`. I haven't traced that one yet; its request isn't in the log. **Would you like us to take on some of this?** I work with Claude Code on this machine, and either part is something we could try: - the two-halves case; - the Ratchet pointer-from-V# case; - the light-list key with no domain. It would be a commit on top of your branch or a follow-up PR, whichever you prefer. I'd rather not start without your view on which approach fits #757's design. I can also run any branch you push on both titles and report back. <details><summary>How it was traced</summary> A local diagnostic in `TryMakeTableColumn` names which `return false` each `GetImageResource` handle takes: - 110 handles fail at "no scalar or address memory read" (not table loads); - 1 fails at the dword-4 offset check, which is the T# above. It then prints both dwords' handle and offset IR, which is where the two expressions above come from. The request replays with `agc_shader_replay` (4824 code words, 14 user data, wave64, 4×4×4 threads). It's game code, so I'm not attaching it. </details> *Tested and written by Claude (AI assistant) on a contributor's machine.*
Dextroid17 commented 2026-10-13 02:00:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-13T02:00:31Z.


Measurement on Ghost of Yotei (PPSA26344), llvmpipe (LLVM 23.1.1) through lavapipe, no AMD hardware, so no RADV claim.

Stack. main at 510a2188c plus tv7's rebase/757 (8945fe208), merged locally as 4702369de. It hits the same three conflicting files as in my rebase check above (that check was against 1c5e62878, this run against 510a2188c).

Result on this title. On main alone the run aborts at compute shader 0x80003aa700 (the record-table shader from #2715). That one failure appears in 3 log lines: the registration warning, presentation failed, and what():. With #757 stacked, 0x80003aa700 appears in 0 log lines, and the run stops at a different shader. The presentation failed line reads:

compute shader 0x800027c200: ... ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x00000e58(GetAddressResource(GetUserData(Void), GetUserData(Void)), ...

The chain starts with LoadAddressU32 on a GetAddressResource pointer, which is the shape #758 handles.

This is one stop on one device. The title does not reach gameplay, and I am not claiming it does.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6136459321 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6136459321). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-13T02:00:31Z. --- Measurement on Ghost of Yotei (PPSA26344), llvmpipe (LLVM 23.1.1) through lavapipe, no AMD hardware, so no RADV claim. **Stack.** `main` at `510a2188c` plus tv7's `rebase/757` (`8945fe208`), merged locally as `4702369de`. It hits the same three conflicting files as in my rebase check above (that check was against `1c5e62878`, this run against `510a2188c`). **Result on this title.** On `main` alone the run aborts at compute shader `0x80003aa700` (the record-table shader from #2715). That one failure appears in 3 log lines: the registration warning, `presentation failed`, and `what():`. With #757 stacked, `0x80003aa700` appears in 0 log lines, and the run stops at a different shader. The `presentation failed` line reads: ``` compute shader 0x800027c200: ... ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x00000e58(GetAddressResource(GetUserData(Void), GetUserData(Void)), ... ``` The chain starts with `LoadAddressU32` on a `GetAddressResource` pointer, which is the shape #758 handles. This is one stop on one device. The title does not reach gameplay, and I am not claiming it does.
Celegans12 commented 2026-10-13 02:27:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-13T02:27:38Z.


@adriadam10, sorry for leaving your question from Sunday open. Short answer: the old head changed neither cost report, and this one changes both, though only partly for keys that can't be narrowed. I've rebased onto main 37dd4830 and pushed the changes as one commit.

Here's what changed for each report:

  • @SleglJan's word-by-word snapshot. Records are now read in contiguous runs through a bulk ShaderMemory::readWords (that reader is Jan's, from his perf/image-table-snapshot-reuse), and the per-record lookups use a hash instead of an ordered map. Offline, an 18,960-record table now takes 1.6 ms per capture instead of 4.2 ms on my machine, including the page fetches. Jan's per-thread memo would cut it further, so I've left that for his follow-up, as he planned.
  • @tv7's "every entry below imageTableCapacity". The driver only builds textures for the entries the snapshot holds. So the real lever is narrowing, and I've folded in Jan's fix/757-key-domain: a key the SRT walker can evaluate now narrows the table to the selected record. It's in this commit with credit in the message. That still doesn't help @Tamalero's Guardians tables. Their keys are loop counters (Phi(init, IAdd(Phi, step))), so the shader really can reach every entry below the loop bound. @tv7, your 2,493-entry heap on 8 GB will still run out of device memory if its key is one of the shapes that can't be narrowed. A texture byte budget would turn that into a fault whenever the shader selects an entry past the budget. I'd rather not decide that policy inside this PR. Would a separate issue for it work for you?
  • @Tamalero's garbage slots. I took his fix in a slightly narrower form: a table T# whose surface has no mapped byte at all is now rejected, like a decode failure. It reads zeros and only faults if a lane selects it. Surfaces that are partly mapped are still bound the way a direct T# is, so this doesn't stop anything that works today. agc_driver_image_table now requires the fault for such an entry. With the fix reverted, that check fails.

@tibzejoker, your GTA numbers (1.22 → 0.65 → 0.77 FPS) were measured before both changes. If you get a chance, a rerun on this head would show how much is left.

The rebase itself follows @tv7's rebase/757: per-set table bindings, so a fragment table sits in the fragment set when pipeline libraries split it. That should also cover the set-0 crash @Mouhand-Kaddo found on RADV. For the rest of the rebase I used @Dextroid17's conflict notes. On his question: I didn't port verifyBindlessTable. Its two modes, keys from material records and the whole table, are what verifyImageTableKeys and verifyImageTables cover now with TableMaterialCode and TableWholeCode.

@oneandonlydean, thanks for rerunning the reuse test. Could you run agc_driver_image_table_reuse and agc_driver_image_table once more on the 4090? And @adriadam10, could you run agc_driver_bindless_images on RADV again? Both changed since your runs.

Details
  • Both suites ran on #758's head, which contains this commit, one rebase before the final one; that rebase only resolved a DepthSurface.cpp conflict with main.
  • Windows NVIDIA (RTX 3080 Laptop): 1,023/1,024 pass; log_macros fails on main too.
  • Linux (upstream's job in WSL, lavapipe), merged with main 0c3dc9ca: 1,006/1,007 pass; agc_driver_depth_compare_copy fails on main too.
  • Snapshot benchmark: 18,960 records of 8 dwords, 1,600 distinct T#s, a fresh ShaderMemory per capture, median of 60. Before: 4.2 ms. After: 1.6 ms, or 1.0 ms with the pages already fetched. Of the remaining time, about 0.7 ms is the per-record descriptor lookup.
  • New checks: agc_shader_bindless compares run reads with word reads. That includes a run across a page and a record cut by an unmapped page, with identical snapshots and captured regions. It also includes Jan's SRT-key case, which fails with his tracker change reverted.
  • Disk format 29, because main took 28 since my last push. Runtime ABI 12.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6136868926 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6136868926). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-13T02:27:38Z. --- @adriadam10, sorry for leaving your question from Sunday open. Short answer: the old head changed neither cost report, and this one changes both, though only partly for keys that can't be narrowed. I've rebased onto `main` 37dd4830 and pushed the changes as one commit. Here's what changed for each report: - **@SleglJan's word-by-word snapshot.** Records are now read in contiguous runs through a bulk `ShaderMemory::readWords` (that reader is Jan's, from his `perf/image-table-snapshot-reuse`), and the per-record lookups use a hash instead of an ordered map. Offline, an 18,960-record table now takes 1.6 ms per capture instead of 4.2 ms on my machine, including the page fetches. Jan's per-thread memo would cut it further, so I've left that for his follow-up, as he planned. - **@tv7's "every entry below `imageTableCapacity`".** The driver only builds textures for the entries the snapshot holds. So the real lever is narrowing, and I've folded in Jan's `fix/757-key-domain`: a key the SRT walker can evaluate now narrows the table to the selected record. It's in this commit with credit in the message. That still doesn't help @Tamalero's Guardians tables. Their keys are loop counters (`Phi(init, IAdd(Phi, step))`), so the shader really can reach every entry below the loop bound. @tv7, your 2,493-entry heap on 8 GB will still run out of device memory if its key is one of the shapes that can't be narrowed. A texture byte budget would turn that into a fault whenever the shader selects an entry past the budget. I'd rather not decide that policy inside this PR. Would a separate issue for it work for you? - **@Tamalero's garbage slots.** I took his fix in a slightly narrower form: a table T# whose surface has no mapped byte at all is now rejected, like a decode failure. It reads zeros and only faults if a lane selects it. Surfaces that are partly mapped are still bound the way a direct T# is, so this doesn't stop anything that works today. `agc_driver_image_table` now requires the fault for such an entry. With the fix reverted, that check fails. @tibzejoker, your GTA numbers (1.22 → 0.65 → 0.77 FPS) were measured before both changes. If you get a chance, a rerun on this head would show how much is left. The rebase itself follows @tv7's `rebase/757`: per-set table bindings, so a fragment table sits in the fragment set when pipeline libraries split it. That should also cover the set-0 crash @Mouhand-Kaddo found on RADV. For the rest of the rebase I used @Dextroid17's conflict notes. On his question: I didn't port `verifyBindlessTable`. Its two modes, keys from material records and the whole table, are what `verifyImageTableKeys` and `verifyImageTables` cover now with `TableMaterialCode` and `TableWholeCode`. @oneandonlydean, thanks for rerunning the reuse test. Could you run `agc_driver_image_table_reuse` and `agc_driver_image_table` once more on the 4090? And @adriadam10, could you run `agc_driver_bindless_images` on RADV again? Both changed since your runs. <details><summary>Details</summary> - Both suites ran on #758's head, which contains this commit, one rebase before the final one; that rebase only resolved a `DepthSurface.cpp` conflict with `main`. - Windows NVIDIA (RTX 3080 Laptop): 1,023/1,024 pass; `log_macros` fails on `main` too. - Linux (upstream's job in WSL, lavapipe), merged with `main` 0c3dc9ca: 1,006/1,007 pass; `agc_driver_depth_compare_copy` fails on `main` too. - Snapshot benchmark: 18,960 records of 8 dwords, 1,600 distinct T#s, a fresh `ShaderMemory` per capture, median of 60. Before: 4.2 ms. After: 1.6 ms, or 1.0 ms with the pages already fetched. Of the remaining time, about 0.7 ms is the per-record descriptor lookup. - New checks: `agc_shader_bindless` compares run reads with word reads. That includes a run across a page and a record cut by an unmapped page, with identical snapshots and captured regions. It also includes Jan's SRT-key case, which fails with his tracker change reverted. - Disk format 29, because `main` took 28 since my last push. Runtime ABI 12. </details>
Ondra97 commented 2026-10-13 03:47:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-13T03:47:42Z.


I reviewed the overlap with #4757, #757 and #758. #4757 fixes a reproduced CPU memo hash collision by retaining an owned ResourceSnapshot and checking exact Matches at both lookups. Your image-table snapshots own their vectors and provide nested default equality, so retaining ResourceSnapshot::operator== would automatically include the new tables, including #758's readRanges.

I propose landing #4757 first, then rebasing #757/#758 while retaining that equality and the collision regression alongside the image-table checks. I have not tested the combined branches. Would you agree to this order? If agreed, #4757 would keep Depends on: none, and the following PRs would declare #4757 as a dependency.

AI-assisted: yes. — Codex

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137782512 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6137782512). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-13T03:47:42Z. --- I reviewed the overlap with #4757, #757 and #758. #4757 fixes a reproduced CPU memo hash collision by retaining an owned ResourceSnapshot and checking exact Matches at both lookups. Your image-table snapshots own their vectors and provide nested default equality, so retaining ResourceSnapshot::operator== would automatically include the new tables, including #758's readRanges. I propose landing #4757 first, then rebasing #757/#758 while retaining that equality and the collision regression alongside the image-table checks. I have not tested the combined branches. Would you agree to this order? If agreed, #4757 would keep Depends on: none, and the following PRs would declare #4757 as a dependency. AI-assisted: yes. — Codex
SleglJan commented 2026-10-13 04:27:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-13T04:27:58Z.


@Celegans12 thanks for folding the SRT key domain into f99f5ecdc. @tibzejoker @Tamalero thanks for testing it. Two problems with it turned up on 007 since I posted it, and both are fixed on our stack. The first is now in f99f5ecdc too; a one-commit fix on top of it follows.

  1. A table column's identity includes its key domain (TableColumn's defaulted operator==). Once accesses get domains, accesses with different key expressions over the same table become separate columns, image resources and snapshot columns.
    • In one of 007's 12 affected shaders, the patch together with our follow-up key shapes (peeled, shifted, masked and record-strided keys; not in the posted commit) raised image resources from 28 to 37. It also split that shader's 18,960-record heap into 13+ columns. In two others, image resources went from 38 to 49 and from 7 to 10.
    • Fewer uses per image loosened each image's flags, so the per-access mode switch in the lighting shaders grew from 6 to 9 cases (20 in one other shader).
    • Menu FPS fell from 3.4–3.6 to 2.3–2.75 across three runs.
    • The fix keeps one column per heap access shape with a list of domains. An access without a domain keeps the shared column whole. Otherwise the column narrows to another access's key and the domainless reads hit poison, which our first version of the fix did: "outside the key domain" faults and zero reads.
    • With both, the 12 affected shaders compile to the same SPIR-V as without the patch. Menu FPS came back to 3.15–3.46 with the domain list alone (the run that showed the poisoned reads). With the unkeyed rule as well it was 2.85–3.20 in the next two runs, on builds that also carried other changes, so that step isn't isolated.
  2. Narrowing before the walk defeats the memos. This one isn't in f99f5ecdc, which has no memo of the snapshot walk yet. It matters for the per-thread memo follow-up you left for me. The whole-snapshot memo skips keyed columns, and the column memo is keyed on the pre-walk record states, which change with every key value, so neither hits. On our stack the fix walks the whole domain as before and applies the narrowing afterwards as a mask over the output codes. That will go into the memo follow-up.

@Tamalero your loop-carried Phi/IAdd32 keys get no domain from the patch, as you found. It only changes such a shader if another access in it does get a domain, and then problem 1 applies. I can't tell from here whether that's behind your 2.5–3.8 vs 3.5–6 FPS. On the unmapped slots: across two of our 007 runs (~142k texture creations) no such surface reached creation (the largest was 6400x4096), so it's not a lever there, but the rejection is harmless for us.

Patch: SleglJan/AnyPS5 fix/757-key-domain-v2 at 92bdcdbfa, one commit on f99f5ecdc (4 files, +144/−32).

  • A column's identity is its heap access shape; it carries a list of key domains.
  • Each access merges its domain into the shared column and keeps its own domain alive at its own position, so no key is referenced before it is defined.
  • An access without a domain marks the column unkeyed (whole domain), in either access order.
  • A store to any of the column's key buffers clears all its domains.
  • Narrow marks the union of all domains' records and keeps record 0.
  • New ShaderMemory cases under agc_shader_bindless:
    • two SRT-keyed reads plan one image and bind the union;
    • the same with the second key loaded after the first read;
    • an SRT-keyed read and a read keyed by v_readfirstlane of a per-lane buffer load leave the column whole, checked in both orders.
  • Adapted to f99f5ecdc's single keyDomain field, the union case's planning check fails there: two images are planned for the two keyed reads.
  • Tested on Linux with lavapipe: the 6 table tests pass, and the full agc set 456/457, where agc_driver_depth_compare_copy fails on main too. Conventions pass against f99f5ecdc.
  • Not run on a GPU or a title at f99f5ecdc: our 007 request dumps don't load on that head.

@tibzejoker if you rerun GTA on f99f5ecdc, this commit on top would show whether split columns cost anything there.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6138234535 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6138234535). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-13T04:27:58Z. --- @Celegans12 thanks for folding the SRT key domain into f99f5ecdc. @tibzejoker @Tamalero thanks for testing it. Two problems with it turned up on 007 since I posted it, and both are fixed on our stack. The first is now in f99f5ecdc too; a one-commit fix on top of it follows. 1. **A table column's identity includes its key domain** (`TableColumn`'s defaulted `operator==`). Once accesses get domains, accesses with different key expressions over the same table become separate columns, image resources and snapshot columns. - In one of 007's 12 affected shaders, the patch together with our follow-up key shapes (peeled, shifted, masked and record-strided keys; not in the posted commit) raised image resources from 28 to 37. It also split that shader's 18,960-record heap into 13+ columns. In two others, image resources went from 38 to 49 and from 7 to 10. - Fewer uses per image loosened each image's flags, so the per-access mode switch in the lighting shaders grew from 6 to 9 cases (20 in one other shader). - Menu FPS fell from 3.4–3.6 to 2.3–2.75 across three runs. - The fix keeps one column per heap access shape with a list of domains. An access without a domain keeps the shared column whole. Otherwise the column narrows to another access's key and the domainless reads hit poison, which our first version of the fix did: "outside the key domain" faults and zero reads. - With both, the 12 affected shaders compile to the same SPIR-V as without the patch. Menu FPS came back to 3.15–3.46 with the domain list alone (the run that showed the poisoned reads). With the unkeyed rule as well it was 2.85–3.20 in the next two runs, on builds that also carried other changes, so that step isn't isolated. 2. **Narrowing before the walk defeats the memos.** This one isn't in f99f5ecdc, which has no memo of the snapshot walk yet. It matters for the per-thread memo follow-up you left for me. The whole-snapshot memo skips keyed columns, and the column memo is keyed on the pre-walk record states, which change with every key value, so neither hits. On our stack the fix walks the whole domain as before and applies the narrowing afterwards as a mask over the output codes. That will go into the memo follow-up. @Tamalero your loop-carried `Phi`/`IAdd32` keys get no domain from the patch, as you found. It only changes such a shader if another access in it does get a domain, and then problem 1 applies. I can't tell from here whether that's behind your 2.5–3.8 vs 3.5–6 FPS. On the unmapped slots: across two of our 007 runs (~142k texture creations) no such surface reached creation (the largest was 6400x4096), so it's not a lever there, but the rejection is harmless for us. **Patch:** SleglJan/AnyPS5 `fix/757-key-domain-v2` at 92bdcdbfa, one commit on f99f5ecdc (4 files, +144/−32). - A column's identity is its heap access shape; it carries a list of key domains. - Each access merges its domain into the shared column and keeps its own domain alive at its own position, so no key is referenced before it is defined. - An access without a domain marks the column unkeyed (whole domain), in either access order. - A store to any of the column's key buffers clears all its domains. - `Narrow` marks the union of all domains' records and keeps record 0. - New `ShaderMemory` cases under `agc_shader_bindless`: - two SRT-keyed reads plan one image and bind the union; - the same with the second key loaded after the first read; - an SRT-keyed read and a read keyed by `v_readfirstlane` of a per-lane buffer load leave the column whole, checked in both orders. - Adapted to f99f5ecdc's single `keyDomain` field, the union case's planning check fails there: two images are planned for the two keyed reads. - Tested on Linux with lavapipe: the 6 table tests pass, and the full agc set 456/457, where `agc_driver_depth_compare_copy` fails on `main` too. Conventions pass against f99f5ecdc. - Not run on a GPU or a title at f99f5ecdc: our 007 request dumps don't load on that head. @tibzejoker if you rerun GTA on f99f5ecdc, this commit on top would show whether split columns cost anything there. AI-assisted: yes (Claude Code)
tibzejoker commented 2026-10-13 04:51:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-13T04:51:56Z.


@Celegans12 GTA V (PPSA04264) rerun on f99f5ecdc. Windows 11, RTX 4090, 64 GB RAM. Story prologue, same scene as my earlier numbers, FPS from frames counted over t=30..120 s.

The base is now main 37dd48308 plus the open PRs GTA needs, so I measured with and without #757 on that same base:

FPS process RAM
without #757 1.33 31-32 GB
with #757 at f99f5ecdc 0.78 36-38 GB
with #757 at f99f5ecdc + SleglJan's fix/757-key-domain-v2 (92bdcdbfa) 0.74 37-38 GB
earlier, older base: without / 8945fe208 / 8945fe208 + fix/757-key-domain 1.22 / 0.65 / 0.77 25-26 / 30-31 / 32 GB
  • The two 65536-entry bindless tables (0x25b456800, 0x25b458e00) still dispatch with #757. Without it they fail and are skipped, so the "without" row does less GPU work than the "with" row.
  • The cost ratio is about the same as with the old head plus the key-domain fix, and RAM is higher. 92bdcdbfa cherry-picks cleanly and doesn't change GTA either way (one run, within noise). I didn't profile where it goes this time.
  • The only in-order failure left is still 0x25b45a200: GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@.... Its T# index comes from a second constant buffer.
  • No table element was rejected as unmapped in my earlier check of that fix on this title, so that part doesn't change GTA.

Two things outside this PR were needed to get this far on current main, for anyone stacking on it:

  • #4410 (merged) makes GTA fail about 30 s into Story: dozens of JobManager dispatches read a block that is all 0xFF, then one aborts on buffer descriptor has reserved bits set. Main up to e55b881f0 is fine, and reverting #4410 alone fixes it. I'll write it up separately.
  • #4500's newer head (889e5d436) refuses a 2D-array/cube depth storage view that GTA uses (compute 0x242d4a200), so I reverted that commit locally.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6138499525 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6138499525). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-13T04:51:56Z. --- @Celegans12 GTA V (PPSA04264) rerun on f99f5ecdc. Windows 11, RTX 4090, 64 GB RAM. Story prologue, same scene as my earlier numbers, FPS from frames counted over t=30..120 s. The base is now main 37dd48308 plus the open PRs GTA needs, so I measured with and without #757 on that same base: | | FPS | process RAM | |---|---:|---:| | without #757 | 1.33 | 31-32 GB | | with #757 at f99f5ecdc | 0.78 | 36-38 GB | | with #757 at f99f5ecdc + SleglJan's `fix/757-key-domain-v2` (92bdcdbfa) | 0.74 | 37-38 GB | | earlier, older base: without / 8945fe208 / 8945fe208 + `fix/757-key-domain` | 1.22 / 0.65 / 0.77 | 25-26 / 30-31 / 32 GB | - The two 65536-entry bindless tables (`0x25b456800`, `0x25b458e00`) still dispatch with #757. Without it they fail and are skipped, so the "without" row does less GPU work than the "with" row. - The cost ratio is about the same as with the old head plus the key-domain fix, and RAM is higher. 92bdcdbfa cherry-picks cleanly and doesn't change GTA either way (one run, within noise). I didn't profile where it goes this time. - The only in-order failure left is still `0x25b45a200`: `GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@...`. Its T# index comes from a second constant buffer. - No table element was rejected as unmapped in my earlier check of that fix on this title, so that part doesn't change GTA. Two things outside this PR were needed to get this far on current main, for anyone stacking on it: - #4410 (merged) makes GTA fail about 30 s into Story: dozens of JobManager dispatches read a block that is all 0xFF, then one aborts on `buffer descriptor has reserved bits set`. Main up to e55b881f0 is fine, and reverting #4410 alone fixes it. I'll write it up separately. - #4500's newer head (889e5d436) refuses a 2D-array/cube depth storage view that GTA uses (compute `0x242d4a200`), so I reverted that commit locally. AI-assisted (Claude Code).
tibzejoker commented 2026-10-13 07:50:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-13T07:50:18Z.


@Celegans12 the last in-order failure in GTA V (PPSA04264) with this PR, and a one-commit fix on top of f99f5ecdc, in case it fits #757.

Shape. Compute shader 0x25b45a200 reads its T# with s_buffer_load from a V# at (key << 5) & mask. The key itself is a ReadConstBuffer from a second V# at a v_readfirstlane index. Only key * stride (+ addend) offsets are matched as a table column, so it stops on f99f5ecdc with:

GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x000013b8(GetBufferResource(ReadConst(GetSrtResource, Immediate), ...), BitwiseAnd32(ShiftLeftLogical32(ReadConstBuffer@pc=0x0000135c(GetBufferResource(...), ReadFirstLane(...)), Immediate), Immediate))

Patch: tibzejoker/AnyPS5 fix/757-masked-table-offset at 2a2f96385, one commit on f99f5ecdc (3 files, +58/−3).

  • TryMakeTableColumn also accepts BitwiseAnd32(ShiftLeftLogical32|IMul32(key, 2^n), imm): the shift is the stride, the addend is 0.
  • The handle still takes the full masked offset (as the column path already does), so the record the shader selects is exact.
  • The key gets no key domain. A domain would narrow by the unmasked key value, which selects the wrong record when the key carries bits above the mask. So the column binds its whole domain, and a line in docs/dev/debt/shader.md says so.
  • New ShaderMemory case verifyImageTableMaskedOffset. It runs TableMaterialCode with an s_and_b32 after the shift, and keys that carry bits above the mask. It checks the column (stride 32, no key domain) and that the whole table is bound. On f99f5ecdc it fails with the same GetImageResource dword 0 error.

Tested on Windows 11, RTX 4090, GCC 15.2.0 UCRT, Release:

  • agc_shader_memory, agc_shader_bindless, agc_driver_image_table, agc_driver_image_table_cache, agc_driver_image_table_reuse and agc_driver_bindless_images pass.
  • tools/check_conventions.py --base f99f5ecdc passes.
  • With agc_shader_replay, GTA's request now passes resource analysis. It then stops at SrtWalker::EvaluateDescriptorSources, because replay has no guest memory.
  • In game: on our GTA stack (main 37dd48308 plus f99f5ecdc and the other open PRs it needs), with this commit 0x25b45a200 dispatches. For the first time the Story prologue runs with no failing dispatch at all: our local skip-on-error hack never fired in 150 s, and the rendering is correct. Binding the whole domain costs FPS: 0.56 against 0.66-0.78 when the shader was skipped, at the same 36-37 GB RAM.

Fold it in or take it as a follow-up, whichever you prefer.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140907362 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6140907362). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-13T07:50:18Z. --- @Celegans12 the last in-order failure in GTA V (PPSA04264) with this PR, and a one-commit fix on top of f99f5ecdc, in case it fits #757. **Shape.** Compute shader `0x25b45a200` reads its T# with `s_buffer_load` from a V# at `(key << 5) & mask`. The key itself is a `ReadConstBuffer` from a second V# at a `v_readfirstlane` index. Only `key * stride (+ addend)` offsets are matched as a table column, so it stops on f99f5ecdc with: ``` GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x000013b8(GetBufferResource(ReadConst(GetSrtResource, Immediate), ...), BitwiseAnd32(ShiftLeftLogical32(ReadConstBuffer@pc=0x0000135c(GetBufferResource(...), ReadFirstLane(...)), Immediate), Immediate)) ``` **Patch:** tibzejoker/AnyPS5 `fix/757-masked-table-offset` at 2a2f96385, one commit on f99f5ecdc (3 files, +58/−3). - `TryMakeTableColumn` also accepts `BitwiseAnd32(ShiftLeftLogical32|IMul32(key, 2^n), imm)`: the shift is the stride, the addend is 0. - The handle still takes the full masked offset (as the column path already does), so the record the shader selects is exact. - The key gets no key domain. A domain would narrow by the unmasked key value, which selects the wrong record when the key carries bits above the mask. So the column binds its whole domain, and a line in `docs/dev/debt/shader.md` says so. - **New `ShaderMemory` case `verifyImageTableMaskedOffset`.** It runs `TableMaterialCode` with an `s_and_b32` after the shift, and keys that carry bits above the mask. It checks the column (stride 32, no key domain) and that the whole table is bound. On f99f5ecdc it fails with the same `GetImageResource dword 0` error. **Tested** on Windows 11, RTX 4090, GCC 15.2.0 UCRT, Release: - `agc_shader_memory`, `agc_shader_bindless`, `agc_driver_image_table`, `agc_driver_image_table_cache`, `agc_driver_image_table_reuse` and `agc_driver_bindless_images` pass. - `tools/check_conventions.py --base f99f5ecdc` passes. - With `agc_shader_replay`, GTA's request now passes resource analysis. It then stops at `SrtWalker::EvaluateDescriptorSources`, because replay has no guest memory. - **In game:** on our GTA stack (main 37dd48308 plus f99f5ecdc and the other open PRs it needs), with this commit `0x25b45a200` dispatches. For the first time the Story prologue runs with **no failing dispatch at all**: our local skip-on-error hack never fired in 150 s, and the rendering is correct. Binding the whole domain costs FPS: 0.56 against 0.66-0.78 when the shader was skipped, at the same 36-37 GB RAM. Fold it in or take it as a follow-up, whichever you prefer. AI-assisted (Claude Code).
adriadam10 commented 2026-10-13 08:43:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T08:43:01Z.

Review: CHANGES_REQUESTED


Checked f99f5ecdc merged onto current main (Linux, RADV, libSceAgc + libSceAgcDriver scope): 493/494 ctest. agc_driver_image_table, _cache, _reuse, agc_driver_bindless_images, agc_driver_graphics and the shader memory/disk cache tests pass. The one failure, agc_driver_tessellation, is a SIGSEGV inside libvulkan_radeon from LinkPipelineFromLibraries; it also shows up on an unrelated PR here, so I'm not blaming this one. The new tests can't be run against main (they need ImageTableAbi.hpp), so no negative check from our side.

Before this can land:

  • docs/dev/ARCHITECTURE.md needs the change: runtime image/sampler tables, the map buffer, snapshots per invocation and the new disk format. The PR touches the descriptor flow and the cache but only edits docs/dev/debt.
  • Cost: @tibzejoker measured GTA V at 1.33 FPS without this PR and 0.78 with it (RAM 31-32 GB → 36-38 GB) on the same base, and @SleglJan's and @Tamalero's reports show tables not being narrowed (loop-carried keys Phi(init, IAdd32(Phi, step)), 257-342 bound entries per frame). Please say what you expect to bound this to, or narrow those cases, with a before/after on the same tree.
  • @SleglJan's key-domain follow-up (TableColumn equality including the domain) and @tibzejoker's one-commit fix for the (key << 5) & mask shape are not in this head; fold them in or say why not.
  • Order with #4757 (snapshot equality) and #4883 (also disk format 29): pick the sequence and rebase on the winner; the ABI/format numbers need to be final.
  • Merge needs the full Build dispatched for this head (linux/windows are skipped on the PR), since this changes the Windows-built runtime ABI too.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5500958343 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#pullrequestreview-5500958343). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-13T08:43:01Z. **Review:** CHANGES_REQUESTED --- Checked f99f5ecdc merged onto current `main` (Linux, RADV, libSceAgc + libSceAgcDriver scope): 493/494 ctest. `agc_driver_image_table`, `_cache`, `_reuse`, `agc_driver_bindless_images`, `agc_driver_graphics` and the shader memory/disk cache tests pass. The one failure, `agc_driver_tessellation`, is a SIGSEGV inside `libvulkan_radeon` from `LinkPipelineFromLibraries`; it also shows up on an unrelated PR here, so I'm not blaming this one. The new tests can't be run against `main` (they need `ImageTableAbi.hpp`), so no negative check from our side. Before this can land: - `docs/dev/ARCHITECTURE.md` needs the change: runtime image/sampler tables, the map buffer, snapshots per invocation and the new disk format. The PR touches the descriptor flow and the cache but only edits `docs/dev/debt`. - Cost: @tibzejoker measured GTA V at 1.33 FPS without this PR and 0.78 with it (RAM 31-32 GB → 36-38 GB) on the same base, and @SleglJan's and @Tamalero's reports show tables not being narrowed (loop-carried keys `Phi(init, IAdd32(Phi, step))`, 257-342 bound entries per frame). Please say what you expect to bound this to, or narrow those cases, with a before/after on the same tree. - @SleglJan's key-domain follow-up (`TableColumn` equality including the domain) and @tibzejoker's one-commit fix for the `(key << 5) & mask` shape are not in this head; fold them in or say why not. - Order with #4757 (snapshot equality) and #4883 (also disk format 29): pick the sequence and rebase on the winner; the ABI/format numbers need to be final. - Merge needs the full Build dispatched for this head (linux/windows are skipped on the PR), since this changes the Windows-built runtime ABI too.
adriadam10 commented 2026-10-13 13:10:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T13:10:35Z.

Review: CHANGES_REQUESTED


8ca1d7acd is a rebase onto main 0f2683cb (conflicts only); none of the points from the last review are addressed yet, and they still apply:

  • docs/dev/ARCHITECTURE.md still describes the descriptor flow without the runtime image/sampler tables, the map buffer, per-invocation snapshots and the new disk format. Add it under the section that covers runtime descriptors.
  • Cost: @tibzejoker measured GTA V at 1.33 FPS without this PR and 0.78 with it (RAM 31-32 GB → 36-38 GB) on the same base, and @SleglJan's and @Tamalero's reports show loop-carried keys (Phi(init, IAdd32(Phi, step))) binding 257-342 entries per frame. Please say what you expect to bound this to, or narrow those cases, with a before/after on the same tree.
  • @SleglJan's TableColumn key-domain follow-up and @tibzejoker's fix for the (key << 5) & mask shape are not in this head; fold them in or say why not.
  • Pick the order with #4757 (snapshot equality) and #4883 (also disk format 29) and rebase on the winner, so the ABI/format numbers are final.

Merge needs the full Build dispatched on the final head (linux/windows are skipped on PRs).

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5504019124 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#pullrequestreview-5504019124). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-13T13:10:35Z. **Review:** CHANGES_REQUESTED --- 8ca1d7acd is a rebase onto `main` 0f2683cb (conflicts only); none of the points from the last review are addressed yet, and they still apply: - `docs/dev/ARCHITECTURE.md` still describes the descriptor flow without the runtime image/sampler tables, the map buffer, per-invocation snapshots and the new disk format. Add it under the section that covers runtime descriptors. - Cost: @tibzejoker measured GTA V at 1.33 FPS without this PR and 0.78 with it (RAM 31-32 GB → 36-38 GB) on the same base, and @SleglJan's and @Tamalero's reports show loop-carried keys (`Phi(init, IAdd32(Phi, step))`) binding 257-342 entries per frame. Please say what you expect to bound this to, or narrow those cases, with a before/after on the same tree. - @SleglJan's `TableColumn` key-domain follow-up and @tibzejoker's fix for the `(key << 5) & mask` shape are not in this head; fold them in or say why not. - Pick the order with #4757 (snapshot equality) and #4883 (also disk format 29) and rebase on the winner, so the ABI/format numbers are final. Merge needs the full Build dispatched on the final head (linux/windows are skipped on PRs).
tibzejoker commented 2026-10-13 13:19:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-13T13:19:39Z.


@Celegans12 the (key << n) & mask fix applies cleanly on 8ca1d7acd: tibzejoker/AnyPS5 fix/757-masked-table-offset-8ca1, one commit f1a8500f3 on your head (3 files, +58/−3, same change as 2a2f96385).

On Windows 11, RTX 4090, GCC 15.2.0, Release:

  • agc_shader_memory, agc_shader_bindless, agc_driver_image_table, agc_driver_image_table_cache, agc_driver_image_table_reuse and agc_driver_bindless_images pass.
  • Without the ResourceTracker.cpp change, agc_shader_bindless fails on the new verifyImageTableMaskedOffset case.
  • tools/check_conventions.py --base 8ca1d7acd passes.

Cherry-pick it if you want to fold it in.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146480127 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6146480127). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-13T13:19:39Z. --- @Celegans12 the `(key << n) & mask` fix applies cleanly on 8ca1d7acd: tibzejoker/AnyPS5 `fix/757-masked-table-offset-8ca1`, one commit `f1a8500f3` on your head (3 files, +58/−3, same change as 2a2f96385). On Windows 11, RTX 4090, GCC 15.2.0, Release: - `agc_shader_memory`, `agc_shader_bindless`, `agc_driver_image_table`, `agc_driver_image_table_cache`, `agc_driver_image_table_reuse` and `agc_driver_bindless_images` pass. - Without the `ResourceTracker.cpp` change, `agc_shader_bindless` fails on the new `verifyImageTableMaskedOffset` case. - `tools/check_conventions.py --base 8ca1d7acd` passes. Cherry-pick it if you want to fold it in. AI-assisted (Claude Code).
tv7 commented 2026-10-13 17:13:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-13T17:13:48Z.


@Celegans12 @tibzejoker Marvel's Wolverine (PPSA03671) on 8ca1d7acd + tibzejoker's f1a8500f3, for the masked-offset question in the last review. Windows 11, RTX 3070, GCC 15.2.0, Release. Base: #757's head (main 0f2683cb) plus #4702, #5304 and local placeholders for three unknown imports. Not current main, which #757 conflicts with.

The title still stops at the same place as without f1a8500f3:

shader 0x11d1418800 stage 5: ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain: Phi(Phi(ReadConstBuffer@pc=0x00009878(GetBufferResource(GetUserData(Void), ...), ShiftLeftLogical32(BitwiseAnd32(ReadConstBuffer@pc=0x000094ec(GetBufferResource(ReadConst(GetSrtResource, Immediate), ...), ShiftLeftLogical32(ReadConstBuffer@pc=0x00000a14(GetBufferResource, IMul32), Immediate)), Immediate), Immediate)), Phi(...

Shape. It is the other order of the (key << n) & mask case: the mask comes first, the shift after.

0x9868  s_pack_ll_b32_b16  s20, s47, 0        ; key = s47 & 0xffff
0x9870  s_lshl_b32         s20, s20, 5        ; offset = key << 5
0x9878  s_buffer_load_dwordx8 s[28:35], s[4:7], s20   ; T# from the user-data V#

s47 is itself an s_buffer_load_dword at 0x94ec from a V# read from the SRT, at an offset loaded at 0xa14 and shifted left by 4. The T# then reaches the image instruction through nested Phis (the fetch sits in a loop with branches), so this may also be one of the loop-carried keys from the cost discussion, not only a new offset shape.

agc_shader_replay shader_11d1418800.req reproduces it offline on this tree (resource analysis failed: GetImageResource dword 0 ...). The dump holds the title's shader code, so I have not attached it; the instructions above are the relevant part, and I can run a candidate fix against it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6151054114 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6151054114). Originally posted by [tv7](https://github.com/tv7) on 2026-10-13T17:13:48Z. --- @Celegans12 @tibzejoker Marvel's Wolverine (PPSA03671) on 8ca1d7acd + tibzejoker's `f1a8500f3`, for the masked-offset question in the last review. Windows 11, RTX 3070, GCC 15.2.0, Release. Base: #757's head (main `0f2683cb`) plus #4702, #5304 and local placeholders for three unknown imports. Not current main, which #757 conflicts with. The title still stops at the same place as without `f1a8500f3`: ``` shader 0x11d1418800 stage 5: ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain: Phi(Phi(ReadConstBuffer@pc=0x00009878(GetBufferResource(GetUserData(Void), ...), ShiftLeftLogical32(BitwiseAnd32(ReadConstBuffer@pc=0x000094ec(GetBufferResource(ReadConst(GetSrtResource, Immediate), ...), ShiftLeftLogical32(ReadConstBuffer@pc=0x00000a14(GetBufferResource, IMul32), Immediate)), Immediate), Immediate)), Phi(... ``` **Shape.** It is the other order of the `(key << n) & mask` case: the mask comes first, the shift after. ``` 0x9868 s_pack_ll_b32_b16 s20, s47, 0 ; key = s47 & 0xffff 0x9870 s_lshl_b32 s20, s20, 5 ; offset = key << 5 0x9878 s_buffer_load_dwordx8 s[28:35], s[4:7], s20 ; T# from the user-data V# ``` `s47` is itself an `s_buffer_load_dword` at 0x94ec from a V# read from the SRT, at an offset loaded at 0xa14 and shifted left by 4. The T# then reaches the image instruction through nested Phis (the fetch sits in a loop with branches), so this may also be one of the loop-carried keys from the cost discussion, not only a new offset shape. `agc_shader_replay shader_11d1418800.req` reproduces it offline on this tree (`resource analysis failed: GetImageResource dword 0 ...`). The dump holds the title's shader code, so I have not attached it; the instructions above are the relevant part, and I can run a candidate fix against it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tibzejoker commented 2026-10-13 17:19:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-13T17:19:04Z.


@tv7 thanks. I don't think the offset is what stops it there.

  • The offset already matches on #757 without f1a8500f3. (key & 0xffff) << 5 is MatchScale's ShiftLeftLogical32(x, 5), with key = BitwiseAnd32(...): an affine key * 32 column. f1a8500f3 only adds the other order, (key << n) & mask, where the mask is applied after the scale.
  • The likely blocker is the Phis. The chain is rooted at Phi(Phi(ReadConstBuffer@0x9878 ...), Phi(...)), so the T# that reaches the image instruction merges loads from different arms or iterations.
  • What fails to resolve it: SplitDescriptorPhis only splits a descriptor Phi when every predecessor gives an incoming value and the arms are equivalent. It also searches 8 levels at most (phiSearchDepth). A loop-carried T# (Phi(init, load) in the loop header) falls outside both conditions.
  • How to check: APS5_DUMP_IR=11d1418800 on that replay should show whether the s_buffer_load_dwordx8 at 0x9878 ever becomes a table handle before the Phi. Is the header Phi's other incoming value the same load from a previous iteration, or a different T#?

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6151148874 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6151148874). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-13T17:19:04Z. --- @tv7 thanks. I don't think the offset is what stops it there. - **The offset already matches on #757 without `f1a8500f3`.** `(key & 0xffff) << 5` is `MatchScale`'s `ShiftLeftLogical32(x, 5)`, with `key = BitwiseAnd32(...)`: an affine `key * 32` column. `f1a8500f3` only adds the other order, `(key << n) & mask`, where the mask is applied after the scale. - **The likely blocker is the Phis.** The chain is rooted at `Phi(Phi(ReadConstBuffer@0x9878 ...), Phi(...))`, so the T# that reaches the image instruction merges loads from different arms or iterations. - **What fails to resolve it:** `SplitDescriptorPhis` only splits a descriptor Phi when every predecessor gives an incoming value and the arms are equivalent. It also searches 8 levels at most (`phiSearchDepth`). A loop-carried T# (`Phi(init, load)` in the loop header) falls outside both conditions. - **How to check:** `APS5_DUMP_IR=11d1418800` on that replay should show whether the `s_buffer_load_dwordx8` at 0x9878 ever becomes a table handle before the Phi. Is the header Phi's other incoming value the same load from a previous iteration, or a different T#? AI-assisted (Claude Code).
tv7 commented 2026-10-13 19:22:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-13T19:22:33Z.


@tibzejoker thanks, that was it. APS5_DUMP_IR=11d1418800 on the replay (same tree, 8ca1d7acd + f1a8500f3), IR after srt:

The failing GetImageResource %99754 (block $309, pc 0xc818..0xcc38) gets every dword through two nested loop-header Phis, and both are loop-invariant. The other incoming value is the Phi itself, not a different T#:

%84353 = Phi [%84111, $250], [%84353, $310]     ; block $251, back edge from $310
%84111 = Phi [%69710, $247], [%84353, $312]     ; block $248, back edge from $312
%69710 = ReadConstBuffer %69709, %69707         ; block $211 (pc 0x92d0..0x9a40), the s_buffer_load_dwordx8 at 0x9878
%69707 = ShiftLeftLogical32 (BitwiseAnd32 %66981, 0xffff), 5

Dropping the self-references, all eight dwords (%69710..%69717) resolve to that one load, so the T# is fetched once before the loop and carried through it unchanged. The other image accesses in this shader with a Phi in dword 0 have the same shape (Phi(x, self) in $248/$251). So it looks like a case for removing trivial Phi(x, self) before SplitDescriptorPhis / the table match, not one that needs per-iteration snapshots.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153367361 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6153367361). Originally posted by [tv7](https://github.com/tv7) on 2026-10-13T19:22:33Z. --- @tibzejoker thanks, that was it. `APS5_DUMP_IR=11d1418800` on the replay (same tree, 8ca1d7acd + `f1a8500f3`), IR after `srt`: The failing `GetImageResource %99754` (block `$309`, pc 0xc818..0xcc38) gets every dword through two nested loop-header Phis, and both are loop-invariant. The other incoming value is the Phi itself, not a different T#: ``` %84353 = Phi [%84111, $250], [%84353, $310] ; block $251, back edge from $310 %84111 = Phi [%69710, $247], [%84353, $312] ; block $248, back edge from $312 %69710 = ReadConstBuffer %69709, %69707 ; block $211 (pc 0x92d0..0x9a40), the s_buffer_load_dwordx8 at 0x9878 %69707 = ShiftLeftLogical32 (BitwiseAnd32 %66981, 0xffff), 5 ``` Dropping the self-references, all eight dwords (`%69710`..`%69717`) resolve to that one load, so the T# is fetched once before the loop and carried through it unchanged. The other image accesses in this shader with a Phi in dword 0 have the same shape (`Phi(x, self)` in `$248`/`$251`). So it looks like a case for removing trivial `Phi(x, self)` before `SplitDescriptorPhis` / the table match, not one that needs per-iteration snapshots. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Celegans12 commented 2026-10-14 02:24:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-14T02:24:40Z.


@adriadam10, this head goes through your four points from yesterday. I've rebased onto main ee9037d8, which has #4883, so the disk format is now 31 here and 32 on #758. The runtime ABI stays 12, and neither PR touches the request serializer.

docs/dev/ARCHITECTURE.md has a new "Runtime image and sampler tables" section under Graphics, next to the registration-module bullets that describe the other runtime descriptors. It covers how a column is planned and narrowed, the per-invocation snapshot, the map buffer layout, poisoning, driver-side reuse and what the disk cache stores. Rebasing onto #4883 also needed a real change: its stored front-end plans carried the old indirect-image fields, so the plan encoder now writes each table column with its key domains, and agc_shader_disk_cache round-trips plans with keyed and whole columns.

Both fixes from the thread are folded in, credited in the commit message. @tibzejoker's (key << n) & mask change is in, with one line adapted so a masked read marks the shared column whole. @SleglJan's TableColumn follow-up is in too: one column per heap access shape, narrowed to the union of its keys, and kept whole as soon as one read has no key domain. Both of their tests are in agc_shader_bindless. @Tamalero's unmapped-slot rejection was already in the last head.

On cost, I can't run GTA V or Guardians, so here's what I can say and measure. A table whose key the SRT walker can evaluate binds the records its keys select plus record 0. A loop-carried, lane-reduced or masked key binds every record the heap V# covers, capped at 65,536. Inside one invocation the shader can read any of those records, so binding fewer would mean faulting on reads that are valid. A loop-limit bound would only help when the limit is something we can evaluate and is smaller than the V#. In Guardians the table changes size every frame with the list (214-345 entries in @Tamalero's trace), so I expect the two to be the same there. I haven't seen a title where they differ.

For a before/after on the same tree, I took a 65,536-record heap with 4,096 distinct T#s (GTA's table size) and timed the CPU side of one invocation, with and without the two fold-ins. A whole table costs about 7.1 ms to snapshot plus 0.4 ms to build the map, and binds all 4,096 images. A keyed table costs 0.2-0.3 ms. Before the fold-ins, two SRT keys into one heap made two table images and two snapshots; now they make one (0.58 → 0.32 ms). The masked shape went from a refused dispatch to a whole table, which matches what @tibzejoker saw: GTA has no failing dispatch, but runs at 0.56 FPS instead of 0.66-0.78 with that shader skipped. His 1.33 FPS baseline also skipped the two 65,536-entry table dispatches, so it isn't the same amount of work.

I also replayed Yōtei's captured requests with both trees. 64 of them plan tables, 137 columns in all, and every one is whole in both: their keys are waterfall v_readlane/v_readfirstlane indices and loop counters. So for these titles the cost is per bound entry, and I don't think narrowing is what will bring it down. What will is not redoing that work every frame. @SleglJan's snapshot reuse (3.3 → 0.3 ms per snapshot on 007) needs #758, so it can follow once both land. For the driver side, @Tamalero's per-element memo keyed by the descriptor words would fit Guardians, where whole-table reuse never hits. My CPU numbers don't include the driver's texture lookup per element, and at the ~150 µs per entry he measured, that's the larger part.

On order: #4883 is merged and this is rebased onto it, so 31/32 are final unless main takes another format first. #5461 and #5472 also bump to 31, so whichever of us lands later renumbers. #4757 doesn't change any format or ABI number, and the only textual overlap is two adjacent lines in ResourcePlan.hpp. Since ImageTableSnapshot already compares by value, its snapshot equality covers the tables automatically. I'd suggest #4757 goes first since it's small and fixes a correctness bug, and I'll rebase this onto it. @Ondra97, does that work for you? A maintainer still needs to dispatch the full Build on this head.

Details
  • Checks on this head: Windows NVIDIA (RTX 3080 Laptop): 1,113/1,114 pass; log_macros fails on main too. Linux (upstream's job in WSL, lavapipe), merged with main 016db923: 1,093/1,095 pass; agc_driver_bc_block_copy and agc_driver_depth_compare_copy fail on main 016db923 too.
  • #758 on top: the same counts and the same failures.
  • Targeted Windows NVIDIA tests on both heads: agc_driver_image_table, _cache, _reuse, agc_driver_bindless_images, agc_driver_runtime_images, agc_shader_bindless, agc_shader_memory, agc_shader_disk_cache, agc_driver_graphics, agc_shader_device_profile: 10/10.
  • agc_shader_disk_cache's plan-switch check used APS5_TRACE_BINDLESS, which only the removed indirect path read, so it now uses APS5_TRACE_IMAGE_TABLE.
  • Benchmark (a scratch harness, not committed): CaptureResources through ShaderMemory plus Recompile(request, capture) for the six TableRequest shaders, 65,536 records of 32 bytes and 4,096 distinct T#s, median of 10 after 2 warm-ups, RTX 3080 Laptop machine, CPU only.
key before (head without the fold-ins) after
v_readfirstlane lane key whole, 65,536 records, 4,096 images, 7.3 + 0.4 ms same, 7.1 + 0.4 ms
key from a material V# (scan) 4 records, 0.3 ms 4 records, 0.3 ms
SRT key 2 records, 0.3 ms 2 records, 0.2 ms
two SRT keys, one heap 2 table images, 2 snapshots, 4 records, 0.58 + 0.12 ms 1 table image, 3 records, 0.32 + 0.06 ms
SRT key + lane key, one heap 2 table images, 65,538 records, 7.5 + 0.5 ms 1 table image, 65,536 records, 7.2 + 0.4 ms
(key << 5) & 0x1fffe0 refused (GetImageResource dword 0) whole, 65,536 records, 7.2 + 0.4 ms
  • Yōtei census: one captured request per program from our corpus (1,448 programs), resource analysis only, with the plan's table columns printed. 430 load with main's request reader; 428 plan, and the 2 failures are #758's pointer tables. 64 plan tables, 137 columns, all whole on both trees. Key shapes per shader: ReadLane(SelectU32) 38, loop Phi 20, ReadFirstLane(SelectU32) 8, ReadLane(Phi) 3, UMin32(ReadLane) 1, and 2 whose material-V# keys share a column with an unkeyed read.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159492622 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6159492622). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-14T02:24:40Z. --- @adriadam10, this head goes through your four points from yesterday. I've rebased onto `main` ee9037d8, which has #4883, so the disk format is now 31 here and 32 on #758. The runtime ABI stays 12, and neither PR touches the request serializer. `docs/dev/ARCHITECTURE.md` has a new "Runtime image and sampler tables" section under Graphics, next to the registration-module bullets that describe the other runtime descriptors. It covers how a column is planned and narrowed, the per-invocation snapshot, the map buffer layout, poisoning, driver-side reuse and what the disk cache stores. Rebasing onto #4883 also needed a real change: its stored front-end plans carried the old indirect-image fields, so the plan encoder now writes each table column with its key domains, and `agc_shader_disk_cache` round-trips plans with keyed and whole columns. Both fixes from the thread are folded in, credited in the commit message. @tibzejoker's `(key << n) & mask` change is in, with one line adapted so a masked read marks the shared column whole. @SleglJan's `TableColumn` follow-up is in too: one column per heap access shape, narrowed to the union of its keys, and kept whole as soon as one read has no key domain. Both of their tests are in `agc_shader_bindless`. @Tamalero's unmapped-slot rejection was already in the last head. On cost, I can't run GTA V or Guardians, so here's what I can say and measure. A table whose key the SRT walker can evaluate binds the records its keys select plus record 0. A loop-carried, lane-reduced or masked key binds every record the heap V# covers, capped at 65,536. Inside one invocation the shader can read any of those records, so binding fewer would mean faulting on reads that are valid. A loop-limit bound would only help when the limit is something we can evaluate and is smaller than the V#. In Guardians the table changes size every frame with the list (214-345 entries in @Tamalero's trace), so I expect the two to be the same there. I haven't seen a title where they differ. For a before/after on the same tree, I took a 65,536-record heap with 4,096 distinct T#s (GTA's table size) and timed the CPU side of one invocation, with and without the two fold-ins. A whole table costs about 7.1 ms to snapshot plus 0.4 ms to build the map, and binds all 4,096 images. A keyed table costs 0.2-0.3 ms. Before the fold-ins, two SRT keys into one heap made two table images and two snapshots; now they make one (0.58 → 0.32 ms). The masked shape went from a refused dispatch to a whole table, which matches what @tibzejoker saw: GTA has no failing dispatch, but runs at 0.56 FPS instead of 0.66-0.78 with that shader skipped. His 1.33 FPS baseline also skipped the two 65,536-entry table dispatches, so it isn't the same amount of work. I also replayed Yōtei's captured requests with both trees. 64 of them plan tables, 137 columns in all, and every one is whole in both: their keys are waterfall `v_readlane`/`v_readfirstlane` indices and loop counters. So for these titles the cost is per bound entry, and I don't think narrowing is what will bring it down. What will is not redoing that work every frame. @SleglJan's snapshot reuse (3.3 → 0.3 ms per snapshot on 007) needs #758, so it can follow once both land. For the driver side, @Tamalero's per-element memo keyed by the descriptor words would fit Guardians, where whole-table reuse never hits. My CPU numbers don't include the driver's texture lookup per element, and at the ~150 µs per entry he measured, that's the larger part. On order: #4883 is merged and this is rebased onto it, so 31/32 are final unless `main` takes another format first. #5461 and #5472 also bump to 31, so whichever of us lands later renumbers. #4757 doesn't change any format or ABI number, and the only textual overlap is two adjacent lines in `ResourcePlan.hpp`. Since `ImageTableSnapshot` already compares by value, its snapshot equality covers the tables automatically. I'd suggest #4757 goes first since it's small and fixes a correctness bug, and I'll rebase this onto it. @Ondra97, does that work for you? A maintainer still needs to dispatch the full Build on this head. <details><summary>Details</summary> - Checks on this head: Windows NVIDIA (RTX 3080 Laptop): 1,113/1,114 pass; `log_macros` fails on `main` too. Linux (upstream's job in WSL, lavapipe), merged with `main` 016db923: 1,093/1,095 pass; `agc_driver_bc_block_copy` and `agc_driver_depth_compare_copy` fail on `main` 016db923 too. - #758 on top: the same counts and the same failures. - Targeted Windows NVIDIA tests on both heads: `agc_driver_image_table`, `_cache`, `_reuse`, `agc_driver_bindless_images`, `agc_driver_runtime_images`, `agc_shader_bindless`, `agc_shader_memory`, `agc_shader_disk_cache`, `agc_driver_graphics`, `agc_shader_device_profile`: 10/10. - `agc_shader_disk_cache`'s plan-switch check used `APS5_TRACE_BINDLESS`, which only the removed indirect path read, so it now uses `APS5_TRACE_IMAGE_TABLE`. - Benchmark (a scratch harness, not committed): `CaptureResources` through `ShaderMemory` plus `Recompile(request, capture)` for the six `TableRequest` shaders, 65,536 records of 32 bytes and 4,096 distinct T#s, median of 10 after 2 warm-ups, RTX 3080 Laptop machine, CPU only. | key | before (head without the fold-ins) | after | |---|---|---| | `v_readfirstlane` lane key | whole, 65,536 records, 4,096 images, 7.3 + 0.4 ms | same, 7.1 + 0.4 ms | | key from a material V# (scan) | 4 records, 0.3 ms | 4 records, 0.3 ms | | SRT key | 2 records, 0.3 ms | 2 records, 0.2 ms | | two SRT keys, one heap | 2 table images, 2 snapshots, 4 records, 0.58 + 0.12 ms | 1 table image, 3 records, 0.32 + 0.06 ms | | SRT key + lane key, one heap | 2 table images, 65,538 records, 7.5 + 0.5 ms | 1 table image, 65,536 records, 7.2 + 0.4 ms | | `(key << 5) & 0x1fffe0` | refused (`GetImageResource dword 0`) | whole, 65,536 records, 7.2 + 0.4 ms | - Yōtei census: one captured request per program from our corpus (1,448 programs), resource analysis only, with the plan's table columns printed. 430 load with `main`'s request reader; 428 plan, and the 2 failures are #758's pointer tables. 64 plan tables, 137 columns, all whole on both trees. Key shapes per shader: `ReadLane(SelectU32)` 38, loop `Phi` 20, `ReadFirstLane(SelectU32)` 8, `ReadLane(Phi)` 3, `UMin32(ReadLane)` 1, and 2 whose material-V# keys share a column with an unkeyed read. </details>
tibzejoker commented 2026-10-14 02:51:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-14T02:51:04Z.


@Celegans12 GTA V (PPSA04264) on this head, b26df6aaa. Windows 11, RTX 4090, MinGW-w64 GCC 15.2.0, Release, write watch on.

Base: main 71c71f50b plus the open PRs GTA needs to reach Story: #5596 (#637's port), #4878, fdfawef324's #448 port, #1186 and #1189. I ran the same tree with and without this PR, one Story run each. "Skipped" is our local hack that logs a dispatch whose shader can't be compiled and skips it instead of aborting.

without #757 with b26df6aaa
in-order dispatches that fail 3 shaders every frame: 0x25b456800 and 0x25b458e00 (65,536-entry tables), 0x25b45a200 (masked key) none in 180 s
FPS (frame counter delta) 0.98 0.66
RAM (private bytes) 33 GB, flat 39 GB 30 s into Story, then 43 GB at 180 s and still slowly rising

So the folded-in masked-offset change works on this head, and GTA has no failing dispatch with it. The FPS gap is the same as on our older stack (0.56 against 0.66-0.78). As you said, it isn't the same work, since the run without #757 skips those three dispatches.

Two things that may be worth a look:

  • When Story starts, RAM jumps from 30 to 40 GB within about 15 s. Meanwhile the frame counter stops for those 15-20 s, before the first Story frame. Without this PR, the same moment goes from 30 to 33 GB with no stall. With our usual 40 GB guard, the first run was killed right there.
  • After that it keeps climbing by about 1 GB a minute (39 → 43 GB over 150 s). That fits the whole 65,536-record tables (4,096 distinct T#s in GTA) being snapshotted again for new invocations. I have not traced where the memory goes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159794843 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6159794843). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-14T02:51:04Z. --- @Celegans12 GTA V (PPSA04264) on this head, b26df6aaa. Windows 11, RTX 4090, MinGW-w64 GCC 15.2.0, Release, write watch on. Base: `main` 71c71f50b plus the open PRs GTA needs to reach Story: #5596 (#637's port), #4878, fdfawef324's #448 port, #1186 and #1189. I ran the same tree with and without this PR, one Story run each. "Skipped" is our local hack that logs a dispatch whose shader can't be compiled and skips it instead of aborting. | | without #757 | with b26df6aaa | |---|---|---| | in-order dispatches that fail | 3 shaders every frame: 0x25b456800 and 0x25b458e00 (65,536-entry tables), 0x25b45a200 (masked key) | **none in 180 s** | | FPS (frame counter delta) | 0.98 | 0.66 | | RAM (private bytes) | 33 GB, flat | 39 GB 30 s into Story, then 43 GB at 180 s and still slowly rising | So the folded-in masked-offset change works on this head, and GTA has no failing dispatch with it. The FPS gap is the same as on our older stack (0.56 against 0.66-0.78). As you said, it isn't the same work, since the run without #757 skips those three dispatches. Two things that may be worth a look: - When Story starts, RAM jumps from 30 to 40 GB within about 15 s. Meanwhile the frame counter stops for those 15-20 s, before the first Story frame. Without this PR, the same moment goes from 30 to 33 GB with no stall. With our usual 40 GB guard, the first run was killed right there. - After that it keeps climbing by about 1 GB a minute (39 → 43 GB over 150 s). That fits the whole 65,536-record tables (4,096 distinct T#s in GTA) being snapshotted again for new invocations. I have not traced where the memory goes. AI-assisted (Claude Code).
Celegans12 commented 2026-10-14 05:11:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-14T05:11:04Z.


@tibzejoker, thanks for the before/after numbers. I chased the growth with a driver-level test, and it wasn't a snapshot kept per invocation. Two caches in the driver are capped by entry count only, and with this PR their table entries became several MB each. The new head 4dcf657a20 caps both by size.

The resource cache keys a built dispatch on its descriptors, and that key includes the table's T# list and map. So when a few records change every frame, each frame adds a new ~5 MB object that keeps its 4,096 textures alive, and the old ones are never hit again. The cap was 1,024 entries, so roughly 5 GB plus those textures. The dispatch cache keys on user data, and each entry stores the captured table words (2 MiB for 65,536 records) plus the compiled result. When the SRT pointer moves between frames, every frame adds an entry, and that cache was only capped at 8,192 keys. Your ~1 GB/min at 0.66 FPS is about 8 MB per table dispatch with three table shaders, which is the same order as these two together. Now the resource cache keeps at most 65,536 table elements and the dispatch cache at most 256 MiB of captured words, evicting the least recently used (APS5_RESOURCE_CACHE_TABLE_ELEMENTS and APS5_DISPATCH_CACHE_BYTES override them). In my test both stay flat over 300 dispatches. With the same table every dispatch, nothing grew before either.

The jump when Story starts is a different thing, and this head doesn't change it. I checked that nothing runs per record that should run per distinct T#: the 65,536 records are read once to build the map, and exactly 4,096 elements and 4,096 textures come out of it. All of them are created in that first dispatch, so that's the stall. On top of the GPU copy, the texture cache keeps a CPU copy of each sampled texture's guest bytes for its change check, so a 4,096-texture table costs about its texture size again in RAM. My guess is that this is most of your 10 GB, but I haven't measured it with GTA-sized textures. That copy is bounded by the sampled-texture budget, which comes from VRAM, not by RAM, so it's a separate follow-up. The draw cache has the same count-only cap. Fragment-stage tables could grow it the same way, but nothing has shown that yet, so I've left it for a follow-up if a title does.

Could you rerun Story on 4dcf657a20 with APS5_PROFILE_DRAW=1 and post the [dispatch-cache] and [rescache] lines plus RAM at 180 s? Those lines show which of the two caches GTA was filling.

@adriadam10, the ordering question is settled: #4757 was closed (oneandonlydean found no title reaches it), so #757 goes first and #758 stays stacked on it. The disk formats stay 31 here and 32 on #758, and the runtime ABI stays 12. #5461 and #5472 also take 31, so whichever of us lands later renumbers. For Ghost of Yōtei this pair is the difference between no frame and the loading screen. I ran plain main 75690a11 tonight, and the game aborts 31 s in, before its first frame, on the compute shader 0x80003aa700 (GetImageResource dword 0, its texture comes from a runtime table). With #757/#758 and the rest of our stack it renders the logos, intro and title and runs 50 minutes into the loading screen without a crash. Could you re-review this head? A maintainer also needs to dispatch the full Build on it.

Details
  • Heads: #757 4dcf657a20, #758 5595a163c0 (restacked only; its own diff is unchanged). Both are still based on main ee9037d8, and both merge cleanly with main 90d0cb48.
  • Checks on #758's head (contains #757): Windows NVIDIA (RTX 3080 Laptop): 1,114/1,115 pass; log_macros fails on main too. Linux (upstream's job in WSL, lavapipe), merged with main 90d0cb48: 1,110/1,112 pass; agc_driver_bc_block_copy and agc_driver_depth_compare_copy fail on main too. #757 alone, Linux job merged with main 75690a11: the 10 targeted tests pass.
  • Targeted Windows NVIDIA tests on both heads: agc_driver_image_table, _cache, _cache_bounds, _reuse, agc_driver_bindless_images, agc_driver_runtime_images, agc_shader_bindless, agc_shader_memory, agc_shader_disk_cache, agc_driver_graphics: 10/10.
  • New test agc_driver_image_table_cache_bounds:
    • It sets the two budgets to 8,192 elements and 16 MiB, so it stays fast.
    • It changes one record of a 4,096-element table per dispatch for 6 dispatches, then runs 16 dispatches through 16 SRTs.
    • With both evictions removed it fails: 24,597 table elements kept against 8,192.
    • With only the dispatch eviction removed it fails: 38 MiB of captured words against 16 MiB.
    • It passes with both: 1.6 s on NVIDIA; on lavapipe in WSL it takes 7 s alone and ~30 s inside the parallel suite.
  • Scratch harness (not committed): it submits the whole-table shader through a DCB, so it goes through the real capture, recompile, dispatch cache, resource cache and texture cache. It uses 65,536 records of 32 bytes and 4,096 distinct 64x64 RGBA8 T#s. Private bytes are relative to the start; RTX 3080 Laptop.
300 dispatches before after
same table every dispatch flat at +1,748 MiB from the 2nd dispatch same
4 records changed per dispatch resource cache 1 → 300 entries, +1,347 → +2,915 MiB 12-15 entries, +1,374 → +1,528 MiB
SRT moved every dispatch dispatch cache 300 entries, 600 MiB of words + 147 MiB of results, rising 127 entries, 254 MiB, +1.59-1.65 GB flat
  • Setting APS5_RESOURCE_CACHE_ENTRIES=4 or APS5_DISPATCH_CACHE_ENTRIES=16 on the old head also stopped the growth in the matching case, which confirms which cache each case fills.
  • First use of the table: 4,096 Texture creations, 2.2-2.4 s. Private memory +1.34 GB for 64 MiB of texels, or +0.68 GB with APS5_SYNC_TEXTURE_UPLOAD=1, so about half of it is uploads held by the open batch (the recorder submits every 512 MiB of kept bytes).
  • Still bounded, unchanged: the per-shader result memo (256 results, ~0.5 MiB each for this table), the descriptor decode memo (cleared at 1M entries) and the buffer pool (512 + 64 MiB).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161395667 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6161395667). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-14T05:11:04Z. --- @tibzejoker, thanks for the before/after numbers. I chased the growth with a driver-level test, and it wasn't a snapshot kept per invocation. Two caches in the driver are capped by entry count only, and with this PR their table entries became several MB each. The new head 4dcf657a20 caps both by size. The resource cache keys a built dispatch on its descriptors, and that key includes the table's T# list and map. So when a few records change every frame, each frame adds a new ~5 MB object that keeps its 4,096 textures alive, and the old ones are never hit again. The cap was 1,024 entries, so roughly 5 GB plus those textures. The dispatch cache keys on user data, and each entry stores the captured table words (2 MiB for 65,536 records) plus the compiled result. When the SRT pointer moves between frames, every frame adds an entry, and that cache was only capped at 8,192 keys. Your ~1 GB/min at 0.66 FPS is about 8 MB per table dispatch with three table shaders, which is the same order as these two together. Now the resource cache keeps at most 65,536 table elements and the dispatch cache at most 256 MiB of captured words, evicting the least recently used (`APS5_RESOURCE_CACHE_TABLE_ELEMENTS` and `APS5_DISPATCH_CACHE_BYTES` override them). In my test both stay flat over 300 dispatches. With the same table every dispatch, nothing grew before either. The jump when Story starts is a different thing, and this head doesn't change it. I checked that nothing runs per record that should run per distinct T#: the 65,536 records are read once to build the map, and exactly 4,096 elements and 4,096 textures come out of it. All of them are created in that first dispatch, so that's the stall. On top of the GPU copy, the texture cache keeps a CPU copy of each sampled texture's guest bytes for its change check, so a 4,096-texture table costs about its texture size again in RAM. My guess is that this is most of your 10 GB, but I haven't measured it with GTA-sized textures. That copy is bounded by the sampled-texture budget, which comes from VRAM, not by RAM, so it's a separate follow-up. The draw cache has the same count-only cap. Fragment-stage tables could grow it the same way, but nothing has shown that yet, so I've left it for a follow-up if a title does. Could you rerun Story on 4dcf657a20 with `APS5_PROFILE_DRAW=1` and post the `[dispatch-cache]` and `[rescache]` lines plus RAM at 180 s? Those lines show which of the two caches GTA was filling. @adriadam10, the ordering question is settled: #4757 was closed (oneandonlydean found no title reaches it), so #757 goes first and #758 stays stacked on it. The disk formats stay 31 here and 32 on #758, and the runtime ABI stays 12. #5461 and #5472 also take 31, so whichever of us lands later renumbers. For Ghost of Yōtei this pair is the difference between no frame and the loading screen. I ran plain `main` 75690a11 tonight, and the game aborts 31 s in, before its first frame, on the compute shader 0x80003aa700 (`GetImageResource dword 0`, its texture comes from a runtime table). With #757/#758 and the rest of our stack it renders the logos, intro and title and runs 50 minutes into the loading screen without a crash. Could you re-review this head? A maintainer also needs to dispatch the full Build on it. <details><summary>Details</summary> - Heads: #757 4dcf657a20, #758 5595a163c0 (restacked only; its own diff is unchanged). Both are still based on `main` ee9037d8, and both merge cleanly with `main` 90d0cb48. - Checks on #758's head (contains #757): Windows NVIDIA (RTX 3080 Laptop): 1,114/1,115 pass; `log_macros` fails on `main` too. Linux (upstream's job in WSL, lavapipe), merged with `main` 90d0cb48: 1,110/1,112 pass; `agc_driver_bc_block_copy` and `agc_driver_depth_compare_copy` fail on `main` too. #757 alone, Linux job merged with `main` 75690a11: the 10 targeted tests pass. - Targeted Windows NVIDIA tests on both heads: `agc_driver_image_table`, `_cache`, `_cache_bounds`, `_reuse`, `agc_driver_bindless_images`, `agc_driver_runtime_images`, `agc_shader_bindless`, `agc_shader_memory`, `agc_shader_disk_cache`, `agc_driver_graphics`: 10/10. - New test `agc_driver_image_table_cache_bounds`: - It sets the two budgets to 8,192 elements and 16 MiB, so it stays fast. - It changes one record of a 4,096-element table per dispatch for 6 dispatches, then runs 16 dispatches through 16 SRTs. - With both evictions removed it fails: 24,597 table elements kept against 8,192. - With only the dispatch eviction removed it fails: 38 MiB of captured words against 16 MiB. - It passes with both: 1.6 s on NVIDIA; on lavapipe in WSL it takes 7 s alone and ~30 s inside the parallel suite. - Scratch harness (not committed): it submits the whole-table shader through a DCB, so it goes through the real capture, recompile, dispatch cache, resource cache and texture cache. It uses 65,536 records of 32 bytes and 4,096 distinct 64x64 RGBA8 T#s. Private bytes are relative to the start; RTX 3080 Laptop. | 300 dispatches | before | after | |---|---|---| | same table every dispatch | flat at +1,748 MiB from the 2nd dispatch | same | | 4 records changed per dispatch | resource cache 1 → 300 entries, +1,347 → +2,915 MiB | 12-15 entries, +1,374 → +1,528 MiB | | SRT moved every dispatch | dispatch cache 300 entries, 600 MiB of words + 147 MiB of results, rising | 127 entries, 254 MiB, +1.59-1.65 GB flat | - Setting `APS5_RESOURCE_CACHE_ENTRIES=4` or `APS5_DISPATCH_CACHE_ENTRIES=16` on the old head also stopped the growth in the matching case, which confirms which cache each case fills. - First use of the table: 4,096 `Texture` creations, 2.2-2.4 s. Private memory +1.34 GB for 64 MiB of texels, or +0.68 GB with `APS5_SYNC_TEXTURE_UPLOAD=1`, so about half of it is uploads held by the open batch (the recorder submits every 512 MiB of kept bytes). - Still bounded, unchanged: the per-shader result memo (256 results, ~0.5 MiB each for this table), the descriptor decode memo (cleared at 1M entries) and the buffer pool (512 + 64 MiB). </details>
tibzejoker commented 2026-10-14 05:59:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-14T05:59:27Z.


@Celegans12 Story on 4dcf657a2 with APS5_PROFILE_DRAW=1, the same stack as my last post (main ee9037d85 plus #5596, #4878, the #448 port, #1186 and #1189). Windows 11, RTX 4090.

There were no failing dispatches in 180 s. The frame rate is about 0.6 FPS, with or without the profile switch.

RAM (private bytes):

Story time 15 s 30 s 60 s 90 s 120 s 150 s 180 s
RAM 29 GB 39 GB 40 GB 40 GB 41 GB 41 GB 42 GB

The jump at the start is still there, as you expected. After it, RAM rises about 1 GB a minute, close to b26df6aaa (39 → 43 GB over the same 150 s). So capping these two caches did not change the slope for GTA.

Last lines at 180 s:

[dispatch-cache] 1329 lookups (10 s): 266 no entry, 1063 validated by value in 6.1 us each: 1012 equal, 51 differing, 0 page not mapped, 0 queued label, 0 image being stored, 0 publish generation moved, 0 pending serial moved, 0 forget serial moved (0 pending images stored first, 1 pending runs synced first, 1012 equal entries inserted before a forget; gate retried 6: 6 equal, 0 moved again); runs per entry 3.8 validated / 32.8 inserted; 0 misses found the entry replaced meanwhile; 317 inserts (0 captures not kept: unstable), 7844 evictions in total, 2658 entries, 342 LRU moves
[dispatch-cache] variants (10 s, k = 4): hits by rank 1..k 927 / 79 / 5 / 1; 1.16 variants compared per validation; 51 inserted into an entry, 16 evicted beyond k; 1.12 variants per entry (2985 over 2658 entries, ~254.3 MiB)
[rescache] 7637 hits, 23441 misses, 6 invalidated, 1024 entries (dispatch + draw); template hits: 157 refreshed the data buffers (revalidate 0.8 ms), 7480 had the same words; Find calls 255782, Touch calls 11840
[rescache] miss churn (draws), first differing word by role: GuestImages 20 (T# word 20/0/0/0/0/0/0/0); layout 32, draw target/index 1259, same key 213 (not inserted or evicted), first seen 206
[gpu] 31400 dispatches (19887 dispatch cache hits, 8180 evictions, 11532 recompile cache hits): capture 30.7 s, cache key 0.0 s, recompile 15.8 s, device 153.4 s

As far as I can read them:

  • The dispatch cache sits at its new cap: about 254 MiB, 2,658 entries, about 8,000 evictions so far.
  • The resource cache is at 1,024 entries, with about 23k misses per 10 s against 7.6k hits. Most of the misses come from the draw target and index words (1,259 in the churn line); there are only 20 from table T#s.

So the remaining growth is likely somewhere else, possibly the CPU copies of sampled textures you mentioned.

The first try on this head crashed 15 s into Story, in [RAGE] HDD Streamer at eboot 0x28aacee. The run above used the identical build and did not crash, so I take that crash to be intermittent and not caused by this PR. I am checking it separately.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161974754 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6161974754). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-14T05:59:27Z. --- @Celegans12 Story on 4dcf657a2 with `APS5_PROFILE_DRAW=1`, the same stack as my last post (`main` ee9037d85 plus #5596, #4878, the #448 port, #1186 and #1189). Windows 11, RTX 4090. There were no failing dispatches in 180 s. The frame rate is about 0.6 FPS, with or without the profile switch. RAM (private bytes): | Story time | 15 s | 30 s | 60 s | 90 s | 120 s | 150 s | 180 s | |---|---|---|---|---|---|---|---| | RAM | 29 GB | 39 GB | 40 GB | 40 GB | 41 GB | 41 GB | 42 GB | The jump at the start is still there, as you expected. After it, RAM rises about 1 GB a minute, close to b26df6aaa (39 → 43 GB over the same 150 s). So capping these two caches did not change the slope for GTA. Last lines at 180 s: ``` [dispatch-cache] 1329 lookups (10 s): 266 no entry, 1063 validated by value in 6.1 us each: 1012 equal, 51 differing, 0 page not mapped, 0 queued label, 0 image being stored, 0 publish generation moved, 0 pending serial moved, 0 forget serial moved (0 pending images stored first, 1 pending runs synced first, 1012 equal entries inserted before a forget; gate retried 6: 6 equal, 0 moved again); runs per entry 3.8 validated / 32.8 inserted; 0 misses found the entry replaced meanwhile; 317 inserts (0 captures not kept: unstable), 7844 evictions in total, 2658 entries, 342 LRU moves [dispatch-cache] variants (10 s, k = 4): hits by rank 1..k 927 / 79 / 5 / 1; 1.16 variants compared per validation; 51 inserted into an entry, 16 evicted beyond k; 1.12 variants per entry (2985 over 2658 entries, ~254.3 MiB) [rescache] 7637 hits, 23441 misses, 6 invalidated, 1024 entries (dispatch + draw); template hits: 157 refreshed the data buffers (revalidate 0.8 ms), 7480 had the same words; Find calls 255782, Touch calls 11840 [rescache] miss churn (draws), first differing word by role: GuestImages 20 (T# word 20/0/0/0/0/0/0/0); layout 32, draw target/index 1259, same key 213 (not inserted or evicted), first seen 206 [gpu] 31400 dispatches (19887 dispatch cache hits, 8180 evictions, 11532 recompile cache hits): capture 30.7 s, cache key 0.0 s, recompile 15.8 s, device 153.4 s ``` As far as I can read them: - The dispatch cache sits at its new cap: about 254 MiB, 2,658 entries, about 8,000 evictions so far. - The resource cache is at 1,024 entries, with about 23k misses per 10 s against 7.6k hits. Most of the misses come from the draw target and index words (1,259 in the churn line); there are only 20 from table T#s. So the remaining growth is likely somewhere else, possibly the CPU copies of sampled textures you mentioned. The first try on this head crashed 15 s into Story, in `[RAGE] HDD Streamer` at eboot 0x28aacee. The run above used the identical build and did not crash, so I take that crash to be intermittent and not caused by this PR. I am checking it separately. AI-assisted (Claude Code).
oneandonlydean commented 2026-10-14 06:18:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T06:18:50Z.


On b26df6aaa tibzejoker sees process RAM jump by ~10 GB when Story starts (with a 15-20 s stall) and then keep rising by about 1 GB a minute, while it stays flat without this PR. Does anything keep the per-invocation snapshots of the whole tables alive past their batch? Please find where it goes and bound it, or show that it levels off.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6162223495 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6162223495). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T06:18:50Z. --- On b26df6aaa tibzejoker sees process RAM jump by ~10 GB when Story starts (with a 15-20 s stall) and then keep rising by about 1 GB a minute, while it stays flat without this PR. Does anything keep the per-invocation snapshots of the whole tables alive past their batch? Please find where it goes and bound it, or show that it levels off.
Tamalero commented 2026-10-14 07:21:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-14T07:21:21Z.


@Celegans12, Guardians of the Galaxy (PPSA01748) on the current heads, since you can't run it: main d8888df9b + #758 5595a163c0 (which carries this PR's 4dcf657a20), and nothing else except one NpManager stub.

Progress. On older main with this PR alone, the title aborted after about 97 s on GetImageResource (shader stage 5, pc 0x588). With both PRs it no longer aborts. It gets past the loading screen to its first UI screen at about 11 FPS. That screen draws only a dark background, a red rule and two corner marks, so its text and images are missing. That is about where my old local stack got, but now with no local table changes.

Memory, since that's the open question here: RSS stays flat at 11.6 GiB over a minute on that screen, and was about 10 GiB three minutes in, while shaders were still compiling. I don't see the ~1 GB/min growth reported for GTA V, though this title doesn't get far yet.

What still doesn't plan (21 shaders at registration):

Count Reason
10 program address not in the shader registers (prepared on use)
8 s_swappc_b64 to a computed target (pcs 0x6a8, 0xa98, 0xbc4): #4706's territory
3 GetImageResource dword 0 is not a valid runtime value at pc 0x4378 / 0x4380

The three at 0x4378/0x4380 are the shape I'd flag for this PR or #758:

LoadAddressU32@pc=0x00004378(
  GetAddressResource(ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate)),
  ShiftLeftLogical32(ReadFirstLane(SelectU32(..., FindILsb32(Phi(SelectU32(..., CompositeExtractU32x4(ImageRead, Immediate), ...

The T# is loaded through a pointer from the SRT, at key << n. The key is a readfirstlane of a value that comes from an ImageRead: a per-pixel material id read from a texture, then made wave-uniform. So it's a uniform runtime key into a pointer-reached table, but the key's set of values isn't in a buffer the planner can enumerate.

FYI, for whoever sequences these: #5089 (waterfall loops over per-lane T#s) doesn't cover this. Tried alone on main, these chains have no ReadLane copy and are unchanged. It also conflicts with this PR and #758 in ResourceTracker.cpp (12 hunks), so the two can't be stacked locally as they are.

Details
  • Linux, RTX 4090 (driver 615.78.08), i9-14900K. The relink is --to-intel, and the shader cache was rebuilt (format change on main).
  • With #5089 alone instead of #757/#758, the title aborts again at pc 0x588, as expected.
  • The NpManager stub is local only: sceNpGetUserIdByAccountId returns USER_NOT_FOUND offline, since main's version still throws.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6163112623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6163112623). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-14T07:21:21Z. --- @Celegans12, Guardians of the Galaxy (PPSA01748) on the current heads, since you can't run it: `main` `d8888df9b` + #758 `5595a163c0` (which carries this PR's `4dcf657a20`), and nothing else except one NpManager stub. **Progress.** On older `main` with this PR alone, the title aborted after about 97 s on `GetImageResource` (shader stage 5, pc 0x588). With both PRs it no longer aborts. It gets past the loading screen to its first UI screen at about 11 FPS. That screen draws only a dark background, a red rule and two corner marks, so its text and images are missing. That is about where my old local stack got, but now with no local table changes. **Memory**, since that's the open question here: RSS stays flat at 11.6 GiB over a minute on that screen, and was about 10 GiB three minutes in, while shaders were still compiling. I don't see the ~1 GB/min growth reported for GTA V, though this title doesn't get far yet. **What still doesn't plan** (21 shaders at registration): | Count | Reason | | --- | --- | | 10 | program address not in the shader registers (prepared on use) | | 8 | `s_swappc_b64` to a computed target (pcs 0x6a8, 0xa98, 0xbc4): #4706's territory | | 3 | `GetImageResource dword 0 is not a valid runtime value` at pc 0x4378 / 0x4380 | The three at 0x4378/0x4380 are the shape I'd flag for this PR or #758: ``` LoadAddressU32@pc=0x00004378( GetAddressResource(ReadConst(GetSrtResource, Immediate), ReadConst(GetSrtResource, Immediate)), ShiftLeftLogical32(ReadFirstLane(SelectU32(..., FindILsb32(Phi(SelectU32(..., CompositeExtractU32x4(ImageRead, Immediate), ... ``` The T# is loaded through a pointer from the SRT, at `key << n`. The key is a `readfirstlane` of a value that comes from an **`ImageRead`**: a per-pixel material id read from a texture, then made wave-uniform. So it's a uniform runtime key into a pointer-reached table, but the key's set of values isn't in a buffer the planner can enumerate. FYI, for whoever sequences these: #5089 (waterfall loops over per-lane T#s) doesn't cover this. Tried alone on `main`, these chains have no `ReadLane` copy and are unchanged. It also conflicts with this PR and #758 in `ResourceTracker.cpp` (12 hunks), so the two can't be stacked locally as they are. <details><summary>Details</summary> - Linux, RTX 4090 (driver 615.78.08), i9-14900K. The relink is `--to-intel`, and the shader cache was rebuilt (format change on `main`). - With #5089 alone instead of #757/#758, the title aborts again at pc 0x588, as expected. - The NpManager stub is local only: `sceNpGetUserIdByAccountId` returns USER_NOT_FOUND offline, since `main`'s version still throws. </details> *Tested and written by Claude (AI assistant) on a contributor's machine.*
EagleBearerYS commented 2026-10-14 08:55:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T08:55:03Z.


Resident Evil Village (PPSA01556) numbers with this PR, from a Windows run to the title (RTX 3070 Laptop, driver 617.42), in case they help.

Setup: our Village stack, main f74ec639c plus this PR at b26df6aaa (ResourceMaterializer.cpp is the same at 4dcf657a2) and other open PRs and local experiments of ours, with #5596 reverted and the address-space cache off (APS5_NO_ADDRESS_SPACE_CACHE=1, for an unrelated stop). Of those, only a local change that drops branch conditions the CPU walk can never evaluate touches resource plans.

  • Every image table planned up to the title is the same material heap, 70 table plans in all:
    table 0 (image): base 0x204d400000 size 0x180000 stride 0x30 addend 0x10 offset 0x0 dwords 8, 32768 records, 32768 keys, 0 structural poison
    
    Our stack also carries a local fallback that plans a T# chosen per lane as a null image. With this PR it never fires up to the title.
  • Narrowing never applies. Every key domain spans the same 32 MiB key buffer, so all 64 skips that a local print in Narrow() traced were over the scan cap, for example:
    [image-table] shader 0x221ed46600: narrowing skipped, 2097152 key positions, over APS5_IMAGE_TABLE_KEY_SCAN 256 (key domain source 1 offset 0x8 stride 0x10, key buffer 0x204f800000+0x2000000, at 0x204f800008)
    [image-table] shader 0x221ea19700: narrowing skipped, 8388604 key positions, over APS5_IMAGE_TABLE_KEY_SCAN 256 (key domain source 1 offset 0x10 stride 0x4, key buffer 0x204f800000+0x2000000, at 0x204f800010)
    
  • The snapshot cost at the title: [image-table] (10 s): 408 snapshots, 408 tables, 13369344 keys, structural poison: none, narrowing 0 applied / 408 skipped, 1850.3 ms, about 4.5 ms per snapshot. Other windows there: 235 snapshots in 1,158 ms, 396 in 1,925 ms, 141 in 975 ms. How many snapshots a window takes may depend on the address-space cache being off; the cost per snapshot shouldn't.

Two directions that might help, if useful:

  1. ResourceMaterializer::Materialize takes the snapshot anew on every call (TableSnapshotter(...).Run()), so an unchanged heap is read and decoded again each time. Reusing a column's records while its heap range is unwritten would avoid most of those 4.5 ms per snapshot, with or without narrowing. The snapshot already records that range in tables.ranges.
  2. Bounding a key domain by what its selector can reach, instead of the key buffer's whole extent, would let narrowing apply to large key buffers like this one. That could be the selector's possible bits, or the reading draw's range.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164648878 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6164648878). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T08:55:03Z. --- Resident Evil Village (PPSA01556) numbers with this PR, from a Windows run to the title (RTX 3070 Laptop, driver 617.42), in case they help. Setup: our Village stack, `main` f74ec639c plus this PR at b26df6aaa (`ResourceMaterializer.cpp` is the same at 4dcf657a2) and other open PRs and local experiments of ours, with #5596 reverted and the address-space cache off (`APS5_NO_ADDRESS_SPACE_CACHE=1`, for an unrelated stop). Of those, only a local change that drops branch conditions the CPU walk can never evaluate touches resource plans. - Every image table planned up to the title is the same material heap, 70 table plans in all: ``` table 0 (image): base 0x204d400000 size 0x180000 stride 0x30 addend 0x10 offset 0x0 dwords 8, 32768 records, 32768 keys, 0 structural poison ``` Our stack also carries a local fallback that plans a T# chosen per lane as a null image. With this PR it never fires up to the title. - Narrowing never applies. Every key domain spans the same 32 MiB key buffer, so all 64 skips that a local print in `Narrow()` traced were over the scan cap, for example: ``` [image-table] shader 0x221ed46600: narrowing skipped, 2097152 key positions, over APS5_IMAGE_TABLE_KEY_SCAN 256 (key domain source 1 offset 0x8 stride 0x10, key buffer 0x204f800000+0x2000000, at 0x204f800008) [image-table] shader 0x221ea19700: narrowing skipped, 8388604 key positions, over APS5_IMAGE_TABLE_KEY_SCAN 256 (key domain source 1 offset 0x10 stride 0x4, key buffer 0x204f800000+0x2000000, at 0x204f800010) ``` - The snapshot cost at the title: `[image-table] (10 s): 408 snapshots, 408 tables, 13369344 keys, structural poison: none, narrowing 0 applied / 408 skipped, 1850.3 ms`, about 4.5 ms per snapshot. Other windows there: 235 snapshots in 1,158 ms, 396 in 1,925 ms, 141 in 975 ms. How many snapshots a window takes may depend on the address-space cache being off; the cost per snapshot shouldn't. Two directions that might help, if useful: 1. `ResourceMaterializer::Materialize` takes the snapshot anew on every call (`TableSnapshotter(...).Run()`), so an unchanged heap is read and decoded again each time. Reusing a column's records while its heap range is unwritten would avoid most of those 4.5 ms per snapshot, with or without narrowing. The snapshot already records that range in `tables.ranges`. 2. Bounding a key domain by what its selector can reach, instead of the key buffer's whole extent, would let narrowing apply to large key buffers like this one. That could be the selector's possible bits, or the reading draw's range.
tibzejoker commented 2026-10-14 09:00:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-14T09:00:13Z.


For EagleBearerYS's first direction, here is what GTA V shows on 4dcf657a2 (main d8888df9b plus this PR, #448's port, #1186 and #1189). I sampled queue worker 0 every millisecond over 150 s of Story (APS5_SAMPLE_WORKER, 8,967 samples, symbolized with nm). Worker 0 is GTA's critical path; the full profile is in #5694.

  • ShaderResources::resolveImageTables → GuestMemory::EqualsCommitted (memcmp): 7.1 % of worker 0.
  • ResourceMaterializer::ResolveImageTables, its own time: 3.4 %.
  • TableSnapshotter::Column: 0.5 %.

So in GTA, about 11 % of the critical thread goes to re-reading and comparing tables. The tables are GTA's 65,536-record heaps with 4,096 distinct T#s, and they change rarely. Reusing a column's records while tables.ranges is unwritten, as suggested, should remove most of that.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164739063 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6164739063). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-14T09:00:13Z. --- For EagleBearerYS's first direction, here is what GTA V shows on 4dcf657a2 (`main` d8888df9b plus this PR, #448's port, #1186 and #1189). I sampled queue worker 0 every millisecond over 150 s of Story (`APS5_SAMPLE_WORKER`, 8,967 samples, symbolized with `nm`). Worker 0 is GTA's critical path; the full profile is in #5694. - `ShaderResources::resolveImageTables` → `GuestMemory::EqualsCommitted` (memcmp): **7.1 %** of worker 0. - `ResourceMaterializer::ResolveImageTables`, its own time: **3.4 %**. - `TableSnapshotter::Column`: 0.5 %. So in GTA, about 11 % of the critical thread goes to re-reading and comparing tables. The tables are GTA's 65,536-record heaps with 4,096 distinct T#s, and they change rarely. Reusing a column's records while `tables.ranges` is unwritten, as suggested, should remove most of that. AI-assisted (Claude Code).
Celegans12 commented 2026-10-14 09:18:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-14T09:18:11Z.


Thanks for running these heads on three more titles. It's good to see Guardians of the Galaxy get past its loading screen with memory flat at 11.6 GiB, and GTA with no failing dispatch.

What all three runs agree on is where the time goes now: re-reading tables that rarely change. In Village, each snapshot costs about 4.5 ms because narrowing never applies to its 32 MiB key buffer, and in GTA about 11% of the critical worker goes to re-reading and comparing the 65,536-record heaps (7.1% in EqualsCommitted alone). @SleglJan already has the start of this in perf/image-table-snapshot-reuse (f9c2003df): it keeps a column's plan and descriptor lookups while its words are unchanged. That still reads and compares the words on every capture, which is the part tibzejoker's profile shows as the larger cost. So I'd add what @EagleBearerYS suggests on top of it: skip the read itself while the column's range in tables.ranges has no write since the last snapshot.

@SleglJan, you said you'd open this after #757/#758 merge. Would you rather open it now, stacked on #758, or should I fold it in here with your authorship and add the unwritten-range skip? I'm fine either way. I'd just like the cost numbers in this thread to have an answer that lands soon.

@Tamalero, the three shaders at 0x4378/0x4380 are a new shape: a pointer table keyed by a material id read from a texture and made wave-uniform. The planner can't enumerate those keys from a buffer, so they'd need either the whole pointer-reached table or a runtime bound. I'll look at it as a follow-up rather than grow this PR. Could you attach one of their requests?

@adriadam10, none of this changes the four points from your last review, which I answered this morning. The snapshot reuse is a follow-up for the cost, not a correctness issue. This head is still waiting for your re-review and for the full Build.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6165051879 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6165051879). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-14T09:18:11Z. --- Thanks for running these heads on three more titles. It's good to see Guardians of the Galaxy get past its loading screen with memory flat at 11.6 GiB, and GTA with no failing dispatch. What all three runs agree on is where the time goes now: re-reading tables that rarely change. In Village, each snapshot costs about 4.5 ms because narrowing never applies to its 32 MiB key buffer, and in GTA about 11% of the critical worker goes to re-reading and comparing the 65,536-record heaps (7.1% in `EqualsCommitted` alone). @SleglJan already has the start of this in `perf/image-table-snapshot-reuse` (f9c2003df): it keeps a column's plan and descriptor lookups while its words are unchanged. That still reads and compares the words on every capture, which is the part tibzejoker's profile shows as the larger cost. So I'd add what @EagleBearerYS suggests on top of it: skip the read itself while the column's range in `tables.ranges` has no write since the last snapshot. @SleglJan, you said you'd open this after #757/#758 merge. Would you rather open it now, stacked on #758, or should I fold it in here with your authorship and add the unwritten-range skip? I'm fine either way. I'd just like the cost numbers in this thread to have an answer that lands soon. @Tamalero, the three shaders at 0x4378/0x4380 are a new shape: a pointer table keyed by a material id read from a texture and made wave-uniform. The planner can't enumerate those keys from a buffer, so they'd need either the whole pointer-reached table or a runtime bound. I'll look at it as a follow-up rather than grow this PR. Could you attach one of their requests? @adriadam10, none of this changes the four points from your last review, which I answered this morning. The snapshot reuse is a follow-up for the cost, not a correctness issue. This head is still waiting for your re-review and for the full Build.
Celegans12 commented 2026-10-14 10:35:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-14T10:35:04Z.


I've rebased this onto main c654b199 (head e7faf20683): #4806's mapped SPIR-V took disk format 31, so this PR now uses 32 and #758 uses 33, and #5347's depth-surface rework only moved where a new surface bumps the table-reuse serial. The one change in meaning is #5188's new test: with this PR, a T# read from a constant buffer at a user-data offset becomes a one-column table instead of an ordinary image, so I changed its check to read the record each key selects from the table snapshot. Both heads pass the full Windows NVIDIA suite and upstream's Linux job apart from the tests that also fail on main. @EagleBearerYS, does that still cover what you needed for the Village mesh program?

Details
  • Heads: #757 e7faf20683, #758 a5c63d5249 (restacked; its own diff only changes the two size asserts, the format, now 32 to 33, and the format line in ARCHITECTURE.md). Runtime ABI stays 12 (main is at 11). Both merge cleanly with main 3e577eda.
  • On #758's head, which includes this one: Windows NVIDIA passes 1,148/1,149, and log_macros also fails on main. Upstream's Linux job in WSL (lavapipe), merged with main 23e93c05, passes 1,123/1,125, and agc_driver_bc_block_copy and agc_driver_depth_compare_copy also fail on main there.
  • Targeted Windows NVIDIA tests on both heads pass 11/11: agc_driver_image_table, _cache, _cache_bounds, _reuse, agc_driver_bindless_images, agc_driver_runtime_images, agc_shader_bindless, agc_shader_memory, agc_shader_disk_cache, agc_driver_graphics, agc_driver_buffer_descriptor_runtime. The same 11 pass in the Linux job merged with main 3e577eda.
  • verifyUniformTableImage (#5188) now checks that the T# is planned as a table column with a 48-byte stride, and that the captures with s2 = 2 and s2 = 1 read the T#s of records 2 and 1 through the table.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6166396645 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6166396645). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-14T10:35:04Z. --- I've rebased this onto `main` c654b199 (head e7faf20683): #4806's mapped SPIR-V took disk format 31, so this PR now uses 32 and #758 uses 33, and #5347's depth-surface rework only moved where a new surface bumps the table-reuse serial. The one change in meaning is #5188's new test: with this PR, a T# read from a constant buffer at a user-data offset becomes a one-column table instead of an ordinary image, so I changed its check to read the record each key selects from the table snapshot. Both heads pass the full Windows NVIDIA suite and upstream's Linux job apart from the tests that also fail on `main`. @EagleBearerYS, does that still cover what you needed for the Village mesh program? <details><summary>Details</summary> - Heads: #757 e7faf20683, #758 a5c63d5249 (restacked; its own diff only changes the two size asserts, the format, now 32 to 33, and the format line in ARCHITECTURE.md). Runtime ABI stays 12 (`main` is at 11). Both merge cleanly with `main` 3e577eda. - On #758's head, which includes this one: Windows NVIDIA passes 1,148/1,149, and `log_macros` also fails on `main`. Upstream's Linux job in WSL (lavapipe), merged with `main` 23e93c05, passes 1,123/1,125, and `agc_driver_bc_block_copy` and `agc_driver_depth_compare_copy` also fail on `main` there. - Targeted Windows NVIDIA tests on both heads pass 11/11: `agc_driver_image_table`, `_cache`, `_cache_bounds`, `_reuse`, `agc_driver_bindless_images`, `agc_driver_runtime_images`, `agc_shader_bindless`, `agc_shader_memory`, `agc_shader_disk_cache`, `agc_driver_graphics`, `agc_driver_buffer_descriptor_runtime`. The same 11 pass in the Linux job merged with `main` 3e577eda. - `verifyUniformTableImage` (#5188) now checks that the T# is planned as a table column with a 48-byte stride, and that the captures with `s2 = 2` and `s2 = 1` read the T#s of records 2 and 1 through the table. </details>
EagleBearerYS commented 2026-10-14 10:45:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T10:45:41Z.


Yes for what the test was there for: that the program plans, and that each capture reads the T# of the record the user data selects. Your version checks both through the table (one column at a 48-byte stride, records 2 and 1). I haven't replayed Village's dumped mesh program on e7faf20683 yet. I'll add the result here when I have it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6166575193 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6166575193). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T10:45:41Z. --- Yes for what the test was there for: that the program plans, and that each capture reads the T# of the record the user data selects. Your version checks both through the table (one column at a 48-byte stride, records 2 and 1). I haven't replayed Village's dumped mesh program on e7faf20683 yet. I'll add the result here when I have it.
EagleBearerYS commented 2026-10-14 12:07:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T12:07:39Z.


A follow-up on the replay I mentioned: it didn't get as far as the recompiler. Village's dumped mesh program (shader 0x2086a1e500, stage 7) is from 2026-10-13, request format version 20, and agc_shader_replay built at e7faf20683 stops loading it with RequestSerializer: truncated data. This PR doesn't change RequestSerializer.cpp, so main reads it the same way. The dump was written by our local Village stack at the time, so it may not match main's reader.

The driver only writes these dumps when preparation fails, and with #5188 merged this program prepares, so a fresh dump won't come on its own. Short of a Village run through its PSO cache build on this head, your updated verifyUniformTableImage is what covers it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6167964594 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6167964594). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T12:07:39Z. --- A follow-up on the replay I mentioned: it didn't get as far as the recompiler. Village's dumped mesh program (shader 0x2086a1e500, stage 7) is from 2026-10-13, request format version 20, and `agc_shader_replay` built at e7faf20683 stops loading it with `RequestSerializer: truncated data`. This PR doesn't change `RequestSerializer.cpp`, so `main` reads it the same way. The dump was written by our local Village stack at the time, so it may not match `main`'s reader. The driver only writes these dumps when preparation fails, and with #5188 merged this program prepares, so a fresh dump won't come on its own. Short of a Village run through its PSO cache build on this head, your updated `verifyUniformTableImage` is what covers it.
Celegans12 commented 2026-10-14 15:14:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-14T15:14:26Z.


I've rebased this onto main 066b58fa again, and the new head is d9e47d1e98. The textual conflicts came from #5550, #5249 and #5408, but only #5550 changed what the code means. It taught the old bindless-table path to accept a T# that several image operations share, which happens when one table entry is both queried and sampled. This PR replaces that path. TryMakeTableColumn never required the T#'s reads to have a single user, so each copy of the T# plans the same column, and the reads become planning-only once every user is a planned column. I ported milescoviello's test into verifyImageTables: the shader must plan one column holding one image, and the map must select the right record for each key. To check that the test really guards the case, I added a single-user check back into TryMakeTableColumn in a scratch build. The test then failed with the error from #5550 (GetImageResource dword 0 is not a valid runtime value).

Two other merges were clean as text but broke on the content-key words this PR adds, an image shape per table element. #4783 reserves each key's exact size, and agc_driver_graphics caught the missing words. #5408's key-miss trace parses keys word by word, so every real key would have come out unlabelled. Both now count the shapes, and the trace counts table words as image and sampler words. Their tests cover this. #5249's in-place sparse heaps merged cleanly, and its two tests pass on this head.

Disk format stays 32 here and 33 in #758, and the runtime ABI stays 12 (main is still at 31 and 11). With #758 on top, Windows NVIDIA passes 1,188 of 1,189 tests, and upstream's Linux job merged with main 84b01f9c passes 1,171 of 1,173. The failures are the ones main has as well.

@adriadam10 @oneandonlydean, could you take another look and start the full Build while the head is clean? main moves fast, and these shader files conflicted again within a day.

Details
  • How each conflict was resolved:
    • ShaderResources.hpp and tests/Graphics.cpp: kept both sides (#5408's ContentKeyComponent next to ImageTableReuseCounts, and the alpha-to-coverage switches next to the image-table ones).
    • ResourceTracker.cpp: kept this PR's TryMakeTableColumn and dropped #5550's usedOnlyAsImage together with the path it extended.
    • tests/ShaderMemory.cpp: ported #5550's query test to the table-column model.
  • Changes beyond the conflicts:
    • #5555 (2D-array loads on 3D T#s) still called LoadSampledImageDescriptor with the slot argument this PR removed. It now loads the resource's descriptor like every other caller.
    • ContentKey reserves 1 + imageShapes.size() more words per binding. ResourceContentKeyTests now gives the images shapes and checks that changing the last shape changes the key. Before the fix it failed with "content key reserved a different word count than it serialized".
    • LabelShaderKey reads the shape list and labels ImageTable/SamplerTable words as image/sampler. agc_driver_key_miss gained image-table word, shape and sampler-table word cases.
  • #5249: table records are read through the capture snapshot and checked by the table reuse proof, not through the heap's buffer binding. A heap that the shader also binds whole still uses #5249's in-place import and its CutRegions check, and a set holding both is reused only when both proofs pass. agc_sparse_run_import and agc_sparse_run_import_copied pass.
  • Targeted Windows NVIDIA run, 18/18 on both heads: agc_driver_image_table, _cache, _cache_bounds, _reuse, agc_driver_bindless_images, agc_driver_runtime_images, agc_shader_bindless, agc_shader_memory, agc_shader_disk_cache, agc_driver_graphics, agc_driver_buffer_descriptor_runtime, agc_driver_key_miss, agc_sparse_run_import, _copied, agc_driver_image_store_array_through_volume, agc_driver_image_address_dimension, and both alpha-to-coverage state tests. The same 18 pass in the Linux job on #758 merged with main 84b01f9c.
  • Full Windows run on #758's head: agc_shader_disk_cache timed out once in the parallel pass. It passed alone, and then ten times in a row under -j 8 alongside the other table tests.
  • Both heads merge cleanly with main 84b01f9c.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6171649308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6171649308). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-14T15:14:26Z. --- I've rebased this onto `main` 066b58fa again, and the new head is d9e47d1e98. The textual conflicts came from #5550, #5249 and #5408, but only #5550 changed what the code means. It taught the old bindless-table path to accept a T# that several image operations share, which happens when one table entry is both queried and sampled. This PR replaces that path. `TryMakeTableColumn` never required the T#'s reads to have a single user, so each copy of the T# plans the same column, and the reads become planning-only once every user is a planned column. I ported milescoviello's test into `verifyImageTables`: the shader must plan one column holding one image, and the map must select the right record for each key. To check that the test really guards the case, I added a single-user check back into `TryMakeTableColumn` in a scratch build. The test then failed with the error from #5550 (`GetImageResource dword 0 is not a valid runtime value`). Two other merges were clean as text but broke on the content-key words this PR adds, an image shape per table element. #4783 reserves each key's exact size, and `agc_driver_graphics` caught the missing words. #5408's key-miss trace parses keys word by word, so every real key would have come out unlabelled. Both now count the shapes, and the trace counts table words as image and sampler words. Their tests cover this. #5249's in-place sparse heaps merged cleanly, and its two tests pass on this head. Disk format stays 32 here and 33 in #758, and the runtime ABI stays 12 (`main` is still at 31 and 11). With #758 on top, Windows NVIDIA passes 1,188 of 1,189 tests, and upstream's Linux job merged with `main` 84b01f9c passes 1,171 of 1,173. The failures are the ones `main` has as well. @adriadam10 @oneandonlydean, could you take another look and start the full Build while the head is clean? `main` moves fast, and these shader files conflicted again within a day. <details><summary>Details</summary> - How each conflict was resolved: - `ShaderResources.hpp` and `tests/Graphics.cpp`: kept both sides (#5408's `ContentKeyComponent` next to `ImageTableReuseCounts`, and the alpha-to-coverage switches next to the image-table ones). - `ResourceTracker.cpp`: kept this PR's `TryMakeTableColumn` and dropped #5550's `usedOnlyAsImage` together with the path it extended. - `tests/ShaderMemory.cpp`: ported #5550's query test to the table-column model. - Changes beyond the conflicts: - #5555 (2D-array loads on 3D T#s) still called `LoadSampledImageDescriptor` with the slot argument this PR removed. It now loads the resource's descriptor like every other caller. - `ContentKey` reserves `1 + imageShapes.size()` more words per binding. `ResourceContentKeyTests` now gives the images shapes and checks that changing the last shape changes the key. Before the fix it failed with "content key reserved a different word count than it serialized". - `LabelShaderKey` reads the shape list and labels `ImageTable`/`SamplerTable` words as image/sampler. `agc_driver_key_miss` gained image-table word, shape and sampler-table word cases. - #5249: table records are read through the capture snapshot and checked by the table reuse proof, not through the heap's buffer binding. A heap that the shader also binds whole still uses #5249's in-place import and its `CutRegions` check, and a set holding both is reused only when both proofs pass. `agc_sparse_run_import` and `agc_sparse_run_import_copied` pass. - Targeted Windows NVIDIA run, 18/18 on both heads: `agc_driver_image_table`, `_cache`, `_cache_bounds`, `_reuse`, `agc_driver_bindless_images`, `agc_driver_runtime_images`, `agc_shader_bindless`, `agc_shader_memory`, `agc_shader_disk_cache`, `agc_driver_graphics`, `agc_driver_buffer_descriptor_runtime`, `agc_driver_key_miss`, `agc_sparse_run_import`, `_copied`, `agc_driver_image_store_array_through_volume`, `agc_driver_image_address_dimension`, and both alpha-to-coverage state tests. The same 18 pass in the Linux job on #758 merged with `main` 84b01f9c. - Full Windows run on #758's head: `agc_shader_disk_cache` timed out once in the parallel pass. It passed alone, and then ten times in a row under `-j 8` alongside the other table tests. - Both heads merge cleanly with `main` 84b01f9c. </details>
github-actions[bot] commented 2026-10-14 15:28:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T15:28:00Z.


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
#1193 core/shader/recompiler/Optimization/include/Optimization/ResourceMaterializer.hpp L22-23, L25-27
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L29-30, L446-447, L1026-1027, L1042, L1048-1056
#4943 core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp L34
core/shader/recompiler/ShaderDiskCache.cpp L87-89
#5181 core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ResourcePlan.hpp L13
#5371 core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp L59-61
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp L416-427
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L195-197, L586-587
#5375 core/shader/recompiler/ShaderDiskCache.cpp L141-142
#5461 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp L170
core/shader/recompiler/ShaderDiskCache.cpp L141-142
#5472 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp L170
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L1037-1038
core/shader/recompiler/ShaderDiskCache.cpp L141-142
#5473 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L1080-1101
#5496 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L12, L683-684
#5524 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L12, L682-684
#5554 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L12, L682-684
#5609 core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp L34
core/shader/recompiler/ShaderDiskCache.cpp L87-89
#5620 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp L1358
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp L22-37
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L317-338, L380-399
core/shader/recompiler/Optimization/src/ResourceTracker.cpp L433-463, L485, L498, L540-547, L557-585
core/shader/recompiler/ShaderDiskCache.cpp L110-111, L150, L967-975, L1106, L1109-1118
#5804 core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp L127
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L703
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp L154, L330-331, L597, L618
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L26
#5820 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp L1358
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp L22-37
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L317-338, L344-369, L380-399
core/shader/recompiler/Optimization/src/ResourceTracker.cpp L433-463, L485, L498, L540-547, L557-585
core/shader/recompiler/ShaderDiskCache.cpp L110-111, L150, L967-975, L1106, L1109-1118
#5875 core/shader/recompiler/ShaderDiskCache.cpp L86-89
#5899 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L220
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6171923461 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6171923461). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T15:28:00Z. --- <!-- pr-overlap --> 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 | |---|---|---|---| | #1193 | `core/shader/recompiler/Optimization/include/Optimization/ResourceMaterializer.hpp` [L22-23](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/include/Optimization/ResourceMaterializer.hpp#L22-L23), [L25-27](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/include/Optimization/ResourceMaterializer.hpp#L25-L27)<br>`core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp` [L29-30](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L29-L30), [L446-447](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L446-L447), [L1026-1027](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L1026-L1027), [L1042](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L1042), [L1048-1056](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L1048-L1056) | | | | #4943 | `core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp` [L34](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp#L34)<br>`core/shader/recompiler/ShaderDiskCache.cpp` [L87-89](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L87-L89) | | | | #5181 | `core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ResourcePlan.hpp` [L13](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ResourcePlan.hpp#L13) | | | | #5371 | `core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp` [L59-61](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp#L59-L61)<br>`core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp` [L416-427](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp#L416-L427)<br>`core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp` [L195-197](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L195-L197), [L586-587](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L586-L587) | | | | #5375 | `core/shader/recompiler/ShaderDiskCache.cpp` [L141-142](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L141-L142) | | | | #5461 | `core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp` [L170](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp#L170)<br>`core/shader/recompiler/ShaderDiskCache.cpp` [L141-142](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L141-L142) | | | | #5472 | `core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp` [L170](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp#L170)<br>`core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp` [L1037-1038](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L1037-L1038)<br>`core/shader/recompiler/ShaderDiskCache.cpp` [L141-142](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L141-L142) | | | | #5473 | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` [L1080-1101](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L1080-L1101) | | | | #5496 | `core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp` [L12](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L12), [L683-684](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L683-L684) | | | | #5524 | `core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp` [L12](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L12), [L682-684](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L682-L684) | | | | #5554 | `core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp` [L12](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L12), [L682-684](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L682-L684) | | | | #5609 | `core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp` [L34](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp#L34)<br>`core/shader/recompiler/ShaderDiskCache.cpp` [L87-89](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L87-L89) | | | | #5620 | `core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp` [L1358](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp#L1358)<br>`core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp` [L22-37](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp#L22-L37)<br>`core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp` [L317-338](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L317-L338), [L380-399](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L380-L399)<br>`core/shader/recompiler/Optimization/src/ResourceTracker.cpp` [L433-463](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L433-L463), [L485](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L485), [L498](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L498), [L540-547](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L540-L547), [L557-585](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L557-L585)<br>`core/shader/recompiler/ShaderDiskCache.cpp` [L110-111](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L110-L111), [L150](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L150), [L967-975](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L967-L975), [L1106](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L1106), [L1109-1118](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L1109-L1118) | | | | #5804 | `core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp` [L127](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp#L127)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` [L703](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L703)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp` [L154](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L154), [L330-331](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L330-L331), [L597](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L597), [L618](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L618)<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L26](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L26) | | | | #5820 | `core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp` [L1358](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp#L1358)<br>`core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp` [L22-37](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp#L22-L37)<br>`core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp` [L317-338](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L317-L338), [L344-369](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L344-L369), [L380-399](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L380-L399)<br>`core/shader/recompiler/Optimization/src/ResourceTracker.cpp` [L433-463](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L433-L463), [L485](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L485), [L498](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L498), [L540-547](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L540-L547), [L557-585](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L557-L585)<br>`core/shader/recompiler/ShaderDiskCache.cpp` [L110-111](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L110-L111), [L150](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L150), [L967-975](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L967-L975), [L1106](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L1106), [L1109-1118](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L1109-L1118) | | | | #5875 | `core/shader/recompiler/ShaderDiskCache.cpp` [L86-89](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/ShaderDiskCache.cpp#L86-L89) | | | | #5899 | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp` [L220](https://github.com/boykopovar/AnyPS5/blob/a453108cf7768b71879b0e832d367a935c43440d/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L220) | | |
adriadam10 commented 2026-10-14 15:34:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T15:34:48Z.

Review: APPROVED


Re-review of d9e47d1e98 (#757) with #758's 34525fdf7a on top, merged onto main 84b01f9cd (clean merge). Linux, RADV, -DANYPS5_ENABLE_SPIRV_TOOLS=ON, libSceAgc + libSceAgcDriver scope: 572/573 ctest.

  • agc_driver_image_table, _cache, _cache_bounds, _reuse, agc_driver_bindless_images, agc_shader_bindless, agc_shader_memory, agc_shader_disk_cache, agc_driver_graphics, agc_driver_key_miss, agc_sparse_run_import and _copied pass. In agc_driver_image_table the poisoned entries (outside the snapshot, not an image, unmapped surface, sRGB decode, table written by its dispatch) each reach the host as a thrown image table: fault. Only the per-wave wave32 case is skipped, since RADV's subgroup is 64.
  • The one failure, agc_driver_tessellation (SIGSEGV), fails the same way on main 84b01f9cd built alone, so it isn't this PR.

All four points from my last review are addressed: the ARCHITECTURE.md section, both fold-ins (with their tests in agc_shader_bindless), the order (#4757 closed, #4883 rebased on) and the final numbers (disk format 32/33, runtime ABI 12). Selected poison entries throw through BdaResources::CheckFault, so nothing that main refused now returns a plausible value, and every unbound case has a debt line.

On @oneandonlydean's memory question: tibzejoker's 4dcf657a2 run shows both caches sitting at their new caps (dispatch cache ~254 MiB, resource cache 1,024 entries, only 20 table T# misses per 10 s). The ~1 GB/min that remains in GTA isn't in the structures this PR adds, and Guardians stays flat at 11.6 GiB. The CPU copies of sampled textures are bounded by the VRAM-derived budget, which is a follow-up that isn't specific to tables. The snapshot cost (Village 4.5 ms, GTA ~11 % of worker 0) is a performance follow-up (SleglJan's snapshot reuse plus the unwritten-range skip), not a correctness issue.

Approving both. #758 goes in after #757. The full Build (Windows) is dispatched on the final heads before the merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5520495454 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#pullrequestreview-5520495454). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T15:34:48Z. **Review:** APPROVED --- Re-review of d9e47d1e98 (#757) with #758's 34525fdf7a on top, merged onto `main` 84b01f9cd (clean merge). Linux, RADV, `-DANYPS5_ENABLE_SPIRV_TOOLS=ON`, libSceAgc + libSceAgcDriver scope: 572/573 ctest. - `agc_driver_image_table`, `_cache`, `_cache_bounds`, `_reuse`, `agc_driver_bindless_images`, `agc_shader_bindless`, `agc_shader_memory`, `agc_shader_disk_cache`, `agc_driver_graphics`, `agc_driver_key_miss`, `agc_sparse_run_import` and `_copied` pass. In `agc_driver_image_table` the poisoned entries (outside the snapshot, not an image, unmapped surface, sRGB decode, table written by its dispatch) each reach the host as a thrown `image table:` fault. Only the per-wave wave32 case is skipped, since RADV's subgroup is 64. - The one failure, `agc_driver_tessellation` (SIGSEGV), fails the same way on `main` 84b01f9cd built alone, so it isn't this PR. All four points from my last review are addressed: the ARCHITECTURE.md section, both fold-ins (with their tests in `agc_shader_bindless`), the order (#4757 closed, #4883 rebased on) and the final numbers (disk format 32/33, runtime ABI 12). Selected poison entries throw through `BdaResources::CheckFault`, so nothing that `main` refused now returns a plausible value, and every unbound case has a debt line. On @oneandonlydean's memory question: tibzejoker's 4dcf657a2 run shows both caches sitting at their new caps (dispatch cache ~254 MiB, resource cache 1,024 entries, only 20 table T# misses per 10 s). The ~1 GB/min that remains in GTA isn't in the structures this PR adds, and Guardians stays flat at 11.6 GiB. The CPU copies of sampled textures are bounded by the VRAM-derived budget, which is a follow-up that isn't specific to tables. The snapshot cost (Village 4.5 ms, GTA ~11 % of worker 0) is a performance follow-up (SleglJan's snapshot reuse plus the unwritten-range skip), not a correctness issue. Approving both. #758 goes in after #757. The full Build (Windows) is dispatched on the final heads before the merge.
Tamalero commented 2026-10-14 19:10:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-14T19:10:07Z.


@Celegans12, Guardians of the Galaxy (PPSA01748) on main bebff8b0e, which has this PR, #758 and #4475 merged. The only local change is one NpManager stub.

Better than before. All the menu text now renders, which it didn't on the older heads. The title goes through the language, brightness and adjustments screens, plays its intro video, and starts loading the first level.

It still stops during that load, on a shape I'd separate from the 0x4378/0x4380 one you described:

shader 0x3b94a7500 stage 5: GetImageResource dword 0 is not a valid runtime value; chain:
LoadAddressU32@pc=0x84(
  GetAddressResource(LoadAddressU32@pc=0x70(
    GetAddressResource(ReadConstBuffer@pc=0x30(GetBufferResource(GetUserData…),
                       ShiftLeftLogical32(ReadFirstLane(GetInterpolationParameter(…)), …)),
                       ReadConstBuffer@pc=0x30(…same…)), …),
  LoadAddressU32@pc=0x70(…))

The key is a readfirstlane of an interpolated attribute (a flat per-primitive id). It indexes a constant buffer that holds a pointer. That pointer leads to a second pointer, which leads to the T#. So it's two pointer hops, where #758 covers one. Yesterday's run, on the older heads, stopped on a second pixel shader with exactly the same chain at different pcs (0x3b9421600, pc 0x144 / 0x118 / 0x94). The 0x4378/0x4380 shaders (key from an ImageRead) still show up as unplanned at registration but haven't been the stop.

On the request: I'd rather not attach it. The serialized request carries the title's shader binary, and I keep game code off public threads. If you open a follow-up for either shape, I can run it on this title the same day and post the result, or paste more of AnyPS5's own planner output from the log.

Details
  • Linux, RTX 4090 (driver 615.78.08), i9-14900K. Relinked --to-intel against this build; fresh shader cache (format change).
  • Registration on this run: 21 shaders unplanned. 10 have a program address outside the shader registers (prepared on use), 8 are s_swappc_b64 to a computed target (#4706's territory), and 3 are the 0x4378/0x4380 shape. Plus 11 notices of "unsupported registered shader type 8".
  • RSS was about 10 GiB during the load. The text-strip re-creation I mentioned earlier dropped from about 5,400 to about 780 creations by the menus.

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

image Note, there seems to be bug unrelated to this thread on the language availability. Will be reported later (chunks)
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176213628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6176213628). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-14T19:10:07Z. --- @Celegans12, Guardians of the Galaxy (PPSA01748) on `main` `bebff8b0e`, which has this PR, #758 and #4475 merged. The only local change is one NpManager stub. **Better than before.** All the menu text now renders, which it didn't on the older heads. The title goes through the language, brightness and adjustments screens, plays its intro video, and starts loading the first level. **It still stops during that load**, on a shape I'd separate from the 0x4378/0x4380 one you described: ``` shader 0x3b94a7500 stage 5: GetImageResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x84( GetAddressResource(LoadAddressU32@pc=0x70( GetAddressResource(ReadConstBuffer@pc=0x30(GetBufferResource(GetUserData…), ShiftLeftLogical32(ReadFirstLane(GetInterpolationParameter(…)), …)), ReadConstBuffer@pc=0x30(…same…)), …), LoadAddressU32@pc=0x70(…)) ``` The key is a `readfirstlane` of an **interpolated attribute** (a flat per-primitive id). It indexes a constant buffer that holds a pointer. That pointer leads to a second pointer, which leads to the T#. So it's **two pointer hops**, where #758 covers one. Yesterday's run, on the older heads, stopped on a second pixel shader with exactly the same chain at different pcs (0x3b9421600, pc 0x144 / 0x118 / 0x94). The 0x4378/0x4380 shaders (key from an `ImageRead`) still show up as unplanned at registration but haven't been the stop. On the request: I'd rather not attach it. The serialized request carries the title's shader binary, and I keep game code off public threads. If you open a follow-up for either shape, I can run it on this title the same day and post the result, or paste more of AnyPS5's own planner output from the log. <details><summary>Details</summary> - Linux, RTX 4090 (driver 615.78.08), i9-14900K. Relinked `--to-intel` against this build; fresh shader cache (format change). - Registration on this run: 21 shaders unplanned. 10 have a program address outside the shader registers (prepared on use), 8 are `s_swappc_b64` to a computed target (#4706's territory), and 3 are the 0x4378/0x4380 shape. Plus 11 notices of "unsupported registered shader type 8". - RSS was about 10 GiB during the load. The text-strip re-creation I mentioned earlier dropped from about 5,400 to about 780 creations by the menus. </details> *Tested and written by Claude (AI assistant) on a contributor's machine.* <img width="3317" height="1895" alt="image" src="https://github.com/user-attachments/assets/8e92496b-12d2-41a8-bfd4-dc3da329b5d9" /> Note, there seems to be bug unrelated to this thread on the language availability. Will be reported later (chunks)
EagleBearerYS commented 2026-10-14 23:05:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T23:05:18Z.


@Celegans12, Village numbers for the snapshot-reuse follow-up. Resident Evil Village (PPSA01556) on main e34c47921, which has this PR, plus the commits Village needs on this PC, on an RTX 3070 Laptop (driver 617.42) under Windows 11. The extra commits are #5703, #5851, #5815, #1186 and #3864, plus local workarounds for shader preparation, sample counts and sample locations.

From one run from boot to first control with APS5_PROFILE_DRAW=1, where the queue-0 worker is 100% busy throughout:

Phase 10 s windows Snapshots per 10 s [image-table] time per 10 s Per snapshot Narrowing applied
Title 77 445 2.4 s 5.4 ms 0 of 34,294
First 3D scene 72 116 1.3 s 11.2 ms 0 of 8,350
The scene's fade 52 74 1.4 s 18.4 ms 0 of 3,858

Each table has 32,768 keys. In a Tracy capture of the title with local zones, the draw stage's capture, which reads each column's records, is 55% of the worker's own time, about 100k words read per capture. resolveImageTables takes another 15%, 2.9 ms per draw. Both of those numbers come from profiled runs.

Without any profiling (only APS5_TRACE_SECONDS), a trace of the load into the first 3D scene has Shader.DrawStage at 171 ms of the 332 ms per frame that queue 0's draw packets take.

So keeping a column while its words are unchanged, and skipping its read while tables.ranges has no write since the last snapshot, would reach a large share of the worker's time in this title.

I can test SleglJan's perf/image-table-snapshot-reuse, or the follow-up PR when it's up, on Village and post the same numbers before and after.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180437501 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/757#issuecomment-6180437501). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T23:05:18Z. --- @Celegans12, Village numbers for the snapshot-reuse follow-up. Resident Evil Village (PPSA01556) on `main` e34c47921, which has this PR, plus the commits Village needs on this PC, on an RTX 3070 Laptop (driver 617.42) under Windows 11. The extra commits are #5703, #5851, #5815, #1186 and #3864, plus local workarounds for shader preparation, sample counts and sample locations. From one run from boot to first control with `APS5_PROFILE_DRAW=1`, where the queue-0 worker is 100% busy throughout: | Phase | 10 s windows | Snapshots per 10 s | `[image-table]` time per 10 s | Per snapshot | Narrowing applied | |---|---|---|---|---|---| | Title | 77 | 445 | 2.4 s | 5.4 ms | 0 of 34,294 | | First 3D scene | 72 | 116 | 1.3 s | 11.2 ms | 0 of 8,350 | | The scene's fade | 52 | 74 | 1.4 s | 18.4 ms | 0 of 3,858 | Each table has 32,768 keys. In a Tracy capture of the title with local zones, the draw stage's capture, which reads each column's records, is 55% of the worker's own time, about 100k words read per capture. `resolveImageTables` takes another 15%, 2.9 ms per draw. Both of those numbers come from profiled runs. Without any profiling (only `APS5_TRACE_SECONDS`), a trace of the load into the first 3D scene has `Shader.DrawStage` at 171 ms of the 332 ms per frame that queue 0's draw packets take. So keeping a column while its words are unchanged, and skipping its read while `tables.ranges` has no write since the last snapshot, would reach a large share of the worker's time in this title. I can test SleglJan's `perf/image-table-snapshot-reuse`, or the follow-up PR when it's up, on Village and post the same numbers before and after.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!757
No description provided.