Visible to Intel only — GUID: GUID-C2EC0087-27B9-4DC6-A97D-D498FC587E94
Visible to Intel only — GUID: GUID-C2EC0087-27B9-4DC6-A97D-D498FC587E94
DPCT1003
Message
Migrated API does not return error code. (*, 0) is inserted. You may need to rewrite this code.
Detailed Help
Typically, this happens because the CUDA* API returns an error code and then it is consumed by the program logic.
SYCL* uses exceptions to report errors and does not return the error code.
Intel® DPC++ Compatibility Tool inserts a (*, 0) operator, so that the resulting application can be compiled. This operator returns 0 and is inserted if the return code is expected by the program logic and the new API does not return it. You should review all such places in the code.
Suggestions to Fix
If in a DPC++ application you:
Do not need the code that consumes the error code, remove the code and the (*, 0) operator.
Need the code that consumes the error code, try to replace it with an exception handling code and use your logic in an exception handler.
For example, this original CUDA code:
void foo() {
cudaError_t err;
float *f;
err = cudaMalloc(&f, 4);
err = cudaFree(f);
}
results in the following migrated SYCL code:
void foo()
dpct::device_ext &dev_ct1 = dpct::get_current_device();
sycl::queue &q_ct1 = dev_ct1.default_queue();
int err;
float *f;
/*
DPCT1003:0: Migrated API does not return error code. (*, 0) is inserted. You
may need to rewrite this code.
*/
err = (f = (float *)sycl::malloc_device(4, q_ct1), 0);
/*
DPCT1003:1: Migrated API does not return error code. (*, 0) is inserted. You
may need to rewrite this code.
*/
err = (sycl::free(f, q_ct1), 0);
}
which is rewritten to:
void foo()
dpct::device_ext &dev_ct1 = dpct::get_current_device();
sycl::queue &q_ct1 = dev_ct1.default_queue();
float *f;
f = (float *)sycl::malloc_device(4, q_ct1);
sycl::free(f, q_ct1);
}