Skip to content

Tests: integer-to-float conversions on the GPU - #654

Open
acaracargo wants to merge 1 commit into
xcl-dev:mainfrom
acaracargo:fork/cvt-to-float-gpu-tests
Open

acaracargo wants to merge 1 commit into
xcl-dev:mainfrom
acaracargo:fork/cvt-to-float-gpu-tests

Conversation

@acaracargo

Copy link
Copy Markdown

Adds GPU coverage for v_cvt_f32_i32, v_cvt_f32_u32, v_cvt_f32_ubyte0..3 and v_cvt_f64_i32 / u32 / f32. Previously, only v_cvt_f32_ubyte1 was covered by a GPU test.

The 16 inputs cover:

  • The boundaries of the i32 and u32 ranges.
  • 2^24 + 1 and the tie at 2^24 + 3, which must round to nearest even.
  • Every byte lane.
  • f32 infinities and NaN for the f64 conversion.

The reference uses Rust's as conversion, which also rounds to nearest even. An f32 denormal is deliberately excluded from v_cvt_f64_f32, since its preservation depends on the denormal mode and this driver flushes it to zero.

#515 covers v_cvt_f16_u16 / i16, which this test does not use.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: gpu_int_to_float_conversions.

Tested

  • NVIDIA GeForce RTX 4060 (32-lane waves only), driver 610.88; Intel Core i5-13400F; Windows 11 Pro 26300; Rust 1.100.0 x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug.
  • cargo test --workspace -- --test-threads=4 on 6d171e3: 685 passed, 0 failed, 41 ignored (main 9ce2070: 684 / 0 / 41).
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).
  • Removing the (int) cast from v_cvt_f64_i32 or reading the wrong byte for ubyte3 causes the test to fail (checked locally, reverted).

Regression run

  • Test-only change, no runtime regression run.

Not tested

  • AMD GPUs and native wave64; console hardware.

AI use

  • Claude Code (Claude Opus 5.5) wrote the test and the original description and ran the tests and mutation checks. ChatGPT assisted with editing the PR description.

v_cvt_f32_i32, v_cvt_f32_u32, v_cvt_f32_ubyte0..3 and v_cvt_f64_i32 /
u32 / f32 had no edge-value GPU test (only ubyte1 ran). 16 inputs: the
ends of the i32 and u32 ranges, 2^24 + 1 and the tie at 2^24 + 3 (round
to nearest even), all byte lanes, and f32 infinities and NaN for the
f64 conversion. The reference is Rust's `as`, which rounds to nearest
even like the ISA's default mode.

An f32 denormal is left out of v_cvt_f64_f32: whether it is flushed
depends on the f32 denormal mode. This driver flushes it to 0.

Measured: RTX 4060 (wave32), Windows 11 Pro 26300, Rust 1.100, debug.
cargo test --workspace -- --test-threads=4: 678 passed, 0 failed,
41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask,
gpu_wave32_program_in_wave64_hardware. Dropping the (int) cast of
v_cvt_f64_i32 or reading the wrong byte for ubyte3 in emit.rs fails
the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WsgnReN2iZK9RUNckZAhrv
@MonkeyPython

Copy link
Copy Markdown

AMD / native-wave64 data point (the "Not tested" axis): gpu_int_to_float_conversions passes on an AMD Raphael iGPU (RDNA2, native wave64) and on NVIDIA wave32.

Setup: Windows 11 Pro 26300, Ryzen 7 7800X3D, 32 GB; adapters: AMD Radeon(TM) Graphics (Raphael iGPU, wave64) and RTX 3080 Ti 12 GB (driver 621.01, wave32-only). PR head 6d171e3, release.

Runs (cargo test -p xcl --release --lib gpu_int_to_float_conversions):

  • XCL_ADAPTER=Radeon (selects the iGPU; the selector errors on no match, so a pass means it ran there): 1 passed / 0 failed, 0.25 s.
  • Default adapter (3080 Ti): 1 passed / 0 failed, 0.24 s.

The cvt rounding paths agree on native wave64 and on the wave32 split path.

Not tested: discrete AMD GPUs, other titles.

AI use: Gentle Shell (Pi coding agent), model qwen4-max: ran the tests and wrote this report from their logs; a human reviews it before posting. No code changes.

@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of 6d171e32577340e3224fc5d7803d3f673aa9232f on AMD RDNA4 (native wave64). I merged it onto current main 63cdc25 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: 693 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 653 passed, 0 failed, 21 ignored
  • 0 SKIPPED; gpu_int_to_float_conversions passes.

Review: i32 / u32 → f32 round to nearest even, v_cvt_f32_ubyteN take byte N, the f64 conversions are exact, and NaN stays NaN through v_cvt_f64_f32; the references follow the ISA. This adds RDNA4 next to the RDNA2 iGPU result above.

Not tested: no retail title (not needed for a test-only change), 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.

@lordon1a

Copy link
Copy Markdown

Independent GPU test report on 6d171e3:

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)
  • Command: cargo test -p xcl --lib gpu_int_to_float_conversions -- --nocapture
  • Result: 1 passed, 0 failed, 0 ignored in 0.76s (gpu::recomp::tests::gpu_int_to_float_conversions ok)

Not tested

  • AMD / wave64, Intel GPU, retail title

AI use

  • Antigravity (Google DeepMind agent) — fetched 6d171e3 in a detached worktree, audited the diff, ran the GPU test, and posted this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants