Skip to content

test(gpu): add fix for packed 16-bit integer ops (TEST-775) - #4214

Open
Sagah123 wants to merge 3 commits into
ItsNotRexed:mainfrom
Sagah123:test-775-packed-int16
Open

Sagah123 wants to merge 3 commits into
ItsNotRexed:mainfrom
Sagah123:test-775-packed-int16

Conversation

@Sagah123

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as:

What and why

Adds GPU fixture cs_w32_pk_int16.asm for row 247 (packed 16-bit integer ops: v_pk_add/sub_u16/i16, v_pk_mul_lo_u16, v_pk_max_u16). GPU-verified on NVIDIA GeForce RTX 3060 (0 mismatches). Registered in check.py and run_gpu_tests.py, updated docs/design.md.

Tested

  • build.py cs_w32_pk_int16: 1 translated, 1 pass spirv-val.
  • vk_compute_test.exe cs_w32_pk_int16.spv 1 dump: 0 mismatches on NVIDIA GeForce RTX 3060.
  • python -m unittest tests.test_shader_checks: 74/74 passed.

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.

@ray3242

ray3242 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

The expected words check out on the CPU. I translated cs_w32_pk_int16.asm at this head with support.translate_lines and ran it through tests/semantic/spirv_mini_interp.py (wave32, the same FSSM/V# setup as test_new_ops_fixture.py). The output is ffff0000 ffffffff ffff0002 00000000 7fff0002 0001fffe 00010001 8000ffff, the same as the header, check.py and run_gpu_tests.py. The words also match the design.md row worked by hand: the wrap on add/sub/sub_i16, the clamp on the u16 and i16 adds and the u16 sub floor, and the low 16 bits of 0x7fff * 0x7fff.

Two things:

  • GitHub reports the PR as conflicting with main: git merge-tree against aa2988c conflicts in runtime/test/shaders/check.py, scripts/run_gpu_tests.py and docs/design.md, the lists other GPU tests were added to. It needs a rebase.
  • The other cs_w32_* GPU tests from today have a CPU twin under tests/semantic (test_new_ops_fixture.py for cs_w32_new_ops): it runs the fixture through the interpreter and checks that check.py and run_gpu_tests.py hold the same words. Adding one here would keep the three copies of the words from drifting. The check above is that test in about 15 lines.

CPU only, Python 3.12, no GPU.

@MKmajster

Copy link
Copy Markdown

Tested 89205eb on NVIDIA GeForce RTX 3070 (Ampere), driver 617.42, Windows 11 24H2: run_gpu_tests.py --filter cs_w32_pk_int16 1/1 pass, tests/test_shader_checks.py OK. That's a second NVIDIA GPU next to the RTX 3060.

One caveat for the docs/design.md row, on top of the hand derivation above (which I get too): of the clamp forms used here, only v_pk_add_u16 clamp saturating has a native gfx1036 measurement so far (it is #4082's positive control). v_pk_sub_u16 clamp flooring at 0 and v_pk_add_i16 clamp saturating signed are the ISA reading, confirmed translator-vs-model on two NVIDIA GPUs, not against RDNA2 silicon. A hw_oracle run of those two would make the row's "GPU-verified" fully hardware-backed.

No game files. AI-assisted (Claude).

@bobcatchris

Copy link
Copy Markdown
Contributor

Apple M2 data point. Tested head 0672489 on Apple M2 (Mac14,3), macOS 26.4, MoltenVK 1.4.2 (direct), subgroup 4..32, llvm-mc 23.1.6, Python 3.13.18; clean full build on AppleClang 17 (exit 0).

python -I scripts/run_gpu_tests.py --filter cs_w32_pk_int16 --build runtime/build/linux: 1 shader translated, 1 pass spirv-val; 1/1 passed — words 4294901760 4294967295 4294901762 0 2147418114 131070 65537 2147549183, 0 mismatches. Adds an Apple/MoltenVK result to the NVIDIA run in the PR body, and this wave32 fixture ran here (no 32-lane skip). Head fetched read-only, no rebase/edit/push. Synthetic shader and counts only; no game files.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants