upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tools/f64_diff.py
diff options
context:
space:
mode:
authorevilclanker9000 <45567075+evilclanker9000@users.noreply.github.com>2026-11-23 20:56:24 +0100
committerevilclanker9000 <45567075+evilclanker9000@users.noreply.github.com>2026-11-23 20:56:24 +0100
commitf114bfb35cd1d98d0f00de1fa1d4bba5bdb7c216 (patch)
tree05c15faafd002ad1f8778a1fdd7be44f049d4f98 /tools/f64_diff.py
parent867d922f09b86583859796a174df89555fb32da8 (diff)
f64_diff: the hw oracle's reference starts with one lane in EXEC
ref_program began with EXEC = 0xffffffff, but the hardware kernel runs one lane, so EXEC is 1 there. Every v_cmpx case (the program reads exec_lo back with s_mov_b32 s22, exec_lo) therefore differed in one word, --oracle hw stopped at the first such case with a false mismatch, and the shrinker reduced it to an unrelated program. ref_program takes exec_lo (default unchanged for the translator and gpu oracles) and run_one passes 1 for hw; the FakeHW test double answers as a one-lane kernel. On gfx1036 the run now gives 294 match, 0 mismatch (it stopped at the first v_cmpx before).
Diffstat (limited to 'tools/f64_diff.py')
-rw-r--r--tools/f64_diff.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/f64_diff.py b/tools/f64_diff.py
index 33d46aa0f..299d8f447 100644
--- a/tools/f64_diff.py
+++ b/tools/f64_diff.py
@@ -281,8 +281,8 @@ def parse_source_args(line):
281 return bits[0], bits[1].rstrip(","), [x.strip() for x in args] 281 return bits[0], bits[1].rstrip(","), [x.strip() for x in args]
282 282
283 283
284def ref_program(lines, include_known=False): 284def ref_program(lines, include_known=False, exec_lo=M32):
285 vgpr, sgpr, mode, vcc, active = {}, {}, 0, 0, M32 285 vgpr, sgpr, mode, vcc, active = {}, {}, 0, 0, exec_lo
286 for line in lines: 286 for line in lines:
287 s = line.strip() 287 s = line.strip()
288 if not s or s.startswith((";", "exp ", "s_endpgm")): continue 288 if not s or s.startswith((";", "exp ", "s_endpgm")): continue
@@ -629,7 +629,8 @@ def run_one(lines, name, tmp, oracle="translator", gpu=None, include_known=False
629 return "skip", f"KNOWN_DIVERGENCE fclamp-nan-zero: {KNOWN_DIVERGENCES['fclamp-nan-zero']}", None, None 629 return "skip", f"KNOWN_DIVERGENCE fclamp-nan-zero: {KNOWN_DIVERGENCES['fclamp-nan-zero']}", None, None
630 if line.split() and line.split()[0] in ("v_add_f64", "v_cvt_f32_f64", "v_rcp_f64", "v_rsq_f64", "v_sqrt_f64", "v_div_fmas_f64") and ("|" in line or "-v[" in line or "-s[" in line): 630 if line.split() and line.split()[0] in ("v_add_f64", "v_cvt_f32_f64", "v_rcp_f64", "v_rsq_f64", "v_sqrt_f64", "v_div_fmas_f64") and ("|" in line or "-v[" in line or "-s[" in line):
631 return "skip", f"KNOWN_DIVERGENCE double-neg-abs: {KNOWN_DIVERGENCES['double-neg-abs']}", None, None 631 return "skip", f"KNOWN_DIVERGENCE double-neg-abs: {KNOWN_DIVERGENCES['double-neg-abs']}", None, None
632 try: expected = ref_program(lines, include_known) 632 # The hardware kernel is one lane, so EXEC is 1 there and a program that reads exec_lo back sees 1.
633 try: expected = ref_program(lines, include_known, 1 if oracle == "hw" else M32)
633 except SkipCase as exc: return "skip", str(exc), None, None 634 except SkipCase as exc: return "skip", str(exc), None, None
634 except (ArithmeticError, IndexError, KeyError, ValueError) as exc: 635 except (ArithmeticError, IndexError, KeyError, ValueError) as exc:
635 return "skip", f"reference limitation: {type(exc).__name__}: {exc}", None, None 636 return "skip", f"reference limitation: {type(exc).__name__}: {exc}", None, None