upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authoriurysf <98192149+iurysf@users.noreply.github.com>2026-11-23 01:18:15 -0300
committeriurysf <98192149+iurysf@users.noreply.github.com>2026-11-23 01:18:15 -0300
commite1e81f8a24e22c71be10db1cfeaf0cdfd59cdb94 (patch)
tree22f9b72b80f8969c05c8117cbd3044a905610d12 /tools
parent7bd5f01dd166dfcf80f4f96bb678cccc5918a7bc (diff)
FUZZ-55: Drop div-fixup-nan-s0 from KNOWN_DIVERGENCES now that #2477 is on main
#2477 (48a1a98b) makes the translator return signed infinity for v_div_fixup_f64 with NaN(S0), as measured on RDNA2 gfx1036, which is what the reference already modelled. The case is no longer a known divergence (as TreXito's review of #4536 observed: two tests fail on main because they expect the old divergence). - Remove the div-fixup-nan-s0 entry, its reference skip and its dedicated --known program; NaN(S0) programs are compared like any other. - Add a positive test that the reference and the translator give +-inf for qNaN, -qNaN and sNaN with both output signs. - Rework the two --known tests so they no longer depend on div_fixup: the three remaining forms are excluded with a reason by default, run with --known, and a planted clamp-only translator error exits 1 and prints the shrunk program. - docs/shader_validation.md no longer lists the div_fixup case. Same change as 41525870 (prepared for #4586, which #2477 made redundant). AI-assisted (OpenBot team). Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/f64_diff.py21
1 files changed, 4 insertions, 17 deletions
diff --git a/tools/f64_diff.py b/tools/f64_diff.py
index 340f3d106..4e42ca6f3 100644
--- a/tools/f64_diff.py
+++ b/tools/f64_diff.py
@@ -57,7 +57,6 @@ KNOWN_DIVERGENCES = {
57 "f64-omod": "SHADER-721: f64 output modifiers; owned by @fiestorra.", 57 "f64-omod": "SHADER-721: f64 output modifiers; owned by @fiestorra.",
58 "double-neg-abs": "TEST-912 (#4172): spirv_mini_interp rounds binary64 OpFNegate/FAbs through binary32, changing values as well as NaN payloads.", 58 "double-neg-abs": "TEST-912 (#4172): spirv_mini_interp rounds binary64 OpFNegate/FAbs through binary32, changing values as well as NaN payloads.",
59 "fclamp-nan-zero": "FClamp NaN and signed-zero results are driver-dependent after f64 clamp/omod.", 59 "fclamp-nan-zero": "FClamp NaN and signed-zero results are driver-dependent after f64 clamp/omod.",
60 "div-fixup-nan-s0": "RDNA2 ISA maps NaN(S0) to signed infinity; current translator preserves the NaN payload.",
61} 60}
62 61
63 62
@@ -342,15 +341,8 @@ def ref_program(lines, include_known=False):
342 else: 341 else:
343 d = int(dst[2:-1].split(":")[0]); vgpr[d], vgpr[d + 1] = bits_to_words(out) 342 d = int(dst[2:-1].split(":")[0]); vgpr[d], vgpr[d + 1] = bits_to_words(out)
344 elif op == "v_div_fixup_f64": 343 elif op == "v_div_fixup_f64":
345 args = [read_source(t, vgpr, sgpr) for t in a[:3]] 344 # NaN(S0) gives signed infinity, measured on RDNA2 gfx1036 (TEST-983; the translator has it since #2477, 48a1a98b).
346 s0, s1, s2 = args 345 d = int(dst[2:-1].split(":")[0]); vgpr[d], vgpr[d + 1] = bits_to_words(fixup(*[read_source(t, vgpr, sgpr) for t in a[:3]]))
347 ediff = ((s2 >> 52) & 0x7FF) - ((s1 >> 52) & 0x7FF)
348 normal_division = (not is_nan(s1) and not is_inf(s1) and not is_zero(s1)
349 and not is_nan(s2) and not is_inf(s2) and not is_zero(s2)
350 and -1074 <= ediff < 1024)
351 if not include_known and is_nan(s0) and normal_division:
352 raise SkipCase(f"KNOWN_DIVERGENCE div-fixup-nan-s0: {KNOWN_DIVERGENCES['div-fixup-nan-s0']}")
353 d = int(dst[2:-1].split(":")[0]); vgpr[d], vgpr[d + 1] = bits_to_words(fixup(*args))
354 elif op == "v_frexp_mant_f64": 346 elif op == "v_frexp_mant_f64":
355 d = int(dst[2:-1].split(":")[0]); vgpr[d], vgpr[d + 1] = bits_to_words(frexp(read_source(a[0], vgpr, sgpr))[0]) 347 d = int(dst[2:-1].split(":")[0]); vgpr[d], vgpr[d + 1] = bits_to_words(frexp(read_source(a[0], vgpr, sgpr))[0])
356 elif op == "v_frexp_exp_i32_f64": 348 elif op == "v_frexp_exp_i32_f64":
@@ -545,11 +537,7 @@ def make_case(rng, op, allow_literal=True, known_case=None):
545 if known_case == "fclamp-nan-zero": left, right = "0x7ff80001", "1.0" 537 if known_case == "fclamp-nan-zero": left, right = "0x7ff80001", "1.0"
546 body_lines.append(f"{op} v[8:9], {left}, {right}{suffix}") 538 body_lines.append(f"{op} v[8:9], {left}, {right}{suffix}")
547 elif op == "v_div_fixup_f64": 539 elif op == "v_div_fixup_f64":
548 if known_case == "div-fixup-nan-s0": 540 body_lines.append(f"{op} v[8:9], {gen_source(rng, 0, allow_literal, bus)}, {gen_source(rng, 1, allow_literal, bus)}, {gen_source(rng, 2, allow_literal, bus)}")
549 setup_lines += ["v_mov_b32 v12, 0x00000000", "v_mov_b32 v13, 0x7ff80000"]
550 body_lines.append(f"{op} v[8:9], v[12:13], 1.0, 2.0")
551 else:
552 body_lines.append(f"{op} v[8:9], {gen_source(rng, 0, allow_literal, bus)}, {gen_source(rng, 1, allow_literal, bus)}, {gen_source(rng, 2, allow_literal, bus)}")
553 elif op == "v_div_fmas_f64": 541 elif op == "v_div_fmas_f64":
554 # VCC is initialized true so the f64 scaled FMA path is exercised deterministically. 542 # VCC is initialized true so the f64 scaled FMA path is exercised deterministically.
555 body_lines += ["v_cmp_eq_i32_e32 vcc_lo, 0, 0", f"{op} v[8:9], {gen_source(rng, 0, allow_literal, bus)}, {gen_source(rng, 1, allow_literal, bus)}, {gen_source(rng, 2, allow_literal, bus)}"] 543 body_lines += ["v_cmp_eq_i32_e32 vcc_lo, 0, 0", f"{op} v[8:9], {gen_source(rng, 0, allow_literal, bus)}, {gen_source(rng, 1, allow_literal, bus)}, {gen_source(rng, 2, allow_literal, bus)}"]
@@ -681,8 +669,7 @@ def run_batch(ops, programs, seed, max_ops=1, sweep=True, allow_literal=True, kn
681 sequence = [(op, True, None) for op in ops] if sweep else [] 669 sequence = [(op, True, None) for op in ops] if sweep else []
682 sequence += [(rng.choice(ops), False, None) for _ in range(programs)] 670 sequence += [(rng.choice(ops), False, None) for _ in range(programs)]
683 if known: 671 if known:
684 sequence += [("v_div_fixup_f64" if label == "div-fixup-nan-s0" else "v_add_f64", True, label) 672 sequence += [("v_add_f64", True, label) for label in KNOWN_DIVERGENCES]
685 for label in KNOWN_DIVERGENCES]
686 cases = [] 673 cases = []
687 for idx, (op, is_sweep, known_case) in enumerate(sequence): 674 for idx, (op, is_sweep, known_case) in enumerate(sequence):
688 setup_lines, body_lines, _, _ = make_case(rng, op, allow_literal, known_case) 675 setup_lines, body_lines, _, _ = make_case(rng, op, allow_literal, known_case)