Skip to content

Tests: GPU test for 16-bit integer VOPC compares (i16/u16, e32 and e64) - #2461

Open
Vonsek wants to merge 3 commits into
ItsNotRexed:mainfrom
Vonsek:test/gpu-vcmp-int16
Open

Vonsek wants to merge 3 commits into
ItsNotRexed:mainfrom
Vonsek:test/gpu-vcmp-int16

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Requested by Lucas · project thread

Claimed in the coordination issue as: EGEN-GPU-VCMP-INT16, #2078 (comment)

What and why

Adds ps_vcmp_int16, a GPU test for the 16-bit integer VOPC compares: v_cmp_{eq,ne,lt,le,gt,ge}_{i16,u16}, in the e32 form (VCC) and the e64 form (SGPR pair, operands swapped). On main these twelve ran only on the CPU. v_cmp_f/t_{i16,u16} cannot be assembled for gfx10 (llvm-mc rejects them), so they are left out.

Five operand pairs per op, on the low 16 bits only: a 16-bit literal 0x8000 vs 1 and an inline -1 vs 0 (signed and unsigned disagree), an inline 1 vs 0x8000, a literal 0x1234 vs a register whose high half is 0xabcd (equal as 16-bit values), and two registers 3 vs 5 where the first has 0xffff in its high half. The four expected words are derived by hand in the .asm header. The same shader is a tests/semantic fixture, asserted in tests/semantic/test_vcmp_int16.py against a plain-Python reference.

Not covered: the f16 compares and v_cmpx on 16-bit operands.

Tested

  • RTX 5080 (driver 616.92) and Radeon RDNA2 iGPU (driver 26.10.1), run_gpu_tests.py --filter ps_vcmp_int16: PASS, 4096/4096 pixels exact on both.
  • Negative control: dropping the sign extension of v_cmp_*_i16 in tools/rdna2spirv.py (one line) fails on both GPUs: got 0x163e52e8, 0x163e52e8, 0x39458ee8, 0x39458ee8, want 0x184dcee8, 0x163e52e8, 0x373612e8, 0x39458ee8 (4096/4096 mismatches). Reverted.
  • python -m unittest discover -s tests/semantic (2569 tests, OK, 3 skipped), python tests/semantic/regen_fixtures.py --check clean, python -I tests/test_shader_checks.py (60 tests OK).
  • No translator change, so no shader counts to report.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • No new translator rule (test only).

AI-assisted.

Adds ps_vcmp_int16 for v_cmp_{eq,ne,lt,le,gt,ge}_{i16,u16}, with the words
derived by hand in the .asm header, plus the matching semantic fixture and test.

AI-assisted.
@Rainmaker33

Copy link
Copy Markdown

Tested 7cfdf4b on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass.

The PR's diff applied cleanly to main 4947579. VS 2022, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8; harness programs from a CMake build of that main; overlay layers off.

  • scripts/run_gpu_tests.py: 140/186 pass, 46 skipped (wave64), no failures (main: 139/185). ps_vcmp_int16: 4096/4096 pixels exact.
  • tests/semantic/test_vcmp_int16.py: OK.

@SashaTun

Copy link
Copy Markdown
Contributor

Tested 7cfdf4b8 on NVIDIA GeForce RTX 5060 (driver 621.01, Windows 11, Vulkan API 1.4.357): pass.

  • python -I runtime/test/shaders/build.py <out>: 205 shaders, 205 translated, 205 pass spirv-val.
  • python -I runtime/test/shaders/check.py <out> runtime/build: 129 of 164 pass, 35 skipped, 0 failed. The new fixture ps_vcmp_int16 is ok on this 32-wide device.
  • python -m unittest discover -s tests/semantic -p test_vcmp_int16.py: 2 tests, OK.

AI-assisted run.

@0xTehuti

Copy link
Copy Markdown
Contributor

Hardware Validation: NVIDIA Turing (RTX 2070 SUPER)

Tested \ps_vcmp_int16\ on physical hardware:

  • OS: Windows 11 Pro x64 (Build 26100)
  • GPU: NVIDIA GeForce RTX 2070 SUPER (Driver 595.79, Vulkan 1.4.329)
  • Validation: Khronos Validation Layers active (\LEONIDA_VK_VALIDATION=1, 0 VUID errors)

Results:


  • dna2spirv.py: 1/1 shaders translated cleanly, passed \spirv-val.

  • un_gpu_tests.py --filter ps_vcmp_int16: PASS (4096/4096 pixels exact).
  • \ ests/semantic/test_vcmp_int16.py: 2/2 tests OK (0.057s).
  • Verified exact bitwise match on all 4 MRT0 words (\

@emirduran707

Copy link
Copy Markdown
Contributor

Tested 7cfdf4b on AMD Radeon RX 9060 XT (RDNA4), AMD driver 26.10.44 (LLPC, Vulkan driver 2.0.395), Windows 11 Pro 10.0.26300, subgroup 32..64: pass. The checks above have no AMD run from outside the author; this adds an AMD card with native 64-wide subgroups.

  • python -I scripts/run_gpu_tests.py --build <build> --filter <fixture>, one run per new fixture:
    • ps_vcmp_int16: PASS, 4096/4096 pixels exact; same with LEONIDA_W64_EMULATE=1
  • Whole suite (native wave64): 191 shaders translated, 191 pass spirv-val; 171/186 passed, 15 skipped, 0 failed (main 4947579 here: 170/185, 15 skipped). The skips are the 14 fixtures the d3d12_* tests run, and ps_w64x_readlane (skipped on main too, see check.py: judge ps_w64x_readlane where vk_harness required 64 (its line has no "required") #2085).
  • build.py + check.py: 205 shaders: 205 translated, 205 pass spirv-val; 160 of 164 pass, 4 skipped; ok for ps_vcmp_int16.
  • CPU: python -I -m unittest discover -s tests/semantic -p test_vcmp_int16.py 2 OK, tests/test_shader_checks.py 60 OK, tests/test_run_gpu_tests.py 30 OK, tests/semantic/regen_fixtures.py --check clean. I did not run the whole tests/semantic suite.

Test programs: an MSVC 14.44 build of 4947579, this PR's base; the PR changes no C++ or CMake. llvm-mc 21.1.8 (native), Vulkan SDK 1.4.363.0. No negative control run here. No game files. AI-assisted (Claude Code).

@lunisahdidouch

Copy link
Copy Markdown

Tested 7cfdf4b on an RX 9070 (RDNA4), AMD 26.11.1 (LLPC), Vulkan 1.4.359, Windows 11: pass

New ps_vcmp_int16 passes, 4096/4096 pixels exact. Full run_gpu_tests.py: 171/186 passed, 15 skipped, nothing failed, the rest matches main 4947579. tests/semantic passes too (2569 tests, OK).

AI-assisted

tests/semantic/regen_fixtures.py

AI-assisted.
@crastinator

Copy link
Copy Markdown
Contributor

Tested 9be59ee merged into main f847748c (clean merge) on AMD Radeon RX 6700 XT (Navi 22, gfx1031, subgroup 32..64), RADV Mesa 26.3.1, CachyOS, Linux 7.3.5, GCC 16.2.1, llvm-mc 23.1.5: pass.

  • New test passes natively: ps_vcmp_int16 (4096/4096 pixels exact).
  • Whole run_gpu_tests.py: 186/200 native, 186/200 with LEONIDA_W64_EMULATE=1 (the skips are the D3D12-only fixtures and ps_w64x_readlane, as on main). ctest 41/41.
  • tests/semantic/test_vcmp_int16.py: 2 passed.

No game files. AI-assisted (Claude Code).

@zneel

zneel commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 9be59ee4 on AMD Radeon RX 9070 XT (RDNA4, subgroup 32..64), AMD 26.11.2, Windows 11 Pro 10.0.26300, AMD Ryzen 7 9800X3D CPU (64 GB RAM), Python 3.12.10: pass.

Runtime and test programs built from this head (MSVC 14.51, Ninja, RelWithDebInfo), native Windows llvm-mc 21.1.8, Vulkan SDK 1.4.363.0. No game files.

run result
run_gpu_tests.py (whole suite, native wave64) 176/190, 14 skipped, 0 failed (main 49475796: 170/185)
same with LEONIDA_W64_EMULATE=1 176/190, 14 skipped, 0 failed
pytest tests/test_shader_checks.py tests/test_run_gpu_tests.py 105 passed, 249 subtests passed in 2.27s
unittest discover -s tests/semantic -p test_vcmp_int16.py 2 OK
tests/semantic/regen_fixtures.py --check clean

This PR's shaders:

  • native: PASS ps_vcmp_int16 4096/4096 pixels exact; emulated: PASS ps_vcmp_int16 4096/4096 pixels exact

ps_vcmp_int16 gives 4096/4096 pixels exact on RDNA4, native and emulated, including the cases with junk in the high halves.

AI-assisted (Claude Code); I checked the results.

tests/semantic/regen_fixtures.py

AI-assisted.
@TreXito

TreXito commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 4f19eb2b (the rebased head) on NVIDIA GeForce RTX 3060 Ti (subgroup 32..32), driver 580.173.02, Linux (kernel 6.18), Python 3.14: pass.

  • scripts/run_gpu_tests.py: 165/211 passed, 46 skipped, 0 failed. ps_vcmp_int16: 4096/4096 pixels exact.
  • ctest: 47/47 passed.
  • pytest tests/semantic/test_vcmp_int16.py: 2 passed (also with main's tools/ at aa2988c, as expected for a tests-only change).

No game files. AI-assisted (Claude Code).

@amarovndres

Copy link
Copy Markdown

Tested 4f19eb2b on AMD Radeon RX 9060 XT (RDNA4, discrete, subgroup 32..64), AMD 26.10.1 (32.0.32015.7029, LLPC, Vulkan 1.4.359), Windows 11 Pro (build 26200): pass.

  • scripts/run_gpu_tests.py (full suite; test programs built from this head with llvm-mingw, llvm-mc 23.1.6): 197/211 passed, 14 skipped, 0 failed. main d0835dd9 on the same machine: 196/210 passed, 14 skipped.
    • PASS ps_vcmp_int16 4096/4096 pixels exact
  • tests/semantic/test_vcmp_int16.py: 2 tests, OK

AI-assisted (Claude Code). Synthetic shaders only, no game files.

@throny

throny commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 4f19eb2 on NVIDIA RTX 4080, driver 610.88, Windows 11: pass

This is the head rebased on aa2988cc. Ran (MSVC 19.44 / VS 2022 BuildTools, Ninja, RelWithDebInfo, Vulkan SDK 1.4.363.0, native llvm-mc 23.1.6; this PR has no runtime C++ change, so the test programs were built from the aa2988cc tree):

  • python -I scripts/run_gpu_tests.py --build <build>: 165/211 passed, 46 skipped, 0 failed. ps_vcmp_int16 4096/4096 pixels exact.
  • test_vcmp_int16 (run from tests/semantic): 2 tests OK.

AI-assisted.

@PingasMech

Copy link
Copy Markdown

Tested 4f19eb2b on Windows 11 with an Intel UHD 770, driver 32.0.101.7088. Built the harness from the PR commit and ran run_gpu_tests.py --filter ps_vcmp_int16 --require-pass. The shader passed spirv-val, all 4,096 pixels matched exactly, and both CPU reference tests passed. AI-assisted verification.

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown

Tested 4f19eb2 (merge base aa2988c) on NVIDIA GeForce RTX 5080, Linux 580.65.06: pass

Tested the PR head merged with current main 7b7d73f8 (clean merge, not pushed). Runtime harnesses built from main 7b7d73f8, llvm-mc 21, Python 3.13, Vulkan SDK 1.4.363, Linux native.

Check main 7b7d73f8 this PR
run_gpu_tests.py native 170/217 passed, 47 skipped 171/218 passed, 47 skipped
run_gpu_tests.py with LEONIDA_W64_EMULATE=1 201/217 passed, 16 skipped 202/218 passed, 16 skipped
failed (native / emulated) 0 / 0 0 / 0
tests/semantic/regen_fixtures.py --check ok ok
pytest tests/semantic/test_vcmp_int16.py tests/test_shader_checks.py tests/test_run_gpu_tests.py tests/test_cf_diff.py 162 passed, 315 subtests passed (3 shared files) 164 passed, 315 subtests passed in 3.82s

Line-by-line against my main run (results that differ from main):

  • native:
    • ps_vcmp_int16 main: - pr: PASS 4096/4096 pixels exact
  • emulated:
    • ps_vcmp_int16 main: - pr: PASS 4096/4096 pixels exact

Not run: the full unittest discover -s tests/semantic (about 6 minutes, and main alone has failures there); only the test files this PR touches plus the shared checker tests ran. No other GPU vendor, no Windows. No game files.

AI-assisted (Claude Code).

@tunczzz

tunczzz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 4f19eb2b (merge base aa2988cc) on an NVIDIA GeForce RTX 5070 Ti (Blackwell, subgroup 32..32), driver 616.56, Windows 11 10.0.26300. Translator and fixtures from this head; runtime test programs built from main aa2988cc (MSVC 19.44, Vulkan-Headers fetched by CMake, loader from the NVIDIA driver); spirv-as/spirv-val and llvm-mc 21 from WSL Ubuntu: pass.

  • scripts/run_gpu_tests.py: 165/211 passed, 46 skipped (wave64 programs on a 32-wide GPU), 0 failed.
  • Diffed test by test against main aa2988cc (164/210, 46 skipped): every main result is the same here.
  • New: ps_vcmp_int16 PASS (4096/4096 pixels exact).

Not run: LEONIDA_W64_EMULATE=1, other vendors, Linux. No game files.

AI-assisted (Claude Code).

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.