pixel_aot: v_cvt_i32_f64 and v_cvt_u32_f64 on a provable input domain? (scope question) #1485

Closed
opened 2026-11-24 12:52:16 +00:00 by JB2WIN · 1 comment
JB2WIN commented 2026-11-24 12:52:16 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-24T12:52:16Z.


tools/pixel_aot.py now converts into binary64 (#1363, #1446; scope closed in #1325). This asks about the next slice, conversions out of binary64: v_cvt_i32_f64 and v_cvt_u32_f64, again restricted to a provable input domain.

What the translator would track. It would record where each binary64 pair it lowered came from:

Source of the pair Domain Result
v_cvt_f64_i32 integer, in i32 range v_cvt_i32_f64 returns the original word exactly
v_cvt_f64_u32 integer, in u32 range v_cvt_u32_f64 returns the original word exactly
v_cvt_f64_f32 with known bits (#1446) known value computed at translation time by truncation toward zero, and accepted only if the value is finite and in range

What would be refused:

  • every cross case, for example a v_cvt_f64_u32 pair converted to i32 or a v_cvt_f64_i32 pair converted to u32, because the result depends on saturation;
  • NaN, infinity and out-of-range known values;
  • any pair whose origin is unknown;
  • clamp, omod, modifiers other than LLVM 15's printed forms, DPP and SDWA.

The test would round-trip the endpoint rows from #1363 (INT_MIN, INT_MAX, UINT_MAX, around 2^24) bit for bit. Fractional known values would cover truncation (±1.5, ±0.75 and the largest normal below 2^31). The negative controls would be a cross case, an out-of-range known value and a pair overwritten between the two conversions.

v_cvt_f32_f64 would stay out for now, because it rounds. It could follow later under the same provenance rule. If you'd rather leave out-conversions until the saturation rules are established, tell me.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6582205881 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1492). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-24T12:52:16Z. --- `tools/pixel_aot.py` now converts into binary64 (#1363, #1446; scope closed in #1325). This asks about the next slice, conversions *out of* binary64: `v_cvt_i32_f64` and `v_cvt_u32_f64`, again restricted to a provable input domain. **What the translator would track.** It would record where each binary64 pair it lowered came from: | Source of the pair | Domain | Result | |---|---|---| | `v_cvt_f64_i32` | integer, in i32 range | `v_cvt_i32_f64` returns the original word exactly | | `v_cvt_f64_u32` | integer, in u32 range | `v_cvt_u32_f64` returns the original word exactly | | `v_cvt_f64_f32` with known bits (#1446) | known value | computed at translation time by truncation toward zero, and accepted only if the value is finite and in range | **What would be refused:** - every cross case, for example a `v_cvt_f64_u32` pair converted to i32 or a `v_cvt_f64_i32` pair converted to u32, because the result depends on saturation; - NaN, infinity and out-of-range known values; - any pair whose origin is unknown; - `clamp`, `omod`, modifiers other than LLVM 15's printed forms, DPP and SDWA. The test would round-trip the endpoint rows from #1363 (`INT_MIN`, `INT_MAX`, `UINT_MAX`, around 2^24) bit for bit. Fractional known values would cover truncation (±1.5, ±0.75 and the largest normal below 2^31). The negative controls would be a cross case, an out-of-range known value and a pair overwritten between the two conversions. `v_cvt_f32_f64` would stay out for now, because it rounds. It could follow later under the same provenance rule. If you'd rather leave out-conversions until the saturation rules are established, tell me. AI-assisted (Claude Code).
R0Y00 commented 2026-11-24 14:03:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:22:49Z.


The restricted slice can proceed. Track both words of the binary64 pair through copies and control flow. At a join, keep provenance only when every reachable path establishes the same supported domain. Keep the same-signedness round trips and known finite values whose truncated result fits the destination. Add a one-half clobber or divergent join control. Leave cross-signedness, unsupported modifiers, and special or out-of-range values for separately measured behavior.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132746219 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1492#issuecomment-7132746219). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T13:22:49Z. --- The restricted slice can proceed. Track both words of the binary64 pair through copies and control flow. At a join, keep provenance only when every reachable path establishes the same supported domain. Keep the same-signedness round trips and known finite values whose truncated result fits the destination. Add a one-half clobber or divergent join control. Leave cross-signedness, unsupported modifiers, and special or out-of-range values for separately measured behavior.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#1485
No description provided.