13 #include "Float16.cuh"
17 namespace faiss {
namespace gpu {
26 constexpr
float kFloatMax = std::numeric_limits<float>::max();
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) {
48 static __device__ __host__
inline half getMin() {
49 return kGetHalf(0xfbffU);
51 static __device__ __host__
inline half getMax() {
52 return kGetHalf(0x7bffU);
56 #endif // FAISS_USE_FLOAT16
58 constexpr
int kIntMin = std::numeric_limits<int>::min();
59 constexpr
int kIntMax = std::numeric_limits<int>::max();
63 static __device__ __host__
inline int getMin() {
66 static __device__ __host__
inline int getMax() {
71 template<
typename K,
typename V>
73 static __device__ __host__
inline Pair<K, V> getMin() {
77 static __device__ __host__
inline Pair<K, V> getMax() {
A simple pair type for CUDA device usage.