Repository navigation
feat(shader): resolve nested image tables through runtime pointers - #7223
Conversation
|
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.
|
|
First physical-GPU runs (existing coverage is QEMU/lavapipe-class only): head
|
|
Linux confirmation on Ratchet & Clank: Rift Apart (PPSA01474), RTX 4090,
So 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. |
|
@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 ( Tested and written by Claude (AI assistant) on a contributor's machine. |
|
I checked head |
|
@MarcZX100 here is the shape, from a local diagnostic that evaluates the refused chain against guest memory at registration (Ratchet & Clank: Rift Apart, Common part (all three loads below use it):
The three loads from the selected block:
Words at those offsets, records 0 and 1:
So a synthetic fixture would be: a record table (16-byte records, pointer at Tested and written by Claude (AI assistant) on a contributor's machine. |
|
Thanks, this is enough to define a useful synthetic regression without retaining title data. It should keep the per-lane |
|
@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 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 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. |
|
Stack note: this PR is the base of #7395 — its head |
…mers A T# read from a nested child table stayed a runtime read when one of its words also fed another instruction. That read goes through a V# that exists only in the snapshot, so the dispatch read a garbage address; lavapipe crashed in the shader. The nested branch now refuses a child whose descriptor words are used by anything but equal handles, as it already does for a V# with another consumer. (cherry picked from commit 0df7d32)
…sharp-reuse 6e403b4 is boykopovar#9457 with the stack's merges of boykopovar#7395's main merge after boykopovar#7223. FormatVersion stays this branch's 71. In the debt file, boykopovar#7395 adds a sentence on nested children's registered views to "Nested image tables", which this branch rewrites. The entry keeps this branch's wording, and the sentence moves into its own entry after it, since both together are over the debt files' 1000 characters.
b41beed is boykopovar#9790 with the stack's merges of boykopovar#7395's main merge after boykopovar#7223. FormatVersion stays this branch's 73, and the debt file keeps this branch's three entries, with boykopovar#7395's "Nested image table children" entry added after "Nested image tables".
6e403b4 is boykopovar#9457 with the stack's merges of boykopovar#7395's main merge after boykopovar#7223. The conflicts are this branch's own: FormatVersion 70 and its pointer-keyed chase debt entry.
…ords-on-c2 f498717 is boykopovar#9633 with the stack's merges of boykopovar#7395's main merge after boykopovar#7223. The conflicts are this branch's own: FormatVersion 72 and its wording of the pointer-keyed chase debt entry.
#7223 takes FormatVersion 56 on main, above this branch's 54, so this branch moves to 57, the next number no open pull request holds.
An S# or T# loaded through a pointer that a scalar record holds was refused when a Phi merged the pointer's low word with constants, so recompiling failed with "GetSamplerResource dword 0 is not a valid runtime value". Such a column is now pointer-keyed: the snapshot captures every record's pointer and the descriptor behind it, the map holds #7223's sorted pointer dictionary with descriptor records as its codes, and the GPU looks up the actual 64-bit pointer. A pointer that was not captured faults as outside the snapshot, and a null one as unmapped. The plan gains TableColumn::pointerKeyed and the snapshot gains ImageTableColumnSnapshot::pointerKeyed, so the disk-cache format moves to 43 and the image-table ABI to 4.
# Conflicts: # core/shader/recompiler/ShaderDiskCache.hpp
…lines The nested image table and nested sampler table tests no longer check refusals: d908758 dropped the shared V# and other-consumer T# cases, and the nested sampler refusal cases went before it. Their success lines now say only what they check. The nested image table line comes from #7223 (ad44bc4) and is in this branch through its merges of #7223.
…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.
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)