Skip to content

fix(shader): read a chased pointer's high word at its own offset - #9749

Open
EagleBearerYS wants to merge 156 commits into
boykopovar:mainfrom
EagleBearerYS:fix/shader-pointer-chase-split-words-on-c2
Open

EagleBearerYS wants to merge 156 commits into
boykopovar:mainfrom
EagleBearerYS:fix/shader-pointer-chase-split-words-on-c2

Conversation

@EagleBearerYS

@EagleBearerYS EagleBearerYS commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What

This is stacked on #9633.

With #9633, Ratchet & Clank: Rift Apart (PPSA01474) got past its 0x10b84 stop. It then stopped at the next T# load, in compute 0x116bb67100 (Tamalero's run):

ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x00013bc0(GetAddressResource(Phi(...

Ratchet & Clank: Rift Apart (PPSA01474), 11-13: this PR got the title past 0x13bc0 in Tamalero's run of 10-22 (see Tested). On current main the title doesn't stop there. #14636 removed the title's pc=0x62d4 GetSamplerResource refusal: with #14636's merge reverted, main f57c971 aborts on it again (dantdmdarealguy's run). Tamalero's run of main 4e2acc2 with #18522, on RADV with APS5_MAX_COMPUTE_SPIRV_WORDS=2000000 and APS5_SKIP_REFUSED_DISPATCHES=1 (which skips and logs any compute shader whose recompile fails, code), reaches the first gameplay; the only shaders it skipped were two dropped for size (comment). main still refuses this PR's shape: on main fb542a2, which has #14636, agc_driver_pointer_chase_split_table fails 3 of 3 with #9633 merged and passes 3 of 3 with this PR merged (llvmpipe, a cloud Linux machine).

Tamalero's trace of the same shader (comment) shows a third chase step:

  • the V# is at the pointer plus 0x110;
  • the next pointer is dword 5 (low, 0x54) and dword 11 (high, 0x6c) of one s_buffer_load_dwordx16 from 0x40.

#9633's chase arm required the high word at the low word's immediate + 4, so the walk refused this step. Its V# offset and its depth (3 of 4) were already covered. #9633's 2c1a650 already gives each word pair through a V# its own chase site, so the new high immediate becomes part of that site.

The change:

The chased V#'s base (52ae654): on a diagnostic build of this PR, Tamalero's run stopped after 781 s on AGC driver: invalid shader memory read address (comment), on a V# read as 4f81f1f 0 ffffffff 0. TableSnapshotter::Chase() checked the four words it reads as a V#, but not the alignment of the address it then reads through that V#, and the driver's shader memory reader throws on an unaligned address. Chase() now treats an unaligned base as unresolved, as the snapshot's other runtime-address reads do. That step isn't captured, so a dispatch that takes it faults as outside the snapshot, like a link to memory the snapshot can't read.

Overlap:

Tested

Checklist

EagleBearerYS and others added 14 commits October 21, 2026 05:39
…ed record pointer

A T# loaded through a record pointer was still refused with "GetImageResource
dword 0 is not a valid runtime value" when the pointer's low word passed
ANDs with lane masks, as a waterfall loop that copies EXEC into the
pointer's SGPR builds them, or when its high word was a Phi of the
record's high word read under several keys.

For a pointer-keyed column, the walk of the low word now takes an AND
with a lane-mask operand (a Ballot word, or an AND or Phi of only Ballot
words and immediates) and keeps walking its other operand, so its
record reads must still match the column and anything else still
refuses. The high word is walked the same way: its record reads must
be the record word at the low word's offset plus 4. A high word that is
one read still gives the column its table and record offset, as before.
Otherwise the table comes from a record read whose V# words are defined
before the descriptor load, and the record offset from the high word,
which the GPU does not read for a pointer-keyed column.

A high-word arm read from another buffer, such as one whose V# is
loaded through a pointer, stays refused. A shader that planned before
plans the same way, so the disk-cache format does not change.
… a pointer-keyed record pointer

A T# loaded through a record pointer was still refused with "GetImageResource
dword 0 is not a valid runtime value" when a Phi of the pointer's low word
merged the record read, a zero, and the waterfall's lane mask with the
handled lane's bit cleared, BitwiseAnd32(CompositeExtractU32x4(Ballot(...), 0),
BitwiseNot32(ShiftLeftLogical32(1, index))), as s_ff1, s_lshl and s_not with
s_and, or s_andn2, build it in the SGPR the pointer reuses. The walk took only
Ballot words and ANDs of them as lane masks, so it walked into the NOT and
refused.

A lane-mask operand is now a Ballot word or the loop's lane bit, a shift of 1
by an index from FindILsb32, FindUMsb32 or ReadFirstLane (through the AND,
add, subtract and select that s_ff1_i32_b64, s_bitset0 and the shift's own
mask put around it), or an AND, OR, NOT or Phi of only those and immediates.
An arm of the pointer that is entirely such an operand is skipped. An AND
with a record read in it still has the read matched against the column, and
anything else still refuses.

agc_driver_pointer_phi_lane_not_table builds that shape in a wave64
waterfall: the low word's Phis merge the record read at +0, a zero and the
lane mask without the handled lane's bit, cleared by s_not and s_and and by
s_andn2, and the high word is one read at +4. Each lane samples the T# of its
record, and every masked word faults outside the snapshot.
agc_driver_pointer_vsharp_select_table reads a record keyed by
ReadFirstLane(SelectU32(LogicalAnd, IAdd32, Phi)), a pointer from it, a V#
through the pointer and the T# through the V#; it passes without this change
and keeps that chain checked, including a record pointer moved to the other
V# without a recompile.

Shaders that planned before plan the same way, and a refusal is never cached,
so the disk-cache format does not change.
…keyed records

A pointer-keyed record pointer now also takes lane-mask ANDs, the
waterfall loop's lane bit and its OR and NOT forms, and a high word
merged from the record's next word. A high word read from a second buffer
stays refused.
The low and high words of a pointer-keyed record pointer were walked
separately, so a high-word arm on a path whose low word is a lane mask
refused the plan even though that pair is no pointer. Ratchet & Clank:
Rift Apart (PPSA01474) stops this way at LoadAddressU32@pc=0x9a30: one
high-word arm reads a second buffer, and on that edge the low word is a
lane mask, the waterfall loop reusing the SGPR pair.

Walk the two words together. Where both are Phis of one block, each
low-word edge takes the high word of the same predecessor. An edge whose
low word is a constant or a lane mask is skipped with its high word. A
record low word still needs every high word it can meet to be a constant,
a lane mask or the same record column at offset + 4, so a second-buffer
high word paired with the record word stays refused.

agc_driver_pointer_phi_high_second_lane_table adds the lane-mask low word
to the second-buffer arm: it plans, each group samples the T# its record
selects, and that arm faults outside the snapshot.
…nter

The two words of the pointer are now walked edge by edge, and an edge
whose low word is a constant or a lane mask is skipped with its high
word. A high word read from a second buffer stays refused on an edge
whose low word is the record word.
…ane-masks

Brings boykopovar#7395's merge of main bd4d801, with boykopovar#8991. It merged without conflicts.
TryMakeIndirectColumn refused every pointer hop once the record's
pointer words were merged, so a T# read through a pointer loaded from a
pointer-keyed record pointer stayed unplanned (Gran Turismo 7's World
Map compute shaders, issue boykopovar#6191). Only buffer handles still refuse hops:
the materializer keys the records by the innermost pointer before it
follows the hops, and the plan's parent pointer is that innermost one.
…one-key child

From hugodearaujo's change on boykopovar#8939 (Marvel's Spider-Man 2, PPSA03016).
Spider-Man 2's shape: a record keyed by a first-lane read, its dwords
2-3 a pointer, a V# loaded at that pointer plus 0xa0, and the T# read at
offset 0 or 0x40 of that V#'s buffer with no second key. Two records
point at V#s of different T#s; a moved record pointer and a moved V#
must change the result without recompiling.
… pointer-keyed record pointer

A T# read at a pointer that a shader chases conditionally from a
pointer-keyed record pointer, loading a V# at a fixed offset of the
pointer and reading the next pointer from that buffer, stayed unplanned:
the merged pointer's chase arms read another buffer at another offset
than the record word, so PointerRecordRead refused them (Ratchet & Clank:
Rift Apart stops at compute LoadAddressU32 with this shape).

The walk now takes such an arm when its V# is read from a pointer that is
the record pointer or another chase arm, records each distinct chase as a
hop of the column, and refuses a chase that reaches itself or a depth
over 4. The snapshot then also captures every record pointer's chase
closure up to that depth as pointer-keyed entries, each with the T# at
its own offset, so the GPU's lookup finds the pointer the shader reached.
PointerRecordPairs found an existing chase site by its V# alone. A
second chase arm that reads its next pointer through the same V# at
other words therefore kept the first arm's PointerChase, and the
snapshot never followed the second arm: a T# behind a node whose V#
holds two links (words 0 and 1, words 2 and 3), each taken in its own
lanes, faulted as outside the snapshot when the second link was taken.

Sites are now keyed by the V# and the whole PointerChase, so each word
pair of one V# is its own chase in the column and in the snapshot's
closure. This follows the chase work for Ratchet & Clank: Rift Apart
(PPSA01474); its trace has not shown this shape yet.
A pointer chase arm whose next pointer is rebuilt from two words that
are not adjacent stayed unplanned: ChaseHighRead took the high word only
at the low word's immediate plus 4, so the walk refused the arm.
Ratchet & Clank: Rift Apart (PPSA01474) stops this way at compute
LoadAddressU32@pc=0x13bc0 with "GetImageResource dword 0 is not a valid
runtime value": after two chase steps through a V# at the pointer plus
0x60, its third step loads a V# at the pointer plus 0x110, reads 16
dwords from 0x40 with one s_buffer_load_dwordx16 and rebuilds the next
pointer from dword 5 (0x54) and dword 11 (0x6c).

PointerChase now keeps the high word's own immediate, readHighImmediate.
The walk takes a high read through the low read's V# (or an equivalent
one) at the same buffer offset when its immediate is 4-aligned and
differs from the low word's, and the snapshot reads the next pointer's
high word at that immediate. The shader disk cache stores the field and
refuses a plan whose high immediate is unaligned or equals the low one
(format 48).

Suggested by Tamalero's trace on boykopovar#9633 (issuecomment-6338256607), which
also proposed the readHighImmediate field.
@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 22, 2026
@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

@Tamalero this is the follow-up for the third read you traced on #9633. PointerChase now keeps the high word's own immediate (readHighImmediate, as you suggested), so the walk takes compute 0x116bb67100's step with the low word at 0x54 and the high word at 0x6c, and the snapshot reads the high word there. It's stacked on #9633 at 2c1a650. The disk cache format moves to 48, so older cache entries aren't reused. If you can run Rift Apart on this PR's head the same way as before, we'd like to know where it stops next.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 7689 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 10351 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 15548 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 15555 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmake L11, L13
core/shader/recompiler/Optimization/src/ResourceTracker.cpp L18, L898, L906, L985-986, L988-989, L998-1005, L1007, L1110-1112, L1115-1118, L1131, L1133-1135, L1143
core/shader/recompiler/ShaderDiskCache.cpp L116-118, L157-158
core/shader/recompiler/ShaderDiskCache.hpp L16
PR 16812 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmake L11, L13
core/shader/recompiler/Optimization/src/ResourceTracker.cpp L18, L898, L906, L985-986, L988-989, L998-1005, L1007, L1110-1112, L1115-1118, L1131, L1133-1135, L1143
core/shader/recompiler/ShaderDiskCache.cpp L116-118, L157-158
core/shader/recompiler/ShaderDiskCache.hpp L16
PR 16814 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmake L11, L13
core/shader/recompiler/Optimization/src/ResourceTracker.cpp L18, L898, L906, L985-986, L988-989, L998-1005, L1007, L1110-1112, L1115-1118, L1131, L1133-1135, L1143
core/shader/recompiler/ShaderDiskCache.cpp L116-118, L157-158
core/shader/recompiler/ShaderDiskCache.hpp L16
PR 17611 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 18106 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmake L11, L13
core/shader/recompiler/Optimization/src/ResourceTracker.cpp L18, L898, L906, L985-986, L988-989, L998-1005, L1007, L1110-1112, L1115-1118, L1131, L1133-1135, L1143
core/shader/recompiler/ShaderDiskCache.cpp L116-118, L157-158
core/shader/recompiler/ShaderDiskCache.hpp L16
PR 18107 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmake L11, L13
core/shader/recompiler/Optimization/src/ResourceTracker.cpp L18, L898, L906-907, L985-986, L988-989, L998-1005, L1007, L1110-1112, L1115-1118, L1131, L1133-1135, L1143
core/shader/recompiler/ShaderDiskCache.cpp L116-118, L157-158
core/shader/recompiler/ShaderDiskCache.hpp L16
PR 19564 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmake L11, L13
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp L379, L2412
PR 19852 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 21776 core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp L61
core/shader/recompiler/ShaderDiskCache.hpp L16
PR 21970 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 21971 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 22583 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 22602 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 22628 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 22692 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 23243 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 23244 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 23409 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 23778 core/shader/recompiler/Optimization/src/ResourceTracker.cpp L898-899
PR 24781 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 26012 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 26630 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 26691 core/shader/recompiler/ShaderDiskCache.hpp L16

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5371 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/shader.md
PR 5609 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 5925 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
docs/dev/debt/shader.md
PR 6280 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/debt/shader.md
PR 6412 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/debt/shader.md
PR 6481 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/debt/shader.md
PR 6924 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/debt/shader.md
PR 7085 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 7392 docs/dev/debt/shader.md
PR 7684 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/debt/shader.md
PR 9356 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9387 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/debt/shader.md
PR 9508 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9852 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9897 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 10193 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 10652 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
docs/dev/debt/shader.md
PR 11483 docs/dev/debt/shader.md
PR 11551 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 12324 core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp
PR 12944 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/debt/shader.md
PR 13928 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 13929 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 14032 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 14871 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/debt/shader.md
PR 14944 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 16260 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 16391 core/shader/recompiler/ShaderDiskCache.cpp
PR 16571 docs/dev/debt/shader.md
PR 17056 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 17623 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 18185 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 20248 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 22071 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
PR 23111 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 23242 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 25010 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found no logic defect in the new high-word-immediate handling: the tracker records it, the snapshot reads it, the cache serializes/validates it, and the added positive/refusal tests cover the separate offsets. The PR report provides substantial repeated Linux test and VVL evidence. Current-base git diff --check and conventions pass, and merge-tree with current main is clean. I did not run the GPU suite locally; the workspace has no configured build and under 700 MB free.

Please update the integration checklist before approval. The PR says it is stacked on #9633, which is still open, but currently lists only Depends on: #9457; record #9633 as the prerequisite (the earlier stack is transitively included by it). Also this head is based on 3ca07d0, 19 commits behind current main b7d1d47. Rebase/refresh it and rerun the focused shader tests. The VVL evidence I see for this increment compares #9633 to this PR; after the refresh, include the required same-GPU main versus final-head ctest -V comparison with the prescribed environment, confirm the layer loaded, and compare VUID- output.

@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

Thanks, @MarcZX10. main at b7d1d47 is now merged in (6db7b36), with the PR's own diff unchanged. On GitHub's runners (run), the ten pointer, image-table and shader disk cache tests pass 10 of 10 on Linux; on Windows they build and pass, with the Vulkan tests skipping. The same run compares main with this head under the validation layer: the layer loads in both, and both logs report only VUID-VkDeviceCreateInfo-pNext-pNext, so this head adds no VUID- message. It's in Tested. On the stack, the checklist's line reads "Depends on: #9633", and #9457 and #8939 come in through it.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final head 6db7b36aefce38828c2392ca2c147fd230529492 is based on current main b7d1d47a5f and merges cleanly with today’s 11f976b27c16ed91633f00039dba5dfd97dd7cc1; conventions and diff-check pass. The report now contains Linux llvmpipe positive/refusal cases, a red control against #9633, repeated CI runs, and a main-versus-change validation-layer comparison where the layer loaded in both and neither showed a new VUID. The integration checklist is still stale in the body I can see: it says Depends on: #9457, while the author comment says it was corrected to #9633. Please make sure the actual checklist text is updated to Depends on: #9633 (which carries #9457/#8939 transitively) before merge. I did not independently rerun the GPU suite locally.

@Tamalero

Copy link
Copy Markdown
Contributor

@EagleBearerYS ran it: with this PR, PPSA01474 (content 01.005.003) gets past the 0x13bc0 stop. It then stops on sampler resource limit exceeded, the stop the relaxed build hit on #9633.

Setup: Linux (CachyOS, kernel 7.2.9), GCC 16.2.1, Release, RTX 4090 (NVIDIA 615.78.08). The executable was relinked once with this head's relinker, and both runs use it. Cold shader cache, no input.

Build Result
Control: 6db7b36 with only 7ab0765 reverted (so the same base, without this PR's change) 294 s, compute 0x116bb66a00, LoadAddressU32@pc=0x13bc0, the same sites as on #9633 (third read ReadConstBuffer@pc=0x12e9c through the V# at pc=0x12de8)
This PR: 6db7b36 425 s, no refusal at 0x13bc0; new stop in compute 0x116bb61900: ShaderRecompiler::Recompile: sampler resource limit exceeded

Same shaders on both builds: I replayed the two requests captured for #9633 offline, 0x116bb67b00 (0x13bc0) and its sibling 0x116bb5e100 (0x128d4), with each build's agc_shader_replay:

  • control: both still refused at the T# load (pc=0x13bc0 and pc=0x128d4);
  • this PR: both pass it and stop on sampler resource limit exceeded.

The next stop is AddSampler returning the limit at ShaderInfo::MaxSamplers = 32. So these shaders now get through the resource walk, but plan more than 32 distinct sampler sources. That's a capacity limit, not another pointer shape. I can count how many distinct S# sources one of them needs, and how many sampled image/sampler pairs, if that helps decide between raising the limit and sharing identical S# sources.

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

@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

@Tamalero thanks for the control and the replays. With this PR, Ratchet & Clank: Rift Apart (PPSA01474) gets past the 0x13bc0 T# stop, and both captured shaders get through the resource walk, so the next stop is the capacity limit in AddSampler (ShaderInfo::MaxSamplers = 32), as you say. Your run is in Tested.

Yes, the counts would help. One lead on our side: #7527 re-plans selected image-table columns when a shader would pass its limits, but PlannedWithinLimits in ResourceTracker.cpp counts only images (64) and image/sampler pairs (64), not samplers (32). If the extra sampler sources are selected columns of one heap, that's the gap. For 0x116bb67b00 (or 0x116bb61900), these would tell:

  1. how many distinct sampler sources it plans, and how many of them are image-table columns rather than direct S# handles; for the columns, how many share one heap (the same table read at different CPU-evaluated keys);
  2. how many images and how many sampled image/sampler pairs the same shader has.

A branch with a possible fix on this PR's head is being built for a replay of the two captured requests; I'll link it here when it's up. If the counts show more than 32 genuinely distinct direct S# handles, that fix won't move it, and the question becomes the 32-bit sampler masks.

@EagleBearerYS
EagleBearerYS marked this pull request as ready for review October 22, 2026 18:24
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 19, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 20, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

Nothing in the production changes I inspected demonstrates a blocking defect; approval is not justified because one changed file was not read and I did not run checks.

What I ran

Reviewed head dd2c6b1aee4d4fe2dcb1572906fa9d64f1c11ce8 using the prepared patch and repo_read.py. No tests or builds were run.

Results

Check Result Note
Patch and targeted source review passed Core tracker and materializer paths inspected
Tests and build not run No local execution

Findings

Blocking

None identified in the source inspected.

Non-blocking

None.

Not verified

core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was excluded from the prepared full-text files as too large; I read only its changed region through repo_read.py. I did not read every changed file listed as reviewed in the manifest, so the test additions and remaining changed files are not fully verified. I did not run the author-reported tests or hardware checks.

Files read: review/description.md, review/commits.md, review/manifest.json, review/diff.patch, core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp (targeted range), core/shader/recompiler/Optimization/src/ResourceTracker.cpp, core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp, core/shader/recompiler/ShaderDiskCache.cpp (targeted range), and core/shader/recompiler/ShaderDiskCache.hpp.

Files excluded or not fully read: core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was excluded from files/ due to size; other changed files were not read in full.

To get this to a good state

Nothing is required. Optional: complete review of the changed files not read and run the focused tests on this head.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 20, 2026
oneandonlydean pushed a commit that referenced this pull request Nov 21, 2026
…at, 63

yabanana's #7223 now takes 51, the number this PR had, and 52-62 are held by the open PRs: #10000 52, #8939 53, #10489 54, #9457 55, #9633 56, #9749 57, #10193 58, #9790 59, #9969 60, #10846 61, #7642 62. So this PR takes 63 and a cache written by #7223's recompiler is not read as this one's.
oneandonlydean and others added 4 commits November 23, 2026 00:49
Moves this branch's FormatVersion from 95 to 98, above boykopovar#8939's 97.
Moves this branch's FormatVersion from 96 to 99, above boykopovar#9457's 98.
…ords-on-c2

Moves this branch's FormatVersion from 97 to 100, above boykopovar#9633's 99.
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 23, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the focused tests described by the author exercise split high-word pointer chases, snapshot closure, and cache round-tripping.

What I ran

Reviewed head 198784fc4eeefae6ae5290253c11818539d206f6 using the prepared diff and repository reader. No commands or tests were run in this review.

Results

Check Result Note
Diff and targeted code review passed Core tracking, materialization, cache, and test changes inspected
Tests in this review not run Test results in the description are author-reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

I read the added lines in all nine changed files listed in the review manifest and targeted surrounding code in the tracker, materializer, and cache decoder. I did not run tests, build the change, or verify the reported console behavior. The description reports focused Linux tests and Windows builds, with Vulkan tests skipped on Windows; these are author-reported results, not runs performed here.

To get this to a good state

Nothing is required.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 23, 2026
mrfelek added a commit to mrfelek/AnyPS5 that referenced this pull request Nov 24, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — comments

Nothing blocks this; the points below are optional.

What I ran

Reviewed head ce812ac2be4af274fa5f92b49a90266f7ea5fa8b. No commands or tests were run; the test results in the PR description are author reported.

Results

Check Result Note
Diff review passed Change and key chase paths inspected
Tests not run Author reported results were not independently verified

Negative control

Not run.

Findings

Blocking

None verified in the inspected code.

Non-blocking

  • The full text of all changed files was not reviewed, so this review does not establish that the complete change is ready for approval.

Sources

Not verified

The changed files listed in manifest.json are core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp, core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmake, core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp, core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp, core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp, core/shader/recompiler/Optimization/src/ResourceTracker.cpp, core/shader/recompiler/ShaderDiskCache.cpp, core/shader/recompiler/ShaderDiskCache.hpp, and docs/dev/debt/shader.md. I inspected the diff and targeted ranges in ResourceTracker.cpp, ResourceMaterializer.cpp, and ShaderDiskCache.cpp; I did not read the complete text of any changed file. No files were excluded by the prepared review manifest, and no test execution was performed.

To get this to a good state

Nothing is required. The optional point is to complete the review of the changed files and independently run the relevant tests before treating this as a formal merge decision.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants