F16-UNARY-CASES-16BIT-MASKING-AND-REF-TESTS #2347
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2347
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/f16-unary-cases-mask-safety"
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 successfully merged and closed
Claimed in the coordination issue as: F16-UNARY-CASES-16BIT-MASKING-AND-REF-TESTS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194729737)
What and why
h &= 0xFFFFat the entry ofref_rcp,ref_sqrt,ref_rsq, andref_fractintests/semantic/f16_unary_cases.pyso upper bits in 32-bit test words do not leak past NaN checks (0x17E01 | 0x7E00) or bypass the+inf/-0exact comparisons (0x17C00triggeringOverflowErrorinFraction(...)).exact_sqrt_ratio(num, den, k=64)domain parameters up front (num >= 0,den > 0,k >= 0, rejecting booleans and non-integers withValueError).tests/test_f16_unary_cases.py.Tested
python -I tests/test_f16_unary_cases.py -v: 3 passed, 0 failed (detachedupstream/mainbaseline with only the new test file fails: 9 failures, 3 errors across subtests).test_valu_fract_f16,test_valu_pack_b32_f16,test_valu_rcp_f16,test_valu_rsq_f16,test_valu_sqrt_f16): 46 passed, 0 failed.python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tests/semantic/f16_unary_cases.py tests/test_f16_unary_cases.py, andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Approving fe131376f.
The
f16_unary_caseshelpers now mask their inputs to 16 bits and refuse non-integer or negative arguments. Sincef16_unary_casesandf16_refare references the translator tests compare against, I also ran every semantic test that imports either one on this batch: 208 passed (5,662 subtests).Merged onto
maind1dff7949in one batch with 15 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_f16_unary_cases.py: 3 passed (new). AI-assisted (Claude Code, Claude Opus 5.5).#2347 | head fe131376f5bd01e38e9138148ea399e9421e8200 (merged cleanly with main 901b6c1bf) |
python -I tests/test_f16_unary_cases.py && python -I scripts/run_semantic_tests.py -p "test_*f16*.py" tests/semantic| red on main:FAILED (failures=9, errors=3)(unmasked upper bits above bit 15 inref_rcp/ref_sqrt/ref_rsq/ref_fractand unguardedexact_sqrt_ratiodomain/bool inputs) | green on PR+main:3 tests OKand55 files, 575 tests, 0 files failed| Windows 11, Python 3.12.10 | AI-assisted: yesAudited
exact_sqrt_ratioandref_rcp/ref_sqrt/ref_rsq/ref_fractintests/semantic/f16_unary_cases.pyplustests/test_f16_unary_cases.py. Verified both standalone and merged together with #2303 (tests/semantic/f16_ref.py):0merge conflicts and all unit, semantic (575/575),tests/test_ci_registration.py(18 OK),tests/test_text_write_line_endings.py(3 OK),tests/test_runner_calls_all_tests.py(3 OK), andscripts/check_no_game_data.pychecks pass.Red/green: classified READY by oreo-lot3 (red on main b1619e0a3, green on head merged with main); head fe131376f5bd unchanged since 2026-11-26, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)