Skip to content

Tests: check packed f16 VOP3P, v_dot2c_f32_f16, v_pack_b32_f16 and f16 FMA ops on the GPU - #1158

Open
microwave805 wants to merge 1 commit into
xcl-dev:mainfrom
microwave805:gpu-tests-packed-f16
Open

microwave805 wants to merge 1 commit into
xcl-dev:mainfrom
microwave805:gpu-tests-packed-f16

Conversation

@microwave805

@microwave805 microwave805 commented Nov 24, 2026 •

Copy link
Copy Markdown

Adds GPU tests for 8 translated RDNA2 f16 instructions that currently have no GPU coverage in crates/xcl/src/gpu/recomp/tests.rs: v_pk_fma_f16, v_pk_min_f16, v_pk_max_f16, v_dot2c_f32_f16, v_pack_b32_f16, v_fmac_f16, v_fmamk_f16, and v_fmaak_f16.

All inputs are exact binary16 values across four distinct edge-case lanes so results are exact across rounding modes and hardware drivers.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs:
    • gpu_packed_f16_fma_min_max_dot2c_and_pack: checks v_pk_fma_f16, v_pk_min_f16, and v_pk_max_f16 (plain, swapped OP_SEL/OP_SEL_HI/OP_SEL_HI_2, NEG/NEG_HI, and CLAMP), two consecutive v_dot2c_f32_f16 accumulations into the same vdst, and all four OP_SEL[1:0] pairings of v_pack_b32_f16.
    • gpu_f16_fmac_fmamk_fmaak: checks VOP2 v_fmac_f16, VOP3 v_fmac_f16 (OP_SEL=0b1010, CLAMP=1), v_fmamk_f16, and v_fmaak_f16 (verifying upper-16-bit literal masking and preservation of the untouched half of vdst).

Tested

  • NVIDIA GeForce RTX 3070 (driver 32.0.16.1742), AMD Ryzen 5 5600X, Windows 11 Pro (build 22631), DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), Rust 1.100.0 (stable-x86_64-pc-windows-msvc, debug)
  • cargo test -p xcl --lib gpu_packed_f16 -- --nocapture: 1 passed, 0 failed
  • cargo test -p xcl --lib gpu_f16_fmac -- --nocapture: 1 passed, 0 failed
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 743 passed, 0 failed, 41 ignored
  • SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64)
  • python -I scripts/pr_check.py --local on this PR's description and changed files: description ok

Regression run

  • Not needed: changes only crates/xcl/src/gpu/recomp/tests.rs (test-only).

Not tested

  • Native wave64 / AMD GPUs (ran on NVIDIA RTX 3070 via split-wave64)
  • Retail titles

AI use

  • Antigravity (Gemini 4 Neon): audited untested f16 instructions in emit.rs/tests.rs, wrote both GPU tests and this PR description, and ran the test commands above.

…6 FMA ops on the GPU

Add GPU coverage for eight translated RDNA2 f16 instructions with no
existing GPU tests: v_pk_fma_f16, v_pk_min_f16, v_pk_max_f16,
v_dot2c_f32_f16, v_pack_b32_f16, v_fmac_f16, v_fmamk_f16 and v_fmaak_f16.

Exercises OP_SEL/OP_SEL_HI/OP_SEL_HI_2, NEG/NEG_HI, CLAMP, consecutive
dot2c accumulation, upper-16-bit literal masking and untouched VDST half
preservation across four distinct exact binary16 lane patterns.

Assisted-by: Antigravity (Gemini 4 Neon)
@DavidM1911

Copy link
Copy Markdown
Contributor

Independent verification on current main 384f7f7 (branch already contains it — clean).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11.

  • cargo test -p xcl --lib packed_f16: 1 passed, 0 failed — gpu_packed_f16_fma_min_max_dot2c_and_pack covers the packed-f16 VOP3P/FMA/dot2c/pack ops on real hardware.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

@TobiasFornell

Copy link
Copy Markdown

AMD / Linux data point (the PR's runs were NVIDIA with no wave64).

Tested: RX 9070 XT (RDNA4, native wave64), Mesa RADV 26.3.1, CachyOS (kernel 7.3), Proton Experimental 11.0-20261112 Wine, vkd3d-proton v3.1 (scripts/linux build), DXC 1.9.2609, x86_64-pc-windows-msvc cross-build, release. Head aa94ba9 merged onto main 47efa2e (clean), together with #1144.

  • gpu_packed_f16_fma_min_max_dot2c_and_pack, gpu_f16_fmac_fmamk_fmaak, gpu_f16_defaults_to_round_to_nearest_even: pass.
  • The two tests skipped with no wave64 on NVIDIA (gpu_wave32_program_in_wave64_hardware, gpu_geometry_wave32_prefix_count_over_a_mask) run and pass here.

Testing and write-up assisted by Claude Code (Claude Opus 5.5); runs on my own hardware, checked by me.

@0xTehuti

Copy link
Copy Markdown

Test report on NVIDIA GeForce RTX 2070 SUPER (Turing, wave32)

Commit tested
aa94ba9d343d99aa06f757123cf7e5e38b38ff2f (PR #1158 head)

Tested

  • Hardware:
    • GPU: NVIDIA GeForce RTX 2070 SUPER (Driver 595.79 / 32.0.15.9579, 7989 MiB VRAM)
    • CPU: Intel Core i7-10700K CPU @ 3.80GHz
    • OS: Windows 11 x64, Rust 1.99.0
  • Commands run and results:
    • cargo test -p xcl --lib recomp:
      190 passed; 0 failed; 18 ignored; 0 measured; 513 filtered out; finished in 6.63s
    • New test targets checked individually:
      • gpu_packed_f16_fma_min_max_dot2c_and_pack: 1 passed; 0 failed (0.26s)
      • gpu_f16_fmac_fmamk_fmaak: 1 passed; 0 failed (0.29s)
  • Findings:
    • All eight newly tested RDNA2 f16 instructions (v_pk_fma_f16, v_pk_min_f16, v_pk_max_f16, v_dot2c_f32_f16, v_pack_b32_f16, v_fmac_f16, v_fmamk_f16, v_fmaak_f16) compile and execute cleanly on Turing hardware with DXIL 1.8.
    • Operand selectors (OP_SEL, OP_SEL_HI, NEG, CLAMP) and binary16 lane pattern preservation pass without issues.

Not tested

  • Retail game packages (XCL_SAMPLE_* unset).

AI use

  • Tool: Antigravity / T3 Code
  • Model: Gemini 3.8 Flash
  • Details: Checked out PR branch in isolated worktree, compiled with DXC 10.0.26100.0, executed GPU tests on NVIDIA hardware, and recorded factual output.

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

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants