fix(shader): answer image_get_resinfo on any T# dimension #7550
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7550"
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 gjonn on 2026-10-18T13:16:37Z.
What
image_get_resinfowith DIM 1D on a T# that is a cube, 3D or 2D array is refused onmain:The tracker turns the size query into a 1D image, and
ResourceMaterializerfinds no 1D mode that matches such a T#. But the size, layer count and level count thatimage_get_resinforeturns come from the T#. DIM only sets how many address registers the instruction reads.mainalready treats size queries on flat volumes this way.PPSA01317 does this in a pixel shader: it asks the size of a 64x64 cube T# (6 faces, 7 levels) with DIM 1D.
Change:
ImageResourcegetsdimensionQueryOnly. The tracker clears it when the image is used by any operation other thanImageQueryDimensions.RuntimeImageModesadds 2D, 1D array, 2D array, 3D and cube views for it, so the query reads the real view.FormatVersiongoes 37 -> 38, as earlier field additions did (for exampleflatVolumeLineCompatible).Possible conflicts:
FormatVersion; its body says 36 -> 37, andmainis now at 37. Whichever merges second takes the next value.image_get_resinforesults (levels past the mip chain) and touchesResourceMaterializer.cpp,ResourceTracker.cpp,Resources.hppandShaderDiskCache. A textual conflict is possible there, but the two changes do not overlap in behaviour.Tested
Windows 11, MinGW-w64 GCC, NVIDIA GeForce RTX 5090 Laptop GPU (driver 616.92). Tested on
mainat5bf2e139e. After that the branch was rebased cleanly onto385ed71f2(an unrelated LDS atomics merge) and not rebuilt.agc_driver_image_resinfo_dimension(tests/execution/ImageResinfoDimension.cpp). It runsimage_get_resinfoin a compute shader on cube, 3D and 2D-array T#s, once with DIM 1D and once with the T#'s own DIM, and requires both answers to match:main: fails withShaderRecompiler::Recompile: image address has too few coordinate components.image resinfo dimension tests passed).agc_shader_disk_cache(the image round-trip now setsdimensionQueryOnly = false),agc_shader_disk_cache_large_file,agc_shader_memoryandagc_driver_graphicspass.python tools/check_conventions.py --base origin/mainandpython tools/check_test_registration.pypass.Not tested: AMD, Intel, Linux, macOS. The title was not run on this exact branch.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T13:17:41Z.
The query-only path still appears to reject both multisample T# types.
descriptorDimensiondecodesColor2DMsaa/Color2DMsaaArrayasDim2DMsaa/Dim2DMsaaArray, but the new 1D query-onlyRuntimeImageModesbranch only adds 2D, 1D-array, 2D-array, 3D, and cube modes. SinceTryRuntimeImageModerequires an exact dimension match, a DIM 1Dimage_get_resinfoon either MSAA descriptor still falls through to the incompatible-interface error. The RDNA ISA documents GET_RESINFO withdim Anyand includes both MSAA descriptor dimensions (https://docs.amd.com/api/khub/documents/uQpkEvk3pvkfAb2xj4uw/content). Could you add the MSAA query modes and a regression for at least 2D MSAA, plus array MSAA if supported by this backend, or narrow the PR claim if these are intentionally excluded?Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-18T13:38:08Z.
I checked the overlap list. This PR doesn't depend on any of them and doesn't duplicate any of them:
levelUsestracking for mip chains) next to the same line inResourceTracker.cpp. This PR addsdimensionQueryOnlythere. Whichever merges second only needs a trivial rebase.FormatVersionline, which every cache-format change bumps. Whichever merges later takes the next number.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T14:38:46Z.
Review: DISMISSED
The current head still omits both multisample T# shapes from the query-only 1D mode set.
descriptorDimensiondecodesColor2DMsaaasDim2DMsaaandColor2DMsaaArrayasDim2DMsaaArray, but thedimensionQueryOnlybranch adds onlyDim2D,Dim1DArray,Dim2DArray, andDim3D(plus cube).decodeTableEntrytherefore has no matching candidate for a DIM 1Dimage_get_resinfoon either MSAA descriptor. The newImageResinfoDimensiontest covers cube, 3D, and 2D array descriptors, but not MSAA. Please include the 2D MSAA query mode and an array-MSAA mode/test if supported, or narrow the “any T# dimension” claim.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-18T15:14:44Z.
Apple GPU / MoltenVK run of
agc_driver_image_resinfo_dimension, since macOS was not tested.Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head de6d94daf. Method: macos-port @ b7eb6b6b + ImportWatched + PR diff, not main.
ResourceMaterializer.cppand the new test applied cleanly. The other five files conflicted only because the port lacks fields added on main since then (flatVolumeLineCompatible, the field-count asserts, the newerFormatVersion). I kept the port's side and added only this PR'sdimensionQueryOnlylines, withFormatVersionraised by one. Drivers: MoltenVK 1.4.2 (SDK) and MoltenVK main + SPIRV-Cross #2704.ShaderRecompiler::Recompile: image address has too few coordinate componentsWith a local print added to the test, Apple returns the same answer for DIM 1D and for each T#'s own DIM: cube
8x8x6 levels 1, 3D8x8x4 levels 1, 2D array8x8x3 levels 1. So the cube, 3D and 2D-array views thatRuntimeImageModesnow adds for a query-only 1D image also work through MoltenVK's size and level queries.agc_shader_disk_cache,agc_shader_memoryandagc_driver_graphicspass. Full^agcsuite with the PR (SDK driver,-j1 --timeout 30, flip/display/lds_atomics64 excluded): 14 failures out of 434. These are the 13 known port-baseline failures plusagc_driver_cross_workgroup_flag, which also fails on the unchanged port on this machine today. No new failures.GPUs tested: Apple M2 Max (MoltenVK 1.4.2 and MoltenVK main + SPIRV-Cross #2704)
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T15:23:32Z.
Thanks for the MoltenVK run and for documenting the existing baseline failures. The cube, 3D and 2D-array dimension-query results add useful coverage across both MoltenVK versions. My review still asks for the separate 2D MSAA and array-MSAA cases, since those descriptors decode to distinct runtime image modes.
Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-18T17:49:36Z.
Hardware data for the DIM question, since the PR has no AMD run yet.
image_get_resinfo(mip 0) on an RX 6700 XT (gfx1031, RDNA 2). The MIMG words are this PR's test encoding,0xf0380f00 | dim << 3, run through HIP on the real GPU. I ran every T# type against every DIM:So on RDNA 2:
agc_driver_image_resinfo_dimensionrequires DIM 1D to give the same answer as the T#'s own DIM. On this GPU that holds for the 3D T#, but not for the cube or the 2D array: the hardware gives 0 layers where the test expects 6 and 3. The MSAA descriptors @MarcZX10 asked about also answer DIM 1D without error here: (8, 8, 0, 1) for both.This is PC RDNA 2, not a PS5. I don't know which components PPSA01317's shader reads. If it only reads the size, this doesn't change what the title sees.
Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-18T22:08:27Z.
Tested on AMD on Linux, which this PR had not covered.
radv, Mesa 25.2.8-0ubuntu0.24.04.4de6d94dafmerged intomain0bc3003f8, Release,BUILD_TESTING=ONagc_driver_image_resinfo_dimensionpasses.Full
ctestwithANYPS5_REQUIRE_VULKAN=1: 1479 of 1481. Both failures also happen onmainwithout this PR and are unrelated to it:
agc_pipeline_cache_file: the test reads a cache hit as an exactvkGetPipelineCacheDatasizematch, and RADV moves that size by 8 bytes on a hit (#7676).
agc_driver_guest_memory_lifetime_direct: this machine has no read-write access to/dev/udmabufyet.Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-18T22:50:50Z.
RTX 4090 data point on PPSA01317, continuing today's chain on D4697 and #6815 (same box, same stack): with this PR the
image address has too few coordinate componentsrefusal onshader 0x126f962f00is gone, 4 of 4 runs, and nothing else throws for a long time. The title then sits on a black screen, busy on about three cores, for three to five minutes; the one run that got out of that phase within the cap (188 s) stopped on the blend that #7243 leaves refused,blending into an 11_11_10 float color target is unsupported.Setup. Gran Turismo 7 PPSA01317 01.000.001 (base package), Windows 11 (26200), RTX 4090 (NVIDIA 616.92), AMD Ryzen 7 5800X, MinGW-w64 GCC 15.2.0 r7 (UCRT), Release
libstarget only (no tests built).app.exeis the relink frommain31cbb55d7(--windows --registry --module-dir .); onlylibs/is swapped between runs. Tree:main48d61f53b(2026-10-18; it already carries #7137, #7207, #7175, #7238, #7240, #7271 and #7626) + #7256 (which brings #7254) + #7243 + #5958 + #6815 d513fb987 + this PR's head de6d94daf (merge 1f1ecc1b7). The merge is textually clean, but #5958 and this PR each add oneImageResourcefield and each raise thefieldCount<ImageResource>()assertion to 39, so the build stops atShaderDiskCache.cpp:143; with the count set to 40 (5d50a64b9) it builds, and both new fields are already in the encoder and decoder.FormatVersionstays at 38, which the tree already had; the shader-source version changed anyway, so run 1 recompiled everything (1,571 misses). Three local environment-gated lines on top, none of which changes a result: a bypass that makessceHmd2Initializeanswer0x81110016again (currentmainaborts 5 to 12 s in onsceHmd2ReprojectionQueryBufferSizeAlign not implemented, the #7323 regression), a print ofsceSslConnect's return, and a display-buffer print that was off here. No controller, no input, one-shot interactive task per run, 300 s cap, box otherwise idle.Result. The control (the same tree without this PR, on #6815) aborts on
shader 0x126f962f00 stage 5: image address has too few coordinate componentsat 43 s and 247 s. With this PR that query goes through: no refusal of that wording in any run, noimage_get_resinfocomplaint of any other wording, and the 774 shader registrations are the same as before.shader 0x126f962f00 stage 5: image address has too few coordinate componentsAGC graphics: blending into an 11_11_10 float color target is unsupportedWhat the title does in that time, the same in all four runs: the "Sony Interactive Entertainment presents" splash (title-bar counter 18 FPS at 560 frames, +15 s), then a black window; by +55 s the counter is at about 1,320 frames and 12 FPS, and from there it advances by a handful of frames over the next minutes (run 2: 1,319 at +55 s, 1,322 at +245 s; run 3: 1,329 at +245 s; run 4: 1,331 at +170 s). It is not idle. A 15 s sampler on run 4 (
Get-Processplusnetstat) shows the process using 41 to 44 CPU-seconds per 15 s, that is close to three cores, with 170 to 177 threads and a working set growing from 5.2 to 9.3 GB, while the last stderr activity is a trickle of texture creations (2 to 27 lines per 10 s); nothing is waiting on a socket, the only TCP entries are repeatedSYN_SENTto two :443 peers that never establish, plus two UDP ports. What is busy is host pipeline compilation: thepipeline-journalthe runtime loads at start grew from 0 to 321, 519 and 673 pipelines over runs 1 to 4 (and to 757 in three later runs on the same tree, which then reach the draw below in about 50 s every time), so the 3 to 5 minutes are the NVIDIA driver compiling this title's pipelines, amortised across runs by the journal, not a guest loop. Run 4 got out of it at 179 s ([pm4 ring] ... t=178896.1 msjust before the abort) and the next draw blends into an 11_11_10 float target with something other than the replace equation #7243 decodes, whichDecodeStatestill refuses by design ("Every other blend into a packed target is still refused", #7243). I do not have that draw'sCB_BLEND_CONTROLvalue; nothing logs it.sceSslConnect(main's #7626) returnsSSL_ERROR_WANT_POLLINtwo to four times and thenSSL_ERROR_UNKNOWN_CAon each of the title's seven connections in all runs; the title goes on.Chain on this box for a
main-built runtime, as of tonight:sceHmd2ReprojectionQueryBufferSizeAlign(#7323 regression, no PR) -> #7243 -> #7254 / #7256 -> #5958 -> #6815 -> this PR -> a source-over alpha blend into an 11_11_10 float target (CB_BLEND0_CONTROL 0x65040504, measured in three later runs; no PR), behind a pipeline-compilation phase that shrinks as the pipeline journal fills.sampler on run 4 (15 s period; cpu is the process total, d15 the increase over the period)
stderr of run 4 (warm, box idle) from the save-data mount to the abort, the per-shader
ShaderRegistrylines, thesceKernelOpenmisses and the cache and texture bookkeeping removed, the[shadow]lines collapsed, the[log]lines shortenedAI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-19T05:25:51Z.
I compared #7550 at
de6d94daff2bwith the rebased #6280 candidate0e1f2ab53b59. The scopes remain separate: dimension-query eligibility here, and physical/guest mip counts plus out-of-count results in #6280.For composition, preserve
dimensionQueryOnly, main'sconvertedSamples, and #6280'slevelUsesin tracking, runtime modes, encoder/decoder, minimum record sizes and the nonzero cache fixture. #6280 now has image field count40 and cache format41 on its pinned base676d; adding your field to that exact layout gives41 fields. Recount on the landing base and choose its next available cache version. Keep the safe physical query LOD, outside-count extent mask, guest count, and single-unrepresented-base admission control.I propose #6280 first, then rebase #7550 with both changes preserved; that is a proposal, not an agreed merge order. The separate DIM/layer-component and MSAA reviewer questions remain open, including thuanquang's desktop RDNA2 evidence; this composition note does not settle them or claim a combined execution result.
AI-assisted: yes (Codex)
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T07:46:41Z.
Rebase handoff — rebased onto current
main(authorship unchanged). One serializer conflict:main'sFormatVersion40 kept (your branch's 38 predatesmain's bumps).Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; conventions pass; full suite green apart from the four knownmainregressions (#5444 Mesa, #7584 BDA, #7766, #7784), none from this PR.To pick it up:
Head is
32ab83655.Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T07:49:46Z.
Correction: the first push didn't build (the PR's
ImageResourcefield-count pin was stale against the merged struct — 39→40, your PR's new field plus main's). Head is now227481d76: builds, the image-resinfo test passes, conventions pass, full suite green apart from the four knownmainregressions.Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-19T08:05:54Z.
@blawesom @gjonn one thing in the handoff 227481d76: the info encoder and decoder now write and read
dimensionQueryOnly, butShaderDiskCache.hppis unchanged, soFormatVersionstays atmain's 40. A cache written bymain(format 40, without the field) would then be read with the new layout. It needs 41.Heads-up on merge order: #7381 makes the same two edits,
fieldCount<ImageResource>() == 40andFormatVersion41. Git merges identical edits without a conflict, so whichever of the two lands second builds against a struct with 41 fields and fails thestatic_assert. That's how #7381's earlier head broke against #5958 this morning. The second one needs 41 and 42.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T16:25:17Z.
Review: CHANGES_REQUESTED
Thanks for this. A few things need fixing before it can merge:
image_get_resinfoon RDNA 2 (comment above): width, height and levels come from the T#, but for a non-3D T# a DIM without layers (1D, 2D, 2D_MSAA) returns 0 in the third component (cube 8x8 →8, 8, 0, 1; 2D array 8x8x3 →8, 8, 0, 1); a 3D T# returns its depth for every DIM. The new view modes return the real layer count, andImageResinfoDimension.cpp:88(Check) requires DIM 1D to equal the T#'s own DIM, so the test pins the wrong value for cube and 2D array. Make the third component 0 when the instruction's DIM has no layers (except 3D T#), and change the test to expect that.ResourceMaterializer.cpp:1523-1534adds no 2D MSAA / 2D MSAA array view, so DIM 1D on those T# still hits the incompatible-interface error (MarcZX10's review). HW answers them too (8, 8, 0, 1). Add the modes and a test row for each.main.FormatVersion(ShaderDiskCache.hpp:16, 38) andfieldCount<ImageResource>()(ShaderDiskCache.cpp:143, 39) are stale:mainis at 40 and #7381 also takes 41. Use the next free values after rebasing, and re-runagc_shader_disk_cacheand the new test.