14 namespace faiss {
namespace gpu {
67 #define HLF_EPSILON 4.887581E-04
69 typedef struct __align__(2) {
73 half1 cpu_float2half_rn(
float f);
75 float cpu_half2float(half1 h);
77 static __inline__ __device__ __host__ half1 habs(half1 h)
83 static __inline__ __device__ __host__ half1 hneg(half1 h)
89 static __inline__ __device__ __host__
int ishnan(half1 h)
92 return (h.x & 0x7c00U) == 0x7c00U && (h.x & 0x03ffU) != 0;
95 static __inline__ __device__ __host__
int ishinf(half1 h)
98 return (h.x & 0x7c00U) == 0x7c00U && (h.x & 0x03ffU) == 0;
101 static __inline__ __device__ __host__
int ishequ(half1 x, half1 y)
103 return ishnan(x) == 0 && ishnan(y) == 0 && x.x == y.x;
106 static __inline__ __device__ __host__ half1 hzero()
113 static __inline__ __device__ __host__ half1 hone()