Skip to content

Commit 030a6dd

Browse files
authored
Merge branch 'facebookresearch:main' into main
2 parents 15f1943 + ab2b7f5 commit 030a6dd

16 files changed

Lines changed: 380 additions & 226 deletions

benchs/bench_cppcontrib_sa_decode.cpp

Lines changed: 59 additions & 92 deletions
Large diffs are not rendered by default.

demos/demo_imi_pq.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ int main() {
7777
// the coarse quantizer should not be dealloced before the index
7878
// 4 = nb of bytes per code (d must be a multiple of this)
7979
// 8 = nb of bits per sub-code (almost always 8)
80-
faiss::MetricType metric = faiss::METRIC_L2; // can be METRIC_INNER_PRODUCT
8180
faiss::IndexIVFPQ index(
8281
&coarse_quantizer, d, ncentroids, bytes_per_code, 8);
8382
index.quantizer_trains_alone = true;

faiss/IVFlib.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,10 @@ void search_with_parameters(
352352
const IndexIVF* index_ivf = dynamic_cast<const IndexIVF*>(index);
353353
FAISS_THROW_IF_NOT(index_ivf);
354354

355-
index_ivf->quantizer->search(n, x, params->nprobe, Dq.data(), Iq.data());
355+
SearchParameters* quantizer_params =
356+
(params) ? params->quantizer_params : nullptr;
357+
index_ivf->quantizer->search(
358+
n, x, params->nprobe, Dq.data(), Iq.data(), quantizer_params);
356359

357360
if (nb_dis_ptr) {
358361
*nb_dis_ptr = count_ndis(index_ivf, n * params->nprobe, Iq.data());

faiss/IndexBinaryIVF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ void search_knn_hamming_heap(
456456
}
457457

458458
} // parallel for
459-
} // parallel
459+
} // parallel
460460

461461
indexIVF_stats.nq += n;
462462
indexIVF_stats.nlist += nlistv;

faiss/IndexFastScan.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ void estimators_from_tables_generic(
189189
dt += index.ksub;
190190
}
191191
}
192+
192193
if (C::cmp(heap_dis[0], dis)) {
193194
heap_pop<C>(k, heap_dis, heap_ids);
194195
heap_push<C>(k, heap_dis, heap_ids, dis, j);
@@ -203,17 +204,18 @@ ResultHandlerCompare<C, false>* make_knn_handler(
203204
idx_t k,
204205
size_t ntotal,
205206
float* distances,
206-
idx_t* labels) {
207+
idx_t* labels,
208+
const IDSelector* sel = nullptr) {
207209
using HeapHC = HeapHandler<C, false>;
208210
using ReservoirHC = ReservoirHandler<C, false>;
209211
using SingleResultHC = SingleResultHandler<C, false>;
210212

211213
if (k == 1) {
212-
return new SingleResultHC(n, ntotal, distances, labels);
214+
return new SingleResultHC(n, ntotal, distances, labels, sel);
213215
} else if (impl % 2 == 0) {
214-
return new HeapHC(n, ntotal, k, distances, labels);
216+
return new HeapHC(n, ntotal, k, distances, labels, sel);
215217
} else /* if (impl % 2 == 1) */ {
216-
return new ReservoirHC(n, ntotal, k, 2 * k, distances, labels);
218+
return new ReservoirHC(n, ntotal, k, 2 * k, distances, labels, sel);
217219
}
218220
}
219221

faiss/IndexIVF.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void IndexIVF::search_preassigned(
444444
max_codes = unlimited_list_size;
445445
}
446446

447-
bool do_parallel = omp_get_max_threads() >= 2 &&
447+
[[maybe_unused]] bool do_parallel = omp_get_max_threads() >= 2 &&
448448
(pmode == 0 ? false
449449
: pmode == 3 ? n > 1
450450
: pmode == 1 ? nprobe > 1
@@ -784,7 +784,7 @@ void IndexIVF::range_search_preassigned(
784784

785785
int pmode = this->parallel_mode & ~PARALLEL_MODE_NO_HEAP_INIT;
786786
// don't start parallel section if single query
787-
bool do_parallel = omp_get_max_threads() >= 2 &&
787+
[[maybe_unused]] bool do_parallel = omp_get_max_threads() >= 2 &&
788788
(pmode == 3 ? false
789789
: pmode == 0 ? nx > 1
790790
: pmode == 1 ? nprobe > 1

0 commit comments

Comments
 (0)