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

Closed
titoreinaldo wants to merge 1 commit from upstream-pr/1355 into main
titoreinaldo commented 2026-11-24 22:23:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by titoreinaldo on 2026-11-24T22:23:10Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5481327199 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1355). Originally posted by [titoreinaldo](https://github.com/titoreinaldo) on 2026-11-24T22:23:10Z. --- Claimed in the coordination issue as [SHADER-IMAGE-LOAD-MSAA](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144288740). 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.
PierreEbele commented 2026-11-25 15:02:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T15:02:34Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166211608 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1355#issuecomment-7166211608). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T15:02:34Z. --- 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
MoonEyes commented 2026-11-28 02:59:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T02:59:19Z.


Hi @titoreinaldo, thanks for this pull request. It currently conflicts with main (conflicting file(s): tools/rdna2spirv.py), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232720891 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1355#issuecomment-7232720891). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T02:59:19Z. --- Hi @titoreinaldo, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `tools/rdna2spirv.py`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 11:46:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:46:03Z.

Review: CHANGES_REQUESTED


This PR cannot merge in its current state:

  • Merge conflict with main in tools/rdna2spirv.py (also note coordination dependency with #1199).
  • No CI run on current head ab4c9c5.

Please rebase onto current main and obtain a green CI run.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130590471 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1355#pullrequestreview-6130590471). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:46:03Z. **Review:** CHANGES_REQUESTED --- This PR cannot merge in its current state: - **Merge conflict** with `main` in `tools/rdna2spirv.py` (also note coordination dependency with `#1199`). - **No CI run** on current head `ab4c9c5`. Please rebase onto current `main` and obtain a green CI run. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:22:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:22:41Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319201885 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1355#issuecomment-7319201885). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:22:41Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1355
No description provided.