Translate ordinary per-sample texture reads on multisampled images (SHADER-IMAGE-LOAD-MSAA) #1355

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

@⁠titoreinaldo on GitHub · 2026-11-24 22:23 UTC · original
titoreinaldo:contrib/msaa-image-load → main · +188 −10 · 4 files · 1 commits · open

Claimed in the coordination issue as SHADER-IMAGE-LOAD-MSAA.

Depends on: #1199 for merge coordination. Both PRs touch the typed multisample declarations in tools/rdna2spirv.py. This branch builds directly on 66d4f5aa and merges cleanly with 51a6074d. Whichever lands second needs a rebase. Credit to @⁠madhyn for the shared typed declarations and view selection in 4cd97486.

What changed

Ordinary GFX10 image_load can read selected color channels from one sample of a pixel. The standalone translator previously rejected both multisampled dimensions. With --msaa-image-load it now consumes x, y, optional array slice and the explicit sample ID, then emits a typed Vulkan fetch. The opt-in targets devices whose bindless layout exposes all three numeric classes at bindings 20–25. The new contract row and its references are in docs/msaa_image_load.md. The specialized multi-sample gather remains tracked in #1199. AMD RDNA2 ISA, table 42

Tested

  • Exact submitted head ab4c9c59e9a8105928f210a6572687105db263c1. Seven independently generated gfx1030 programs: upstream base translated 0/7 (three 2D and four array rejections). With the target option, 7/7 translated and passed spirv-val. One is a deliberate sample-zero control.
  • Physical runs used Windows 11 Pro 26H2 build 26300.9974. The runner explicitly selected the NVIDIA GeForce RTX 3070 eGPU (PCI 10de:2484, driver 610.88) and Intel Arc Graphics (PCI 8086:7d55, driver 32.0.101.8132). Each adapter passed 18/18 positive dispatches, 576/576 four-word results, with zero skipped cases and zero Khronos validation errors. The control produced exactly 72 expected mismatches on each adapter. Inputs distinguish four samples, two array layers, all three numeric classes, packed addresses and sparse D16 results. Reproduction commands, both scripts and complete output
  • python -I -u scripts/run_semantic_tests.py -j 10 tests/semantic reported 471 files, 6,171 tests and zero failed files. The ordinary baseline GPU suite on 66d4f5aa recorded 235 passes / 17 skips on NVIDIA and 217 passes / 35 skips on Intel, with zero failures on either. The new physical measurements cover translated Vulkan output. Native RDNA2 remains unmeasured here.

AI-assisted: yes, with Codex. All inputs in this report were generated for the tests.

**@⁠titoreinaldo** on GitHub · 2026-11-24 22:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1355) `titoreinaldo:contrib/msaa-image-load` → `main` · +188 −10 · 4 files · 1 commits · open Claimed in the coordination issue as [SHADER-IMAGE-LOAD-MSAA](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14). Depends on: #1199 for merge coordination. Both PRs touch the typed multisample declarations in `tools/rdna2spirv.py`. This branch builds directly on `66d4f5aa` and merges cleanly with `51a6074d`. Whichever lands second needs a rebase. Credit to @⁠madhyn for the shared typed declarations and view selection in `4cd97486`. ### What changed Ordinary GFX10 `image_load` can read selected color channels from one sample of a pixel. The standalone translator previously rejected both multisampled dimensions. With `--msaa-image-load` it now consumes x, y, optional array slice and the explicit sample ID, then emits a typed Vulkan fetch. The opt-in targets devices whose bindless layout exposes all three numeric classes at bindings 20–25. The new contract row and its references are in `docs/msaa_image_load.md`. The specialized multi-sample gather remains tracked in #1199. [AMD RDNA2 ISA, table 42](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf#page=72) ### Tested - Exact submitted head `ab4c9c59e9a8105928f210a6572687105db263c1`. Seven independently generated gfx1030 programs: upstream base translated 0/7 (three 2D and four array rejections). With the target option, 7/7 translated and passed `spirv-val`. One is a deliberate sample-zero control. - Physical runs used Windows 11 Pro 26H2 build 26300.9974. The runner explicitly selected the NVIDIA GeForce RTX 3070 eGPU (PCI 10de:2484, driver 610.88) and Intel Arc Graphics (PCI 8086:7d55, driver 32.0.101.8132). Each adapter passed 18/18 positive dispatches, 576/576 four-word results, with zero skipped cases and zero Khronos validation errors. The control produced exactly 72 expected mismatches on each adapter. Inputs distinguish four samples, two array layers, all three numeric classes, packed addresses and sparse D16 results. [Reproduction commands, both scripts and complete output](https://github.com/titoreinaldo/leonida/tree/5ec71104dba9f21889423c755514059037c29590/verification/msaa) - `python -I -u scripts/run_semantic_tests.py -j 10 tests/semantic` reported 471 files, 6,171 tests and zero failed files. The ordinary baseline GPU suite on `66d4f5aa` recorded 235 passes / 17 skips on NVIDIA and 217 passes / 35 skips on Intel, with zero failures on either. The new physical measurements cover translated Vulkan output. Native RDNA2 remains unmeasured here. AI-assisted: yes, with Codex. All inputs in this report were generated for the tests.
SHADER-IMAGE-LOAD-MSAA. Reuse typed multisample declarations and view selection from madhyn in #1199 (4cd97486). Gate the standalone translator on the target layout and test sample, slice, channel and numeric-class selection with synthetic inputs. Codex-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:48:35 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 15:02 UTC · original

Reviewed ab4c9c59e: ran the new test and the image/typed-load regression subset on both trees — test_image_load_multisample.py passes on the PR (spirv-as/val subtest skipped here) and fails on main, which rejects the instruction with Unsupported: image_load 2D_MSAA; typed-dims, dynamic-index, coherent, store-dmask/d16, gather4 and test_image_load_typed all pass on both trees; a probe ran d16 loads (a16/plain, flat/array, float/uint/sint) through the interpreter and every packed half matched; bindings 20+2*cls+arr match runtime/src/vulkan_bindless.h. Findings: docs/msaa_image_load.md is the only doc missing from the docs/README.md index; the commit message's "from madhyn in #1199 (4cd97486)" cites a SHA that is not in this repository, and #1199 here is a different change (bindless array sizing), so the attribution could not be verified. No code bug found. AI-assisted review.

Recommendation: Fix first

**@⁠PierreEbele** on GitHub · 2026-11-25 15:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1355#issuecomment-7166211608) Reviewed ab4c9c59e: ran the new test and the image/typed-load regression subset on both trees — test_image_load_multisample.py passes on the PR (spirv-as/val subtest skipped here) and fails on main, which rejects the instruction with `Unsupported: image_load 2D_MSAA`; typed-dims, dynamic-index, coherent, store-dmask/d16, gather4 and test_image_load_typed all pass on both trees; a probe ran d16 loads (a16/plain, flat/array, float/uint/sint) through the interpreter and every packed half matched; bindings 20+2*cls+arr match runtime/src/vulkan_bindless.h. Findings: docs/msaa_image_load.md is the only doc missing from the docs/README.md index; the commit message's "from madhyn in #1199 (4cd97486)" cites a SHA that is not in this repository, and #1199 here is a different change (bindless array sizing), so the attribution could not be verified. No code bug found. AI-assisted review. **Recommendation:** Fix first
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/1355/head:github-bot/gh-1355'
git switch 'github-bot/gh-1355'

Merge

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