GPU fixture for v_mqsad_u32_u8 through the translated path (TEST-644) #36

Closed
Andretuta wants to merge 3 commits from upstream-pr/36 into main
Andretuta commented 2026-11-24 02:04:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:04:45Z.


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

TEST-644, the v_mqsad_u32_u8 part (claim). The ds_wrxchg2 part is already run by cs_w32_new_ops.asm on main, and the open #3208 and #2003 add fixtures for it, so it is left to them.

What

The v_mqsad_u32_u8 row of docs/design.md was hardware-verified on RDNA2 (native, through hw_oracle), but the translated path had never run on a GPU (Not GPU-verified). This adds the fixture:

  • runtime/test/shaders/cs_w32_mqsad_u32.asm runs v_mqsad_u32_u8 twice. S0 = 0x88776655_44332211. S1 = 0x40005000, whose bytes 0 and 2 are zero, so the masked SAD has to skip them.
    • A, in place (D = S2): S2 = {0xFFFFFFF0, 1, 2, 3}, so accumulator 0 wraps at 32 bits.
    • B, D over S0 (v[2:5] over v[2:3]): this only gives the expected words if every source is read before the first write, as the row says.
  • The expected words are derived step by step in the .asm header from the ISA pseudocode, and checked by the same formula in Python: 0x22 0x33 0x34 0x3F 0x132 0x232 0x332 0x43C.
  • It is registered in runtime/test/shaders/check.py and scripts/run_gpu_tests.py next to cs_w32_new_ops, as a wave32 fixture.
  • The row in docs/design.md is now GPU-checked.

Tested (RTX 3060, Ampere, driver 616.64, Windows 11)

  • run_gpu_tests.py --filter cs_w32_mqsad_u32: translated, passes spirv-val, PASS (34 51 52 63 306 562 818 1084). It also passes with LEONIDA_W64_EMULATE=1.
  • tests/test_run_gpu_tests.py, test_run_gpu_tests_paths.py (20), test_shader_checks.py (83), test_ctest_registration.py, test_docs_design_rows.py and test_docs_links.py pass, and git diff --check is clean.

Since then it has also passed on an AMD RX 6700 XT (RDNA2), an RTX 5070 Ti and an Apple M2 (MoltenVK); the row says so (6db3a228).

