OLD-9875: rdna2spirv: translate 2D image_load_mip glc via coherent storage view #1572

Open
github-bot wants to merge 2 commits from github-bot/gh-1572 into main AGit
Owner

@⁠Tortoche on GitHub · 2026-11-25 04:47 UTC · original
Tortoche:old-9875 → main · +150 −15 · 3 files · 2 commits · open

Item ID: OLD-9875
Carries forward Draft #143 (old-pr/9875), preserving original author tedin7 (e6b7cb689), rebased onto main (364ab4eab), plus follow-up refinement 0c5605585 (image_load_mip glc on 2D via coherent storage view).
Claimed in #14: #14

AI-assisted: yes

Summary

  • tools/rdna2spirv.py (image_misc, image_load_mip_coherent):
    • Translate image_load_mip with glc on plain 2D images (including a16 and d16) through the coherent storage view %stv*_0 instead of rejecting it or emitting sampled OpImageFetch.
    • Keep OpImageRead on the mip == 0 branch (image_load_coherent, decorated Coherent, without setting uses_query), and zero-fill destination registers on mip != 0 via OpIEqual %bool (raw_xs[2] as %uint) + structured OpSelectionMerge/OpBranchConditional, using write_lo16 on the trailing odd d16 register so the high 16 bits are preserved.
    • Refuse image_load_mip ... glc for non-2D dimensions and tfe/lwe status forms (Unsupported).
  • tests/semantic/test_image_coherent.py:
    • Add CoherentMipLoad (8 tests: f32, negative control without glc, a16, d16 even/odd 0xFFFF0000 high-half masking on both branches), expand UnmodelledCoherentReads (2D_ARRAY, 3D, tfe, lwe), and add Validation.test_spirv_val_accepts_a_coherent_mip_load.
  • docs/design.md:
    • Update the Coherent image accesses (glc) contract row for 2D image_load_mip glc (including d16/a16/odd-component handling and explicit note that mip > 0 zero-fill on a coherent view is not yet hardware-measured).

Tests Executed & Verified (Linux x86_64 CPU; no GPU / retail game-corpus run)

  • python3 -I scripts/run_semantic_tests.py -j 2 tests/semantic: 476 files, 6232 tests, 0 files failed in 5032 s (exit 0)
  • python3 -m unittest discover -s tests/semantic -p test_image_coherent.py -v: 19/19 passed (with /usr/bin/spirv-as & /usr/bin/spirv-val), plus 18/18 refusal probes and 12/12 spirv-val adversarial probes
  • python3 -I tests/test_design_contract_rows.py -v: 5/5 passed
  • python3 -I tests/test_docs_links.py -v: 16/16 passed
  • python3 -I tests/test_docs_design_rows.py -v: 5/5 passed
  • python3 -I tests/test_text_write_line_endings.py -v: 3/3 passed
  • python3 -I tests/test_ci_registration.py -v: 16/16 passed
  • python3 -m compileall -q make_game.py tools tests: OK (exit 0)
  • python3 -I scripts/check_no_game_data.py docs/design.md tests/semantic/test_image_coherent.py tools/rdna2spirv.py: OK (exit 0, zero game data)
