Tests: check f16 rounding, frexp and v_ldexp_f16 ops on the GPU #1227

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

@⁠plentilha on GitHub · 2026-11-24 13:24 UTC · original
plentilha:tests/f16-frexp-ldexp-gpu → main · +71 −0 · 1 files · 1 commits · open

Adds GPU execution tests for translated binary16 rounding, fraction, frexp and v_ldexp_f16 instructions: v_ceil_f16, v_floor_f16, v_trunc_f16, v_rndne_f16, v_fract_f16, v_frexp_mant_f32, v_frexp_exp_i32_f32, v_frexp_mant_f16, v_frexp_exp_i16_f16 and v_ldexp_f16. Test-only change.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: gpu_f16_rounding_and_frexp_ldexp covering positive/negative fractions, tie-to-even (2.5 -> 2.0), +0.0/-0.0, +inf and sub-unit scaling across gpu_waves(). Negative-sign mantissa outputs for v_frexp_mant_* are skipped (tracked in #580 / #587).

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_f16_rounding_and_frexp_ldexp --nocapture: 1 passed, 0 failed (wave32 pass on this adapter)

Regression run

  • Not needed: test-only change.

Not tested

  • Negative-sign v_frexp_mant_* outputs (#580 / #587), 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/1227) `plentilha:tests/f16-frexp-ldexp-gpu` → `main` · +71 −0 · 1 files · 1 commits · open Adds GPU execution tests for translated binary16 rounding, fraction, `frexp` and `v_ldexp_f16` instructions: `v_ceil_f16`, `v_floor_f16`, `v_trunc_f16`, `v_rndne_f16`, `v_fract_f16`, `v_frexp_mant_f32`, `v_frexp_exp_i32_f32`, `v_frexp_mant_f16`, `v_frexp_exp_i16_f16` and `v_ldexp_f16`. Test-only change. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_f16_rounding_and_frexp_ldexp` covering positive/negative fractions, tie-to-even (2.5 -> 2.0), `+0.0`/`-0.0`, `+inf` and sub-unit scaling across `gpu_waves()`. Negative-sign mantissa outputs for `v_frexp_mant_*` are skipped (tracked in #580 / #587). **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_f16_rounding_and_frexp_ldexp --nocapture`: 1 passed, 0 failed (wave32 pass on this adapter) **Regression run** - Not needed: test-only change. **Not tested** - Negative-sign `v_frexp_mant_*` outputs (#580 / #587), 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:46 +00:00
Author
Owner

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

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

  • cargo test -p xcl --lib recomp: 190 passed, 0 failed, 18 ignored (new GPU checks included).

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 13:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/1227#issuecomment-7133143031) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib recomp`: 190 passed, 0 failed, 18 ignored (new GPU checks included). Thanks!
Author
Owner

@⁠Mischief8713 on GitHub · 2026-11-24 15:55 UTC · original

GPU run of f30395b on Windows (NVIDIA GTX 1660 Ti, Turing): 699 passed, 0 failed; the new test passes

Tested

  • NVIDIA GeForce GTX 1660 Ti 6 GB (Turing, driver 32.0.16.2114), Ryzen 5 2600X, Windows 11 (10.0.26300), rustc 1.100.0, debug build
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64)
  • main at 930e8b4 on the same machine: lib 707 passed, 0 failed, 21 ignored; e2e 3 passed
  • The head does not contain current main (930e8b4). It was run as it is.
  • lib: 699 passed, 0 failed, 21 ignored. gpu::recomp::tests::gpu_f16_rounding_and_frexp_ldexp ran on the GPU and passed.

Not tested

  • No retail title and no scripts/smoke.ps1 run, so no regression run
  • AMD GPUs; only Turing was run here
  • Not merged with current main

AI use

  • Claude Code with Claude Sonnet 5.5 ran the commands and wrote this report. I checked the output.
**@⁠Mischief8713** on GitHub · 2026-11-24 15:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1227#issuecomment-7136831818) **GPU run of `f30395b` on Windows (NVIDIA GTX 1660 Ti, Turing): 699 passed, 0 failed; the new test passes** **Tested** - NVIDIA GeForce GTX 1660 Ti 6 GB (Turing, driver 32.0.16.2114), Ryzen 5 2600X, Windows 11 (10.0.26300), rustc 1.100.0, debug build - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4` - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no wave64) - `main` at `930e8b4` on the same machine: lib 707 passed, 0 failed, 21 ignored; `e2e` 3 passed - The head does not contain current `main` (`930e8b4`). It was run as it is. - lib: 699 passed, 0 failed, 21 ignored. `gpu::recomp::tests::gpu_f16_rounding_and_frexp_ldexp` ran on the GPU and passed. **Not tested** - No retail title and no `scripts/smoke.ps1` run, so no regression run - AMD GPUs; only Turing was run here - Not merged with current `main` **AI use** - Claude Code with Claude Sonnet 5.5 ran the commands and wrote this report. I checked the output.
Author
Owner

@⁠Toons29 on GitHub · 2026-11-24 17:12 UTC · original

AMD RDNA4 run of f30395b: the new test fails here at v_ldexp_f16 of -0. The runs above are all on NVIDIA.

Tested

  • f30395b merged into main 930e8b4 (clean merge), debug
  • AMD Radeon RX 9070 (RDNA4, native wave64), Adrenalin 26.11.2 (driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0 (stable MSVC)
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 751 passed, 1 failed, 41 ignored, 0 GPU tests SKIPPED
  • gpu_f16_rounding_and_frexp_ldexp alone (--exact): failed 8 of 8, the same way every run, also in the suite run:
panicked at crates\xcl\src\gpu\recomp\tests.rs:7065:17:
wave64 lane 5 v_ldexp_f16(0x8000): got 0x0000, want 0x8000

So the sign of -0.0 is lost (+0 comes back).

Not tested

  • No regression run (scripts/smoke.ps1): I have no retail title.
  • The other cases of the test after lane 5 (it stops at the first mismatch).

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and tests and drafted this report on the machine above; I checked each point against the logs before posting.
**@⁠Toons29** on GitHub · 2026-11-24 17:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/1227#issuecomment-7138847795) AMD RDNA4 run of `f30395b`: the new test fails here at `v_ldexp_f16` of `-0`. The runs above are all on NVIDIA. **Tested** - `f30395b` merged into `main` `930e8b4` (clean merge), debug - AMD Radeon RX 9070 (RDNA4, native wave64), Adrenalin 26.11.2 (driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0 (stable MSVC) - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 751 passed, 1 failed, 41 ignored, 0 GPU tests SKIPPED - `gpu_f16_rounding_and_frexp_ldexp` alone (`--exact`): **failed 8 of 8**, the same way every run, also in the suite run: ``` panicked at crates\xcl\src\gpu\recomp\tests.rs:7065:17: wave64 lane 5 v_ldexp_f16(0x8000): got 0x0000, want 0x8000 ``` So the sign of `-0.0` is lost (`+0` comes back). **Not tested** - No regression run (`scripts/smoke.ps1`): I have no retail title. - The other cases of the test after lane 5 (it stops at the first mismatch). **AI use** - Claude Code (Claude Opus 5.5) ran the builds and tests and drafted this report on the machine above; I checked each point against the logs before posting.
Author
Owner

@⁠joeypercia on GitHub · 2026-11-24 17:52 UTC · original

The -0 case fails because of main's v_ldexp_f16, which #672 fixes: main translates it to HLSL ldexp, and on AMD ldexp(-0.0, n) comes back as +0.

Tested (f30395b merged onto main 9e3831e, debug; Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11)

  • AMD Radeon iGPU of a Ryzen 7 7800X3D (RDNA2, native wave64), driver 26.11.2: gpu_f16_rounding_and_frexp_ldexp fails the same way as on the RX 9070 above (wave64 lane 5 v_ldexp_f16(0x8000): got 0x0000, want 0x8000). With #672 (6ec4036) merged on top, it passes.
  • RTX 4070 Ti (wave32), driver 616.56: passes with and without #672.

So on AMD this test needs #672 first; that may be worth a line in its description.

AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this comment.

**@⁠joeypercia** on GitHub · 2026-11-24 17:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/1227#issuecomment-7139823545) The `-0` case fails because of `main`'s `v_ldexp_f16`, which #672 fixes: `main` translates it to HLSL `ldexp`, and on AMD `ldexp(-0.0, n)` comes back as `+0`. **Tested** (`f30395b` merged onto `main` `9e3831e`, debug; Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11) - AMD Radeon iGPU of a Ryzen 7 7800X3D (RDNA2, native wave64), driver 26.11.2: `gpu_f16_rounding_and_frexp_ldexp` fails the same way as on the RX 9070 above (`wave64 lane 5 v_ldexp_f16(0x8000): got 0x0000, want 0x8000`). With #672 (`6ec4036`) merged on top, it passes. - RTX 4070 Ti (wave32), driver 616.56: passes with and without #672. So on AMD this test needs #672 first; that may be worth a line in its description. **AI use**: Claude Code (Claude Opus 5.5) ran the tests and drafted this comment.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 04:54 UTC · original

Tested

Clean detached PR head f30395be11f4e5b52b66bc122b02991afe725e6b. STOR-WINLAB, Windows 11 Enterprise Evaluation 25H2 x64 (26200.9974), Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust/Cargo 1.100.0 x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5, unoptimized test profile.

cargo test --locked -p xcl --lib --no-run exited 0 in 31.37 s outside the GPU mutex. With XCL_ADAPTER=A770, XCL_DIRECT_DXIL=0, and the specified DXC directory, ran:

& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    & 'L:/XclTooling/pr2008-dc0d25fe/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' gpu::recomp::tests::gpu_f16_rounding_and_frexp_ldexp --exact --nocapture --test-threads=1
}

1 passed, 0 failed, 0 ignored, 0 skipped, 719 filtered out, 0.22 s. Child and wrapper exited 0. An initial wrapper launch stopped before the fixture because of PowerShell execution policy. The successful launch used process-scoped RemoteSigned and ran the fixture once.

All 296 standalone wave32 lane-operation assertions passed. In particular, v_ldexp_f16(-0.0, -5) retained 0x8000 on lanes 5, 13, 21, and 29. The AMD wave64 report exercised a PR-plus-main merge and found positive zero at lane 5.

Not tested

Native or split wave64, negative-sign frexp mantissas outside this fixture, direct DXIL, other revisions and adapters, full suite, and retail smoke.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixtures and prepared this report.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 04:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1227#issuecomment-7153266956) **Tested** Clean detached PR head `f30395be11f4e5b52b66bc122b02991afe725e6b`. STOR-WINLAB, Windows 11 Enterprise Evaluation 25H2 x64 (26200.9974), Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust/Cargo 1.100.0 x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5, unoptimized test profile. `cargo test --locked -p xcl --lib --no-run` exited 0 in 31.37 s outside the GPU mutex. With `XCL_ADAPTER=A770`, `XCL_DIRECT_DXIL=0`, and the specified DXC directory, ran: ```powershell & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { & 'L:/XclTooling/pr2008-dc0d25fe/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' gpu::recomp::tests::gpu_f16_rounding_and_frexp_ldexp --exact --nocapture --test-threads=1 } ``` **1 passed, 0 failed, 0 ignored, 0 skipped**, 719 filtered out, 0.22 s. Child and wrapper exited 0. An initial wrapper launch stopped before the fixture because of PowerShell execution policy. The successful launch used process-scoped RemoteSigned and ran the fixture once. All 296 standalone wave32 lane-operation assertions passed. In particular, `v_ldexp_f16(-0.0, -5)` retained `0x8000` on lanes 5, 13, 21, and 29. The [AMD wave64 report](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1227) exercised a PR-plus-main merge and found positive zero at lane 5. **Not tested** Native or split wave64, negative-sign `frexp` mantissas outside this fixture, direct DXIL, other revisions and adapters, full suite, and retail smoke. **AI use** T3 Code / Codex (`gpt-6.2-sol`) ran the checked-in fixtures and prepared this report.
Author
Owner

@⁠zhouzhidong3-hash on GitHub · 2026-11-25 07:57 UTC · original

Independent RTX 5070 check of this fixture on a newer runtime tree.

Applied the unchanged test-only diff from #1227 f30395be11 cleanly onto 7a1f5a2e65 (#1994 original head). No runtime changes were applied. This is not a clean #1227-head run.

Windows 10 x64, i7-12700KF, RTX 5070 driver 591.86, Rust 1.100.0 MSVC debug, DXC/DXIL 1.8.2502.11 and local Agility SDK, XCL_ADAPTER=5070.

cargo test --locked -p xcl --lib gpu_f16_rounding_and_frexp_ldexp -- --test-threads=1 --nocapture

  • XCL_DIRECT_DXIL=0: 1 passed, 0 failed, 0 ignored, 972 filtered out, 0.49 s.
  • XCL_DIRECT_DXIL=all: 1 passed, 0 failed, 0 ignored, 972 filtered out, 0.30 s.
  • No GPU skips in either log. Original fixture retains its deliberate exclusion of negative frexp mantissa checks. NaN comparison accepts any NaN encoding.

Not tested: clean original PR runtime, AMD/Intel, native wave64, full workspace, Release, retail, or fallback instrumentation. Temporary fixture addition restored byte-for-byte; no tracked diff after execution.

Logs: pr1227-modern-0.log and pr1227-modern-all.log under I:\neospace\work\xcl-1994-5070.
AI assistance: OpenAI Codex applied the existing fixture temporarily, ran both configurations, checked logs, restored source and drafted this report.

**@⁠zhouzhidong3-hash** on GitHub · 2026-11-25 07:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1227#issuecomment-7156443777) Independent RTX 5070 check of this fixture on a newer runtime tree. Applied the unchanged test-only diff from #1227 f30395be11f4e5b52b66bc122b02991afe725e6b cleanly onto 7a1f5a2e6541c9fa0ef921e319fa81a2fdc2e42f (#1994 original head). No runtime changes were applied. This is not a clean #1227-head run. Windows 10 x64, i7-12700KF, RTX 5070 driver 591.86, Rust 1.100.0 MSVC debug, DXC/DXIL 1.8.2502.11 and local Agility SDK, XCL_ADAPTER=5070. `cargo test --locked -p xcl --lib gpu_f16_rounding_and_frexp_ldexp -- --test-threads=1 --nocapture` - XCL_DIRECT_DXIL=0: 1 passed, 0 failed, 0 ignored, 972 filtered out, 0.49 s. - XCL_DIRECT_DXIL=all: 1 passed, 0 failed, 0 ignored, 972 filtered out, 0.30 s. - No GPU skips in either log. Original fixture retains its deliberate exclusion of negative frexp mantissa checks. NaN comparison accepts any NaN encoding. Not tested: clean original PR runtime, AMD/Intel, native wave64, full workspace, Release, retail, or fallback instrumentation. Temporary fixture addition restored byte-for-byte; no tracked diff after execution. Logs: pr1227-modern-0.log and pr1227-modern-all.log under I:\neospace\work\xcl-1994-5070. AI assistance: OpenAI Codex applied the existing fixture temporarily, ran both configurations, checked logs, restored source and drafted this report.
Author
Owner

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

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 04:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/1227#issuecomment-7182461876) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
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/1227/head:github-bot/gh-1227'
git switch 'github-bot/gh-1227'

Merge

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