Skip to content

Commit

Permalink
Nit: fix variable types (#231)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandr Guzhva <[email protected]>
  • Loading branch information
alexanderguzhva authored Nov 29, 2023
1 parent 0c7cef9 commit 58c215d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion thirdparty/faiss/faiss/impl/pq4_fast_scan_search_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void accumulate_fixed_blocks(
ResultHandler& res,
const Scaler& scaler) {
constexpr int bbs = 32 * BB;
for (int64_t j0 = 0; j0 < nb; j0 += bbs) {
for (size_t j0 = 0; j0 < nb; j0 += bbs) {
FixedStorageHandler<NQ, 2 * BB> res2;
kernel_accumulate_block<NQ, BB>(nsq, codes, LUT, res2, scaler);
res.set_block_origin(0, j0);
Expand Down
8 changes: 4 additions & 4 deletions thirdparty/faiss/faiss/impl/pq4_fast_scan_search_qbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ void accumulate_q_4step(
constexpr int Q4 = (QBS >> 12) & 15;
constexpr int SQ = Q1 + Q2 + Q3 + Q4;

for (int64_t j0 = 0; j0 < ntotal2; j0 += 32, codes += 32 * nsq / 2) {
for (size_t j0 = 0; j0 < ntotal2; j0 += 32, codes += 32 * nsq / 2) {
res.set_block_origin(0, j0);

// skip computing distances if all vectors inside a block are filtered out
if (res.sel != nullptr) { // we have filter here
bool skip_flag = true;
for (int64_t jj = 0; jj < std::min<int64_t>(32, ntotal2 - j0);
for (size_t jj = 0; jj < std::min<size_t>(32, ntotal2 - j0);
jj++) {
auto real_idx = res.adjust_id(0, jj);
if (res.sel->is_member(real_idx)) { // id is not filtered out, can not skip computing
Expand Down Expand Up @@ -173,7 +173,7 @@ void kernel_accumulate_block_loop(
const uint8_t* LUT,
ResultHandler& res,
const Scaler& scaler) {
for (int64_t j0 = 0; j0 < ntotal2; j0 += 32) {
for (size_t j0 = 0; j0 < ntotal2; j0 += 32) {
res.set_block_origin(0, j0);
kernel_accumulate_block<NQ, ResultHandler>(
nsq, codes + j0 * nsq / 2, LUT, res, scaler);
Expand Down Expand Up @@ -260,7 +260,7 @@ void pq4_accumulate_loop_qbs(

// default implementation where qbs is not known at compile time

for (int64_t j0 = 0; j0 < ntotal2; j0 += 32) {
for (size_t j0 = 0; j0 < ntotal2; j0 += 32) {
const uint8_t* LUT = LUT0;
int qi = qbs;
int i0 = 0;
Expand Down
4 changes: 2 additions & 2 deletions thirdparty/faiss/faiss/utils/partitioning_avx2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void count_lt_and_eq(
n_lt += 16 - i_ge;
}

for (size_t i = n1 * 16; i < n; i++) {
for (size_t i = n1 * 16; i < (size_t)n; i++) {
uint16_t v = *vals++;
if (C::cmp(thresh, v)) {
n_lt++;
Expand Down Expand Up @@ -162,7 +162,7 @@ int simd_compress_array(
}

// end with scalar
for (int i = (n & ~15); i < n; i++) {
for (size_t i = (n & ~15); i < n; i++) {
if (C::cmp(thresh, vals[i])) {
vals[wp] = vals[i];
ids[wp] = ids[i];
Expand Down

0 comments on commit 58c215d

Please sign in to comment.