Recompiler: v_cmp_class applies abs/neg on the sign bit, not as float ops #1308
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!1308
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1308/head"
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?
@DavidM1911 on GitHub · 2026-11-24 14:34 UTC · original
DavidM1911:fix-1281-cmp-class→main· +69 −16 · 2 files · 1 commits · closed without mergingv_cmp_class_f32applied VOP3abs/negthroughfsrc(), which emitsasfloat()+ floatabs()/neg(). On RDNA2 those modifiers are bitwise sign-bit operations: a floatabs()flushes f32 subnormals to+0.0under D3D12's default FTZ mode (class bits 7/4 misread as 6/5) and can quiet an sNaN into a qNaN (bit 0 vs bit 1). The unconditionalasfloat()round-trip risked the same even without modifiers.The f16 path already did this bitwise; f64 applied abs/neg on the sign bit but still round-tripped through
doubleforfclass64.What is in it
vopc()handlesclassforf32beforefsrc:abs->& 0x7FFFFFFF,neg->^ 0x80000000on the rawuint, thenfclass_u32(uint)on bits directly (same shape asfclass16).v_cmp*_class_f64passes(lo, hi)tofclass64_u32(uint l, uint h)instead ofasdouble/asuintround-trip; abs/neg already acted on the high word's sign bit.gpu_cmp_class_f32_preserves_denormals_and_snan:abs(-subnormal)classifies as+subnormal,neg(sNaN)stays sNaN, plus plain sNaN/qNaN/subnormal checks, on both wave32 and wave64.f64_class_compare_vopc_and_vop3updated for the new helper name/signature.Fixes #1281
Tested
cargo test -p xcl --lib recomp: 190 passed, 0 failed, 18 ignored (RTX 3060 Ti, Windows 11, DXC 1.8.2502.11). New test passes on both wave sizes.cargo test -p xcl --lib: 707 passed, 1 failed (coherent_buffer_sanitizes_console_flags_and_state— the known flake from #913; passes standalone), 21 ignored.cargo test --workspace: lib suite as above; one run of the lib binary aborted with 0xc0000005 under parallel load before completing — rerun completed cleanly, same flake class as the d3d12x filter noted on main.Regression run
main
930e8b4:head
1fee31e:Not tested
macOS / Linux (crate does not build there).
AI use
Devin (Cognition), frontier model. Implemented the fix and tests from the issue's analysis; ran the suites and smokes above.
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@futurepro62 on GitHub · 2026-11-24 14:43 UTC · original · edited 2026-11-24 14:47 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
1fee31e(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_cmp_class_f32_preserves_denormals_and_snan.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.v_cmp_class_f32applied to the sign bit); all three were opened within six minutes, #1308 first.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 15:42 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 21 ignored. (One run aborted with 0xc0000005 under parallel scheduling; clean on rerun — same flake seen on unmodifiedmain.)Thanks!
@ivall on GitHub · 2026-11-24 20:49 UTC · original
Closing this as a duplicate of #1306 (group D2 in #1607), which makes the same f32 change and was opened first. The f64 part here hands the two words to the helper instead of
asdoubleof them.mainalready applies abs / neg to the sign bit there, so no result changes.This says nothing about the quality of the code here. If this PR covers a case the other one does not, or #1306 is closed without being merged, say so and I'll reopen it.
Thank you for the work.
AI use: Claude Code (Claude Opus 5.5) read the diffs and the checks in #1607 and wrote this comment, on the maintainer's behalf.
Pull request closed