docs(debt): measure DIM 3D stores through 2D and 2D-array T#s #17807

Merged
brumskysb merged 1 commit from upstream-pr/17807 into main 2026-11-12 07:32:52 +00:00
brumskysb commented 2026-11-09 16:50:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by brumskysb on 2026-11-09T16:50:49Z.


What

Measures the stores item of the gap clause in the 3D image accesses bound to a 2D or 2D-array T# entry of docs/dev/debt/shader.md: what a DIM 3D image_store does through a 2D T# and through a 2D-array T#.

Measured on gfx1036 (driver 31.0.22044.1) with the hardware oracle, wave32, one work-group, 64 rows, 8x8 32_FLOAT (format 22), 256-byte pitch, one mip, dmask 0x1, a 64 KiB 0xCD marker backing read back in full (16,384 dwords) after every leg, each texel stored with its own fingerprint 0x3F800000 + layer*64 + y*8 + x:

  • 2D T# (type 9): z 0 writes exactly the 64 (x,y) texels and no byte outside the 2,048-byte face; z 1 writes 0 of 16,384 dwords; a mixed dispatch (even lanes z 0, odd lanes z 1) writes exactly the 32 z-0 texels, so the drop is per lane, not per dispatch; image_store_mip at mip 0 writes the same 64 texels as the plain store.
  • 2D-array T# (type 13, DEPTH 1 = two layers): z 0 writes layer 0 only, z 1 layer 1 only (first moved byte 2,048), each leg leaving the other layer at the marker; z 2 writes 0 of 16,384 dwords — it does not clamp into the last layer; image_store_mip at mip 0 writes the same 64 texels as the plain store.
  • Control first: the entry's published DIM 3D image_load rule reproduced on this rig before any store (2D T#: (x,y) texel at z 0, zero for z 1, 4 and -1; 2D-array: z is the layer, 64/64 lanes each). That is a same-SKU reproduction of CouchRiv's gfx1036 rule on a different rig and driver, not a re-measurement of their numbers.
  • Determinism: step 2's z-0 leg and step 3's z-1 leg re-run from fresh processes — 16,384/16,384 dwords identical each, with the rig-side out.bin deleted and verified absent before every one of the 32 dispatches and the rig's code-object SHA-256 equal to the locally assembled one 32/32.

The measured 2D-array rule (layer select, a past-the-end layer writes nothing) agrees with what the recompiler already implements for that case (arrayStore in ResourceMaterializer.cpp, ArraySliceAddress + VolumeSliceInRange in SpirvImageEmitter.cpp, execution test ImageStoreVolumeThroughArray.cpp), so the entry's "stores ... keep throwing" was already stale for the 2D-array half. For a 2D T# the flat-volume runtime modes are !storage and flatVolumeCompatible admits only loads, image_sample_lz and queries, so that store still throws; the entry now says which half is implemented. Both of those are code readings, not measurements; no code changes in this PR.

Evidence (fixture, scripts, all six dumps, verifiers, claims worksheet, full results): https://gist.github.com/brumskysb/1dbfc6a1dddebdc046e43762747372ac

Tested

  • GPU: AMD Radeon(TM) Graphics, integrated RDNA2, gfx1036, driver 31.0.22044.1, Windows 11; harness tools/hw-oracle through rig_runner.py, wave32, 64 rows, one work-group.
  • Bodies: image_store v4, v[5:7], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D (encoding F0200110 00020405) and image_store_mip v4, v[5:8], ... with the mip level in v8, the fourth address component (encoding F0240110 00020405), then s_waitcnt vmcnt(0) and the readback.
  • T# dwords 1-4 c1600000 0001c001 90000fac 00000000 (2D) and c1600000 0001c001 d0000fac 00000001 (2D-array), re-decoded from every leg's own stored body text (format 22, 8x8, type 9 / 13, DEPTH 0 / 1, BASE_ARRAY 0) before any count was taken.
  • 6 + 64 + 64 + 32 dispatches; step2_verify.py, step3_verify.py and step4_verify.py recompute every count from the archived dumps (DUMP RECOMPUTE OK). Dump SHA-256: step 2 75c1a26d…0768f8, step 3 650dc644…736432da, matching the gist's raw files.
  • Descriptor axis: 2D (type 9) and 2D-array (type 13), the two the entry names; no other descriptor type is claimed.

The replaced region, copied from check_entry_edit.py's REPLACED REGION:

