Recompiler: keep memory unchanged on NaN operands in atomic fmin/fmax #1271
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!1271
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1271"
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?
@b3IKK on GitHub · 2026-11-24 14:03 UTC · original
b3IKK:recomp/atomic-fmin-fmax-ignore-nan→main· +59 −7 · 2 files · 1 commits · openfloat_minmax_memrouted NaN operands (> +inf) into the unsigned branch (InterlockedMax/InterlockedMin), so a NaN operand such as+qNaN(0x7FC00000) overwrote a finite value in memory (e.g.+1.0f) under*_atomic_fmininstead of leaving memory unchanged per IEEEminNum/maxNum.This guards NaN operands before the signed/unsigned integer-atomic branches so they only load the existing value (for
GLC) without modifying memory, preserving the loop-free native integer-atomic lowering for f32 and f64 (no CAS loops added; memory cells already holding NaN remain a known non-CAS limitation).What is in it
crates/xcl/src/gpu/recomp/emit.rs: guard NaN operands ((v & ~sign_bit) > +inf) infloat_minmax_memfor both f32 and f64 (_x2), loading{old}without writing memory.crates/xcl/src/gpu/recomp/tests.rs: add GPU testgpu_atomic_fmin_fmax_nan_operand_leaves_memorycovering+qNaN/-qNaNforGLOBAL_ATOMIC_FMIN,GLOBAL_ATOMIC_FMAX,GLOBAL_ATOMIC_FMIN_X2, andGLOBAL_ATOMIC_FMAX_X2withGLC = 1(verified failing before the fix).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib gpu_atomic_fmin_fmax_nan_operand_leaves_memoryandatomic_fmin_fmax_x2_are_native_64_bit_atomics: both pass (first failed on the GPU before the fix, overwriting+1.0fwith+qNaN)Regression run
main:
PR:
Not tested
NaNwhen a finite operand arrives (stays non-CAS by design)AI use
emit.rs, wrote the fix and GPU test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.@DavidM1911 on GitHub · 2026-11-24 14:07 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
@DarkPanda69 on GitHub · 2026-11-25 13:57 UTC · original
AMD run with native wave64 (listed as untested), plus an RTX 3060: the new test passes on both, so a NaN operand leaves memory unchanged on the AMD driver too.
Head
e3b0d02applied onmain06c9f55, debug, Windows 11 Pro 26200,cargo test -p xcl --lib -- gpu:: --test-threads=4:gpu_atomic_fmin_fmax_nan_operand_leaves_memoryok. 639 passed, 2 failed, 22 ignored, 6 SKIPPED; the 2 failures are the AMD fuzz seeds tracked in #2115, the same onmain.Not tested: a memory cell already holding NaN, a title, Linux / Wine.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@S1m0ne1997 on GitHub · 2026-11-25 14:44 UTC · original
Test report for
e3b0d0293a97c637612402ada8312df940809ed7(this PR's head), for #1607.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)x86_64-pc-windows-msvc, debug.cargo build --workspace, thencargo test --workspace -- --test-threads=4at the head: 752 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64).Regression run (retail title,
scripts/smoke.ps1 -Seconds 60, release;mainbuilt from the commit in its block, this PR from its head with no changes tocrates/, both run with thescripts/smoke.ps1ofmain, which hashes the name of the game folder)main:
this PR:
Not tested
AI use: Claude Code with Claude Opus 5.5 ran the build, the suite and the regression run and wrote this report at my request.
@Lum7nt on GitHub · 2026-11-25 14:54 UTC · original
Tested on \
e3b0d0293a\ (\e3b0d02, clean PR head):ustc 1.100.0\ (\x86_64-pc-windows-msvc), DXC \1.8.2502.11\ (Windows SDK \10.0.26100.0), debug profile, \XCL_ADAPTER=nvidia.
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.