Tests: legacy FMA and float min/max NaN semantics on the GPU #719

Open
github-bot wants to merge 1 commit from github-bot/gh-719 into main AGit
Owner

@⁠lordon1a on GitHub · 2026-11-24 04:03 UTC · original
lordon1a:tests/gpu-fma-legacy-and-minmax → main · +92 −0 · 1 files · 1 commits · open

Adds a per-instruction GPU test (gpu_fma_legacy_and_float_min_max) covering 6 RDNA2 floating-point instructions that previously had no GPU test coverage: v_fma_legacy_f32, v_fmac_legacy_f32, v_min_f32, v_max_f32, v_min_f16, and v_max_f16. Checks legacy 0 * inf == 0 / 0 * NaN == 0 returning c, normal FMA, and IEEE-754 minNum/maxNum NaN propagation (one NaN returns the non-NaN operand, two NaNs return NaN) across 12 edge cases.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: adds gpu_fma_legacy_and_float_min_max (test-only; no runtime code changed).

Tested

  • Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver 616.64, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), rustc 1.100.0 (x86_64-pc-windows-gnullvm), debug build, DXC 1.9.2609.5 (01b62ad4)
  • cargo test -p xcl --lib gpu_fma_legacy_and_float_min_max -- --nocapture: 1 passed, 0 failed, 0 ignored (0.64s)
  • cargo test --workspace -- --test-threads=1: 702 passed, 0 failed, 41 ignored
  • SKIPPED GPU tests (expected on wave32-only NVIDIA hardware):
    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64

Not tested

  • AMD / wave64, Intel GPU, MSVC toolchain, retail title (test-only diff; no runtime code modified)

AI use

  • Antigravity (Google DeepMind agent) — wrote the test, ran the local GPU and workspace test suites, and opened this PR.
**@⁠lordon1a** on GitHub · 2026-11-24 04:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/719) `lordon1a:tests/gpu-fma-legacy-and-minmax` → `main` · +92 −0 · 1 files · 1 commits · open Adds a per-instruction GPU test (`gpu_fma_legacy_and_float_min_max`) covering 6 RDNA2 floating-point instructions that previously had no GPU test coverage: `v_fma_legacy_f32`, `v_fmac_legacy_f32`, `v_min_f32`, `v_max_f32`, `v_min_f16`, and `v_max_f16`. Checks legacy `0 * inf == 0` / `0 * NaN == 0` returning `c`, normal FMA, and IEEE-754 `minNum`/`maxNum` NaN propagation (one NaN returns the non-NaN operand, two NaNs return NaN) across 12 edge cases. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: adds `gpu_fma_legacy_and_float_min_max` (test-only; no runtime code changed). **Tested** - Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver `616.64`, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), `rustc 1.100.0` (`x86_64-pc-windows-gnullvm`), debug build, DXC `1.9.2609.5` (`01b62ad4`) - `cargo test -p xcl --lib gpu_fma_legacy_and_float_min_max -- --nocapture`: **1 passed, 0 failed, 0 ignored** (`0.64s`) - `cargo test --workspace -- --test-threads=1`: **702 passed, 0 failed, 41 ignored** - `SKIPPED` GPU tests (expected on wave32-only NVIDIA hardware): - `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64` - `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` **Not tested** - AMD / wave64, Intel GPU, MSVC toolchain, retail title (test-only diff; no runtime code modified) **AI use** - Antigravity (Google DeepMind agent) — wrote the test, ran the local GPU and workspace test suites, and opened this PR.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:30:30 +00:00
Author
Owner

@⁠joeypercia on GitHub · 2026-11-24 04:08 UTC · original

AMD / wave64 run (the Not tested item): 6e948d7 merged onto main f4ce27c (clean merge).

Tested

  • AMD Radeon iGPU (Ryzen 7 7800X3D, RDNA2, native wave64), driver 26.11.2 (32.0.21045.29003); RTX 4070 Ti (616.56, wave32); Windows 11 Pro 26200; Rust 1.100.0 MSVC; DXC 1.8.2502.11; debug
  • gpu_fma_legacy_and_float_min_max: passes on the RDNA2 iGPU (native wave64) and on the RTX 4070 Ti (split form); no SKIPPED

