Skip to content

Commit

Permalink
Disable AVX2 binary distance calculation for mac (milvus-io#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
cydrain authored Apr 1, 2022
1 parent 8b7e43c commit b40dfb2
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions thirdparty/faiss/faiss/utils/BinaryDistance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<C, faiss::JaccardComputerAVX2>
(ncodes, ha, a, b, nb, bitset);
} else {
} else
#endif
{
switch (ncodes) {
#define binary_distance_knn_hc_jaccard(ncodes) \
case ncodes: \
Expand All @@ -449,10 +452,13 @@ void binary_distance_knn_hc (
}

case METRIC_Hamming: {
#ifdef __linux__
if (cpu_support_avx2() && ncodes > 64) {
binary_distance_knn_hc<C, faiss::HammingComputerAVX2>
(ncodes, ha, a, b, nb, bitset);
} else {
} else
#endif
{
switch (ncodes) {
#define binary_distance_knn_hc_hamming(ncodes) \
case ncodes: \
Expand Down Expand Up @@ -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<C, T, faiss::JaccardComputerAVX2>
(a, b, na, nb, ncodes, radius, result, buffer_size, bitset);
} else {
} else
#endif
{
switch (ncodes) {
#define binary_range_search_jaccard(ncodes) \
case ncodes: \
Expand Down Expand Up @@ -591,10 +600,13 @@ void binary_range_search(
}

case METRIC_Hamming: {
#ifdef __linux__
if (cpu_support_avx2() && ncodes > 64) {
binary_range_search<C, T, faiss::HammingComputerAVX2>
(a, b, na, nb, ncodes, radius, result, buffer_size, bitset);
} else {
} else
#endif
{
switch (ncodes) {
#define binary_range_search_hamming(ncodes) \
case ncodes: \
Expand Down

0 comments on commit b40dfb2

Please sign in to comment.