Skip to content

Tests: GPU coverage for v_cmp_class_f16/f64, v_fmamk/fmaak_f16, v_cvt_pknorm_*_f16 and v_mac_legacy_f32 - #135

Closed
Andretuta wants to merge 1 commit into
mainfrom
old-pr/9865
Closed

Andretuta wants to merge 1 commit into
mainfrom
old-pr/9865

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

Carried over from old PR 9865 by KoLolX3 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9865, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
KoLolX3: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

docs/design.md marks these float VALU rows Not GPU-verified: the translations were CPU-checked (and, except v_mac_legacy_f32, the instructions measured on hardware), but the SPIR-V the translator emits had never run on a GPU. No open PR adds a fixture for them.

This adds runtime/test/shaders/cs_vfloat_ext.asm (one lane, laid out like cs_lds_b64_cmpst.asm; 16-bit VOP2 destinations preset to 0xA5A5A5A5):

word op case expected
0 v_cmp_class_f16 one bit per case: sNaN in {sNaN}, -denormal in {-denormal}, +1.0 in {+inf} (miss), -inf in {-inf} 0x0000000B
1 v_cmp_class_f64 -0 in {-0}, qNaN in {sNaN} (miss), smallest +denormal in {+denormal}, +inf in {+inf} 0x0000000D
2 v_fmamk_f16 1.5 * K(2.0) + 0.5, high half kept 0xA5A54300
3 v_fmaak_f16 (1 + 2^-10) * 3.0 + K(0): one rounding to the even 0x4202 0xA5A54202
4 v_cvt_pknorm_i16_f16 0.5 -> 16383.5 rounds to even 16384; -inf -> -32767 0x80014000
5 v_cvt_pknorm_u16_f16 NaN -> 0; 2.0 clamps to 65535 0xFFFF0000
6 v_mac_legacy_f32 legacy 0 * +inf = +0, plus D = 2.0 0x40000000
7 v_mac_legacy_f32 1.5 * 2.0 + D (0.25) 0x40500000

The words are derived in the .asm header from the rows. The fixture is registered in check.py and scripts/run_gpu_tests.py next to cs_lds_atomics_ext. The five rows (including the separate v_cmp_class_f64 row) keep their marker and add a "GPU-checked by" note. The v_mac_legacy_f32 note says it checks the translated SPIR-V, not the opcode on silicon (no RDNA2 desktop part has it).

Tested on an AMD Radeon RX 7900 XT (RADV NAVI31, Mesa 26.3.1, subgroup 32..64), Artix Linux, llvm-mc 23.1.5:

  • cs_vfloat_ext passes with all eight words exact, native and with LEONIDA_W64_EMULATE=1.
  • Negative control: expecting the truncated 0x4201 for word 3 makes it FAIL.
  • Full scripts/run_gpu_tests.py suite, native and emulated: no failure except the known ms_wave_info_s3 flake (#6172).
  • The 50 test files that read check.py, run_gpu_tests.py, design.md or the shader fixtures: the same failure set as a clean worktree of the merge base (26, environment-only on this machine). The branch adds 2 passing tests and 12 subtests.

Resubmitted from #9601 (closed with the other outside PRs on 2026-11-23), rebased onto main 2d53a8055. Related: #9494, #9761 (merged), #9813. Synthetic fixture only, no game files. AI-assisted (Claude Code).

On the rebased branch, the full suite on this card also shows cs_imgload_tfe, cs_imgload_d16_tfe, cs_w32_exec_computed and cs_w64_exec_computed failing; they fail the same way on a clean worktree of main, so they are not this change.

…_pknorm_*_f16 and v_mac_legacy_f32

docs/design.md marks these float VALU rows not GPU-verified: the
translations were CPU-checked (and, except v_mac_legacy_f32, the
instructions measured on hardware), but the translated SPIR-V never
ran on a GPU. cs_vfloat_ext.asm runs one lane through
v_cmp_class_f16 (sNaN, -denormal, -inf, a miss) and v_cmp_class_f64
(-0, a qNaN against the sNaN bit, the smallest +denormal, +inf), one
bit per case; v_fmamk_f16 and v_fmaak_f16 in both print orders,
including the one rounding of (1+2^-10)*3 to 0x4202, with the high
half kept; v_cvt_pknorm_i16_f16/u16_f16 at the even rounding of
0.5*32767, -inf, NaN and a clamped 2.0; and v_mac_legacy_f32 with the
legacy 0 * inf = +0 rule. 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_atomics_ext; the five rows note the GPU check.
@KoLolX3

KoLolX3 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Author here: taken over in #373, rebased on main ece4ba5b3 and re-tested (RX 7900 XT, RADV). This draft can be closed in its favour.

@aslan2142

Copy link
Copy Markdown
Collaborator

This carry-over of old upstream PR 9865 has been taken over in #373, so I'm closing this draft as #17 describes. The branch old-pr/9865 stays.

AI-assisted (Claude Code, Claude Opus 5.5).

@aslan2142 aslan2142 closed this Nov 24, 2026
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.

3 participants