Skip to content

Tests: check integer min3 / max3 / med3 on the GPU - #1199

Open
jesuarchive wants to merge 1 commit into
xcl-dev:mainfrom
jesuarchive:tests/vminmax3-int
Open

jesuarchive wants to merge 1 commit into
xcl-dev:mainfrom
jesuarchive:tests/vminmax3-int

Conversation

@jesuarchive

Copy link
Copy Markdown

v_min3/max3/med3 for i32, u32 and i16 are translated (emit.rs) but had no GPU test. The open test PRs cover the f32, f16 and u16 forms (#686, #738, #739). This adds the integer ones, test-only.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: gpu_min3_max3_med3_integers. It runs triples of six values that order differently as signed and unsigned, with repeats: 0, 1, the signed maximum and minimum, -1 and a middle value. These are 32-bit for the i32 / u32 forms. For the _i16 forms they sit in the low halves and the high halves hold other values. Only the low half of an _i16 result is checked, since what a 16-bit VALU op leaves in the high half is discussed in Tests: 16-bit VALU results keep the other half of VDST #1115. Runs on every adapter through gpu_waves().

Tested

  • NVIDIA GeForce RTX 3060 12 GB (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 --workspace -- --test-threads=4: 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). main 47efa2e on the same machine: 741 / 0 / 41, the same two skipped.
  • cargo test -p xcl --lib -- gpu_min3_max3_med3_integers --nocapture --test-threads=1: 1 passed, not skipped (wave32 pass only on this adapter).
  • Negative controls, each a temporary edit of emit.rs, reverted: v_min3_i32 comparing unsigned, v_med3_u32 returning the maximum, v_max3_i16 comparing unsigned. The test fails on each, naming the instruction.

Regression run

  • Not needed: test-only change.

Not tested

  • The wave64 pass (no 64-lane waves on this GPU): AMD and Intel GPUs.
  • The high half of the _i16 results (see above); OP_SEL on the _i16 forms.
  • Wine, release build.

AI use

  • Claude Code with Claude Opus 5.5: found the untested instructions, wrote the test and this description, ran the tests and negative controls on the machine above.

v_min3/max3/med3 for i32, u32 and i16 were translated but had no GPU
test. The new test runs every triple of six values that order differently
as signed and unsigned (with repeats): 0, 1, the signed maximum and
minimum, -1 and a middle value, in 32 bits and, for the _i16 forms, on the
low halves while the high halves hold other values. Only the low half of
an _i16 result is checked.

It fails if v_min3_i32 compares unsigned, if v_med3_u32 returns the
maximum, or if v_max3_i16 compares unsigned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DavidM1911

Copy link
Copy Markdown
Contributor

Independent verification on current main 384f7f7 (branch already contains it — clean).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11.

  • cargo test -p xcl --lib med3: 1 passed, 0 failed — gpu_min3_max3_med3_integers on real hardware.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

@bjarngard

Copy link
Copy Markdown

Test report for head 6849439 (AMD, native wave64)

Tested

  • AMD Radeon(TM) Graphics (Ryzen 9 9950X iGPU, RDNA2, native wave64), driver 32.0.21043.5001; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no SKIPPED
  • With XCL_REQUIRE_GPU=wave64: gpu_min3_max3_med3_integers passed
  • The test loops over gpu_waves(), so on this adapter both the wave64 and the wave32 pass ran

Not tested: the high half and OP_SEL of the _i16 forms (beyond what the test checks), Intel, Wine.

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.

@ivall ivall added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 24, 2026
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.

4 participants