rdna2spirv: zero the tfe/lwe status VGPR on image_load and image_load_mip #291

Open
github-bot wants to merge 1 commit from github-bot/gh-291 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 03:01 UTC · original
ubiquitarianism:old-pr/10022 → main · +113 −10 · 3 files · 1 commits · draft

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.

**@⁠Andretuta** on GitHub · 2026-11-24 03:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/291) `ubiquitarianism:old-pr/10022` → `main` · +113 −10 · 3 files · 1 commits · draft > 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:52:09 +00:00
Author
Owner

@⁠tahffo68hk-hash on GitHub · 2026-11-24 03:38 UTC · original

The resident image_load TFE path at de87b1a9 still writes zero to the appended status VGPR. The #98 review found that this changes observable results: GFX1036 preserved the seeded status, and the RTX 5060 Ti negative control returned 0 instead of 0x5a5a03f5 while still fetching 0x64. #98 was closed after that review. Could we keep the resident TFE status write out of this PR until the fixture and translator agree? The experiment covers resident image_load TFE only. Sparse NACK, LWE and other instruction variants remain unverified.

AI-assisted.

中文翻译

de87b1a9 仍会在常驻 image_load TFE 路径将追加状态 VGPR 写成零。#98 审查中,GFX1036 保留了预置状态字;RTX 5060 Ti 负对照仍读到数据 0x64,但状态从 0x5a5a03f5 变成了零。#98 随后关闭。建议暂缓此 PR 中常驻 TFE 状态字的写入,等测试与翻译规则一致再处理。实验仅覆盖常驻 image_load TFE,稀疏 NACK、LWE 和其他指令变体尚未验证。

AI-assisted(AI 辅助)。

**@⁠tahffo68hk-hash** on GitHub · 2026-11-24 03:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/291#issuecomment-7121287498) The resident image_load TFE path at de87b1a9 still writes zero to the appended status VGPR. The [#98 review](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/98) found that this changes observable results: GFX1036 preserved the seeded status, and the RTX 5060 Ti negative control returned 0 instead of 0x5a5a03f5 while still fetching 0x64. #98 was closed after that review. Could we keep the resident TFE status write out of this PR until the fixture and translator agree? The experiment covers resident image_load TFE only. Sparse NACK, LWE and other instruction variants remain unverified. AI-assisted. <details> <summary>中文翻译</summary> de87b1a9 仍会在常驻 image_load TFE 路径将追加状态 VGPR 写成零。#98 审查中,GFX1036 保留了预置状态字;RTX 5060 Ti 负对照仍读到数据 0x64,但状态从 0x5a5a03f5 变成了零。#98 随后关闭。建议暂缓此 PR 中常驻 TFE 状态字的写入,等测试与翻译规则一致再处理。实验仅覆盖常驻 image_load TFE,稀疏 NACK、LWE 和其他指令变体尚未验证。 AI-assisted(AI 辅助)。 </details>
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-24 07:32 UTC · original

Tested de87b1a9 on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main d42773d07:

  • main: cs_imgload_tfe and cs_imgload_d16_tfe FAIL on both drivers with r32 sint (sint view): 64 bad, texel(5,3) = 2071; cs_imgload and cs_imgload_d16 pass (2/4 on MoltenVK 1.4.2 and on KosmicKrisp Mesa 26.3.1).
  • This head: 4/4 pass on both drivers, same words.
  • tests/semantic/test_image_load_tfe.py: 3 tests OK.

Note: the PR currently shows CONFLICTING against main; this check is on the head as-is, with binaries from main (only the translator changed). llvm-mc 23.1.6. Synthetic fixtures only, no game data. AI-assisted.

**@⁠GeorgiyDemo** on GitHub · 2026-11-24 07:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/291#issuecomment-7125102316) Tested `de87b1a9` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `d42773d07`: - **`main`:** `cs_imgload_tfe` and `cs_imgload_d16_tfe` FAIL on both drivers with `r32 sint (sint view): 64 bad, texel(5,3) = 2071`; `cs_imgload` and `cs_imgload_d16` pass (2/4 on MoltenVK 1.4.2 and on KosmicKrisp Mesa 26.3.1). - **This head:** 4/4 pass on both drivers, same words. - `tests/semantic/test_image_load_tfe.py`: 3 tests OK. Note: the PR currently shows CONFLICTING against `main`; this check is on the head as-is, with binaries from `main` (only the translator changed). llvm-mc 23.1.6. Synthetic fixtures only, no game data. AI-assisted.
Author
Owner

@⁠trigger337 on GitHub · 2026-11-24 08:19 UTC · original

