diff --git a/thirdparty/faiss/faiss/utils/BinaryDistance.cpp b/thirdparty/faiss/faiss/utils/BinaryDistance.cpp index 3a5ab1a20..8da813323 100644 --- a/thirdparty/faiss/faiss/utils/BinaryDistance.cpp +++ b/thirdparty/faiss/faiss/utils/BinaryDistance.cpp @@ -421,10 +421,13 @@ void binary_distance_knn_hc ( size_t dim = ncodes * 8; switch (metric_type) { case METRIC_Jaccard: { +#ifdef __linux__ if (cpu_support_avx2() && ncodes > 64) { binary_distance_knn_hc (ncodes, ha, a, b, nb, bitset); - } else { + } else +#endif + { switch (ncodes) { #define binary_distance_knn_hc_jaccard(ncodes) \ case ncodes: \ @@ -449,10 +452,13 @@ void binary_distance_knn_hc ( } case METRIC_Hamming: { +#ifdef __linux__ if (cpu_support_avx2() && ncodes > 64) { binary_distance_knn_hc (ncodes, ha, a, b, nb, bitset); - } else { + } else +#endif + { switch (ncodes) { #define binary_distance_knn_hc_hamming(ncodes) \ case ncodes: \ @@ -553,10 +559,13 @@ void binary_range_search( case METRIC_Tanimoto: radius = Tanimoto_2_Jaccard(radius); case METRIC_Jaccard: { +#ifdef __linux__ if (cpu_support_avx2() && ncodes > 64) { binary_range_search (a, b, na, nb, ncodes, radius, result, buffer_size, bitset); - } else { + } else +#endif + { switch (ncodes) { #define binary_range_search_jaccard(ncodes) \ case ncodes: \ @@ -591,10 +600,13 @@ void binary_range_search( } case METRIC_Hamming: { +#ifdef __linux__ if (cpu_support_avx2() && ncodes > 64) { binary_range_search (a, b, na, nb, ncodes, radius, result, buffer_size, bitset); - } else { + } else +#endif + { switch (ncodes) { #define binary_range_search_hamming(ncodes) \ case ncodes: \