4 Commits

Author SHA1 Message Date
266b1a9c04 cvt_diff: reject empty/zero-program runs, invalid counts, and malformed --ops; accept argv 2026-11-25 07:04:49 +01:00
c4861ac7ba cvt_diff: a short export is a mismatch
check() and run_one() compared the two oracles with zip, which stops at
the shorter list, so a translator exporting fewer than the four mrt0
words passed. Both now go through compare(), which reports the word
count first (reported by isfcrctfs in the PR review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 21:05:07 +00:00
2ca1e70b8b tools/cvt_diff.py: generate clamp and the destination op_sel on v_cvt_pknorm_*_f16
Main 225f8266 measured both on gfx1036 and the translator now accepts them:
clamp is a no-op, and op_sel[2] = 1 writes S0's result to D[31:16] with
D[15:0] = 0, dropping S1's. The self-test still pinned them as refused, so
the PR failed its own test once merged onto main.

The reference models the destination bit, the sweep and the random stage
generate both forms, and the self-test pins the three measured words. Two new
translator mutations (destination op_sel ignored, clamp clamping to [0, 1])
are caught by the sweep and the random stage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 12:25:42 +00:00
e0d91d0b33 tools/cvt_diff.py: differential fuzzer for the rounding and normalizing conversions (FUZZ-58)
No fuzzer generated v_cvt_flr_i32_f32, v_cvt_rpi_i32_f32, v_cvt_norm_{i16,u16}_f16 or
v_cvt_pknorm_{i16,u16}_{f32,f16}. cvt_diff.py runs them with every source kind and modifier the
translator takes, and compares the translation (run in spirv_mini_interp) with a reference in
exact rationals, bit for bit. Stages: a source and modifier sweep, an edge grid that holds every
f16 near tie, seeded random programs, and --exhaustive-f16 over all 65,536 halves.

tests/test_cvt_diff.py pins the reference to the measured words and checks the generator and a
wrong-translation canary. docs/shader_validation.md gets a subsection with the results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 12:00:23 +00:00