Skip to content

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

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
brumskysb:docs/shader-dim3-store
Nov 12, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
brumskysb:docs/shader-dim3-store

Conversation

@brumskysb

Copy link
Copy Markdown
Contributor

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

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

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/shader.md
PR 5371 docs/dev/debt/shader.md
PR 6235 docs/dev/debt/shader.md
PR 6280 docs/dev/debt/shader.md
PR 6412 docs/dev/debt/shader.md
PR 6488 docs/dev/debt/shader.md
PR 6924 docs/dev/debt/shader.md
PR 7684 docs/dev/debt/shader.md
PR 9387 docs/dev/debt/shader.md
PR 9748 docs/dev/debt/shader.md
PR 9889 docs/dev/debt/shader.md
PR 10652 docs/dev/debt/shader.md
PR 12316 docs/dev/debt/shader.md
PR 14212 docs/dev/debt/shader.md
PR 14377 docs/dev/debt/shader.md
PR 14853 docs/dev/debt/shader.md
PR 15548 docs/dev/debt/shader.md
PR 17611 docs/dev/debt/shader.md

@milescoviello milescoviello left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@brumskysb

Copy link
Copy Markdown
Contributor Author

Thanks for checking it against main. I re-read the same lines at origin/main 52c3351 and agree: arrayStore (ResourceMaterializer.cpp:2258) only adds a Dim2DArray mode for a DIM 3D storage write, while volumeLoad (line 2249) already covers the 2D and 2D-array T# for loads.

The step 2 data supports the per-lane spec you describe (gfx1036, driver 31.0.22044.1, 64 dispatches). Through the 2D T#, z 0 writes exactly the 64 face dwords at y*256 + x*4, and z 1 moves none of the 16,384 readback dwords. In the mixed leg, exactly the 32 even-lane (z 0) texels move. So a Dim2D mode with a per-lane z == 0 store predicate would reproduce the measured behaviour. That change is to the recompiler, so I've left it out of this docs-only PR.

@github-actions github-actions Bot added the docs label Nov 9, 2026
@brumskysb

Copy link
Copy Markdown
Contributor Author

Reopening to re-trigger CI. The Conventions, PR intake and PR labels check-suites all failed to start on this head (startup_failure, 16:50:53Z) — a workflow-launch failure, not a check result; the diff itself is unchanged. Re-running needs write access, which this fork does not have, so a close/reopen is the available trigger.

@gabichuuuuu gabichuuuuu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 10, 2026
@brumskysb
brumskysb force-pushed the docs/shader-dim3-store branch from 7ece1d9 to fc534d9 Compare November 10, 2026 22:58
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 10, 2026
@oneandonlydean
oneandonlydean merged commit 2e76390 into boykopovar:main Nov 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants