Skip to content

Tests: GPU test for 32-bit integer VOPC compares (u32/i32, e32 and e64) - #2220

Open
Vonsek wants to merge 3 commits into
ItsNotRexed:mainfrom
Vonsek:test/gpu-vopc-int
Open

Vonsek wants to merge 3 commits into
ItsNotRexed:mainfrom
Vonsek:test/gpu-vopc-int

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-VOPC-INT, #2078 (comment)

What and why

Adds ps_vcmp_int32, a GPU test for the 32-bit integer VOPC compares: v_cmp_{eq,ne,lt,le,gt,ge,f,t}_{u32,i32}, in the e32 form (VCC) and the e64 form (SGPR pair). The signed 32-bit compares and v_cmp_f/t_{u32,i32} had no GPU test on main.

Five operand pairs per op: a literal 0x80000000 vs 1 and an inline -1 vs 0 (unsigned and signed disagree), an inline 1 vs 0x80000000 (the mirror), a literal 0x12345678 vs itself (equal) and two VGPRs 3 vs 5. The e64 words use the mirrored operand order (VGPR in src0, constant in src1). The four expected words are derived by hand in the .asm header. The same shader is a tests/semantic fixture, asserted in the new tests/semantic/test_vcmp_int32.py against a plain-Python reference.

Not covered: the 64-bit compares (#1299), the cmpx forms (ps_vcmpx_forms) and the 16-bit forms.

Tested

  • RTX 5080 (driver 616.92) and Radeon RDNA2 iGPU (driver 26.10.1), run_gpu_tests.py --filter ps_vcmp_int32: PASS, 4096/4096 pixels exact on both.
  • Negative control: making v_cmp_gt_u32 signed in tools/rdna2spirv.py (one line) fails on both GPUs: got 0x964e52e8, 0x984dcee8, 0xb9358ee8, 0xb73612e8, want 0x963e52e8, 0x984dcee8, 0xb9458ee8, 0xb73612e8 (4096/4096 mismatches). Reverted.
  • python -m unittest discover -s tests/semantic (1673 tests OK), python tests/semantic/regen_fixtures.py --check (clean) and 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.

ps_vcmp_int32 runs v_cmp_{eq,ne,lt,le,gt,ge,f,t}_{u32,i32} in the e32 and
e64 forms with inline constants and literals, on operands where signed and
unsigned disagree. Words derived by hand in the .asm header; the same shader
is a tests/semantic fixture with a plain-Python reference.

AI-assisted.
@emirduran707

Copy link
Copy Markdown
Contributor

Tested 7d370cd 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.

  • python -I scripts/run_gpu_tests.py --build <build> --filter ps_vcmp_int32: PASS ps_vcmp_int32 4096/4096 pixels exact. Same with LEONIDA_W64_EMULATE=1.
  • Whole suite (native wave64): 186 shaders translated, 186 pass spirv-val; 168/181 passed, 13 skipped, 0 failed. The skips are the 12 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; not from this PR).
  • build.py + check.py: 200 shaders translated, 200 pass spirv-val; 157 of 161 pass, 4 skipped (the 3 mesh fixtures and ps_w64x_readlane); ps_vcmp_int32 ok.
  • CPU: python -I -m unittest discover -s tests/semantic -p test_vcmp_int32.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.

Test programs: an MSVC 14.44 build of 4eb6155, this PR's base. The PR changes no C++ or CMake, so they are what its head builds; the translator, runner and check.py are this PR's. llvm-mc 21.1.8 (native), Vulkan SDK 1.4.363.0.

This adds an RDNA4 card to the RDNA2 iGPU and NVIDIA runs in the description. No negative control run here. No game files. AI-assisted (Claude Code).

@Rainmaker33

Copy link
Copy Markdown

Tested 7d370cd 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 4eb6155. 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: 137/181 pass, 44 skipped (wave64), no failures (main: 136/180). ps_vcmp_int32: 4096/4096 pixels exact.
  • tests/semantic/test_vcmp_int32.py: OK.

@AmazingMoaaz

Copy link
Copy Markdown
Contributor

Tested 7d370cd on Intel UHD Graphics (Xe-LP, Tiger Lake-H iGPU, driver 101.7088) and NVIDIA RTX 3050 Laptop GPU (driver 617.42), Windows 11 Pro build 26300, scripts\build_runtime.ps1 (MSVC 19.51), llvm-mc 23.1.6, Vulkan SDK 1.4.363: pass.

  • ps_vcmp_int32: 4096/4096 pixels exact on both GPUs.
  • Full run_gpu_tests.py on the Intel UHD: 125/181 passed, 56 skipped, 0 failed (main 4eb6155 on the same device: 124/180, 56 skipped).
  • python -m unittest discover -s tests/semantic: 1673 tests OK (2 skipped).

tests/semantic/regen_fixtures.py

AI-assisted.
@crastinator

Copy link
Copy Markdown
Contributor

Tested 9fe7fee 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_int32 (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_int32.py: 2 passed.

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

@zneel

zneel commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 9fe7fee5 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.22s
unittest discover -s tests/semantic -p test_vcmp_int32.py 2 OK
tests/semantic/regen_fixtures.py --check clean

This PR's shaders:

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

ps_vcmp_int32 gives 4096/4096 pixels exact on RDNA4, native and emulated.

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 cd303094 (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_int32: 4096/4096 pixels exact.
  • ctest: 47/47 passed.
  • pytest tests/semantic/test_vcmp_int32.py: 2 passed.

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

@tunczzz

tunczzz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested cd303094 (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_int32 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.

8 participants