Thanks

  • @Kam471 for the RTX 5070 Ti run (Blackwell): the same eight words.
  • @justr4mzi for the AMD RX 6700 XT run (RDNA2, under validation), which makes it hardware-exact as well.
  • @bobcatchris for the Apple M2 / MoltenVK run, with a negative control on the base.
  • @rgvxsthi for the AMD RX 9070 run (RDNA4, LLPC).
  • @JRamos1993 for the RTX 5090 run.
  • @gertify for the Intel UHD 630 run (Mesa ANV).
  • @epzlo for the AMD RX 7600 run (RADV, RDNA3).
  • @carlos-seiffert: tested on RTX 2060.
  • @LukeOsland1 for the RTX 4070 Ti SUPER run (the same eight words) and the corpus count: none of the 26,503 shader listings uses the instruction.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464687510 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/36). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:04:45Z. --- > Carried over from **old PR 4669** by `rafaelpssz` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/4669`, 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. > `rafaelpssz`: 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): TEST-644, the `v_mqsad_u32_u8` part ([claim](https://github.com/ItsNotRexed/Leonida/issues/4571#issuecomment-7091122243)). The `ds_wrxchg2` part is already run by `cs_w32_new_ops.asm` on `main`, and the open `#3208` and `#2003` add fixtures for it, so it is left to them. ### What The `v_mqsad_u32_u8` row of `docs/design.md` was hardware-verified on RDNA2 (native, through `hw_oracle`), but the translated path had never run on a GPU (**Not GPU-verified**). This adds the fixture: - `runtime/test/shaders/cs_w32_mqsad_u32.asm` runs `v_mqsad_u32_u8` twice. S0 = `0x88776655_44332211`. S1 = `0x40005000`, whose bytes 0 and 2 are zero, so the masked SAD has to skip them. - **A, in place (D = S2):** S2 = {0xFFFFFFF0, 1, 2, 3}, so accumulator 0 wraps at 32 bits. - **B, D over S0** (`v[2:5]` over `v[2:3]`): this only gives the expected words if every source is read before the first write, as the row says. - The expected words are derived step by step in the `.asm` header from the ISA pseudocode, and checked by the same formula in Python: `0x22 0x33 0x34 0x3F 0x132 0x232 0x332 0x43C`. - It is registered in `runtime/test/shaders/check.py` and `scripts/run_gpu_tests.py` next to `cs_w32_new_ops`, as a wave32 fixture. - The row in `docs/design.md` is now **GPU-checked**. ### Tested (RTX 3060, Ampere, driver 616.64, Windows 11) - `run_gpu_tests.py --filter cs_w32_mqsad_u32`: translated, passes `spirv-val`, **PASS** (`34 51 52 63 306 562 818 1084`). It also passes with `LEONIDA_W64_EMULATE=1`. - `tests/test_run_gpu_tests.py`, `test_run_gpu_tests_paths.py` (20), `test_shader_checks.py` (83), `test_ctest_registration.py`, `test_docs_design_rows.py` and `test_docs_links.py` pass, and `git diff --check` is clean. Since then it has also passed on an AMD RX 6700 XT (RDNA2), an RTX 5070 Ti and an Apple M2 (MoltenVK); the row says so (`6db3a228`). ### Thanks - `@Kam471` for the RTX 5070 Ti run (Blackwell): the same eight words. - `@justr4mzi` for the AMD RX 6700 XT run (RDNA2, under validation), which makes it hardware-exact as well. - `@bobcatchris` for the Apple M2 / MoltenVK run, with a negative control on the base. - `@rgvxsthi` for the AMD RX 9070 run (RDNA4, LLPC). - `@JRamos1993` for the RTX 5090 run. - `@gertify` for the Intel UHD 630 run (Mesa ANV). - `@epzlo` for the AMD RX 7600 run (RADV, RDNA3). - `@carlos-seiffert`: tested on RTX 2060. - `@LukeOsland1` for the RTX 4070 Ti SUPER run (the same eight words) and the corpus count: none of the 26,503 shader listings uses the instruction.
ImLele69 commented 2026-11-24 11:37:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ImLele69 on 2026-11-24T11:37:13Z.


