Tests: check v_fma_mix_f32, v_fma_mixlo_f16 and v_fma_mixhi_f16 on the GPU #1113

Closed
mynzjerko wants to merge 1 commit from upstream-pr/1122 into main
mynzjerko commented 2026-11-24 12:06:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mynzjerko on 2026-11-24T12:06:26Z.


Add GPU test coverage for v_fma_mix_f32, v_fma_mixlo_f16, and v_fma_mixhi_f16 (ENC_VOP3P) against a pure-Rust reference in both wave64 and wave32.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: add gpu_fma_mix_f32_and_f16 covering OP_SEL_HI / OP_SEL_HI_2 / OP_SEL, NEG_HI (abs, including 0b111 on all three sources), NEG (including 0b111 on all three sources), CLAMP, SGPR SRC2, untouched 16-bit half preservation, chained mixlo + mixhi into one VDST, and dynamic S_ROUND_MODE RNE/RTZ rounding on v_fma_mixhi_f16.

Tested

  • AMD Radeon RX 9070 (RDNA4, native wave64, driver 32.0.32029.2010), AMD Ryzen 5 7500F, Windows 11 Pro 10.0.26300, rustc 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17, debug build
  • cargo test -p xcl --lib -- gpu_fma_mix_f32_and_f16 --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored (0 SKIPPED)
  • cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored (xcl --lib: 699 passed, 0 failed, 21 ignored; SKIPPED GPU tests: 0)

Not tested

  • NVIDIA / Intel GPUs, Linux / Wine, release build, retail titles (scripts/smoke.ps1; tests-only change)

AI use

  • Google Antigravity (Gemini 4 Neon) wrote the test, ran the builds and test suite locally, and drafted this description.
