10 #ifndef EIGEN_TYPE_CASTING_GPU_H
11 #define EIGEN_TYPE_CASTING_GPU_H
14 #include "../../InternalHeaderCheck.h"
20 #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300) || \
21 (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE))
24 struct type_casting_traits<
Eigen::half, float> {
30 float2 r1 = __half22float2(
a);
31 float2 r2 = __half22float2(
b);
32 return make_float4(r1.x, r1.y, r2.x, r2.y);
38 half2* r_alias =
reinterpret_cast<half2*
>(&
r);
39 r_alias[0] = __floats2half2_rn(
a.x,
a.y);
40 r_alias[1] = __floats2half2_rn(
a.z,
a.w);
41 r_alias[2] = __floats2half2_rn(
b.x,
b.y);
42 r_alias[3] = __floats2half2_rn(
b.z,
b.w);
47 struct type_casting_traits<float,
Eigen::half> {
55 const half2* a_alias =
reinterpret_cast<const half2*
>(&
a);
56 float2 r1 = __half22float2(a_alias[0]);
57 float2 r2 = __half22float2(a_alias[1]);
58 r.x =
static_cast<float>(r1.x);
59 r.y =
static_cast<float>(r1.y);
60 r.z =
static_cast<float>(r2.x);
61 r.w =
static_cast<float>(r2.y);
68 return __floats2half2_rn(
a.x,
a.y);
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
Scalar * b
Definition: benchVecAdd.cpp:17
const Scalar * a
Definition: level2_cplx_impl.h:32
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
Definition: Eigen_Colamd.h:49
@ TgtCoeffRatio
Definition: GenericPacketMath.h:206
@ VectorizedCast
Definition: GenericPacketMath.h:203
@ SrcCoeffRatio
Definition: GenericPacketMath.h:205