13 #include "Float16.cuh"
17 namespace faiss {
namespace gpu {
26 constexpr
float kFloatMax = std::numeric_limits<float>::max();
27 constexpr
float kFloatMin = std::numeric_limits<float>::lowest();
31 static __device__ __host__
inline float getMin() {
34 static __device__ __host__
inline float getMax() {
39 #ifdef FAISS_USE_FLOAT16
41 inline __device__ __host__ half kGetHalf(
unsigned short v) {
42 #if CUDA_VERSION >= 9000
55 static __device__ __host__
inline half getMin() {
56 return kGetHalf(0xfbffU);
58 static __device__ __host__
inline half getMax() {
59 return kGetHalf(0x7bffU);
63 #endif // FAISS_USE_FLOAT16
65 constexpr
int kIntMax = std::numeric_limits<int>::max();
66 constexpr
int kIntMin = std::numeric_limits<int>::lowest();
70 static __device__ __host__
inline int getMin() {
73 static __device__ __host__
inline int getMax() {
78 template<
typename K,
typename V>
80 static __device__ __host__
inline Pair<K, V> getMin() {
84 static __device__ __host__
inline Pair<K, V> getMax() {
A simple pair type for CUDA device usage.