Skip to content

PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度

Enhance b70 check (#1937)

Yi Liue8709167f44b
diff --git a/auto_round_extension/ark/auto_round_kernel/utils.py b/auto_round_extension/ark/auto_round_kernel/utils.py
index d1a2294f8..35b8791a1 100644
--- a/auto_round_extension/ark/auto_round_kernel/utils.py
+++ b/auto_round_extension/ark/auto_round_kernel/utils.py
@@ -21,8 +21,6 @@ import torch
logger = logging.getLogger(__name__)
-B70_DEVICE_ID = "0xe223"
-
@lru_cache(maxsize=None)
def is_oneapi_ge_2026() -> bool:
@@ -39,14 +37,18 @@ def is_oneapi_ge_2026() -> bool:
return bool(match and int(match.group(1)) >= 2026)
+B70_DEVICE_ID = "0xe223"
+B70_IDENTIFIERS = (B70_DEVICE_ID, "b70")
+
+
@lru_cache(maxsize=None)
def is_b70(device: int = 0) -> bool:
try:
- name = torch.xpu.get_device_properties(device).name
+ pro = torch.xpu.get_device_properties(device)
except Exception:
return False
- return B70_DEVICE_ID in name.lower()
+ return any(identifier in pro.name.lower() for identifier in B70_IDENTIFIERS) or hex(pro.device_id) == B70_DEVICE_ID
@lru_cache(maxsize=None)