14 #include "Float16.cuh"
18 namespace faiss {
namespace gpu {
27 constexpr
float kFloatMax = std::numeric_limits<float>::max();
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) {
49 static __device__ __host__
inline half getMin() {
50 return kGetHalf(0xfbffU);
52 static __device__ __host__
inline half getMax() {
53 return kGetHalf(0x7bffU);
57 #endif // FAISS_USE_FLOAT16
59 constexpr
int kIntMin = std::numeric_limits<int>::min();
60 constexpr
int kIntMax = std::numeric_limits<int>::max();
64 static __device__ __host__
inline int getMin() {
67 static __device__ __host__
inline int getMax() {
72 template<
typename K,
typename V>
74 static __device__ __host__
inline Pair<K, V> getMin() {
78 static __device__ __host__
inline Pair<K, V> getMax() {
A simple pair type for CUDA device usage.