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
22 #include <unsupported/Eigen/CXX11/Tensor>
25 using Eigen::SyclDevice;
29 template <
typename DataType,
int DataLayout,
typename IndexType>
31 IndexType sizeDim1 = 2;
32 IndexType sizeDim2 = 3;
33 IndexType sizeDim3 = 5;
34 IndexType sizeDim4 = 7;
40 const size_t buffSize = tensor.
size() *
sizeof(DataType);
46 DataType* gpu_data1 =
static_cast<DataType*
>(sycl_device.allocate(buffSize));
47 DataType* gpu_data2 =
static_cast<DataType*
>(sycl_device.allocate(buffSize));
54 sycl_device.memcpyHostToDevice(gpu_data1, tensor.
data(), buffSize);
56 gpu2.device(sycl_device) = gpu1.shuffle(shuffles);
57 sycl_device.memcpyDeviceToHost(no_shuffle.
data(), gpu_data2, buffSize);
58 sycl_device.synchronize();
65 for (IndexType
i = 0;
i < sizeDim1; ++
i) {
66 for (IndexType
j = 0;
j < sizeDim2; ++
j) {
67 for (IndexType k = 0; k < sizeDim3; ++k) {
68 for (IndexType
l = 0;
l < sizeDim4; ++
l) {
80 {sizeDim3, sizeDim4, sizeDim2, sizeDim1}};
82 DataType* gpu_data3 =
static_cast<DataType*
>(sycl_device.allocate(buffSize));
84 gpu_data3, tensorrangeShuffle);
86 gpu3.device(sycl_device) = gpu1.shuffle(shuffles);
87 sycl_device.memcpyDeviceToHost(shuffle.
data(), gpu_data3, buffSize);
88 sycl_device.synchronize();
95 for (IndexType
i = 0;
i < sizeDim1; ++
i) {
96 for (IndexType
j = 0;
j < sizeDim2; ++
j) {
97 for (IndexType k = 0; k < sizeDim3; ++k) {
98 for (IndexType
l = 0;
l < sizeDim4; ++
l) {
106 template <
typename DataType,
typename dev_Selector>
108 QueueInterface queueInterface(
s);
109 auto sycl_device = Eigen::SyclDevice(&queueInterface);
110 test_simple_shuffling_sycl<DataType, RowMajor, int64_t>(sycl_device);
111 test_simple_shuffling_sycl<DataType, ColMajor, int64_t>(sycl_device);
114 for (
const auto& device : Eigen::get_sycl_supported_devices()) {
115 CALL_SUBTEST(sycl_shuffling_test_per_device<float>(device));