1.1.2. Half2 Arithmetic Functions
[Half Precision Intrinsics]
To use these functions include the header file cuda_fp16.h in your program.
Functions
- __device__ __half2 __h2div ( const __half2 a, const __half2 b ) throw ( )
- Performs half2 vector division in round-to-nearest-even mode.
- __device__ __half2 __habs2 ( const __half2 a ) throw ( )
- Calculates the absolute value of both halves of the input half2 number and returns the result.
- __device__ __half2 __hadd2 ( const __half2 a, const __half2 b ) throw ( )
- Performs half2 vector addition in round-to-nearest-even mode.
- __device__ __half2 __hadd2_sat ( const __half2 a, const __half2 b ) throw ( )
- Performs half2 vector addition in round-to-nearest-even mode, with saturation to [0.0, 1.0].
- __device__ __half2 __hfma2 ( const __half2 a, const __half2 b, const __half2 c ) throw ( )
- Performs half2 vector fused multiply-add in round-to-nearest-even mode.
- __device__ __half2 __hfma2_sat ( const __half2 a, const __half2 b, const __half2 c ) throw ( )
- Performs half2 vector fused multiply-add in round-to-nearest-even mode, with saturation to [0.0, 1.0].
- __device__ __half2 __hmul2 ( const __half2 a, const __half2 b ) throw ( )
- Performs half2 vector multiplication in round-to-nearest-even mode.
- __device__ __half2 __hmul2_sat ( const __half2 a, const __half2 b ) throw ( )
- Performs half2 vector multiplication in round-to-nearest-even mode, with saturation to [0.0, 1.0].
- __device__ __half2 __hneg2 ( const __half2 a ) throw ( )
- Negates both halves of the input half2 number and returns the result.
- __device__ __half2 __hsub2 ( const __half2 a, const __half2 b ) throw ( )
- Performs half2 vector subtraction in round-to-nearest-even mode.
- __device__ __half2 __hsub2_sat ( const __half2 a, const __half2 b ) throw ( )
- Performs half2 vector subtraction in round-to-nearest-even mode, with saturation to [0.0, 1.0].
Functions
- __device__ __half2 __h2div ( const __half2 a, const __half2 b ) throw ( )
-
Performs half2 vector division in round-to-nearest-even mode.
Parameters
- a
- - half2. Is only being read.
- b
- - half2. Is only being read.
Returns
half2
- The
elementwise division of a with b.
Description
Divides half2 input vector a by input vector b in round-to-nearest mode. DEEPLEARN-SRM_REQ-103
- __device__ __half2 __habs2 ( const __half2 a ) throw ( )
-
Calculates the absolute value of both halves of the input half2 number and returns the result.
Parameters
- a
- - half2. Is only being read.
Returns
half2
- Returns
a with the absolute value of both halves.
Description
Calculates the absolute value of both halves of the input half2 number and returns the result.
- __device__ __half2 __hadd2 ( const __half2 a, const __half2 b ) throw ( )
-
Performs half2 vector addition in round-to-nearest-even mode.
Parameters
- a
- - half2. Is only being read.
- b
- - half2. Is only being read.
Returns
half2
- The
sum of vectors a and b.
Description
Performs half2 vector add of inputs a and b, in round-to-nearest mode. DEEPLEARN-SRM_REQ-95
- __device__ __half2 __hadd2_sat ( const __half2 a, const __half2 b ) throw ( )
-
Performs half2 vector addition in round-to-nearest-even mode, with saturation to [0.0, 1.0].
Parameters
- a
- - half2. Is only being read.
- b
- - half2. Is only being read.
Returns
half2
- The
sum of a and b, with respect to saturation.
Description
Performs half2 vector add of inputs a and b, in round-to-nearest mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.
- __device__ __half2 __hfma2 ( const __half2 a, const __half2 b, const __half2 c ) throw ( )
-
Performs half2 vector fused multiply-add in round-to-nearest-even mode.
Parameters
- a
- - half2. Is only being read.
- b
- - half2. Is only being read.
- c
- - half2. Is only being read.
Returns
half2
- The
result of elementwise fused multiply-add operation on vectors a, b, and c.
Description
Performs half2 vector multiply on inputs a and b, then performs a half2 vector add of the result with c, rounding the result once in round-to-nearest-even mode. DEEPLEARN-SRM_REQ-105
- __device__ __half2 __hfma2_sat ( const __half2 a, const __half2 b, const __half2 c ) throw ( )
-
Performs half2 vector fused multiply-add in round-to-nearest-even mode, with saturation to [0.0, 1.0].
Parameters
- a
- - half2. Is only being read.
- b
- - half2. Is only being read.
- c
- - half2. Is only being read.
Returns
half2
- The
result of elementwise fused multiply-add operation on vectors a, b, and c, with respect to saturation.
Description
Performs half2 vector multiply on inputs a and b, then performs a half2 vector add of the result with c, rounding the result once in round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.
- __device__ __half2 __hmul2 ( const __half2 a, const __half2 b ) throw ( )
-
Performs half2 vector multiplication in round-to-nearest-even mode.
Parameters
- a
- - half2. Is only being read.
- b
- - half2. Is only being read.
Returns
half2
- The
result of elementwise multiplying the vectors a and b.
Description
Performs half2 vector multiplication of inputs a and b, in round-to-nearest-even mode. DEEPLEARN-SRM_REQ-102
- __device__ __half2 __hmul2_sat ( const __half2 a, const __half2 b ) throw ( )
-
Performs half2 vector multiplication in round-to-nearest-even mode, with saturation to [0.0, 1.0].
Parameters
- a
- - half2. Is only being read.
- b
- - half2. Is only being read.
Returns
half2
- The
result of elementwise multiplication of vectors a and b, with respect to saturation.
Description
Performs half2 vector multiplication of inputs a and b, in round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.
- __device__ __half2 __hneg2 ( const __half2 a ) throw ( )
-
Negates both halves of the input half2 number and returns the result.
Parameters
- a
- - half2. Is only being read.
Returns
half2
- Returns
a with both halves negated.
Description
Negates both halves of the input half2 number a and returns the result. DEEPLEARN-SRM_REQ-101
- __device__ __half2 __hsub2 ( const __half2 a, const __half2 b ) throw ( )
-
Performs half2 vector subtraction in round-to-nearest-even mode.
Parameters
- a
- - half2. Is only being read.
- b
- - half2. Is only being read.
Returns
half2
- The
subtraction of vector b from a.
Description
Subtracts half2 input vector b from input vector a in round-to-nearest-even mode. DEEPLEARN-SRM_REQ-104
- __device__ __half2 __hsub2_sat ( const __half2 a, const __half2 b ) throw ( )
-
Performs half2 vector subtraction in round-to-nearest-even mode, with saturation to [0.0, 1.0].
Parameters
- a
- - half2. Is only being read.
- b
- - half2. Is only being read.
Returns
half2
- The
subtraction of vector b from a, with respect to saturation.
Description
Subtracts half2 input vector b from input vector a in round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +0.0.