DPCT1009#
Message#
SYCL uses exceptions to report errors and does not use the error codes. The original code was commented out and a warning string was inserted. 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 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() {
2 float *f;
3 int err = (f = (float *)sycl::malloc_device(4, dpct::get_default_queue()), 0);
4 /*
5 DPCT1009:1: SYCL uses exceptions to report errors and does not use the error
6 codes. The original code was commented out and a warning string was inserted.
7 You need to rewrite this code.
8 */
9 printf("%s\n",
10 "cudaGetErrorString is not supported" /*cudaGetErrorString(err)*/);
11}
which is rewritten to:
1void foo() {
2 float *f;
3 try {
4 f = (float *)sycl::malloc_device(4, dpct::get_default_queue())
5 } catch (sycl::exception const &e) {
6 std::cerr << e.what() << std::endl;
7 }
8}