Skip to content

Commit 1f755ef

Browse files
Michael Norrismeta-codesync[bot]
authored andcommitted
Prune cuVS brute-force flat index on aarch64 (FAISS_CUVS_NO_FLAT) (#5431)
Summary: Pull Request resolved: #5431 Fix link error Reviewed By: weidbd2025 Differential Revision: D112244794 fbshipit-source-id: 19373ee4e81d6dfbadb4b9d1e52d750ceb63e157
1 parent a7d91d4 commit 1f755ef

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

faiss/gpu/GpuIndexFlat.cu

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <faiss/gpu/utils/Float16.cuh>
1919
#include <limits>
2020

21-
#if defined USE_NVIDIA_CUVS
21+
#if defined(USE_NVIDIA_CUVS) && !defined(FAISS_CUVS_NO_FLAT)
2222
#include <faiss/gpu/impl/CuvsFlatIndex.cuh>
2323
#endif
2424

@@ -93,7 +93,7 @@ GpuIndexFlat::GpuIndexFlat(
9393
GpuIndexFlat::~GpuIndexFlat() {}
9494

9595
void GpuIndexFlat::resetIndex_(int dims) {
96-
#if defined USE_NVIDIA_CUVS
96+
#if defined(USE_NVIDIA_CUVS) && !defined(FAISS_CUVS_NO_FLAT)
9797

9898
if (should_use_cuvs(config_)) {
9999
data_.reset(new CuvsFlatIndex(
@@ -102,12 +102,17 @@ void GpuIndexFlat::resetIndex_(int dims) {
102102
flatConfig_.useFloat16,
103103
config_.memorySpace));
104104
} else
105-
#else
105+
#elif !defined(USE_NVIDIA_CUVS)
106106
if (should_use_cuvs(config_)) {
107107
FAISS_THROW_MSG(
108108
"cuVS has not been compiled into the current version so it cannot be used.");
109109
} else
110110
#endif
111+
// When cuVS is compiled in but the cuVS flat backend is pruned
112+
// (FAISS_CUVS_NO_FLAT — e.g. the cuVS 26.02 IVF-PQ-only build on aarch64,
113+
// whose cuvs-ivfpq-2602 dep omits neighbors/brute_force), should_use_cuvs
114+
// may still be true; fall back to the classic GPU FlatIndex
115+
// (bfKnnOnDevice), which is functionally equivalent for brute-force search.
111116
{
112117
data_.reset(new FlatIndex(
113118
resources_.get(),

0 commit comments

Comments
 (0)