From 75ae0bfb7fd50f321c5e5c361a177b1f7fdb835d Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Tue, 30 Jan 2024 09:48:48 -0800 Subject: [PATCH] Remove unused variables in faiss/IndexScalarQuantizer.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: algoriddle Differential Revision: D52981077 fbshipit-source-id: ad164f9fbe267c6f594f9298132578f0a3805a2c --- faiss/IndexScalarQuantizer.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/faiss/IndexScalarQuantizer.cpp b/faiss/IndexScalarQuantizer.cpp index 6b2331573..b7199df39 100644 --- a/faiss/IndexScalarQuantizer.cpp +++ b/faiss/IndexScalarQuantizer.cpp @@ -210,12 +210,11 @@ void IndexIVFScalarQuantizer::add_core( const idx_t* coarse_idx) { FAISS_THROW_IF_NOT(is_trained); - size_t nadd = 0; std::unique_ptr squant(sq.select_quantizer()); DirectMapAdd dm_add(direct_map, n, xids); -#pragma omp parallel reduction(+ : nadd) +#pragma omp parallel { std::vector residual(d); std::vector one_code(code_size); @@ -240,7 +239,6 @@ void IndexIVFScalarQuantizer::add_core( size_t ofs = invlists->add_entry(list_no, id, one_code.data()); dm_add.add(i, list_no, ofs); - nadd++; } else if (rank == 0 && list_no == -1) { dm_add.add(i, -1, 0);