23#ifndef EIGEN_TYPE_CASTING_SYCL_H
24#define EIGEN_TYPE_CASTING_SYCL_H
27#include "../../InternalHeaderCheck.h"
32#ifdef SYCL_DEVICE_ONLY
34struct type_casting_traits<float, int> {
35 enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 1 };
39EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_int4 pcast<cl::sycl::cl_float4, cl::sycl::cl_int4>(
40 const cl::sycl::cl_float4& a) {
41 return a.template convert<cl::sycl::cl_int, cl::sycl::rounding_mode::automatic>();
45struct type_casting_traits<int, float> {
46 enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 1 };
50EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 pcast<cl::sycl::cl_int4, cl::sycl::cl_float4>(
51 const cl::sycl::cl_int4& a) {
52 return a.template convert<cl::sycl::cl_float, cl::sycl::rounding_mode::automatic>();
56struct type_casting_traits<double, float> {
57 enum { VectorizedCast = 1, SrcCoeffRatio = 2, TgtCoeffRatio = 1 };
61EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 pcast<cl::sycl::cl_double2, cl::sycl::cl_float4>(
62 const cl::sycl::cl_double2& a,
const cl::sycl::cl_double2& b) {
63 auto a1 = a.template convert<cl::sycl::cl_float, cl::sycl::rounding_mode::automatic>();
64 auto b1 = b.template convert<cl::sycl::cl_float, cl::sycl::rounding_mode::automatic>();
65 return cl::sycl::cl_float4(a1.x(), a1.y(), b1.x(), b1.y());
69struct type_casting_traits<float, double> {
70 enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 2 };
74EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_double2 pcast<cl::sycl::cl_float4, cl::sycl::cl_double2>(
75 const cl::sycl::cl_float4& a) {
77 return cl::sycl::cl_double2(a.x(), a.y());