NVIDIA DeepStream SDK API Reference

9.2 Release
includes/half.hpp File Reference

Detailed Description

Main header file for half-precision functionality.

Definition in file includes/half.hpp.

Go to the source code of this file.

Data Structures

struct  half_float::detail::conditional< bool, T, typename >
 Conditional type. More...
 
struct  half_float::detail::conditional< false, T, F >
 
struct  half_float::detail::bool_type< bool >
 Helper for tag dispatching. More...
 
struct  half_float::detail::is_float< typename >
 Type traits for floating-point types. More...
 
struct  half_float::detail::is_float< const T >
 
struct  half_float::detail::is_float< volatile T >
 
struct  half_float::detail::is_float< const volatile T >
 
struct  half_float::detail::is_float< float >
 
struct  half_float::detail::is_float< double >
 
struct  half_float::detail::is_float< long double >
 
struct  half_float::detail::bits< T >
 Type traits for floating-point bits. More...
 
struct  half_float::detail::bits< const T >
 
struct  half_float::detail::bits< volatile T >
 
struct  half_float::detail::bits< const volatile T >
 
struct  half_float::detail::bits< float >
 Unsigned integer of (at least) 32 bits width. More...
 
struct  half_float::detail::bits< double >
 Unsigned integer of (at least) 64 bits width. More...
 
struct  half_float::detail::binary_t
 Tag type for binary construction. More...
 
struct  half_float::detail::f31
 Class for 1.31 unsigned floating-point computation. More...
 
struct  half_float::detail::half_caster< T, U, R >
 Helper class for half casts. More...
 
class  half_float::half
 Half-precision floating-point type. More...
 
struct  half_float::detail::half_caster< T, U, R >
 Helper class for half casts. More...
 
struct  half_float::detail::half_caster< half, U, R >
 
struct  half_float::detail::half_caster< T, half, R >
 
struct  half_float::detail::half_caster< half, half, R >
 
class  std::numeric_limits< half_float::half >
 Numeric limits for half-precision floats. More...
 

Namespaces

 half_float
 Main namespace for half-precision functionality.
 
 half_float::detail
 
 std
 Extensions to the C++ standard library.
 

Macros

#define HALF_GCC_VERSION   (__GNUC__*100+__GNUC_MINOR__)
 
#define HALF_ICC_VERSION   0
 
#define HALF_ERRHANDLING   (HALF_ERRHANDLING_FLAGS||HALF_ERRHANDLING_ERRNO||HALF_ERRHANDLING_FENV||HALF_ERRHANDLING_THROWS)
 
#define HALF_UNUSED_NOERR(name)
 
#define HALF_CONSTEXPR
 
#define HALF_CONSTEXPR_CONST   const
 
#define HALF_CONSTEXPR_NOERR
 
#define HALF_NOEXCEPT
 
#define HALF_NOTHROW   throw()
 
#define HALF_THREAD_LOCAL   static
 
#define HALF_ENABLE_F16C_INTRINSICS   __F16C__
 Enable F16C intruction set intrinsics. More...
 
#define HALF_ERRHANDLING_OVERFLOW_TO_INEXACT   1
 Raise INEXACT exception on overflow. More...
 
#define HALF_ERRHANDLING_UNDERFLOW_TO_INEXACT   1
 Raise INEXACT exception on underflow. More...
 
#define HALF_ROUND_STYLE   1
 Default rounding mode. More...
 
#define HUGE_VALH   std::numeric_limits<half_float::half>::infinity()
 Value signaling overflow. More...
 
#define FP_FAST_FMAH   1
 Fast half-precision fma function. More...
 
#define HLF_ROUNDS   HALF_ROUND_STYLE
 Half rounding mode. More...
 
#define FP_ILOGB0   INT_MIN
 
#define FP_ILOGBNAN   INT_MAX
 
#define FP_SUBNORMAL   0
 
#define FP_ZERO   1
 
#define FP_NAN   2
 