<!-- greyfinch-sync:ivall/xcl:issue:6581384874 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1122). Originally posted by [mynzjerko](https://github.com/mynzjerko) on 2026-11-24T12:06:26Z. --- Add GPU test coverage for `v_fma_mix_f32`, `v_fma_mixlo_f16`, and `v_fma_mixhi_f16` (`ENC_VOP3P`) against a pure-Rust reference in both `wave64` and `wave32`. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: add `gpu_fma_mix_f32_and_f16` covering `OP_SEL_HI` / `OP_SEL_HI_2` / `OP_SEL`, `NEG_HI` (abs, including `0b111` on all three sources), `NEG` (including `0b111` on all three sources), `CLAMP`, SGPR `SRC2`, untouched 16-bit half preservation, chained `mixlo` + `mixhi` into one `VDST`, and dynamic `S_ROUND_MODE` RNE/RTZ rounding on `v_fma_mixhi_f16`. **Tested** - AMD Radeon RX 9070 (RDNA4, native wave64, driver `32.0.32029.2010`), AMD Ryzen 5 7500F, Windows 11 Pro 10.0.26300, `rustc 1.100.0` (`stable-x86_64-pc-windows-msvc`), DXC `1.9.2602.17`, debug build - `cargo test -p xcl --lib -- gpu_fma_mix_f32_and_f16 --nocapture --test-threads=1`: 1 passed, 0 failed, 0 ignored (`0 SKIPPED`) - `cargo test --workspace -- --test-threads=4`: 742 passed, 0 failed, 41 ignored (`xcl --lib`: 699 passed, 0 failed, 21 ignored; `SKIPPED` GPU tests: 0) **Not tested** - NVIDIA / Intel GPUs, Linux / Wine, release build, retail titles (`scripts/smoke.ps1`; tests-only change) **AI use** - Google Antigravity (Gemini 4 Neon) wrote the test, ran the builds and test suite locally, and drafted this description.
AlexandreSchuelter commented 2026-11-24 13:03:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by AlexandreSchuelter on 2026-11-24T12:16:06Z.


Test report on RDNA2 (RX 6900 XT): gpu_fma_mix_f32_and_f16 passes in both wave64 and wave32 (gpu_waves() runs both on a wave64 adapter), and there are no new failures.

Tested

  • AMD Radeon RX 6900 XT (Navi 21, native wave64), driver 32.0.21045.29003; Ryzen 7 5800X3D; Windows NT 10.0.26300
  • Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug; DXC 1.9.2602.17; XCL_NETWORK=0, XCL_REQUIRE_GPU=wave64; no SKIPPED tests
  • cargo build --workspace + cargo test --workspace --no-fail-fast -- --test-threads=4:
Tree Passed Failed Ignored
main 47efa2e 738 3 41
this PR a5d7066 (based on 47efa2e) 739 3 41
  • The 3 failures are the same on both trees and come from main: the RDNA2 packed-mip failure in placed_title_textures_share_vram_and_preserve_pixels (fixed by #470 / #1028) and its two PoisonError cascades (#673).
  • This adds an RDNA2 result to the RDNA4 one in the description, for the f16 rounding cases (RNE / RTZ, odd -> even) and the preserved 16-bit halves.

Not tested

  • NVIDIA / Intel (wave32-only), release build, repeated runs of the new test

AI use: Claude Code (Claude Opus 5.5) fetched the branch, ran the suite and wrote this report; the runs are real, on the hardware above.

<!-- greyfinch-sync:ivall/xcl:comment:7131199316 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1122#issuecomment-7131199316). Originally posted by [AlexandreSchuelter](https://github.com/AlexandreSchuelter) on 2026-11-24T12:16:06Z. --- Test report on RDNA2 (RX 6900 XT): `gpu_fma_mix_f32_and_f16` passes in both wave64 and wave32 (`gpu_waves()` runs both on a wave64 adapter), and there are no new failures. **Tested** - AMD Radeon RX 6900 XT (Navi 21, native wave64), driver 32.0.21045.29003; Ryzen 7 5800X3D; Windows NT 10.0.26300 - Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug; DXC 1.9.2602.17; `XCL_NETWORK=0`, `XCL_REQUIRE_GPU=wave64`; no SKIPPED tests - `cargo build --workspace` + `cargo test --workspace --no-fail-fast -- --test-threads=4`: | Tree | Passed | Failed | Ignored | |---|---|---|---| | `main` `47efa2e` | 738 | 3 | 41 | | this PR `a5d7066` (based on `47efa2e`) | 739 | 3 | 41 | - The 3 failures are the same on both trees and come from `main`: the RDNA2 packed-mip failure in `placed_title_textures_share_vram_and_preserve_pixels` (fixed by #470 / #1028) and its two `PoisonError` cascades (#673). - This adds an RDNA2 result to the RDNA4 one in the description, for the f16 rounding cases (RNE / RTZ, odd -> even) and the preserved 16-bit halves. **Not tested** - NVIDIA / Intel (wave32-only), release build, repeated runs of the new test **AI use**: Claude Code (Claude Opus 5.5) fetched the branch, ran the suite and wrote this report; the runs are real, on the hardware above.
jesuarchive commented 2026-11-24 13:03:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jesuarchive on 2026-11-24T12:42:14Z.


NVIDIA run, since Not tested lists NVIDIA. Head a5d7066, merged locally onto main 47efa2e (clean merge, nothing pushed).

Tested

  • NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.1088; AMD Ryzen 7 5800XT; Windows 11 Pro build 26300; rustc 1.95.0 stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17 from the Windows SDK; debug.
  • cargo test -p xcl --lib -- gpu_fma_mix_f32_and_f16 --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored, not skipped. On this adapter gpu_waves() gives only wave32, so all three of the test's passes ran as wave32 on the NVIDIA driver (no wave64 pass here).
  • cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored. main 47efa2e on the same machine: 741 / 0 / 41; the extra one is this test.
  • SKIPPED on this adapter, the same two on main: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).

Not tested

  • The wave64 passes (no wave64 on this GPU); Intel GPUs; release build.

AI use

  • Claude Code with Claude Opus 5.5: merged the branch, ran the commands above on this machine and wrote this report.
<!-- greyfinch-sync:ivall/xcl:comment:7131804327 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1122#issuecomment-7131804327). Originally posted by [jesuarchive](https://github.com/jesuarchive) on 2026-11-24T12:42:14Z. --- NVIDIA run, since **Not tested** lists NVIDIA. Head `a5d7066`, merged locally onto `main` `47efa2e` (clean merge, nothing pushed). **Tested** - NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.1088; AMD Ryzen 7 5800XT; Windows 11 Pro build 26300; rustc 1.95.0 `stable-x86_64-pc-windows-msvc`; DXC 1.9.2602.17 from the Windows SDK; debug. - `cargo test -p xcl --lib -- gpu_fma_mix_f32_and_f16 --nocapture --test-threads=1`: 1 passed, 0 failed, 0 ignored, not skipped. On this adapter `gpu_waves()` gives only wave32, so all three of the test's passes ran as wave32 on the NVIDIA driver (no wave64 pass here). - `cargo test --workspace -- --test-threads=4`: 742 passed, 0 failed, 41 ignored. `main` `47efa2e` on the same machine: 741 / 0 / 41; the extra one is this test. - SKIPPED on this adapter, the same two on `main`: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64). **Not tested** - The wave64 passes (no wave64 on this GPU); Intel GPUs; release build. **AI use** - Claude Code with Claude Opus 5.5: merged the branch, ran the commands above on this machine and wrote this report.
bjarngard commented 2026-11-24 13:03:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bjarngard on 2026-11-24T12:45:39Z.


Test report for head a5d7066 (NVIDIA, wave32 only)

Tested

  • RTX 5080 (Blackwell, wave32), driver 621.24; Ryzen 9 9950X; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug
  • XCL_ADAPTER=nvidia cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored; gpu_fma_mix_f32_and_f16 passed
  • SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware

Not tested: Intel, retail titles.

AI use: the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.

<!-- greyfinch-sync:ivall/xcl:comment:7131881682 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1122#issuecomment-7131881682). Originally posted by [bjarngard](https://github.com/bjarngard) on 2026-11-24T12:45:39Z. --- Test report for head `a5d7066` (NVIDIA, wave32 only) **Tested** - RTX 5080 (Blackwell, wave32), driver 621.24; Ryzen 9 9950X; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug - `XCL_ADAPTER=nvidia cargo test --workspace --no-fail-fast -- --test-threads=4`: 742 passed, 0 failed, 41 ignored; `gpu_fma_mix_f32_and_f16` passed - SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` **Not tested:** Intel, retail titles. **AI use:** the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.
JoaoPauluu commented 2026-11-24 14:06:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T13:45:21Z.


A run on Linux with vkd3d-proton, where the shaders go through dxil-spirv to Vulkan instead of a Windows driver's DXIL compiler.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. a5d7066 as it is (based on 47efa2e), no uncommitted changes. The lib test binary runs under Wine.
  • gpu::recomp::tests::gpu_fma_mix_f32_and_f16 (--exact, one process): ok, no SKIPPED. DXC compiled it and it ran on the GPU in about 0.8 s.

Not tested

  • the rest of the suite on this head; native Windows; AMD / native wave64.

AI use

  • Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
<!-- greyfinch-sync:ivall/xcl:comment:7133288813 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1122#issuecomment-7133288813). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-24T13:45:21Z. --- A run on Linux with vkd3d-proton, where the shaders go through dxil-spirv to Vulkan instead of a Windows driver's DXIL compiler. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `a5d7066` as it is (based on `47efa2e`), no uncommitted changes. The lib test binary runs under Wine. - `gpu::recomp::tests::gpu_fma_mix_f32_and_f16` (`--exact`, one process): **ok**, no SKIPPED. DXC compiled it and it ran on the GPU in about 0.8 s. **Not tested** - the rest of the suite on this head; native Windows; AMD / native wave64. **AI use** - Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
Rj45n commented 2026-11-24 16:07:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Rj45n on 2026-11-24T16:05:55Z.


Tested on the NVIDIA side you list under Not tested, and it passes. I also checked that it actually fails when the emitter is wrong, which is the part a test like this lives or dies on.

Machine: RTX 5070 Ti 16 GB (driver 621.01), Windows 11 Pro 10.0.26300, Rust 1.98.1 stable-x86_64-pc-windows-msvc, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), 64 GB RAM, debug profile. Wave32 adapter, so the native 64-lane path is the one thing this card cannot cover. No XCL_SAMPLE_* set, no game data.

