fix(shader): write 1D storage images through 2D image stores #2348

Merged
Pipodi merged 4 commits from upstream-pr/2348 into main 2026-10-10 08:06:37 +00:00
Pipodi commented 2026-10-09 16:06:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-09T16:06:32Z.


What

A compute program of PPSA26344 (Ghost of Yōtei) writes a 1D storage image (T# type 8, 80000fac) with image_store DIM 2D. No runtime image mode matched the descriptor:

image descriptor is incompatible with the static runtime image interface

RuntimeImageModes offers a 3D mode for a 2D access and plain modes for array accesses. For a 2D access on a 1D T# it offered nothing.

  • RuntimeImageModes: a 2D storage image that is only written (not read, not atomic, not image_store_mip, not packed, BY or depth) gets a 1D mode for each of its numeric modes. The emitter already builds the coordinate from the components the mode's dimension uses, so the store addresses texel x.
  • y is ignored. That is the hardware rule, measured on RDNA2 (gfx1035) in review: for y from 0 to 4 and 0xffffffff, single- and four-component formats and a 1x1 8_8_8_8_UNORM T#, image_store DIM 2D through a 1D T# writes texel x. The T# type decides the addressing, and DIM only sets how many address VGPRs are read. EmitWriteOp is unchanged from main. TechnicalDebt records the measured rule.
  • Loads, atomics and image_store_mip through a 1D T# with DIM 2D still throw, as before. Mip stores are left out because their LOD is taken from the address component after the coordinates, which would move.

Related: #2133 and #2140 add 2D modes for 3D accesses (a 2D T# under DIM 3D). This is the same situation one dimension down, for stores, and doesn't overlap their changes.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, RTX 4090 (driver 617.42).

  • New execution test agc_driver_image_store_line_through_plane:
    • 32 lanes run two DIM 2D image_stores into a 32-texel 1D T#: x = tid with y = 0 and dmask 0xF, then y = 1 with dmask 0x5. This is done for 32_SINT and 32_32_32_32_SINT.
    • Every texel must hold the y = 1 store, as measured: its components 0 and 2, with components 1 and 3 at 0. The bytes past the texture must be untouched.
    • A read-only DIM 2D image_load through the 1D T# is still refused.
    • The test fails with the earlier y = 0 condition: texel 0 component 1 reads 0x3c6ef362 instead of 0. Without the 1D mode it fails with "image descriptor is incompatible with the static runtime image interface".
  • Full ctest: 508/508 passed.
  • PPSA26344 on an integration branch: the program above dispatches.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4802899549 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-09T16:06:32Z. --- ### What A compute program of PPSA26344 (Ghost of Yōtei) writes a 1D storage image (T# type 8, `80000fac`) with `image_store` DIM 2D. No runtime image mode matched the descriptor: ``` image descriptor is incompatible with the static runtime image interface ``` `RuntimeImageModes` offers a 3D mode for a 2D access and plain modes for array accesses. For a 2D access on a 1D T# it offered nothing. - `RuntimeImageModes`: a 2D storage image that is only written (not read, not atomic, not `image_store_mip`, not packed, BY or depth) gets a 1D mode for each of its numeric modes. The emitter already builds the coordinate from the components the mode's dimension uses, so the store addresses texel x. - y is ignored. That is the hardware rule, measured on RDNA2 (gfx1035) in review: for y from 0 to 4 and 0xffffffff, single- and four-component formats and a 1x1 8_8_8_8_UNORM T#, `image_store` DIM 2D through a 1D T# writes texel x. The T# type decides the addressing, and DIM only sets how many address VGPRs are read. `EmitWriteOp` is unchanged from `main`. TechnicalDebt records the measured rule. - Loads, atomics and `image_store_mip` through a 1D T# with DIM 2D still throw, as before. Mip stores are left out because their LOD is taken from the address component after the coordinates, which would move. Related: #2133 and #2140 add 2D modes for 3D accesses (a 2D T# under DIM 3D). This is the same situation one dimension down, for stores, and doesn't overlap their changes. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, RTX 4090 (driver 617.42). - New execution test `agc_driver_image_store_line_through_plane`: - 32 lanes run two DIM 2D `image_store`s into a 32-texel 1D T#: x = tid with y = 0 and dmask 0xF, then y = 1 with dmask 0x5. This is done for 32_SINT and 32_32_32_32_SINT. - Every texel must hold the y = 1 store, as measured: its components 0 and 2, with components 1 and 3 at 0. The bytes past the texture must be untouched. - A read-only DIM 2D `image_load` through the 1D T# is still refused. - The test fails with the earlier y = 0 condition: texel 0 component 1 reads `0x3c6ef362` instead of 0. Without the 1D mode it fails with "image descriptor is incompatible with the static runtime image interface". - Full ctest: 508/508 passed. - PPSA26344 on an integration branch: the program above dispatches. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Kikoarl commented 2026-10-09 17:27:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-09T17:27:27Z.


Linux run: Linux 7.2 (x86_64), Intel(R) Graphics (RPL-S) (Mesa 26.3.0-devel, Vulkan 1.4.363), GCC 16.2.1, Release, -DBUILD_TESTING=ON, #2348 (1716dbe7) tested on current main (0fdda7be).

  • tests/agc_driver_image_store_line_through_plane_tests: passes cleanly on Vulkan (device Intel(R) Graphics (RPL-S), image store line through plane tests passed).
  • tools/check_conventions.py: passes cleanly.
  • Tested on Linux to verify SPIR-V 1D-as-2D storage image emission across GPU vendors.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6085894466 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348#issuecomment-6085894466). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-10-09T17:27:27Z. --- Linux run: Linux 7.2 (x86_64), Intel(R) Graphics (RPL-S) (Mesa 26.3.0-devel, Vulkan 1.4.363), GCC 16.2.1, Release, `-DBUILD_TESTING=ON`, #2348 (`1716dbe7`) tested on current `main` (`0fdda7be`). - `tests/agc_driver_image_store_line_through_plane_tests`: passes cleanly on Vulkan (`device Intel(R) Graphics (RPL-S)`, `image store line through plane tests passed`). - `tools/check_conventions.py`: passes cleanly. - Tested on Linux to verify SPIR-V 1D-as-2D storage image emission across GPU vendors.
Kikoarl commented 2026-10-09 17:52:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-09T17:52:39Z.


Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at 1716dbe7:

  • Build: Built cleanly in RAM (/tmp/anyps5_build) with zero warnings/errors.
  • Conventions: python3 tools/check_conventions.py --base origin/main --head HEAD -> PASS (0 errors).
  • Verification: Verified ImageStoreLineThroughPlane.cpp execution. Correctly routes 1D image stores via 2D planes for Vulkan drivers that restrict 1D storage image writing.

LGTM!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6086304509 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348#issuecomment-6086304509). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-10-09T17:52:39Z. --- Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at `1716dbe7`: - **Build**: Built cleanly in RAM (`/tmp/anyps5_build`) with zero warnings/errors. - **Conventions**: `python3 tools/check_conventions.py --base origin/main --head HEAD` -> **PASS (0 errors)**. - **Verification**: Verified `ImageStoreLineThroughPlane.cpp` execution. Correctly routes 1D image stores via 2D planes for Vulkan drivers that restrict 1D storage image writing. LGTM!
Celegans12 commented 2026-10-10 01:58:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-10T01:58:12Z.


Could someone with the native RDNA hardware oracle measure how image_store with instruction DIM_2D behaves through a 1D T#? Does it ignore y, check y and discard some writes, or do something else? We have half-float output captures and a separate 1x1 UNORM case with all-zero destination selectors.

This would settle the unmeasured store rule in #2348. Our Yotei integration still rejects the incompatible image interface; tolerated diagnostic skips are not successful stores. Vulkan/SPIR-V execution tests, including tests on an AMD Vulkan driver, cannot settle the original instruction's semantics because they execute the emulator's chosen lowering.

Captured instructions and suggested native test

Final candidate 12 reported 154 tolerated dispatch failures at 0x80003d8400 and three at 0x8000405d00. All seven captured frames were black. We stopped the run for memory pressure at 01:25 UTC on October 10, rather than observing a crash or allocation failure. No fresh descriptor dump was captured at those failing dispatches: the instruction/descriptor pairs below come from saved historical requests and are concrete measurement cases, not confirmed descriptor values for each new failure.

The historical descriptors are:

A: 50a749b0 c4700000 000000ff 80000fac 00000000 00700000 00000000 00000000
B: 509e77eb c1d00000 000000ff 8000026c 00000000 00700000 00000000 00000000
C: 50091c00 03800000 00000000 80000000 00000000 00700000 00000000 00000000

Their fields decode as follows:

Descriptor Format Width / height Type / layout Destination selectors
A 71, 16_16_16_16_FLOAT 1024 / 1 1D / linear SW_MODE 0 R,G,B,A
B 29, 16_16_FLOAT 1024 / 1 1D / linear SW_MODE 0 R,G,1,1
C 56, 8_8_8_8_UNORM 1 / 1 1D / linear SW_MODE 0 0,0,0,0

The exact instruction/descriptor pairing comes from saved request 415904866eeb6fa2.req for shader 0x80003d8400, originally captured in the earlier drv-1 run. Its SRT at 0x2011723290 supplies A at offset 0x40 and B at 0x60; the 16-dword scalar load at shader PC 0x7c loads them into s20..s35. The current run identifies the same shader but does not dump its descriptor words; the full descriptors above come from that earlier saved capture.

C comes from saved request 486484c9782d82ea.req for shader 0x8000405d00, captured October 9. Its SRT at 0x2014976730 supplies C at offset 0x40; the load at PC 0x54 places it in s4..s11. Two other historical requests contain this same 1D variant, while three contain an ordinary 2D output in that slot. Therefore this historical variant is a possible cause of the three new failures, not a fresh-capture attribution. C has a nonzero base address; it is not an ordinary null descriptor. Measured constant-swizzle sampling does not by itself establish storage behavior.

Store Shader-relative PC Raw instruction dwords DMASK Descriptor / data / coordinates
A 0x3c4 f0202f08 00050016 0xf s20..s27 / v0..v3 / v22,v23
B 0x3f0 f0202308 00070016 0x3 s28..s35 / v0,v1 / v22,v23
C 0xc8 f0202f08 00010007 0xf s4..s11 / v0..v3 / v7,v8

All three decode as plain image_store (opcode 0x08), DIM_2D (encoding 1), A16=0, D16=0, GLC=1, SLC=0, DLC=0, R128=0, TFE=0, LWE=0 and NSA=0. There is no mip/LOD operand; the address uses two 32-bit VGPRs. The raw little-endian bytes are 08 2f 20 f0 16 00 05 00 for A, 08 23 20 f0 16 00 07 00 for B, and 08 2f 20 f0 07 00 01 00 for C. These register identities do not by themselves establish the coordinate values at execution.

Please relocate the base address into oracle-owned memory; do not reuse the guest address. Preserve the other descriptor fields and captured instruction controls when testing the captured form, and report any fields or registers changed to make a native control valid. Use DMASK 0xf for A/C and 0x3 for B in the first measurements, and report the assembled bytes after adapting the registers to the oracle harness.

The existing hardware oracle should suffice. Crucially, #2237's native gfx1036 measurement found that DIM_2D image_load and image_sample_lz through 1D T#s ignore y, including nonzero y for loads. That differs from #2023's 3D-load/2D-T# result, where nonzero z returns zero. #2237 measured only reads; #1379's native stores use the opposite mismatch direction. These results are why this store needs its own measurement, without assuming either ignored y or discarded writes.

Suggested half-float measurement matrix, repeated for A and B:

Case Native instruction / coordinates Purpose
Control DIM_1D, x=0, 1, 1023 Establish that the descriptor, conversion and readback actually work.
Mismatched y=0 DIM_2D, those same x values, y=0 Compare directly with the native 1D control.
Extra coordinate DIM_2D, x=0, 1, 1023 with y=1 and y=2 Distinguish discarded writes, ignored y, and writes elsewhere.
x boundary DIM_2D, x=1024 with y=0, 1 and 2 Establish behavior immediately outside the declared width; inspect guard storage.
Control x boundary DIM_1D, x=1024 Separate ordinary x bounds from the dimensional mismatch.

Use fresh sentinel-filled storage per trial. First write baseline=(1,2,3,4) through the valid native control, then issue the tested store with replacement=(8,16,32,64). These values are exactly representable in half precision. For RG16_FLOAT only the first two stored components matter. A retained baseline texel, a replacement texel and changed guard storage distinguish the competing behaviors. Start with the captured masks above; separately repeat the core y=0/y=1 cases with DMASK 0x5, since #2348's proposed test uses it and missing write components can become zero. The DIM_1D control should use the same mask as its mismatched counterpart.

For C, keep the 1x1 RGBA8_UNORM layout and run this separate matrix twice: first with its captured all-zero selectors (word3=80000000), then with only those selectors changed to identity (word3=80000fac). Keep DMASK 0xf and GLC=1 in both sets.

Case Native instruction / coordinates Purpose
Native control DIM_1D, x=0 Establish whether and what the all-zero-selector descriptor writes; compare identity selectors.
Extra coordinate DIM_2D, x=0, y=0, 1, 2 Distinguish ignored y, discarded writes, selector behavior and writes elsewhere.
x boundary DIM_1D x=1; DIM_2D x=1 with y=0, 1, 2 Check the first out-of-bounds x independently of the extra coordinate.

For each C trial, retain the runner's initial raw sentinel 0xeeeeeeee in the texel and surrounding guards, then issue one tested store with data (1,0,1,0). Repeat with (0,1,0,1). The values are exactly representable UNORM endpoints, distinct from the sentinel. Do not use an image-store baseline for C: if zero selectors force every write to the same value, two image stores could conceal an overwrite. Inspect raw bytes, including both guards. If the native DIM_1D all-zero control itself leaves the sentinel unchanged, report that observation separately; it cannot establish the DIM_2D y rule. The identity-selector controls keep the coordinate question independently observable.

An existing-harness setup can return the raw memory without changing the C runner: submit exactly 512 rows in one workgroup, AND the existing EXEC with the comparison v0==0 for stores, and leave it masked for the template's output stores. Do not set EXEC to the literal 1, which would activate one lane in every wave. The runner allocates 512*64 = 32768 output bytes, initialized to 0xee. Put the image at align_up(output + 256, 256); the template epilogue then writes only the first 64 bytes, leaving image and guards intact. Record the image offset in lane 0's result. That allocation covers the 8192-byte RGBA16_FLOAT image plus the tested y=1/2 row-equivalent guard regions and x=1024; RG16_FLOAT and the separate four-byte C case require less. Keep all 512 result rows so host readback includes those bytes. Use a separate run per case and complete any baseline store before the tested replacement store. The runner's SYSTEM completion fence and host readback supply raw image bytes, avoiding both cross-lane races and an image-load result that could hide an unintended write. Do not use the extra/input allocation as the only observable target: this runner returns output memory, not modified input bytes.

Useful result attachment: GPU model/gfx target, driver/HSA and LLVM versions, wave size and every oracle floating-point control, the eight relocated descriptor words, assembled instruction bytes, kernel/rows source, and a table of raw before/after texels and guards for each case. Report the observed behavior, including unchanged memory or writes outside the declared image. RDNA2 gfx103x evidence would answer the immediate question; label it accurately rather than calling it a PS5 measurement.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6092447191 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348#issuecomment-6092447191). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-10T01:58:12Z. --- Could someone with the native RDNA hardware oracle measure how `image_store` with instruction DIM_2D behaves through a **1D T#**? Does it ignore y, check y and discard some writes, or do something else? We have half-float output captures and a separate 1x1 UNORM case with all-zero destination selectors. This would settle the unmeasured store rule in #2348. Our Yotei integration still rejects the incompatible image interface; tolerated diagnostic skips are not successful stores. Vulkan/SPIR-V execution tests, including tests on an AMD Vulkan driver, cannot settle the original instruction's semantics because they execute the emulator's chosen lowering. <details> <summary>Captured instructions and suggested native test</summary> Final candidate 12 reported 154 tolerated dispatch failures at `0x80003d8400` and three at `0x8000405d00`. All seven captured frames were black. We stopped the run for memory pressure at 01:25 UTC on October 10, rather than observing a crash or allocation failure. No fresh descriptor dump was captured at those failing dispatches: the instruction/descriptor pairs below come from saved historical requests and are concrete measurement cases, not confirmed descriptor values for each new failure. The historical descriptors are: ```text A: 50a749b0 c4700000 000000ff 80000fac 00000000 00700000 00000000 00000000 B: 509e77eb c1d00000 000000ff 8000026c 00000000 00700000 00000000 00000000 C: 50091c00 03800000 00000000 80000000 00000000 00700000 00000000 00000000 ``` Their fields decode as follows: | Descriptor | Format | Width / height | Type / layout | Destination selectors | | --- | --- | --- | --- | --- | | A | 71, 16_16_16_16_FLOAT | 1024 / 1 | 1D / linear SW_MODE 0 | R,G,B,A | | B | 29, 16_16_FLOAT | 1024 / 1 | 1D / linear SW_MODE 0 | R,G,1,1 | | C | 56, 8_8_8_8_UNORM | 1 / 1 | 1D / linear SW_MODE 0 | 0,0,0,0 | The exact instruction/descriptor pairing comes from saved request `415904866eeb6fa2.req` for shader `0x80003d8400`, originally captured in the earlier `drv-1` run. Its SRT at `0x2011723290` supplies A at offset `0x40` and B at `0x60`; the 16-dword scalar load at shader PC `0x7c` loads them into s20..s35. The current run identifies the same shader but does not dump its descriptor words; the full descriptors above come from that earlier saved capture. C comes from saved request `486484c9782d82ea.req` for shader `0x8000405d00`, captured October 9. Its SRT at `0x2014976730` supplies C at offset `0x40`; the load at PC `0x54` places it in s4..s11. Two other historical requests contain this same 1D variant, while three contain an ordinary 2D output in that slot. Therefore this historical variant is a possible cause of the three new failures, not a fresh-capture attribution. C has a nonzero base address; it is not an ordinary null descriptor. Measured constant-swizzle sampling does not by itself establish storage behavior. | Store | Shader-relative PC | Raw instruction dwords | DMASK | Descriptor / data / coordinates | | --- | --- | --- | --- | --- | | A | `0x3c4` | `f0202f08 00050016` | `0xf` | s20..s27 / v0..v3 / v22,v23 | | B | `0x3f0` | `f0202308 00070016` | `0x3` | s28..s35 / v0,v1 / v22,v23 | | C | `0xc8` | `f0202f08 00010007` | `0xf` | s4..s11 / v0..v3 / v7,v8 | All three decode as plain `image_store` (opcode `0x08`), DIM_2D (encoding 1), A16=0, D16=0, GLC=1, SLC=0, DLC=0, R128=0, TFE=0, LWE=0 and NSA=0. There is no mip/LOD operand; the address uses two 32-bit VGPRs. The raw little-endian bytes are `08 2f 20 f0 16 00 05 00` for A, `08 23 20 f0 16 00 07 00` for B, and `08 2f 20 f0 07 00 01 00` for C. These register identities do not by themselves establish the coordinate values at execution. Please relocate the base address into oracle-owned memory; do not reuse the guest address. Preserve the other descriptor fields and captured instruction controls when testing the captured form, and report any fields or registers changed to make a native control valid. Use DMASK 0xf for A/C and 0x3 for B in the first measurements, and report the assembled bytes after adapting the registers to the oracle harness. The existing [hardware oracle](https://github.com/boykopovar/AnyPS5/blob/1f0c9fef5645bbb02d82d5efd28927baca95bfd5/docs/dev/HW_ORACLE.md) should suffice. Crucially, [#2237's native gfx1036 measurement](https://github.com/boykopovar/AnyPS5/issues/2237#issuecomment-6086167872) found that DIM_2D `image_load` and `image_sample_lz` through 1D T#s ignore y, including nonzero y for loads. That differs from [#2023's 3D-load/2D-T# result](https://github.com/boykopovar/AnyPS5/issues/2023#issuecomment-6076256002), where nonzero z returns zero. #2237 measured only reads; [#1379's native stores](https://github.com/boykopovar/AnyPS5/pull/1379#issuecomment-6060102741) use the opposite mismatch direction. These results are why this store needs its own measurement, without assuming either ignored y or discarded writes. Suggested half-float measurement matrix, repeated for A and B: | Case | Native instruction / coordinates | Purpose | | --- | --- | --- | | Control | DIM_1D, x=0, 1, 1023 | Establish that the descriptor, conversion and readback actually work. | | Mismatched y=0 | DIM_2D, those same x values, y=0 | Compare directly with the native 1D control. | | Extra coordinate | DIM_2D, x=0, 1, 1023 with y=1 and y=2 | Distinguish discarded writes, ignored y, and writes elsewhere. | | x boundary | DIM_2D, x=1024 with y=0, 1 and 2 | Establish behavior immediately outside the declared width; inspect guard storage. | | Control x boundary | DIM_1D, x=1024 | Separate ordinary x bounds from the dimensional mismatch. | Use fresh sentinel-filled storage per trial. First write baseline=(1,2,3,4) through the valid native control, then issue the tested store with replacement=(8,16,32,64). These values are exactly representable in half precision. For RG16_FLOAT only the first two stored components matter. A retained baseline texel, a replacement texel and changed guard storage distinguish the competing behaviors. Start with the captured masks above; separately repeat the core y=0/y=1 cases with DMASK 0x5, since #2348's proposed test uses it and missing write components can become zero. The DIM_1D control should use the same mask as its mismatched counterpart. For C, keep the 1x1 RGBA8_UNORM layout and run this separate matrix twice: first with its captured all-zero selectors (`word3=80000000`), then with only those selectors changed to identity (`word3=80000fac`). Keep DMASK 0xf and GLC=1 in both sets. | Case | Native instruction / coordinates | Purpose | | --- | --- | --- | | Native control | DIM_1D, x=0 | Establish whether and what the all-zero-selector descriptor writes; compare identity selectors. | | Extra coordinate | DIM_2D, x=0, y=0, 1, 2 | Distinguish ignored y, discarded writes, selector behavior and writes elsewhere. | | x boundary | DIM_1D x=1; DIM_2D x=1 with y=0, 1, 2 | Check the first out-of-bounds x independently of the extra coordinate. | For each C trial, retain the runner's initial raw sentinel `0xeeeeeeee` in the texel and surrounding guards, then issue one tested store with data `(1,0,1,0)`. Repeat with `(0,1,0,1)`. The values are exactly representable UNORM endpoints, distinct from the sentinel. Do not use an image-store baseline for C: if zero selectors force every write to the same value, two image stores could conceal an overwrite. Inspect raw bytes, including both guards. If the native DIM_1D all-zero control itself leaves the sentinel unchanged, report that observation separately; it cannot establish the DIM_2D y rule. The identity-selector controls keep the coordinate question independently observable. An existing-harness setup can return the raw memory without changing the C runner: submit exactly 512 rows in one workgroup, AND the existing EXEC with the comparison v0==0 for stores, and leave it masked for the template's output stores. Do not set EXEC to the literal 1, which would activate one lane in every wave. The runner allocates 512*64 = 32768 output bytes, initialized to 0xee. Put the image at `align_up(output + 256, 256)`; the template epilogue then writes only the first 64 bytes, leaving image and guards intact. Record the image offset in lane 0's result. That allocation covers the 8192-byte RGBA16_FLOAT image plus the tested y=1/2 row-equivalent guard regions and x=1024; RG16_FLOAT and the separate four-byte C case require less. Keep all 512 result rows so host readback includes those bytes. Use a separate run per case and complete any baseline store before the tested replacement store. The runner's SYSTEM completion fence and host readback supply raw image bytes, avoiding both cross-lane races and an image-load result that could hide an unintended write. Do not use the `extra`/input allocation as the only observable target: this runner returns output memory, not modified input bytes. Useful result attachment: GPU model/gfx target, driver/HSA and LLVM versions, wave size and every oracle floating-point control, the eight relocated descriptor words, assembled instruction bytes, kernel/rows source, and a table of raw before/after texels and guards for each case. Report the observed behavior, including unchanged memory or writes outside the declared image. RDNA2 gfx103x evidence would answer the immediate question; label it accurately rather than calling it a PS5 measurement. </details>
adriadam10 commented 2026-10-10 06:02:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:02:35Z.

Review: CHANGES_REQUESTED


Measured on RDNA2 (gfx1035) with tools/hw-oracle, answering @Celegans12's question: image_store with DIM 2D through a 1D T# (type 8) ignores y. It writes texel x for every y, so the y ≠ 0 drop doesn't match hardware.

T# store result
1D, width 32, height field 0 or 3, 32_SINT DIM 2D, x = lane, y = 0, 1, 2, 3, 4, 0xffffffff texel x written for every y
1D, 32_32_32_32_SINT y = 0 dmask 0xf, then y = 1 dmask 0x5 the y = 1 store overwrites texel x: components 0/2 from it, 1/3 become 0
1D, 32_32_32_32_SINT y = 3 dmask 0xf texel x written
1D 1x1 8_8_8_8_UNORM, dst_sel all 0 or identity y = 1, x = 0 texel 0 written
2D, height 1 (control) y = 1 dropped, nothing written
2D, height 4 (control) y = 1 row 1 written

As with the 3D-on-2D cases in #2023/#2140, the T# type decides the addressing and DIM only sets how many address VGPRs are read. A 1D T# isn't a one-texel-high 2D image.

Requested changes:

  • SpirvImageEmitter.cpp:987-991: drop the y == 0 condition. The 1D mode already builds the coordinate from x only, so the store should just write texel x.
  • ImageStoreLineThroughPlane.cpp:165: the test should pin the hardware result. After the y = 1 store with dmask 0x5, texel x holds that store's components 0 and 2, and components 1 and 3 are 0 (unmasked components are zeroed, which StoreTexel already does). Keep the "bytes past the texture" check and the refused image_load.
  • TechnicalDebt.md:284: replace "dropped otherwise ... not measured" with the measured rule (y ignored, measured on gfx1035), or remove the line if nothing unverified is left.

Build, the PR's test and a negative run (the test fails without the change) are fine locally, and there are no conflicts with #2133/#2140.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5477887355 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348#pullrequestreview-5477887355). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T06:02:35Z. **Review:** CHANGES_REQUESTED --- Measured on RDNA2 (gfx1035) with `tools/hw-oracle`, answering @Celegans12's question: `image_store` with DIM 2D through a 1D T# (type 8) **ignores y**. It writes texel x for every y, so the y ≠ 0 drop doesn't match hardware. | T# | store | result | |---|---|---| | 1D, width 32, height field 0 or 3, 32_SINT | DIM 2D, x = lane, y = 0, 1, 2, 3, 4, 0xffffffff | texel x written for every y | | 1D, 32_32_32_32_SINT | y = 0 dmask 0xf, then y = 1 dmask 0x5 | the y = 1 store overwrites texel x: components 0/2 from it, 1/3 become 0 | | 1D, 32_32_32_32_SINT | y = 3 dmask 0xf | texel x written | | 1D 1x1 8_8_8_8_UNORM, dst_sel all 0 or identity | y = 1, x = 0 | texel 0 written | | 2D, height 1 (control) | y = 1 | dropped, nothing written | | 2D, height 4 (control) | y = 1 | row 1 written | As with the 3D-on-2D cases in #2023/#2140, the T# type decides the addressing and DIM only sets how many address VGPRs are read. A 1D T# isn't a one-texel-high 2D image. Requested changes: - `SpirvImageEmitter.cpp:987-991`: drop the `y == 0` condition. The 1D mode already builds the coordinate from x only, so the store should just write texel x. - `ImageStoreLineThroughPlane.cpp:165`: the test should pin the hardware result. After the y = 1 store with dmask 0x5, texel x holds that store's components 0 and 2, and components 1 and 3 are 0 (unmasked components are zeroed, which `StoreTexel` already does). Keep the "bytes past the texture" check and the refused `image_load`. - `TechnicalDebt.md:284`: replace "dropped otherwise ... not measured" with the measured rule (y ignored, measured on gfx1035), or remove the line if nothing unverified is left. Build, the PR's test and a negative run (the test fails without the change) are fine locally, and there are no conflicts with #2133/#2140.
Pipodi commented 2026-10-10 06:44:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-10T06:44:38Z.


@adriadam10 thanks for measuring it. All three are in 601f4a1b:

  • SpirvImageEmitter.cpp: the y == 0 condition is gone, so the file is back to main. The 1D mode builds the coordinate from x, so the store writes texel x for any y.
  • ImageStoreLineThroughPlane.cpp: the test pins your result. After the y = 1 store with dmask 0x5, texel x holds that store's components 0 and 2, and components 1 and 3 are 0. The past-the-texture check and the refused image_load stay. With the old condition back, the test fails: texel 0 component 1 reads 0x3c6ef362 instead of 0.
  • TechnicalDebt.md: the line now gives the measured rule (y ignored, gfx1035) and keeps only the unimplemented loads, atomics and image_store_mip.

Full ctest 508/508 on Windows 11, MinGW-w64 GCC 15.2.0, RTX 4090. The description is updated.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094773273 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348#issuecomment-6094773273). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-10T06:44:38Z. --- @adriadam10 thanks for measuring it. All three are in `601f4a1b`: - `SpirvImageEmitter.cpp`: the `y == 0` condition is gone, so the file is back to `main`. The 1D mode builds the coordinate from x, so the store writes texel x for any y. - `ImageStoreLineThroughPlane.cpp`: the test pins your result. After the y = 1 store with dmask 0x5, texel x holds that store's components 0 and 2, and components 1 and 3 are 0. The past-the-texture check and the refused `image_load` stay. With the old condition back, the test fails: texel 0 component 1 reads `0x3c6ef362` instead of 0. - `TechnicalDebt.md`: the line now gives the measured rule (y ignored, gfx1035) and keeps only the unimplemented loads, atomics and `image_store_mip`. Full ctest 508/508 on Windows 11, MinGW-w64 GCC 15.2.0, RTX 4090. The description is updated.
adriadam10 commented 2026-10-10 07:53:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T07:53:25Z.

Review: APPROVED


Rebased onto current main (adjacency conflict in ResourceMaterializer.cpp with the new 3D→2D plane mode; both blocks kept, plus one small commit closing a brace).

Checked: agc_driver_image_store_line_through_plane passes on a real Vulkan device after the rebase, fails without the ResourceMaterializer.cpp change, and the AgcDriver/Agc ctest scope is green (333/333). The y-ignored rule matches our gfx1035 measurement, and the TechnicalDebt line is in place.

Note: #2140 touches the same spot in RuntimeImageModes; whichever lands second needs a trivial rebase.

Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5478207717 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348#pullrequestreview-5478207717). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T07:53:25Z. **Review:** APPROVED --- Rebased onto current `main` (adjacency conflict in `ResourceMaterializer.cpp` with the new 3D→2D `plane` mode; both blocks kept, plus one small commit closing a brace). Checked: `agc_driver_image_store_line_through_plane` passes on a real Vulkan device after the rebase, fails without the `ResourceMaterializer.cpp` change, and the AgcDriver/Agc ctest scope is green (333/333). The y-ignored rule matches our gfx1035 measurement, and the TechnicalDebt line is in place. Note: #2140 touches the same spot in `RuntimeImageModes`; whichever lands second needs a trivial rebase. Merging.
adriadam10 commented 2026-10-10 07:59:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T07:59:58Z.


Rebased again onto current main: it conflicted after #2237's 2D→1D T# change (eb06284c7) landed.

One small commit added on top: agc_driver_image_store_line_through_plane asserted that a read-only DIM 2D image_load through a 1D T# is refused, which main now accepts. I removed that check (and its unused shader), and the TechnicalDebt line now says storage loads, atomics and image_store_mip still throw.

Checked: the AgcDriver/Agc ctest scope is green (332/332) with the test passing on a real Vulkan device, and the test still fails without the ResourceMaterializer.cpp change.

Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095411211 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348#issuecomment-6095411211). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T07:59:58Z. --- Rebased again onto current `main`: it conflicted after #2237's 2D→1D T# change (`eb06284c7`) landed. One small commit added on top: `agc_driver_image_store_line_through_plane` asserted that a read-only DIM 2D `image_load` through a 1D T# is refused, which `main` now accepts. I removed that check (and its unused shader), and the TechnicalDebt line now says storage loads, atomics and `image_store_mip` still throw. Checked: the AgcDriver/Agc ctest scope is green (332/332) with the test passing on a real Vulkan device, and the test still fails without the `ResourceMaterializer.cpp` change. Merging once CI is green.
Celegans12 commented 2026-10-10 12:31:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-10T12:31:48Z.


Now that #2348 is merged, could you extend the gfx1035 store measurement to image_store DIM_2D_ARRAY through a 1D T#? The measured rule and merged implementation cover ordinary DIM_2D; the array instruction's extra layer operand remains unmeasured.

With that store fix applied, our Yōtei run captured a separate array-store interface refusal. The descriptor is non-null, linear 1×1 8_8_8_8_UNORM, with all four destination selectors zero. The instruction uses DMASK 0xf, GLC=1, 32-bit x/y/layer coordinates and 32-bit data. All 16 retained requests have zero in a uniform flag that skips this store. That flag remains runtime-loaded, and these snapshots do not establish native behavior when the store executes or the lane values of y and layer.

The existing synthetic native probe should need only the array DIM encoding and one additional address VGPR; there is no need for game shader code or request files. Please keep the captured descriptor fields and DMASK, relocate the base into oracle-owned memory, and compare with the same descriptor using identity selectors as a separate control.

Small synthetic measurement matrix

Use T# type8 (SQ_RSRC_IMG_1D), format56 (8_8_8_8_UNORM), WIDTH=HEIGHT=DEPTH=0 fields (one texel), SW_MODE=0, zero destination selectors. Preserve the remaining captured descriptor fields: word4=0, word5=0x00700000, word6=word7=0; word1 has format bits 0x03800000 plus only the relocated address bits, word2=0, word3=0x80000000. For the identity-selector control, change only word3 to 0x80000fac. Use image_store without mip/LOD, DMASK 0xf, GLC=1, A16=D16=NSA=R128=0; report the assembled bytes and any additional flags needed by the harness.

Access Coordinates Purpose
DIM_1D control x=0 and x=1 Establish the write and ordinary x bounds for each selector setting.
Existing DIM_2D control x=0; y=0,1,2,0xffffffff Recheck the measured ignored-y behavior with this descriptor.
DIM_2D_ARRAY x=0; cross y and layer independently over 0,1,2,0xffffffff Distinguish ignored coordinates, discarded writes, and writes elsewhere; do not vary y and layer together only.
DIM_2D_ARRAY x bound x=1; (y,layer)=(0,0),(0,1),(1,0) Compare with the ordinary 1D out-of-bounds control.

Use fresh raw sentinel-filled output and guard storage for each trial, then one store of (1,0,1,0); repeat with (0,1,0,1). Keep DMASK 0xf throughout this core matrix so missing-component behavior is not mixed with the layer question. Inspect raw memory rather than loading it back through an image instruction, and do not initialize the texel with another image store: that could conceal the all-zero-selector result. Keep only the intended lane active and preserve the existing probe's output-buffer/guard arrangement.

Please report the GPU/gfx target, wave size, floating-point controls, relocated eight-word T#, assembled instruction and raw texel/guard results, including unchanged sentinel bytes or unexpected addresses. This asks what the hardware does; it does not assume that either y or layer is ignored.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6097521628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348#issuecomment-6097521628). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-10T12:31:48Z. --- Now that #2348 is merged, could you extend the [gfx1035 store measurement](https://github.com/boykopovar/AnyPS5/pull/2348#pullrequestreview-5477887355) to `image_store DIM_2D_ARRAY` through a 1D T#? The measured rule and merged implementation cover ordinary DIM_2D; the array instruction's extra layer operand remains unmeasured. With that store fix applied, our Yōtei run captured a separate array-store interface refusal. The descriptor is non-null, linear 1×1 `8_8_8_8_UNORM`, with all four destination selectors zero. The instruction uses DMASK `0xf`, GLC=1, 32-bit x/y/layer coordinates and 32-bit data. All 16 retained requests have zero in a uniform flag that skips this store. That flag remains runtime-loaded, and these snapshots do not establish native behavior when the store executes or the lane values of y and layer. The existing synthetic native probe should need only the array DIM encoding and one additional address VGPR; there is no need for game shader code or request files. Please keep the captured descriptor fields and DMASK, relocate the base into oracle-owned memory, and compare with the same descriptor using identity selectors as a separate control. <details> <summary>Small synthetic measurement matrix</summary> Use T# type8 (`SQ_RSRC_IMG_1D`), format56 (`8_8_8_8_UNORM`), WIDTH=HEIGHT=DEPTH=0 fields (one texel), SW_MODE=0, zero destination selectors. Preserve the remaining captured descriptor fields: word4=0, word5=`0x00700000`, word6=word7=0; word1 has format bits `0x03800000` plus only the relocated address bits, word2=0, word3=`0x80000000`. For the identity-selector control, change only word3 to `0x80000fac`. Use `image_store` without mip/LOD, DMASK `0xf`, GLC=1, A16=D16=NSA=R128=0; report the assembled bytes and any additional flags needed by the harness. | Access | Coordinates | Purpose | |---|---|---| | DIM_1D control | x=0 and x=1 | Establish the write and ordinary x bounds for each selector setting. | | Existing DIM_2D control | x=0; y=0,1,2,`0xffffffff` | Recheck the measured ignored-y behavior with this descriptor. | | DIM_2D_ARRAY | x=0; cross y and layer independently over 0,1,2,`0xffffffff` | Distinguish ignored coordinates, discarded writes, and writes elsewhere; do not vary y and layer together only. | | DIM_2D_ARRAY x bound | x=1; (y,layer)=(0,0),(0,1),(1,0) | Compare with the ordinary 1D out-of-bounds control. | Use fresh raw sentinel-filled output and guard storage for each trial, then one store of `(1,0,1,0)`; repeat with `(0,1,0,1)`. Keep DMASK `0xf` throughout this core matrix so missing-component behavior is not mixed with the layer question. Inspect raw memory rather than loading it back through an image instruction, and do not initialize the texel with another image store: that could conceal the all-zero-selector result. Keep only the intended lane active and preserve the existing probe's output-buffer/guard arrangement. Please report the GPU/gfx target, wave size, floating-point controls, relocated eight-word T#, assembled instruction and raw texel/guard results, including unchanged sentinel bytes or unexpected addresses. This asks what the hardware does; it does not assume that either y or layer is ignored. </details>
Pipodi commented 2026-10-10 12:57:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-10T12:57:26Z.


@Celegans12 I can't run that probe: I only have an RTX 4090, no RDNA hardware. The gfx1035 measurement in this PR was @adriadam10's, with tools/hw-oracle. @adriadam10, would you be able to run the DIM_2D_ARRAY matrix above?

For context, Yōtei hits it on 0x80002c4500 as well. Locally I gave write-only DIM_2D_ARRAY storage accesses the same 1D mode as DIM_2D (x only; y and layer ignored, unmeasured), and the title got past that shader. That's a bring-up workaround until the layer behaviour is measured, not something I'd propose as is.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6097737538 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2348#issuecomment-6097737538). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-10T12:57:26Z. --- @Celegans12 I can't run that probe: I only have an RTX 4090, no RDNA hardware. The gfx1035 measurement in this PR was @adriadam10's, with `tools/hw-oracle`. @adriadam10, would you be able to run the DIM_2D_ARRAY matrix above? For context, Yōtei hits it on `0x80002c4500` as well. Locally I gave write-only DIM_2D_ARRAY storage accesses the same 1D mode as DIM_2D (x only; y and layer ignored, unmeasured), and the title got past that shader. That's a bring-up workaround until the layer behaviour is measured, not something I'd propose as is.
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!2348
No description provided.