DPCT1010#

Message#

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

Detailed Help#

SYCL* uses exceptions to report errors and does not use error codes. The original code tries to get an error code, while SYCL does not require such functionality. The call was replaced with 0.

Suggestions to Fix#

You may need to rewrite this code.

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_default_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 errors and does not use the error
14  codes. The call was replaced with 0. You need to rewrite this code.
15  */
16  int err = 0;
17  printf("%d\n", err);
18}

which is rewritten to:

 1void kernel() {
 2  ...
 3}
 4
 5void foo() {
 6  try {
 7    dpct::get_default_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}