Tests: cover the v_fma_mix family's halves, modifiers and clamp #1560

Open
Rj45n wants to merge 1 commit from upstream-pr/1570 into main
Rj45n commented 2026-11-24 17:46:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Rj45n on 2026-11-24T17:46:10Z.


Superseded by #1122, which came first and covers more. I wrote this before seeing that PR;
it also exercises SGPR operands, both wave32 and wave64, the dynamic S_ROUND_MODE rounding and
chained mixlo+mixhi, none of which are here. I ran #1122 on an RTX 5070 Ti and it catches eight
deliberate emit.rs regressions out of eight (report in that thread). Close this one in its favour.

The only thing this test reaches that #1122 does not: NEG = 0b111 and NEG_HI = 0b111, the
modifiers set on all three sources at once. If that is worth having, it belongs as two encodings
added to #1122, not as a second test.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: gpu_fma_mix_halves_modifiers_clamp_and_preserved_half,
    12 encodings on each of the three MIX opcodes against a CPU reference — OP_SEL_HI, OP_SEL,
    OP_SEL on a non-f16 source (ignored), NEG, NEG_HI (which is abs here, applied before
    NEG), CLAMP above 1 and below 0, and the untouched half of the destination.

Tested

  • 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, debug. No game data.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 752 passed, 0 failed, 41 ignored
    over 18 test binaries.
  • SKIPPED, 2, both "no wave64": gpu_geometry_wave32_prefix_count_over_a_mask,
    gpu_wave32_program_in_wave64_hardware.
  • Eight deliberate regressions in the MIX arm of emit.rs (NEG/NEG_HI swapped; NEG_HI not doing
    abs; abs after neg; OP_SEL taking the other half; OP_SEL_HI ignored; MIXLO writing the high half;
    the other half not preserved; CLAMP ignored) are each caught. emit.rs is unchanged here.

Not tested

  • AMD and any other GPU, Linux / Wine, release profile, wave64 (this adapter is wave32).
  • No retail title, so no scripts/smoke.ps1; the diff touches only tests.rs, which
    pr_check.py exempts.
  • f16 rounding: out of scope by design — every expected result is exactly representable.

AI use

  • Claude Code with Claude Opus 5 wrote the test, ran the suite and the mutation check, and drafted
    this description. I checked the diff and every count against the logs.