- gathers, `image_get_lod` and stores,
+ gathers and `image_get_lod`, keeps throwing because it is not measured. DIM 3D `image_store` and `image_store_mip` at mip 0 were measured on RDNA2 (gfx1036, driver 31.0.22044.1) with the hardware oracle, `dmask` 0x1 on an 8x8 32_FLOAT T#: on a 2D T# a lane writes its (x,y) texel when z is 0 and nothing when z is 1; on a two-layer 2D-array T# z is the layer and z 2 writes nothing. The recompiler implements the 2D-array store; a store through a 2D T# keeps throwing.

before:
... Every other access of such an image, including samples with an LOD, bias, derivatives, offset or comparison, gathers, image_get_lod and stores, keeps throwing because it is not measured.

after:
... Every other access of such an image, including samples with an LOD, bias, derivatives, offset or comparison, gathers and image_get_lod, keeps throwing because it is not measured. DIM 3D image_storeandimage_store_mipat mip 0 were measured on RDNA2 (gfx1036, driver 31.0.22044.1) with the hardware oracle,dmask 0x1 on an 8x8 32_FLOAT T#: on a 2D T# a lane writes its (x,y) texel when z is 0 and nothing when z is 1; on a two-layer 2D-array T# z is the layer and z 2 writes nothing. The recompiler implements the 2D-array store; a store through a 2D T# keeps throwing.

Removed phrases declared to the gate: gathers, image_get_lod`` and stores, — the list loses only "and stores"; samples with an LOD, bias, derivatives, offset or comparison, gathers and image_get_lod stay named as unmeasured, and the CouchRiv/adriadam10 provenance and "not the PS5's gfx1013" are untouched.

