21#ifndef EIGEN_INTEROP_HEADERS_SYCL_H
22#define EIGEN_INTEROP_HEADERS_SYCL_H
26#if !defined(EIGEN_DONT_VECTORIZE_SYCL)
30template <
int has_blend,
int lengths>
78#ifdef SYCL_DEVICE_ONLY
79#define SYCL_PACKET_TRAITS(packet_type, has_blend, unpacket_type, lengths) \
81 struct packet_traits<unpacket_type> \
82 : sycl_packet_traits<has_blend, lengths> { \
83 typedef packet_type type; \
84 typedef packet_type half; \
87SYCL_PACKET_TRAITS(cl::sycl::cl_float4, 1,
float, 4)
88SYCL_PACKET_TRAITS(
cl::sycl::cl_float4, 1, const
float, 4)
89SYCL_PACKET_TRAITS(
cl::sycl::cl_double2, 0,
double, 2)
90SYCL_PACKET_TRAITS(
cl::sycl::cl_double2, 0, const
double, 2)
91#undef SYCL_PACKET_TRAITS
96#define SYCL_ARITHMETIC(packet_type) \
98 struct is_arithmetic<packet_type> { \
99 enum { value = true }; \
101SYCL_ARITHMETIC(cl::sycl::cl_float4)
102SYCL_ARITHMETIC(cl::sycl::cl_double2)
103#undef SYCL_ARITHMETIC
105#define SYCL_UNPACKET_TRAITS(packet_type, unpacket_type, lengths) \
107 struct unpacket_traits<packet_type> { \
108 typedef unpacket_type type; \
109 enum { size = lengths, vectorizable = true, alignment = Aligned16 }; \
110 typedef packet_type half; \
112SYCL_UNPACKET_TRAITS(cl::sycl::cl_float4,
float, 4)
113SYCL_UNPACKET_TRAITS(
cl::sycl::cl_double2,
double, 2)
115#undef SYCL_UNPACKET_TRAITS
122namespace TensorSycl {
125template <
typename PacketReturnType,
int PacketSize>
128#ifndef SYCL_DEVICE_ONLY
129template <
typename PacketReturnType,
int PacketSize>
131 typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type
133 template <
typename Index>
135 eigen_assert(
false &&
"THERE IS NO PACKETIZE VERSION FOR THE CHOSEN TYPE");
140 return ::Eigen::internal::template plset<PacketReturnType>(in);
143 eigen_assert(
false &&
"THERE IS NO PACKETIZE VERSION FOR THE CHOSEN TYPE");
148#elif defined(SYCL_DEVICE_ONLY)
149template <
typename PacketReturnType>
150struct PacketWrapper<PacketReturnType, 4> {
151 typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type
153 template <
typename Index>
167 __builtin_unreachable();
169 __builtin_unreachable();
174 return PacketReturnType(in, other, other, other);
177 lhs = PacketReturnType(rhs[0], rhs[1], rhs[2], rhs[3]);
181template <
typename PacketReturnType>
182struct PacketWrapper<PacketReturnType, 1> {
183 typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type
185 template <
typename Index>
191 return PacketReturnType(in);
198template <
typename PacketReturnType>
199struct PacketWrapper<PacketReturnType, 2> {
200 typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type
202 template <
typename Index>
212 __builtin_unreachable();
214 __builtin_unreachable();
219 return PacketReturnType(in, other);
222 lhs = PacketReturnType(rhs[0], rhs[1]);
#define EIGEN_DEVICE_FUNC
Definition Macros.h:976
#define eigen_assert(x)
Definition Macros.h:1037
#define EIGEN_STRONG_INLINE
Definition Macros.h:917
SCALAR Scalar
Definition bench_gemm.cpp:46
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Definition cxx11_tensor_builtins_sycl.cpp:30
Definition BandTriangularSolver.h:13
Definition InteropHeaders.h:130
::Eigen::internal::unpacket_traits< PacketReturnType >::type Scalar
Definition InteropHeaders.h:132
static EIGEN_DEVICE_FUNC void set_packet(PacketReturnType, Scalar *)
Definition InteropHeaders.h:142
static EIGEN_DEVICE_FUNC PacketReturnType convert_to_packet_type(Scalar in, Scalar)
Definition InteropHeaders.h:138
static EIGEN_DEVICE_FUNC Scalar scalarize(Index, PacketReturnType &)
Definition InteropHeaders.h:134
Definition GenericPacketMath.h:43
Definition InteropHeaders.h:31
@ HasHalfPacket
Definition InteropHeaders.h:36
@ HasCmp
Definition InteropHeaders.h:64
@ HasIGammac
Definition InteropHeaders.h:59
@ HasExp
Definition InteropHeaders.h:39
@ HasSin
Definition InteropHeaders.h:42
@ HasErfc
Definition InteropHeaders.h:56
@ HasFloor
Definition InteropHeaders.h:69
@ HasLGamma
Definition InteropHeaders.h:51
@ HasMul
Definition InteropHeaders.h:67
@ HasDiGamma
Definition InteropHeaders.h:52
@ HasSqrt
Definition InteropHeaders.h:40
@ HasLog1p
Definition InteropHeaders.h:72
@ HasRsqrt
Definition InteropHeaders.h:41
@ HasErf
Definition InteropHeaders.h:55
@ HasZeta
Definition InteropHeaders.h:53
@ HasIGamma
Definition InteropHeaders.h:58
@ HasACos
Definition InteropHeaders.h:46
@ HasAdd
Definition InteropHeaders.h:68
@ HasTan
Definition InteropHeaders.h:44
@ Vectorizable
Definition InteropHeaders.h:33
@ HasATan
Definition InteropHeaders.h:47
@ HasBlend
Definition InteropHeaders.h:61
@ HasCosh
Definition InteropHeaders.h:49
@ HasMin
Definition InteropHeaders.h:66
@ AlignedOnScalar
Definition InteropHeaders.h:34
@ HasBetaInc
Definition InteropHeaders.h:60
@ HasRound
Definition InteropHeaders.h:70
@ HasSinh
Definition InteropHeaders.h:48
@ HasPolygamma
Definition InteropHeaders.h:54
@ HasExpm1
Definition InteropHeaders.h:73
@ HasTanh
Definition InteropHeaders.h:50
@ HasLog
Definition InteropHeaders.h:38
@ size
Definition InteropHeaders.h:35
@ HasMax
Definition InteropHeaders.h:65
@ HasNdtri
Definition InteropHeaders.h:57
@ HasDiv
Definition InteropHeaders.h:37
@ HasCeil
Definition InteropHeaders.h:74
@ HasASin
Definition InteropHeaders.h:45
@ HasCos
Definition InteropHeaders.h:43
@ HasRint
Definition InteropHeaders.h:71
Definition ForwardDeclarations.h:17