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

Open
github-bot wants to merge 3 commits from github-bot/gh-36 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:04 UTC · original
ubiquitarianism:old-pr/4669 → main · +52 −4 · 4 files · 3 commits · draft

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.
**@⁠Andretuta** on GitHub · 2026-11-24 02:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/36) `ubiquitarianism:old-pr/4669` → `main` · +52 −4 · 4 files · 3 commits · draft > 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.
cs_w32_mqsad_u32 runs v_mqsad_u32_u8 twice on S0 = 0x88776655_44332211 and
S1 = 0x40005000 (two zero bytes the masked SAD skips): in place with D = S2
(one accumulator wraps at 32 bits), and with D over S0, which only gives the
expected words if every source is read before the first write. Expected
words derived from the ISA pseudocode in the .asm. Exact on an RTX 3060
(616.64), native and with LEONIDA_W64_EMULATE=1; the design.md row is now
GPU-checked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@justr4mzi (RX 6700 XT, gfx1031), @Kam471 (RTX 5070 Ti) and @bobcatchris
(Apple M2 / MoltenVK) ran cs_w32_mqsad_u32 with the same eight words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two conflicts:
- docs/design.md: the quad-byte SAD row takes main's wording (full test paths and test names); the v_mqsad_u32_u8
  row keeps this branch's GPU-checked sentence, the only difference from main's.
- runtime/test/shaders/check.py: main's fixture list, with cs_w32_mqsad_u32 added.

On the merged tree, with vk_compute_test, vk_store_test and vk_harness built from it: cs_w32_mqsad_u32 passes on an
RTX 3060 (610.88), native and with LEONIDA_W64_EMULATE=1, the same eight words (34 51 52 63 306 562 818 1084).
tests/semantic/test_alu_mqsad_u32.py and tests/test_docs_links.py pass.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:41:50 +00:00
Author
Owner

@⁠ImLele69 on GitHub · 2026-11-24 11:37 UTC · original

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

**@⁠ImLele69** on GitHub · 2026-11-24 11:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/36#issuecomment-7130331667) 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).
Author
Owner

@⁠potatoe0100 on GitHub · 2026-11-25 10:12 UTC · original

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

**@⁠potatoe0100** on GitHub · 2026-11-25 10:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/36#issuecomment-7159370288) 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).
This pull request has changes conflicting with the target branch.
  • docs/design.md
  • runtime/test/shaders/check.py
  • scripts/run_gpu_tests.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/36/head:github-bot/gh-36'
git switch 'github-bot/gh-36'

Merge

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