Skip to content

Commit fbb911b

Browse files
committed
fix has_avx512bf16
Signed-off-by: jiqing-feng <[email protected]>
1 parent 3b3d609 commit fbb911b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

bitsandbytes/functional.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,10 +2217,15 @@ def _convert_weight_packed_for_cpu_inverse(
22172217

22182218

22192219
def has_avx512bf16():
2220-
if hasattr(lib, "has_avx512bf16_cpu") and lib.has_avx512bf16_cpu():
2221-
return True
2222-
else:
2223-
return False
2220+
"""
2221+
Try calling native lib.has_avx512bf16_cpu().
2222+
Return False explicitly if symbol missing or call fails.
2223+
"""
2224+
try:
2225+
support_avx_bf16 = lib.has_avx512bf16_cpu()
2226+
except (AttributeError, RuntimeError, OSError):
2227+
support_avx_bf16 = False
2228+
return support_avx_bf16
22242229

22252230

22262231
C = 127.0

0 commit comments

Comments
 (0)