Review note: the legacy model here is "a zero factor returns c". That differs from the hardware in one case: c = -0, where the result is +0 (the legacy product is +0, and +0 + -0 = +0; LLVM's amdgcn_fma_legacy folding calls this out). None of the cases has a zero product with c = -0, so the test is right as written, but adding one (e.g. (0, inf, -0) → +0) would cover #679. It would fail on main today, so it fits #679's fix PR better than this one.

Not tested: the full suite on this merge (test-only change); release build.

Run and report by Claude Code (Claude Opus 5.5).

**@⁠joeypercia** on GitHub · 2026-11-24 04:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/719#issuecomment-7121742899) **AMD / wave64** run (the **Not tested** item): `6e948d7` merged onto `main` `f4ce27c` (clean merge). **Tested** - AMD Radeon iGPU (Ryzen 7 7800X3D, RDNA2, native wave64), driver 26.11.2 (32.0.21045.29003); RTX 4070 Ti (616.56, wave32); Windows 11 Pro 26200; Rust 1.100.0 **MSVC**; DXC 1.8.2502.11; debug - `gpu_fma_legacy_and_float_min_max`: passes on the RDNA2 iGPU (native wave64) and on the RTX 4070 Ti (split form); no `SKIPPED` **Review note:** the legacy model here is "a zero factor returns `c`". That differs from the hardware in one case: `c = -0`, where the result is `+0` (the legacy product is `+0`, and `+0 + -0 = +0`; LLVM's `amdgcn_fma_legacy` folding calls this out). None of the cases has a zero product with `c = -0`, so the test is right as written, but adding one (e.g. `(0, inf, -0) → +0`) would cover #679. It would fail on `main` today, so it fits #679's fix PR better than this one. **Not tested:** the full suite on this merge (test-only change); release build. Run and report by Claude Code (Claude Opus 5.5).
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 04:14 UTC · original

Test run of 6e948d7153ca09a4002fc83da3becf3804554efb on AMD RDNA4. I merged it onto current main f4ce27c locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 702 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 661 passed, 0 failed, 21 ignored
  • 0 SKIPPED; gpu_fma_legacy_and_float_min_max passes.

Review: The min / max references follow IEEE minNum / maxNum (one NaN gives the other operand), and the legacy FMA cases with a zero factor check that c comes back. One precision for the description: the hardware returns c + (+0), so for c = −0 the result is +0, not c; #720 fixes the translation for that case. None of this test's cases uses c = −0, so it passes with or without #720.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 04:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/719#issuecomment-7121840214) Test run of `6e948d7153ca09a4002fc83da3becf3804554efb` on AMD RDNA4. I merged it onto current `main` `f4ce27c` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **702 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 661 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `gpu_fma_legacy_and_float_min_max` passes. **Review:** The min / max references follow IEEE minNum / maxNum (one NaN gives the other operand), and the legacy FMA cases with a zero factor check that `c` comes back. One precision for the description: the hardware returns c + (+0), so for c = −0 the result is +0, not c; #720 fixes the translation for that case. None of this test's cases uses c = −0, so it passes with or without #720. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 06:10 UTC · original

Empirical test report (6e948d71)

Hardware / environment

  • Intel Arc A770 selected with XCL_ADAPTER=A770, Windows x64 build 26200, AMD CPU (family 23, model 113). GPU driver version was not recorded.
  • Rust rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5 (01b62ad47), and Cargo's unoptimized test profile with debug info and incremental compilation disabled.
  • Tested commit 6e948d7153ca09a4002fc83da3becf3804554efb.

Commands and results

  • cargo test -p xcl --lib --no-run completed with exit code 0 before acquiring the GPU lock.
  • Inside Invoke-ArcTest.ps1, ran & $fixturePath gpu::recomp::tests::gpu_fma_legacy_and_float_min_max --exact --nocapture --test-threads=1 with RUST_TEST_NOCAPTURE=1. $fixturePath was the unit-test executable printed by the compile step.
  • The test process exited 0. The harness reported 1 passed, 0 failed, 0 ignored, with 681 tests filtered out. A case-sensitive scan of the focused log found 0 SKIPPED lines. The fixture completed in 2.04 seconds.

Observed behavior

  • The fixture dispatched a shader and compared readback for 12 input lanes across six instructions. Both legacy f32 FMA instructions returned the addend for the exercised zero-times-infinity and zero-times-NaN cases, including a NaN addend. The other cases matched the fixture's fused multiply-add expectations.
  • The f32 and f16 min/max checks returned the numeric operand when exactly one operand was NaN and returned a NaN when both operands were NaN. The fixture compared exact bits for numeric results and checked the NaN class for expected NaNs.

Not tested

The full GPU workspace suite and game smoke runs were omitted. Other GPU adapters were not tested.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr719-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 06:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/719#issuecomment-7154521195) ### Empirical test report (6e948d71) **Hardware / environment** - Intel Arc A770 selected with `XCL_ADAPTER=A770`, Windows x64 build 26200, AMD CPU (family 23, model 113). GPU driver version was not recorded. - Rust `rustc 1.100.0 (0ef1bc386 2026-11-09)`, DXC 1.9.2609.5 (01b62ad47), and Cargo's unoptimized test profile with debug info and incremental compilation disabled. - Tested commit `6e948d7153ca09a4002fc83da3becf3804554efb`. **Commands and results** - `cargo test -p xcl --lib --no-run` completed with exit code 0 before acquiring the GPU lock. - Inside `Invoke-ArcTest.ps1`, ran `& $fixturePath gpu::recomp::tests::gpu_fma_legacy_and_float_min_max --exact --nocapture --test-threads=1` with `RUST_TEST_NOCAPTURE=1`. `$fixturePath` was the unit-test executable printed by the compile step. - The test process exited 0. The harness reported **1 passed, 0 failed, 0 ignored**, with 681 tests filtered out. A case-sensitive scan of the focused log found **0 `SKIPPED` lines**. The fixture completed in 2.04 seconds. **Observed behavior** - The fixture dispatched a shader and compared readback for 12 input lanes across six instructions. Both legacy f32 FMA instructions returned the addend for the exercised zero-times-infinity and zero-times-NaN cases, including a NaN addend. The other cases matched the fixture's fused multiply-add expectations. - The f32 and f16 min/max checks returned the numeric operand when exactly one operand was NaN and returned a NaN when both operands were NaN. The fixture compared exact bits for numeric results and checked the NaN class for expected NaNs. **Not tested** The full GPU workspace suite and game smoke runs were omitted. Other GPU adapters were not tested. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr719-focused.log and published.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 11:38 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 11:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/719#issuecomment-7161316437) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/719/head:github-bot/gh-719'
git switch 'github-bot/gh-719'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-719'
git switch 'github-bot/gh-719'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-719'
git switch 'github-bot/gh-719'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-719'
git switch 'main'
git merge --squash 'github-bot/gh-719'
git switch 'main'
git merge --ff-only 'github-bot/gh-719'
git switch 'main'
git merge 'github-bot/gh-719'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.