docs(debt): record that an image load misses the same shader's stores to the T# #22719

Merged
MichonGoddijn231849 merged 1 commit from upstream-pr/22719 into main 2026-11-18 06:23:41 +00:00
MichonGoddijn231849 commented 2026-11-18 05:06:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-11-18T05:06:28Z.


What

A debt entry records that an image_load of a T# that the same shader also stores to does not see the shader's own stores.

ResourceTracker's ImageKey includes the opcode's resource class. So ImageRead (class Sampled) and ImageWrite (class Storage) on the same descriptor source become two image resources with two bindings. The load then goes through the sampled path, either a view of the surface's cached storage image or a snapshot. Vulkan does not make that coherent with the dispatch's own storage writes, so a load after a store of the same texel can return the texel as it was before the dispatch. RDNA2 hardware returns the stored value.

Only docs/dev/debt/changes/docs-image-load-after-store-same-shader.md is added; no code changes. A fix would read a written source through its storage binding. That changes the class of every read-write image and interacts with the store-only format paths (rawSintStorage, rawFloat16Storage require !read), so it belongs in its own PR.

Measurement: tools/hw-oracle with the vulkan runtime and agc_oracle_runner. The program is a 2D 8×4 image pre-filled with 0xAB bytes; per lane image_store of four distinct dwords to texel (lane & 7, lane >> 3), then s_waitcnt vmcnt(0), then image_load of the same texel, with and without glc on both:

32_32_32_32_UINT (75) 32_UINT (20)
gfx1036 hardware stored values (glc and no glc) stored values
AnyPS5, NVIDIA GeForce RTX 5080 (610.74) 0xabababab × 4 0xabababab
AnyPS5, AMD Radeon(TM) Graphics (gfx1036, 32.0.21045.16010) stored values 0xabababab

A store-then-load sweep over every guest format the runner accepts gave the same split. NVIDIA differed on 19 to 32 of 32 lanes for every format. AMD differed for the one-channel formats and for 1 to 3 of 32 lanes of some two-channel ones, and matched for the four-channel formats.

Tested

Windows 11 Pro 10.0.26200, AnyPS5 at main, on the two GPUs above. The fragment passes tools/debt_fold.py --check and tools/check_conventions.py. Not tested on a PS5.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: none
  • GPUs tested: NVIDIA GeForce RTX 5080, driver 610.74, Windows 11 Pro 10.0.26200; AMD Radeon(TM) Graphics (RDNA2 iGPU, gfx1036), driver 32.0.21045.16010, Windows 11 Pro 10.0.26200
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5370283554 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22719). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-11-18T05:06:28Z. --- ### What A debt entry records that an `image_load` of a T# that the same shader also stores to does not see the shader's own stores. `ResourceTracker`'s `ImageKey` includes the opcode's resource class. So `ImageRead` (class `Sampled`) and `ImageWrite` (class `Storage`) on the same descriptor source become two image resources with two bindings. The load then goes through the sampled path, either a view of the surface's cached storage image or a snapshot. Vulkan does not make that coherent with the dispatch's own storage writes, so a load after a store of the same texel can return the texel as it was before the dispatch. RDNA2 hardware returns the stored value. Only `docs/dev/debt/changes/docs-image-load-after-store-same-shader.md` is added; no code changes. A fix would read a written source through its storage binding. That changes the class of every read-write image and interacts with the store-only format paths (`rawSintStorage`, `rawFloat16Storage` require `!read`), so it belongs in its own PR. **Measurement:** `tools/hw-oracle` with the `vulkan` runtime and `agc_oracle_runner`. The program is a 2D 8×4 image pre-filled with 0xAB bytes; per lane `image_store` of four distinct dwords to texel (lane & 7, lane >> 3), then `s_waitcnt vmcnt(0)`, then `image_load` of the same texel, with and without `glc` on both: | | `32_32_32_32_UINT` (75) | `32_UINT` (20) | | --- | --- | --- | | gfx1036 hardware | stored values (`glc` and no `glc`) | stored values | | AnyPS5, NVIDIA GeForce RTX 5080 (610.74) | `0xabababab` × 4 | `0xabababab` | | AnyPS5, AMD Radeon(TM) Graphics (gfx1036, 32.0.21045.16010) | stored values | `0xabababab` | A store-then-load sweep over every guest format the runner accepts gave the same split. NVIDIA differed on 19 to 32 of 32 lanes for every format. AMD differed for the one-channel formats and for 1 to 3 of 32 lanes of some two-channel ones, and matched for the four-channel formats. ### Tested Windows 11 Pro 10.0.26200, AnyPS5 at `main`, on the two GPUs above. The fragment passes `tools/debt_fold.py --check` and `tools/check_conventions.py`. Not tested on a PS5. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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) and the licence notice of code adapted from upstream (see AGENTS.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 (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: none - [x] GPUs tested: NVIDIA GeForce RTX 5080, driver 610.74, Windows 11 Pro 10.0.26200; AMD Radeon(TM) Graphics (RDNA2 iGPU, gfx1036), driver 32.0.21045.16010, Windows 11 Pro 10.0.26200 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!22719
No description provided.