Recompiler: v_cmp_class_f32 takes abs / neg on the sign bit (#1281) #1306
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!1306
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1306"
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?
@tiagonogueiraa-bit on GitHub · 2026-11-24 14:33 UTC · original
tiagonogueiraa-bit:cmp-class-f32-bits→main· +44 −6 · 2 files · 1 commits · openv_cmp_class_f32applied its VOP3 abs / neg as float operations (abs(asfloat(u)),-asfloat(u)) and passed a float tofclass. In DXIL,-xisfsub -0.0, x, which quiets an sNaN, and with D3D's fp32 denormal flush it turns a denormal into a zero. Sonegon an sNaN classified it as a qNaN, andnegon a denormal as a zero. The f16 and f64 paths already work on the bits. Fixes #1281.What is in it
crates/xcl/src/gpu/recomp/emit.rs: invopc,classon f32 clears or flips bit 31 of the raw bits, andfclasstakes theuint, asfclass16does.crates/xcl/src/gpu/recomp/tests.rs:gpu_cmp_class_f32_modifiers_keep_the_bitschecks abs / neg on a negative denormal and on an sNaN.Tested
cargo check -p xcl --lib --tests --target x86_64-pc-windows-msvc, no errors. The C code is stubbed and nothing is linked.mainand from this branch as C++ on one lane, with-xasfsub -0.0, xand the fp32 denormal flush on, to stand in for the GPU.main,neg(-denormal)andneg(sNaN)fail; the twoabscases pass, becausefabsonly touches the sign.5b4069c:cargo test --workspace --no-fail-fast -- --test-threads=4752 passed, 0 failed, 41 ignored, with SKIPPED (no wave64)gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware. The new test fails withemit.rsfrom930e8b4, withwave32 abs(-denormal) matches +denormal. (report)scripts/test.ps1752 passed, 0 failed, 41 ignored, noSKIPPED. On this card the new test also passes without the change: AMD's driver keeps denormals and sNaN throughfabsandfsub -0.0, x. So the test tells the two apart on NVIDIA (above) but not on AMD. (report)main:cargo test -p xcl --lib -- --test-threads=1, all passed, 0 failed, 21 ignored. (report)Regression run
By @IvyNotFound,
scripts/smoke.ps1 -Seconds 60,XCL_PRESS_A_AT=15, RTX 5080, unedited, from the report:main:
PR:
Not tested
fclass64'sdoubleargument (point 3 of the issue). It is left for its own change.AI use
🤖 Generated with Claude Code
@IvyNotFound on GitHub · 2026-11-24 14:57 UTC · original
GPU run of
5b4069con Windows (NVIDIA RTX 5080, 32-lane waves), since the description's runs were on macOS without a GPU: the new test passes, and fails without the changeTested
930e8b4), clean tree.cargo test -p xcl --lib gpu_cmp_class: 2 passed (gpu_cmp_class_f32_modifiers_keep_the_bits,gpu_cmp_class_f16_preserves_snan).emit.rsfrom930e8b4(the test file of this PR): fails withwave32 abs(-denormal) matches +denormal,left: (0, 0),right: (4294967295, 0).cargo test --workspace --no-fail-fast -- --test-threads=4(XCL_SAMPLE_RPF,_DLLS,_TTPF,_BVH4,_BK2,_AWCset): 752 passed, 0 failed, 41 ignored;SKIPPED(no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.scripts/smoke.ps1 -Seconds 60,XCL_PRESS_A_AT=15, unedited, for Regression run if you want them:main:
this PR:
Not tested
AI use
@vitor127wt on GitHub · 2026-11-24 14:57 UTC · original
Test report on RTX 5070 Ti under Wine
Following up on #1243. I tested the exact PR head
5b4069cdf0c1bb53886dca234ff9ef6888638fa2in a separate checkout and build directory.gpu::recomp::tests::gpu_cmp_class_f32_modifiers_keep_the_bitspassed in the workspace suite and in an isolated rerun with--exact gpu::recomp::tests::gpu_cmp_class_f32_modifiers_keep_the_bits --nocapture --test-threads=1(1 passed, 0 failed, 0 ignored, 0 skipped). The test log confirmed the RTX 5070 Ti and DXC were in use.Tested
7.3.5-2-cachyos, Wine 11.22, DXVKv2.7.1-498-ga6764047e587178, vkd3d-proton 3.1.0 from Proton-CachyOS (0bb64c56c8f0dcc), DXC 1.9.2609.5. Rust 1.100.0 and cargo-xwin 0.24.1, Windows MSVC debug target.cargo xwin build --offline --locked --target x86_64-pc-windows-msvc --workspacesucceeded.cargo xwin test --offline --locked --target x86_64-pc-windows-msvc --workspace --no-fail-fast -- --test-threads=4ran under Wine and reported 686 passed, 66 failed, 41 ignored (exit 101). Four capability skips are included in the harness's passed count and listed below.930e8b49c1c2ec683d22c724a398b39111cd0e56reported 683 passed, 68 failed, 41 ignored, with the same four skips. All 66 failure names from the PR also appeared on the base. The two additional base failures weregpu_nonfused_mad_and_mac_prevent_fma_contraction(device removed) andnever_picks_xcl_itself(file copy error). The baseline build used an on-disk target directory after a linker error on tmpfs.Not tested
Native Windows, AMD hardware and retail-title smoke runs. Retail sample environment variables were unset.
AI use
Codex (GPT-6, exact variant unavailable) cross-built and ran the tests, compared the failure lists and drafted this report.
@tiagonogueiraa-bit on GitHub · 2026-11-24 14:59 UTC · original
Thank you, @IvyNotFound and @vitor127wt! I put your runs under Tested and the two
xcl-smokeblocks under Regression run exactly as posted, with credit, and marked the PR ready for review.Written with Claude Code (Claude Opus 5.5).
@ySKELLETONX on GitHub · 2026-11-24 15:10 UTC · original
Test report on head
5b4069c(asked for in #1243). AI-written (Claude Code, Claude Opus 5.5) from real runs; checked by me.Tested
scripts/test.ps1(cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored; noSKIPPEDlinesgpu::recomp::tests::gpu_cmp_class_f32_modifiers_keep_the_bits: okemit.rschange reverted (test kept, base930e8b4), the test also passes on this card: AMD's driver keeps denormals / sNaN through FAbs andfsub fast -0.0, x, so on AMD it does not tell fixed from unfixed. An HLSL-level check on the f32 class path would fail on main on any GPU. Details for all four PRs on this issue: https://github.com/ivall/xcl/issues/1281#issuecomment-7135496005Not tested
@tiagonogueiraa-bit on GitHub · 2026-11-24 15:13 UTC · original
Thank you, @ySKELLETONX! That the test can't tell the two apart on AMD is a useful point, so I wrote it into Tested next to the NVIDIA run where it does fail without the change. I'm not pushing an extra HLSL-level check onto this head: that would invalidate the smoke blocks it already has. It would be an easy follow-up if a maintainer wants one.
Written with Claude Code (Claude Opus 5.5).
@DavidM1911 on GitHub · 2026-11-24 15:47 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!
@tiagonogueiraa-bit on GitHub · 2026-11-24 20:14 UTC · original
Thank you @DavidM1911, the merged-with-
mainrun is in Tested.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.