mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
Fix guard clauses for SSE3. (#1325)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1325 Reviewed By: mdouze Differential Revision: D23104964 Pulled By: beauby fbshipit-source-id: 04705f1695e65682748b6308fd5d3e217a4af75a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
13a2d4ef8f
commit
569c855ed0
@@ -14,7 +14,7 @@
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __SSE__
|
||||
#ifdef __SSE3__
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
|
||||
@@ -270,7 +270,7 @@ struct DistanceXPQ4 : Distance2Level {
|
||||
}
|
||||
|
||||
float operator () (idx_t i) override {
|
||||
#ifdef __SSE__
|
||||
#ifdef __SSE3__
|
||||
const uint8_t *code = storage.codes.data() + i * storage.code_size;
|
||||
long key = 0;
|
||||
memcpy (&key, code, storage.code_size_1);
|
||||
@@ -323,7 +323,7 @@ struct Distance2xXPQ4 : Distance2Level {
|
||||
long key01 = 0;
|
||||
memcpy (&key01, code, storage.code_size_1);
|
||||
code += storage.code_size_1;
|
||||
#ifdef __SSE__
|
||||
#ifdef __SSE3__
|
||||
|
||||
// walking pointers
|
||||
const float *qa = q;
|
||||
@@ -361,7 +361,7 @@ struct Distance2xXPQ4 : Distance2Level {
|
||||
|
||||
|
||||
DistanceComputer * Index2Layer::get_distance_computer() const {
|
||||
#ifdef __SSE__
|
||||
#ifdef __SSE3__
|
||||
const MultiIndexQuantizer *mi =
|
||||
dynamic_cast<MultiIndexQuantizer*> (q1.quantizer);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
|
||||
#ifdef __SSE__
|
||||
#ifdef __SSE3__
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
|
||||
@@ -133,7 +133,7 @@ void fvec_L2sqr_ny_ref (float * dis,
|
||||
* SSE and AVX implementations
|
||||
*/
|
||||
|
||||
#ifdef __SSE__
|
||||
#ifdef __SSE3__
|
||||
|
||||
// reads 0 <= d < 4 floats as __m128
|
||||
static inline __m128 masked_read (int d, const float *x)
|
||||
@@ -477,7 +477,7 @@ float fvec_Linf (const float * x, const float * y, size_t d)
|
||||
return _mm_cvtss_f32 (msum2);
|
||||
}
|
||||
|
||||
#elif defined(__SSE__) // But not AVX
|
||||
#elif defined(__SSE3__) // But not AVX
|
||||
|
||||
float fvec_L1 (const float * x, const float * y, size_t d)
|
||||
{
|
||||
@@ -677,7 +677,7 @@ static inline void fvec_madd_ref (size_t n, const float *a,
|
||||
c[i] = a[i] + bf * b[i];
|
||||
}
|
||||
|
||||
#ifdef __SSE__
|
||||
#ifdef __SSE3__
|
||||
|
||||
static inline void fvec_madd_sse (size_t n, const float *a,
|
||||
float bf, const float *b, float *c) {
|
||||
@@ -730,7 +730,7 @@ static inline int fvec_madd_and_argmin_ref (size_t n, const float *a,
|
||||
return imin;
|
||||
}
|
||||
|
||||
#ifdef __SSE__
|
||||
#ifdef __SSE3__
|
||||
|
||||
static inline int fvec_madd_and_argmin_sse (
|
||||
size_t n, const float *a,
|
||||
|
||||
Reference in New Issue
Block a user