mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #2266] spirv_interp: handle GLSL IEEE edge domains, FMA sign/overflow, and OpFNegate NaNs #2270
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#2270
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/2266
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/spirv-interp-ieee-safety📝 Commits (1)
d1b1407spirv_interp: handle GLSL IEEE edge domains, FMA sign/overflow, and OpFNegate NaNs📊 Changes
2 files changed (+224 additions, -5 deletions)
View changed files
📝
tests/spirv_interp.py(+70 -5)📝
tests/test_spirv_interp_signs.py(+154 -0)📄 Description
Claimed in the coordination issue as: SPIRV-INTERP-IEEE-DOMAIN-OVERFLOW-FMA-AND-BITCAST-SIGN (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7191180874)
What and why
tests/spirv_interp.pypreviously raised Python exceptions or lost IEEE-754 sign/payload bits on valid edge-case inputs:Sqrt,InverseSqrt,Log2,Sin,Cos,Fract, andExp2called rawmath.*/2.0 ** xfunctions directly, raisingValueErrororOverflowErroron negative/zero/infinite/huge operands instead of returning IEEE-754NaN, signed infinity,0.0, or-0.0.FmaconvertedFractionsums unconditionally viafloat(...), losing-0.0sign when-0.0 * c + (-0.0)summed to zero and raisingOverflowErroron overflowing binary64 results.OpFNegateran unary-v, stripping_F32bit-pattern payloads (including signalling NaN bits) and failing on tuple vector operands.This adds IEEE-754 domain/overflow/
-0.0-safe evaluation inglsl(), preserves_F32bit patterns and vector/f64 NaN signs inOpFNegate, and adds regression tests intests/test_spirv_interp_signs.py.Tested
python -I tests/test_spirv_interp_signs.py -v(11 passed)python -I tests/test_spirv_interp_bits.py -v(5 passed)python -I tests/test_spirv_interp_f64_glsl.py -v(6 passed)upstream/mainbaseline negative control: failed with the new tests before the fixpython -I tests/test_ci_registration.py,python -I tests/test_text_write_line_endings.py,python -I scripts/check_no_game_data.py,python -I -m compileall -q, andgit diff --cached --checkGPUs 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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.