Skip to content

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
KoLolX3 wants to merge 1 commit into
ProjectLeonida:mainfrom
KoLolX3:test/valu16-gpu
Open

KoLolX3 wants to merge 1 commit into
ProjectLeonida:mainfrom
KoLolX3:test/valu16-gpu

Conversation

@KoLolX3

@KoLolX3 KoLolX3 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

@Sangonapou

Copy link
Copy Markdown
Contributor

Tested 8df9db0 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.

@ohshitwaddup

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
…_pk_add_u16/v_pk_mad_i16

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-actions github-actions Bot added needs rebase Conflicts with the base branch: rebase it on main and removed needs rebase Conflicts with the base branch: rebase it on main labels Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants