21 #ifndef EIGEN_INTEROP_HEADERS_SYCL_H
22 #define EIGEN_INTEROP_HEADERS_SYCL_H
26 #if !defined(EIGEN_DONT_VECTORIZE_SYCL)
30 template <
int has_blend,
int lengths>
31 struct sycl_packet_traits : default_packet_traits {
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; \
87 SYCL_PACKET_TRAITS(cl::sycl::cl_float4, 1,
float, 4)
88 SYCL_PACKET_TRAITS(
cl::sycl::cl_float4, 1, const
float, 4)
89 SYCL_PACKET_TRAITS(
cl::sycl::cl_double2, 0,
double, 2)
90 SYCL_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 }; \
101 SYCL_ARITHMETIC(cl::sycl::cl_float4)
102 SYCL_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; \
112 SYCL_UNPACKET_TRAITS(cl::sycl::cl_float4,
float, 4)
113 SYCL_UNPACKET_TRAITS(
cl::sycl::cl_double2,
double, 2)
115 #undef SYCL_UNPACKET_TRAITS
122 namespace TensorSycl {
125 template <
typename PacketReturnType,
int PacketSize>
126 struct PacketWrapper;
128 #ifndef SYCL_DEVICE_ONLY
129 template <
typename PacketReturnType,
int PacketSize>
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)
149 template <
typename PacketReturnType>
153 template <
typename Index>
167 __builtin_unreachable();
169 __builtin_unreachable();
177 lhs = PacketReturnType(rhs[0], rhs[1], rhs[2], rhs[3]);
181 template <
typename PacketReturnType>
185 template <
typename Index>
191 return PacketReturnType(in);
198 template <
typename PacketReturnType>
199 struct PacketWrapper<PacketReturnType, 2> {
202 template <
typename Index>
212 __builtin_unreachable();
214 __builtin_unreachable();
219 return PacketReturnType(in,
other);
222 lhs = PacketReturnType(rhs[0], rhs[1]);
232 #endif // EIGEN_INTEROP_HEADERS_SYCL_H