DPCT1022#

Message#

There is no exact match between the maxGridSize and the max_nd_range size. Verify the correctness of the code.

Detailed Help#

There is no analogue of the maxGridSize in SYCL*. SYCL nd_ranges can have up to three dimensions, just like grids in CUDA*, but there is no maximum of nd_range size beyond the data type width, which is size_t. The SYCLomatic replaces the maxGridSize with the max_nd_range_size helper, which is initialized to the size_t width.

Suggestions to Fix#

Verify the code correctness.

For example, this original CUDA code:

 1void foo() {
 2  cudaDeviceProp prop;
 3  cudaGetDeviceProperties(&prop, 0);
 4  if (prop.maxGridSize[0] >= TASK_SIZE) {
 5    // submit the task on one kernel
 6    ...
 7  } else {
 8    // split the task into multi kernels
 9    ...
10  }
11}

results in the following migrated SYCL code:

 1void foo() {
 2  dpct::device_info prop;
 3  dpct::dev_mgr::instance().get_device(0).get_device_info(prop);
 4  /*
 5  DPCT1022:0: There is no exact match between the maxGridSize and the
 6  max_nd_range size. Verify the correctness of the code.
 7  */
 8  if (prop.get_max_nd_range_size()[0] >= TASK_SIZE) {
 9    // submit the task on one kernel
10    ...
11  } else {
12    // split the task into multi kernels
13    ...
14  }
15}

which is rewritten to:

1void foo() {
2  // submit the task on one kernel
3  ...
4}