From 205427762e97e7993fd9acf818f58eed9676c25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Theodor=20Wu=CC=88bker?= Date: Thu, 25 Sep 2025 09:44:57 +0200 Subject: [PATCH] Distance computation: Fix SSE instructions Currently, invalid SSE instructions like _mm128_loadu_ps are used. This causes DiskANN compilation to fail on machines that only support SSE and not AVX. Instead, it should be _mm_loadu_ps. Change the instructions to the correct ones. --- src/distance.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/distance.cpp b/src/distance.cpp index c2f88c85b..d7d7a2852 100644 --- a/src/distance.cpp +++ b/src/distance.cpp @@ -346,10 +346,10 @@ template float DistanceInnerProduct::inner_product(const T *a, c #else #ifdef __SSE2__ #define SSE_DOT(addr1, addr2, dest, tmp1, tmp2) \ - tmp1 = _mm128_loadu_ps(addr1); \ - tmp2 = _mm128_loadu_ps(addr2); \ - tmp1 = _mm128_mul_ps(tmp1, tmp2); \ - dest = _mm128_add_ps(dest, tmp1); + tmp1 = _mm_loadu_ps(addr1); \ + tmp2 = _mm_loadu_ps(addr2); \ + tmp1 = _mm_mul_ps(tmp1, tmp2); \ + dest = _mm_add_ps(dest, tmp1); __m128 sum; __m128 l0, l1, l2, l3; __m128 r0, r1, r2, r3; @@ -458,9 +458,9 @@ template float DistanceFastL2::norm(const T *a, uint32_t size) c #else #ifdef __SSE2__ #define SSE_L2NORM(addr, dest, tmp) \ - tmp = _mm128_loadu_ps(addr); \ - tmp = _mm128_mul_ps(tmp, tmp); \ - dest = _mm128_add_ps(dest, tmp); + tmp = _mm_loadu_ps(addr); \ + tmp = _mm_mul_ps(tmp, tmp); \ + dest = _mm_add_ps(dest, tmp); __m128 sum; __m128 l0, l1, l2, l3;