[PR #291] rdna2spirv: zero the tfe/lwe status VGPR on image_load and image_load_mip #343

Open
opened 2026-11-26 20:17:34 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/291
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: old-pr/10022


📝 Commits (1)

  • de87b1a rdna2spirv: zero the tfe/lwe status VGPR on image_load and image_load_mip

📊 Changes

3 files changed (+113 additions, -10 deletions)

View changed files

📝 docs/design.md (+1 -1)
➕ tests/semantic/test_image_load_tfe.py (+95 -0)
📝 tools/rdna2spirv.py (+17 -9)

📄 Description

Carried over from old PR 10022 by n-romanovich in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10022, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
n-romanovich: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

#8968 added cs_imgload_tfe and cs_imgload_d16_tfe on main, and both fail on an NVIDIA GeForce RTX 5060 Ti (r32 sint (sint view): 64 bad, texel(5,3) = 2071 instead of 71) because image_read_typed never wrote 0 into the trailing tfe/lwe status VGPR (vdata[data_vgprs]), leaving the seeded 0x3e8 (1000) value untouched.

Claimed in #9677.

Changes

  • tools/rdna2spirv.py: pass status=("tfe" in mods or "lwe" in mods) from image_load (typed and glc coherent) and image_load_mip (2D and 3D) into image_read_typed, and write 0 to vdata[data_vgprs] ((popcount(dmask) + 1) // 2 under d16, else popcount(dmask)) via self.dst(...) so inactive lanes stay preserved.
  • tests/semantic/test_image_load_tfe.py: unit tests covering tfe, lwe, d16 packing (dmask:0x3, 0x7), glc, and 2D/3D image_load_mip.
  • docs/design.md: document the tfe/lwe status VGPR rule under Typed image loads.

Tested

  • GPU / driver / OS: NVIDIA GeForce RTX 5060 Ti, NVIDIA 610.88, Windows 11 (Vulkan SDK 1.4.363.0, llvm-mc 21.1.8, Python 3.14.4)
  • python -I scripts/run_gpu_tests.py --build runtime/build --filter imgload: 4/4 passed (cs_imgload, cs_imgload_d16, cs_imgload_tfe, cs_imgload_d16_tfe; 4/4 spirv-val) — previously 2/4 (cs_imgload_tfe and cs_imgload_d16_tfe failed with 2071)
  • python -m unittest discover -s tests/semantic -p test_image_load_tfe.py: 3/3 passed
  • python -m unittest discover -s tests/semantic -p test_mem_crash_forms.py: 1/1 passed
  • python -m unittest discover -s tests/semantic -p test_image_coherent.py: 10/10 passed (1 skipped)
  • python -I tests/test_image_load_typed.py: 23/23 passed (2 skipped)
  • python -m compileall -q make_game.py tools tests and python -I scripts/check_no_game_data.py ...: passed
  • Synthetic inputs only, no game files.

AI-assisted.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/291 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/10022` --- ### 📝 Commits (1) - [`de87b1a`](https://github.com/ubiquitarianism/leonida/commit/de87b1a9ea278d95724171613ca10384bc2b8e27) rdna2spirv: zero the tfe/lwe status VGPR on image_load and image_load_mip ### 📊 Changes **3 files changed** (+113 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -1) ➕ `tests/semantic/test_image_load_tfe.py` (+95 -0) 📝 `tools/rdna2spirv.py` (+17 -9) </details> ### 📄 Description > Carried over from **old PR 10022** by `n-romanovich` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10022`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `n-romanovich`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): `#8968` added `cs_imgload_tfe` and `cs_imgload_d16_tfe` on `main`, and both fail on an NVIDIA GeForce RTX 5060 Ti (`r32 sint (sint view): 64 bad, texel(5,3) = 2071` instead of `71`) because `image_read_typed` never wrote `0` into the trailing `tfe`/`lwe` status VGPR (`vdata[data_vgprs]`), leaving the seeded `0x3e8` (`1000`) value untouched. Claimed in `#9677`. ### Changes - `tools/rdna2spirv.py`: pass `status=("tfe" in mods or "lwe" in mods)` from `image_load` (typed and `glc` coherent) and `image_load_mip` (2D and 3D) into `image_read_typed`, and write `0` to `vdata[data_vgprs]` (`(popcount(dmask) + 1) // 2` under `d16`, else `popcount(dmask)`) via `self.dst(...)` so inactive lanes stay preserved. - `tests/semantic/test_image_load_tfe.py`: unit tests covering `tfe`, `lwe`, `d16` packing (`dmask:0x3`, `0x7`), `glc`, and 2D/3D `image_load_mip`. - `docs/design.md`: document the `tfe`/`lwe` status VGPR rule under `Typed image loads`. ### Tested - GPU / driver / OS: NVIDIA GeForce RTX 5060 Ti, NVIDIA 610.88, Windows 11 (Vulkan SDK 1.4.363.0, `llvm-mc 21.1.8`, Python 3.14.4) - `python -I scripts/run_gpu_tests.py --build runtime/build --filter imgload`: **4/4 passed** (`cs_imgload`, `cs_imgload_d16`, `cs_imgload_tfe`, `cs_imgload_d16_tfe`; 4/4 `spirv-val`) — previously 2/4 (`cs_imgload_tfe` and `cs_imgload_d16_tfe` failed with `2071`) - `python -m unittest discover -s tests/semantic -p test_image_load_tfe.py`: 3/3 passed - `python -m unittest discover -s tests/semantic -p test_mem_crash_forms.py`: 1/1 passed - `python -m unittest discover -s tests/semantic -p test_image_coherent.py`: 10/10 passed (1 skipped) - `python -I tests/test_image_load_typed.py`: 23/23 passed (2 skipped) - `python -m compileall -q make_game.py tools tests` and `python -I scripts/check_no_game_data.py ...`: passed - Synthetic inputs only, no game files. AI-assisted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#343
No description provided.