DPCT1009#

Message#

SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(…)" with a real error-handling function.

Detailed Help#

SYCL* uses exceptions to report errors and does not use error codes. The original code tries to get a string message through the error code, while SYCL does not require such functionality.

To indicate that the code needs to be updated, a warning string is inserted.

Suggestions to Fix#

You may need to rewrite this code.

For example, this original CUDA* code:

1void foo() {
2  float *f;
3  cudaError_t err = cudaMalloc(&f, 4);
4  printf("%s\n", cudaGetErrorString(err));
5}

results in the following migrated SYCL code:

 1void foo() try {
 2  float *f;
 3  dpct::err0 err = DPCT_CHECK_ERROR(
 4      f = (float *)sycl::malloc_device(4, dpct::get_in_order_queue()));
 5  /*
 6  DPCT1009:1: SYCL uses exceptions to report errors and does not use the error
 7  codes. The original code was commented out and a warning string was inserted.
 8  You need to rewrite this code.
 9  */
10  printf("%s\n", dpct::get_error_string_dummy(err));
11}
12catch (sycl::exception const &exc) {
13  std::cerr <<exc.what() << "Exception caught at file." << __FILE__
14            << ", line:" << __LINE__ << std:endl;
15  std::exit(1);
16}

which needs to be rewritten to:

1void foo() {
2  float *f;
3  try {
4    f = (float *)sycl::malloc_device(4, dpct::get_in_order_queue())
5  } catch (sycl::exception const &e) {
6    std::cerr << e.what() << std::endl;
7  }
8}