15.20. __nv_fp8_e8m0
-
struct __nv_fp8_e8m0
-
__nv_fp8_e8m0 数据类型
此结构体实现了用于处理
e8m0
类型的 8 位比例因子的数据类型:解释为以偏差指数为底的 2 的幂。偏差等于 127,因此数字 0 到 254 表示 2^-127 到 2^127。数字0xFF
= 255 保留给 NaN。此结构体实现了转换构造函数和运算符。
公共函数
-
__nv_fp8_e8m0() = default
-
默认构造函数。
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const __half f)
-
从
__half
数据类型构造,对于较大的输入值,依赖于__NV_SATFINITE
行为,对于舍入,依赖于cudaRoundZero
。另请参阅
__nv_cvt_float_to_e8m0 以了解更多详情
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const __nv_bfloat16 f)
-
从
__nv_bfloat16
数据类型构造,对于较大的输入值,依赖于__NV_SATFINITE
行为,对于舍入,依赖于cudaRoundZero
。另请参阅
__nv_cvt_bfloat16raw_to_e8m0 以了解更多详情
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const double f)
-
从
double
数据类型构造,对于较大的输入值,依赖于__NV_SATFINITE
行为,对于舍入,依赖于cudaRoundZero
。另请参阅
__nv_cvt_double_to_e8m0 以了解更多详情
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const float f)
-
从
float
数据类型构造,对于较大的输入值,依赖于__NV_SATFINITE
行为,对于舍入,依赖于cudaRoundZero
。另请参阅
__nv_cvt_float_to_e8m0 以了解更多详情
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const int val)
-
从
int
数据类型构造,依赖于cudaRoundZero
舍入。
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const long int val)
-
从
long
int
数据类型构造,依赖于cudaRoundZero
舍入。
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const long long int val)
-
从
long
long
int
数据类型构造,依赖于cudaRoundZero
舍入。
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const short int val)
-
从
short
int
数据类型构造,依赖于cudaRoundZero
舍入。
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const unsigned int val)
-
从
unsigned
int
数据类型构造,依赖于cudaRoundZero
舍入。
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const unsigned long int val)
-
从
unsigned
long
int
数据类型构造,依赖于cudaRoundZero
舍入。
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const unsigned long long int val)
-
从
unsigned
long
long
int
数据类型构造,依赖于cudaRoundZero
舍入。
-
__host__ __device__ inline explicit __nv_fp8_e8m0(const unsigned short int val)
-
从
unsigned
short
int
数据类型构造,依赖于cudaRoundZero
舍入。
-
__host__ __device__ inline explicit operator __nv_bfloat16() const
-
转换为
__nv_bfloat16
数据类型的转换运算符。
-
__host__ __device__ inline explicit operator bool() const
-
转换为
bool
数据类型的转换运算符。输入范围内的所有值均为非零值,因此结果始终为
true
。
-
__host__ __device__ inline explicit operator char() const
-
转换为实现定义的
char
数据类型的转换运算符。检测
char
类型的有符号性并据此进行处理,有关更多详细信息,请参见有符号和无符号字符运算符。将输入钳制到输出范围。
NaN
输入转换为zero
。
-
__host__ __device__ inline explicit operator double() const
-
转换为
double
数据类型的转换运算符。
-
__host__ __device__ inline explicit operator float() const
-
转换为
float
数据类型的转换运算符。
-
__host__ __device__ inline explicit operator int() const
-
转换为
int
数据类型的转换运算符。将过大的输入钳制到输出范围。
NaN
输入转换为zero
。
-
__host__ __device__ inline explicit operator long int() const
-
转换为
long
int
数据类型的转换运算符。将过大的输入钳制到输出范围。
NaN
输入在输出类型为 32 位时转换为zero
。NaN
输入在输出类型为 64 位时转换为0x8000000000000000ULL
。
-
__host__ __device__ inline explicit operator long long int() const
-
转换为
long
long
int
数据类型的转换运算符。将过大的输入钳制到输出范围。
NaN
输入转换为0x8000000000000000LL
。
-
__host__ __device__ inline explicit operator short int() const
-
转换为
short
int
数据类型的转换运算符。将过大的输入钳制到输出范围。
NaN
输入转换为zero
。
-
__host__ __device__ inline explicit operator signed char() const
-
转换为
signed
char
数据类型的转换运算符。将过大的输入钳制到输出范围。
NaN
输入转换为zero
。
-
__host__ __device__ inline explicit operator unsigned char() const
-
转换为
unsigned
char
数据类型的转换运算符。将过大的输入钳制到输出范围。
NaN
输入转换为zero
。
-
__host__ __device__ inline explicit operator unsigned int() const
-
转换为
unsigned
int
数据类型的转换运算符。将过大的输入钳制到输出范围。
NaN
输入转换为zero
。
-
__host__ __device__ inline explicit operator unsigned long int() const
-
转换为
unsigned
long
int
数据类型的转换运算符。将过大的输入钳制到输出范围。
NaN
输入在输出类型为 32 位时转换为zero
。NaN
输入在输出类型为 64 位时转换为0x8000000000000000ULL
。
-
__host__ __device__ inline explicit operator unsigned long long int() const
-
转换为
unsigned
long
long
int
数据类型的转换运算符。将过大的输入钳制到输出范围。
NaN
输入转换为0x8000000000000000ULL
。
-
__host__ __device__ inline explicit operator unsigned short int() const
-
转换为
unsigned
short
int
数据类型的类型转换运算符。将过大的输入钳制到输出范围。
NaN
输入转换为zero
。
公共成员
-
__nv_fp8_storage_t __x
-
存储变量包含 8 位比例数据。
-
__nv_fp8_e8m0() = default