Tests: GPU coverage for v_add/sub_nc_i16, 16-bit min3/max3/med3 and v_pk_add_u16/v_pk_mad_i16 #366

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

@⁠KoLolX3 on GitHub · 2026-11-24 03:56 UTC · original
KoLolX3:test/valu16-gpu → main · +97 −8 · 4 files · 1 commits · open

Adds a synthetic GPU fixture for 16-bit integer add/sub, min/max/median and packed add/multiply-add translations.

Rebased on main 3f81d46a; the runner conflict retains the current cs_w64x_cmp_sdst registration. Removed stale “Not GPU-verified” text where the fixture adds verification.

Tested on AMD Radeon RX 7900 XT (RADV NAVI31, Mesa 26.3.1, Linux): the fixture translated and passed spirv-val, and all eight expected words matched with subgroup size 32 in native and LEONIDA_W64_EMULATE=1 builds. python -I tests/test_run_gpu_tests.py passed 68 tests; the semantic suite passed 6,279 tests in 487 files. Compileall, make_game.py --help, check_no_game_data.py on changed files and git diff --check passed. Synthetic fixtures only, no game files.

AI-assisted: yes (Claude Code and OpenAI Codex).

**@⁠KoLolX3** on GitHub · 2026-11-24 03:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/366) `KoLolX3:test/valu16-gpu` → `main` · +97 −8 · 4 files · 1 commits · open Adds a synthetic GPU fixture for 16-bit integer add/sub, min/max/median and packed add/multiply-add translations. Rebased on `main` `3f81d46a`; the runner conflict retains the current `cs_w64x_cmp_sdst` registration. Removed stale “Not GPU-verified” text where the fixture adds verification. Tested on AMD Radeon RX 7900 XT (RADV NAVI31, Mesa 26.3.1, Linux): the fixture translated and passed `spirv-val`, and all eight expected words matched with subgroup size 32 in native and `LEONIDA_W64_EMULATE=1` builds. `python -I tests/test_run_gpu_tests.py` passed 68 tests; the semantic suite passed 6,279 tests in 487 files. Compileall, `make_game.py --help`, `check_no_game_data.py` on changed files and `git diff --check` passed. Synthetic fixtures only, no game files. AI-assisted: yes (Claude Code and OpenAI Codex).
docs/design.md marks the v_add_nc_i16/v_sub_nc_i16, 16-bit
min3/max3/med3 and packed 16-bit integer rows not GPU-verified: the
instructions were measured on hardware and the translations
CPU-checked, but the translated SPIR-V never ran on a GPU.
cs_valu16_ext.asm runs one lane with every destination preset to
0xA5A5A5A5, so the unwritten half shows: i16 clamp at both ends of the
range (one written to the high half through op_sel), the wrap without
clamp, v_med3_i16 reading S0's high half, v_max3_u16/v_min3_u16 and
v_min3_f16/v_max3_f16 (with a quiet NaN) each writing one half,
v_pk_add_u16 clamp saturating one half, and v_pk_mad_i16 with a
negative half. The eight expected words are derived in its header from
the rows. Registered in check.py and run_gpu_tests.py next to
cs_lds_b64_cmpst; the three rows note the GPU check.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:55:55 +00:00
Author
Owner

@⁠Sangonapou on GitHub · 2026-11-24 05:05 UTC · original

Tested 8df9db0b on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass

Runtime built at this head with scripts\build_runtime.ps1 (MSVC 19.51, VS Build Tools 2026); llvm-mc 23.1.6 (conda-forge), SPIRV-Tools 2026.4, Vulkan SDK 1.4.363.0. No game files.

  • run_gpu_tests.py --filter cs_valu16_ext --require-pass: PASS native and with LEONIDA_W64_EMULATE=1 (0xa5a57fff 0x8000a5a5 0xa5a58000 0xa5a50003 0x3fffb 0x3c00c000 0xffff0008 0x7000c).
  • Full suite: 258 shaders, 258 translated, 258 pass spirv-val; native 198/249 passed, 49 skipped; emulated 230/249 passed, 17 skipped, i.e. main plus this fixture. The only failures, cs_imgload_tfe and cs_imgload_d16_tfe, fail identically on main ece4ba5b on this card (main: native 197/248, emulated 229/248), the same pair as #31 / #336.
