Tests: float min / max order -0 below +0 on the GPU #1291
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T14:30:49Z.
The 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
At the current head
88bbc77(rebased ontomaine99b0bdon 2026-12-03): NVIDIA GeForce RTX 3070, driver 621.40, Windows 11 Pro, rustc 1.100.0, debug.cargo test -p xcl --lib -- --test-threads=4(default, direct backend): 2864 passed, 0 failed, 37 ignoredgpu_min_max_order_minus_zero_below_plus_zero, 3 runs each withXCL_DIRECT_DXIL=0and=1: 1 passed, 0 failed every run.Earlier, at
b4819a3: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
The pair below is for the earlier head
b4819a3, before the 2026-12-03 rebase; a pair on88bbc77is needed.Not needed: test-only change.
Not tested
v_min/v_max, which order the zeros themselves), Intel, WARP.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-24T14:39:39Z.
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.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:33:16Z.
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
Imported from ivall/xcl. Originally posted by ersinhf on 2026-11-24T14:42:14Z.
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
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T15:52:46Z.
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!
upstream-sync referenced this pull request2026-11-25 04:08:41 +00:00
upstream-sync referenced this pull request2026-11-25 07:04:28 +00:00
upstream-sync referenced this pull request2026-11-25 18:04:03 +00:00
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:18:39Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:22:34Z.
Triage (#1607) – head
b4819a3#1577 targets the same issue (#1282) differently: it wraps every f16/f32 min/max/min3/max3/pk_min/pk_max in new
fmin_ieee/fmax_ieeehelpers. This PR adds only a GPU test that pins the ISA's -0 < +0 ordering (f64 included) and reports that the current lowering already passes on NVIDIA and AMD. The two are different approaches, not duplicates.No problems found in the diff. The PR conflicts with main.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by upipibi on 2026-12-03T17:10:18Z.
Rebased onto
maine99b0bd(head88bbc77, test-only). It still pins min/max ordering −0 below +0 on the GPU across drivers. RTX 3070, driver 621.40, debug:gpu_min_max_order_minus_zero_below_plus_zero, 3 runs each withXCL_DIRECT_DXIL=0and=1: 1 passed, 0 failed every runcargo test -p xcl --lib -- --test-threads=4: 2864 passed, 0 failed, 37 ignoredTested with the help of Claude Code (Claude Opus 5.5).
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.