fix(shader): write 1D storage images through 2D-array stores at slice 0 #11120

Merged
shahulmubeen-a merged 1 commit from upstream-pr/11120 into main 2026-10-26 08:58:24 +00:00
shahulmubeen-a commented 2026-10-25 18:41:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by shahulmubeen-a on 2026-10-25T18:41:07Z.


What

An image_store with 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:

compute shader 0x80002cd600: image descriptor is incompatible with the static runtime image interface

(T# 50091c00 03800000 00000000 80000000 ..., access Dim2DArray storage.)

RuntimeImageModes now gives write-only 2D-array storage images the same 1D mode as the 2D case, with the same conditions. In EmitWriteOp, 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-oracle through 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.

  • DIM 2D_ARRAY, DEPTH 0 and 3, x of 0, 5 and 63, y of 0, 1, 3 and 0xffffffff:
    • slice 0: exactly texel x is written, whatever y is.
    • slices 1, 2, 5 and 0xffffffff: nothing is written.
  • Controls on the same T#:
    • DIM 2D writes texel x for every y, as #2348 measured.
    • DIM 1D_ARRAY writes only at slice 0.
    • DIM 1D writes texel x.

This matches the image_load result in the docs/dev/debt/shader.md entry for 2D accesses through a 1D T#, where loads at nonzero slices return zero. The debt/shader.md entry 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:

image_store v7, v[4:6], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_2D_ARRAY unorm glc
dim       depth x   y          slice      | changed first_index first_value
2D_ARRAY  0     5   0x00000001 0x00000000 |    1     5 0x12340005
2D_ARRAY  0     5   0x00000001 0x00000001 |    0
2D_ARRAY  0     5   0xffffffff 0xffffffff |    0
2D_ARRAY  3     63  0x00000003 0x00000000 |    1    63 0x1234003f
2D_ARRAY  3     63  0x00000003 0x00000002 |    0
2D        3     5   0xffffffff -          |    1     5 0x12340005
1D_ARRAY  0     5   -          0x00000001 |    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: b9d00c5d8 on main a7a2eece4.

  • New 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.
    • It fails on main with image descriptor is incompatible with the static runtime image interface ... T# 73c96300 c1500002 00000007 80000fac ....
    • Without the slice check in EmitWriteOp, it fails with texel 0 component 1 is 0x00000000, expected the y = 1, slice = 0 store 0x3c6ef362 and the stores to slices 0xffffffff and 1 dropped.
  • 16 neighbouring image tests pass on that head (ctest -R "image_store|on_line|line_through|through_volume|on_volume|agc_shader_memory|image_volume"). tools/check_conventions.py --base origin/main passes.
  • I ran the same 16 tests on main and on this head, each with ctest -V, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1:
    • The layer was loaded in both runs: neither log has was not found but was requested, and both show the same WARNING-VkImageSubresourceRange-layerCount-compatibility warnings.
    • Neither log has a VUID- error.
    • On main, only the new test fails.
  • Ghost of Yōtei: an earlier version of this mode (without the slice check), on our local stack, got program 0x80002cd600 past the stop. I have not run the title again on this head.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA26344 #675
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, driver 610.88, Windows 11 Pro 26300 (tests); AMD Radeon Graphics iGPU of a Ryzen 9 7950X (gfx1036), AMD Windows driver, for the oracle measurement
  • AI-assisted: yes (written with Claude Code; I reviewed and ran it)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5007568811 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11120). Originally posted by [shahulmubeen-a](https://github.com/shahulmubeen-a) on 2026-10-25T18:41:07Z. --- ### What An `image_store` with 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: ``` compute shader 0x80002cd600: image descriptor is incompatible with the static runtime image interface ``` (T# `50091c00 03800000 00000000 80000000 ...`, access Dim2DArray storage.) `RuntimeImageModes` now gives write-only 2D-array storage images the same 1D mode as the 2D case, with the same conditions. In `EmitWriteOp`, 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-oracle` through 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. - DIM 2D_ARRAY, DEPTH 0 and 3, x of 0, 5 and 63, y of 0, 1, 3 and 0xffffffff: - slice 0: exactly texel x is written, whatever y is. - slices 1, 2, 5 and 0xffffffff: nothing is written. - Controls on the same T#: - DIM 2D writes texel x for every y, as #2348 measured. - DIM 1D_ARRAY writes only at slice 0. - DIM 1D writes texel x. This matches the `image_load` result in the `docs/dev/debt/shader.md` entry for 2D accesses through a 1D T#, where loads at nonzero slices return zero. The `debt/shader.md` entry for 2D stores to 1D storage images now states the 2D-array rule and the measurement. The PS5's gfx1013 is not measured. <details><summary>Oracle probe (script and output excerpt)</summary> Body around the store, with `s[8:15]` set to the T# `addr>>8, fmt 20 | width bits, 15, 0x80000fac, DEPTH, 0, 0, 0`: ``` image_store v7, v[4:6], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_2D_ARRAY unorm glc ``` ``` dim depth x y slice | changed first_index first_value 2D_ARRAY 0 5 0x00000001 0x00000000 | 1 5 0x12340005 2D_ARRAY 0 5 0x00000001 0x00000001 | 0 2D_ARRAY 0 5 0xffffffff 0xffffffff | 0 2D_ARRAY 3 63 0x00000003 0x00000000 | 1 63 0x1234003f 2D_ARRAY 3 63 0x00000003 0x00000002 | 0 2D 3 5 0xffffffff - | 1 5 0x12340005 1D_ARRAY 0 5 - 0x00000001 | 0 ``` All 180 rows follow the rule above. </details> ### Tested Windows 11 Pro 26300, NVIDIA GeForce RTX 4070 Ti SUPER (610.88), WinLibs GCC 15.2.0, Release. Tested head: b9d00c5d8 on `main` a7a2eece4. - New `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. - It fails on `main` with `image descriptor is incompatible with the static runtime image interface ... T# 73c96300 c1500002 00000007 80000fac ...`. - Without the slice check in `EmitWriteOp`, it fails with `texel 0 component 1 is 0x00000000, expected the y = 1, slice = 0 store 0x3c6ef362 and the stores to slices 0xffffffff and 1 dropped`. - 16 neighbouring image tests pass on that head (`ctest -R "image_store|on_line|line_through|through_volume|on_volume|agc_shader_memory|image_volume"`). `tools/check_conventions.py --base origin/main` passes. - I ran the same 16 tests on `main` and on this head, each with `ctest -V`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1`: - The layer was loaded in both runs: neither log has `was not found but was requested`, and both show the same `WARNING-VkImageSubresourceRange-layerCount-compatibility` warnings. - Neither log has a `VUID-` error. - On `main`, only the new test fails. - Ghost of Yōtei: an earlier version of this mode (without the slice check), on our local stack, got program 0x80002cd600 past the stop. I have not run the title again on this head. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA26344 #675 - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, driver 610.88, Windows 11 Pro 26300 (tests); AMD Radeon Graphics iGPU of a Ryzen 9 7950X (gfx1036), AMD Windows driver, for the oracle measurement - [x] AI-assisted: yes (written with Claude Code; I reviewed and ran it) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-25 18:46:39 +00:00 (Migrated from github.com)

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 on main and 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644707589 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11120#pullrequestreview-5644707589). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T18:46:39Z. **Review:** APPROVED --- Reviewed exact head b9d00c5d808c4de8dd8e8425d5a9d1a962baef54. 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 on `main` and 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.
klosixgaming-arch commented 2026-10-25 21:45:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-25T21:45:41Z.

Review: APPROVED


Reviewed head b9d00c5d80 by 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_store with DIM 2D-array through a 1D T# is now allowed as a runtime image mode (RuntimeImageModes accepts Dim2DArray as well as Dim2D), and the emitter masks the store with address[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:

  • The test file is not listed in CMakeLists.txt in this diff, but libSceAgcDriver/CMakeLists.txt globs tests/execution/*.cpp with CONFIGURE_DEPENDS, so it is built and registered. I checked that rather than assume it.
  • The new test covers 32_SINT and 32_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.
  • GuestBlock frees what it allocates, and the test returns VulkanTestSkipped when no device is present.
  • tablefrogpillow ran it on several AMD GPUs with validation layers (details in the thread).

Nits:

  • The test name ImageStoreLineThroughPlaneArray is not obvious (the repo says "2D-array"); consider matching the debt entry's wording.
  • The debt entry is edited but I would add the slice != 0 case explicitly: the store is dropped, and whether the console drops it or writes elsewhere should be marked measured or not measured.

Approving.

AI-assisted: yes. Written with AI assistance and reviewed by me.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5645479386 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11120#pullrequestreview-5645479386). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-25T21:45:41Z. **Review:** APPROVED --- Reviewed head `b9d00c5d80` by 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_store` with DIM 2D-array through a 1D T# is now allowed as a runtime image mode (`RuntimeImageModes` accepts `Dim2DArray` as well as `Dim2D`), and the emitter masks the store with `address[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:** - The test file is not listed in `CMakeLists.txt` in this diff, but `libSceAgcDriver/CMakeLists.txt` globs `tests/execution/*.cpp` with `CONFIGURE_DEPENDS`, so it is built and registered. I checked that rather than assume it. - The new test covers `32_SINT` and `32_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. - `GuestBlock` frees what it allocates, and the test returns `VulkanTestSkipped` when no device is present. - `tablefrogpillow` ran it on several AMD GPUs with validation layers (details in the thread). **Nits:** - The test name `ImageStoreLineThroughPlaneArray` is not obvious (the repo says "2D-array"); consider matching the debt entry's wording. - The debt entry is edited but I would add the slice != 0 case explicitly: the store is dropped, and whether the console drops it or writes elsewhere should be marked measured or not measured. Approving. AI-assisted: yes. Written with AI assistance and reviewed by me.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!11120
No description provided.