**@⁠Tortoche** on GitHub · 2026-11-25 04:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1572) `Tortoche:old-9875` → `main` · +150 −15 · 3 files · 2 commits · open Item ID: `OLD-9875` Carries forward Draft `#143` (`old-pr/9875`), preserving original author `tedin7` (`e6b7cb689`), rebased onto `main` (`364ab4eab`), plus follow-up refinement `0c5605585` (`image_load_mip glc` on 2D via coherent storage view). Claimed in `#14`: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 AI-assisted: yes ### Summary - `tools/rdna2spirv.py` (`image_misc`, `image_load_mip_coherent`): - Translate `image_load_mip` with `glc` on plain 2D images (including `a16` and `d16`) through the coherent storage view `%stv*_0` instead of rejecting it or emitting sampled `OpImageFetch`. - Keep `OpImageRead` on the `mip == 0` branch (`image_load_coherent`, decorated `Coherent`, without setting `uses_query`), and zero-fill destination registers on `mip != 0` via `OpIEqual %bool` (`raw_xs[2]` as `%uint`) + structured `OpSelectionMerge`/`OpBranchConditional`, using `write_lo16` on the trailing odd `d16` register so the high 16 bits are preserved. - Refuse `image_load_mip ... glc` for non-2D dimensions and `tfe`/`lwe` status forms (`Unsupported`). - `tests/semantic/test_image_coherent.py`: - Add `CoherentMipLoad` (8 tests: `f32`, negative control without `glc`, `a16`, `d16` even/odd `0xFFFF0000` high-half masking on both branches), expand `UnmodelledCoherentReads` (`2D_ARRAY`, `3D`, `tfe`, `lwe`), and add `Validation.test_spirv_val_accepts_a_coherent_mip_load`. - `docs/design.md`: - Update the `Coherent image accesses (glc)` contract row for 2D `image_load_mip glc` (including `d16`/`a16`/odd-component handling and explicit note that `mip > 0` zero-fill on a coherent view is not yet hardware-measured). ### Tests Executed & Verified (Linux x86_64 CPU; no GPU / retail game-corpus run) - `python3 -I scripts/run_semantic_tests.py -j 2 tests/semantic`: **476 files, 6232 tests, 0 files failed in 5032 s** (exit 0) - `python3 -m unittest discover -s tests/semantic -p test_image_coherent.py -v`: **19/19 passed** (with `/usr/bin/spirv-as` & `/usr/bin/spirv-val`), plus **18/18** refusal probes and **12/12** `spirv-val` adversarial probes - `python3 -I tests/test_design_contract_rows.py -v`: **5/5 passed** - `python3 -I tests/test_docs_links.py -v`: **16/16 passed** - `python3 -I tests/test_docs_design_rows.py -v`: **5/5 passed** - `python3 -I tests/test_text_write_line_endings.py -v`: **3/3 passed** - `python3 -I tests/test_ci_registration.py -v`: **16/16 passed** - `python3 -m compileall -q make_game.py tools tests`: **OK** (exit 0) - `python3 -I scripts/check_no_game_data.py docs/design.md tests/semantic/test_image_coherent.py tools/rdna2spirv.py`: **OK** (exit 0, zero game data)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:56:56 +00:00
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-25 04:50 UTC · original

Tested 0c5605585 on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main c7e82e26e (translator-only PR; binaries from the build at 66d4f5aa3):

  • python3 -m unittest test_image_coherent (from tests/semantic): OK at this head. The same file on main errors 14 times — the 2D image_load_mip + glc coherent-view path is refused there.
  • GPU regression on MoltenVK 1.4.2: --filter ps_texture 8/8 PASS, --filter ps_tex 12/12 PASS (ps_texoff/ps_texoff_implicit note the device's ±8 texel-offset limit, unchanged).
  • Not run: GPU execution of the new 2D image_load_mip glc path — there is no .asm fixture for it; the semantic suite is the evidence here.

AI-assisted; synthetic fixtures only, no game data.

**@⁠GeorgiyDemo** on GitHub · 2026-11-25 04:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1572#issuecomment-7153208639) Tested `0c5605585` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `c7e82e26e` (translator-only PR; binaries from the build at `66d4f5aa3`): - `python3 -m unittest test_image_coherent` (from `tests/semantic`): **OK** at this head. The same file on `main` errors **14 times** — the 2D `image_load_mip` + `glc` coherent-view path is refused there. - GPU regression on **MoltenVK 1.4.2**: `--filter ps_texture` **8/8 PASS**, `--filter ps_tex` **12/12 PASS** (`ps_texoff`/`ps_texoff_implicit` note the device's ±8 texel-offset limit, unchanged). - Not run: GPU execution of the new 2D `image_load_mip` `glc` path — there is no `.asm` fixture for it; the semantic suite is the evidence here. AI-assisted; synthetic fixtures only, no game data.
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/1572/head:github-bot/gh-1572'
git switch 'github-bot/gh-1572'

Merge

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