mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Apply clang-format
This commit is contained in:
@@ -78,12 +78,11 @@ struct sycl_packet_traits : default_packet_traits {
|
||||
};
|
||||
|
||||
#ifdef SYCL_DEVICE_ONLY
|
||||
#define SYCL_PACKET_TRAITS(packet_type, has_blend, unpacket_type, lengths) \
|
||||
template <> \
|
||||
struct packet_traits<unpacket_type> \
|
||||
: sycl_packet_traits<has_blend, lengths> { \
|
||||
typedef packet_type type; \
|
||||
typedef packet_type half; \
|
||||
#define SYCL_PACKET_TRAITS(packet_type, has_blend, unpacket_type, lengths) \
|
||||
template <> \
|
||||
struct packet_traits<unpacket_type> : sycl_packet_traits<has_blend, lengths> { \
|
||||
typedef packet_type type; \
|
||||
typedef packet_type half; \
|
||||
};
|
||||
|
||||
SYCL_PACKET_TRAITS(cl::sycl::cl_half8, 1, Eigen::half, 8)
|
||||
@@ -134,15 +133,13 @@ struct PacketWrapper;
|
||||
#ifndef SYCL_DEVICE_ONLY
|
||||
template <typename PacketReturnType, int PacketSize>
|
||||
struct PacketWrapper {
|
||||
typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type
|
||||
Scalar;
|
||||
typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type Scalar;
|
||||
template <typename Index>
|
||||
EIGEN_DEVICE_FUNC static Scalar scalarize(Index, PacketReturnType &) {
|
||||
eigen_assert(false && "THERE IS NO PACKETIZE VERSION FOR THE CHOSEN TYPE");
|
||||
abort();
|
||||
}
|
||||
EIGEN_DEVICE_FUNC static PacketReturnType convert_to_packet_type(Scalar in,
|
||||
Scalar) {
|
||||
EIGEN_DEVICE_FUNC static PacketReturnType convert_to_packet_type(Scalar in, Scalar) {
|
||||
return ::Eigen::internal::template plset<PacketReturnType>(in);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC static void set_packet(PacketReturnType, Scalar *) {
|
||||
@@ -154,8 +151,7 @@ struct PacketWrapper {
|
||||
#elif defined(SYCL_DEVICE_ONLY)
|
||||
template <typename PacketReturnType>
|
||||
struct PacketWrapper<PacketReturnType, 4> {
|
||||
typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type
|
||||
Scalar;
|
||||
typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type Scalar;
|
||||
template <typename Index>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static Scalar scalarize(Index index, PacketReturnType &in) {
|
||||
switch (index) {
|
||||
@@ -168,15 +164,14 @@ struct PacketWrapper<PacketReturnType, 4> {
|
||||
case 3:
|
||||
return in.w();
|
||||
default:
|
||||
//INDEX MUST BE BETWEEN 0 and 3.There is no abort function in SYCL kernel. so we cannot use abort here.
|
||||
// The code will never reach here
|
||||
__builtin_unreachable();
|
||||
// INDEX MUST BE BETWEEN 0 and 3.There is no abort function in SYCL kernel. so we cannot use abort here.
|
||||
// The code will never reach here
|
||||
__builtin_unreachable();
|
||||
}
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static PacketReturnType convert_to_packet_type(
|
||||
Scalar in, Scalar other) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static PacketReturnType convert_to_packet_type(Scalar in, Scalar other) {
|
||||
return PacketReturnType(in, other, other, other);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static void set_packet(PacketReturnType &lhs, Scalar *rhs) {
|
||||
@@ -186,25 +181,20 @@ struct PacketWrapper<PacketReturnType, 4> {
|
||||
|
||||
template <typename PacketReturnType>
|
||||
struct PacketWrapper<PacketReturnType, 1> {
|
||||
typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type
|
||||
Scalar;
|
||||
typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type Scalar;
|
||||
template <typename Index>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static Scalar scalarize(Index, PacketReturnType &in) {
|
||||
return in;
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static PacketReturnType convert_to_packet_type(Scalar in,
|
||||
Scalar) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static PacketReturnType convert_to_packet_type(Scalar in, Scalar) {
|
||||
return PacketReturnType(in);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static void set_packet(PacketReturnType &lhs, Scalar *rhs) {
|
||||
lhs = rhs[0];
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static void set_packet(PacketReturnType &lhs, Scalar *rhs) { lhs = rhs[0]; }
|
||||
};
|
||||
|
||||
template <typename PacketReturnType>
|
||||
struct PacketWrapper<PacketReturnType, 2> {
|
||||
typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type
|
||||
Scalar;
|
||||
typedef typename ::Eigen::internal::unpacket_traits<PacketReturnType>::type Scalar;
|
||||
template <typename Index>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static Scalar scalarize(Index index, PacketReturnType &in) {
|
||||
switch (index) {
|
||||
@@ -213,15 +203,14 @@ struct PacketWrapper<PacketReturnType, 2> {
|
||||
case 1:
|
||||
return in.y();
|
||||
default:
|
||||
//INDEX MUST BE BETWEEN 0 and 1.There is no abort function in SYCL kernel. so we cannot use abort here.
|
||||
// The code will never reach here
|
||||
// INDEX MUST BE BETWEEN 0 and 1.There is no abort function in SYCL kernel. so we cannot use abort here.
|
||||
// The code will never reach here
|
||||
__builtin_unreachable();
|
||||
}
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static PacketReturnType convert_to_packet_type(
|
||||
Scalar in, Scalar other) {
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static PacketReturnType convert_to_packet_type(Scalar in, Scalar other) {
|
||||
return PacketReturnType(in, other);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static void set_packet(PacketReturnType &lhs, Scalar *rhs) {
|
||||
|
||||
@@ -31,11 +31,10 @@ namespace internal {
|
||||
// introduce conflicts between these packet_traits definitions and the ones
|
||||
// we'll use on the host side (SSE, AVX, ...)
|
||||
#if defined(SYCL_DEVICE_ONLY)
|
||||
#define SYCL_PLOG(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type plog<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::log(a); \
|
||||
#define SYCL_PLOG(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type plog<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::log(a); \
|
||||
}
|
||||
|
||||
SYCL_PLOG(cl::sycl::cl_half8)
|
||||
@@ -43,11 +42,10 @@ SYCL_PLOG(cl::sycl::cl_float4)
|
||||
SYCL_PLOG(cl::sycl::cl_double2)
|
||||
#undef SYCL_PLOG
|
||||
|
||||
#define SYCL_PLOG1P(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type plog1p<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::log1p(a); \
|
||||
#define SYCL_PLOG1P(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type plog1p<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::log1p(a); \
|
||||
}
|
||||
|
||||
SYCL_PLOG1P(cl::sycl::cl_half8)
|
||||
@@ -55,11 +53,10 @@ SYCL_PLOG1P(cl::sycl::cl_float4)
|
||||
SYCL_PLOG1P(cl::sycl::cl_double2)
|
||||
#undef SYCL_PLOG1P
|
||||
|
||||
#define SYCL_PLOG10(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type plog10<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::log10(a); \
|
||||
#define SYCL_PLOG10(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type plog10<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::log10(a); \
|
||||
}
|
||||
|
||||
SYCL_PLOG10(cl::sycl::cl_half8)
|
||||
@@ -67,11 +64,10 @@ SYCL_PLOG10(cl::sycl::cl_float4)
|
||||
SYCL_PLOG10(cl::sycl::cl_double2)
|
||||
#undef SYCL_PLOG10
|
||||
|
||||
#define SYCL_PEXP(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pexp<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::exp(a); \
|
||||
#define SYCL_PEXP(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pexp<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::exp(a); \
|
||||
}
|
||||
|
||||
SYCL_PEXP(cl::sycl::cl_half8)
|
||||
@@ -81,11 +77,10 @@ SYCL_PEXP(cl::sycl::cl_float)
|
||||
SYCL_PEXP(cl::sycl::cl_double2)
|
||||
#undef SYCL_PEXP
|
||||
|
||||
#define SYCL_PEXPM1(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pexpm1<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::expm1(a); \
|
||||
#define SYCL_PEXPM1(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pexpm1<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::expm1(a); \
|
||||
}
|
||||
|
||||
SYCL_PEXPM1(cl::sycl::cl_half8)
|
||||
@@ -93,11 +88,10 @@ SYCL_PEXPM1(cl::sycl::cl_float4)
|
||||
SYCL_PEXPM1(cl::sycl::cl_double2)
|
||||
#undef SYCL_PEXPM1
|
||||
|
||||
#define SYCL_PSQRT(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type psqrt<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::sqrt(a); \
|
||||
#define SYCL_PSQRT(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type psqrt<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::sqrt(a); \
|
||||
}
|
||||
|
||||
SYCL_PSQRT(cl::sycl::cl_half8)
|
||||
@@ -105,11 +99,10 @@ SYCL_PSQRT(cl::sycl::cl_float4)
|
||||
SYCL_PSQRT(cl::sycl::cl_double2)
|
||||
#undef SYCL_PSQRT
|
||||
|
||||
#define SYCL_PRSQRT(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type prsqrt<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::rsqrt(a); \
|
||||
#define SYCL_PRSQRT(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type prsqrt<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::rsqrt(a); \
|
||||
}
|
||||
|
||||
SYCL_PRSQRT(cl::sycl::cl_half8)
|
||||
@@ -118,11 +111,10 @@ SYCL_PRSQRT(cl::sycl::cl_double2)
|
||||
#undef SYCL_PRSQRT
|
||||
|
||||
/** \internal \returns the hyperbolic sine of \a a (coeff-wise) */
|
||||
#define SYCL_PSIN(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type psin<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::sin(a); \
|
||||
#define SYCL_PSIN(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type psin<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::sin(a); \
|
||||
}
|
||||
|
||||
SYCL_PSIN(cl::sycl::cl_half8)
|
||||
@@ -131,11 +123,10 @@ SYCL_PSIN(cl::sycl::cl_double2)
|
||||
#undef SYCL_PSIN
|
||||
|
||||
/** \internal \returns the hyperbolic cosine of \a a (coeff-wise) */
|
||||
#define SYCL_PCOS(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pcos<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::cos(a); \
|
||||
#define SYCL_PCOS(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pcos<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::cos(a); \
|
||||
}
|
||||
|
||||
SYCL_PCOS(cl::sycl::cl_half8)
|
||||
@@ -144,11 +135,10 @@ SYCL_PCOS(cl::sycl::cl_double2)
|
||||
#undef SYCL_PCOS
|
||||
|
||||
/** \internal \returns the hyperbolic tan of \a a (coeff-wise) */
|
||||
#define SYCL_PTAN(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type ptan<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::tan(a); \
|
||||
#define SYCL_PTAN(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type ptan<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::tan(a); \
|
||||
}
|
||||
|
||||
SYCL_PTAN(cl::sycl::cl_half8)
|
||||
@@ -157,11 +147,10 @@ SYCL_PTAN(cl::sycl::cl_double2)
|
||||
#undef SYCL_PTAN
|
||||
|
||||
/** \internal \returns the hyperbolic sine of \a a (coeff-wise) */
|
||||
#define SYCL_PASIN(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pasin<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::asin(a); \
|
||||
#define SYCL_PASIN(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pasin<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::asin(a); \
|
||||
}
|
||||
|
||||
SYCL_PASIN(cl::sycl::cl_half8)
|
||||
@@ -170,11 +159,10 @@ SYCL_PASIN(cl::sycl::cl_double2)
|
||||
#undef SYCL_PASIN
|
||||
|
||||
/** \internal \returns the hyperbolic cosine of \a a (coeff-wise) */
|
||||
#define SYCL_PACOS(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pacos<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::acos(a); \
|
||||
#define SYCL_PACOS(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pacos<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::acos(a); \
|
||||
}
|
||||
|
||||
SYCL_PACOS(cl::sycl::cl_half8)
|
||||
@@ -183,11 +171,10 @@ SYCL_PACOS(cl::sycl::cl_double2)
|
||||
#undef SYCL_PACOS
|
||||
|
||||
/** \internal \returns the hyperbolic tan of \a a (coeff-wise) */
|
||||
#define SYCL_PATAN(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type patan<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::atan(a); \
|
||||
#define SYCL_PATAN(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type patan<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::atan(a); \
|
||||
}
|
||||
|
||||
SYCL_PATAN(cl::sycl::cl_half8)
|
||||
@@ -196,11 +183,10 @@ SYCL_PATAN(cl::sycl::cl_double2)
|
||||
#undef SYCL_PATAN
|
||||
|
||||
/** \internal \returns the hyperbolic sine of \a a (coeff-wise) */
|
||||
#define SYCL_PSINH(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type psinh<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::sinh(a); \
|
||||
#define SYCL_PSINH(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type psinh<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::sinh(a); \
|
||||
}
|
||||
|
||||
SYCL_PSINH(cl::sycl::cl_half8)
|
||||
@@ -209,11 +195,10 @@ SYCL_PSINH(cl::sycl::cl_double2)
|
||||
#undef SYCL_PSINH
|
||||
|
||||
/** \internal \returns the hyperbolic cosine of \a a (coeff-wise) */
|
||||
#define SYCL_PCOSH(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pcosh<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::cosh(a); \
|
||||
#define SYCL_PCOSH(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pcosh<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::cosh(a); \
|
||||
}
|
||||
|
||||
SYCL_PCOSH(cl::sycl::cl_half8)
|
||||
@@ -222,11 +207,10 @@ SYCL_PCOSH(cl::sycl::cl_double2)
|
||||
#undef SYCL_PCOSH
|
||||
|
||||
/** \internal \returns the hyperbolic tan of \a a (coeff-wise) */
|
||||
#define SYCL_PTANH(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type ptanh<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::tanh(a); \
|
||||
#define SYCL_PTANH(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type ptanh<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::tanh(a); \
|
||||
}
|
||||
|
||||
SYCL_PTANH(cl::sycl::cl_half8)
|
||||
@@ -234,11 +218,10 @@ SYCL_PTANH(cl::sycl::cl_float4)
|
||||
SYCL_PTANH(cl::sycl::cl_double2)
|
||||
#undef SYCL_PTANH
|
||||
|
||||
#define SYCL_PCEIL(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pceil<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::ceil(a); \
|
||||
#define SYCL_PCEIL(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pceil<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::ceil(a); \
|
||||
}
|
||||
|
||||
SYCL_PCEIL(cl::sycl::cl_half)
|
||||
@@ -246,11 +229,10 @@ SYCL_PCEIL(cl::sycl::cl_float4)
|
||||
SYCL_PCEIL(cl::sycl::cl_double2)
|
||||
#undef SYCL_PCEIL
|
||||
|
||||
#define SYCL_PROUND(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pround<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::round(a); \
|
||||
#define SYCL_PROUND(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pround<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::round(a); \
|
||||
}
|
||||
|
||||
SYCL_PROUND(cl::sycl::cl_half8)
|
||||
@@ -258,11 +240,10 @@ SYCL_PROUND(cl::sycl::cl_float4)
|
||||
SYCL_PROUND(cl::sycl::cl_double2)
|
||||
#undef SYCL_PROUND
|
||||
|
||||
#define SYCL_PRINT(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type print<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::rint(a); \
|
||||
#define SYCL_PRINT(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type print<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::rint(a); \
|
||||
}
|
||||
|
||||
SYCL_PRINT(cl::sycl::cl_half8)
|
||||
@@ -270,11 +251,10 @@ SYCL_PRINT(cl::sycl::cl_float4)
|
||||
SYCL_PRINT(cl::sycl::cl_double2)
|
||||
#undef SYCL_PRINT
|
||||
|
||||
#define SYCL_FLOOR(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pfloor<packet_type>( \
|
||||
const packet_type& a) { \
|
||||
return cl::sycl::floor(a); \
|
||||
#define SYCL_FLOOR(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pfloor<packet_type>(const packet_type& a) { \
|
||||
return cl::sycl::floor(a); \
|
||||
}
|
||||
|
||||
SYCL_FLOOR(cl::sycl::cl_half8)
|
||||
@@ -282,11 +262,10 @@ SYCL_FLOOR(cl::sycl::cl_float4)
|
||||
SYCL_FLOOR(cl::sycl::cl_double2)
|
||||
#undef SYCL_FLOOR
|
||||
|
||||
#define SYCL_PMIN(packet_type, expr) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pmin<packet_type>( \
|
||||
const packet_type& a, const packet_type& b) { \
|
||||
return expr; \
|
||||
#define SYCL_PMIN(packet_type, expr) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pmin<packet_type>(const packet_type& a, const packet_type& b) { \
|
||||
return expr; \
|
||||
}
|
||||
|
||||
SYCL_PMIN(cl::sycl::cl_half8, cl::sycl::fmin(a, b))
|
||||
@@ -294,11 +273,10 @@ SYCL_PMIN(cl::sycl::cl_float4, cl::sycl::fmin(a, b))
|
||||
SYCL_PMIN(cl::sycl::cl_double2, cl::sycl::fmin(a, b))
|
||||
#undef SYCL_PMIN
|
||||
|
||||
#define SYCL_PMAX(packet_type, expr) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pmax<packet_type>( \
|
||||
const packet_type& a, const packet_type& b) { \
|
||||
return expr; \
|
||||
#define SYCL_PMAX(packet_type, expr) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pmax<packet_type>(const packet_type& a, const packet_type& b) { \
|
||||
return expr; \
|
||||
}
|
||||
|
||||
SYCL_PMAX(cl::sycl::cl_half8, cl::sycl::fmax(a, b))
|
||||
@@ -306,13 +284,10 @@ SYCL_PMAX(cl::sycl::cl_float4, cl::sycl::fmax(a, b))
|
||||
SYCL_PMAX(cl::sycl::cl_double2, cl::sycl::fmax(a, b))
|
||||
#undef SYCL_PMAX
|
||||
|
||||
#define SYCL_PLDEXP(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pldexp( \
|
||||
const packet_type& a, const packet_type& exponent) { \
|
||||
return cl::sycl::ldexp( \
|
||||
a, exponent.template convert<cl::sycl::cl_int, \
|
||||
cl::sycl::rounding_mode::automatic>()); \
|
||||
#define SYCL_PLDEXP(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pldexp(const packet_type& a, const packet_type& exponent) { \
|
||||
return cl::sycl::ldexp(a, exponent.template convert<cl::sycl::cl_int, cl::sycl::rounding_mode::automatic>()); \
|
||||
}
|
||||
|
||||
SYCL_PLDEXP(cl::sycl::cl_half8)
|
||||
|
||||
@@ -29,15 +29,16 @@ namespace Eigen {
|
||||
|
||||
namespace internal {
|
||||
#ifdef SYCL_DEVICE_ONLY
|
||||
#define SYCL_PLOAD(packet_type, AlignedType) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE packet_type \
|
||||
pload##AlignedType<packet_type>( \
|
||||
const typename unpacket_traits<packet_type>::type* from) { \
|
||||
auto ptr = cl::sycl::address_space_cast<cl::sycl::access::address_space::generic_space, cl::sycl::access::decorated::no>(from);\
|
||||
packet_type res{}; \
|
||||
res.load(0, ptr); \
|
||||
return res; \
|
||||
#define SYCL_PLOAD(packet_type, AlignedType) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE packet_type pload##AlignedType<packet_type>( \
|
||||
const typename unpacket_traits<packet_type>::type* from) { \
|
||||
auto ptr = \
|
||||
cl::sycl::address_space_cast<cl::sycl::access::address_space::generic_space, cl::sycl::access::decorated::no>( \
|
||||
from); \
|
||||
packet_type res{}; \
|
||||
res.load(0, ptr); \
|
||||
return res; \
|
||||
}
|
||||
|
||||
SYCL_PLOAD(cl::sycl::cl_float4, u)
|
||||
@@ -47,37 +48,34 @@ SYCL_PLOAD(cl::sycl::cl_double2, )
|
||||
#undef SYCL_PLOAD
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_half8
|
||||
pload<cl::sycl::cl_half8>(
|
||||
const typename unpacket_traits<cl::sycl::cl_half8>::type* from) {
|
||||
auto ptr = cl::sycl::address_space_cast<
|
||||
cl::sycl::access::address_space::generic_space,
|
||||
cl::sycl::access::decorated::no>(
|
||||
reinterpret_cast<const cl::sycl::cl_half*>(from));
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_half8 pload<cl::sycl::cl_half8>(
|
||||
const typename unpacket_traits<cl::sycl::cl_half8>::type* from) {
|
||||
auto ptr =
|
||||
cl::sycl::address_space_cast<cl::sycl::access::address_space::generic_space, cl::sycl::access::decorated::no>(
|
||||
reinterpret_cast<const cl::sycl::cl_half*>(from));
|
||||
cl::sycl::cl_half8 res{};
|
||||
res.load(0, ptr);
|
||||
return res;
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_half8
|
||||
ploadu<cl::sycl::cl_half8>(
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_half8 ploadu<cl::sycl::cl_half8>(
|
||||
const typename unpacket_traits<cl::sycl::cl_half8>::type* from) {
|
||||
auto ptr = cl::sycl::address_space_cast<
|
||||
cl::sycl::access::address_space::generic_space,
|
||||
cl::sycl::access::decorated::no>(
|
||||
reinterpret_cast<const cl::sycl::cl_half*>(from));
|
||||
auto ptr =
|
||||
cl::sycl::address_space_cast<cl::sycl::access::address_space::generic_space, cl::sycl::access::decorated::no>(
|
||||
reinterpret_cast<const cl::sycl::cl_half*>(from));
|
||||
cl::sycl::cl_half8 res{};
|
||||
res.load(0, ptr);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define SYCL_PSTORE(scalar, packet_type, alignment) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstore##alignment( \
|
||||
scalar* to, const packet_type& from) { \
|
||||
auto ptr = cl::sycl::address_space_cast<cl::sycl::access::address_space::generic_space, cl::sycl::access::decorated::no>(to);\
|
||||
from.store(0, ptr); \
|
||||
#define SYCL_PSTORE(scalar, packet_type, alignment) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstore##alignment(scalar* to, const packet_type& from) { \
|
||||
auto ptr = \
|
||||
cl::sycl::address_space_cast<cl::sycl::access::address_space::generic_space, cl::sycl::access::decorated::no>( \
|
||||
to); \
|
||||
from.store(0, ptr); \
|
||||
}
|
||||
|
||||
SYCL_PSTORE(float, cl::sycl::cl_float4, )
|
||||
@@ -87,22 +85,18 @@ SYCL_PSTORE(double, cl::sycl::cl_double2, u)
|
||||
#undef SYCL_PSTORE
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoreu(
|
||||
Eigen::half* to, const cl::sycl::cl_half8& from) {
|
||||
auto ptr = cl::sycl::address_space_cast<
|
||||
cl::sycl::access::address_space::generic_space,
|
||||
cl::sycl::access::decorated::no>(
|
||||
reinterpret_cast<cl::sycl::cl_half*>(to));
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoreu(Eigen::half* to, const cl::sycl::cl_half8& from) {
|
||||
auto ptr =
|
||||
cl::sycl::address_space_cast<cl::sycl::access::address_space::generic_space, cl::sycl::access::decorated::no>(
|
||||
reinterpret_cast<cl::sycl::cl_half*>(to));
|
||||
from.store(0, ptr);
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstore(
|
||||
Eigen::half* to, const cl::sycl::cl_half8& from) {
|
||||
auto ptr = cl::sycl::address_space_cast<
|
||||
cl::sycl::access::address_space::generic_space,
|
||||
cl::sycl::access::decorated::no>(
|
||||
reinterpret_cast<cl::sycl::cl_half*>(to));
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstore(Eigen::half* to, const cl::sycl::cl_half8& from) {
|
||||
auto ptr =
|
||||
cl::sycl::address_space_cast<cl::sycl::access::address_space::generic_space, cl::sycl::access::decorated::no>(
|
||||
reinterpret_cast<cl::sycl::cl_half*>(to));
|
||||
from.store(0, ptr);
|
||||
}
|
||||
|
||||
@@ -123,44 +117,33 @@ SYCL_PSET1(cl::sycl::cl_double2)
|
||||
template <typename packet_type>
|
||||
struct get_base_packet {
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type
|
||||
get_ploaddup(sycl_multi_pointer) {}
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type get_ploaddup(sycl_multi_pointer) {}
|
||||
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type
|
||||
get_pgather(sycl_multi_pointer, Index) {}
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type get_pgather(sycl_multi_pointer, Index) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct get_base_packet<cl::sycl::cl_half8> {
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_half8 get_ploaddup(
|
||||
sycl_multi_pointer from) {
|
||||
return cl::sycl::cl_half8(static_cast<cl::sycl::half>(from[0]),
|
||||
static_cast<cl::sycl::half>(from[0]),
|
||||
static_cast<cl::sycl::half>(from[1]),
|
||||
static_cast<cl::sycl::half>(from[1]),
|
||||
static_cast<cl::sycl::half>(from[2]),
|
||||
static_cast<cl::sycl::half>(from[2]),
|
||||
static_cast<cl::sycl::half>(from[3]),
|
||||
static_cast<cl::sycl::half>(from[3]));
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_half8 get_ploaddup(sycl_multi_pointer from) {
|
||||
return cl::sycl::cl_half8(static_cast<cl::sycl::half>(from[0]), static_cast<cl::sycl::half>(from[0]),
|
||||
static_cast<cl::sycl::half>(from[1]), static_cast<cl::sycl::half>(from[1]),
|
||||
static_cast<cl::sycl::half>(from[2]), static_cast<cl::sycl::half>(from[2]),
|
||||
static_cast<cl::sycl::half>(from[3]), static_cast<cl::sycl::half>(from[3]));
|
||||
}
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_half8 get_pgather(
|
||||
sycl_multi_pointer from, Index stride) {
|
||||
return cl::sycl::cl_half8(static_cast<cl::sycl::half>(from[0 * stride]),
|
||||
static_cast<cl::sycl::half>(from[1 * stride]),
|
||||
static_cast<cl::sycl::half>(from[2 * stride]),
|
||||
static_cast<cl::sycl::half>(from[3 * stride]),
|
||||
static_cast<cl::sycl::half>(from[4 * stride]),
|
||||
static_cast<cl::sycl::half>(from[5 * stride]),
|
||||
static_cast<cl::sycl::half>(from[6 * stride]),
|
||||
static_cast<cl::sycl::half>(from[7 * stride]));
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_half8 get_pgather(sycl_multi_pointer from, Index stride) {
|
||||
return cl::sycl::cl_half8(
|
||||
static_cast<cl::sycl::half>(from[0 * stride]), static_cast<cl::sycl::half>(from[1 * stride]),
|
||||
static_cast<cl::sycl::half>(from[2 * stride]), static_cast<cl::sycl::half>(from[3 * stride]),
|
||||
static_cast<cl::sycl::half>(from[4 * stride]), static_cast<cl::sycl::half>(from[5 * stride]),
|
||||
static_cast<cl::sycl::half>(from[6 * stride]), static_cast<cl::sycl::half>(from[7 * stride]));
|
||||
}
|
||||
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void set_pscatter(
|
||||
sycl_multi_pointer to, const cl::sycl::cl_half8& from, Index stride) {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void set_pscatter(sycl_multi_pointer to, const cl::sycl::cl_half8& from,
|
||||
Index stride) {
|
||||
auto tmp = stride;
|
||||
to[0] = Eigen::half(from.s0());
|
||||
to[tmp] = Eigen::half(from.s1());
|
||||
@@ -171,45 +154,36 @@ struct get_base_packet<cl::sycl::cl_half8> {
|
||||
to[tmp += stride] = Eigen::half(from.s6());
|
||||
to[tmp += stride] = Eigen::half(from.s7());
|
||||
}
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_half8 set_plset(
|
||||
const cl::sycl::half& a) {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_half8 set_plset(const cl::sycl::half& a) {
|
||||
return cl::sycl::cl_half8(static_cast<cl::sycl::half>(a), static_cast<cl::sycl::half>(a + 1),
|
||||
static_cast<cl::sycl::half>(a + 2),
|
||||
static_cast<cl::sycl::half>(a + 3),
|
||||
static_cast<cl::sycl::half>(a + 4),
|
||||
static_cast<cl::sycl::half>(a + 5),
|
||||
static_cast<cl::sycl::half>(a + 6),
|
||||
static_cast<cl::sycl::half>(a + 7));
|
||||
static_cast<cl::sycl::half>(a + 2), static_cast<cl::sycl::half>(a + 3),
|
||||
static_cast<cl::sycl::half>(a + 4), static_cast<cl::sycl::half>(a + 5),
|
||||
static_cast<cl::sycl::half>(a + 6), static_cast<cl::sycl::half>(a + 7));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct get_base_packet<cl::sycl::cl_float4> {
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_float4 get_ploaddup(
|
||||
sycl_multi_pointer from) {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_float4 get_ploaddup(sycl_multi_pointer from) {
|
||||
return cl::sycl::cl_float4(from[0], from[0], from[1], from[1]);
|
||||
}
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_float4 get_pgather(
|
||||
sycl_multi_pointer from, Index stride) {
|
||||
return cl::sycl::cl_float4(from[0 * stride], from[1 * stride],
|
||||
from[2 * stride], from[3 * stride]);
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_float4 get_pgather(sycl_multi_pointer from, Index stride) {
|
||||
return cl::sycl::cl_float4(from[0 * stride], from[1 * stride], from[2 * stride], from[3 * stride]);
|
||||
}
|
||||
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void set_pscatter(
|
||||
sycl_multi_pointer to, const cl::sycl::cl_float4& from, Index stride) {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void set_pscatter(sycl_multi_pointer to, const cl::sycl::cl_float4& from,
|
||||
Index stride) {
|
||||
auto tmp = stride;
|
||||
to[0] = from.x();
|
||||
to[tmp] = from.y();
|
||||
to[tmp += stride] = from.z();
|
||||
to[tmp += stride] = from.w();
|
||||
}
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_float4 set_plset(
|
||||
const float& a) {
|
||||
return cl::sycl::cl_float4(static_cast<float>(a), static_cast<float>(a + 1),
|
||||
static_cast<float>(a + 2),
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_float4 set_plset(const float& a) {
|
||||
return cl::sycl::cl_float4(static_cast<float>(a), static_cast<float>(a + 1), static_cast<float>(a + 2),
|
||||
static_cast<float>(a + 3));
|
||||
}
|
||||
};
|
||||
@@ -217,28 +191,25 @@ struct get_base_packet<cl::sycl::cl_float4> {
|
||||
template <>
|
||||
struct get_base_packet<cl::sycl::cl_double2> {
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_double2
|
||||
get_ploaddup(const sycl_multi_pointer from) {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_double2 get_ploaddup(const sycl_multi_pointer from) {
|
||||
return cl::sycl::cl_double2(from[0], from[0]);
|
||||
}
|
||||
|
||||
template <typename sycl_multi_pointer, typename Index>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_double2 get_pgather(
|
||||
const sycl_multi_pointer from, Index stride) {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_double2 get_pgather(const sycl_multi_pointer from,
|
||||
Index stride) {
|
||||
return cl::sycl::cl_double2(from[0 * stride], from[1 * stride]);
|
||||
}
|
||||
|
||||
template <typename sycl_multi_pointer>
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void set_pscatter(
|
||||
sycl_multi_pointer to, const cl::sycl::cl_double2& from, Index stride) {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void set_pscatter(sycl_multi_pointer to,
|
||||
const cl::sycl::cl_double2& from, Index stride) {
|
||||
to[0] = from.x();
|
||||
to[stride] = from.y();
|
||||
}
|
||||
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_double2 set_plset(
|
||||
const double& a) {
|
||||
return cl::sycl::cl_double2(static_cast<double>(a),
|
||||
static_cast<double>(a + 1));
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE cl::sycl::cl_double2 set_plset(const double& a) {
|
||||
return cl::sycl::cl_double2(static_cast<double>(a), static_cast<double>(a + 1));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -268,15 +239,14 @@ SYCL_PLSET(cl::sycl::cl_double2)
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_half8 plset<cl::sycl::cl_half8>(
|
||||
const typename unpacket_traits<cl::sycl::cl_half8>::type& a) {
|
||||
return get_base_packet<cl::sycl::cl_half8>::set_plset((const cl::sycl::half &) a);
|
||||
return get_base_packet<cl::sycl::cl_half8>::set_plset((const cl::sycl::half&)a);
|
||||
}
|
||||
|
||||
#define SYCL_PGATHER_SPECILIZE(scalar, packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type \
|
||||
pgather<scalar, packet_type>( \
|
||||
const typename unpacket_traits<packet_type>::type* from, Index stride) { \
|
||||
return get_base_packet<packet_type>::get_pgather(from, stride); \
|
||||
#define SYCL_PGATHER_SPECILIZE(scalar, packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pgather<scalar, packet_type>( \
|
||||
const typename unpacket_traits<packet_type>::type* from, Index stride) { \
|
||||
return get_base_packet<packet_type>::get_pgather(from, stride); \
|
||||
}
|
||||
|
||||
SYCL_PGATHER_SPECILIZE(Eigen::half, cl::sycl::cl_half8)
|
||||
@@ -284,12 +254,11 @@ SYCL_PGATHER_SPECILIZE(float, cl::sycl::cl_float4)
|
||||
SYCL_PGATHER_SPECILIZE(double, cl::sycl::cl_double2)
|
||||
#undef SYCL_PGATHER_SPECILIZE
|
||||
|
||||
#define SYCL_PSCATTER_SPECILIZE(scalar, packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void pscatter<scalar, packet_type>( \
|
||||
typename unpacket_traits<packet_type>::type * to, \
|
||||
const packet_type& from, Index stride) { \
|
||||
get_base_packet<packet_type>::set_pscatter(to, from, stride); \
|
||||
#define SYCL_PSCATTER_SPECILIZE(scalar, packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void pscatter<scalar, packet_type>( \
|
||||
typename unpacket_traits<packet_type>::type * to, const packet_type& from, Index stride) { \
|
||||
get_base_packet<packet_type>::set_pscatter(to, from, stride); \
|
||||
}
|
||||
|
||||
SYCL_PSCATTER_SPECILIZE(Eigen::half, cl::sycl::cl_half8)
|
||||
@@ -298,11 +267,11 @@ SYCL_PSCATTER_SPECILIZE(double, cl::sycl::cl_double2)
|
||||
|
||||
#undef SYCL_PSCATTER_SPECILIZE
|
||||
|
||||
#define SYCL_PMAD(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE packet_type pmadd( \
|
||||
const packet_type& a, const packet_type& b, const packet_type& c) { \
|
||||
return cl::sycl::mad(a, b, c); \
|
||||
#define SYCL_PMAD(packet_type) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE packet_type pmadd(const packet_type& a, const packet_type& b, \
|
||||
const packet_type& c) { \
|
||||
return cl::sycl::mad(a, b, c); \
|
||||
}
|
||||
|
||||
SYCL_PMAD(cl::sycl::cl_half8)
|
||||
@@ -311,146 +280,109 @@ SYCL_PMAD(cl::sycl::cl_double2)
|
||||
#undef SYCL_PMAD
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half pfirst<cl::sycl::cl_half8>(
|
||||
const cl::sycl::cl_half8& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half pfirst<cl::sycl::cl_half8>(const cl::sycl::cl_half8& a) {
|
||||
return Eigen::half(a.s0());
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float pfirst<cl::sycl::cl_float4>(
|
||||
const cl::sycl::cl_float4& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float pfirst<cl::sycl::cl_float4>(const cl::sycl::cl_float4& a) {
|
||||
return a.x();
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double pfirst<cl::sycl::cl_double2>(
|
||||
const cl::sycl::cl_double2& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double pfirst<cl::sycl::cl_double2>(const cl::sycl::cl_double2& a) {
|
||||
return a.x();
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half predux<cl::sycl::cl_half8>(
|
||||
const cl::sycl::cl_half8& a) {
|
||||
return Eigen::half(a.s0() + a.s1() + a.s2() + a.s3() + a.s4() + a.s5()
|
||||
+ a.s6() + a.s7());
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half predux<cl::sycl::cl_half8>(const cl::sycl::cl_half8& a) {
|
||||
return Eigen::half(a.s0() + a.s1() + a.s2() + a.s3() + a.s4() + a.s5() + a.s6() + a.s7());
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float predux<cl::sycl::cl_float4>(
|
||||
const cl::sycl::cl_float4& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float predux<cl::sycl::cl_float4>(const cl::sycl::cl_float4& a) {
|
||||
return a.x() + a.y() + a.z() + a.w();
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double predux<cl::sycl::cl_double2>(
|
||||
const cl::sycl::cl_double2& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double predux<cl::sycl::cl_double2>(const cl::sycl::cl_double2& a) {
|
||||
return a.x() + a.y();
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half predux_max<cl::sycl::cl_half8>(
|
||||
const cl::sycl::cl_half8& a) {
|
||||
return Eigen::half(cl::sycl::fmax(
|
||||
cl::sycl::fmax(
|
||||
cl::sycl::fmax(a.s0(), a.s1()),
|
||||
cl::sycl::fmax(a.s2(), a.s3())),
|
||||
cl::sycl::fmax(
|
||||
cl::sycl::fmax(a.s4(), a.s5()),
|
||||
cl::sycl::fmax(a.s6(), a.s7()))));
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half predux_max<cl::sycl::cl_half8>(const cl::sycl::cl_half8& a) {
|
||||
return Eigen::half(cl::sycl::fmax(cl::sycl::fmax(cl::sycl::fmax(a.s0(), a.s1()), cl::sycl::fmax(a.s2(), a.s3())),
|
||||
cl::sycl::fmax(cl::sycl::fmax(a.s4(), a.s5()), cl::sycl::fmax(a.s6(), a.s7()))));
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float predux_max<cl::sycl::cl_float4>(
|
||||
const cl::sycl::cl_float4& a) {
|
||||
return cl::sycl::fmax(cl::sycl::fmax(a.x(), a.y()),
|
||||
cl::sycl::fmax(a.z(), a.w()));
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float predux_max<cl::sycl::cl_float4>(const cl::sycl::cl_float4& a) {
|
||||
return cl::sycl::fmax(cl::sycl::fmax(a.x(), a.y()), cl::sycl::fmax(a.z(), a.w()));
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double predux_max<cl::sycl::cl_double2>(
|
||||
const cl::sycl::cl_double2& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double predux_max<cl::sycl::cl_double2>(const cl::sycl::cl_double2& a) {
|
||||
return cl::sycl::fmax(a.x(), a.y());
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half predux_min<cl::sycl::cl_half8>(
|
||||
const cl::sycl::cl_half8& a) {
|
||||
return Eigen::half(cl::sycl::fmin(
|
||||
cl::sycl::fmin(
|
||||
cl::sycl::fmin(a.s0(), a.s1()),
|
||||
cl::sycl::fmin(a.s2(), a.s3())),
|
||||
cl::sycl::fmin(
|
||||
cl::sycl::fmin(a.s4(), a.s5()),
|
||||
cl::sycl::fmin(a.s6(), a.s7()))));
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half predux_min<cl::sycl::cl_half8>(const cl::sycl::cl_half8& a) {
|
||||
return Eigen::half(cl::sycl::fmin(cl::sycl::fmin(cl::sycl::fmin(a.s0(), a.s1()), cl::sycl::fmin(a.s2(), a.s3())),
|
||||
cl::sycl::fmin(cl::sycl::fmin(a.s4(), a.s5()), cl::sycl::fmin(a.s6(), a.s7()))));
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float predux_min<cl::sycl::cl_float4>(
|
||||
const cl::sycl::cl_float4& a) {
|
||||
return cl::sycl::fmin(cl::sycl::fmin(a.x(), a.y()),
|
||||
cl::sycl::fmin(a.z(), a.w()));
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float predux_min<cl::sycl::cl_float4>(const cl::sycl::cl_float4& a) {
|
||||
return cl::sycl::fmin(cl::sycl::fmin(a.x(), a.y()), cl::sycl::fmin(a.z(), a.w()));
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double predux_min<cl::sycl::cl_double2>(
|
||||
const cl::sycl::cl_double2& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double predux_min<cl::sycl::cl_double2>(const cl::sycl::cl_double2& a) {
|
||||
return cl::sycl::fmin(a.x(), a.y());
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half predux_mul<cl::sycl::cl_half8>(
|
||||
const cl::sycl::cl_half8& a) {
|
||||
return Eigen::half(a.s0() * a.s1() * a.s2() * a.s3() * a.s4() * a.s5() *
|
||||
a.s6() * a.s7());
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Eigen::half predux_mul<cl::sycl::cl_half8>(const cl::sycl::cl_half8& a) {
|
||||
return Eigen::half(a.s0() * a.s1() * a.s2() * a.s3() * a.s4() * a.s5() * a.s6() * a.s7());
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float predux_mul<cl::sycl::cl_float4>(
|
||||
const cl::sycl::cl_float4& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float predux_mul<cl::sycl::cl_float4>(const cl::sycl::cl_float4& a) {
|
||||
return a.x() * a.y() * a.z() * a.w();
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double predux_mul<cl::sycl::cl_double2>(
|
||||
const cl::sycl::cl_double2& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double predux_mul<cl::sycl::cl_double2>(const cl::sycl::cl_double2& a) {
|
||||
return a.x() * a.y();
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_half8
|
||||
pabs<cl::sycl::cl_half8>(const cl::sycl::cl_half8& a) {
|
||||
return cl::sycl::cl_half8(cl::sycl::fabs(a.s0()), cl::sycl::fabs(a.s1()),
|
||||
cl::sycl::fabs(a.s2()), cl::sycl::fabs(a.s3()),
|
||||
cl::sycl::fabs(a.s4()), cl::sycl::fabs(a.s5()),
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_half8 pabs<cl::sycl::cl_half8>(const cl::sycl::cl_half8& a) {
|
||||
return cl::sycl::cl_half8(cl::sycl::fabs(a.s0()), cl::sycl::fabs(a.s1()), cl::sycl::fabs(a.s2()),
|
||||
cl::sycl::fabs(a.s3()), cl::sycl::fabs(a.s4()), cl::sycl::fabs(a.s5()),
|
||||
cl::sycl::fabs(a.s6()), cl::sycl::fabs(a.s7()));
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4
|
||||
pabs<cl::sycl::cl_float4>(const cl::sycl::cl_float4& a) {
|
||||
return cl::sycl::cl_float4(cl::sycl::fabs(a.x()), cl::sycl::fabs(a.y()),
|
||||
cl::sycl::fabs(a.z()), cl::sycl::fabs(a.w()));
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 pabs<cl::sycl::cl_float4>(const cl::sycl::cl_float4& a) {
|
||||
return cl::sycl::cl_float4(cl::sycl::fabs(a.x()), cl::sycl::fabs(a.y()), cl::sycl::fabs(a.z()),
|
||||
cl::sycl::fabs(a.w()));
|
||||
}
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_double2
|
||||
pabs<cl::sycl::cl_double2>(const cl::sycl::cl_double2& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_double2 pabs<cl::sycl::cl_double2>(const cl::sycl::cl_double2& a) {
|
||||
return cl::sycl::cl_double2(cl::sycl::fabs(a.x()), cl::sycl::fabs(a.y()));
|
||||
}
|
||||
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet sycl_pcmp_le(const Packet &a,
|
||||
const Packet &b) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet sycl_pcmp_le(const Packet& a, const Packet& b) {
|
||||
return (a <= b).template as<Packet>();
|
||||
}
|
||||
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet sycl_pcmp_lt(const Packet &a,
|
||||
const Packet &b) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet sycl_pcmp_lt(const Packet& a, const Packet& b) {
|
||||
return (a < b).template as<Packet>();
|
||||
}
|
||||
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet sycl_pcmp_eq(const Packet &a,
|
||||
const Packet &b) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet sycl_pcmp_eq(const Packet& a, const Packet& b) {
|
||||
return (a == b).template as<Packet>();
|
||||
}
|
||||
|
||||
#define SYCL_PCMP(OP, TYPE) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE TYPE pcmp_##OP<TYPE>(const TYPE &a, \
|
||||
const TYPE &b) { \
|
||||
return sycl_pcmp_##OP<TYPE>(a, b); \
|
||||
#define SYCL_PCMP(OP, TYPE) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE TYPE pcmp_##OP<TYPE>(const TYPE& a, const TYPE& b) { \
|
||||
return sycl_pcmp_##OP<TYPE>(a, b); \
|
||||
}
|
||||
|
||||
SYCL_PCMP(le, cl::sycl::cl_half8)
|
||||
@@ -464,8 +396,7 @@ SYCL_PCMP(lt, cl::sycl::cl_double2)
|
||||
SYCL_PCMP(eq, cl::sycl::cl_double2)
|
||||
#undef SYCL_PCMP
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void ptranspose(
|
||||
PacketBlock<cl::sycl::cl_half8, 8>& kernel) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void ptranspose(PacketBlock<cl::sycl::cl_half8, 8>& kernel) {
|
||||
cl::sycl::cl_half tmp = kernel.packet[0].s1();
|
||||
kernel.packet[0].s1() = kernel.packet[1].s0();
|
||||
kernel.packet[1].s0() = tmp;
|
||||
@@ -579,8 +510,7 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void ptranspose(
|
||||
kernel.packet[7].s6() = tmp;
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void ptranspose(
|
||||
PacketBlock<cl::sycl::cl_float4, 4>& kernel) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void ptranspose(PacketBlock<cl::sycl::cl_float4, 4>& kernel) {
|
||||
float tmp = kernel.packet[0].y();
|
||||
kernel.packet[0].y() = kernel.packet[1].x();
|
||||
kernel.packet[1].x() = tmp;
|
||||
@@ -606,8 +536,7 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void ptranspose(
|
||||
kernel.packet[3].z() = tmp;
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void ptranspose(
|
||||
PacketBlock<cl::sycl::cl_double2, 2>& kernel) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void ptranspose(PacketBlock<cl::sycl::cl_double2, 2>& kernel) {
|
||||
double tmp = kernel.packet[0].y();
|
||||
kernel.packet[0].y() = kernel.packet[1].x();
|
||||
kernel.packet[1].x() = tmp;
|
||||
@@ -615,35 +544,27 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void ptranspose(
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_half8 pblend(
|
||||
const Selector<unpacket_traits<cl::sycl::cl_half8>::size>& ifPacket,
|
||||
const cl::sycl::cl_half8& thenPacket,
|
||||
const Selector<unpacket_traits<cl::sycl::cl_half8>::size>& ifPacket, const cl::sycl::cl_half8& thenPacket,
|
||||
const cl::sycl::cl_half8& elsePacket) {
|
||||
cl::sycl::cl_short8 condition(
|
||||
ifPacket.select[0] ? 0 : -1, ifPacket.select[1] ? 0 : -1,
|
||||
ifPacket.select[2] ? 0 : -1, ifPacket.select[3] ? 0 : -1,
|
||||
ifPacket.select[4] ? 0 : -1, ifPacket.select[5] ? 0 : -1,
|
||||
ifPacket.select[6] ? 0 : -1, ifPacket.select[7] ? 0 : -1);
|
||||
cl::sycl::cl_short8 condition(ifPacket.select[0] ? 0 : -1, ifPacket.select[1] ? 0 : -1, ifPacket.select[2] ? 0 : -1,
|
||||
ifPacket.select[3] ? 0 : -1, ifPacket.select[4] ? 0 : -1, ifPacket.select[5] ? 0 : -1,
|
||||
ifPacket.select[6] ? 0 : -1, ifPacket.select[7] ? 0 : -1);
|
||||
return cl::sycl::select(thenPacket, elsePacket, condition);
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 pblend(
|
||||
const Selector<unpacket_traits<cl::sycl::cl_float4>::size>& ifPacket,
|
||||
const cl::sycl::cl_float4& thenPacket,
|
||||
const Selector<unpacket_traits<cl::sycl::cl_float4>::size>& ifPacket, const cl::sycl::cl_float4& thenPacket,
|
||||
const cl::sycl::cl_float4& elsePacket) {
|
||||
cl::sycl::cl_int4 condition(
|
||||
ifPacket.select[0] ? 0 : -1, ifPacket.select[1] ? 0 : -1,
|
||||
ifPacket.select[2] ? 0 : -1, ifPacket.select[3] ? 0 : -1);
|
||||
cl::sycl::cl_int4 condition(ifPacket.select[0] ? 0 : -1, ifPacket.select[1] ? 0 : -1, ifPacket.select[2] ? 0 : -1,
|
||||
ifPacket.select[3] ? 0 : -1);
|
||||
return cl::sycl::select(thenPacket, elsePacket, condition);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline cl::sycl::cl_double2 pblend(
|
||||
const Selector<unpacket_traits<cl::sycl::cl_double2>::size>& ifPacket,
|
||||
const cl::sycl::cl_double2& thenPacket,
|
||||
const cl::sycl::cl_double2& elsePacket) {
|
||||
cl::sycl::cl_long2 condition(ifPacket.select[0] ? 0 : -1,
|
||||
ifPacket.select[1] ? 0 : -1);
|
||||
inline cl::sycl::cl_double2 pblend(const Selector<unpacket_traits<cl::sycl::cl_double2>::size>& ifPacket,
|
||||
const cl::sycl::cl_double2& thenPacket, const cl::sycl::cl_double2& elsePacket) {
|
||||
cl::sycl::cl_long2 condition(ifPacket.select[0] ? 0 : -1, ifPacket.select[1] ? 0 : -1);
|
||||
return cl::sycl::select(thenPacket, elsePacket, condition);
|
||||
}
|
||||
#endif // SYCL_DEVICE_ONLY
|
||||
|
||||
@@ -34,10 +34,9 @@ struct type_casting_traits<float, int> {
|
||||
};
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_int4
|
||||
pcast<cl::sycl::cl_float4, cl::sycl::cl_int4>(const cl::sycl::cl_float4& a) {
|
||||
return a
|
||||
.template convert<cl::sycl::cl_int, cl::sycl::rounding_mode::automatic>();
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_int4 pcast<cl::sycl::cl_float4, cl::sycl::cl_int4>(
|
||||
const cl::sycl::cl_float4& a) {
|
||||
return a.template convert<cl::sycl::cl_int, cl::sycl::rounding_mode::automatic>();
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -46,10 +45,9 @@ struct type_casting_traits<int, float> {
|
||||
};
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4
|
||||
pcast<cl::sycl::cl_int4, cl::sycl::cl_float4>(const cl::sycl::cl_int4& a) {
|
||||
return a.template convert<cl::sycl::cl_float,
|
||||
cl::sycl::rounding_mode::automatic>();
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 pcast<cl::sycl::cl_int4, cl::sycl::cl_float4>(
|
||||
const cl::sycl::cl_int4& a) {
|
||||
return a.template convert<cl::sycl::cl_float, cl::sycl::rounding_mode::automatic>();
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -58,13 +56,10 @@ struct type_casting_traits<double, float> {
|
||||
};
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4
|
||||
pcast<cl::sycl::cl_double2, cl::sycl::cl_float4>(
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 pcast<cl::sycl::cl_double2, cl::sycl::cl_float4>(
|
||||
const cl::sycl::cl_double2& a, const cl::sycl::cl_double2& b) {
|
||||
auto a1 = a.template convert<cl::sycl::cl_float,
|
||||
cl::sycl::rounding_mode::automatic>();
|
||||
auto b1 = b.template convert<cl::sycl::cl_float,
|
||||
cl::sycl::rounding_mode::automatic>();
|
||||
auto a1 = a.template convert<cl::sycl::cl_float, cl::sycl::rounding_mode::automatic>();
|
||||
auto b1 = b.template convert<cl::sycl::cl_float, cl::sycl::rounding_mode::automatic>();
|
||||
return cl::sycl::cl_float4(a1.x(), a1.y(), b1.x(), b1.y());
|
||||
}
|
||||
|
||||
@@ -74,8 +69,8 @@ struct type_casting_traits<float, double> {
|
||||
};
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_double2
|
||||
pcast<cl::sycl::cl_float4, cl::sycl::cl_double2>(const cl::sycl::cl_float4& a) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_double2 pcast<cl::sycl::cl_float4, cl::sycl::cl_double2>(
|
||||
const cl::sycl::cl_float4& a) {
|
||||
// Simply discard the second half of the input
|
||||
return cl::sycl::cl_double2(a.x(), a.y());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user