Tests: float min / max order -0 below +0 on the GPU #1301
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1301
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1301"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@upipibi on GitHub · 2026-11-24 14:30 UTC · original
upipibi:fix/minmax-signed-zero→main· +77 −0 · 1 files · 1 commits · openThe RDNA2 ISA defines
min(+0, -0) = min(-0, +0) = -0andmax(+0, -0) = max(-0, +0) = +0forV_MIN/MAX_F32,_F16and_F64, ahead of the IEEE_MODE branch.min3/max3are nested min / max. XCL emits HLSLmin/max, whose DXILFMin/FMaxleave the sign of a zero result to the driver. #1282 proposes bit-level helpers around every min / max. This PR adds the GPU test instead. On the driver below the current lowering already gives the ISA's results, so the test pins that behaviour and fails on any driver that does not, without adding HLSL to every min / max (#1269).Test-only. Part of #1282.
What is in it
crates/xcl/src/gpu/recomp/tests.rs:gpu_min_max_order_minus_zero_below_plus_zero. It coversv_min/max_f32,v_min3/max3_f32,v_min/max_f16,v_pk_min/max_f16andv_min/max_f64with(+0, -0)and(-0, +0), and compares result bits, in wave32 and wave64 (the split form on this GPU).Tested
main's emitter.cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4atb4819a3: 751 passed, 1 failed, 41 ignored.hle::xaudio2::tests::opus_source_voice_decodes_and_manages_lifetime(the voice never starts:STARTED0). It failed the same way onmain930e8b4while a parallel 24-thread C++ build had the CPU, and passed in a later full suite on this PC once that build was done: it gives the voice 3 s to start, so it is load-sensitive here, not affected by this change.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.XCL_ADAPTER=warp: the test skips, because WARP has neither 32- nor 64-lane waves. So WARP is not covered.Regression run
Not needed: test-only change.
Not tested
v_min/v_max, which order the zeros themselves), Intel, WARP.AI use
🤖 Generated with Claude Code
@DarkPanda69 on GitHub · 2026-11-24 14:39 UTC · original
AMD result, which this PR lists as not tested.
Tested: pass, head
b4819a3applied onmain930e8b4, 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:gpu_min_max_order_minus_zero_below_plus_zerook.gpu_min_max_order_minus_zero_below_plus_zerook.Not tested: Intel, WARP; the whole workspace suite.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@futurepro62 on GitHub · 2026-11-24 14:33 UTC · original · edited 2026-11-24 14:40 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
b4819a3(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.gpu_min_max_order_minus_zero_below_plus_zero.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
@ersinhf on GitHub · 2026-11-24 14:42 UTC · original
Ada and a newer NVIDIA driver (the reports so far are a 3070 on 616.56 and a 5070 Ti on 616.64). Exact head
b4819a3, clean tree, on its base930e8b4.Tested
stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17 (SDK 10.0.26100.0); noXCL_SAMPLE_*setcargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4(debug): 752 passed, 0 failed, 41 ignored; the same in release: 752 passed, 0 failed, 41 ignoredgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwaregpu_min_max_order_minus_zero_below_plus_zeroran (no skip) and passed, three more runs on its own as well: this driver gives the ISA's signed zeros for every form the test covershle::xaudio2::tests::opus_source_voice_decodes_and_manages_lifetimepasses here in both builds, so the failure in the description does look local to that PCXCL_ADAPTER=warp: the test skips (no wave64), as the description saysDoes the test catch a wrong lowering? Two local edits of
emit.rs'sv_min_f32line, reverted after:v_min_f32case (v_min_f32(-0.0, 0.0) = 0x12345678, want 0x80000000, …), so that line is the one it exercisesmin(a, b)replaced by(a < b ? a : b), which returns+0for(-0, +0)as written: the test still passes. My reading (not verified in the DXIL) is that DXC turns the compare-and-select back intoFMin, since its default float model ignores the sign of zero. If that is right, it bears on #1282's suggestion: a fix written as HLSL compares could be folded away in the same way, while the bit operations it proposes (asuint(a) | asuint(b)) would not be. It also means this test checks the driver'sFMin/FMax, which is what the PR says it pins.Not tested
FMinreading above is inferred from the result only)AI use
@DavidM1911 on GitHub · 2026-11-24 15:52 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodifiedmain.)Thanks!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.