Commit Graph

4 Commits

Author SHA1 Message Date
6dd1181a3e Merge pull request #2004 from Ch1mpleo/fix/f16-widen-probe-atomic-json
tools/f16_widen_probe: write --json report atomically (F16-WIDEN-PROBE-ATOMIC-JSON)
2026-11-28 11:48:14 +01:00
c97e981f36 tools/f16_widen_probe: write --json report atomically (F16-WIDEN-PROBE-ATOMIC-JSON) 2026-11-26 00:56:04 +07:00
571b972cbe tools: close hardware oracle in f16_widen_probe (PROBE-F16WIDEN-ORACLE-CLOSE)
Claimed in the coordination issue as: PROBE-F16WIDEN-ORACLE-CLOSE (#14)

Wrap hardware oracle execution in tools/f16_widen_probe.py in a
try/finally block so oracle.close() is called on normal completion,
non-GFX10 exit (code 77), report write errors, and sweep exceptions.

Add unit tests in tests/test_f16_widen_probe.py verifying oracle closure
on normal success, non-GFX10 skip, and sweep exceptions.

AI-assisted: yes
agent: yes
2026-11-24 12:17:40 +03:00
79dfd24a30 Typed buffer loads keep a half NaN's payload, measured on gfx1036
mem_diff found one class of mismatch: a 16_FLOAT/16_16_FLOAT/16_16_16_16_FLOAT
typed buffer load of a half NaN. Measured natively on RDNA2 (gfx1036) with the new
tools/f16_widen_probe.py, wave32 and wave64, MUBUF and MTBUF, formats 13, 29 and 71:
the hardware widens a half NaN to f32 as sign | 0x7F800000 | (payload << 13), keeping
the sign and the quiet bit exactly as the half has them (0x7ddb -> 0x7fbb6000,
0x7fe6 -> 0x7ffcc000, 0xffb2 -> 0xfff64000).

Gen.decode_format decoded every half with UnpackHalf2x16, whose NaN result is
undefined and which the interpreter canonicalises to 0x7fc00000, so the payload was
lost. It now uses UnpackHalf2x16 for the non-NaN halves (an exact widening) and builds
the NaN word from the bits with integer ops. v_cvt_f32_f16 was measured too: it quiets
an sNaN with the payload kept (0x7ffb6000), which the typed load does not.

mem_diff's reference used struct's '<e', which keeps the payload only from Python 3.14;
f16_to_f32 pins the measured rule so the fuzzer is version independent.

tests/semantic/test_buffer_f16_widen_hw.py pins the ten measured words for MUBUF and
MTBUF and formats 13/29/71; tests/test_f16_widen_probe.py covers the probe (models,
fake oracle, CLI); mem_diff --self-test now pins the rule too.
2026-11-23 06:19:54 +03:00