diff --git a/unified-runtime/source/adapters/opencl/common.cpp b/unified-runtime/source/adapters/opencl/common.cpp index 5047e61ab9355..ba23fb52c46b9 100644 --- a/unified-runtime/source/adapters/opencl/common.cpp +++ b/unified-runtime/source/adapters/opencl/common.cpp @@ -93,6 +93,8 @@ ur_result_t mapCLErrorToUR(cl_int Result) { return UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE; case CL_INVALID_SPEC_ID: return UR_RESULT_ERROR_INVALID_SPEC_ID; + case CL_INVALID_KERNEL: + return UR_RESULT_ERROR_INVALID_KERNEL; default: return UR_RESULT_ERROR_UNKNOWN; } diff --git a/unified-runtime/source/adapters/opencl/kernel.cpp b/unified-runtime/source/adapters/opencl/kernel.cpp index 62fcabbf48efa..cd94f7e99fab3 100644 --- a/unified-runtime/source/adapters/opencl/kernel.cpp +++ b/unified-runtime/source/adapters/opencl/kernel.cpp @@ -67,6 +67,14 @@ urKernelCreate(ur_program_handle_t hProgram, const char *pKernelName, cl_int CLResult; cl_kernel Kernel = clCreateKernel(hProgram->CLProgram, pKernelName, &CLResult); + + if (CLResult == CL_INVALID_KERNEL_DEFINITION) { + cl_adapter::setErrorMessage( + "clCreateKernel failed with CL_INVALID_KERNEL_DEFINITION", + UR_RESULT_ERROR_ADAPTER_SPECIFIC); + return UR_RESULT_ERROR_ADAPTER_SPECIFIC; + } + CL_RETURN_ON_FAILURE(CLResult); auto URKernel = std::make_unique<ur_kernel_handle_t_>(Kernel, hProgram, hProgram->Context);