Skip to content

Commit

Permalink
Remove unused variables in faiss/IndexScalarQuantizer.cpp
Browse files Browse the repository at this point in the history
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
  • Loading branch information
r-barnes authored and facebook-github-bot committed Jan 30, 2024
1 parent 420d25f commit 75ae0bf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions faiss/IndexScalarQuantizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ScalarQuantizer::SQuantizer> squant(sq.select_quantizer());

DirectMapAdd dm_add(direct_map, n, xids);

#pragma omp parallel reduction(+ : nadd)
#pragma omp parallel
{
std::vector<float> residual(d);
std::vector<uint8_t> one_code(code_size);
Expand All @@ -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);
Expand Down

0 comments on commit 75ae0bf

Please sign in to comment.