Skip to content

Commit 7cb4556

Browse files
lkuffofacebook-github-bot
authored andcommitted
Fix Sapphire Rapids never loading in Python bindings (facebookresearch#4209)
Summary: If both `avx512` and `avx512_spr` are compiled, Sapphire Rapids capabilities are never loaded when using the Python bindings, as the `avx512` import always overrides the `avx512_spr` one. This very small PR solves the issue. Pull Request resolved: facebookresearch#4209 Reviewed By: mengdilin Differential Revision: D70015045 Pulled By: gtwang01 fbshipit-source-id: d3553a6c9048a534c0901ee29e7e2354de96e79f
1 parent 20c7ca3 commit 7cb4556

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

faiss/python/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def is_sve_supported():
108108
loaded = False
109109

110110
has_AVX512 = any("AVX512" in x.upper() for x in instruction_sets)
111-
if has_AVX512:
111+
if has_AVX512 and not loaded:
112112
try:
113113
logger.info("Loading faiss with AVX512 support.")
114114
from .swigfaiss_avx512 import *

0 commit comments

Comments
 (0)