docs/design: contract row for the image fetch status VGPR (tfe/lwe), a resident read leaves it unchanged (SHADER-1266-DESIGN-ROW) #1067

Closed
syntaxixr wants to merge 1 commit from upstream-pr/1067 into main
syntaxixr commented 2026-11-24 17:40:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by syntaxixr on 2026-11-24T17:40:48Z.


Claimed in the coordination issue as: SHADER-1266-DESIGN-ROW (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7139494723).

This is the follow-up @aslan2142 named when merging #892: a docs/design.md contract row saying that a resident image_load with tfe leaves the status VGPR unchanged, so the zeroing change does not come back.

The new row, Image fetch status (tfe, lwe) (SHADER-1266), comes right after "Typed image loads" and records:

  • where the status VGPR is (vdata[n], with n the data VGPR count, packed two per VGPR under d16), that the translator writes nothing there, and that read_before_write_vgprs still counts it as a destination;
  • not to write 0 there (#98, draft #291), and that with #291 both fixtures fail again (2111);
  • the native evidence (gfx1036 raw dispatch: 48 kernels, 192 lanes, three seeds) and the LLVM SIISelLowering reasoning, from #98 and #892;
  • the GPU fixtures and how they catch any write ((v8 ^ 0x3e8) | (v12 ^ 0x7d0)), and the GPUs and drivers they pass on in #892;
  • the forms that raise Unsupported with tfe/lwe, read from tools/rdna2spirv.py: image_store, a16 gather/sample with offsets, a16 image_get_lod, 3D image_sample_d/_cl, and the d16 3D image_load_mip.

Tested: every tests/test_docs_*.py and tests/test_i18n_index.py passes (the docs-only CI set), and scripts/check_no_game_data.py docs/design.md is clean. Docs only, no game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5477291164 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1067). Originally posted by [syntaxixr](https://github.com/syntaxixr) on 2026-11-24T17:40:48Z. --- Claimed in the coordination issue as: SHADER-1266-DESIGN-ROW (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7139494723). This is the follow-up @aslan2142 named when merging #892: a `docs/design.md` contract row saying that a resident `image_load` with `tfe` leaves the status VGPR unchanged, so the zeroing change does not come back. The new row, **Image fetch status (`tfe`, `lwe`) (SHADER-1266)**, comes right after "Typed image loads" and records: - where the status VGPR is (`vdata[n]`, with n the data VGPR count, packed two per VGPR under `d16`), that the translator writes nothing there, and that `read_before_write_vgprs` still counts it as a destination; - not to write 0 there (#98, draft #291), and that with #291 both fixtures fail again (2111); - the native evidence (gfx1036 raw dispatch: 48 kernels, 192 lanes, three seeds) and the LLVM `SIISelLowering` reasoning, from #98 and #892; - the GPU fixtures and how they catch any write (`(v8 ^ 0x3e8) | (v12 ^ 0x7d0)`), and the GPUs and drivers they pass on in #892; - the forms that raise `Unsupported` with `tfe`/`lwe`, read from `tools/rdna2spirv.py`: `image_store`, `a16` gather/sample with offsets, `a16` `image_get_lod`, 3D `image_sample_d`/`_cl`, and the d16 3D `image_load_mip`. Tested: every `tests/test_docs_*.py` and `tests/test_i18n_index.py` passes (the docs-only CI set), and `scripts/check_no_game_data.py docs/design.md` is clean. Docs only, no game files. AI-assisted.
PierreEbele commented 2026-11-25 07:05:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T07:05:56Z.


Reviewed 2981ead: ran python3 -I tests/test_image_load_typed.py in the sandbox on both trees (PR 23 OK, main 28 OK, 2 skipped each; PR adds no tests) and a translator probe on both trees. Confirmed that image_load/image_load_mip with tfe/lwe (d32/d16, plus main's coherent glc dlc and 1D_ARRAY paths) leave the status VGPR unwritten. A few items in the new row need fixing before merging: (1) read_before_write_vgprs does not call vgpr_dest_registers(ins, extra=int("tfe" in ins["mods"])) — that call is in interp_copy_sources (tools/rdna2spirv.py:18141, main :18614), where extra=1 counts one VGPR past status ([7, 8, 9] on image_load v[7:8] ... tfe because _mimg_data_count already returns n + 1), while read_before_write_vgprs calls plain vgpr_dest_registers(ins) and does not count the status VGPR for the decoder's lwe form (image_load v7 ... lwe, so a later v8 read is read-before-write); scope that sentence to tfe and fix the function/expression. (2) Under refused forms, a16 image_sample*_o with tfe/lwe translates rather than raising Unsupported (only a16 image_gather4_*_o is refused; a16 2D image_load_mip and image_sample_c_l also refuse tfe/lwe), and cs_imgload_d16_tfe.asm is run via vk_store_test load-d16, not load. (3) docs/design.md conflicts with origin/main, which already has a Resident image_load tfe row (line 446) at the same spot — please rebase and fold this SHADER-1266 detail into that row instead of adding a duplicate. GPU/native checks were not run here (no GPU in sandbox). AI-assisted review.
Recommendation: Fix first

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7155485303 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1067#issuecomment-7155485303). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T07:05:56Z. --- Reviewed 2981ead: ran `python3 -I tests/test_image_load_typed.py` in the sandbox on both trees (PR 23 OK, main 28 OK, 2 skipped each; PR adds no tests) and a translator probe on both trees. Confirmed that `image_load`/`image_load_mip` with `tfe`/`lwe` (d32/d16, plus main's coherent `glc dlc` and `1D_ARRAY` paths) leave the status VGPR unwritten. A few items in the new row need fixing before merging: (1) `read_before_write_vgprs` does not call `vgpr_dest_registers(ins, extra=int("tfe" in ins["mods"]))` — that call is in `interp_copy_sources` (`tools/rdna2spirv.py:18141`, main `:18614`), where `extra=1` counts one VGPR past status (`[7, 8, 9]` on `image_load v[7:8] ... tfe` because `_mimg_data_count` already returns `n + 1`), while `read_before_write_vgprs` calls plain `vgpr_dest_registers(ins)` and does not count the status VGPR for the decoder's `lwe` form (`image_load v7 ... lwe`, so a later `v8` read is read-before-write); scope that sentence to `tfe` and fix the function/expression. (2) Under refused forms, `a16` `image_sample*_o` with `tfe`/`lwe` translates rather than raising `Unsupported` (only `a16` `image_gather4_*_o` is refused; `a16` 2D `image_load_mip` and `image_sample_c_l` also refuse `tfe`/`lwe`), and `cs_imgload_d16_tfe.asm` is run via `vk_store_test load-d16`, not `load`. (3) `docs/design.md` conflicts with `origin/main`, which already has a `Resident image_load tfe` row (line 446) at the same spot — please rebase and fold this SHADER-1266 detail into that row instead of adding a duplicate. GPU/native checks were not run here (no GPU in sandbox). AI-assisted review. **Recommendation:** Fix first
MoonEyes commented 2026-11-28 02:56:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T02:56:58Z.


Hi @syntaxixr, thanks for this pull request. It currently conflicts with main (conflicting file(s): docs/design.md), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232696957 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1067#issuecomment-7232696957). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T02:56:58Z. --- Hi @syntaxixr, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `docs/design.md`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 10:56:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T10:56:27Z.

Review: CHANGES_REQUESTED


Requesting changes before this can land:

  1. Accuracy fix needed in the new row: As @PierreEbele noted on head 2981ead6, read_before_write_vgprs does not call vgpr_dest_registers(ins, extra=int("tfe" in ins["mods"])) — that call is in interp_copy_sources. Please verify and update the code references in the new Image fetch status (tfe, lwe) row against current tools/rdna2spirv.py.
  2. Merge conflict & missing CI: docs/design.md conflicts with current main and no CI checks ran on this head (label cancelled).

Please rebase onto main, fix the code citation, and ensure change-scope and no-game-data pass.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6129856610 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1067#pullrequestreview-6129856610). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T10:56:27Z. **Review:** CHANGES_REQUESTED --- Requesting changes before this can land: 1. **Accuracy fix needed in the new row:** As @PierreEbele noted on head `2981ead6`, `read_before_write_vgprs` does not call `vgpr_dest_registers(ins, extra=int("tfe" in ins["mods"]))` — that call is in `interp_copy_sources`. Please verify and update the code references in the new `Image fetch status (tfe, lwe)` row against current `tools/rdna2spirv.py`. 2. **Merge conflict & missing CI:** `docs/design.md` conflicts with current `main` and no CI checks ran on this head (`label` cancelled). Please rebase onto `main`, fix the code citation, and ensure `change-scope` and `no-game-data` pass. *(AI-assisted review.)*
MoonEyes commented 2026-12-02 11:39:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T11:39:49Z.


Closing: this pull request no longer applies to current main (merge conflict in docs/design.md), and open pull requests that have fallen out of step with main are being closed so the list stays workable. If you still want this change, rebase it on current main and reopen it (or open a new pull request); it will be looked at again.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7344233348 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1067#issuecomment-7344233348). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T11:39:49Z. --- Closing: this pull request no longer applies to current `main` (merge conflict in `docs/design.md`), and open pull requests that have fallen out of step with `main` are being closed so the list stays workable. If you still want this change, rebase it on current `main` and reopen it (or open a new pull request); it will be looked at again. AI-assisted (Claude Code).

Pull request closed

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
ProjectLeonida/mandy!1067
No description provided.