From cda72c1de68bb4b9f1e47ddbbd480184acef1527 Mon Sep 17 00:00:00 2001 From: nimlgen <138685161+nimlgen@users.noreply.github.com> Date: Sat, 3 May 2025 22:46:04 +0300 Subject: [PATCH] amd: print full trace when AMD_IFACE is set (#10149) --- tinygrad/runtime/ops_amd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tinygrad/runtime/ops_amd.py b/tinygrad/runtime/ops_amd.py index 185c13e004..9dafb84baa 100644 --- a/tinygrad/runtime/ops_amd.py +++ b/tinygrad/runtime/ops_amd.py @@ -844,8 +844,10 @@ class AMDDevice(HCQCompiled): def is_usb(self) -> bool: return isinstance(self.dev_iface, USBIface) def _select_iface(self): + if len(nm:=getenv("AMD_IFACE", "")) > 0: return getattr(sys.modules[__name__], f"{nm}Iface")(self, self.device_id) + errs:str = "" - for iface_t in (KFDIface, PCIIface, USBIface) if len(nm:=getenv("AMD_IFACE", "")) == 0 else (getattr(sys.modules[__name__], f"{nm}Iface"),): + for iface_t in (KFDIface, PCIIface, USBIface): try: return iface_t(self, self.device_id) except Exception as e: errs += f"\n{iface_t.__name__}: {type(e).__name__}: {e}" raise RuntimeError(f"Cannot find a usable interface for AMD:{self.device_id}:{errs}")