fix(shader): write 1D storage images through 2D-array stores at slice 0 #11120
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11120"
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 shahulmubeen-a on 2026-10-25T18:41:07Z.
What
An
image_storewith DIM 2D_ARRAY through a 1D T# (type 8) had no runtime image mode, so the dispatch stopped. #2348 gave DIM 2D stores through a 1D T# a 1D mode, but not DIM 2D_ARRAY stores. Ghost of Yōtei (PPSA26344) stopped on this in a compute program:(T#
50091c00 03800000 00000000 80000000 ..., access Dim2DArray storage.)RuntimeImageModesnow gives write-only 2D-array storage images the same 1D mode as the 2D case, with the same conditions. InEmitWriteOp, such a store runs only when its slice address is 0.The slice rule comes from a measurement on RDNA2 (gfx1036), made with
tools/hw-oraclethrough the AMD Windows driver's HIP runtime. Settings: wave32, IEEE off, DX10 clamp on, denormals preserved, round to nearest even. One lane stores a dword through a 64-texel linear 32_UINT 1D T#. The kernel then scans 1024 dwords of the image memory for changes.This matches the
image_loadresult in thedocs/dev/debt/shader.mdentry for 2D accesses through a 1D T#, where loads at nonzero slices return zero. Thedebt/shader.mdentry for 2D stores to 1D storage images now states the 2D-array rule and the measurement. The PS5's gfx1013 is not measured.Oracle probe (script and output excerpt)
Body around the store, with
s[8:15]set to the T#addr>>8, fmt 20 | width bits, 15, 0x80000fac, DEPTH, 0, 0, 0:All 180 rows follow the rule above.
Tested
Windows 11 Pro 26300, NVIDIA GeForce RTX 4070 Ti SUPER (610.88), WinLibs GCC 15.2.0, Release. Tested head:
b9d00c5d8onmaina7a2eece4.agc_driver_image_store_line_through_plane_array, for 32_SINT and 32_32_32_32_SINT 1D T#s. Each lane makes three DIM 2D_ARRAY stores: (x, y = 1, slice 0) with dmask 0xf, then (x, 0, 0xffffffff) and (x, 0, 1) with dmask 0x5. The test expects only the first store in the texels and no change past the texture.mainwithimage descriptor is incompatible with the static runtime image interface ... T# 73c96300 c1500002 00000007 80000fac ....EmitWriteOp, it fails withtexel 0 component 1 is 0x00000000, expected the y = 1, slice = 0 store 0x3c6ef362 and the stores to slices 0xffffffff and 1 dropped.ctest -R "image_store|on_line|line_through|through_volume|on_volume|agc_shader_memory|image_volume").tools/check_conventions.py --base origin/mainpasses.mainand on this head, each withctest -V,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1:was not found but was requested, and both show the sameWARNING-VkImageSubresourceRange-layerCount-compatibilitywarnings.VUID-error.main, only the new test fails.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:46:39Z.
Review: APPROVED
Reviewed exact head
b9d00c5d80. The runtime mode is added only for write-only, non-atomic 2D/2D-array storage images under the existing format/mip restrictions. The emitter separately gates 2D_ARRAY-through-1D writes on the third address component being zero; ordinary 2D-through-1D stores retain their previous behavior. The committed execution regression checks 32_SINT and 32_32_32_32_SINT, slice-zero writes, dropped nonzero/large slices, and bounds beyond the texture. The PR reports 16 focused Vulkan tests onmainand this head with validation enabled on the same RTX 4070 Ti SUPER, no VUIDs, and only the same warnings; hosted product jobs are skipped. I found no remaining blocking issue.Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-25T21:45:41Z.
Review: APPROVED
Reviewed head
b9d00c5d80by reading the diff and the existing review thread. I did not build or run this, so everything below is from the code, not from a test of mine.What it does. A write-only, non-atomic
image_storewith DIM 2D-array through a 1D T# is now allowed as a runtime image mode (RuntimeImageModesacceptsDim2DArrayas well asDim2D), and the emitter masks the store withaddress[2] == 0, so only slice 0 is written. That matches the existing measured 2D-through-1D behaviour (texel x written, y ignored) and extends it to the array form.Checked:
CMakeLists.txtin this diff, butlibSceAgcDriver/CMakeLists.txtglobstests/execution/*.cppwithCONFIGURE_DEPENDS, so it is built and registered. I checked that rather than assume it.32_SINTand32_32_32_32_SINT, checks every texel of a 32-wide texture, and checks that the bytes after the texture are untouched, which guards the "wrote the wrong place" failure.GuestBlockfrees what it allocates, and the test returnsVulkanTestSkippedwhen no device is present.tablefrogpillowran it on several AMD GPUs with validation layers (details in the thread).Nits:
ImageStoreLineThroughPlaneArrayis not obvious (the repo says "2D-array"); consider matching the debt entry's wording.Approving.
AI-assisted: yes. Written with AI assistance and reviewed by me.