test: GPU fixtures for masked SAD, v_swaprel and s_movrels #1036

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

@⁠YaBulochka on GitHub · 2026-11-24 17:06 UTC · original
YaBulochka:feat/fixtures-batch2 → main · +607 −80 · 11 files · 1 commits · open

Claimed in the coordination issue as: carried over from the closed original repository (branch feat/fixtures-batch2); no new claim

Depends on: none. Overlaps #364 (v_swaprel_b32, s_movrels_b32/b64), #171/#853 (cs_w32_pk_rel_ext: packed ints, the rel moves, ds_or/xor_b64), #179 (s_movrels_b64) and #36 (v_mqsad_u32_u8); this PR's fixtures are separate files with their own words and CPU fixtures, so whichever lands first, the other can drop the row it covered.

What and why

Three wave32 GPU fixtures for docs/design.md rows that had no Vulkan check:

  • cs_msad_mqsad: v_msad_u8 and v_mqsad_u32_u8 — masked bytes, the sliding 64-bit windows and 32-bit accumulator wraps;
  • cs_swaprel: both M0 fields, ignored M0 bits and a self-swap;
  • cs_movrels: s_movrels_b32/b64, an overlapping destination and an unchanged SCC.

Each expected set of eight words is derived in the .asm header, registered in check.py (WAVE32_DUMPS, WAVE32_LANE_DUMPS, CS_DUMPS) and scripts/run_gpu_tests.py (the main table, the 64-bit exclusion and the skip list). tests/semantic/fixtures/disasm/*.s are the generated disassembly fixtures the semantic suite pins; they are the author's hand-written ISA programs, not a dump from the game. tests/semantic/test_msad_mqsad_fixture.py and test_rel_addressing_fixture.py replay the same words through the translator and spirv_mini_interp and keep the headers and both runner tables in step. docs/design.md rows for the three ops now name the fixtures.

Tested

  • python3 -m unittest discover -s tests/semantic: 6,175 tests, OK (3 skipped), on CPU in this environment.
  • python3 -m pytest tests/test_shader_checks.py -x -q: 91 passed, 333 subtests passed.
  • python3 tests/semantic/regen_fixtures.py --check: clean (the fixtures match the marked .asm sources).
  • GPU (the author's measurement, not repeated here): gfx1036, RADV, Mesa 27.0.0-devel, all three fixtures match their headers word for word.

AI-assisted: yes.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No new rule; the existing rows now name the GPU confirmation.)
**@⁠YaBulochka** on GitHub · 2026-11-24 17:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1036) `YaBulochka:feat/fixtures-batch2` → `main` · +607 −80 · 11 files · 1 commits · open Claimed in the coordination issue as: carried over from the closed original repository (branch `feat/fixtures-batch2`); no new claim Depends on: none. Overlaps #364 (`v_swaprel_b32`, `s_movrels_b32/b64`), #171/#853 (`cs_w32_pk_rel_ext`: packed ints, the rel moves, `ds_or/xor_b64`), #179 (`s_movrels_b64`) and #36 (`v_mqsad_u32_u8`); this PR's fixtures are separate files with their own words and CPU fixtures, so whichever lands first, the other can drop the row it covered. ### What and why Three wave32 GPU fixtures for `docs/design.md` rows that had no Vulkan check: - `cs_msad_mqsad`: `v_msad_u8` and `v_mqsad_u32_u8` — masked bytes, the sliding 64-bit windows and 32-bit accumulator wraps; - `cs_swaprel`: both M0 fields, ignored M0 bits and a self-swap; - `cs_movrels`: `s_movrels_b32/b64`, an overlapping destination and an unchanged SCC. Each expected set of eight words is derived in the `.asm` header, registered in `check.py` (`WAVE32_DUMPS`, `WAVE32_LANE_DUMPS`, `CS_DUMPS`) and `scripts/run_gpu_tests.py` (the main table, the 64-bit exclusion and the skip list). `tests/semantic/fixtures/disasm/*.s` are the generated disassembly fixtures the semantic suite pins; they are the author's hand-written ISA programs, not a dump from the game. `tests/semantic/test_msad_mqsad_fixture.py` and `test_rel_addressing_fixture.py` replay the same words through the translator and `spirv_mini_interp` and keep the headers and both runner tables in step. `docs/design.md` rows for the three ops now name the fixtures. ### Tested - `python3 -m unittest discover -s tests/semantic`: 6,175 tests, OK (3 skipped), on CPU in this environment. - `python3 -m pytest tests/test_shader_checks.py -x -q`: 91 passed, 333 subtests passed. - `python3 tests/semantic/regen_fixtures.py --check`: clean (the fixtures match the marked `.asm` sources). - GPU (the author's measurement, not repeated here): gfx1036, RADV, Mesa 27.0.0-devel, all three fixtures match their headers word for word. AI-assisted: yes. ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No new rule; the existing rows now name the GPU confirmation.)
cs_msad_mqsad covers v_msad_u8 and v_mqsad_u32_u8: masked bytes, the
sliding 64-bit windows, and 32-bit accumulator wraps.
cs_swaprel covers both M0 fields, ignored M0 bits and a self-swap;
cs_movrels covers s_movrels_b32/b64, an overlapping destination and
an unchanged SCC. All three are wave32 dumps registered with check.py
and scripts/run_gpu_tests.py, with CPU fixtures in tests/semantic.

Measured on the RDNA2 iGPU (gfx1036, RADV, Mesa 27.0.0-devel):
all three match their headers bit-for-bit.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:34:37 +00:00
Author
Owner

@⁠Mykolas009 on GitHub · 2026-11-24 18:31 UTC · original

Tested on NVIDIA Blackwell: head ae45f4f92 merged onto main 32950551e (clean merge, not pushed).

  • NVIDIA GeForce RTX 5060 8 GB (subgroup 32..32, no 64-wide subgroups), driver 610.88; Windows 11 Pro 26300;
    MSVC (VS 18) + Ninja, RelWithDebInfo; llvm-mc 21.1.8 built by scripts\build_llvm_mc.ps1; Python 3.14.3.
  • python -I scripts/run_gpu_tests.py --filter <name>, native wave32, all words exact:
fixture result words
cs_msad_mqsad PASS 48 4294967284 4294967290 7 2147483654 305419900 3735928559 255
cs_swaprel PASS 11 22 55 44 77 55 66 88
cs_movrels PASS 170 204 187 204 187 187 1 238
  • Control: with the first expected word of cs_swaprel changed in scripts/run_gpu_tests.py, the runner reports FAIL
    (then reverted).
  • test_msad_mqsad_fixture.py (4 tests) and test_rel_addressing_fixture.py (6 tests): OK.

Not tested

  • runtime/test/shaders/check.py (no SPIRV-Tools here, so build.py stops at spirv-as); spirv-val was skipped
    by the runner for the same reason. Wave64 emulation, other NVIDIA generations, Linux.

AI use

  • Claude Code (Claude Opus 5.5) built and ran the tests and drafted this; I checked the results before posting.
**@⁠Mykolas009** on GitHub · 2026-11-24 18:31 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1036#issuecomment-7140762370) **Tested on NVIDIA Blackwell:** head `ae45f4f92` merged onto `main` `32950551e` (clean merge, not pushed). - NVIDIA GeForce RTX 5060 8 GB (subgroup 32..32, no 64-wide subgroups), driver 610.88; Windows 11 Pro 26300; MSVC (VS 18) + Ninja, RelWithDebInfo; `llvm-mc` 21.1.8 built by `scripts\build_llvm_mc.ps1`; Python 3.14.3. - `python -I scripts/run_gpu_tests.py --filter <name>`, native wave32, all words exact: | fixture | result | words | |---|---|---| | `cs_msad_mqsad` | PASS | 48 4294967284 4294967290 7 2147483654 305419900 3735928559 255 | | `cs_swaprel` | PASS | 11 22 55 44 77 55 66 88 | | `cs_movrels` | PASS | 170 204 187 204 187 187 1 238 | - Control: with the first expected word of `cs_swaprel` changed in `scripts/run_gpu_tests.py`, the runner reports FAIL (then reverted). - `test_msad_mqsad_fixture.py` (4 tests) and `test_rel_addressing_fixture.py` (6 tests): OK. **Not tested** - `runtime/test/shaders/check.py` (no SPIRV-Tools here, so `build.py` stops at `spirv-as`); `spirv-val` was skipped by the runner for the same reason. Wave64 emulation, other NVIDIA generations, Linux. **AI use** - Claude Code (Claude Opus 5.5) built and ran the tests and drafted this; I checked the results before posting.
Author
Owner

@⁠thesubtleties on GitHub · 2026-11-24 19:21 UTC · original

Tested ae45f4f92 merged onto main 3aa97542: cs_movrels, cs_msad_mqsad and cs_swaprel pass on the 3080 and gfx1036, native and with LEONIDA_W64_EMULATE=1. No other GPU test changes from main. run_semantic_tests.py tests/semantic: 0 files failed.

NVIDIA RTX 3080 (620.73.04) and AMD Raphael RDNA2 iGPU gfx1036 (RADV, Mesa 26.3.1), CachyOS. This runs translated SPIR-V; it is not a native RDNA2 measurement. AI-assisted (Claude Code)

**@⁠thesubtleties** on GitHub · 2026-11-24 19:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1036#issuecomment-7141980286) Tested `ae45f4f92` merged onto main `3aa97542`: `cs_movrels`, `cs_msad_mqsad` and `cs_swaprel` pass on the 3080 and gfx1036, native and with `LEONIDA_W64_EMULATE=1`. No other GPU test changes from main. `run_semantic_tests.py tests/semantic`: 0 files failed. NVIDIA RTX 3080 (620.73.04) and AMD Raphael RDNA2 iGPU gfx1036 (RADV, Mesa 26.3.1), CachyOS. This runs translated SPIR-V; it is not a native RDNA2 measurement. AI-assisted (Claude Code)
This pull request has changes conflicting with the target branch.
  • docs/design.md
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/1036/head:github-bot/gh-1036'
git switch 'github-bot/gh-1036'

Merge

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