feat(shader): resolve nested image tables through runtime pointers #7223
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7223"
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 yabanana on 2026-10-17T17:56:26Z.
What
Related to #6191. Resolve image descriptors through a scalar-buffer record, a runtime pointer, a V#, then a second independent key. The fixtures model the first GetImageResource dword-0 shape reported for Ratchet & Clank; full-title behavior on this head is unverified. Sampler and direct pointer-Phi extensions remain separate in #7395.
The materializer captures exact 64-bit record pointers and shares equal child tables. SPIR-V searches a sorted pointer dictionary, then uses the existing inner-table lookup. The actual pointer selected by a low-word Phi, including loop back edges and constant arms, stays dynamic. Unknown pointers fault; parent scans, child snapshots and final map size remain bounded.
The 20 October update includes Yunus Shaikh's offered shared-child-consumer fix, preserving authorship. A child T# word used by another instruction could leave a runtime read through a V# that exists only in the snapshot, causing a driver crash. Such children are now refused, with a regression test.
Main is merged without rewriting the published commits, preserving #7395's ancestry. Integration retains main's selected columns, #6232 pointer hops, per-column SharedValues storage and scratch maps. Nested child-header and leaf-record indices use separate scratch maps. Snapshot hashes and resolution memo identity include child tables and pointers. New tests verify unchanged snapshot sharing and compare child-only and pointer-only mutations with uncached resolution. Disk-plan format is 51 over the tested main's 50; image-table ABI remains 3. This preserves the maintainer's integration and avoids reusing main's disk-cache version.
Parent scans allow at most 524288 records and inner snapshots at most 1048576 key slots per shader; the final map is capped at 32 MiB. The synthetic fixture covers 348156 outer records and 131072 inner positions from the public report without embedding title code or captures. Nested samplers, other pointer origins, shared descriptor-word consumers and deeper nesting remain refused.
Ordering: this PR supplies the base for #7395, which owns the S# and direct pointer-Phi extensions. Earlier overlaps already merged into main are integrated here. The #7395/#7684/#6488 ordering discussion remains relevant to later integration; no combined result with unmerged branches is claimed. No ARM64-port branch was changed.
The 24 October integration includes Yunus Shaikh's offered merge and cache fix with authorship. Both helper sets are retained. In TryMakeIndirectColumn, only the merged buffer low word uses PointerRecordOrigin; other reads use UnwrapTableRead with its null check. Main's AvailableAt dominance check remains. The 27 October merge retains main's runtime ABI 14 and advances this PR's disk format to 49, keeping image-table ABI 3.
Tested
30 October integration: head
7f36e41c458c2abbf06c5a638636869ed9a4cc59, tested basee471817c68d4e1b1e44b0ce369ed88bafe4ae8ed. Main now uses disk format 50, so this head uses 51; image-table ABI 3/runtime ABI 14 remain. Published ancestry is preserved. The two offered test-only commits from EagleBearerYS were cherry-picked with authorship: valid shared-V#/additional-T# consumer shapes are no longer pinned to rejection; production refusals were not weakened.Both key budgets reset at the beginning of every TableSnapshotter attempt. A single nested image column now participates in the descriptor-epoch check. New
agc_shader_nested_snapshot_retryuses 262145 parent keys and 524289 child keys, forces one invalidation, verifies per-attempt coverage through each last key and compares the final parent/child snapshots (keys, pointers, words and codes) against an undisturbed capture. It accounts for the enclosing materializer's revalidation, which could otherwise hide a truncated discarded attempt. Three separate negative controls fail: removing only the parent reset, only the child reset, or only nested epoch eligibility. Restoring all changes passes (final 2.33 s; timeout 20 s).Fresh paired llvmpipe checks:11 common passes on each revision, same two 32-lane skips;3/3 nested GPU cases pass. Flip, teardown and exact RGBA checks pass. Max common15.50 s main/14.49 s candidate; nested12.72 s. Required validation-layer insertion confirmed, shader/Mesa caches disabled; normalized messages match, no new VUIDs, existing pNext-layer VUID retained. Original disk-cache full/codec executables pass both revisions: 4/4, actual formats50/51, SHA256-verified binaries and multiprocess checks. Final test-timeout registration leaves the tested executable hashes unchanged. Full public-header compilation passes: 374 libraries / 14,864 exports; conventions and whitespace pass.
Environment: GCC 13.3 cross compiler on ARM64, Ubuntu24.04; software GPU Mesa25.2.8 llvmpipe/LLVM20.1.2 under QEMU-user10.2.3. Full-kernel cache tests use Alpine 6.12.110/QEMU system 8.2.2 TCG cpu=max,smap=off,2 vCPUs, 1536 MiB. Earlier SMAP-on issue remains unqualified. No new native Windows/title/physical-GPU execution by the author.
Contributor physical-GPU evidence belongs to preceding head
0dbf5478b2, not this fix: XairRrR reports10/10 focused passes on RTX4070TiSUPER/615.78.08, matched main7/7, zeroVUIDs and three failing production-removal controls. TechLevelZero reports RTX2000Ada/595.99.02:2343 passes,5 existing/unstable-main failures,41skips and no new validation IDs; the three nested cases were validated but not compared to main's validation pass. These reports do not validate the new retry regression or claim a title unblock.29 October current integration: head
0dbf5478b2aaaac7f2a5f7a12e3724d9a2346461, mainf7e84c4cf1609cc10bac95a44cd431805e5ebc8a. Disk format 50 versus main 49; image-table ABI 3 and runtime ABI 14 retained. Normal merge preserves contributor ancestry. #12051 is closed without merge, so no memo gate or speculative dependency was added.Matched fresh llvmpipe runs: 11 common passes each, the same two 32-lane color-readback skips, plus 3/3 nested passes on the candidate. Flip/flip-compute, teardown and exact RGBA readback pass. Maximum common runtime: main 13.31 s, candidate 13.21 s; nested maximum 11.54 s. No performance claim. Vulkan is required, shader/Mesa caches disabled, Khronos layer insertion verified; normalized validation messages match, with no new VUIDs. The pre-existing pNext VUID from layer 1.3.275 remains.
Original freshly built disk-cache executables pass full and resource-plan-codec modes on both revisions (4/4) in a full Linux kernel, exercising actual format-49/50 serialization/rejection and multiprocess paths. SHA256-verified originals, no substitute cache executable. Kernel VM: Alpine 6.12.110, QEMU system 8.2.2 TCG, cpu=max,smap=off, two vCPUs, 1536 MiB; GPU runs: Mesa 25.2.8 llvmpipe LLVM20.1.2 under QEMU user10.2.3, Ubuntu24.04, GCC 13.3 cross compiler. Complete public-header audit/compilation (373 libraries / 13,451 exports), conventions and whitespace pass. No new physical-GPU/title/native-Windows claim. Earlier evidence below remains tied to its original revisions.
27 October head
153400ba2b1193870e4dc7046fa18638214c2ae9, integrated main0d62324ce25ebe4087984b9da143779ce99e7a88. On that earlier base main used disk format 48 and the candidate used 49. Published ancestry/contributor authorship retained. Image-table ABI stays 3; runtime ABI follows main at 14.Matched software-GPU runs pass 11 common CTests per revision, including bindless Phi, shader memory, serializer, table cache/reuse, bindless images, flip/flip-compute, address-space teardown, D32 and exact uint8x4 RGBA readback. Both skip the same two optimized color32/color64 cases: 32 subgroup lanes required, llvmpipe has 8. Candidate also passes 3/3 nested cases. Slowest common case: main 14.87 s, candidate 14.03 s; nested max 13.42 s. No test or rejection guard was weakened.
The original, newly built shader disk-cache executable and its resource-plan codec mode each pass on both revisions in the full Linux-kernel VM (four successful executions). These tests exercise the actual format-48/49 encoder/decoder, previous-format rejection and multiprocess paths, with unmodified test code. SHA256-verified binaries are used. An inherited user-mode adapter redirected the initial disk-cache run to an old executable; that result is excluded. The redirect is removed from the new lab builds, and the qualified GPU comparison was rerun separately. No stale replacement executable is counted as current-head evidence.
Ubuntu 24.04 x86-64 build, GCC 13.3 cross compiler hosted on ARM64. GPU path: QEMU user 10.2.3, Mesa 25.2.8 llvmpipe / LLVM 20.1.2 (256-bit), SPIRV-Tools at main's pinned revision. Vulkan is required; shader/Mesa caches disabled; ctest -V requests Khronos validation, and loader logs confirm insertion. Normalized messages match main, including its existing VUID-VkDeviceCreateInfo-pNext-pNext for type 1000574000 with layer 1.3.275. No new VUIDs; not zero validation errors. CPU cache tests use Alpine 6.12.110-0-virt / QEMU system 8.2.2 TCG cpu=max, two vCPUs, 1536 MiB. Write watching uses the existing byte-comparison fallback.
All-library public-header audit/compilation passes (368 libraries, 12,811 exports); current-main conventions/whitespace pass. Final-commit GPU binaries match the tested hashes. Full upstream Linux/Windows CI still needs a maintainer dispatch.
Historical Tamalero physical/title results at 74700a08d stay attributed to that earlier head and its reported sampler refusal, not a frame or title run of this head. No new physical-GPU/title or speed claim. Sampler/direct-pointer-Phi extensions remain separate in #7395.
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)74700a08d: contributor-reported NVIDIA RTX 4090 and AMD Radeon Pro V620/RADV on Linux (driver versions not supplied); earlierf4549448f: contributor-reported NVIDIA RTX 3070 / 617.42 and Intel UHD 630 / igvk64 on Windows 11; NVIDIA RTX 4090 on Linux (driver not specified).Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-17T19:49:48Z.
First physical-GPU runs (existing coverage is QEMU/lavapipe-class only): head
f4549448f, Windows 11, MinGW (WinLibs GCC 15.2.0), Release, serial fresh processes:agc_driver_nested_image_table,_large,_budget,agc_driver_image_table,_cache,_cache_bounds,_reuse,agc_driver_bindless_images,agc_shader_bindless,agc_shader_memory,agc_shader_disk_cache— 11/11 pass.ANYPS5_GPU=UHD, igvk64): same 11/11 pass.Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-18T00:12:53Z.
Linux confirmation on Ratchet & Clank: Rift Apart (PPSA01474), RTX 4090,
main5361e69de, the PR's two commits cherry-picked (one test-only conflict intests/execution/ImageTable.cpp, resolved by keeping both role checks), one run each:GetImageResource dword 0 is not a valid runtime valueatpc=0x6b80(the #6191 chain), compute0x116bb66d00GetSamplerResource dword 0 is not a valid runtime valueatpc=0x6b74, compute0x116bb63500, through the samePhi(Phi(ReadConstBuffer@pc=0x1aa8 …))recordSo the T# half of the chain resolves, as @ps54all saw on Windows, and the next stop is the sampler of the same record.
Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-18T00:19:47Z.
@yabanana the next stop after this PR is the sampler of the same record, in both titles that have this shape so far: Ratchet & Clank (
GetSamplerResource dword 0atpc=0x6b74, above and in #6191) and Marvel's Wolverine (images and samplers through the same chain, #6191). Is a nested sampler table in scope for this PR or a follow-up? I can run either on Ratchet the same day, and send the S# words and keys of a failing record if that helps with a fixture.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T00:25:04Z.
I checked head
f4549448f: the PR explicitly leaves nested samplers unsupported, while the new table lookup path already has a sampler-table branch. That makes nested S# handling a plausible follow-up, but it shares the planner/materializer and cache snapshot machinery, so I am holding off on a parallel patch until the merge ordering is clear. For a focused regression fixture, could you share a sanitized S# descriptor and the two key sequences (or expected sampled result) from the failing shape? That would let us test a synthetic chain without title shader data.Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-18T01:52:44Z.
@MarcZX100 here is the shape, from a local diagnostic that evaluates the refused chain against guest memory at registration (Ratchet & Clank: Rift Apart,
main5361e69de+ this PR). Addresses are masked (A,B,P0), offsets and alignment are real.Common part (all three loads below use it):
pc=0x1a9c, offsets0x270..0x27c:A_lo 00100011 00054ffc 00005204(stride 16,0x54ffcrecords).key1atpc=0x1aa8: a 64-bit pointer atkey1 * 16 + 0x8/+ 0xc. Record 0 holdsP0, record 1 holdsP0 + 0x120, so the pointers select consecutive 0x120-byte blocks.key1is not a plain value: it isReadFirstLane(SelectU32(LogicalAnd(...), IAdd32(Phi, Phi), Phi(...))), a loop over the lanes' keys, so the real key sequence is per lane at run time. I can only show what records 0 and 1 hold, not which records a dispatch selects.The three loads from the selected block:
0x6b80key20x6b74+0xb0GetSamplerResource dword 0)0x7cbc+0x0; the pointer goes through four nestedPhis (loop iterations)Words at those offsets, records 0 and 1:
+0xb0: record 100000003 00700080 00000000 00000000(a plausible sampler: LOD 0x080–0x700); record 0B_lo 00200011 00002000 00005204, which looks like a buffer descriptor rather than an S#, so not every record holds a sampler there.+0x0: record 0C_lo cb300000 003fc03f b00503ac 0000017f 00700050 00000000 00000000(plausible 2D T#); record 1 does not look like an image descriptor.So a synthetic fixture would be: a record table (16-byte records, pointer at
+0x8), blocks of 0x120 bytes, an S# at block+0xb0selected by the lane-loop key alone, and, for the0x7cbccase, a T# at block+0x0with the block pointer merged through a few loopPhis. To see past the S# stop I replaced unresolvable S#s with an all-zero sampler locally (not for upstream); that is how the0x7cbcstop showed up.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T01:54:18Z.
Thanks, this is enough to define a useful synthetic regression without retaining title data. It should keep the per-lane
key1loop dynamic, select blocks through the 16-byte record pointer at+8, and cover the heterogeneous records: one selected block with the valid S# at+0xb0, another with a non-sampler value there, plus the T# at+0whose pointer passes through the nested loopPhis. The local all-zero sampler substitution is a diagnostic only; the upstream test should exercise the real sampler descriptor and keep the unsupported path explicit if it is not implemented. This confirms the follow-up needs sampler resolution and a second pointer-chain case; I’ll avoid a parallel patch until the scope/order with #7223 is settled.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-18T02:23:34Z.
@yabanana, thanks for #7223. Two things came up while building on it.
A crash on this head. When another instruction also reads a nested child's T# words, lavapipe crashes inside the shader. The child's V# words are planning-only loads that are never emitted, so the other consumer keeps a runtime read through a V# that exists only in the snapshot. Commit 0df7d3256e refuses such a child, the same way #7223 already refuses a V# with another consumer, and adds the case to
agc_driver_nested_image_table. That case is a SIGSEGV onf4549448f7and passes with the commit. It's a single commit on top of your head, and you're welcome to take it as is. It's the first commit on branchfeat/shader-nested-sampler-tables.The S# half. The same branch has the sampler half that this PR leaves for later. It's stacked on your head and doesn't change your commits:
The new tests are
agc_driver_nested_sampler_table,agc_driver_pointer_phi_sampler_tableand two disk-cache round trips. On your head they fail withGetSamplerResource dword 0 is not a valid runtime value, and the consumer case is a SIGSEGV. On the branch they pass on GitHub's Linux runner; on Windows the GPU tests skip and the disk-cache tests pass (run).We plan to open the S# half shortly as a separate PR stacked on #7223 ("Depends on: #7223"), unless you'd rather fold it into this one. If you would, say so and the commits are yours to take.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-18T10:38:00Z.
Stack note: this PR is the base of #7395 — its head
f4549448fis the merge-base, so #7395's series builds directly on these two commits. I rebased the full stack onto currentmainasblawesom:rebase/7395(verified: builds, conventions pass, full suite green apart from the knownmainregressionagc_driver_tessellation— Mesa, #5444), which covers this PR's rebase as well. If the two land separately, #7395 should rebase onto this one rather than ontomaindirectly; if they land together, the singlerebase/7395branch serves both.Imported from boykopovar/AnyPS5. Originally posted by yabanana on 2026-10-20T13:17:14Z.
The shared-child-word crash fix from @EagleBearerYS (
0df7d3256e) is now included with its original authorship. @blawesom, this update keeps the two published #7223 commits and merges main, so #7395 can merge this branch without losing its existing ancestry. @Tamalero @MarcZX10: the sampler and direct pointer-Phi extensions remain in #7395; I have not folded them into this PR.The main integration keeps selected columns, #6232 pointer hops, SharedValues snapshot storage, and separate scratch maps for child-header and leaf-record indices. The new resolution memo also keys on nested children and pointer values. A regression compares child-only and pointer-only changes against uncached resolution; an unchanged snapshot still shares its resolution. Plan format is now 42 over main's 41; image-table ABI stays 3.
Published head
74700a08d11f6846d0e6474223cd1ef0dcbf4e67on main44e3389c8: 13/13 focused CTests pass, plus 3/3 cold-cache nested tests. The new child-cache negative control fails as intended when that comparison is removed; the restored code passes. Two broader tests remain limited in this QEMU/lavapipe lab on both untouched main and this head: image-table graphics ends invkWaitForFences graphics: Vulkan result 2, and image-table cache-bounds exceeds both 30 s CTest and 120 s direct diagnostic bounds. No repository timeout or acceptance check was relaxed. Previous NVIDIA/Intel and Ratchet reports remain valuable evidence forf4549448f, not a retest of this new head. Full upstream Linux/Windows builds still need maintainer dispatch.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T14:58:22Z.
Thanks. We've reviewed
74700a08d1and it looks good to us, including the shared-consumer fix. Local runs on an RTX 4090 pass, and the tests fail as expected when the new refusal or the nested fallback is turned off. The PR is still marked as a draft. Is anything left that you want to add? If not, could you mark it ready for review? Then we'll run full CI, and because it changes the shader ABI and the disk-plan format, also a GPU test run against main.Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-20T19:51:41Z.
Retail check of
74700a08don Ratchet & Clank: Rift Apart (PPSA01474), ahead of the GPU run. No local patches, cold shader cache, one unattended run per build.main44e3389c8(this PR's base)GetImageResource, T# read atpc=0x6b80through the V# loaded atpc=0x6b6c(the #6191 chain); 3 image refusals74700a08dGetSamplerResourceatLoadAddressU32@pc=0x6b74; 0 image refusals, 3 sampler refusals74700a08dGetSamplerResourceatpc=0x6b74; 0 image refusals. Onmain659230f7bthe same shader stopped at the T# read atpc=0x6b80So the merged head still resolves Ratchet's record → pointer → V# → T# chain on both vendors. The next stop is the sampler read in the same shaders, which is what #7395 adds on top. No crash or new error before that point.
Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by yabanana on 2026-10-21T09:04:28Z.
@oneandonlydean Nothing else to add to this PR. The sampler and direct pointer-Phi work stays in #7395.
I merged main
27c88a8d7to clear the new conflict, preserving published ancestry. The only textual conflict was the disk-plan version: now 44 over main's 43; image-table ABI stays 3. Head87168157a2e4c893468e535bbe99a9003c6fcd97passes 10/10 common tests on both main and candidate, plus 3/3 cold-cache nested tests. Loaded Khronos validation reports only the identical baseline VUID documented in the description.@Tamalero I added your unpatched NVIDIA/AMD Ratchet results for
74700a08dto the description, separately from the new integration head.Marked ready for review. Please proceed with the full CI and main/GPU comparison you proposed.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T09:17:25Z.
@yabanana thanks for un-drafting it and for the merge with
main. We'll check the merge, then run full CI and the GPU comparison on87168157a2. One heads-up on the version: another open PR also movesFormatVersionto 44, so whichever of the two lands second will need 45; we'll check that at merge time.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T10:01:17Z.
@yabanana a heads-up on the version line: the other PR I mentioned has just merged with
FormatVersion44, somainis now at 44. Could you move this branch to 45? The rest of the review and CI stand.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T21:24:14Z.
@yabanana, since #8991 merged, this PR conflicts with
maininResourceTracker.cpp. #8991 addsFirstLaneOffset,ParseFirstLaneOffsetandSameFirstLaneOffsetjust beforeTryMakeTableColumn, whose signature this PR changes.A merge of
main0c6a5bd593into this branch is ready if it helps:EagleBearerYS/AnyPS5pm/7223-merge-main, one merge commit, 8ed8acc4ba, on your87168157a2.main's three helpers beforeTryMakeTableColumnwith this PR's signature, thebufferparameter included.main's first-lane base check in the column loop merged on its own.agc_shader_bindless, which runs #8991's new case, pass 3 times each. On Windows it builds and passes, with the Vulkan cases skipping.You can fast-forward to it, or merge
mainyourself. It's the same resolution #7395 carries (bd4d8018d2).Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T05:45:20Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The cache format version is now stale against current
main. The PR setsFormatVersionto 49, but currentmain52c09d567d2fa453494dd720fcf53a98149468e4also sets it to 49. This PR changes the serialized shader disk-cache plan, so using the same format number risks accepting entries written with a different layout. The PR description still says it is format 49 over main's 48, which was true for its earlier base but is no longer true.The #12051 overlap is resolved by its closure; this request concerns the cache format and current-main integration only.
What I ran
153400ba2b1193870e4dc7046fa18638214c2ae9against currentmain52c09d567d2fa453494dd720fcf53a98149468e4.git merge-tree --write-tree,git diff --check, andpython3 tools/check_conventions.py --base refs/review/main-20261029c --head refs/review/pr-7223-latest.FormatVersioninShaderDiskCache.hppon both exact refs and checked current CI status.Results
git diff --checkmainand this PR use 49; this PR changes the encoded planPlease refresh the branch on current
main, take the next available disk-cache format version for the changed encoding, update the description, and rerun the focused shader/image-table and cache tests on that exact integrated head. The reported hosted checks do not run the skipped product tests.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T10:52:48Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The nested T# path builds, its tests pass on a physical NVIDIA GPU with Khronos validation and fail without the production change, but the new per-shader key budgets are not reset when the table snapshot is retried, so a retried snapshot is truncated.
What I ran
0dbf5478b2aaaac7f2a5f7a12e3724d9a2346461,main1db077e876a839f75d11a56e728e7f56a4a8c25e, merged with--no-ffin a clean worktree (no conflicts).Results
maingit diff --checkcheck_conventions.pyAll conventions checks passed.libs)agc_driver_nested_image_table,_large,_budgetmain, focused testswas not found but was requested by env var VK_INSTANCE_LAYERSVUID-linesmain, 0 on the merged treeagc_driver_image_table); nested cases 0.45–0.67 s, under the 30 s limitFormatVersionmain1db077e876. This resolves the format collision raised in the earlier changes-requested reviewMerged tree, ctest excerpt
main, ctest excerpt
Negative control
I restored the nine non-test production files under
core/shader/recompilerfromorigin/main. I kept the PR'stests/execution/ImageTable.cppand theCMakeLists.txttest registrations, then rebuiltagc_driver_image_table_tests. All three nested tests fail with the #6191 refusal:Output
The
ShaderDiskCache.cpptest changes use the newpointers/nested/bufferfields and cannot compile againstmain, so they have no negative control.Findings
Blocking
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp:1465-1466.parentKeysRemainingandnestedKeysRemainingareTableSnapshottermembers, initialized once. They are decremented at L1068-L1069 and L1437-L1438.Run()retries the whole snapshot up to three times when the descriptor epoch changes. Before a retry it clearscolumns,pages,wholePagesandtables(L728-L735), but it does not restore the two budgets. Every column is re-read, so the retry draws on what the discarded attempt left over.count > 1u, L726) and a descriptor invalidation lands during the snapshot.ImageTableAbi::MaxParentKeysandImageTableAbi::MaxNestedKeysat the start of each attempt, or make them per-attempt locals. Add a materializer-level test whosedescriptorScopereports one invalidation on the first attempt, and check that the parent column still holds all its keys.Non-blocking
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp:706-717.hasIndirectis set only when the image or sampler column itself isindirect(L706-L717).indirect;decodePlaneven rejects one that is. Its parent, the pointer-indirect V# column, is. So a shader whose only table is nested hascheckEpoch == false. A single-level pointer-indirect table does get the multi-attempt consistency check, although the nested chain reads record → pointer → V# → T# and is at least as exposed.hasIndirectwhenplan.descriptorSources[column.heapSource].tableColumnis present, unless leaving it out is intentional. If it is, say why in the PR.TableOutsideCodeis always counted as an expected fault.core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp:2083in the merged tree (L2058 at the PR head). For a nested root,fillalways callspoison(resource, PoisonReason::Unmapped, nullptr)forTableOutsideCode.out.faults, even when every lane's pointer is non-null. This looks harmless given howfaultsis used today. Iffaultsis meant to count reachable outcomes only, consider allocating the entry lazily.Not verified
To get this to a good state
parentKeysRemaining/nestedKeysRemainingper snapshot attempt and add a regression test for a retried nested snapshot.hasIndirect.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T11:12:29Z.
Review: CHANGES_REQUESTED
Re-checked — changes requested
The new update addresses the format-version finding: it reports version 50 on the PR versus 49 on main, keeps the other ABI versions unchanged, and supplies fresh cache, runtime and validation-layer results on the reported head. That is useful evidence, but the branch is still based on
f7e84c4cf1; currentmainisba5b5330b3and has since changedResourceMaterializer.cpp,ShaderDiskCache.cppand the shader debt file touched by this PR. Please integrate current main and rerun the focused cache/replay and nested-image tests, including the paired validation check, on the resulting exact tree. Preserve the published stack order with #7395.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T16:27:02Z.
Review: CHANGES_REQUESTED
Re-checked — changes still requested
The new commits fix my earlier blocking finding. Commit
7f36e41resets both key budgets on every snapshot attempt and lets a nested column trigger the epoch check, and it addsagc_shader_nested_snapshot_retry. That test passes on the merged tree and fails under both negative controls. One thing still blocks: the new test is registered without the WindowsPATHentry for libc's DLL directory, so it cannot start on the Windows job.What changed since my last review
7f36e41c45, "fix(shader): reset nested table budgets on snapshot retries":parentKeysRemainingandnestedKeysRemainingare now reset at the top of everyTableSnapshotter::Run()attempt.hasIndirectis now also set when an image column'sheapSourceis itself a table column.agc_shader_nested_snapshot_retry(ShaderMemory.cpp).FormatVersionmoved to 51 at that point.6d8f907c5aand11366202db(EagleBearerYS, cherry-picked): drop the two shared-wordrefused(...)checks and their helper fromImageTable.cpp, and change the summary line to match.main(b215a39ec1,635f569fea):tests/cmake/agc_driver_image_table_tests.cmakeandagc_shader_memory_tests.cmake.FormatVersionis now 56, against 52 onmain4f41f4c375.What I ran
PR head
635f569feae58702e4cd4ce4fc3ccfff0e2e2102,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged with--no-ffin a clean worktree. Debian 13 VM (2× Xeon Gold 6136), GCC 14.2.0, Release/Ninja, Vulkan through lavapipe (Mesa 26.1.6, LLVM 19).The script's build and test run (build.json) also applies: build,
libsand skips OK. 2218 tests ran, with no new failures and no timeouts; 7 knownmainfailures. Khronos validation loaded in 772 of 773 tests, with no new VUIDs againstmain.Results
git diff --checkcheck_conventions.pyAll conventions checks passed.agc_shader_nested_snapshot_retry1.70 s,agc_driver_image_table8.57 s (the longest); all are under 30 sagc_shader_nested_snapshot_retryfails:nested retry: a discarded attempt consumed the next attempt key budgetsnested retry: expected inner retry and outer revalidationgit status --porcelainis emptyVUID-lines; the layer loaded in every test but oneFormatVersionmain4f41f4c375Focused ctest excerpt
The author reports three separate controls (parent reset, child reset, epoch eligibility). I reproduced two of them: both resets removed together, and the eligibility change reverted.
Previous findings
hasIndirectwhen the column'sheapSourceis a table column.TableOutsideCodeis always counted as a fault: No longer applies.faultscounts the poison entries prepared in advance, not faults seen at dispatch. I withdraw the suggestion.New findings
Blocking
agc_shader_nested_snapshot_retrylacks the Windows libcPATH, so it cannot start on the Windows job.TIMEOUT 20.agc_shader_memory_testsin this fragment has anif(WIN32)block withENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>"(for example L30-L32 and L38-L40 right next to it), because the executable links the guest libc DLL.if(WIN32) set_tests_properties(agc_shader_nested_snapshot_retry PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>") endif()after L34. That is what EagleBearerYS offered in 3fd2dd02f7, now applied to the split fragment.Non-blocking
None.
Not verified
0dbf5478b2,7f36e41c45).agc_shader_disk_cache*exercises them here.To get this to a good state
if(WIN32)libcPATHblock foragc_shader_nested_snapshot_retryintests/cmake/agc_shader_memory_tests.cmake, then ask for a Windows CI run.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T18:44:10Z.
Review: APPROVED
Re-checked — approved
Commit
51c9e3bdf6adds the Windows libcPATHentry thatagc_shader_nested_snapshot_retrywas missing. That was the only open blocking finding. The checks and the focused tests pass on the PR merged with currentmain.What changed since my last review
51c9e3bdf6, "test(agc): put libc's directory on PATH for agc_shader_nested_snapshot_retry on Windows". It adds three lines totests/cmake/agc_shader_memory_tests.cmakeand changes no sources.mainmoved from4f41f4c375to1e658521a0. Between those two commits,maindid not touchcore/shader, this PR's two test fragments ordocs/dev/debt/shader.md.FormatVersionis still 56 on the merged tree, against 52 onmain1e658521a0.What I ran
PR head
51c9e3bdf651284df23e9037bdca5b4eaea83f07,main1e658521a0a599872612bb91949311e2956b5283, merged with--no-ff(tree4f3aac4b1c19364a4d58aea09bd7765a320e6772) in a clean worktree. Debian 13 VM (2× Xeon Gold 6136), GCC 14.2.0, Release/Ninja, Vulkan through lavapipe (Mesa 26.1.6, LLVM 19).The script's build and test run of this merge also applies:
libsand the skip check succeeded.main.VUID-lines compared withmain.Results
git diff --checkcheck_conventions.pyAll conventions checks passed.agc_shader_nested_snapshot_retrytook 1.64 s; the slowest wasagc_driver_image_tableat 8.60 sgit status --porcelainis emptyNegative control
None this round. The new commit only changes a Windows-only test property. The Linux negative controls I ran on
635f569feacover the same test source and production code, and that code has not changed since.Previous findings
agc_shader_nested_snapshot_retrylacked the Windows libcPATH: Resolved. agc_shader_memory_tests.cmake L35-L37 now has the sameif(WIN32)ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>"block asagc_shader_descriptor_phisandagc_shader_region_mergenext to it.New findings
Blocking
None.
Non-blocking
None.
Not verified