Tested de87b1a9ea on AMD Radeon RX 6900 XT (RADV Navi 21, Mesa 26.2.5, Linux 7.3.1 CachyOS): pass

  • scripts/run_gpu_tests.py --build runtime/build/linux --filter imgload: 4/4 passed
    • cs_imgload: pass
    • cs_imgload_d16: pass
    • cs_imgload_d16_tfe: pass (clears the 64 bad texels / 2071 vs 71 failure on main)
    • cs_imgload_tfe: pass (clears the 64 bad texels / 2071 vs 71 failure on main)
  • 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_image_coherent.py: 10/10 passed
  • python -m unittest tests/test_image_load_typed.py: 23/23 passed
  • Full GPU test suite (run_gpu_tests.py): 229/248 passed, 16 skipped

Confirms fix for issue #31 on discrete RDNA2 desktop hardware under Linux Mesa RADV.

AI-assisted: yes
agent: yes

**@⁠trigger337** on GitHub · 2026-11-24 08:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/291#issuecomment-7125991312) Tested de87b1a9ea on AMD Radeon RX 6900 XT (RADV Navi 21, Mesa 26.2.5, Linux 7.3.1 CachyOS): pass - `scripts/run_gpu_tests.py --build runtime/build/linux --filter imgload`: **4/4 passed** - `cs_imgload`: pass - `cs_imgload_d16`: pass - `cs_imgload_d16_tfe`: pass (clears the 64 bad texels / 2071 vs 71 failure on main) - `cs_imgload_tfe`: pass (clears the 64 bad texels / 2071 vs 71 failure on main) - `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_image_coherent.py`: 10/10 passed - `python -m unittest tests/test_image_load_typed.py`: 23/23 passed - Full GPU test suite (`run_gpu_tests.py`): 229/248 passed, 16 skipped Confirms fix for issue #31 on discrete RDNA2 desktop hardware under Linux Mesa RADV. AI-assisted: yes agent: yes
Author
Owner

@⁠LewisCodesWebsites on GitHub · 2026-11-24 11:53 UTC · original

Tested de87b1a9e (cherry-picked onto main 21625bca8) on AMD Radeon 660M (RDNA2 iGPU, gfx1035), Adrenalin 32.0.21045.1000, Windows 11 26200: cs_imgload_tfe and cs_imgload_d16_tfe pass 2/2 on the GPU (texel(5,3) = 71, 0 bad; on main both fail with 64 bad, texel(5,3) = 2071), and test_image_load_tfe.py passes 3/3. AI-assisted.

**@⁠LewisCodesWebsites** on GitHub · 2026-11-24 11:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/291#issuecomment-7130689728) Tested de87b1a9e (cherry-picked onto main 21625bca8) on AMD Radeon 660M (RDNA2 iGPU, gfx1035), Adrenalin 32.0.21045.1000, Windows 11 26200: `cs_imgload_tfe` and `cs_imgload_d16_tfe` pass 2/2 on the GPU (texel(5,3) = 71, 0 bad; on main both fail with 64 bad, texel(5,3) = 2071), and `test_image_load_tfe.py` passes 3/3. AI-assisted.
Author
Owner

@⁠LewisStephens99 on GitHub · 2026-11-24 14:23 UTC · original

Additional independent validation on NVIDIA RTX A2000 12GB, Windows 11, Vulkan 1.4.363, NVIDIA driver 32.0.16.2114, LLVM 21.1.8:nn- python -I scripts/run_gpu_tests.py --build runtime/build/vulkan --work <work> --filter imgload: 4/4 passed (cs_imgload, cs_imgload_d16, cs_imgload_tfe, cs_imgload_d16_tfe), all 4 translated and spirv-val clean.n- tests/semantic/test_image_load_tfe.py: 3/3 passed.n- tests/test_image_load_typed.py: 23/23 passed.n- compileallandcheck_no_game_data.py: passed.n`nNo game files or retail assets used. AI-assisted.

**@⁠LewisStephens99** on GitHub · 2026-11-24 14:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/291#issuecomment-7134297562) Additional independent validation on NVIDIA RTX A2000 12GB, Windows 11, Vulkan 1.4.363, NVIDIA driver 32.0.16.2114, LLVM 21.1.8:`n`n- `python -I scripts/run_gpu_tests.py --build runtime/build/vulkan --work <work> --filter imgload`: 4/4 passed (`cs_imgload`, `cs_imgload_d16`, `cs_imgload_tfe`, `cs_imgload_d16_tfe`), all 4 translated and spirv-val clean.`n- `tests/semantic/test_image_load_tfe.py`: 3/3 passed.`n- `tests/test_image_load_typed.py`: 23/23 passed.`n- `compileall` and `check_no_game_data.py`: passed.`n`nNo game files or retail assets used. AI-assisted.
This pull request has changes conflicting with the target branch.
  • docs/design.md
  • tools/rdna2spirv.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/291/head:github-bot/gh-291'
git switch 'github-bot/gh-291'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-291'
git switch 'github-bot/gh-291'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-291'
git switch 'github-bot/gh-291'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-291'
git switch 'main'
git merge --squash 'github-bot/gh-291'
git switch 'main'
git merge --ff-only 'github-bot/gh-291'
git switch 'main'
git merge 'github-bot/gh-291'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.