tests: GPU fixtures for the packed 16-bit integer ops #1037

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

@⁠YaBulochka on GitHub · 2026-11-24 17:06 UTC · original
YaBulochka:feat/fixtures-batch3 → main · +270 −3 · 9 files · 1 commits · open

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

Depends on: none. Overlaps #366 (v_pk_add_u16 / v_pk_mad_i16) and #171/#853 (cs_w32_pk_rel_ext); this PR covers all eleven integer forms in two fixtures with the full op_sel/op_sel_hi/clamp grid and CPU fixtures, so the overlapping rows can be dropped from whichever lands second.

What and why

Two wave32 GPU fixtures for the packed 16-bit integer ops in docs/design.md:

  • cs_pk_int16_u: the six u16 forms (v_pk_add/sub_u16, v_pk_mul_lo_u16, v_pk_mad_u16, v_pk_max/min_u16) with op_sel/op_sel_hi and clamp on add and sub;
  • cs_pk_int16_i: the five i16 forms with op_sel/op_sel_hi and clamp on add, sub and mad.

Each header derives its eight words. Both are registered in check.py and scripts/run_gpu_tests.py; tests/semantic/test_pk_int16_gpu_fixtures.py runs the same disassembly through the translator and the interpreter and checks the headers, CS_DUMPS and the runner table against it. docs/design.md and docs/shader_validation.md name the fixtures and the measured result. The .s files under tests/semantic/fixtures/disasm/ are generated from the author's hand-written .asm sources by tests/semantic/regen_fixtures.py (the marker-based mechanism already on main), not a dump from the game.

Tested

  • python3 -m unittest discover -s tests/semantic -p "test_pk_int16_gpu_fixtures.py": 3 tests, OK.
  • python3 -m pytest tests/test_shader_checks.py -x -q: 91 passed, 333 subtests passed.
  • python3 tests/semantic/regen_fixtures.py --check: clean.
  • GPU (the author's measurement, not repeated here): gfx1036, RADV RAPHAEL_MENDOCINO, Mesa 27.0.0-devel, 2/2 fixtures, 16/16 words exact.

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 row now names the GPU confirmation.)
**@⁠YaBulochka** on GitHub · 2026-11-24 17:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1037) `YaBulochka:feat/fixtures-batch3` → `main` · +270 −3 · 9 files · 1 commits · open Claimed in the coordination issue as: carried over from the closed original repository (branch `feat/fixtures-batch3`); no new claim Depends on: none. Overlaps #366 (`v_pk_add_u16` / `v_pk_mad_i16`) and #171/#853 (`cs_w32_pk_rel_ext`); this PR covers all eleven integer forms in two fixtures with the full `op_sel`/`op_sel_hi`/`clamp` grid and CPU fixtures, so the overlapping rows can be dropped from whichever lands second. ### What and why Two wave32 GPU fixtures for the packed 16-bit integer ops in `docs/design.md`: - `cs_pk_int16_u`: the six u16 forms (`v_pk_add/sub_u16`, `v_pk_mul_lo_u16`, `v_pk_mad_u16`, `v_pk_max/min_u16`) with `op_sel`/`op_sel_hi` and `clamp` on add and sub; - `cs_pk_int16_i`: the five i16 forms with `op_sel`/`op_sel_hi` and `clamp` on add, sub and mad. Each header derives its eight words. Both are registered in `check.py` and `scripts/run_gpu_tests.py`; `tests/semantic/test_pk_int16_gpu_fixtures.py` runs the same disassembly through the translator and the interpreter and checks the headers, `CS_DUMPS` and the runner table against it. `docs/design.md` and `docs/shader_validation.md` name the fixtures and the measured result. The `.s` files under `tests/semantic/fixtures/disasm/` are generated from the author's hand-written `.asm` sources by `tests/semantic/regen_fixtures.py` (the marker-based mechanism already on main), not a dump from the game. ### Tested - `python3 -m unittest discover -s tests/semantic -p "test_pk_int16_gpu_fixtures.py"`: 3 tests, OK. - `python3 -m pytest tests/test_shader_checks.py -x -q`: 91 passed, 333 subtests passed. - `python3 tests/semantic/regen_fixtures.py --check`: clean. - GPU (the author's measurement, not repeated here): gfx1036, RADV `RAPHAEL_MENDOCINO`, Mesa 27.0.0-devel, 2/2 fixtures, 16/16 words exact. 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 row now names the GPU confirmation.)
cs_pk_int16_u covers the six u16 forms with op_sel/op_sel_hi and clamp on
add/sub; cs_pk_int16_i covers the five i16 forms with op_sel/op_sel_hi and
clamp on add/sub/mad.  Both are wave32, store eight words derived in their
headers, and are registered in check.py, scripts/run_gpu_tests.py and
tests/semantic/regen_fixtures.py.  test_pk_int16_gpu_fixtures.py runs the
same disassembly in the interpreter and keeps the headers and both runner
tables in step.  docs/design.md row 247 and docs/shader_validation.md name
the fixtures and the measured result.

GPU: gfx1036 (RADV RAPHAEL_MENDOCINO, Mesa 27.0.0-devel), 2/2 fixtures,
16/16 words exact.

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:34:38 +00:00
Author
Owner

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

Tested on NVIDIA Blackwell: head f87562179 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_pk_int16_u PASS 4294901767 393213 4294574084 13 4294836228 196609 4294901765 0
cs_pk_int16_i PASS 98304 229378 2147549185 196607 4294934529 2147516416 2147450880 2147450879
  • Control: with the first expected word of cs_pk_int16_u changed in scripts/run_gpu_tests.py, the runner reports
    FAIL (then reverted).
  • test_pk_int16_gpu_fixtures.py: 3 tests, OK.

So the u16/i16 op_sel/op_sel_hi/clamp results the PR measured on gfx1036 also hold on NVIDIA.

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. 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/1037#issuecomment-7140763433) **Tested on NVIDIA Blackwell:** head `f87562179` 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_pk_int16_u` | PASS | 4294901767 393213 4294574084 13 4294836228 196609 4294901765 0 | | `cs_pk_int16_i` | PASS | 98304 229378 2147549185 196607 4294934529 2147516416 2147450880 2147450879 | - Control: with the first expected word of `cs_pk_int16_u` changed in `scripts/run_gpu_tests.py`, the runner reports FAIL (then reverted). - `test_pk_int16_gpu_fixtures.py`: 3 tests, OK. So the u16/i16 `op_sel`/`op_sel_hi`/`clamp` results the PR measured on gfx1036 also hold on NVIDIA. **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. 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 f87562179 merged onto main 3aa97542: cs_pk_int16_i and cs_pk_int16_u 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/1037#issuecomment-7141981063) Tested `f87562179` merged onto main `3aa97542`: `cs_pk_int16_i` and `cs_pk_int16_u` 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 can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1037/head:github-bot/gh-1037'
git switch 'github-bot/gh-1037'

Merge

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