Tests: check 24-bit multiply/MAD, mul_hi and SAD ops on the GPU #1228

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

@⁠plentilha on GitHub · 2026-11-24 13:24 UTC · original
plentilha:tests/mul24-sad-gpu → main · +83 −0 · 1 files · 1 commits · open

Adds GPU execution tests for 14 translated 24-bit multiply/MAD, 32-bit high-multiply, sum-of-absolute-differences and byte-lerp VALU instructions: v_mul_i32_i24, v_mul_hi_i32_i24, v_mul_u32_u24, v_mul_hi_u32_u24, v_mad_i32_i24, v_mad_u32_u24, v_mul_hi_i32, v_mul_hi_u32, v_sad_u32, v_sad_u16, v_sad_u8, v_sad_hi_u8, v_msad_u8 and v_lerp_u8. Test-only change.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: gpu_mul24_mul_hi_and_sad_ops verifying high-byte masking/sign-extension on 24-bit inputs, 64-bit high products, zero-byte masking in v_msad_u8 and rounding-bit carries in v_lerp_u8 across gpu_waves().

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 3070 (driver 32.0.16.2124, wave32 only), Intel Core i7-9700K, Windows 11 x64, rustc 1.100.0, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), debug
  • ./scripts/test.ps1: 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64))
  • cargo test -p xcl --lib -- gpu_mul24_mul_hi_and_sad_ops --nocapture: 1 passed, 0 failed (wave32 pass on this adapter)

Regression run

  • Not needed: test-only change.

Not tested

  • Native wave64 pass (AMD/Intel GPUs), retail game runs (XCL_SAMPLE_* unset), Wine, release build.

AI use

  • Antigravity (Gemini 4 Hydrogen): checked emit.rs coverage, wrote the test and PR description, and ran the test suite locally.
**@⁠plentilha** on GitHub · 2026-11-24 13:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1228) `plentilha:tests/mul24-sad-gpu` → `main` · +83 −0 · 1 files · 1 commits · open Adds GPU execution tests for 14 translated 24-bit multiply/MAD, 32-bit high-multiply, sum-of-absolute-differences and byte-lerp VALU instructions: `v_mul_i32_i24`, `v_mul_hi_i32_i24`, `v_mul_u32_u24`, `v_mul_hi_u32_u24`, `v_mad_i32_i24`, `v_mad_u32_u24`, `v_mul_hi_i32`, `v_mul_hi_u32`, `v_sad_u32`, `v_sad_u16`, `v_sad_u8`, `v_sad_hi_u8`, `v_msad_u8` and `v_lerp_u8`. Test-only change. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_mul24_mul_hi_and_sad_ops` verifying high-byte masking/sign-extension on 24-bit inputs, 64-bit high products, zero-byte masking in `v_msad_u8` and rounding-bit carries in `v_lerp_u8` across `gpu_waves()`. **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 3070 (driver 32.0.16.2124, wave32 only), Intel Core i7-9700K, Windows 11 x64, rustc 1.100.0, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), debug - `./scripts/test.ps1`: 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64)) - `cargo test -p xcl --lib -- gpu_mul24_mul_hi_and_sad_ops --nocapture`: 1 passed, 0 failed (wave32 pass on this adapter) **Regression run** - Not needed: test-only change. **Not tested** - Native wave64 pass (AMD/Intel GPUs), retail game runs (`XCL_SAMPLE_*` unset), Wine, release build. **AI use** - Antigravity (Gemini 4 Hydrogen): checked `emit.rs` coverage, wrote the test and PR description, and ran the test suite locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:48 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 13:28 UTC · original

Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on main@47efa2e (baseline 741 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
742 passed; 0 failed; 41 ignored   (exit 0)

One more than the baseline: the 24-bit multiply/MAD, mul_hi and SAD checks run green here.

Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

**@⁠dcastell1** on GitHub · 2026-11-24 13:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1228#issuecomment-7132880296) Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on `main@47efa2e` (baseline **741 passed, 0 failed, 41 ignored** on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 742 passed; 0 failed; 41 ignored (exit 0) ``` One more than the baseline: the 24-bit multiply/MAD, `mul_hi` and SAD checks run green here. Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 13:36 UTC · original

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

  • cargo test -p xcl --lib recomp: 190 passed, 0 failed, 18 ignored (includes the new 24-bit multiply/MAD/mul_hi/SAD GPU checks).

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 13:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/1228#issuecomment-7133063694) Verification on RTX 3060 Ti (Windows 11, latest Vulkan driver), branch merged with current `main`: - `cargo test -p xcl --lib recomp`: 190 passed, 0 failed, 18 ignored (includes the new 24-bit multiply/MAD/mul_hi/SAD GPU checks). Thanks!
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 14:09 UTC · original

I checked the expected values against the RDNA2 definitions (read from the ISA, not run on AMD hardware). All 14 match:

  • v_mul_hi_{i32_i24,u32_u24}: bits 63..32 of the 48-bit product.
  • v_msad_u8: a byte whose S1 byte is 0 adds nothing.
  • v_sad_hi_u8: the SAD shifted left 16 before S2 is added.
  • v_lerp_u8: the rounding bit of each byte is bit 0 of the matching S2 byte (bits 0, 8, 16, 24).

The cases also cover the ignored top byte of the 24-bit ops, and a zero reference byte for msad. No changes needed from my side.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-24 14:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/1228#issuecomment-7133923824) I checked the expected values against the RDNA2 definitions (read from the ISA, not run on AMD hardware). All 14 match: - `v_mul_hi_{i32_i24,u32_u24}`: bits 63..32 of the 48-bit product. - `v_msad_u8`: a byte whose S1 byte is 0 adds nothing. - `v_sad_hi_u8`: the SAD shifted left 16 before S2 is added. - `v_lerp_u8`: the rounding bit of each byte is bit 0 of the matching S2 byte (bits 0, 8, 16, 24). The cases also cover the ignored top byte of the 24-bit ops, and a zero reference byte for `msad`. No changes needed from my side. AI-assisted (Claude Code).
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:17 UTC · original

Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-26 04:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/1228#issuecomment-7182464797) Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/gpu/recomp/tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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