Skip to content

Tests: GPU test for 16-bit float v_cmpx compares (all 16 f16 predicates, e32 and e64) - #2607

Merged
ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
Vonsek:test/gpu-vcmpx-f16
Nov 22, 2026
Merged

ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
Vonsek:test/gpu-vcmpx-f16

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-VCMPX-F16, #2516 (comment)

Depends on: #2531 (this branch is stacked on it; the diff against main also shows that PR's commit until it merges).

What and why

#2531 covers v_cmp_*_f16. The 16 v_cmpx_{f,lt,eq,le,gt,lg,ge,o,u,nge,nlg,ngt,nle,neq,nlt,tru}_f16 forms had only CPU tests (nlg aside). This adds two pixel tests modelled on #2464 and #2531, with hand-derived words in the headers:

  • ps_vcmpx_f16: e32 form.
  • ps_vcmpx_f16_e64: e64 form (no SDST) with swapped operands.

The same seven operand pairs as #2531 (less, greater, +0 vs -0, quiet and signalling NaN, +-inf, f16 denormals, junk high halves). Each compare runs alone: EXEC is copied out and restored after it, so a lane that stayed active shows as 1. Two extra bits per word test the EXEC and VCC effects: VCC set by v_cmp_tru_f16 must survive a v_cmpx_f_f16 that empties EXEC (bit 29 = 1), and a true v_cmpx_tru_f16 after an emptied EXEC must not bring lanes back (bit 28 = 0). Registered in check.py, run_gpu_tests.py, regen_fixtures.py (fixtures regenerated), plus tests/semantic/test_vcmpx_f16.py and a sentence in the existing design.md row. No translator change.

Tested

  • run_gpu_tests.py --filter ps_vcmpx_f16: 2/2, 4096/4096 pixels exact on NVIDIA GeForce RTX 5080 (driver 616.92) and AMD Radeon RDNA2 iGPU (driver 26.10.1); device line confirmed for both.
  • Negative control: in compare() the v_cmpx branch stored the compare result into %active instead of active & result; both tests fail on both GPUs (bit 28 set in all four words). Reverted.
  • python -m unittest discover -s tests/semantic (2573 tests), regen_fixtures.py --check, tests/test_shader_checks.py: OK.

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 (no new rule; the existing row names the new tests).

AI-assisted.

…, e32 and e64)

Two pixel tests, ps_vcmp_f16 (e32, VCC) and ps_vcmp_f16_e64 (SGPR destination,
swapped operands), with NaN, +-0, +-inf, f16 denormals and junk high halves.
Words derived by hand in the headers; semantic fixture and test added.

AI-assisted.
…es, e32 and e64)

Two pixel tests, ps_vcmpx_f16 (e32) and ps_vcmpx_f16_e64 (swapped operands),
on the operand pairs of ps_vcmp_f16: the EXEC result of each predicate, VCC
kept, and EXEC only ANDed. Words derived by hand in the headers; semantic
fixture and test added.

AI-assisted.
@ricarmandoagent

Copy link
Copy Markdown

Tested 29b1ba10 on NVIDIA GeForce RTX 4060 (Ada, AD107; Vulkan subgroupSize 32..32), NVIDIA 620.70.06, Vulkan 1.4.357, Bazzite 45 / Linux 7.3.4 (Wayland).

Test programs built from 4947579 (this PR changes no runtime/ C++); translator is this tree's tools/rdna2spirv.py:

python -I scripts/run_gpu_tests.py --build runtime/build/linux --filter vcmp_f16
  PASS  ps_vcmp_f16           4096/4096 pixels exact
  PASS  ps_vcmp_f16_e64       4096/4096 pixels exact
2/2 passed

python -I scripts/run_gpu_tests.py --build runtime/build/linux --filter vcmpx_f16
  PASS  ps_vcmpx_f16          4096/4096 pixels exact
  PASS  ps_vcmpx_f16_e64      4096/4096 pixels exact
2/2 passed

All four fixtures assemble, pass spirv-val (LLVM 23.1.5) and match their derived words on a second vendor and driver. AI-assisted run on a contributor machine.

@Marukooh

Copy link
Copy Markdown
Contributor

Tested 29b1ba1 on NVIDIA GeForce RTX 5070 Ti (Blackwell), NVIDIA 620.73.04, CachyOS Linux. Built the harness from this PR and ran scripts/run_gpu_tests.py --filter ps_vcmp with LEONIDA_W64_EMULATE=0 and =1. All five modules validated and all five draws matched 4,096/4,096 pixels in both runs, including the four f16 e32/e64 fixtures. The six targeted semantic tests passed. AI-assisted.

@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Rechecked in game MODE (IEEE off, DX10_CLAMP on, f32 denorm flush): same words. AI-assisted.

ItsNotRexed added a commit that referenced this pull request Nov 22, 2026
@crastinator

Copy link
Copy Markdown
Contributor

Tested 859553d merged into main 16282101 (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 tests pass natively: ps_vcmp_f16 (4096/4096 pixels exact); ps_vcmp_f16_e64 (4096/4096 pixels exact); ps_vcmpx_f16 (4096/4096 pixels exact); ps_vcmpx_f16_e64 (4096/4096 pixels exact).
  • Whole run_gpu_tests.py: 179/193 native, 179/193 with LEONIDA_W64_EMULATE=1 (the skips are the D3D12-only fixtures and ps_w64x_readlane, as on main). ctest 37/37.
  • tests/semantic/test_vcmp_f16.py, tests/semantic/test_vcmpx_f16.py: 6 passed.

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

@bobcatchris

Copy link
Copy Markdown
Contributor

Apple M2 data for these newly merged f16 compare fixtures (macOS 26.4, MoltenVK 1.4.2 direct, subgroup 4..32, llvm-mc 23.1.6, Python 3.13.18, upstream/main f847748): they FAIL here, unlike the NVIDIA and AMD runs on this PR.

Full suite: 203 shaders translated/validated; 120/199 passed, 74 skipped, 5 failed. The four relevant failures (all 4096/4096 mismatches) are ps_vcmp_f16, ps_vcmp_f16_e64, ps_vcmpx_f16 and ps_vcmpx_f16_e64, with got/want word lists in the finding at #3381 (comment) and in #166. All four differ only in the second word's low half by 0x0c00 (bits 10-11 of an f16 result). The fixtures include NaN, inf, +-0 and f16 denormal operands; I have not determined whether this is a MoltenVK f16 special-value limitation or a translator expectation issue. No new issue from me; synthetic shaders only, no game files.

AI-assisted.

@ItsNotRexed
ItsNotRexed merged commit eb11ca5 into ItsNotRexed:main Nov 22, 2026
2 of 4 checks passed
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.

6 participants