DPCT1060#

Message#

SYCL range can only be a 1D, 2D, or 3D vector. Adjust the code.

Detailed Help#

This warning is emitted when the number of dimensions of memory in the original code exceeds 3. Since SYCL* range supports only 1, 2 or 3 dimensions, the resulting code is not SYCL-compliant.

To fix the resulting code you can use the low-dimensional arrays to simulate high-dimensional arrays.

The following fix example demonstrates how to use a 3D array to simulate a 4D array.

For example, this original CUDA* code:

1__constant__ int const_array[dimX][dimY][dimZ][dimW];
2
3__global__ void kernel(int x, int y, int z, int w) {
4  int a = const_array[x][y][z][w];
5}

results in the following migrated SYCL code:

1/*
2DPCT1060:0: SYCL range can only be a 1D, 2D, or 3D vector. Adjust the code.
3*/
4static dpct::constant_memory<int, 4> const_array(dimX, dimY, dimZ, dimW);
5
6void kernel(int x, int y, int z, int w,
7            sycl::accessor<int, 4, sycl::access_mode::read, sycl::access::target::device> const_array) {
8  int a = const_array[x][y][z][w];
9}

which is rewritten to:

1static dpct::constant_memory<int, 3> const_array(dimX, dimY, dimZ * dimW);
2
3void kernel(int x, int y, int z, int w,
4            sycl::accessor<int, 3, sycl::access_mode::read, sycl::access::target::device> const_array) {
5  int a = const_array[x][y][w * dimZ + z];
6}

Suggestions to Fix#

You may need to rewrite this code.