Commit tested: a5d7066 (this PR's head), and the same commit rebased onto main 930e8b4, ten commits ahead of your base. The rebase is clean — one file, 193 insertions, no conflict.

cargo test -p xcl --lib gpu_fma_mix_f32_and_f16 -- --test-threads=1, on a5d7066: 1 passed, 0 failed, 0 SKIPPED. Same on the rebase onto 930e8b4.
cargo test --workspace --no-fail-fast -- --test-threads=4 on the rebase: 752 passed, 0 failed, 41 ignored over 18 test binaries.
SKIPPED on this adapter — 2, both "no wave64": gpu_geometry_wave32_prefix_count_over_a_mask (which does run its wave32 content and only skips the native reference) and gpu_wave32_program_in_wave64_hardware.
It catches regressions. I put eight deliberate changes into the MIX arm of emit.rs, one at a time, reverting between each, and ran only this test. All eight fail it:

change to the v_fma_mix* arm of emit.rs assertion that fires
NEG and NEG_HI swapped v_fma_mix_f32 abs+neg
NEG_HI no longer applies abs mixlo / exactness check
abs applied after neg instead of before v_fma_mix_f32 -|x| + sgpr
OP_SEL takes the other half-word v_fma_mix_f32 mixed hi2
OP_SEL_HI ignored (every source read as f32) v_fma_mix_f32 mixed hi2
MIXLO writes the high half half-preservation assertion
the half not written is no longer preserved half-preservation assertion
CLAMP ignored v_fma_mix_f32 clamp
That is the whole point of this PR and it holds. emit.rs is byte-identical to main again; the mutations were local and never committed.

Two combinations it does not reach, if you want them and they are cheap to add — each of your cases sets NEG or NEG_HI on at most one source at a time:

NEG = 0b111 (all three sources negated),
NEG_HI = 0b111 (abs on all three).
I had these in a test of my own that I am not opening, since yours came first and covers more. Say the word if you would rather I posted the two encodings here than add them yourself.

Not tested: AMD (you have RDNA4 covered), Intel, any other NVIDIA generation, Linux / Wine, release profile, and no retail title (no Xbox GDK files here, so no scripts/smoke.ps1; this diff touches only tests.rs, so pr_check.py does not ask for one).

AI use: Claude Code with Claude Opus 5 ran the suite, the rebase and the eight-mutation check, and drafted this report. I read your diff in full before running it, and checked every count against the logs.

<!-- greyfinch-sync:ivall/xcl:comment:7137114148 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1122#issuecomment-7137114148). Originally posted by [Rj45n](https://github.com/Rj45n) on 2026-11-24T16:05:55Z. --- Tested on the NVIDIA side you list under Not tested, and it passes. I also checked that it actually fails when the emitter is wrong, which is the part a test like this lives or dies on. Machine: RTX 5070 Ti 16 GB (driver 621.01), Windows 11 Pro 10.0.26300, Rust 1.98.1 stable-x86_64-pc-windows-msvc, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), 64 GB RAM, debug profile. Wave32 adapter, so the native 64-lane path is the one thing this card cannot cover. No XCL_SAMPLE_* set, no game data. Commit tested: a5d7066 (this PR's head), and the same commit rebased onto main 930e8b4, ten commits ahead of your base. The rebase is clean — one file, 193 insertions, no conflict. cargo test -p xcl --lib gpu_fma_mix_f32_and_f16 -- --test-threads=1, on a5d7066: 1 passed, 0 failed, 0 SKIPPED. Same on the rebase onto 930e8b4. cargo test --workspace --no-fail-fast -- --test-threads=4 on the rebase: 752 passed, 0 failed, 41 ignored over 18 test binaries. SKIPPED on this adapter — 2, both "no wave64": gpu_geometry_wave32_prefix_count_over_a_mask (which does run its wave32 content and only skips the native reference) and gpu_wave32_program_in_wave64_hardware. It catches regressions. I put eight deliberate changes into the MIX arm of emit.rs, one at a time, reverting between each, and ran only this test. All eight fail it: change to the v_fma_mix* arm of emit.rs assertion that fires NEG and NEG_HI swapped v_fma_mix_f32 abs+neg NEG_HI no longer applies abs mixlo / exactness check abs applied after neg instead of before v_fma_mix_f32 -|x| + sgpr OP_SEL takes the other half-word v_fma_mix_f32 mixed hi2 OP_SEL_HI ignored (every source read as f32) v_fma_mix_f32 mixed hi2 MIXLO writes the high half half-preservation assertion the half not written is no longer preserved half-preservation assertion CLAMP ignored v_fma_mix_f32 clamp That is the whole point of this PR and it holds. emit.rs is byte-identical to main again; the mutations were local and never committed. Two combinations it does not reach, if you want them and they are cheap to add — each of your cases sets NEG or NEG_HI on at most one source at a time: NEG = 0b111 (all three sources negated), NEG_HI = 0b111 (abs on all three). I had these in a test of my own that I am not opening, since yours came first and covers more. Say the word if you would rather I posted the two encodings here than add them yourself. Not tested: AMD (you have RDNA4 covered), Intel, any other NVIDIA generation, Linux / Wine, release profile, and no retail title (no Xbox GDK files here, so no scripts/smoke.ps1; this diff touches only tests.rs, so pr_check.py does not ask for one). AI use: Claude Code with Claude Opus 5 ran the suite, the rebase and the eight-mutation check, and drafted this report. I read your diff in full before running it, and checked every count against the logs.
mynzjerko commented 2026-11-24 17:06:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mynzjerko on 2026-11-24T16:47:36Z.


Thanks @Rj45n for testing on RTX 5070 Ti and running the mutation checks!

I added both NEG=0b111 and NEG_HI=0b111 cases (v20 and v21) to gpu_fma_mix_f32_and_f16 (amended head 167e48a) and re-ran the suite on RX 9070 (Windows 11 Pro 10.0.26300, rustc 1.100.0, DXC 1.9.2602.17, debug):

  • cargo test -p xcl --lib -- gpu_fma_mix_f32_and_f16 --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored (0 SKIPPED)
  • cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored (0 SKIPPED)
<!-- greyfinch-sync:ivall/xcl:comment:7138215189 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1122#issuecomment-7138215189). Originally posted by [mynzjerko](https://github.com/mynzjerko) on 2026-11-24T16:47:36Z. --- Thanks @Rj45n for testing on RTX 5070 Ti and running the mutation checks! I added both `NEG=0b111` and `NEG_HI=0b111` cases (`v20` and `v21`) to `gpu_fma_mix_f32_and_f16` (amended head `167e48a`) and re-ran the suite on RX 9070 (Windows 11 Pro 10.0.26300, `rustc 1.100.0`, DXC `1.9.2602.17`, debug): - `cargo test -p xcl --lib -- gpu_fma_mix_f32_and_f16 --nocapture --test-threads=1`: 1 passed, 0 failed, 0 ignored (`0 SKIPPED`) - `cargo test --workspace -- --test-threads=4`: 742 passed, 0 failed, 41 ignored (`0 SKIPPED`)
upstream-sync closed this pull request 2026-11-25 00:07:11 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1113
No description provided.