From 6ace75e54dd9b778083dd1354539541e4c5b60c2 Mon Sep 17 00:00:00 2001 From: Xu Zhao Date: Mon, 27 Apr 2026 13:56:54 -0700 Subject: [PATCH] Guard against attribute error Summary: Sometime third-party packages can be imported but there is no desired attribute, for example: ``` from .operator import Operator _ = tk.bf16_b200_gemm ^^^^^^^^^^^^^^^^^ AttributeError: module 'thunderkittens' has no attribute 'bf16_b200_gemm' ``` Handle attribute error in `try_import` ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: triton Differential Revision: D102627731 --- tritonbench/utils/python_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tritonbench/utils/python_utils.py b/tritonbench/utils/python_utils.py index f71d19121..2179486fe 100644 --- a/tritonbench/utils/python_utils.py +++ b/tritonbench/utils/python_utils.py @@ -9,5 +9,5 @@ def try_import(cond_name: str): try: yield _caller_globals[cond_name] = True - except (ImportError, ModuleNotFoundError, OSError) as e: + except (ImportError, ModuleNotFoundError, OSError, AttributeError) as e: _caller_globals[cond_name] = False