upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/test_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 /tests/test_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 'tests/test_f64_diff.py')
-rw-r--r--tests/test_f64_diff.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test_f64_diff.py b/tests/test_f64_diff.py
index 154c3f275..4c92e419e 100644
--- a/tests/test_f64_diff.py
+++ b/tests/test_f64_diff.py
@@ -104,6 +104,23 @@ class F64DiffTests(unittest.TestCase):
104 "v_mov_b32 v13, 0x3ff00000", op]) 104 "v_mov_b32 v13, 0x3ff00000", op])
105 self.assertEqual(result[0], 0x12345678) 105 self.assertEqual(result[0], 0x12345678)
106 106
107 def test_hw_oracle_reference_starts_with_one_lane_in_exec(self):
108 # The hardware kernel is one lane, so a v_cmpx that hits leaves EXEC = 1 and `s_mov_b32 s22, exec_lo` reads 1;
109 # the all-lanes reference said 0xffffffff, so every v_cmpx case was a false mismatch on --oracle hw. The
110 # words are what gfx1036 returned for this program (RDNA2 iGPU, Windows driver 32.0.21045.16010).
111 lines = ["s_mov_b32 s6, 0x66466f79", "s_mov_b32 s7, 0x2df96874",
112 "v_mov_b32 v8, 0x1081490d", "v_mov_b32 v9, 0xfdeb0203",
113 "v_mov_b32 v10, 0xa1ef942f", "v_mov_b32 v11, 0xfedbc06e",
114 "s_mov_b32 s10, exec_lo", "v_cmpx_lt_f64_e64 0xc83d5d11, |s[6:7]|",
115 "s_mov_b32 s22, exec_lo", "s_mov_b32 exec_lo, s10", "v_mov_b32 v9, s22",
116 "v_cmp_lt_f64_e64 s20, 0xc83d5d11, |s[6:7]|", "v_cndmask_b32_e64 v8, 0, 1, s20"]
117 hardware = [0x00000001, 0x00000001, 0xA1EF942F, 0xFEDBC06E]
118 with tempfile.TemporaryDirectory() as tmp:
119 status, _, _, _ = fd.run_one(lines, "ps_f64_hw_exec", tmp, "hw", hw_words=hardware)
120 self.assertEqual(status, "match")
121 self.assertEqual(fd.ref_program(lines)[1], 0xFFFFFFFF) # the translator's all-lanes view is unchanged
122 self.assertEqual(fd.ref_program(lines, exec_lo=1)[1], 1)
123
107 def test_shrink_reuses_prepared_gpu_context(self): 124 def test_shrink_reuses_prepared_gpu_context(self):
108 context = {"exe": "fake"} 125 context = {"exe": "fake"}
109 observed = [] 126 observed = []
@@ -288,7 +305,7 @@ class F64DiffTests(unittest.TestCase):
288 out.append(self.reason) 305 out.append(self.reason)
289 continue 306 continue
290 try: 307 try:
291 words = fd.ref_program(kernel.lines[:-3], True) # drop the store epilogue 308 words = fd.ref_program(kernel.lines[:-3], True, exec_lo=1) # drop the store epilogue; one lane, EXEC = 1
292 except (fd.SkipCase, ArithmeticError, IndexError, KeyError, ValueError): 309 except (fd.SkipCase, ArithmeticError, IndexError, KeyError, ValueError):
293 out.append("assembler rejected: fake") 310 out.append("assembler rejected: fake")
294 continue 311 continue