23#ifndef EIGEN_MATH_FUNCTIONS_SYCL_H
24#define EIGEN_MATH_FUNCTIONS_SYCL_H
26#include "../../InternalHeaderCheck.h"
35#if defined(SYCL_DEVICE_ONLY)
38#define SYCL_PACKET_FUNCTION(EIGEN_FUNC, SYCL_FUNC, PACKET) \
40 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PACKET EIGEN_FUNC<PACKET>(const PACKET& a) { \
41 return cl::sycl::SYCL_FUNC(a); \
45#define SYCL_UNARY_FUNCTION(EIGEN_FUNC, SYCL_FUNC) \
46 SYCL_PACKET_FUNCTION(EIGEN_FUNC, SYCL_FUNC, cl::sycl::cl_half8) \
47 SYCL_PACKET_FUNCTION(EIGEN_FUNC, SYCL_FUNC, cl::sycl::cl_float4) \
48 SYCL_PACKET_FUNCTION(EIGEN_FUNC, SYCL_FUNC, cl::sycl::cl_double2)
50SYCL_UNARY_FUNCTION(plog, log)
51SYCL_UNARY_FUNCTION(plog1p, log1p)
52SYCL_UNARY_FUNCTION(plog10, log10)
53SYCL_UNARY_FUNCTION(pexpm1, expm1)
54SYCL_UNARY_FUNCTION(psqrt, sqrt)
55SYCL_UNARY_FUNCTION(prsqrt, rsqrt)
56SYCL_UNARY_FUNCTION(psin, sin)
57SYCL_UNARY_FUNCTION(pcos, cos)
58SYCL_UNARY_FUNCTION(ptan, tan)
59SYCL_UNARY_FUNCTION(pasin, asin)
60SYCL_UNARY_FUNCTION(pacos, acos)
61SYCL_UNARY_FUNCTION(patan, atan)
62SYCL_UNARY_FUNCTION(psinh, sinh)
63SYCL_UNARY_FUNCTION(pcosh, cosh)
64SYCL_UNARY_FUNCTION(ptanh, tanh)
65SYCL_UNARY_FUNCTION(pround, round)
66SYCL_UNARY_FUNCTION(print, rint)
67SYCL_UNARY_FUNCTION(pfloor, floor)
70SYCL_UNARY_FUNCTION(pexp, exp)
71SYCL_PACKET_FUNCTION(pexp, exp, cl::sycl::cl_half)
72SYCL_PACKET_FUNCTION(pexp, exp, cl::sycl::cl_float)
75SYCL_PACKET_FUNCTION(pceil, ceil, cl::sycl::cl_half)
76SYCL_PACKET_FUNCTION(pceil, ceil, cl::sycl::cl_float4)
77SYCL_PACKET_FUNCTION(pceil, ceil, cl::sycl::cl_double2)
79#undef SYCL_UNARY_FUNCTION
80#undef SYCL_PACKET_FUNCTION
83#define SYCL_BINARY_FUNCTION(EIGEN_FUNC, SYCL_FUNC, PACKET) \
85 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PACKET EIGEN_FUNC<PACKET>(const PACKET& a, const PACKET& b) { \
86 return cl::sycl::SYCL_FUNC(a, b); \
89SYCL_BINARY_FUNCTION(pmin, fmin, cl::sycl::cl_half8)
90SYCL_BINARY_FUNCTION(pmin, fmin, cl::sycl::cl_float4)
91SYCL_BINARY_FUNCTION(pmin, fmin, cl::sycl::cl_double2)
92SYCL_BINARY_FUNCTION(pmax, fmax, cl::sycl::cl_half8)
93SYCL_BINARY_FUNCTION(pmax, fmax, cl::sycl::cl_float4)
94SYCL_BINARY_FUNCTION(pmax, fmax, cl::sycl::cl_double2)
96#undef SYCL_BINARY_FUNCTION
99#define SYCL_PLDEXP(packet_type) \
101 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE packet_type pldexp(const packet_type& a, const packet_type& exponent) { \
102 return cl::sycl::ldexp(a, exponent.template convert<cl::sycl::cl_int, cl::sycl::rounding_mode::automatic>()); \
105SYCL_PLDEXP(cl::sycl::cl_half8)
106SYCL_PLDEXP(cl::sycl::cl_float4)
107SYCL_PLDEXP(cl::sycl::cl_double2)