Files
metal2vulkan/crates
Anees Iqbal fbf2a6bc14 SCCP float folds: a NaN beside a run value as it is; constants alone, quieted
The M3 qualification of the sfold cases (m3-max-12847) settles what Metal makes of a NaN
operand once the constants are bound:

- beside a value only the run knows, the NaN exactly as given, a signalling one not quieted
  (precise fadd, fsub, fmul, fdiv: 0x7f800321 stays 0x7f800321, a half 0xfd21 stays 0xfd21;
  air.fma with fast math or without, likewise): LLVM's propagateNaN as Metal's compiler has
  it, which returns the operand;
- where every operand is a constant, the first NaN operand quieted (sNaN + qNaN reads
  0x7fc00321, qNaN + sNaN 0xffc12345): constant folding. Metal's compiler spells such an
  operation over lane 0 of vectors whose other lanes are poison, so a NaN constant now admits
  poison lanes, as LLVM's m_NaN does, and they stay poison.

Under nnan the first case makes the AIR's value poison; the fold keeps writing the NaN (the
fragment outputs of fcprobe read it on all three Macs), where a kernel's store of it on the M3 is
dropped: an accepted difference, recorded in docs/API.md with the change that adds its rows.

Unit tests canon::tests::float_folds updated for both cases and the poison lanes (to run).

(cherry picked from commit 9ee95cb4bd782762b7ee7ab00e68d6fd6b9e099c)
2026-11-09 20:44:24 -08:00
..