fix: translate image_load_mip glc on 2D through the coherent storage view #143

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

@⁠Andretuta on GitHub · 2026-11-24 02:27 UTC · original
ubiquitarianism:old-pr/9875 → main · +90 −6 · 2 files · 1 commits · draft

Carried over from old PR 9875 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9875, 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.
tedin7: 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):

What

image_load_mip with glc on a plain 2D image no longer raises Unsupported. It reads through the same Coherent storage view that image_load glc already uses (image_load_coherent). The read is taken when the mip operand is 0. Any other mip writes zeros to the result registers, which is what an out-of-range image_load_mip returns on hardware, because the storage view has exactly one level. Other dims and the tfe/lwe forms still raise Unsupported, now with the dim in the message.

Why

A shader containing a coherent mip load could not be translated at all, so the pipeline that uses it fails to build. That blocks PSO creation and the first frame for any shader that hits it. This makes the translation succeed and validate.

Tested

  • pytest tests/semantic/test_image_coherent.py: 16 passed, 15 subtests passed.
  • Negative control: with tools/rdna2spirv.py restored to origin/main (the test file kept), 8 tests fail (CoherentMipLoad x3 plus the subtests per dmask, and Validation spirv-val f32 and d16). With the fix they pass.
  • Neighbours: the -k 'image or mip or coherent' selection of tests/semantic has the same 47 failures with and without this change, all in test_image_atomics_guard.py. Those fail on current origin/main already ("OpImageTexelPointer in unguarded block"), unrelated to this PR.
  • Not run: no GPU or lavapipe run. Only translation plus spirv-val.

Rebased cleanly on current main (cherry-pick, no conflicts).
Coordination: https://github.com/ProjectLeonida/Leonida/issues/9677

**@⁠Andretuta** on GitHub · 2026-11-24 02:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/143) `ubiquitarianism:old-pr/9875` → `main` · +90 −6 · 2 files · 1 commits · draft > Carried over from **old PR 9875** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9875`, 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. > `tedin7`: 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): ## What `image_load_mip` with `glc` on a plain 2D image no longer raises `Unsupported`. It reads through the same Coherent storage view that `image_load` glc already uses (`image_load_coherent`). The read is taken when the mip operand is 0. Any other mip writes zeros to the result registers, which is what an out-of-range `image_load_mip` returns on hardware, because the storage view has exactly one level. Other dims and the tfe/lwe forms still raise `Unsupported`, now with the dim in the message. ## Why A shader containing a coherent mip load could not be translated at all, so the pipeline that uses it fails to build. That blocks PSO creation and the first frame for any shader that hits it. This makes the translation succeed and validate. ## Tested - `pytest tests/semantic/test_image_coherent.py`: 16 passed, 15 subtests passed. - Negative control: with `tools/rdna2spirv.py` restored to origin/main (the test file kept), 8 tests fail (CoherentMipLoad x3 plus the subtests per dmask, and Validation spirv-val f32 and d16). With the fix they pass. - Neighbours: the `-k 'image or mip or coherent'` selection of tests/semantic has the same 47 failures with and without this change, all in test_image_atomics_guard.py. Those fail on current origin/main already ("OpImageTexelPointer in unguarded block"), unrelated to this PR. - Not run: no GPU or lavapipe run. Only translation plus spirv-val. Rebased cleanly on current main (cherry-pick, no conflicts). Coordination: https://github.com/ProjectLeonida/Leonida/issues/9677
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:46:16 +00:00
Author
Owner

@⁠ImLele69 on GitHub · 2026-11-24 11:37 UTC · original

Tested on Linux, merged onto main 21625bca8 (PR head 8c9a4745b, merges cleanly).

GPU: NVIDIA GeForce RTX 2070 SUPER (Turing, subgroup 32), proprietary driver 620.70.06, Fedora 44, llvm-mc 22.1.8, SPIRV-Tools 2026.1.

Run This PR main alone
run_gpu_tests.py native 197/248 passed, 49 skipped 197/248 passed, 49 skipped
LEONIDA_W64_EMULATE=1 229/248 passed, 17 skipped 229/248 passed, 17 skipped
run_semantic_tests.py tests/semantic 465 files, 6114 tests, 0 files failed in 97 s with 16 jobs 465 files, 6108 tests, 0 files failed

No new GPU fixture; no change in the GPU results against main.

The only failures in both runs are the known cs_imgload_tfe / cs_imgload_d16_tfe pair (#31), as on main. No regressions.

AI-assisted: yes (Claude Code ran the build and tests on my machine; numbers are the runners' own output).

**@⁠ImLele69** on GitHub · 2026-11-24 11:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/143#issuecomment-7130334973) Tested on Linux, merged onto `main` `21625bca8` (PR head `8c9a4745b`, merges cleanly). GPU: NVIDIA GeForce RTX 2070 SUPER (Turing, subgroup 32), proprietary driver 620.70.06, Fedora 44, llvm-mc 22.1.8, SPIRV-Tools 2026.1. | Run | This PR | `main` alone | |---|---|---| | `run_gpu_tests.py` native | 197/248 passed, 49 skipped | 197/248 passed, 49 skipped | | `LEONIDA_W64_EMULATE=1` | 229/248 passed, 17 skipped | 229/248 passed, 17 skipped | | `run_semantic_tests.py tests/semantic` | 465 files, 6114 tests, 0 files failed in 97 s with 16 jobs | 465 files, 6108 tests, 0 files failed | No new GPU fixture; no change in the GPU results against `main`. The only failures in both runs are the known `cs_imgload_tfe` / `cs_imgload_d16_tfe` pair (#31), as on `main`. No regressions. AI-assisted: yes (Claude Code ran the build and tests on my machine; numbers are the runners' own output).
This pull request has changes conflicting with the target branch.
  • 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/143/head:github-bot/gh-143'
git switch 'github-bot/gh-143'

Merge

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