15.5. __nv_bfloat16
-
struct __nv_bfloat16
-
nv_bfloat16 数据类型
该结构实现了用于存储nv_bfloat16浮点数的数据类型。该结构实现了赋值运算符和类型转换。总共使用16位:1位符号位,8位指数位,7位存储尾数。总精度为8位。
公共函数
-
__nv_bfloat16() = default
-
默认构造函数。
空的默认构造函数,结果未初始化。
-
__host__ __device__ inline explicit __nv_bfloat16(const __half f)
-
使用默认的舍入到最近偶数模式,从
__half输入构造__nv_bfloat16。
-
__host__ __device__ inline constexpr __nv_bfloat16(const __nv_bfloat16_raw &hr)
-
__host__ __device__ inline __nv_bfloat16(const double f)
-
使用默认的舍入到最近偶数模式,从
double输入构造__nv_bfloat16。
-
__host__ __device__ inline __nv_bfloat16(const float f)
-
使用默认的舍入到最近偶数模式从
float输入构造__nv_bfloat16。
-
__host__ __device__ inline __nv_bfloat16(const long val)
-
使用默认的舍入到最近偶数模式从
long输入构造__nv_bfloat16。
-
__host__ __device__ inline __nv_bfloat16(const unsigned long val)
-
使用默认的舍入到最近偶数模式,从
unsignedlong输入构造__nv_bfloat16。
-
__host__ __device__ inline __nv_bfloat16(int val)
-
使用默认的舍入到最近偶数模式,从
int输入构造__nv_bfloat16。
-
__host__ __device__ inline __nv_bfloat16(long long val)
-
使用默认的舍入到最近偶数模式,从
longlong输入构造__nv_bfloat16。
-
__host__ __device__ inline __nv_bfloat16(short val)
-
使用默认的舍入到最近偶数模式,从
short整型输入构造__nv_bfloat16。
-
__host__ __device__ inline __nv_bfloat16(unsigned int val)
-
使用默认的舍入到最近偶数模式,从
unsignedint输入构造__nv_bfloat16。
-
__host__ __device__ inline __nv_bfloat16(unsigned long long val)
-
使用默认的舍入到最近偶数模式,从
unsignedlonglong输入构造__nv_bfloat16。
-
__host__ __device__ inline __nv_bfloat16(unsigned short val)
-
使用默认的舍入到最近偶数模式,从
unsignedshort整型输入构造__nv_bfloat16。
-
__host__ __device__ operator __nv_bfloat16_raw() const
-
类型转换为
__nv_bfloat16_raw运算符。
-
__host__ __device__ operator __nv_bfloat16_raw() volatile const
-
将类型转换为
__nv_bfloat16_raw运算符,输入为volatile。
-
__host__ __device__ inline constexpr operator bool() const
-
转换为
bool数据类型的转换运算符。输入+0和-0转换为
false。非零输入转换为true。
-
__host__ __device__ operator char() const
-
转换为实现定义的
char数据类型的转换运算符。使用向零舍入模式。
检测
char类型的有符号性并相应处理,更多细节请参阅有符号和无符号char运算符。
-
__host__ __device__ operator float() const
-
类型转换为
float操作符。
-
__host__ __device__ operator int() const
-
转换为
int数据类型的转换运算符。使用向零舍入模式。
-
__host__ __device__ operator long() const
-
转换为
long数据类型的转换运算符。使用向零取整的舍入模式。
-
__host__ __device__ operator long long() const
-
转换为
longlong数据类型的转换运算符。使用向零舍入模式。
-
__host__ __device__ operator short() const
-
转换为
short数据类型的转换运算符。使用向零舍入模式。
-
__host__ __device__ operator signed char() const
-
转换为
signedchar数据类型的转换运算符。使用向零舍入模式。
-
__host__ __device__ operator unsigned char() const
-
转换为
unsignedchar数据类型的转换运算符。使用向零舍入模式。
-
__host__ __device__ operator unsigned int() const
-
转换为
unsignedint数据类型的转换运算符。使用向零舍入模式。
-
__host__ __device__ operator unsigned long() const
-
转换为
unsignedlong数据类型的转换运算符。使用向零取整的舍入模式。
-
__host__ __device__ operator unsigned long long() const
-
转换为
unsignedlonglong数据类型的转换运算符。使用向零舍入模式。
-
__host__ __device__ operator unsigned short() const
-
转换为
unsignedshort数据类型的转换运算符。使用向零舍入模式。
-
__host__ __device__ __nv_bfloat16 &operator=(const __nv_bfloat16_raw &hr)
-
来自
__nv_bfloat16_raw的赋值运算符。
-
__host__ __device__ volatile __nv_bfloat16 &operator=(const __nv_bfloat16_raw &hr) volatile
-
从
__nv_bfloat16_raw到volatile__nv_bfloat16的赋值运算符。
-
__host__ __device__ __nv_bfloat16 &operator=(const double f)
-
使用默认的舍入到最近偶数模式,将
__nv_bfloat16类型转换为从double输入的赋值运算符。
-
__host__ __device__ __nv_bfloat16 &operator=(const float f)
-
使用默认的舍入到最近偶数模式,将
__nv_bfloat16类型转换为从float输入的赋值运算符。
-
__host__ __device__ volatile __nv_bfloat16 &operator=(volatile const __nv_bfloat16_raw &hr) volatile
-
从
volatile__nv_bfloat16_raw到volatile__nv_bfloat16的赋值运算符。
-
__host__ __device__ __nv_bfloat16 &operator=(int val)
-
从
int类型转换的赋值运算符,使用默认的向最近偶数舍入模式。
-
__host__ __device__ __nv_bfloat16 &operator=(long long val)
-
从
longlong赋值运算符进行类型转换,使用默认的向最近偶数舍入模式。
-
__host__ __device__ __nv_bfloat16 &operator=(short val)
-
从
short类型转换的赋值运算符,使用默认的向最近偶数舍入模式。
-
__host__ __device__ __nv_bfloat16 &operator=(unsigned int val)
-
从
unsignedint赋值操作符进行类型转换,使用默认的向最近偶数舍入模式。
-
__host__ __device__ __nv_bfloat16 &operator=(unsigned long long val)
-
从
unsignedlonglong类型转换的赋值运算符,使用默认的向最近偶数舍入模式。
-
__host__ __device__ __nv_bfloat16 &operator=(unsigned short val)
-
从
unsignedshort类型转换的赋值运算符,使用默认的向最近偶数舍入模式。
-
__nv_bfloat16() = default