DPCT1002#

Message#

Special case error handling if-stmt was detected. You may need to rewrite this code.

Detailed Help#

See DPCT1000.

Suggestions to Fix#

For example, this original CUDA* code:

1void foo() {
2  float *f;
3  cudaError_t err = cudaMalloc(&f, 4);
4  if (err == cudaErrorMemoryAllocation) {
5    std::cerr << "cudaErrorMemoryAllocation" << std::endl;
6  }
7}

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  DPCT1002:1: Special case error handling if-stmt was detected. You may need to
 6  rewrite this code.
 7  */
 8  if (err == 2) {
 9    std::cerr << "cudaErrorMemoryAllocation" << std::endl;
10  }
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}