From 1667669c46db10616635dc802616afb9aba65582 Mon Sep 17 00:00:00 2001 From: Filip Brzek Date: Sun, 8 Feb 2026 18:22:35 +0100 Subject: [PATCH] fix: python3 -m tinygrad.device reporting on AMD/CPU (#14622) * test: device module expects PASS in -m tinygrad.device for CPU * fix: use device._compiler_name instead of unwrap_class_type(compiler).__name__ in enumerate_devices_str --- test/null/test_device.py | 4 ++-- tinygrad/device.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/null/test_device.py b/test/null/test_device.py index ffba17fbca..2640f7f0e1 100644 --- a/test/null/test_device.py +++ b/test/null/test_device.py @@ -102,8 +102,8 @@ class TestCompiler(unittest.TestCase): class TestRunAsModule(unittest.TestCase): def test_module_runs(self): - out = '\n'.join(enumerate_devices_str()) - self.assertIn("CPU", out) # for sanity check + cpu_line = [l for l in enumerate_devices_str() if "CPU" in l][0] + self.assertIn("PASS", cpu_line, f"expected CPU to PASS, got: {cpu_line}") if __name__ == "__main__": unittest.main() diff --git a/tinygrad/device.py b/tinygrad/device.py index dc39aa2e12..fd34e25caa 100644 --- a/tinygrad/device.py +++ b/tinygrad/device.py @@ -406,9 +406,9 @@ def enumerate_devices_str() -> Generator[str, None, None]: if test != [2,4,6]: raise ValueError(f"got {test} instead of [2, 4, 6]") set_text = f'({cc_ctrl_var.key}={d._compiler_name(r, c)} to make default)' if cc_ctrl_var is not None else '' default_text = '(default)' if type(default_compiler) is type(d.compiler) else set_text - compilers_results.append(f"{colored('+', 'green')} {unwrap_class_type(c).__name__} {default_text}") + compilers_results.append(f"{colored('+', 'green')} {d._compiler_name(r, c)} {default_text}") any_works = True - except Exception as e: compilers_results.append(f"{colored('-', 'yellow')} {unwrap_class_type(c).__name__}: {e}") + except Exception as e: compilers_results.append(f"{colored('-', 'yellow')} {d._compiler_name(r, c)}: {e}") finally: # put the defaults back! d.comp_sets, d.comps_ctrl_var = default_comp_pairs, cc_ctrl_var