Notes

  • debt-length warning: the entry grows from 836 to 1,225 characters, 225 over the 1,000 guideline. No measured condition was compressed to fit; trimming the entry is its own PR.
  • Not covered, and the new sentence does not claim it: other formats, multi-component dmask, z other than 0 and 1 on a 2D T#, negative z, arrays of more than two layers, mip levels other than 0, and the PS5's gfx1013.
  • Overlap: the 300 most recent open PRs were scanned; 7 touch docs/dev/debt/shader.md (#17733, #17701, #17623, #17611, #17606, #17605, #17523) and none of them edits this entry.

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 (attached 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: none
  • GPUs tested: AMD Radeon(TM) Graphics (gfx1036, driver 31.0.22044.1, Windows 11)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5227641724 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17807). Originally posted by [brumskysb](https://github.com/brumskysb) on 2026-11-09T16:50:49Z. --- ### What Measures the **stores** item of the gap clause in the **3D image accesses bound to a 2D or 2D-array T#** entry of `docs/dev/debt/shader.md`: what a DIM 3D `image_store` does through a 2D T# and through a 2D-array T#. Measured on gfx1036 (driver **31.0.22044.1**) with the hardware oracle, wave32, one work-group, 64 rows, 8x8 `32_FLOAT` (format 22), 256-byte pitch, one mip, `dmask 0x1`, a 64 KiB `0xCD` marker backing read back in full (16,384 dwords) after every leg, each texel stored with its own fingerprint `0x3F800000 + layer*64 + y*8 + x`: - **2D T# (type 9):** z 0 writes exactly the 64 (x,y) texels and no byte outside the 2,048-byte face; z 1 writes **0 of 16,384** dwords; a mixed dispatch (even lanes z 0, odd lanes z 1) writes exactly the 32 z-0 texels, so the drop is per lane, not per dispatch; `image_store_mip` at mip 0 writes the same 64 texels as the plain store. - **2D-array T# (type 13, DEPTH 1 = two layers):** z 0 writes layer 0 only, z 1 layer 1 only (first moved byte 2,048), each leg leaving the other layer at the marker; z 2 writes **0 of 16,384** dwords — it does not clamp into the last layer; `image_store_mip` at mip 0 writes the same 64 texels as the plain store. - **Control first:** the entry's published DIM 3D `image_load` rule reproduced on this rig before any store (2D T#: (x,y) texel at z 0, zero for z 1, 4 and -1; 2D-array: z is the layer, 64/64 lanes each). That is a same-SKU reproduction of CouchRiv's gfx1036 rule on a different rig and driver, not a re-measurement of their numbers. - **Determinism:** step 2's z-0 leg and step 3's z-1 leg re-run from fresh processes — **16,384/16,384 dwords identical each**, with the rig-side `out.bin` deleted and verified absent before every one of the 32 dispatches and the rig's code-object SHA-256 equal to the locally assembled one 32/32. The measured 2D-array rule (layer select, a past-the-end layer writes nothing) agrees with what the recompiler already implements for that case (`arrayStore` in `ResourceMaterializer.cpp`, `ArraySliceAddress` + `VolumeSliceInRange` in `SpirvImageEmitter.cpp`, execution test `ImageStoreVolumeThroughArray.cpp`), so the entry's "stores ... keep throwing" was already stale for the 2D-array half. For a 2D T# the flat-volume runtime modes are `!storage` and `flatVolumeCompatible` admits only loads, `image_sample_lz` and queries, so that store still throws; the entry now says which half is implemented. Both of those are code readings, not measurements; no code changes in this PR. Evidence (fixture, scripts, all six dumps, verifiers, claims worksheet, full results): https://gist.github.com/brumskysb/1dbfc6a1dddebdc046e43762747372ac ### Tested - GPU: AMD Radeon(TM) Graphics, integrated RDNA2, `gfx1036`, driver **31.0.22044.1**, Windows 11; harness `tools/hw-oracle` through `rig_runner.py`, wave32, 64 rows, one work-group. - Bodies: `image_store v4, v[5:7], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D` (encoding `F0200110 00020405`) and `image_store_mip v4, v[5:8], ...` with the mip level in `v8`, the fourth address component (encoding `F0240110 00020405`), then `s_waitcnt vmcnt(0)` and the readback. - T# dwords 1-4 `c1600000 0001c001 90000fac 00000000` (2D) and `c1600000 0001c001 d0000fac 00000001` (2D-array), re-decoded from every leg's own stored body text (format 22, 8x8, type 9 / 13, DEPTH 0 / 1, BASE_ARRAY 0) before any count was taken. - 6 + 64 + 64 + 32 dispatches; `step2_verify.py`, `step3_verify.py` and `step4_verify.py` recompute every count from the archived dumps (`DUMP RECOMPUTE OK`). Dump SHA-256: step 2 `75c1a26d…0768f8`, step 3 `650dc644…736432da`, matching the gist's raw files. - Descriptor axis: `2D` (type 9) and `2D-array` (type 13), the two the entry names; no other descriptor type is claimed. The replaced region, copied from `check_entry_edit.py`'s REPLACED REGION: ``` - gathers, `image_get_lod` and stores, + gathers and `image_get_lod`, keeps throwing because it is not measured. DIM 3D `image_store` and `image_store_mip` at mip 0 were measured on RDNA2 (gfx1036, driver 31.0.22044.1) with the hardware oracle, `dmask` 0x1 on an 8x8 32_FLOAT T#: on a 2D T# a lane writes its (x,y) texel when z is 0 and nothing when z is 1; on a two-layer 2D-array T# z is the layer and z 2 writes nothing. The recompiler implements the 2D-array store; a store through a 2D T# keeps throwing. ``` before: `... Every other access of such an image, including samples with an LOD, bias, derivatives, offset or comparison, gathers, `image_get_lod` and stores, keeps throwing because it is not measured.` after: `... Every other access of such an image, including samples with an LOD, bias, derivatives, offset or comparison, gathers and `image_get_lod`, keeps throwing because it is not measured. DIM 3D `image_store` and `image_store_mip` at mip 0 were measured on RDNA2 (gfx1036, driver 31.0.22044.1) with the hardware oracle, `dmask` 0x1 on an 8x8 32_FLOAT T#: on a 2D T# a lane writes its (x,y) texel when z is 0 and nothing when z is 1; on a two-layer 2D-array T# z is the layer and z 2 writes nothing. The recompiler implements the 2D-array store; a store through a 2D T# keeps throwing.` Removed phrases declared to the gate: `gathers, `image_get_lod`` and `stores,` — the list loses only "and stores"; samples with an LOD, bias, derivatives, offset or comparison, gathers and `image_get_lod` stay named as unmeasured, and the CouchRiv/adriadam10 provenance and "not the PS5's gfx1013" are untouched. ### Notes - **`debt-length` warning:** the entry grows from 836 to 1,225 characters, 225 over the 1,000 guideline. No measured condition was compressed to fit; trimming the entry is its own PR. - Not covered, and the new sentence does not claim it: other formats, multi-component `dmask`, z other than 0 and 1 on a 2D T#, negative z, arrays of more than two layers, mip levels other than 0, and the PS5's gfx1013. - Overlap: the 300 most recent open PRs were scanned; 7 touch `docs/dev/debt/shader.md` (#17733, #17701, #17623, #17611, #17606, #17605, #17523) and none of them edits this entry. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attached 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: none - [x] GPUs tested: AMD Radeon(TM) Graphics (gfx1036, driver 31.0.22044.1, Windows 11) - [x] AI-assisted: yes
milescoviello commented 2026-11-09 17:17:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-11-09T17:17:23Z.

Review: APPROVED


Checked the new sentence about the recompiler against main. In ResourceMaterializer.cpp, arrayStore (line 2258) adds only a Dim2DArray runtime mode for a DIM 3D storage write. A two-layer 2D-array T# is therefore served (layer = z, and a past-the-end layer writes nothing through VolumeSliceInRange, matching your z 2 leg). A 2D T# has no matching mode and still throws. So "the recompiler implements the 2D-array store; a store through a 2D T# keeps throwing" is accurate.

The measured 2D-T# rule also gives a small follow-up a precise spec: z 0 writes the (x,y) texel, z ≠ 0 writes nothing, decided per lane. A Dim2D mode for these stores, with a z == 0 store predicate, would mirror what the DIM 3D image_load through a 2D T# already does for z ≠ 0 (volumeLoad, returning zero).

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5829753403 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17807#pullrequestreview-5829753403). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-11-09T17:17:23Z. **Review:** APPROVED --- Checked the new sentence about the recompiler against `main`. In `ResourceMaterializer.cpp`, `arrayStore` (line 2258) adds only a `Dim2DArray` runtime mode for a DIM 3D storage write. A two-layer 2D-array T# is therefore served (layer = z, and a past-the-end layer writes nothing through `VolumeSliceInRange`, matching your z 2 leg). A 2D T# has no matching mode and still throws. So "the recompiler implements the 2D-array store; a store through a 2D T# keeps throwing" is accurate. The measured 2D-T# rule also gives a small follow-up a precise spec: z 0 writes the (x,y) texel, z ≠ 0 writes nothing, decided per lane. A `Dim2D` mode for these stores, with a `z == 0` store predicate, would mirror what the DIM 3D `image_load` through a 2D T# already does for z ≠ 0 (`volumeLoad`, returning zero). AI-assisted: yes (Claude Code)
gabichuuuuu commented 2026-11-10 17:49:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-10T17:49:34Z.

Review: COMMENTED


Read 7ece1d9203 against main.

Correctness. ResourceMaterializer.cpp:RuntimeImageModes (lines 2258-2262 at this head) adds a Dim2DArray mode for a Dim3D shader image only when it is a storage image that is written, not read, not atomic and not DynamicStorage. There is no Dim2D mode for a 3D store, so a store through a 2D T# still throws and the 2D-array store is implemented, as the added text says. The earlier "and stores" in the list of throwing accesses is removed, which is consistent with that. The gfx1036 measurements cannot be checked from the code. The entry text on main is identical to the PR base, and the other shader.md PRs in this set (#17974, #18026) edit different entries.

Non-blocking. The kept sentence "Every other access of such an image ... keeps throwing" no longer says that stores outside the measured case (read-write or atomic images, mip above 0 on a dynamic-mip image, depth, packed or BY formats, per RuntimeImageModes:2258-2259) also still throw. One short clause would keep the gap list complete.

Not run here; this is from reading the code.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5846660630 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17807#pullrequestreview-5846660630). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-10T17:49:34Z. **Review:** COMMENTED --- Read `7ece1d9203` against `main`. **Correctness.** `ResourceMaterializer.cpp:RuntimeImageModes` (lines 2258-2262 at this head) adds a `Dim2DArray` mode for a `Dim3D` shader image only when it is a storage image that is written, not read, not atomic and not `DynamicStorage`. There is no `Dim2D` mode for a 3D store, so a store through a 2D T# still throws and the 2D-array store is implemented, as the added text says. The earlier "and stores" in the list of throwing accesses is removed, which is consistent with that. The gfx1036 measurements cannot be checked from the code. The entry text on main is identical to the PR base, and the other shader.md PRs in this set (#17974, #18026) edit different entries. **Non-blocking.** The kept sentence "Every other access of such an image ... keeps throwing" no longer says that stores outside the measured case (read-write or atomic images, mip above 0 on a dynamic-mip image, depth, packed or BY formats, per `RuntimeImageModes:2258-2259`) also still throw. One short clause would keep the gap list complete. Not run here; this is from reading the code. AI-assisted: yes.
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!17807
No description provided.