mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
Remove unused variables in faiss/IndexIVF.cpp
Summary: LLVM-15 has a warning `-Wunused-but-set-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance. This diff either (a) removes an unused variable and, possibly, it's associated code, or (b) qualifies the variable with `[[maybe_unused]]`, mostly in cases where the variable _is_ used, but, eg, in an `assert` statement that isn't present in production code. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: dmm-fb Differential Revision: D56065763 fbshipit-source-id: b0541b8a759c4b6ca0e8753fc24b8c227047bd3d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
acd06d6211
commit
a35eb0ac11
@@ -77,7 +77,6 @@ int main() {
|
||||
// the coarse quantizer should not be dealloced before the index
|
||||
// 4 = nb of bytes per code (d must be a multiple of this)
|
||||
// 8 = nb of bits per sub-code (almost always 8)
|
||||
faiss::MetricType metric = faiss::METRIC_L2; // can be METRIC_INNER_PRODUCT
|
||||
faiss::IndexIVFPQ index(
|
||||
&coarse_quantizer, d, ncentroids, bytes_per_code, 8);
|
||||
index.quantizer_trains_alone = true;
|
||||
|
||||
+2
-2
@@ -444,7 +444,7 @@ void IndexIVF::search_preassigned(
|
||||
max_codes = unlimited_list_size;
|
||||
}
|
||||
|
||||
bool do_parallel = omp_get_max_threads() >= 2 &&
|
||||
[[maybe_unused]] bool do_parallel = omp_get_max_threads() >= 2 &&
|
||||
(pmode == 0 ? false
|
||||
: pmode == 3 ? n > 1
|
||||
: pmode == 1 ? nprobe > 1
|
||||
@@ -784,7 +784,7 @@ void IndexIVF::range_search_preassigned(
|
||||
|
||||
int pmode = this->parallel_mode & ~PARALLEL_MODE_NO_HEAP_INIT;
|
||||
// don't start parallel section if single query
|
||||
bool do_parallel = omp_get_max_threads() >= 2 &&
|
||||
[[maybe_unused]] bool do_parallel = omp_get_max_threads() >= 2 &&
|
||||
(pmode == 3 ? false
|
||||
: pmode == 0 ? nx > 1
|
||||
: pmode == 1 ? nprobe > 1
|
||||
|
||||
@@ -141,7 +141,7 @@ void exhaustive_inner_product_seq(
|
||||
const IDSelector* sel = nullptr) {
|
||||
using SingleResultHandler =
|
||||
typename BlockResultHandler::SingleResultHandler;
|
||||
int nt = std::min(int(nx), omp_get_max_threads());
|
||||
[[maybe_unused]] int nt = std::min(int(nx), omp_get_max_threads());
|
||||
|
||||
FAISS_ASSERT(use_sel == (sel != nullptr));
|
||||
|
||||
@@ -178,7 +178,7 @@ void exhaustive_L2sqr_seq(
|
||||
const IDSelector* sel = nullptr) {
|
||||
using SingleResultHandler =
|
||||
typename BlockResultHandler::SingleResultHandler;
|
||||
int nt = std::min(int(nx), omp_get_max_threads());
|
||||
[[maybe_unused]] int nt = std::min(int(nx), omp_get_max_threads());
|
||||
|
||||
FAISS_ASSERT(use_sel == (sel != nullptr));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user