15 #define EIGEN_TEST_NO_LONGDOUBLE
16 #define EIGEN_TEST_NO_COMPLEX
18 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int64_t
19 #define EIGEN_USE_SYCL
23 #include <Eigen/CXX11/Tensor>
27 template <
typename DataType,
typename IndexType>
30 IndexType sizeDim1 = 2;
31 IndexType sizeDim2 = 3;
32 IndexType sizeDim3 = 7;
41 DataType* gpu_data1 =
static_cast<DataType*
>(sycl_device.allocate(tensor1.
size()*
sizeof(DataType)));
42 DataType* gpu_data2 =
static_cast<DataType*
>(sycl_device.allocate(tensor2.
size()*
sizeof(DataType)));
46 sycl_device.memcpyHostToDevice(gpu_data1, tensor1.
data(),(tensor1.
size())*
sizeof(DataType));
47 gpu2.device(sycl_device)=gpu1.swap_layout();
48 sycl_device.memcpyDeviceToHost(tensor2.
data(), gpu_data2,(tensor2.
size())*
sizeof(DataType));
59 for (IndexType
i = 0;
i < 2; ++
i) {
60 for (IndexType
j = 0;
j < 3; ++
j) {
61 for (IndexType k = 0; k < 7; ++k) {
66 sycl_device.deallocate(gpu_data1);
67 sycl_device.deallocate(gpu_data2);
70 template <
typename DataType,
typename IndexType>
74 IndexType sizeDim1 = 2;
75 IndexType sizeDim2 = 3;
76 IndexType sizeDim3 = 7;
84 DataType* gpu_data1 =
static_cast<DataType*
>(sycl_device.allocate(tensor1.
size()*
sizeof(DataType)));
85 DataType* gpu_data2 =
static_cast<DataType*
>(sycl_device.allocate(tensor2.
size()*
sizeof(DataType)));
89 sycl_device.memcpyHostToDevice(gpu_data1, tensor1.
data(),(tensor1.
size())*
sizeof(DataType));
90 gpu2.swap_layout().device(sycl_device)=gpu1;
91 sycl_device.memcpyDeviceToHost(tensor2.
data(), gpu_data2,(tensor2.
size())*
sizeof(DataType));
103 for (IndexType
i = 0;
i < 2; ++
i) {
104 for (IndexType
j = 0;
j < 3; ++
j) {
105 for (IndexType k = 0; k < 7; ++k) {
110 sycl_device.deallocate(gpu_data1);
111 sycl_device.deallocate(gpu_data2);
116 QueueInterface queueInterface(
s);
117 auto sycl_device = Eigen::SyclDevice(&queueInterface);
118 test_simple_swap_sycl<DataType, int64_t>(sycl_device);
119 test_swap_as_lvalue_sycl<DataType, int64_t>(sycl_device);
123 for (
const auto& device :Eigen::get_sycl_supported_devices()) {
124 CALL_SUBTEST(sycl_tensor_layout_swap_test_per_device<float>(device));