#define FP_INFINITE   3
 
#define FP_NORMAL   4
 
#define FE_INVALID   0x10
 
#define FE_DIVBYZERO   0x08
 
#define FE_OVERFLOW   0x04
 
#define FE_UNDERFLOW   0x02
 
#define FE_INEXACT   0x01
 
#define FE_ALL_EXCEPT   (FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW|FE_UNDERFLOW|FE_INEXACT)
 

Typedefs

typedef bool_type< true > half_float::detail::true_type
 
typedef bool_type< false > half_float::detail::false_type
 
typedef unsigned short half_float::detail::uint16
 Unsigned integer of (at least) 16 bits width. More...
 
typedef unsigned long half_float::detail::uint32
 Fastest unsigned integer of (at least) 32 bits width. More...
 
typedef long half_float::detail::int32
 Fastest unsigned integer of (at least) 32 bits width. More...
 

Variables

HALF_CONSTEXPR_CONST binary_t half_float::detail::binary = binary_t()
 Tag for binary construction. More...
 

Macro Definition Documentation

◆ FE_ALL_EXCEPT

Definition at line 443 of file includes/half.hpp.

◆ FE_DIVBYZERO

#define FE_DIVBYZERO   0x08

Definition at line 439 of file includes/half.hpp.

◆ FE_INEXACT

#define FE_INEXACT   0x01

Definition at line 442 of file includes/half.hpp.

◆ FE_INVALID

#define FE_INVALID   0x10

Definition at line 438 of file includes/half.hpp.

◆ FE_OVERFLOW

#define FE_OVERFLOW   0x04

Definition at line 440 of file includes/half.hpp.

◆ FE_UNDERFLOW

#define FE_UNDERFLOW   0x02

Definition at line 441 of file includes/half.hpp.

◆ FP_FAST_FMAH

#define FP_FAST_FMAH   1

Fast half-precision fma function.

This symbol is defined if the fma() function generally executes as fast as, or faster than, a separate half-precision multiplication followed by an addition, which is always the case.

See also: Documentation for FP_FAST_FMA

Definition at line 406 of file includes/half.hpp.

◆ FP_ILOGB0

#define FP_ILOGB0   INT_MIN

Definition at line 416 of file includes/half.hpp.

◆ FP_ILOGBNAN

#define FP_ILOGBNAN   INT_MAX

Definition at line 419 of file includes/half.hpp.

◆ FP_INFINITE

#define FP_INFINITE   3

Definition at line 431 of file includes/half.hpp.

◆ FP_NAN

#define FP_NAN   2

Definition at line 428 of file includes/half.hpp.

◆ FP_NORMAL

#define FP_NORMAL   4

Definition at line 434 of file includes/half.hpp.

◆ FP_SUBNORMAL

#define FP_SUBNORMAL   0

Definition at line 422 of file includes/half.hpp.

◆ FP_ZERO

#define FP_ZERO   1

Definition at line 425 of file includes/half.hpp.

◆ HALF_CONSTEXPR

#define HALF_CONSTEXPR

Definition at line 240 of file includes/half.hpp.

◆ HALF_CONSTEXPR_CONST

#define HALF_CONSTEXPR_CONST   const

Definition at line 241 of file includes/half.hpp.

◆ HALF_CONSTEXPR_NOERR

#define HALF_CONSTEXPR_NOERR

Definition at line 242 of file includes/half.hpp.

◆ HALF_ENABLE_F16C_INTRINSICS

#define HALF_ENABLE_F16C_INTRINSICS   __F16C__

Enable F16C intruction set intrinsics.

Defining this to 1 enables the use of F16C compiler intrinsics for converting between half-precision and single-precision values which may result in improved performance. This will not perform additional checks for support of the F16C instruction set, so an appropriate target platform is required when enabling this feature.

Unless predefined it will be enabled automatically when the __F16C__ symbol is defined, which some compilers do on supporting platforms.

Definition at line 295 of file includes/half.hpp.

