12 namespace faiss {
namespace gpu {
65 #define HLF_EPSILON 4.887581E-04
67 typedef struct __align__(2) {
71 half1 cpu_float2half_rn(
float f);
73 float cpu_half2float(half1 h);
75 static __inline__ __device__ __host__ half1 habs(half1 h)
81 static __inline__ __device__ __host__ half1 hneg(half1 h)
87 static __inline__ __device__ __host__
int ishnan(half1 h)
90 return (h.x & 0x7c00U) == 0x7c00U && (h.x & 0x03ffU) != 0;
93 static __inline__ __device__ __host__
int ishinf(half1 h)
96 return (h.x & 0x7c00U) == 0x7c00U && (h.x & 0x03ffU) == 0;
99 static __inline__ __device__ __host__
int ishequ(half1 x, half1 y)
101 return ishnan(x) == 0 && ishnan(y) == 0 && x.x == y.x;
104 static __inline__ __device__ __host__ half1 hzero()
111 static __inline__ __device__ __host__ half1 hone()