未验证 提交 810d9f54 编写于 作者: X XuanYang-cn 提交者: GitHub

fix pq distance calculation outofrange according to faiss suggests (#3925)

Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>
Co-authored-by: Nyangxuan <xuan.yang@zilliz.com>
上级 cff80c9e
......@@ -52,6 +52,15 @@ pqCodeDistances(Tensor<float, 2, true> queries,
auto subQuantizer = blockIdx.y;
// Each thread will load the pq centroid data for the code that it
// is processing
if(!loadingThreads) {
#pragma unroll
for (int i = 0; i < DimsPerSubQuantizer; ++i) {
subQuantizerData[i] = pqCentroids[subQuantizer][i][code].ldg();
}
}
// Where we store our query vector
float* smemQuery = smem;
......@@ -147,12 +156,6 @@ pqCodeDistances(Tensor<float, 2, true> queries,
}
} else {
// Each thread will load the pq centroid data for the code that it
// is processing
#pragma unroll
for (int i = 0; i < DimsPerSubQuantizer; ++i) {
subQuantizerData[i] = pqCentroids[subQuantizer][i][code].ldg();
}
// These are the processing threads
float dist = 0.0f;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册