21 #ifndef EIGEN_INTEROP_HEADERS_SYCL_H
22 #define EIGEN_INTEROP_HEADERS_SYCL_H
25 #include "../../InternalHeaderCheck.h"
29 #if !defined(EIGEN_DONT_VECTORIZE_SYCL)
33 template <
int has_blend,
int lengths>
80 #ifdef SYCL_DEVICE_ONLY
81 #define SYCL_PACKET_TRAITS(packet_type, has_blend, unpacket_type, lengths) \
83 struct packet_traits<unpacket_type> : sycl_packet_traits<has_blend, lengths> { \
84 typedef packet_type type; \
85 typedef packet_type half; \
88 SYCL_PACKET_TRAITS(cl::sycl::cl_half8, 1,
Eigen::half, 8)
89 SYCL_PACKET_TRAITS(cl::sycl::cl_half8, 1, const
Eigen::
half, 8)
90 SYCL_PACKET_TRAITS(cl::sycl::cl_float4, 1,
float, 4)
91 SYCL_PACKET_TRAITS(cl::sycl::cl_float4, 1, const
float, 4)
92 SYCL_PACKET_TRAITS(cl::sycl::cl_double2, 0,
double, 2)
93 SYCL_PACKET_TRAITS(cl::sycl::cl_double2, 0, const
double, 2)
94 #undef SYCL_PACKET_TRAITS
99 #define SYCL_ARITHMETIC(packet_type) \
101 struct is_arithmetic<packet_type> { \
102 enum { value = true }; \
104 SYCL_ARITHMETIC(cl::sycl::cl_half8)
105 SYCL_ARITHMETIC(cl::sycl::cl_float4)
106 SYCL_ARITHMETIC(cl::sycl::cl_double2)
107 #undef SYCL_ARITHMETIC
109 #define SYCL_UNPACKET_TRAITS(packet_type, unpacket_type, lengths) \
111 struct unpacket_traits<packet_type> { \
112 typedef unpacket_type type; \
113 enum { size = lengths, vectorizable = true, alignment = Aligned16 }; \
114 typedef packet_type half; \
116 SYCL_UNPACKET_TRAITS(cl::sycl::cl_half8,
Eigen::half, 8)
117 SYCL_UNPACKET_TRAITS(cl::sycl::cl_float4,
float, 4)
118 SYCL_UNPACKET_TRAITS(cl::sycl::cl_double2,
double, 2)
120 #undef SYCL_UNPACKET_TRAITS
127 namespace TensorSycl {
130 template <
typename PacketReturnType,
int PacketSize>
133 #ifndef SYCL_DEVICE_ONLY
134 template <
typename PacketReturnType,
int PacketSize>
137 template <
typename Index>
139 eigen_assert(
false &&
"THERE IS NO PACKETIZE VERSION FOR THE CHOSEN TYPE");
143 return ::Eigen::internal::template plset<PacketReturnType>(in);
146 eigen_assert(
false &&
"THERE IS NO PACKETIZE VERSION FOR THE CHOSEN TYPE");
151 #elif defined(SYCL_DEVICE_ONLY)
152 template <
typename PacketReturnType>
153 struct PacketWrapper<PacketReturnType, 4> {
155 template <
typename Index>
169 __builtin_unreachable();
171 __builtin_unreachable();
175 return PacketReturnType(in, other, other, other);
178 lhs = PacketReturnType(rhs[0], rhs[1], rhs[2], rhs[3]);
182 template <
typename PacketReturnType>
183 struct PacketWrapper<PacketReturnType, 1> {
185 template <
typename Index>
190 return PacketReturnType(in);
195 template <
typename PacketReturnType>
196 struct PacketWrapper<PacketReturnType, 2> {
198 template <
typename Index>
208 __builtin_unreachable();
210 __builtin_unreachable();
214 return PacketReturnType(in, other);
217 lhs = PacketReturnType(rhs[0], rhs[1]);
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
SCALAR Scalar
Definition: bench_gemm.cpp:45
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
Definition: InteropHeaders.h:135
::Eigen::internal::unpacket_traits< PacketReturnType >::type Scalar
Definition: InteropHeaders.h:136
static EIGEN_DEVICE_FUNC void set_packet(PacketReturnType, Scalar *)
Definition: InteropHeaders.h:145
static EIGEN_DEVICE_FUNC PacketReturnType convert_to_packet_type(Scalar in, Scalar)
Definition: InteropHeaders.h:142
static EIGEN_DEVICE_FUNC Scalar scalarize(Index, PacketReturnType &)
Definition: InteropHeaders.h:138
Definition: GenericPacketMath.h:45
Definition: InteropHeaders.h:34
@ HasCmp
Definition: InteropHeaders.h:66
@ HasIGammac
Definition: InteropHeaders.h:61
@ HasExp
Definition: InteropHeaders.h:41
@ HasSin
Definition: InteropHeaders.h:44
@ HasErfc
Definition: InteropHeaders.h:58
@ HasFloor
Definition: InteropHeaders.h:71
@ HasLGamma
Definition: InteropHeaders.h:53
@ HasMul
Definition: InteropHeaders.h:69
@ HasDiGamma
Definition: InteropHeaders.h:54
@ HasSqrt
Definition: InteropHeaders.h:42
@ HasLog1p
Definition: InteropHeaders.h:74
@ HasRsqrt
Definition: InteropHeaders.h:43
@ HasErf
Definition: InteropHeaders.h:57
@ HasZeta
Definition: InteropHeaders.h:55
@ HasIGamma
Definition: InteropHeaders.h:60
@ HasACos
Definition: InteropHeaders.h:48
@ HasAdd
Definition: InteropHeaders.h:70
@ HasTan
Definition: InteropHeaders.h:46
@ Vectorizable
Definition: InteropHeaders.h:36
@ HasATan
Definition: InteropHeaders.h:49
@ HasBlend
Definition: InteropHeaders.h:63
@ HasCosh
Definition: InteropHeaders.h:51
@ HasMin
Definition: InteropHeaders.h:68
@ AlignedOnScalar
Definition: InteropHeaders.h:37
@ HasBetaInc
Definition: InteropHeaders.h:62
@ HasRound
Definition: InteropHeaders.h:72
@ HasSinh
Definition: InteropHeaders.h:50
@ HasPolygamma
Definition: InteropHeaders.h:56
@ HasExpm1
Definition: InteropHeaders.h:75
@ HasTanh
Definition: InteropHeaders.h:52
@ HasLog
Definition: InteropHeaders.h:40
@ size
Definition: InteropHeaders.h:38
@ HasMax
Definition: InteropHeaders.h:67
@ HasNdtri
Definition: InteropHeaders.h:59
@ HasDiv
Definition: InteropHeaders.h:39
@ HasCeil
Definition: InteropHeaders.h:76
@ HasASin
Definition: InteropHeaders.h:47
@ HasCos
Definition: InteropHeaders.h:45
@ HasRint
Definition: InteropHeaders.h:73
Definition: ZVector/PacketMath.h:50