3.9. FP8转换与数据移动
要使用这些函数,请在程序中包含头文件 cuda_fp8.h。
枚举
- __nv_fp8_interpretation_t
-
列举将8位数值作为
fp8类型时的可能解释方式。 - __nv_saturation_t
-
列举了在执行向
fp8目标类型进行窄化转换时适用的模式。
Functions
- __host__ __device__ __nv_fp8x2_storage_t __nv_cvt_bfloat162raw_to_e8m0x2(const __nv_bfloat162_raw x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将一对
bfloat16值转换为一对e8m0类型的缩放因子。 - __host__ __device__ __nv_fp8x2_storage_t __nv_cvt_bfloat16raw2_to_fp8x2(const __nv_bfloat162_raw x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入向量中两个打包在
__nv_bfloat162_rawx内的nv_bfloat16精度数值,转换为两个指定类型的fp8值向量,采用最近偶数舍入法和指定的饱和模式。 - __host__ __device__ __nv_fp8_storage_t __nv_cvt_bfloat16raw_to_e8m0(const __nv_bfloat16_raw x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将输入的
bfloat16转换为e8m0类型的缩放因子。 - __host__ __device__ __nv_fp8_storage_t __nv_cvt_bfloat16raw_to_fp8(const __nv_bfloat16_raw x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入的
nv_bfloat16精度x转换为指定类型的fp8格式,采用最近偶数舍入法和指定的饱和模式。 - __host__ __device__ __nv_fp8x2_storage_t __nv_cvt_double2_to_e8m0x2(const double2 x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将一对
double值转换为e8m0类型的缩放因子对。 - __host__ __device__ __nv_fp8x2_storage_t __nv_cvt_double2_to_fp8x2(const double2 x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入向量中两个打包在
double2x中的double精度数字,使用就近取偶舍入法和指定的饱和模式,转换为两个指定类型的fp8值向量。 - __host__ __device__ __nv_fp8_storage_t __nv_cvt_double_to_e8m0(const double x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将输入的
double值转换为e8m0类型的缩放因子。 - __host__ __device__ __nv_fp8_storage_t __nv_cvt_double_to_fp8(const double x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
使用四舍五入到最近的偶数舍入方式和指定的饱和模式,将输入的
double精度x转换为指定类型的fp8格式。 - __host__ __device__ __nv_bfloat16_raw __nv_cvt_e8m0_to_bf16raw(const __nv_fp8_storage_t x)
-
将
e8m0类型的输入缩放因子值转换为bfloat16。 - __host__ __device__ __nv_bfloat162_raw __nv_cvt_e8m0x2_to_bf162raw(const __nv_fp8x2_storage_t x)
-
将输入的一对
e8m0类型的缩放因子转换为一对bfloat16值。 - __host__ __device__ __nv_fp8x2_storage_t __nv_cvt_float2_to_e8m0x2(const float2 x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将一对
float值转换为一对e8m0类型的缩放因子。 - __host__ __device__ __nv_fp8x2_storage_t __nv_cvt_float2_to_fp8x2(const float2 x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入向量中的两个
single精度数(打包在float2x中)转换为两个fp8类型值的向量,使用最近偶数舍入方式和指定的饱和模式。 - __host__ __device__ __nv_fp8_storage_t __nv_cvt_float_to_e8m0(const float x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将输入的
float值转换为e8m0类型的缩放因子。 - __host__ __device__ __nv_fp8_storage_t __nv_cvt_float_to_fp8(const float x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
使用就近偶数舍入和指定的饱和模式,将输入的
single精度x转换为指定类型的fp8格式。 - __host__ __device__ __half_raw __nv_cvt_fp8_to_halfraw(const __nv_fp8_storage_t x, const __nv_fp8_interpretation_t fp8_interpretation)
-
将指定类型的输入
fp8x转换为half精度。 - __host__ __device__ __half2_raw __nv_cvt_fp8x2_to_halfraw2(const __nv_fp8x2_storage_t x, const __nv_fp8_interpretation_t fp8_interpretation)
-
将指定类型的两个
fp8值输入向量转换为打包在__half2_raw结构中的两个half精度值向量。 - __host__ __device__ __nv_fp8x2_storage_t __nv_cvt_halfraw2_to_fp8x2(const __half2_raw x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入向量中两个打包在
__half2_rawx内的半精度数,使用就近取偶舍入法和指定的饱和模式,转换为两个指定类型fp8值的向量。 - __host__ __device__ __nv_fp8_storage_t __nv_cvt_halfraw_to_fp8(const __half_raw x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
使用四舍五入到最近的偶数舍入方式和指定的饱和模式,将输入的
half精度x转换为请求类型的fp8格式。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const int val)
-
从
int数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const unsigned long long int val)
-
从
unsignedlonglongint数据类型的构造函数,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const __nv_bfloat16 f)
-
从
__nv_bfloat16数据类型的构造函数,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const long int val)
-
从
longint数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const long long int val)
-
从
longlongint数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __nv_fp8_e4m3::__nv_fp8_e4m3()=default
-
默认构造函数。
- __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const unsigned short int val)
-
从
unsignedshortint数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const float f)
-
从
float数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const __half f)
-
从
__half数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const unsigned long int val)
-
从
unsignedlongint数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const double f)
-
从
double数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const short int val)
-
从
shortint数据类型的构造函数,依赖__NV_SATFINITE处理超出范围值的行为。 - __host__ __device__ __nv_fp8_e4m3::__nv_fp8_e4m3(const unsigned int val)
-
从
unsignedint数据类型的构造函数,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e4m3::operator __half() const
-
转换为
__half数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator __nv_bfloat16() const
-
转换为
__nv_bfloat16数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator bool() const
-
转换为
bool数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator char() const
-
转换为实现定义的
char数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator double() const
-
转换为
double数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator float() const
-
转换为
float数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator int() const
-
转换为
int数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator long int() const
-
转换为
longint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator long long int() const
-
转换为
longlongint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator short int() const
-
转换为
shortint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator signed char() const
-
转换为
signedchar数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator unsigned char() const
-
转换为
unsignedchar数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator unsigned int() const
-
转换为
unsignedint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator unsigned long int() const
-
转换为
unsignedlongint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator unsigned long long int() const
-
转换为
unsignedlonglongint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e4m3::operator unsigned short int() const
-
转换为
unsignedshortint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const __half f)
-
从
__half数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const long long int val)
-
从
longlongint数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const unsigned int val)
-
从
unsignedint数据类型的构造函数,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const float f)
-
从
float数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const unsigned short int val)
-
从
unsignedshortint数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __nv_fp8_e5m2::__nv_fp8_e5m2()=default
-
默认构造函数。
- __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const int val)
-
从
int数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const long int val)
-
从
longint数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const double f)
-
从
double数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const unsigned long int val)
-
从
unsignedlongint数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const short int val)
-
从
shortint数据类型的构造函数。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const __nv_bfloat16 f)
-
从
__nv_bfloat16数据类型的构造函数,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::__nv_fp8_e5m2(const unsigned long long int val)
-
从
unsignedlonglongint数据类型的构造函数,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8_e5m2::operator __half() const
-
转换为
__half数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator __nv_bfloat16() const
-
转换为
__nv_bfloat16数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator bool() const
-
转换为
bool数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator char() const
-
转换为实现定义的
char数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator double() const
-
转换为
double数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator float() const
-
转换为
float数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator int() const
-
转换为
int数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator long int() const
-
转换为
longint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator long long int() const
-
转换为
longlongint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator short int() const
-
转换为
shortint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator signed char() const
-
转换为
signedchar数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator unsigned char() const
-
转换为
unsignedchar数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator unsigned int() const
-
转换为
unsignedint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator unsigned long int() const
-
转换为
unsignedlongint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator unsigned long long int() const
-
转换为
unsignedlonglongint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e5m2::operator unsigned short int() const
-
转换为
unsignedshortint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const long int val)
-
从
longint数据类型构造,依赖于cudaRoundZero舍入方式。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const int val)
-
从
int数据类型构造,依赖于cudaRoundZero舍入方式。 - __nv_fp8_e8m0::__nv_fp8_e8m0()=default
-
默认构造函数。
- __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const unsigned int val)
-
从
unsignedint数据类型的构造函数,依赖于cudaRoundZero舍入方式。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const float f)
-
从
float数据类型构造,对于大输入值依赖于__NV_SATFINITE的行为特性,并使用cudaRoundZero进行舍入。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const unsigned long long int val)
-
从
unsignedlonglongint数据类型构造,依赖于cudaRoundZero舍入方式。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const double f)
-
从
double数据类型构造,对于大输入值依赖于__NV_SATFINITE行为,并使用cudaRoundZero进行舍入。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const __half f)
-
从
__half数据类型构造,对于大输入值依赖于__NV_SATFINITE的行为,并使用cudaRoundZero进行舍入。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const __nv_bfloat16 f)
-
从
__nv_bfloat16数据类型的构造函数,对于大输入值依赖__NV_SATFINITE行为,并使用cudaRoundZero进行舍入。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const unsigned long int val)
-
从
unsignedlongint数据类型构造,依赖于cudaRoundZero舍入方式。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const unsigned short int val)
-
从
unsignedshortint数据类型构造,依赖于cudaRoundZero舍入方式。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const long long int val)
-
从
longlongint数据类型的构造函数,依赖于cudaRoundZero舍入方式。 - __host__ __device__ __nv_fp8_e8m0::__nv_fp8_e8m0(const short int val)
-
从
shortint数据类型构造,依赖于cudaRoundZero舍入方式。 - __host__ __device__ __nv_fp8_e8m0::operator __half() const
-
转换为
__half数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator __nv_bfloat16() const
-
转换为
__nv_bfloat16数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator bool() const
-
转换为
bool数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator char() const
-
转换为实现定义的
char数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator double() const
-
转换为
double数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator float() const
-
转换为
float数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator int() const
-
转换为
int数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator long int() const
-
转换为
longint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator long long int() const
-
转换为
longlongint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator short int() const
-
转换为
shortint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator signed char() const
-
转换为
signedchar数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator unsigned char() const
-
转换为
unsignedchar数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator unsigned int() const
-
转换为
unsignedint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator unsigned long int() const
-
转换为
unsignedlongint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator unsigned long long int() const
-
转换为
unsignedlonglongint数据类型的转换运算符。 - __host__ __device__ __nv_fp8_e8m0::operator unsigned short int() const
-
转换为
unsignedshortint数据类型的转换运算符。 - __nv_fp8x2_e4m3::__nv_fp8x2_e4m3()=default
-
默认构造函数。
- __host__ __device__ __nv_fp8x2_e4m3::__nv_fp8x2_e4m3(const __nv_bfloat162 f)
-
从
__nv_bfloat162数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e4m3::__nv_fp8x2_e4m3(const double2 f)
-
从
double2数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e4m3::__nv_fp8x2_e4m3(const __half2 f)
-
从
__half2数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e4m3::__nv_fp8x2_e4m3(const float2 f)
-
从
float2数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e4m3::operator __half2() const
-
转换为
__half2数据类型的转换运算符。 - __host__ __device__ __nv_fp8x2_e4m3::operator float2() const
-
转换为
float2数据类型的转换运算符。 - __host__ __device__ __nv_fp8x2_e5m2::__nv_fp8x2_e5m2(const __nv_bfloat162 f)
-
从
__nv_bfloat162数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e5m2::__nv_fp8x2_e5m2(const double2 f)
-
从
double2数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e5m2::__nv_fp8x2_e5m2(const __half2 f)
-
从
__half2数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __nv_fp8x2_e5m2::__nv_fp8x2_e5m2()=default
-
默认构造函数。
- __host__ __device__ __nv_fp8x2_e5m2::__nv_fp8x2_e5m2(const float2 f)
-
从
float2数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e5m2::operator __half2() const
-
转换为
__half2数据类型的转换运算符。 - __host__ __device__ __nv_fp8x2_e5m2::operator float2() const
-
转换为
float2数据类型的转换运算符。 - __host__ __device__ __nv_fp8x2_e8m0::__nv_fp8x2_e8m0(const __half2 f)
-
从
__half2数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e8m0::__nv_fp8x2_e8m0(const float2 f)
-
从
float2数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e8m0::__nv_fp8x2_e8m0(const __nv_bfloat162 f)
-
从
__nv_bfloat162数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x2_e8m0::__nv_fp8x2_e8m0(const double2 f)
-
从
double2数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __nv_fp8x2_e8m0::__nv_fp8x2_e8m0()=default
-
默认构造函数。
- __host__ __device__ __nv_fp8x2_e8m0::operator __half2() const
-
转换为
__half2数据类型的转换运算符。 - __host__ __device__ __nv_fp8x2_e8m0::operator __nv_bfloat162() const
-
转换为
__nv_bfloat162数据类型的转换运算符。 - __host__ __device__ __nv_fp8x2_e8m0::operator float2() const
-
转换为
float2数据类型的转换运算符。 - __host__ __device__ __nv_fp8x4_e4m3::__nv_fp8x4_e4m3(const __nv_bfloat162 flo, const __nv_bfloat162 fhi)
-
从一对
__nv_bfloat162数据类型值构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e4m3::__nv_fp8x4_e4m3(const double4 f)
-
从
double4向量数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __nv_fp8x4_e4m3::__nv_fp8x4_e4m3()=default
-
默认构造函数。
- __host__ __device__ __nv_fp8x4_e4m3::__nv_fp8x4_e4m3(const float4 f)
-
从
float4向量数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e4m3::__nv_fp8x4_e4m3(const __half2 flo, const __half2 fhi)
-
从一对
__half2数据类型值构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e4m3::operator float4() const
-
转换为
float4向量数据类型的转换运算符。 - __nv_fp8x4_e5m2::__nv_fp8x4_e5m2()=default
-
默认构造函数。
- __host__ __device__ __nv_fp8x4_e5m2::__nv_fp8x4_e5m2(const double4 f)
-
从
double4向量数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e5m2::__nv_fp8x4_e5m2(const float4 f)
-
从
float4向量数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e5m2::__nv_fp8x4_e5m2(const __nv_bfloat162 flo, const __nv_bfloat162 fhi)
-
从一对
__nv_bfloat162数据类型值构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e5m2::__nv_fp8x4_e5m2(const __half2 flo, const __half2 fhi)
-
从一对
__half2数据类型值构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e5m2::operator float4() const
-
转换为
float4向量数据类型的转换运算符。 - __host__ __device__ __nv_fp8x4_e8m0::__nv_fp8x4_e8m0(const __half2 flo, const __half2 fhi)
-
从一对
__half2数据类型值构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e8m0::__nv_fp8x4_e8m0(const float4 f)
-
从
float4向量数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e8m0::__nv_fp8x4_e8m0(const double4 f)
-
从
double4向量数据类型构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __host__ __device__ __nv_fp8x4_e8m0::__nv_fp8x4_e8m0(const __nv_bfloat162 flo, const __nv_bfloat162 fhi)
-
从一对
__nv_bfloat162数据类型值构造,对于超出范围的值依赖于__NV_SATFINITE的行为。 - __nv_fp8x4_e8m0::__nv_fp8x4_e8m0()=default
-
默认构造函数。
- __host__ __device__ __nv_fp8x4_e8m0::operator float4() const
-
转换为
float4向量数据类型的转换运算符。
类型定义
- __nv_fp8_storage_t
-
用于存储
fp8浮点数的8位unsignedinteger类型抽象。 - __nv_fp8x2_storage_t
-
用于存储
fp8浮点数对的16位unsignedinteger类型抽象。 - __nv_fp8x4_storage_t
-
用于存储四元组
fp8浮点数的32位unsignedinteger类型抽象。
3.9.1. 枚举
3.9.2. 函数
-
__host__ __device__ __nv_fp8x2_storage_t __nv_cvt_bfloat162raw_to_e8m0x2(const __nv_bfloat162_raw x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将一对
bfloat16值转换为一对e8m0类型的缩放因子。另请参阅
__nv_cvt_bfloat16raw_to_e8m0() 转换的详细信息。
- Returns
-
__nv_fp8x2_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8x2_storage_t __nv_cvt_bfloat16raw2_to_fp8x2(const __nv_bfloat162_raw x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入向量中两个
nv_bfloat16精度的数字(打包在__nv_bfloat162_rawx中)转换为两个fp8类型值的向量,转换过程采用就近偶数舍入法和指定的饱和模式。将输入向量
x转换为由fp8_interpretation参数指定类型的两个fp8值组成的向量,使用由saturate参数指定的就近偶数舍入和饱和模式。- Returns
-
__nv_fp8x2_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8_storage_t __nv_cvt_bfloat16raw_to_e8m0(const __nv_bfloat16_raw x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将输入的
bfloat16转换为e8m0类型的缩放因子。输入数字的绝对值会根据
rounding参数指定的方向四舍五入到最接近的2的幂次方。若舍入结果小于可表示的最小目标格式数值2^-127,则会被截断为2^-127。若结果大于可表示的最大目标格式数值2^127,当saturate等于__NV_SATFINITE时会被截断为2^127,否则将转换为NaN。输入为NaN时将输出NaN,在目标格式中编码为0xFF。- Returns
-
__nv_fp8_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8_storage_t __nv_cvt_bfloat16raw_to_fp8(const __nv_bfloat16_raw x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入的
nv_bfloat16精度x转换为请求类型的fp8格式,采用最近偶数舍入法和请求的饱和模式。将输入
x转换为由fp8_interpretation参数指定类型的fp8格式,使用就近取偶舍入方式,并根据saturate参数指定的饱和模式进行处理。- Returns
-
__nv_fp8_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8x2_storage_t __nv_cvt_double2_to_e8m0x2(const double2 x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将一对
double值转换为e8m0类型的缩放因子对。另请参阅
__nv_cvt_bfloat16raw_to_e8m0() 转换的详细信息。
- Returns
-
__nv_fp8x2_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8x2_storage_t __nv_cvt_double2_to_fp8x2(const double2 x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入向量中两个打包在
double2x的双精度数字转换为两个fp8类型值的向量,使用就近取偶舍入和指定的饱和模式。将输入向量
x转换为由fp8_interpretation参数指定类型的两个fp8值组成的向量,使用由saturate参数指定的就近偶数舍入和饱和模式。- Returns
-
__nv_fp8x2_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8_storage_t __nv_cvt_double_to_e8m0(const double x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将输入的
double值转换为e8m0类型的缩放因子。另请参阅
__nv_cvt_bfloat16raw_to_e8m0() 转换的详细信息。
- Returns
-
__nv_fp8_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8_storage_t __nv_cvt_double_to_fp8(const double x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
使用四舍五入到最近的偶数舍入方式和指定的饱和模式,将输入的
double精度x转换为指定类型的fp8格式。将输入
x转换为由fp8_interpretation参数指定类型的fp8格式,使用就近取偶舍入方式,并根据saturate参数指定的饱和模式进行处理。- Returns
-
__nv_fp8_storage_t值保存转换结果。
-
__host__ __device__ __nv_bfloat16_raw __nv_cvt_e8m0_to_bf16raw(const __nv_fp8_storage_t x)
-
将
e8m0类型的输入缩放因子值转换为bfloat16。输入比例是精确的2的幂次方或一个
NaN值,同样可以在目标格式中表示。- Returns
-
__nv_bfloat16_raw值保存转换结果。
-
__host__ __device__ __nv_bfloat162_raw __nv_cvt_e8m0x2_to_bf162raw(const __nv_fp8x2_storage_t x)
-
将输入的
e8m0类型缩放因子对转换为bfloat16值对。- Returns
-
__nv_bfloat162_raw值保存转换结果。
-
__host__ __device__ __nv_fp8x2_storage_t __nv_cvt_float2_to_e8m0x2(const float2 x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将一对
float值转换为一对e8m0类型的缩放因子。另请参阅
__nv_cvt_bfloat16raw_to_e8m0() 转换的详细信息。
- Returns
-
__nv_fp8x2_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8x2_storage_t __nv_cvt_float2_to_fp8x2(const float2 x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入向量中的两个
single精度数(打包在float2x中)转换为两个fp8类型值的向量,采用就近偶数舍入方式及指定的饱和模式。将输入向量
x转换为由fp8_interpretation参数指定类型的两个fp8值组成的向量,使用由saturate参数指定的就近偶数舍入和饱和模式。- Returns
-
__nv_fp8x2_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8_storage_t __nv_cvt_float_to_e8m0(const float x, const __nv_saturation_t saturate, const enum cudaRoundMode rounding)
-
将输入的
float值转换为e8m0类型的缩放因子。另请参阅
__nv_cvt_bfloat16raw_to_e8m0() 转换的详细信息。
- Returns
-
__nv_fp8_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8_storage_t __nv_cvt_float_to_fp8(const float x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
使用就近偶数舍入和指定的饱和模式,将输入的
single精度x转换为指定类型的fp8格式。将输入
x转换为由fp8_interpretation参数指定类型的fp8格式,使用就近取偶舍入方式,并根据saturate参数指定的饱和模式进行处理。- Returns
-
__nv_fp8_storage_t值保存转换结果。
-
__host__ __device__ __half_raw __nv_cvt_fp8_to_halfraw(const __nv_fp8_storage_t x, const __nv_fp8_interpretation_t fp8_interpretation)
-
将指定类型的输入
fp8x转换为half精度。将输入
x从fp8类型(由fp8_interpretation参数指定)转换为half精度。- Returns
-
__half_raw值保存转换结果。
-
__host__ __device__ __half2_raw __nv_cvt_fp8x2_to_halfraw2(const __nv_fp8x2_storage_t x, const __nv_fp8_interpretation_t fp8_interpretation)
-
将指定类型的两个
fp8值的输入向量转换为打包在__half2_raw结构中的两个half精度值的向量。将输入向量
x从fp8类型(由fp8_interpretation参数指定种类)转换为两个half精度值的向量,并以__half2_raw结构形式返回。- Returns
-
__half2_raw值保存转换结果。
-
__host__ __device__ __nv_fp8x2_storage_t __nv_cvt_halfraw2_to_fp8x2(const __half2_raw x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
将输入向量中的两个
half精度数(打包在__half2_rawx中)转换为两个fp8类型值的向量,使用就近取偶舍入方式和指定的饱和模式。将输入向量
x转换为由fp8_interpretation参数指定类型的两个fp8值组成的向量,使用由saturate参数指定的就近偶数舍入和饱和模式。- Returns
-
__nv_fp8x2_storage_t值保存转换结果。
-
__host__ __device__ __nv_fp8_storage_t __nv_cvt_halfraw_to_fp8(const __half_raw x, const __nv_saturation_t saturate, const __nv_fp8_interpretation_t fp8_interpretation)
-
使用最近偶数舍入法和指定的饱和模式,将输入的
half精度x转换为指定类型的fp8格式。将输入
x转换为由fp8_interpretation参数指定类型的fp8格式,使用就近取偶舍入方式,并根据saturate参数指定的饱和模式进行处理。- Returns
-
__nv_fp8_storage_t值保存转换结果。
3.9.3. 类型定义
-
typedef unsigned char __nv_fp8_storage_t
-
用于存储
fp8浮点数的8位unsignedinteger类型抽象。
-
typedef unsigned short int __nv_fp8x2_storage_t
-
用于存储
fp8浮点数对的16位unsignedinteger类型抽象。
-
typedef unsigned int __nv_fp8x4_storage_t
-
用于存储四组
fp8浮点数的32位unsignedinteger类型抽象。