DPCT1010#

Message#

SYCL uses exceptions to report errors and does not use the error codes. The <function name> function call was replaced with 0. You need to rewrite this code.

Detailed Help#

SYCL* does not support launching kernel in device code. The user needs to merge the parent kernel and child kernel together.

Suggestions to Fix#

For example, this original CUDA* code:

 1__global__ void kernel() {
 2  ...
 3}
 4
 5void foo() {
 6  kernel<<<1, 1>>>();
 7  cudaDeviceSynchronize();
 8  cudaError_t err = cudaGetLastError();
 9  printf("%d\n", err);
10}

results in the following migrated SYCL code:

 1void kernel() {
 2  ...
 3}
 4
 5void foo() {
 6  dpct::get_in_order_queue().parallel_for(
 7      sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)),
 8      [=](sycl::nd_item<3> item_ct1) {
 9        kernel();
10      });
11  dpct::get_current_device().queues_wait_and_throw();
12  /*
13  DPCT1010:0: SYCL uses exceptions to report
14  errors and does not use the error
15  codes. The cudaGetLastError function call was
16  replaced with 0. You need to rewrite this code.
17  */
18  dpct::err0 err = 0;
19  printf("%d\n", err);
20}

which needs to be rewritten to:

 1void kernel() {
 2  ...
 3}
 4
 5void foo() {
 6  try {
 7    dpct::get_in_order_queue().parallel_for(
 8        sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)),
 9        [=](sycl::nd_item<3> item_ct1) {
10          kernel();
11        });
12    dpct::get_current_device().queues_wait_and_throw();
13  } catch (sycl::exception const &e) {
14    std::cerr << e.what() << std::endl;
15  }
16}