**@⁠Sangonapou** on GitHub · 2026-11-24 05:05 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/366#issuecomment-7122620466) Tested 8df9db0b on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass Runtime built at this head with `scripts\build_runtime.ps1` (MSVC 19.51, VS Build Tools 2026); `llvm-mc` 23.1.6 (conda-forge), SPIRV-Tools 2026.4, Vulkan SDK 1.4.363.0. No game files. - `run_gpu_tests.py --filter cs_valu16_ext --require-pass`: PASS native and with `LEONIDA_W64_EMULATE=1` (`0xa5a57fff 0x8000a5a5 0xa5a58000 0xa5a50003 0x3fffb 0x3c00c000 0xffff0008 0x7000c`). - Full suite: 258 shaders, 258 translated, 258 pass spirv-val; native 198/249 passed, 49 skipped; emulated 230/249 passed, 17 skipped, i.e. `main` plus this fixture. The only failures, `cs_imgload_tfe` and `cs_imgload_d16_tfe`, fail identically on `main` `ece4ba5b` on this card (main: native 197/248, emulated 229/248), the same pair as #31 / #336.
Author
Owner

@⁠ohshitwaddup on GitHub · 2026-11-24 18:13 UTC · original

Independent hardware verification of cs_valu16_ext, plus three documentation defects. The fixture is correct — all eight words reproduce exactly. Everything below the verification is about the docs/design.md row text.

Verified on a second card

RX 6900 XT (RDNA2 / GFX1030, Navi 21, PCI 1002:73bf), RADV NAVI21, Mesa 26.2.4, Vulkan 1.4.354, Nobara Linux 44, kernel 7.2.10, subgroup 32..64, run at VKC_SUBGROUP_SIZE=32:

device: AMD Radeon RX 6900 XT (RADV NAVI21) (subgroup 32..64)
compute subgroup size: 32
1 groups x 64: 0 mismatches
out[0..7] = 2779086847 2147526053 2779086848 2779054083 262139 1006682112 4294901768 458764

= 0xA5A57FFF 0x8000A5A5 0xA5A58000 0xA5A50003 0x0003FFFB 0x3C00C000 0xFFFF0008 0x0007000C — 8/8 exact against check.py and the header. Your record is an RX 7900 XT (RADV NAVI31, Mesa 26.3.1); mine is RDNA2 on a different driver, so the words now hold across two AMD generations.

As with the other Vulkan fixtures this executes the translator's SPIR-V (gfx1013 assembly → rdna2spirv.py → SPIR-V), which is what design.md means by "GPU-checked" elsewhere.

Three defects in the row edits

Each of these rows now reads, in one sentence:

**Not GPU-verified.** GPU-checked by `runtime/test/shaders/cs_valu16_ext.asm` (…
one lane, on an RX 7900 XT, RADV NAVI31, Mesa 26.3.1, Linux, native wave64 and `LEONIDA_W64_EMULATE=1`)

1. "native wave64" is not what ran. The fixture declares ; mattr: +wavefrontsize32,-wavefrontsize64 with ; group: 32,1,1, and cs_valu16_ext is listed in WAVE32_LANE_DUMPS, so both check.py and run_gpu_tests.py pin VKC_SUBGROUP_SIZE=32. My run above confirms compute subgroup size: 32. If "native wave64" is meant as "on a device whose native wave is 64" (the 7900 XT is), that is not what the words say — please use native (wave32) and LEONIDA_W64_EMULATE=1.

2. The stale "Not GPU-verified" survives, immediately followed by "GPU-checked by" in the same row. That is self-contradictory, and it means the PR does not yet achieve its own stated purpose of flipping these rows. It appears on all three:

  • Packed 16-bit integer ops (v_pk_add/sub_u16/i16, …)
  • v_add_nc_i16, v_sub_nc_i16
  • v_min3_f16, v_max3_f16, v_min3_i16, …

