[PR #143] fix: translate image_load_mip glc on 2D through the coherent storage view #195

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

📋 Pull Request Information

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

Base: main ← Head: old-pr/9875


📝 Commits (1)

  • 8c9a474 fix: translate image_load_mip glc on 2D through the coherent storage view

📊 Changes

2 files changed (+90 additions, -6 deletions)

View changed files

📝 tests/semantic/test_image_coherent.py (+60 -1)
📝 tools/rdna2spirv.py (+30 -5)

📄 Description

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


🔄 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/143 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/9875` --- ### 📝 Commits (1) - [`8c9a474`](https://github.com/ubiquitarianism/leonida/commit/8c9a4745b2c380a47ce4603276c0919b65a2438c) fix: translate image_load_mip glc on 2D through the coherent storage view ### 📊 Changes **2 files changed** (+90 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `tests/semantic/test_image_coherent.py` (+60 -1) 📝 `tools/rdna2spirv.py` (+30 -5) </details> ### 📄 Description > 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 --- <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#195
No description provided.