15.5. __nv_bfloat16
-
struct __nv_bfloat16
-
nv_bfloat16 datatype
This structure implements the datatype for storing nv_bfloat16 floating-point numbers. The structure implements assignment operators and type conversions. 16 bits are being used in total: 1 sign bit, 8 bits for the exponent, and the significand is being stored in 7 bits. The total precision is 8 bits.
Public Functions
-
__nv_bfloat16() = default
-
Constructor by default.
Emtpy default constructor, result is uninitialized.
-
__host__ __device__ inline explicit __nv_bfloat16(const __half f)
-
Construct
__nv_bfloat16from__halfinput using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline constexpr __nv_bfloat16(const __nv_bfloat16_raw &hr)
-
Constructor from
__nv_bfloat16_raw.
-
__host__ __device__ inline __nv_bfloat16(const double f)
-
Construct
__nv_bfloat16fromdoubleinput using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline __nv_bfloat16(const float f)
-
Construct
__nv_bfloat16fromfloatinput using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline __nv_bfloat16(const long val)
-
Construct
__nv_bfloat16fromlonginput using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline __nv_bfloat16(const unsigned long val)
-
Construct
__nv_bfloat16fromunsignedlonginput using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline __nv_bfloat16(int val)
-
Construct
__nv_bfloat16fromintinput using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline __nv_bfloat16(long long val)
-
Construct
__nv_bfloat16fromlonglonginput using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline __nv_bfloat16(short val)
-
Construct
__nv_bfloat16fromshortinteger input using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline __nv_bfloat16(unsigned int val)
-
Construct
__nv_bfloat16fromunsignedintinput using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline __nv_bfloat16(unsigned long long val)
-
Construct
__nv_bfloat16fromunsignedlonglonginput using default round-to-nearest-even rounding mode.
-
__host__ __device__ inline __nv_bfloat16(unsigned short val)
-
Construct
__nv_bfloat16fromunsignedshortinteger input using default round-to-nearest-even rounding mode.
-
__host__ __device__ operator __nv_bfloat16_raw() const
-
Type cast to
__nv_bfloat16_rawoperator.
-
__host__ __device__ operator __nv_bfloat16_raw() volatile const
-
Type cast to
__nv_bfloat16_rawoperator withvolatileinput.
-
__host__ __device__ inline constexpr operator bool() const
-
Conversion operator to
booldata type.+0 and -0 inputs convert to
false. Non-zero inputs convert totrue.
-
__host__ __device__ operator char() const
-
Conversion operator to an implementation defined
chardata type.Using round-toward-zero rounding mode.
Detects signedness of the
chartype and proceeds accordingly, see further details in signed and unsigned char operators.
-
__host__ __device__ operator float() const
-
Type cast to
floatoperator.
-
__host__ __device__ operator int() const
-
Conversion operator to
intdata type.Using round-toward-zero rounding mode.
See __bfloat162int_rz(__nv_bfloat16) for further details
-
__host__ __device__ operator long() const
-
Conversion operator to
longdata type.Using round-toward-zero rounding mode.
-
__host__ __device__ operator long long() const
-
Conversion operator to
longlongdata type.Using round-toward-zero rounding mode.
See __bfloat162ll_rz(__nv_bfloat16) for further details
-
__host__ __device__ operator short() const
-
Conversion operator to
shortdata type.Using round-toward-zero rounding mode.
See __bfloat162short_rz(__nv_bfloat16) for further details
-
__host__ __device__ operator signed char() const
-
Conversion operator to
signedchardata type.Using round-toward-zero rounding mode.
See __bfloat162char_rz(__nv_bfloat16) for further details
-
__host__ __device__ operator unsigned char() const
-
Conversion operator to
unsignedchardata type.Using round-toward-zero rounding mode.
See __bfloat162uchar_rz(__nv_bfloat16) for further details
-
__host__ __device__ operator unsigned int() const
-
Conversion operator to
unsignedintdata type.Using round-toward-zero rounding mode.
See __bfloat162uint_rz(__nv_bfloat16) for further details
-
__host__ __device__ operator unsigned long() const
-
Conversion operator to
unsignedlongdata type.Using round-toward-zero rounding mode.
-
__host__ __device__ operator unsigned long long() const
-
Conversion operator to
unsignedlonglongdata type.Using round-toward-zero rounding mode.
See __bfloat162ull_rz(__nv_bfloat16) for further details
-
__host__ __device__ operator unsigned short() const
-
Conversion operator to
unsignedshortdata type.Using round-toward-zero rounding mode.
See __bfloat162ushort_rz(__nv_bfloat16) for further details
-
__host__ __device__ __nv_bfloat16 &operator=(const __nv_bfloat16_raw &hr)
-
Assignment operator from
__nv_bfloat16_raw.
-
__host__ __device__ volatile __nv_bfloat16 &operator=(const __nv_bfloat16_raw &hr) volatile
-
Assignment operator from
__nv_bfloat16_rawtovolatile__nv_bfloat16.
-
__host__ __device__ __nv_bfloat16 &operator=(const double f)
-
Type cast to
__nv_bfloat16assignment operator fromdoubleinput using default round-to-nearest-even rounding mode.
-
__host__ __device__ __nv_bfloat16 &operator=(const float f)
-
Type cast to
__nv_bfloat16assignment operator fromfloatinput using default round-to-nearest-even rounding mode.
-
__host__ __device__ volatile __nv_bfloat16 &operator=(volatile const __nv_bfloat16_raw &hr) volatile
-
Assignment operator from
volatile__nv_bfloat16_rawtovolatile__nv_bfloat16.
-
__host__ __device__ __nv_bfloat16 &operator=(int val)
-
Type cast from
intassignment operator, using default round-to-nearest-even rounding mode.
-
__host__ __device__ __nv_bfloat16 &operator=(long long val)
-
Type cast from
longlongassignment operator, using default round-to-nearest-even rounding mode.
-
__host__ __device__ __nv_bfloat16 &operator=(short val)
-
Type cast from
shortassignment operator, using default round-to-nearest-even rounding mode.
-
__host__ __device__ __nv_bfloat16 &operator=(unsigned int val)
-
Type cast from
unsignedintassignment operator, using default round-to-nearest-even rounding mode.
-
__host__ __device__ __nv_bfloat16 &operator=(unsigned long long val)
-
Type cast from
unsignedlonglongassignment operator, using default round-to-nearest-even rounding mode.
-
__host__ __device__ __nv_bfloat16 &operator=(unsigned short val)
-
Type cast from
unsignedshortassignment operator, using default round-to-nearest-even rounding mode.
-
__nv_bfloat16() = default