From 317bd0055b0ea57c7762c25e62497116a21dd330 Mon Sep 17 00:00:00 2001 From: Alexandr Guzhva Date: Tue, 17 Sep 2024 11:46:24 -0700 Subject: [PATCH] FIx a bug for a non-simdlib code of ResidualQuantizer (#3868) Summary: This causes an access violation error. The reason why this was not caught in unit tests for AVX/NEON is that this code branch is unlikely to be used. The reason why this was not caught in unit tests for a plain non-SIMD binary is unclear. More ResidualQuantizer patches to follow. Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3868 Reviewed By: mengdilin Differential Revision: D62882531 Pulled By: mnorris11 fbshipit-source-id: fc50c7409d6064605f783c342b0d313145ffe948 --- faiss/impl/residual_quantizer_encode_steps.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/faiss/impl/residual_quantizer_encode_steps.cpp b/faiss/impl/residual_quantizer_encode_steps.cpp index 802262969a..c52988ab24 100644 --- a/faiss/impl/residual_quantizer_encode_steps.cpp +++ b/faiss/impl/residual_quantizer_encode_steps.cpp @@ -95,7 +95,7 @@ void accum_and_store_tab( for (size_t ij = 1; ij < M; ij++) { reg += cbs[ij][kk]; } - output[b * K + kk] = reg; + output[kk] = reg; } } @@ -152,7 +152,7 @@ void accum_and_add_tab( for (size_t ij = 1; ij < M; ij++) { reg += cbs[ij][kk]; } - output[b * K + kk] += reg; + output[kk] += reg; } }