Visible to Intel only — GUID: GUID-F7ADEE88-8F06-42E5-AEBE-BC24B3CB70B0
Visible to Intel only — GUID: GUID-F7ADEE88-8F06-42E5-AEBE-BC24B3CB70B0
DPCT1034
Message
Migrated API does not return an error code. 0 is returned in the lambda. You may need to rewrite this code.
Detailed Help
Typically, this happens because the API call in the original application 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 return 0; statement at the end of the lambda expression, if the return code is expected by the program logic and the new API does not return it. Review all such places in the code.
Similar to DPCT1003.
Suggestions to Fix
If in a DPC++ application you:
Do not need the code that consumes the error code, remove the code and the return 0; statement.
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.
Similar to DPCT1003.
For example, this original CUDA* code:
void foo() {
CUdevice device;
CUresult status = cuDeviceComputeCapability(&result0, &result1, device);
}
results in the following migrated SYCL code:
void foo() {
/*
DPCT1034:0: Migrated API does not return an error code. 0 is returned in the
lambda. You may need to rewrite this code.
*/
int status = [&]() {
result0 = dpct::dev_mgr::instance().get_device(device).get_major_version();
result1 = dpct::dev_mgr::instance().get_device(device).get_minor_version();
return 0;
}();
}
which is rewritten to:
void foo() {
try {
result0 = dpct::dev_mgr::instance().get_device(device).get_major_version();
result1 = dpct::dev_mgr::instance().get_device(device).get_minor_version();
} catch (...) {
...
}
}