◆ HALF_ERRHANDLING

#define HALF_ERRHANDLING   (HALF_ERRHANDLING_FLAGS||HALF_ERRHANDLING_ERRNO||HALF_ERRHANDLING_FENV||HALF_ERRHANDLING_THROWS)

Definition at line 222 of file includes/half.hpp.

◆ HALF_ERRHANDLING_OVERFLOW_TO_INEXACT

#define HALF_ERRHANDLING_OVERFLOW_TO_INEXACT   1

Raise INEXACT exception on overflow.

Defining this to 1 (default) causes overflow errors to automatically raise inexact exceptions in addition. These will be raised after any possible handling of the underflow exception.

Definition at line 359 of file includes/half.hpp.

◆ HALF_ERRHANDLING_UNDERFLOW_TO_INEXACT

#define HALF_ERRHANDLING_UNDERFLOW_TO_INEXACT   1

Raise INEXACT exception on underflow.

Defining this to 1 (default) causes underflow errors to automatically raise inexact exceptions in addition. These will be raised after any possible handling of the underflow exception.

Note: This will actually cause underflow (and the accompanying inexact) exceptions to be raised only when the result is inexact, while if disabled bare underflow errors will be raised for any (possibly exact) subnormal result.

Definition at line 369 of file includes/half.hpp.

◆ HALF_GCC_VERSION

#define HALF_GCC_VERSION   (__GNUC__*100+__GNUC_MINOR__)

Definition at line 42 of file includes/half.hpp.

◆ HALF_ICC_VERSION

#define HALF_ICC_VERSION   0

Definition at line 51 of file includes/half.hpp.

◆ HALF_NOEXCEPT

#define HALF_NOEXCEPT

Definition at line 250 of file includes/half.hpp.

◆ HALF_NOTHROW

#define HALF_NOTHROW   throw()

Definition at line 251 of file includes/half.hpp.

◆ HALF_ROUND_STYLE

#define HALF_ROUND_STYLE   1

Default rounding mode.

This specifies the rounding mode used for all conversions between halfs and more precise types (unless using half_cast() and specifying the rounding mode directly) as well as in arithmetic operations and mathematical functions. It can be redefined (before including half.hpp) to one of the standard rounding modes using their respective constants or the equivalent values of std::float_round_style:

std::float_round_style value rounding
std::round_indeterminate -1 fastest
std::round_toward_zero 0 toward zero
std::round_to_nearest 1 to nearest (default)
std::round_toward_infinity 2 toward positive infinity
std::round_toward_neg_infinity 3 toward negative infinity

By default this is set to 1 (std::round_to_nearest), which rounds results to the nearest representable value. It can even be set to std::numeric_limits<float>::round_style to synchronize the rounding mode with that of the built-in single-precision implementation (which is likely std::round_to_nearest, though).

Definition at line 391 of file includes/half.hpp.

◆ HALF_THREAD_LOCAL

#define HALF_THREAD_LOCAL   static

Definition at line 258 of file includes/half.hpp.

◆ HALF_UNUSED_NOERR

#define HALF_UNUSED_NOERR (   name)

Definition at line 227 of file includes/half.hpp.

◆ HLF_ROUNDS

#define HLF_ROUNDS   HALF_ROUND_STYLE

Half rounding mode.

In correspondence with FLT_ROUNDS from <cfloat> this symbol expands to the rounding mode used for half-precision operations. It is an alias for HALF_ROUND_STYLE.

See also: Documentation for FLT_ROUNDS

Definition at line 413 of file includes/half.hpp.

◆ HUGE_VALH

#define HUGE_VALH   std::numeric_limits<half_float::half>::infinity()

Value signaling overflow.

In correspondence with HUGE_VAL[F|L] from <cmath> this symbol expands to a positive value signaling the overflow of an operation, in particular it just evaluates to positive infinity.

See also: Documentation for HUGE_VAL

Definition at line 399 of file includes/half.hpp.