Skip to content

Commit b5c2eba

Browse files
committed
Fix prefetch overflow in other places.
1 parent 6e946ed commit b5c2eba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

hnswlib/hnswalg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ class HierarchicalNSW : public AlgorithmInterface<dist_t> {
343343
int candidate_id = *(data + j);
344344
// if (candidate_id == 0) continue;
345345
#ifdef USE_SSE
346-
_mm_prefetch((char *) (visited_array + *(data + j + 1)), _MM_HINT_T0);
347-
_mm_prefetch(data_level0_memory_ + (*(data + j + 1)) * size_data_per_element_ + offsetData_,
346+
_mm_prefetch((char *) (visited_array + *(data + j)), _MM_HINT_T0);
347+
_mm_prefetch(data_level0_memory_ + (*(data + j)) * size_data_per_element_ + offsetData_,
348348
_MM_HINT_T0); ////////////
349349
#endif
350350
if (!(visited_array[candidate_id] == visited_array_tag)) {
@@ -1007,7 +1007,7 @@ class HierarchicalNSW : public AlgorithmInterface<dist_t> {
10071007
#endif
10081008
for (int i = 0; i < size; i++) {
10091009
#ifdef USE_SSE
1010-
_mm_prefetch(getDataByInternalId(*(datal + i + 1)), _MM_HINT_T0);
1010+
_mm_prefetch(getDataByInternalId(*(datal + i)), _MM_HINT_T0);
10111011
#endif
10121012
tableint cand = datal[i];
10131013
dist_t d = fstdistfunc_(dataPoint, getDataByInternalId(cand), dist_func_param_);

0 commit comments

Comments
 (0)