13 namespace faiss {
namespace gpu {
66 #define HLF_EPSILON 4.887581E-04
68 typedef struct __align__(2) {
72 half1 cpu_float2half_rn(
float f);
74 float cpu_half2float(half1 h);
76 static __inline__ __device__ __host__ half1 habs(half1 h)
82 static __inline__ __device__ __host__ half1 hneg(half1 h)
88 static __inline__ __device__ __host__
int ishnan(half1 h)
91 return (h.x & 0x7c00U) == 0x7c00U && (h.x & 0x03ffU) != 0;
94 static __inline__ __device__ __host__
int ishinf(half1 h)
97 return (h.x & 0x7c00U) == 0x7c00U && (h.x & 0x03ffU) == 0;
100 static __inline__ __device__ __host__
int ishequ(half1 x, half1 y)
102 return ishnan(x) == 0 && ishnan(y) == 0 && x.x == y.x;
105 static __inline__ __device__ __host__ half1 hzero()
112 static __inline__ __device__ __host__ half1 hone()