Repository navigation
spirv_mini_interp: f32 and f32_bits give one NaN word on every Python - #7200
paratustra wants to merge 1 commit into
Conversation
struct's '<f' quiets a signalling NaN on 3.12, 3.13 and 3.15 but keeps it signalling on 3.14 (CPython gh-130317), so OpFNegate or OpFAbs on a bitcast signalling NaN gave a different word on 3.14 than on CI's 3.12. Pin CI's rule, as half_to_float already does for f16: the result is quiet, with its sign and the top 22 payload bits kept.
|
Tested 6cb9980 on CPython 3.12.10 (CI's quieting rule), Windows 11: pass for the change itself.
AI-assisted (Claude Code). |
|
Tested
AI-assisted. |
|
Closing. #7302 (merged) negates a binary32 operand on its sign bit, which is the hardware's rule. With it, AI-assisted. |
Claimed in the coordination issue as: new item
What and why
The CPU oracle in
tests/semantic/spirv_mini_interp.pyrounds throughstruct's<f. Its answer for a signalling NaN depends on the Python version. CPython 3.12, 3.13 and 3.15 quiet it, but 3.14 keeps it signalling (gh-130317). SoOpFNegateorOpFAbson a bitcast signalling NaN gave0xFF800001on 3.14 and0xFFC00001on CI's 3.12.That is how #6293's
test_f32_three_input_all_nan_keeps_src0passed for its author on 3.14.6 and is red on 3.12 onmain. A contributor on 3.14 sees a different suite from CI.This pins CI's rule in
f32andf32_bits, ashalf_to_floatandfloat_to_halfalready do for f16: a NaN comes back quiet, with its sign and the top 22 payload bits kept. Non-NaN values take the samestructpath as before._F32values from a bitcast still return their exact bits.Tested
macOS arm64, with CPython from
uv, onmainfd335571.scripts/run_semantic_tests.py tests/semantic, this PRmaintest_float_nan_fractpassesmainon 3.12. The 3 files aretest_float_nan_fract,test_image_atomics_guardandtest_image_store_d16, red onmainindependently of this change.Float32NanRuleTestsfail onmainwith 3.14 (4 subtests) and pass on 3.12, 3.14 and 3.15 with the PR.test_float_nan_fractpasses on 3.12, 3.14 and 3.15. Preserve signaling NaNs through minmax source modifiers #6685 is the fix for that test; this PR only makes every Python agree on it.git diff --checkis clean.AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator change. This is the test oracle.)