2.5. __nv_bfloat16 Struct Reference

[Bfloat16 Precision Intrinsics]

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 Constructors

__host____device__ ​ __nv_bfloat16 ( unsigned long long val )
__host____device__ ​ __nv_bfloat16 ( long long val )
__host____device__ ​ __nv_bfloat16 ( const unsignedlong  val )
__host____device__ ​ __nv_bfloat16 ( const long val )
__host____device__ ​ __nv_bfloat16 ( unsigned int  val )
__host____device__ ​ __nv_bfloat16 ( int  val )
__host____device__ ​ __nv_bfloat16 ( unsigned short val )
__host____device__ ​ __nv_bfloat16 ( short val )
__host____device__ ​ __nv_bfloat16 ( const double  f )
__host____device__ ​ __nv_bfloat16 ( const float  f )
__host____device__ ​ __nv_bfloat16 ( const __nv_bfloat16_raw& hr )
__host____device__ ​ __nv_bfloat16 ( )

Public Member Functions

__host____device__ ​  operator __nv_bfloat16_raw ( ) const
__host____device__ ​  operator __nv_bfloat16_raw ( ) const
__host____device__ ​ constexpr operator bool ( ) const
__host____device__ ​  operator char ( ) const
__host____device__ ​  operator float ( ) const
__host____device__ ​  operator int ( ) const
__host____device__ ​  operator long ( ) const
__host____device__ ​  operator long long ( ) const
__host____device__ ​  operator short ( ) const
__host____device__ ​  operator signed char ( ) const
__host____device__ ​  operator unsigned char ( ) const
__host____device__ ​  operator unsigned int ( ) const
__host____device__ ​  operator unsigned long ( ) const
__host____device__ ​  operator unsigned long long ( ) const
__host____device__ ​  operator unsigned short ( ) const
__host____device____nv_bfloat16operator= ( unsigned long long val )
__host____device____nv_bfloat16operator= ( long long val )
__host____device____nv_bfloat16operator= ( unsigned int  val )
__host____device____nv_bfloat16operator= ( int  val )
__host____device____nv_bfloat16operator= ( unsigned short val )
__host____device____nv_bfloat16operator= ( short val )
__host____device____nv_bfloat16operator= ( const double  f )
__host____device____nv_bfloat16operator= ( const float  f )
__host____device____nv_bfloat16operator= ( const __nv_bfloat16_raw& hr )
__host____device____nv_bfloat16operator= ( const __nv_bfloat16_raw& hr )
__host____device____nv_bfloat16operator= ( const __nv_bfloat16_raw& hr )

Protected Variables

unsigned short  __x

Constructors

__host____device____nv_bfloat16::__nv_bfloat16 ( unsigned long long val ) [inline]
Description

Construct __nv_bfloat16 from unsignedlonglong input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( long long val ) [inline]
Description

Construct __nv_bfloat16 from longlong input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( const unsignedlong  val ) [inline]
Description

Construct __nv_bfloat16 from unsignedlong input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( const long val ) [inline]
Description

Construct __nv_bfloat16 from long input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( unsigned int  val ) [inline]
Description

Construct __nv_bfloat16 from unsignedint input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( int  val ) [inline]
Description

Construct __nv_bfloat16 from int input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( unsigned short val ) [inline]
Description

Construct __nv_bfloat16 from unsignedshort integer input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( short val ) [inline]
Description

Construct __nv_bfloat16 from short integer input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( const double  f ) [inline]
Description

Construct __nv_bfloat16 from double input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( const float  f ) [inline]
Description

Construct __nv_bfloat16 from float input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16::__nv_bfloat16 ( const __nv_bfloat16_raw& hr ) [inline]
Description

Constructor from __nv_bfloat16_raw.

__host____device____nv_bfloat16::__nv_bfloat16 ( ) [inline]
Description

Constructor by default.

Member Functions

__host____device____nv_bfloat16::operator __nv_bfloat16_raw ( ) const [inherited]
Description

Type cast to __nv_bfloat16_raw operator with volatile input.

__host____device____nv_bfloat16::operator __nv_bfloat16_raw ( ) const [inherited]
Description

