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
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.