3. Nothing else. The arithmetic, the coverage claims (both clamp ends, op_sel writing the high half, the wrap without clamp, the unwritten half kept) all match what the fixture actually exercises — I checked the words against the claimed cases and they line up.

Summary

The eight expected words are correct and I reproduced them on RDNA2. Fix items 1 and 2 and all three rows are honest. I would like to see this merged.

AI-assisted: yes (Hermes Agent) — built the PR head, ran the fixture on an RX 6900 XT, and verified each defect above.

**@⁠ohshitwaddup** on GitHub · 2026-11-24 18:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/366#issuecomment-7140344617) Independent hardware verification of `cs_valu16_ext`, plus three documentation defects. **The fixture is correct — all eight words reproduce exactly.** Everything below the verification is about the `docs/design.md` row text. ## Verified on a second card RX 6900 XT (RDNA2 / GFX1030, Navi 21, PCI 1002:73bf), RADV NAVI21, Mesa 26.2.4, Vulkan 1.4.354, Nobara Linux 44, kernel 7.2.10, subgroup 32..64, run at `VKC_SUBGROUP_SIZE=32`: ``` device: AMD Radeon RX 6900 XT (RADV NAVI21) (subgroup 32..64) compute subgroup size: 32 1 groups x 64: 0 mismatches out[0..7] = 2779086847 2147526053 2779086848 2779054083 262139 1006682112 4294901768 458764 ``` = `0xA5A57FFF 0x8000A5A5 0xA5A58000 0xA5A50003 0x0003FFFB 0x3C00C000 0xFFFF0008 0x0007000C` — **8/8 exact** against `check.py` and the header. Your record is an RX 7900 XT (RADV NAVI31, Mesa 26.3.1); mine is RDNA2 on a different driver, so the words now hold across two AMD generations. As with the other Vulkan fixtures this executes the translator's SPIR-V (gfx1013 assembly → `rdna2spirv.py` → SPIR-V), which is what `design.md` means by "GPU-checked" elsewhere. ## Three defects in the row edits Each of these rows now reads, in one sentence: ``` **Not GPU-verified.** GPU-checked by `runtime/test/shaders/cs_valu16_ext.asm` (… one lane, on an RX 7900 XT, RADV NAVI31, Mesa 26.3.1, Linux, native wave64 and `LEONIDA_W64_EMULATE=1`) ``` **1. "native wave64" is not what ran.** The fixture declares `; mattr: +wavefrontsize32,-wavefrontsize64` with `; group: 32,1,1`, and `cs_valu16_ext` is listed in `WAVE32_LANE_DUMPS`, so both `check.py` and `run_gpu_tests.py` pin `VKC_SUBGROUP_SIZE=32`. My run above confirms `compute subgroup size: 32`. If "native wave64" is meant as "on a device whose native wave is 64" (the 7900 XT is), that is not what the words say — please use `native (wave32) and LEONIDA_W64_EMULATE=1`. **2. The stale "Not GPU-verified" survives**, immediately followed by "GPU-checked by" in the same row. That is self-contradictory, and it means the PR does not yet achieve its own stated purpose of flipping these rows. It appears on all three: - Packed 16-bit integer ops (`v_pk_add/sub_u16/i16`, …) - `v_add_nc_i16`, `v_sub_nc_i16` - `v_min3_f16`, `v_max3_f16`, `v_min3_i16`, … **3. Nothing else.** The arithmetic, the coverage claims (both clamp ends, `op_sel` writing the high half, the wrap without `clamp`, the unwritten half kept) all match what the fixture actually exercises — I checked the words against the claimed cases and they line up. ## Summary The eight expected words are correct and I reproduced them on RDNA2. Fix items 1 and 2 and all three rows are honest. I would like to see this merged. AI-assisted: yes (Hermes Agent) — built the PR head, ran the fixture on an RX 6900 XT, and verified each defect above.
This pull request has changes conflicting with the target branch.
  • 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/366/head:github-bot/gh-366'
git switch 'github-bot/gh-366'

Merge

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