1.2. Half Precision Intrinsics

This section describes half precision intrinsic functions that are only supported in device code. To use these functions, include the header file cuda_fp16.h in your program. The following macros are available to help users selectively enable/disable various definitions present in the header file:

  • CUDA_NO_HALF - If defined, this macro will prevent the definition of additional type aliases in the global namespace, helping to avoid potential conflicts with symbols defined in the user program.

  • __CUDA_NO_HALF_CONVERSIONS__ - If defined, this macro will prevent the use of the C++ type conversions (converting constructors and conversion operators) that are common for built-in floating-point types, but may be undesirable for half which is essentially a user-defined type.

  • __CUDA_NO_HALF_OPERATORS__ and __CUDA_NO_HALF2_OPERATORS__ - If defined, these macros will prevent the inadvertent use of usual arithmetic and comparison operators. This enforces the storage-only type semantics and prevents C++ style computations on half and half2 types.

Modules

 
 
 
 
 
 
 

Half Arithmetic Functions

Half2 Arithmetic Functions

Half Comparison Functions

Half2 Comparison Functions

Half Precision Conversion and Data Movement

Half Math Functions

Half2 Math Functions