15 #define EIGEN_TEST_NO_LONGDOUBLE
16 #define EIGEN_TEST_NO_COMPLEX
17 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int64_t
18 #define EIGEN_USE_SYCL
21 #include <unsupported/Eigen/CXX11/Tensor>
24 using Eigen::SyclDevice;
30 template <
typename DataType,
int DataLayout,
typename IndexType>
33 IndexType sizeDim1 = 245;
34 IndexType sizeDim2 = 343;
35 IndexType sizeDim3 = 577;
48 Index3 strides1(1
L,1
L, 1
L);
49 Index3 indicesStart1(1
L, 0
L, 0
L);
50 Index3 indicesStop1(sizeDim1, sizeDim2, sizeDim3);
52 Index3 strides2(1
L,1
L, 1
L);
53 Index3 indicesStart2(0
L, 0
L, 0
L);
54 Index3 indicesStop2(sizeDim1-1, sizeDim2, sizeDim3);
61 DataType* gpu_data1 =
static_cast<DataType*
>(sycl_device.allocate(tensor1.
size()*
sizeof(DataType)));
62 DataType* gpu_data2 =
static_cast<DataType*
>(sycl_device.allocate(tensor2.
size()*
sizeof(DataType)));
63 DataType* gpu_data3 =
static_cast<DataType*
>(sycl_device.allocate(tensor3.
size()*
sizeof(DataType)));
69 sycl_device.memcpyHostToDevice(gpu_data1, tensor1.
data(),(tensor1.
size())*
sizeof(DataType));
70 sycl_device.memcpyHostToDevice(gpu_data2, tensor2.
data(),(tensor2.
size())*
sizeof(DataType));
71 gpu3.device(sycl_device)= gpu1.slice(indicesStart1,
sizes) - gpu2.slice(indicesStart2,
sizes);
72 sycl_device.memcpyDeviceToHost(tensor3.
data(), gpu_data3,(tensor3.
size())*
sizeof(DataType));
74 tensor3_cpu = tensor1.
stridedSlice(indicesStart1,indicesStop1,strides1) - tensor2.
stridedSlice(indicesStart2,indicesStop2,strides2);
77 for (IndexType
i = 0;
i <slice_range[0] ; ++
i) {
78 for (IndexType
j = 0;
j < slice_range[1]; ++
j) {
79 for (IndexType k = 0; k < slice_range[2]; ++k) {
84 sycl_device.deallocate(gpu_data1);
85 sycl_device.deallocate(gpu_data2);
86 sycl_device.deallocate(gpu_data3);
91 QueueInterface queueInterface(
s);
92 auto sycl_device = Eigen::SyclDevice(&queueInterface);
93 test_image_op_sycl<DataType, RowMajor, int64_t>(sycl_device);
97 for (
const auto& device :Eigen::get_sycl_supported_devices()) {
98 CALL_SUBTEST(sycl_computing_test_per_device<float>(device));
99 #ifdef EIGEN_SYCL_DOUBLE_SUPPORT
100 CALL_SUBTEST(sycl_computing_test_per_device<double>(device));