fix(shader): follow pointer-keyed table chases up to 8 steps #16631
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16631"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-11-07T10:43:28Z.
What
This is stacked on #16472 (direct pointer chase steps). #28483 (#9457 merged with
main) is inmainsince 2026-12-03; #16472 carries #9633 and #9749.MaxPointerChaseDepthlimits a pointer-keyed image table's conditional chase to 4 steps. PPSA03671's compute shader0x11d049aa00walks linked records further: with #16472 and the other changes it needs, its chase atpc=0x2a9a8has 5 sites and depth 5, andPointerRecordPairsrefuses it at the depth check.The change:
MaxPointerChaseDepthgoes from 4 to 8.docs/dev/debt/shader.md: the chase entry says 8.Nothing else changes:
ChaseClosure) already follows at most the column'spointerChaseDepthsteps, and stops adding records at the column's key limit, so a deeper chase can't grow the snapshot without bound.FormatVersion100 come from #16472, which this PR sits on. The disk cache's check uses the same constant, so it now accepts depths up to 8. A plan with depth 5–8 was refused before, so no cached plan changes meaning, and there's no format bump.Tested
Linux 7.3, RTX 3080 Ti, NVIDIA 615.71.09, Release.
New test
agc_driver_pointer_chase_deep_table: a direct chase through the pointer at P+0x60, over 12 linked nodes that each hold their own image, so a dropped or repeated step reads the wrong texels. It runs 5 and 8 conditional steps; each step is taken when its bit is set in a per-group key word (all, every other, none, the other half), so the four groups take all, some or none of the steps. It checks:The five-step shader was assembled with
llvm-mc -mcpu=gfx1030; the 8- and 9-step shaders repeat its step block, and the test requires the generated five-step code to equal the written one. WithMaxPointerChaseDepthback at 4, the test fails withGetImageResource dword 0 is not a valid runtime value.Focused tests:
^(agc_driver_(image_table|nested|pointer)|agc_shader_(disk_cache|memory|nested_sampler)), withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V, on this branch at0a5699c99f, which holds #28483 andmain93d64f2d1e(59 tests; at4d8930ac4a, the reworked depth test, twice more on the RTX 3080 Ti, 59/59, and the depth test alone 3/3), and onmain93d64f2d1e(50 tests). Each ran on the RTX 3080 Ti (twice on this branch) and on a Radeon 780M (RADV, Mesa 26.0.8, Linux 7.0). All pass on both GPUs, the loader log shows the layer loaded, and no log has aVUID-line.Windows: the same tests on NVIDIA RTX A2000 Laptop GPU (610.60) and Intel UHD Graphics 0x9a60 (32.0.101.7092), Windows 11 26200, WinLibs GCC, run as a normal user so the loader takes the validation layer from
VK_ADD_LAYER_PATH, on this branch at0a5699c99f(61 tests on each GPU) and onmain93d64f2d1e(52). All pass on both GPUs with noVUID-line.agc_driver_image_table_vouched_lookupsskips on the Intel GPU onmainas on this branch.PPSA03671: on a local tree with this limit, #9969, #16472 and further local changes,
0x11d049aa00is planned completely. That tree is not a review base.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-07T23:10:45Z.
Review: COMMENTED
Read
045d7f8750againstmain.Scope. Only
3ded78990dis new on top of #16472's head14a45d1ce1.The limit. Only
PointerRecordPairsand the plan decoder readMaxPointerChaseDepth. The depth checked against it is still the longest chain of sites, so a shader that was already planned gets the same plan, andChaseClosurestays bounded by the column's key limit. Skipping the format bump is fine: no plan deeper than 4 could be written before, and an older build reading one refuses it and recompiles.Test gap. The disk-cache tests only use depth 1, and nothing checks the decoder at the new edge. A round trip at
MaxPointerChaseDepthand arejectsatMaxPointerChaseDepth + 1uwould cover it without pinning a shader shape to a throw.CI.
agc_driver_pointer_chase_deep_tablewas skipped (no Vulkan device on the Windows runner, and the Linux job doesn't run on pull requests).Not run here; this is from reading the code.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T14:57:50Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected code supports increasing the pointer-chase depth limit to 8, and the implementation caps snapshot growth at the existing record limit.
What I ran
Head:
c3c44f66b55039eafabbe0d4cd67f0451b7001bf. I read the prepared diff and targeted code throughrepo_read.py; I ran no tests or build commands. The author reports focused tests passed on other revisions and hardware; those results were not reproduced on this head.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run tests, build the project, or verify behavior on a physical console. I read the changed regions in all 14 changed files;
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas excluded from the review folder for size and was read through the pinned reader. Other excluded files: none.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T06:21:05Z.
Review: COMMENTED
Reviewed — comments
This review covers head
f394b4381714f82f43b6b13a26f461c865279360; the prepared diff contains substantial pointer-keyed resource tracking and snapshot changes in addition to the advertised depth increase, and one changed test file was unavailable in the review folder.What I ran
No build or tests were run. I read the prepared change bundle and inspected selected implementation code at the pinned head using
repo_read.py.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
Not verified
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas excluded because it was too large for the review folder; its changed lines were not read.core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp; I inspected selected changed sections only.To get this to a good state
Nothing is required. Optional: revise the PR description to describe the full scope of the prepared diff.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T09:55:52Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the code inspected supports increasing the chase-depth limit, but the review is incomplete because some changed files were not read.
What I ran
592656521619c8a93552f44019a0cbe9f0d0e08f; no tests or build commands were run.review/description.md,review/commits.md,review/manifest.json, andreview/diff.patch, plus targeted ranges fromControlFlowInfo.hpp,ResourceTracker.cpp, andResourceMaterializer.cpp.Results
Negative control
Not run; no test or build was run in this review.
Findings
Blocking
None verified in the code inspected.
Non-blocking
None.
Not verified
The changed files
ShaderDiskCache.cpp,agc_driver_image_table_tests.cmake,ImageTable.cpp,ResourceTracker.cppbeyond the targeted range,ResourceMaterializer.cppbeyond the targeted range,ShaderDiskCache.cppin the recompiler,ShaderDiskCache.hpp, anddocs/dev/debt/shader.mdwere not read in full. All entries shown in the manifest are marked included; nofiles.jsonwas available through the reader. The description’s reported test runs were not independently verified.To get this to a good state
Nothing is required. Optional: complete inspection of the remaining changed code and run the focused tests before treating this as a complete review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T11:08:03Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected code supports raising the pointer chase limit to eight steps.
What I ran
Reviewed head
793e9ac0dad79297ed3c3414ec7844f62e2b810ausingrepo_read.pyfor the prepared diff and targeted source ranges. No tests were run; the test runs described in the PR body were author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The PR's reported GPU execution and focused test runs were not independently verified on this head. Reviewed changed files:
ShaderDiskCache.cpp,agc_driver_image_table_tests.cmake,ImageTable.cpp,ControlFlowInfo.hpp,ResourceMaterializer.cpp,ResourceTracker.cpp,ShaderDiskCache.cpp,ShaderDiskCache.hpp, anddocs/dev/debt/shader.md. No changed files were excluded from review; all changed files were included in the review bundle.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T12:38:56Z.
Review: COMMENTED
Reviewed — no blocking findings
No verified blocking defect was found in the inspected change; the review covers the depth limit, snapshot traversal, cache validation and deep-chase test, but not every changed file.
What I ran
33ba0143857566319ec5ea7374c14caecfe46e37, based onmain.repo_read.py.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp,core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmake,core/shader/recompiler/Optimization/src/ResourceTracker.cpp, anddocs/dev/debt/shader.mdwere not read in full. Other portions of the included changed files were also not read; the manifest lists all nine changed files as included.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T12:33:43Z.
Review: COMMENTED
Reviewed — comments
This review is incomplete because the prepared review files and pinned repository source were not available through the tools in this session.
What I ran
No review commands were run;
repo_read.pycould not be invoked.Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The PR description, commits, diff, manifest, changed files, tests, and repository context were not read. No files can be reported as read against the reviewed file list.
To get this to a good state
Provide access to the prepared review folder and reader so the PR can be reviewed.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T13:01:00Z.
Review: COMMENTED
Actionable comments posted: 8
d70322f3-7b4c-417b-89e4-25c1d07fe077Reviewing files that changed from the base of the PR and between
c8d13657c7and6f63a2e5c4.core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppdocs/dev/debt/shader.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T13:01:18Z.
Review: COMMENTED
Reviewed — no blocking findings
The reviewed diff raises the pointer chase limit to eight and adds pointer chase handling, cache encoding, documentation, and focused tests; this review is incomplete, so a formal approval is not justified.
What I ran
Reviewed head
6f63a2e5c4218941b925629343734c067621b0a1. No test commands were run. Read the prepared description, commits, manifest, and diff, plus targeted source ranges at the pinned head.Results
Findings
Blocking
None identified in the inspected ranges.
Non-blocking
None.
Not verified
The review is incomplete: the full text of the changed files was not read, and the files excluded by rule could not be checked because
files.jsonwas not available through the review reader. No tests were run. The reported Linux and GPU test results are author supplied, not independently verified.Changed files listed as included in the manifest:
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, anddocs/dev/debt/shader.md. Targeted ranges were read fromControlFlowInfo.hpp,ResourceMaterializer.cpp,ResourceTracker.cpp, andShaderDiskCache.cpp; all changed files were inspected in the prepared diff, not in full source form.To get this to a good state
Nothing is required. Optional: complete the full changed-file review and run the focused tests on this head before requesting a formal approval.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T21:52:50Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
48d397867ffa05769645c7a52183475cb9c0cb14. No commands or tests were run; test results in the description are author-reported. I readreview/description.md,review/commits.md,review/manifest.json,review/diff.patch, and the included changed filescore/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, anddocs/dev/debt/shader.md. The manifest marks all changed files included;review/files.jsonwas unavailable, so exclusions are not verified.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build and GPU tests were not run in this review. The Linux and GPU test results and the PPSA03671 planning result are author-reported. Excluded-file status was not verified because
review/files.jsonwas unavailable.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-28T11:32:06Z.
Review: COMMENTED
Actionable comments posted: 1
61a192ed-a75f-4b60-8cf2-0d4a2527005bReviewing files that changed from the base of the PR and between
48d397867fandc80c49a2e3.core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.hppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T11:33:58Z.
Review: COMMENTED
Reviewed — comments
The prepared bundle describes a broader pointer chase implementation; this review is incomplete because several changed files were not read in full.
What I ran
Inspected the prepared diff and targeted source ranges for head
c80c49a2e31be76067d52d9f7814c987a0faefd2; no tests or build commands were run.Results
Findings
Blocking
None verified in the inspected ranges.
Non-blocking
None.
Not verified
The manifest lists nine changed files as included. Read the full
ControlFlowInfo.hpp,ShaderDiskCache.hpp, andagc_driver_image_table_tests.cmake; inspected selected ranges ofResourceTracker.cpp,ResourceMaterializer.cpp, andShaderDiskCache.cpp, plus selected diff hunks and the PR description and commit list. Did not read the full text ofShaderDiskCache.cpptests orImageTable.cpp, nor the full text of the three partially inspected implementation files. No files were listed as excluded in the manifest;files.jsonwas unavailable through the reader.To get this to a good state
Nothing is required. Optional: complete review of the unread and partially read changed file contents before making a formal decision.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T23:57:37Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected changes show no verified blocking defect; I could not run the reported GPU tests during this review.
What I ran
Head:
40c3c50851f11d174a1e96da8a99a352dc3eed42.The reader search could not complete because it could not write its review log. I inspected the prepared diff and included head files; no tests or builds were run.
Results
Negative control
Not run in this review. The author reports the new deep chase test fails when the limit is 4.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
reviewedinfiles.jsonwere inspected.files.jsonlists no excluded files.To get this to a good state
Nothing is required. Optional: rerun the reported focused tests on the reviewed head if independent runtime confirmation is desired.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-01T00:03:03Z.
Review: COMMENTED
Actionable comments posted: 2
Architecture findings (1)
Advisory architecture findings (1)
53f1d785-cb67-409a-b072-68d3dfbc5fdfReviewing files that changed from the base of the PR and between
c80c49a2e3and40c3c50851.core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-01T00:47:38Z.
Review: COMMENTED
Reviewed — no blocking findings
No blocking defect was verified in the reviewed changes; I did not independently run the reported GPU tests.
What I ran
Reviewed head
0a5699c99f3c8209a59658c6a25e25cae1863b99using the prepared diff and targeted source ranges fromrepo_read.py. No test, build, or compiler was run.Results
Findings
Blocking
None verified.
Non-blocking
None.
Sources
The tracker records chase sites and enforces the maximum depth in
ResourceTracker.cpp. The materializer follows the recorded sites while respecting the key limit inResourceMaterializer.cpp. The depth constant and plan metadata are inControlFlowInfo.hpp.Not verified
GPU behavior and the author-reported test results were not independently confirmed. Targeted source ranges were read; unchanged callers were not exhaustively audited. All nine files listed under
files.jsonas reviewed were included in the diff;files.jsonlists no excluded files.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-01T00:52:23Z.
Review: COMMENTED
Architecture findings (1)
Advisory architecture findings (1)
8560b268-f0a6-4be1-896b-b539e8c2b63dReviewing files that changed from the base of the PR and between
40c3c50851and0a5699c99f.core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T17:30:38Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected changes show no verified blocking defect; the author should update the description to match the cache serialization changes, and this review remains incomplete because the pinned reader could not read repository context.
What I ran
Head:
c1caca030549135dd21b713a085f34baeaa689d5. I inspected the prepared diff, manifest, and changed-file snapshots.repo_read.py search MaxPointerChaseDepthreturned matching lines, but the reader then failed while logging because the run folder is read-only. I did not run tests or builds. Test results in the PR description are author-reported.Results
Negative control
Not run; no tests were run in this review.
Findings
Blocking
None verified in the inspected changes.
Non-blocking
core/shader/recompiler/ShaderDiskCache.cpp:1241andcore/shader/recompiler/ShaderDiskCache.hpp:20.Sources
Not verified
The pinned repository source could not be read with
repo_read.py; the inspection relied on prepared snapshots for the nine changed files listed in the manifest. No files were excluded by the manifest. I did not examine every changed line in the largeImageTable.cpptest addition, and I did not independently verify the author-reported test runs or console behavior.To get this to a good state
Nothing is required. Optional: correct the description’s plan-encoding summary.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T17:31:09Z.
Review: COMMENTED
The new depth-five fixture gives every even node the same texture and every odd node the other texture. A traversal that drops two ordinary hops can still produce the expected pixels. Can the fixture give each reachable node a distinct value so the readback verifies the precise destination? The new limit is eight, so an accepted depth-eight case and a rejected depth-nine case would also test the boundary set by the change.
This finding is from source inspection at
c1caca0305. I have yet to run a paired Vulkan comparison for this head.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T17:55:12Z.
Review: COMMENTED
Reviewed — no blocking findings
The prepared diff contains substantial pointer-chase implementation and cache-format changes beyond the description’s stated depth-limit change; the head reader could not run because its logging write was blocked, so the review is incomplete.
What I ran
Head:
4d8930ac4a06e8996a2a88122ab3e8f1e4ee645a. I read the prepared description, commits, manifest, diff, and changed-file excerpts. I attemptedpython3 repo_read.py search MaxPointerChaseDepthandpython3 repo_read.py search PointerChaseDepth; both failed because the reader could not write its log. No tests were run. No build or merged-preview check was run.Results
Findings
Blocking
None verified.
Non-blocking
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp:38andcore/shader/recompiler/ShaderDiskCache.hpp:20.Not verified
The full head source context and runtime behavior were not verified because
repo_read.pycould not log its reads. No tests were run. The prepared files contain all nine paths listed underreviewedinfiles.json; I inspected the diff and relevant excerpts, not every full file. No files were excluded by rule.To get this to a good state
Nothing is required. Optional: align the description with the diff. A complete review needs the head source reader to work, followed by targeted source inspection.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T19:12:37Z.
Review: COMMENTED
On Linux/lavapipe, the scalar-buffer, pointer-hop-table and shader-disk-cache controls passed on main
9fcd37e4eaand withc1caca0305applied. Both direct and deep pointer-chase fixtures also passed on that branch. All three logs show Khronos validation active with zero VUIDs and no missing-layer messages.The current head
4d8930ac4achanges the fixture only. Distinct images per node make a dropped or repeated chase step observable, and the added eight- and nine-step cases exercise the old boundary and a chase beyond it. I also ran this exact head on Linux lavapipe. The scalar, pointer-hop and shader-disk-cache controls passed on both maina9cbd48cb0and the change. The updated direct and deep pointer-chase cases passed as well. All three logs show 1.4.369 validation inserted, with zero missing-layer warnings and zero VUIDs.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.