diff --git a/tools/hw-oracle/hw_oracle.py b/tools/hw-oracle/hw_oracle.py index b9a611e57..b3d6e4ed7 100644 --- a/tools/hw-oracle/hw_oracle.py +++ b/tools/hw-oracle/hw_oracle.py @@ -67,7 +67,7 @@ def assemble(body, work, wave64, *, ieee, denorm32, denorm16, dx10_clamp, round3 ("@FP16_OVERFLOW@", str(int(fp16_overflow))), ("@BODY@", body)): text = text.replace(key, value) (work / "k.s").write_text(text) - subprocess.run([tool("clang"), "-x", "assembler", "-target", "amdgcn-amd-amdhsa", f"-mcpu={target()}", "-c", str(work / "k.s"), "-o", str(work / "k.o")], check=True) + subprocess.run([tool("clang"), "-x", "assembler", "-target", "amdgcn-amd-amdhsa", f"-mcpu={target()}", *(["-mwavefrontsize64"] if wave64 else []), "-c", str(work / "k.s"), "-o", str(work / "k.o")], check=True) subprocess.run([tool("ld.lld"), "-shared", str(work / "k.o"), "-o", str(work / "k.co")], check=True) return work / "k.co" diff --git a/tools/hw-oracle/test_hw_oracle.py b/tools/hw-oracle/test_hw_oracle.py index a1fb89cfe..35a00598a 100644 --- a/tools/hw-oracle/test_hw_oracle.py +++ b/tools/hw-oracle/test_hw_oracle.py @@ -122,5 +122,23 @@ class FloatModeTests(unittest.TestCase): self.assertEqual(assemble.call_args.kwargs, MODES) +class AssemblyTests(unittest.TestCase): + def test_condition_operands_match_wave_size(self): + for name in ("clang", "ld.lld"): + try: + hw_oracle.tool(name) + except SystemExit as error: + self.skipTest(str(error)) + for wave64, vcc, sgpr in ((False, "vcc_lo", "s8"), (True, "vcc", "s[8:9]")): + body = (f" v_cmp_lt_f32 {vcc}, v4, v5\n" + f" v_cndmask_b32 v10, v6, v7, {vcc}\n" + f" v_cmp_lt_f32 {sgpr}, v4, v5\n" + f" v_cndmask_b32 v11, v6, v7, {sgpr}\n") + with self.subTest(wave64=wave64), tempfile.TemporaryDirectory() as tmp: + with patch.object(hw_oracle, "target", return_value="gfx1036"): + code = hw_oracle.assemble(body, Path(tmp), wave64, **MODES) + self.assertTrue(code.is_file()) + + if __name__ == "__main__": unittest.main()