Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shadowed variable in faiss/impl/simd_result_handlers.h #3960

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions faiss/impl/simd_result_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ struct HeapHandler : ResultHandlerCompare<C, with_id_map> {
auto real_idx = this->adjust_id(b, j);
lt_mask -= 1 << j;
if (this->sel->is_member(real_idx)) {
T dis = d32tab[j];
if (C::cmp(heap_dis[0], dis)) {
T dis_2 = d32tab[j];
if (C::cmp(heap_dis[0], dis_2)) {
heap_replace_top<C>(
k, heap_dis, heap_ids, dis, real_idx);
k, heap_dis, heap_ids, dis_2, real_idx);
}
}
}
Expand All @@ -380,10 +380,10 @@ struct HeapHandler : ResultHandlerCompare<C, with_id_map> {
// find first non-zero
int j = __builtin_ctz(lt_mask);
lt_mask -= 1 << j;
T dis = d32tab[j];
if (C::cmp(heap_dis[0], dis)) {
T dis_2 = d32tab[j];
if (C::cmp(heap_dis[0], dis_2)) {
int64_t idx = this->adjust_id(b, j);
heap_replace_top<C>(k, heap_dis, heap_ids, dis, idx);
heap_replace_top<C>(k, heap_dis, heap_ids, dis_2, idx);
}
}
}
Expand Down Expand Up @@ -480,17 +480,17 @@ struct ReservoirHandler : ResultHandlerCompare<C, with_id_map> {
auto real_idx = this->adjust_id(b, j);
lt_mask -= 1 << j;
if (this->sel->is_member(real_idx)) {
T dis = d32tab[j];
res.add(dis, real_idx);
T dis_2 = d32tab[j];
res.add(dis_2, real_idx);
}
}
} else {
while (lt_mask) {
// find first non-zero
int j = __builtin_ctz(lt_mask);
lt_mask -= 1 << j;
T dis = d32tab[j];
res.add(dis, this->adjust_id(b, j));
T dis_2 = d32tab[j];
res.add(dis_2, this->adjust_id(b, j));
}
}
}
Expand Down Expand Up @@ -719,10 +719,10 @@ void dispatch_SIMDResultHandler_fixedCW(
Types... args) {
if (auto resh = dynamic_cast<SingleResultHandler<C, W>*>(&res)) {
consumer.template f<SingleResultHandler<C, W>>(*resh, args...);
} else if (auto resh = dynamic_cast<HeapHandler<C, W>*>(&res)) {
consumer.template f<HeapHandler<C, W>>(*resh, args...);
} else if (auto resh = dynamic_cast<ReservoirHandler<C, W>*>(&res)) {
consumer.template f<ReservoirHandler<C, W>>(*resh, args...);
} else if (auto resh_2 = dynamic_cast<HeapHandler<C, W>*>(&res)) {
consumer.template f<HeapHandler<C, W>>(*resh_2, args...);
} else if (auto resh_2 = dynamic_cast<ReservoirHandler<C, W>*>(&res)) {
consumer.template f<ReservoirHandler<C, W>>(*resh_2, args...);
} else { // generic handler -- will not be inlined
FAISS_THROW_IF_NOT_FMT(
simd_result_handlers_accept_virtual,
Expand Down Expand Up @@ -752,8 +752,8 @@ void dispatch_SIMDResultHandler(
if (res.sizeof_ids == 0) {
if (auto resh = dynamic_cast<StoreResultHandler*>(&res)) {
consumer.template f<StoreResultHandler>(*resh, args...);
} else if (auto resh = dynamic_cast<DummyResultHandler*>(&res)) {
consumer.template f<DummyResultHandler>(*resh, args...);
} else if (auto resh_2 = dynamic_cast<DummyResultHandler*>(&res)) {
consumer.template f<DummyResultHandler>(*resh_2, args...);
} else { // generic path
FAISS_THROW_IF_NOT_FMT(
simd_result_handlers_accept_virtual,
Expand Down
Loading