Tested on Linux, merged onto main 21625bca8 (PR head 9339b4116, 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 198/249 passed, 49 skipped 197/248 passed, 49 skipped
LEONIDA_W64_EMULATE=1 230/249 passed, 17 skipped 229/248 passed, 17 skipped
run_semantic_tests.py tests/semantic 465 files, 6108 tests, 0 files failed in 109 s with 16 jobs 465 files, 6108 tests, 0 files failed

New fixture cs_w32_mqsad_u32: PASS in both modes.

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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7130331667 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/36#issuecomment-7130331667). Originally posted by [ImLele69](https://github.com/ImLele69) on 2026-11-24T11:37:13Z. --- Tested on Linux, merged onto `main` `21625bca8` (PR head `9339b4116`, 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 | 198/249 passed, 49 skipped | 197/248 passed, 49 skipped | | `LEONIDA_W64_EMULATE=1` | 230/249 passed, 17 skipped | 229/248 passed, 17 skipped | | `run_semantic_tests.py tests/semantic` | 465 files, 6108 tests, 0 files failed in 109 s with 16 jobs | 465 files, 6108 tests, 0 files failed | New fixture `cs_w32_mqsad_u32`: PASS in both modes. 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).
potatoe0100 commented 2026-11-25 10:12:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by potatoe0100 on 2026-11-25T10:12:12Z.


Tested 9339b4116 merged onto main 57ba40bd6, native Windows 11 Pro 26H2 (build 26300), NVIDIA GeForce RTX 4060 (subgroup 32), driver 621.14, VS 2022 RelWithDebInfo + Ninja, llvm-mc 21.1.8.

It no longer merges cleanly: docs/design.md and the compute name list in scripts/run_gpu_tests.py conflict. For the test I kept main's side of both and added "cs_w32_mqsad_u32" to main's list.

  • run_gpu_tests.py --filter mqsad: PASS cs_w32_mqsad_u32 34 51 52 63 306 562 818 1084, natively and with LEONIDA_W64_EMULATE=1.
  • With LEONIDA_VK_VALIDATION=1 VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1: still passes, 0 validation messages, both modes.

AI-assisted testing (non-developer tester).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7159370288 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/36#issuecomment-7159370288). Originally posted by [potatoe0100](https://github.com/potatoe0100) on 2026-11-25T10:12:12Z. --- Tested `9339b4116` merged onto `main` `57ba40bd6`, native Windows 11 Pro 26H2 (build 26300), NVIDIA GeForce RTX 4060 (subgroup 32), driver 621.14, VS 2022 RelWithDebInfo + Ninja, llvm-mc 21.1.8. It no longer merges cleanly: `docs/design.md` and the compute name list in `scripts/run_gpu_tests.py` conflict. For the test I kept `main`'s side of both and added `"cs_w32_mqsad_u32"` to `main`'s list. - `run_gpu_tests.py --filter mqsad`: `PASS cs_w32_mqsad_u32 34 51 52 63 306 562 818 1084`, natively and with `LEONIDA_W64_EMULATE=1`. - With `LEONIDA_VK_VALIDATION=1 VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1`: still passes, 0 validation messages, both modes. AI-assisted testing (non-developer tester).
MoonEyes commented 2026-11-30 17:39:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T17:39:02Z.


Maintainer review: not ready to merge. This remains a draft; the latest independent comment reports conflicts in docs/design.md and scripts/run_gpu_tests.py, and the current CI run was cancelled. Historical GPU runs are useful evidence but do not validate the current merge result. Please resolve the conflicts, update against current main, run the focused and required full validation, and mark ready before review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7286638072 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/36#issuecomment-7286638072). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T17:39:02Z. --- Maintainer review: not ready to merge. This remains a draft; the latest independent comment reports conflicts in `docs/design.md` and `scripts/run_gpu_tests.py`, and the current CI run was cancelled. Historical GPU runs are useful evidence but do not validate the current merge result. Please resolve the conflicts, update against current main, run the focused and required full validation, and mark ready before review.
aslan2142 commented 2026-12-01 11:42:12 +00:00 (Migrated from github.com)

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


Draft PR review note: this carried-over PR currently conflicts with main (in docs/design.md, runtime/test/shaders/check.py, and scripts/run_gpu_tests.py) and its CI run was cancelled. Please rebase onto current main, mark ready for review, and run fresh CI if you want to land cs_w32_mqsad_u32.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310011921 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/36#issuecomment-7310011921). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:42:12Z. --- Draft PR review note: this carried-over PR currently conflicts with `main` (in `docs/design.md`, `runtime/test/shaders/check.py`, and `scripts/run_gpu_tests.py`) and its CI run was cancelled. Please rebase onto current `main`, mark ready for review, and run fresh CI if you want to land `cs_w32_mqsad_u32`. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 12:04:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:04:13Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310606546 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/36#issuecomment-7310606546). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:04:13Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 12:56:46 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Now ready for review, requesting changes before merge:

  • Merge conflicts (CONFLICTING/DIRTY): conflicts with main in docs/design.md, runtime/test/shaders/check.py, and scripts/run_gpu_tests.py.
  • CI: all checks from 2026-11-24 were cancelled. Please rebase onto current main and run fresh green CI.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6131685010 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/36#pullrequestreview-6131685010). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:56:46Z. **Review:** CHANGES_REQUESTED --- Now ready for review, requesting changes before merge: - **Merge conflicts (`CONFLICTING`/`DIRTY`)**: conflicts with `main` in `docs/design.md`, `runtime/test/shaders/check.py`, and `scripts/run_gpu_tests.py`. - **CI**: all checks from 2026-11-24 were cancelled. Please rebase onto current `main` and run fresh green CI. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 16:19:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:19:40Z.


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:7317418408 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/36#issuecomment-7317418408). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:19:40Z. --- 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!36
No description provided.