fix(shader): accept a nested S# whose V# gives the key of a sibling V#'s T# array #15555
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15555"
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 hugodearaujo on 2026-11-03T18:44:41Z.
What
Marvel's Spider-Man 2 (PPSA03016 01.004.003), with #9969 applied, stops on a compute shader whose S# the recompiler refuses:
The same block also appears 0xbb8 higher, at pc 0x9a78 / 0x99fc. The shape, from the IR posted on #9790 on 2026-11-02:
#9969 handles a key word whose T# reads go through the same V#. Here the key read through A indexes B.
ChildKeyWordrequired the T# reads to use the key's own handle, soDescriptorWordReadsrefused A's key read, and with it the S# column read through A.ChildKeyWordnow also accepts T# reads through a sibling V# whenDescriptorWordReadsasks on behalf of a V# that is read again at dispatch. A sibling is aGetBufferResourcewhose four words areLoadAddressU32s from the same, or an equivalent,GetAddressResourceas the key's V#. Nothing else changes:MatchChildKeystill requires the same handle, so the column falls back toMatchKeyDomain: B's table binds every key the key's known bits allow, up to B's num_records. Narrowing it would need the materializer to read the key from the other V#'s buffer.The debt entry for nested image tables records this form and its limits.
Tested
Arch Linux (kernel 7.2.14), AMD Radeon RX 9070 XT (RADV GFX1201, Mesa 26.2.6), Release. The branch is #9969's head
5f70ec884eplus the three commits of this PR, joined by a merge (77b4696698).New test
agc_driver_pointer_vsharp_sibling_key_table(agc_driver_image_table_tests --pointer-vsharp-sibling-key). It uses #9969's child-key shader with the T# array in a second V# loaded through the same record pointer. A's buffer holds the key and the S#. B's buffer holds the T# array, plus a decoy key and the opposite S# at the same offsets, so reading A's words from B would show up. It checks:None of these recompile the shader.
Paired validation of the 21
agc_driver_(nested_image_table.*|nested_sampler_table|pointer_.*_table|image_table)tests, withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=layer:VUID-linesResourceTracker.cppfrom5f70ec884eOn the base, the new test fails the way the title does:
The validation layer was inserted in every test of both runs. The 63
^shader|^agc_shadertests pass on this branch. These results are from the merge of5f70ec884e(2026-11-10), built withmaineaec74e322merged on top locally; the same pair on the earlier bases0ef70b4bcb,ce65f496e6,5a8c3cc229,c147aa8647and9e7ac69470gave the same counts.Title: Spider-Man 2, relinked with
--module-dir . --registry, fresh shader cache, Cross every 30 s, until the first stop. Base:main4f41f4c375+ #99699e7ac69470+ #893958ebe4b440+ #1364617770dd69f+ #153997a9ecdc365. #13646 keeps the bindless table's textures inside VRAM, and #15399 stops an intermittentruntime resource snapshot did not stabilize.RenderFrameIndexat 5683. The refusing runs stopped at frame 1460 (this base) and at frames 4856 and 5015 (the earlier head).device-local heap 1 uses 16314 of its 16304 MiB budget), and my memory guard stopped it at 161 s. That fill comes from the bindless table (#10195), not from this change.Not verified: the picture. On this machine the bench's screenshots of this title are black after about 60 s in every run, with or without this change, so I can't judge the rendering. The new test checks the selected T# and S# against the guest's own.
On current
main. The head,215d1820e3, merges #9969's current head78bdc14492and thenmainbfcd717ebcinto this branch. The disk cache format is #9969's, 102, abovemain's 96; this branch changes no encoded structure itself. Thewindowsjob's GCC error inpossibleU32BitsDepthfrom the 11-14 merge ofmainstays fixed: theShiftRightLogical32case callspossibleU32BitsDepth, as on #9969. With the validation layer andctest -V -R '^(agc_driver_(image_table|nested|pointer)|agc_shader_(disk_cache|memory|nested_sampler|sampler_limits)|spanned_uniformity|shader_memory_decoder_tolerance)'on the RX 9070 XT, it gives 58 tests: 57 pass andagc_driver_image_table_vouched_lookupsskips (the device reports written imported pages). Onmainbfcd717ebcthe same command gives 45 tests: 44 pass and the same skip. No log has aVUID-line or "was not found but was requested".Runs by others.
77b4696698merged ontomain07ae6afcee, CachyOS (Linux 7.3.1), GCC 16.2.1, Release,ctest -R '^(agc|video_out|shader)'without the validation layer, compared withmainon the same machine. On an NVIDIA RTX 3070 Ti (615.78.08) and an Intel UHD Graphics 630 (Mesa 26.2.6) there is no difference frommain, and the 18 new tests pass on both.77b4696698and its merge base3eb7a74e1c,agc_shader_disk_cache_tests,agc_shader_memory_testsandagc_driver_image_table_tests, 3 runs each, Release. Ubuntu 26.04.1 with an RTX 4070 Ti (NVIDIA 615.71.09, GCC 15.2), and a Windows 11 VM with a GeForce GT 1030 (NVIDIA 582.78, WinLibs GCC 15.2 UCRT). The 18 new tests pass 3 of 3 on both machines, and no other test differs between the base and the head. On the Windows VM, 16agc_driver_image_table_*tests fail 3 of 3 on both sides.77b4696698merged ontomainc5488026ab, Windows 10 22H2, AMD Radeon RX 6750 XT (Adrenalin 26.10.1), WinLibs GCC 15.2 UCRT, Release, no validation layer. The 22^(agc_driver_(nested|pointer)_.*|agc_shader_nested_.*)$tests, the 18 new ones included, pass 3 of 3. In three full^(agc_|windows_write_watch$)runs (1,601 tests), compared per test withmainon the same card: one run had a start-up crash inagc_driver_draw_cache_reuse_entry_verify(replace guest placeholder with private memory, in code this PR doesn't change; #15564 records it onmain), and one, slowed by other work on the machine, had three GPU waits time out. Neither came back in the other runs or when run alone.main56c80b0917+ mrfelek's lazy image tables (9db1fcd707) + this PR at77b4696698, and the same build without this PR, one run each, RTX 4090 (NVIDIA 620.70.06), GCC 16.2.1, Release, fresh shader cache, Cross on the black screen about every 30 s. Both builds carry a local switch that drops a refused compute dispatch instead of stopping. Without this PR, the one dropped program refuses at pc 0x84bc (LoadAddressU32@0x84a8← the record at0x1fc4), and bindless table 0 is never resolved. With it, the dropped program refuses at pc 0xa5b0 instead, the next stop in my runs too (#18106), and table 0 is resolved after the presses.77b4696698merged ontomain510d0bf986, Windows 11 Pro, Radeon Vega iGPU (GCN, Ryzen 5 7530U), AMD driver 23.19.24.04, WinLibs GCC 16.2.0, Release, with the validation layer. The newagc_driver_pointer_vsharp_sibling_key_tablepasses 3 of 3, with noVUID-line.d38090f95bmerged ontomain40206fe50d, Arch Linux, RTX 4090 (NVIDIA 620.70.06), GCC 16.2.1, Release, layer 1.4.363.1, the command above.main40 of 40, this PR 58 of 58, none skipped; noVUID-line, and the layer is inserted.Checklist
main; no other open PR implements the same functions (#9969 and #9790 handle a key read through the T#'s own V#; this is the sibling-V# form neither covers)NotImplemented_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)mainalso shows #9969's chain)Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T20:20:45Z.
Review: APPROVED
Reviewed — approved
The PR's own change, three commits on top of #9969's head
9e7ac69470, letsChildKeyWordaccept a key whose T# reads go through a sibling V# loaded through the same record pointer. It is narrowly scoped, it is covered by a test that fails without it, and its gaps are recorded in the debt file.What I ran
Head
e358b7af22d8023d10fa14f34710bcda0a30e89e,main086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged tree814f9af6ef17ae7e33d8ac275e0069ffa2cc4d51. Machine: Debian 13 VM (32 vCPU Xeon Gold 6136), GCC 14.2.0, lavapipe (Mesa 26.1.6, LLVM 19).Results
git diff --checkcheck_conventions.pymainVUID-lines, 0 "was not found but was requested"agc_driver_pointer_vsharp_sibling_key_tableagc_driver_image_gather_volume(VUID-VkSamplerCreateInfo-addressModeU-01079and-parameter). The test was not run on the baseline. It reports the same VUID with every production file of the PR restored frommain, so it comes frommain, not this PR. The diff doesn't touch sampler creation.New test output (merged tree)
Negative control
I reverse-applied only the PR's own
ResourceTracker.cppchange, the diff from9e7ac694706cto the head, to the merged tree and rebuiltagc_driver_image_table_tests. The new test then fails with the refusal the description quotes, and #9969'sagc_driver_pointer_vsharp_child_key_tablestill passes:Output without the change
After I restored the merged file and rebuilt, the test passes again and
git status --porcelainis empty.Findings
Blocking
None.
Non-blocking
Unblocks:line has no Game bring-up discussion. The line names PPSA03016 but not its Game bring-up discussion. CONTRIBUTING.md asks for both (Unblocks: PPSA01325 #3232). Suggested fix: add the PPSA03016 discussion number.Notes on the code, which need no change:
SiblingVsharp(ResourceTracker.cpp#L2408-L2422) needs all eight words of the two V#s to beLoadAddressU32from one, or an equivalent,GetAddressResource.DescriptorWordReadspassessiblings = true(line 864), and only on itsrereadablepath. So the key stays the guest's value at dispatch, as the description says.MatchKeyDomain, becauseMatchChildKeystill requires the same handle. If the sibling can't be planned, the shader is still refused.docs/dev/debt/shader.mdstates the gap first: the column is not narrowed, and the other forms stay refused.Not verified
main. I reviewed only this PR's three commits on top of9e7ac69470. The chain's tests ran in the script's selection and in the 21 focused tests above.num_records.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T07:00:03Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change based on the implementation and tests inspected; I could not complete a full review because one changed file was excluded from the review bundle.
What I ran
Inspected the prepared diff and relevant code at head
fd3c021c15930639fdc8aafbcd316e3f5365f767. No test commands were run; reported test results below are author supplied.Results
Findings
Blocking
None identified in the code inspected.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas excluded fromfiles/; only its changed diff hunks and targeted head ranges were available. I did not read all changed lines across every reviewed file or run the reported commands. The reported rendering output for Spider-Man 2 was not verified.Files read:
description.md,commits.md,manifest.json,diff.patch; targeted ranges ofResourceTracker.cpp,ResourceMaterializer.cpp,ImageTable.cpp, andShaderMemory.cpp; plus changed hunks inShaderDiskCache.cpp,BdaAnchorReads.cpp,ImageTableAbi.hpp, resource metadata, cache serialization, SPIR-V emitters, CMake test registration, anddocs/dev/debt/shader.md.ShaderMemory.cpp's full changed file was excluded by size.To get this to a good state
Nothing is required. The focused implementation review found no concrete defect; the full test file and reported test commands remain unverified.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T12:41:00Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this review; the points below are optional.
What I ran
Reviewed head
215d1820e3ef6ccf1b14437e146573acff74064fusing the prepared diff and the pinnedrepo_read.pyreader. No tests or builds were run.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Not verified
ShaderMemory.cppis excluded from the review bundle because it is too large; its changed lines were not read. The remaining changed files listed inmanifest.jsonwere read through the diff and/or targeted head source ranges; no full-file audit was performed. Runtime behavior and the author-reported test results were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:40:58Z.
Review: COMMENTED
The trial merge onto
c1601e56d5conflicts in the image-table test source and registration and inShaderDiskCache.hpp. I verified that this exact head is an ancestor of #18106. Preserve the fixture where a nested sampler’s buffer provides the key for a sibling image descriptor and also supplies the sampler data. Testing either use alone could miss the shared provenance change. Reconcile this cache schema before running the stack’s shader-memory and execution fixtures.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.