11 #include "Float16.cuh"
15 namespace faiss {
namespace gpu {
24 constexpr
float kFloatMax = std::numeric_limits<float>::max();
25 constexpr
float kFloatMin = std::numeric_limits<float>::lowest();
29 static __device__ __host__
inline float getMin() {
32 static __device__ __host__
inline float getMax() {
37 #ifdef FAISS_USE_FLOAT16
39 inline __device__ __host__ half kGetHalf(
unsigned short v) {
40 #if CUDA_VERSION >= 9000
53 static __device__ __host__
inline half getMin() {
54 return kGetHalf(0xfbffU);
56 static __device__ __host__
inline half getMax() {
57 return kGetHalf(0x7bffU);
61 #endif // FAISS_USE_FLOAT16
63 constexpr
int kIntMax = std::numeric_limits<int>::max();
64 constexpr
int kIntMin = std::numeric_limits<int>::lowest();
68 static __device__ __host__
inline int getMin() {
71 static __device__ __host__
inline int getMax() {
76 template<
typename K,
typename V>
78 static __device__ __host__
inline Pair<K, V> getMin() {
82 static __device__ __host__
inline Pair<K, V> getMax() {
A simple pair type for CUDA device usage.