pixel_aot: v_cvt_f32_f64 on proven pairs, and which MODE field rounds it? (scope question) #1606
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#1606
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?
@JB2WIN on GitHub · 2026-11-24 14:52 UTC · original
tools/pixel_aot.pynow tracks the provenance of binary64 pairs (#1575), covering conversions into binary64 (#1363, #1446) and out to i32/u32 (#1492). That leavesv_cvt_f32_f64as the last conversion. Unlike the others, it can round, so I'd like to settle two things before I build it.1. Which rounding and denormal field applies? The result is binary32 but the source is binary64.
MODE[1:0]/MODE[5:4]are the binary32 rounding and denormal fields, andMODE[3:2]/MODE[7:6]are the binary16/binary64 fields; the comment aboveHALF_ROUNDINGdescribes these. I have not found a public statement of which pair the hardware uses for this conversion. The LLVM 15 TableGen does not say either, so I don't want to guess.2. Proposed first slice, independent of the mode. Accept only cases whose result needs no rounding and is not subnormal. Then neither field matters:
v_cvt_f64_f32pairs (known bits): always exact back to the original binary32, because widening is exact and narrowing it again is exact. I would compute the result at translation time and check it withstructround-tripping.v_cvt_f64_i32/v_cvt_f64_u32pairs: refused in this slice. A runtime integer above 2^24 rounds, and the translator cannot prove the source magnitude._e64,clamp,omodand modifiers.If you know which MODE field governs the conversion, or have a native reference for it, the integer pairs could follow under a declared rounding profile. This first slice would be small, but it would close the provenance round trip for statically known values. If it isn't worth a PR on its own, tell me and I'll leave it until the rounding question is settled.
AI-assisted (Claude Code).
@R0Y00 on GitHub · 2026-11-24 15:14 UTC · original
Go ahead with the mode-independent slice. Reuse the proven pair tracking from #1575 and accept only a statically known normal binary32 value or signed zero that returns bit-for-bit after widening and narrowing. Keep both infinities, NaNs, subnormals, unknown pairs, integer-origin pairs and modifiers outside this first slice. Include both signed zeros, representative normal endpoints, a word clobber or unequal join, and a value requiring rounding as refusals. Use LLVM round-trip and raw integer readback. Leave selection of the MODE field open until independent native evidence distinguishes the two fields.
@triggered02 on GitHub · 2026-11-28 17:14 UTC · original
Claiming the mode-independent first slice described in your last comment. I will reuse the proven-pair tracking from #1575 in tools/pixel_aot.py and accept only a statically known normal binary32 value or signed zero that round-trips bit-for-bit through a binary64 pair. Infinities, NaNs, subnormals, unknown pairs, integer-origin pairs, _e64, clamp/omod and modifiers stay refused; so do the word-clobber/unequal-join, unequal-precision and rounding-required controls you listed. Evidence will be the pure-Python pixel_aot checks on this Debian x64 host (Python 3, LLVM round-trip and raw integer readback); I cannot supply Windows or hardware evidence here. The MODE field question stays open as you requested. No game files, dumps or personal paths will be shared.
@triggered02 on GitHub · 2026-11-28 17:25 UTC · original
Withdrawing my claim: after checking current main I found the mode-independent slice already implemented in tools/pixel_aot.py (v_cvt_f32_f64 lowering with the proven static-pair record, cvt_f32_f64_exact_bits round-trip check and the refusal controls). My earlier comment predated that check; no PR from me is coming for this issue.