mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #1659] fmisc_diff: do not judge the class bits of a NaN whose quiet bit is unmodelled #1673
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1673
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1659
Author: @whoalin1
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:snan-fma-cmpclass📝 Commits (1)
fc3342ffmisc_diff: do not judge the class bits of a NaN whose quiet bit is unmodelled📊 Changes
3 files changed (+88 additions, -8 deletions)
View changed files
📝
docs/shader_validation.md(+8 -2)📝
tests/test_fmisc_diff.py(+25 -0)📝
tools/fmisc_diff.py(+55 -6)📄 Description
Fuzz-campaign follow-up (coordination issue #14; its comment thread is at the cap so context lives here):
fmisc_diffreported a divergence where an sNaN throughv_fmamk_f32flipped thev_cmp_class_f32result bit on both AMD gfx1036 and NVIDIA RTX 4070 SUPER.Root cause is not the translator: hardware itself does not deterministically preserve the NaN quiet bit — measured on gfx1036 under the game'''s MODE (IEEE off, denormal flush), an sNaN operand mostly passes through
v_fmamk_f32unchanged but is quieted in edge cases. The translator'''s output matched what the hardware produces on both GPUs; the fuzzer'''s reference model simply had no way to express "this NaN'''s quiet bit is unknown".What
tools/fmisc_diff.pygainsst["nanf"]— a set of VGPRs holding a computed NaN whose quiet bit is not modelled. It is set whenv_fmamk_f32sees a signalling-NaN (or already-fuzzy NaN) operand and propagates through the pass-through ops (v_fract_f32,v_frexp_mant_f32,v_frexp_exp_i32_f32,v_ldexp_f32, theNAN_PASSTHROUGHset) andv_mov_b32/v_cndmask_b32_e64; it clears on any fully-modelled result.v_cmp_class_f32on ananfregister raisesUncertain(aSkipsubclass) instead of producing a false mismatch.docs/shader_validation.mdrecords the measurement and the conclusion.Verification
tests/test_fmisc_diff.py: 35 tests pass, including the newtest_class_of_a_computed_nan(sNaN→fmamk→class raisesUncertain; fuzzy NaN surviving a pass-through still raises; quiet-NaN and exact-sNaN cases are still judged — guards against over-skipping).tools/fmisc_diff.py --programs 3000 --seed 11 --max-ops 8(translator oracle): 2512 pass, 0 mismatch, 488 skipped; a targeted 2000-program run produced 4 skips with the new reason and 0 mismatches.Independent review: APPROVE —
nanfcoverage is complete for the ops this fuzzer models (v_fmamk_f32is the only NaN-minting op in its set; other producers raiseRefError),Uncertainflows through the skip path correctly, and the tests fail without the fix. Non-blocking notes left for a possible follow-up:v_cmp_classcould skip only whenmask & 3is exactly one of the NaN class bits (masks00/11are deterministic either way), and one copy/cndmaskpropagation case could be added to the test.AI-assisted (Devin).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.