12 #include "Float16.cuh"
16 namespace faiss {
namespace gpu {
25 constexpr
float kFloatMax = std::numeric_limits<float>::max();
26 constexpr
float kFloatMin = std::numeric_limits<float>::lowest();
30 static __device__ __host__
inline float getMin() {
33 static __device__ __host__
inline float getMax() {
38 #ifdef FAISS_USE_FLOAT16
40 inline __device__ __host__ half kGetHalf(
unsigned short v) {
41 #if CUDA_VERSION >= 9000
54 static __device__ __host__
inline half getMin() {
55 return kGetHalf(0xfbffU);
57 static __device__ __host__
inline half getMax() {
58 return kGetHalf(0x7bffU);
62 #endif // FAISS_USE_FLOAT16
64 constexpr
int kIntMax = std::numeric_limits<int>::max();
65 constexpr
int kIntMin = std::numeric_limits<int>::lowest();
69 static __device__ __host__
inline int getMin() {
72 static __device__ __host__
inline int getMax() {
77 template<
typename K,
typename V>
79 static __device__ __host__
inline Pair<K, V> getMin() {
83 static __device__ __host__
inline Pair<K, V> getMax() {
A simple pair type for CUDA device usage.