Type cast to __nv_bfloat16_raw operator.

__host____device__ ​ constexpr __nv_bfloat16::operator bool ( ) const [inherited, inline]
Description

Conversion operator to bool data type. +0 and -0 inputs convert to false. Non-zero inputs convert to true.

__host____device____nv_bfloat16::operator char ( ) const [inherited]
Description

Conversion operator to an implementation defined char data type. Using round-toward-zero rounding mode.

Detects signedness of the char type and proceeds accordingly, see further details in signed and unsigned char operators.

__host____device____nv_bfloat16::operator float ( ) const [inherited]
Description

Type cast to float operator.

__host____device____nv_bfloat16::operator int ( ) const [inherited]
Description

Conversion operator to int data type. Using round-toward-zero rounding mode.

See __bfloat162int_rz( __nv_bfloat16) for further details

__host____device____nv_bfloat16::operator long ( ) const [inherited]
Description

Conversion operator to long data type. Using round-toward-zero rounding mode.

__host____device____nv_bfloat16::operator long long ( ) const [inherited]
Description

Conversion operator to longlong data type. Using round-toward-zero rounding mode.

See __bfloat162ll_rz( __nv_bfloat16) for further details

__host____device____nv_bfloat16::operator short ( ) const [inherited]
Description

Conversion operator to short data type. Using round-toward-zero rounding mode.

See __bfloat162short_rz( __nv_bfloat16) for further details

__host____device____nv_bfloat16::operator signed char ( ) const [inherited]
Description

Conversion operator to signedchar data type. Using round-toward-zero rounding mode.

See __bfloat162char_rz( __nv_bfloat16) for further details

__host____device____nv_bfloat16::operator unsigned char ( ) const [inherited]
Description

Conversion operator to unsignedchar data type. Using round-toward-zero rounding mode.

See __bfloat162uchar_rz( __nv_bfloat16) for further details

__host____device____nv_bfloat16::operator unsigned int ( ) const [inherited]
Description

Conversion operator to unsignedint data type. Using round-toward-zero rounding mode.

See __bfloat162uint_rz( __nv_bfloat16) for further details

__host____device____nv_bfloat16::operator unsigned long ( ) const [inherited]
Description

Conversion operator to unsignedlong data type. Using round-toward-zero rounding mode.

__host____device____nv_bfloat16::operator unsigned long long ( ) const [inherited]
Description

Conversion operator to unsignedlonglong data type. Using round-toward-zero rounding mode.

See __bfloat162ull_rz( __nv_bfloat16) for further details

__host____device____nv_bfloat16::operator unsigned short ( ) const [inherited]
Description

Conversion operator to unsignedshort data type. Using round-toward-zero rounding mode.

See __bfloat162ushort_rz( __nv_bfloat16) for further details

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( unsigned long long val ) [inherited]
Description

Type cast from unsignedlonglong assignment operator, using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( long long val ) [inherited]
Description

Type cast from longlong assignment operator, using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( unsigned int  val ) [inherited]
Description

Type cast from unsignedint assignment operator, using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( int  val ) [inherited]
Description

Type cast from int assignment operator, using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( unsigned short val ) [inherited]
Description

Type cast from unsignedshort assignment operator, using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( short val ) [inherited]
Description

Type cast from short assignment operator, using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( const double  f ) [inherited]
Description

Type cast to __nv_bfloat16 assignment operator from double input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( const float  f ) [inherited]
Description

Type cast to __nv_bfloat16 assignment operator from float input using default round-to-nearest-even rounding mode.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( const __nv_bfloat16_raw& hr ) [inherited]
Description

Assignment operator from volatile__nv_bfloat16_raw to volatile__nv_bfloat16.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( const __nv_bfloat16_raw& hr ) [inherited]
Description

Assignment operator from __nv_bfloat16_raw to volatile__nv_bfloat16.

__host____device____nv_bfloat16& __nv_bfloat16::operator= ( const __nv_bfloat16_raw& hr ) [inherited]
Description

Assignment operator from __nv_bfloat16_raw.

Variables

unsigned short __nv_bfloat16::__x [inherited, protected]

Protected storage variable contains the bits of floating-point data.