<!-- greyfinch-sync:ivall/xcl:issue:5477369945 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1570). Originally posted by [Rj45n](https://github.com/Rj45n) on 2026-11-24T17:46:10Z. --- **Superseded by #1122, which came first and covers more.** I wrote this before seeing that PR; it also exercises SGPR operands, both wave32 and wave64, the dynamic `S_ROUND_MODE` rounding and chained `mixlo`+`mixhi`, none of which are here. I ran #1122 on an RTX 5070 Ti and it catches eight deliberate `emit.rs` regressions out of eight (report in that thread). Close this one in its favour. The only thing this test reaches that #1122 does not: `NEG = 0b111` and `NEG_HI = 0b111`, the modifiers set on all three sources at once. If that is worth having, it belongs as two encodings added to #1122, not as a second test. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_fma_mix_halves_modifiers_clamp_and_preserved_half`, 12 encodings on each of the three MIX opcodes against a CPU reference — `OP_SEL_HI`, `OP_SEL`, `OP_SEL` on a non-f16 source (ignored), `NEG`, `NEG_HI` (which is `abs` here, applied before `NEG`), `CLAMP` above 1 and below 0, and the untouched half of the destination. **Tested** - 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, debug. No game data. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 752 passed, 0 failed, 41 ignored over 18 test binaries. - `SKIPPED`, 2, both "no wave64": `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - Eight deliberate regressions in the MIX arm of `emit.rs` (NEG/NEG_HI swapped; NEG_HI not doing abs; abs after neg; OP_SEL taking the other half; OP_SEL_HI ignored; MIXLO writing the high half; the other half not preserved; CLAMP ignored) are each caught. `emit.rs` is unchanged here. **Not tested** - AMD and any other GPU, Linux / Wine, release profile, wave64 (this adapter is wave32). - No retail title, so no `scripts/smoke.ps1`; the diff touches only `tests.rs`, which `pr_check.py` exempts. - f16 rounding: out of scope by design — every expected result is exactly representable. **AI use** - Claude Code with Claude Opus 5 wrote the test, ran the suite and the mutation check, and drafted this description. I checked the diff and every count against the logs.
DarkPanda69 commented 2026-11-24 19:07:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-24T18:11:42Z.


AMD run with 64-lane waves, which this PR lists as not tested.

Tested: pass, head f6a575b applied on its base main 9e3831e, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.
cargo test -p xcl --lib -- gpu::recomp --test-threads=4:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 193 passed, 0 failed, 18 ignored, 0 SKIPPED. gpu_fma_mix_halves_modifiers_clamp_and_preserved_half ok.
  • NVIDIA RTX 3060, driver 32.0.16.1088: 193 passed, 0 failed, 18 ignored, 2 SKIPPED (no wave64). Same test ok.

Not tested: release profile; Intel; the whole workspace suite.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7140294037 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1570#issuecomment-7140294037). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-24T18:11:42Z. --- AMD run with 64-lane waves, which this PR lists as not tested. **Tested:** pass, head `f6a575b` applied on its base `main` `9e3831e`, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17. `cargo test -p xcl --lib -- gpu::recomp --test-threads=4`: - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 193 passed, 0 failed, 18 ignored, 0 SKIPPED. `gpu_fma_mix_halves_modifiers_clamp_and_preserved_half` ok. - NVIDIA RTX 3060, driver 32.0.16.1088: 193 passed, 0 failed, 18 ignored, 2 SKIPPED (no wave64). Same test ok. **Not tested:** release profile; Intel; the whole workspace suite. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
DavidM1911 commented 2026-11-24 21:09:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:41:30Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7142453792 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1570#issuecomment-7142453792). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T19:41:30Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
github-actions[bot] commented 2026-11-28 08:00:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:00:43Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7236303389 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1570#issuecomment-7236303389). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T08:00:43Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 06:09:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:09:02Z.


Triage (#1607) – head f6a575b

No open PR adds the same tests; #1122 (closed, not merged) tested the same v_fma_mix family, and main only exercises V_FMA_MIX_F32 / V_FMA_MIXLO_F16 incidentally, with no V_FMA_MIXHI_F16 test.
The CPU reference matches the ISA (NEG_HI is abs for this family, OP_SEL ignored on f32 sources, MIXLO/MIXHI keep the other half), and the operands are exact in f16 so the expectations do not depend on rounding.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302540557 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1570#issuecomment-7302540557). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:09:02Z. --- **Triage (#1607)** – head f6a575b No open PR adds the same tests; #1122 (closed, not merged) tested the same v_fma_mix family, and main only exercises V_FMA_MIX_F32 / V_FMA_MIXLO_F16 incidentally, with no V_FMA_MIXHI_F16 test. The CPU reference matches the ISA (NEG_HI is abs for this family, OP_SEL ignored on f32 sources, MIXLO/MIXHI keep the other half), and the operands are exact in f16 so the expectations do not depend on rounding. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
grathepic commented 2026-12-02 23:45:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by grathepic on 2026-12-02T23:45:12Z.


merge-check

  • base: 078358a058
  • head: f6a575beaf
  • merge: clean (git diff --check exit 0)
  • build: cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace — exit 0 (36 pre-existing warnings in xcl lib)
  • tests: cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked --workspace --no-fail-fast -- --test-threads=4 (with XCL_DXC_DIR=C:\VulkanSDK\1.4.363.0\Bin) — 3007 passed, 0 failed, 52 ignored across 44 harnesses; 27 SKIPPED (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps, 1 no dxil.dll, 1 cannot disable the driver cache (Windows Developer Mode required)). New GPU test gpu::recomp::tests::gpu_fma_mix_halves_modifiers_clamp_and_preserved_half ran and passed with 0 skips.
  • title run: not required (Tier 0 test-only PR; adds one unit test in crates/xcl/src/gpu/recomp/tests.rs with zero production code or dependency changes)
  • review: Read full 101-line diff. Strictly test-only (+101/-0), placed in gpu::recomp::tests and guarded with gpu_ready(). Tests 12 ENC_VOP3P combinations across V_FMA_MIX_F32, V_FMA_MIXLO_F16, and V_FMA_MIXHI_F16 with exact dyadic f16/f32 operands: verifies OP_SEL_HI/OP_SEL_HI_2, OP_SEL (including ignored on f32), NEG_HI as abs before NEG, CLAMP (interior, >1, and <0 cases), and preservation of the untouched destination half (0xA5A5_5A5A sentinel). Disjoint VGPR allocations (v1..v6 inputs, v16..v59 outputs). Note: the PR body's opening line mentions #1122, which was closed unmerged; per #1607 triage, no other open PR covers V_FMA_MIXHI_F16 / this family.
  • performance: not applicable (test-only)
  • verdict: safe to merge
  • hardware / tool and model: NVIDIA GeForce RTX 3080 (driver 32.0.16.2140), AMD Ryzen 7 5800X3D, Windows 11 (10.0.26300.0), Rust 1.98.1-x86_64-pc-windows-msvc, DXC 1.9.0.5512 (VulkanSDK, no dxil.dll) / Antigravity, Gemini 4 Neon
<!-- greyfinch-sync:ivall/xcl:comment:7362382462 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1570#issuecomment-7362382462). Originally posted by [grathepic](https://github.com/grathepic) on 2026-12-02T23:45:12Z. --- merge-check - base: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a - head: f6a575beaf18a9888466bda7d0a5b560984b13a7 - merge: clean (`git diff --check` exit 0) - build: `cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace` — exit 0 (36 pre-existing warnings in `xcl` lib) - tests: `cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked --workspace --no-fail-fast -- --test-threads=4` (with `XCL_DXC_DIR=C:\VulkanSDK\1.4.363.0\Bin`) — 3007 passed, 0 failed, 52 ignored across 44 harnesses; 27 SKIPPED (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps, 1 no dxil.dll, 1 cannot disable the driver cache (Windows Developer Mode required)). New GPU test `gpu::recomp::tests::gpu_fma_mix_halves_modifiers_clamp_and_preserved_half` ran and passed with 0 skips. - title run: not required (Tier 0 test-only PR; adds one unit test in `crates/xcl/src/gpu/recomp/tests.rs` with zero production code or dependency changes) - review: Read full 101-line diff. Strictly test-only (`+101/-0`), placed in `gpu::recomp::tests` and guarded with `gpu_ready()`. Tests 12 `ENC_VOP3P` combinations across `V_FMA_MIX_F32`, `V_FMA_MIXLO_F16`, and `V_FMA_MIXHI_F16` with exact dyadic f16/f32 operands: verifies `OP_SEL_HI`/`OP_SEL_HI_2`, `OP_SEL` (including ignored on f32), `NEG_HI` as `abs` before `NEG`, `CLAMP` (interior, >1, and <0 cases), and preservation of the untouched destination half (`0xA5A5_5A5A` sentinel). Disjoint VGPR allocations (`v1..v6` inputs, `v16..v59` outputs). Note: the PR body's opening line mentions `#1122`, which was closed unmerged; per #1607 triage, no other open PR covers `V_FMA_MIXHI_F16` / this family. - performance: not applicable (test-only) - verdict: safe to merge - hardware / tool and model: NVIDIA GeForce RTX 3080 (driver 32.0.16.2140), AMD Ryzen 7 5800X3D, Windows 11 (10.0.26300.0), Rust 1.98.1-x86_64-pc-windows-msvc, DXC 1.9.0.5512 (VulkanSDK, no dxil.dll) / Antigravity, Gemini 4 Neon
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1570:upstream-pr/1570'
git switch 'upstream-pr/1570'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1570'
git switch 'upstream-pr/1570'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1570'
git switch 'upstream-pr/1570'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1570'
git switch 'main'
git merge --squash 'upstream-pr/1570'
git switch 'main'
git merge --ff-only 'upstream-pr/1570'
git switch 'main'
git merge 'upstream-pr/1570'
git push origin 'main'
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!1560
No description provided.