Skip to content

Commit 6fe6915

Browse files
martygrantkbenzie
andauthored
[UR][OpenCL] Add missing mapping for CL_INVALID_KERNEL to UR OpenCL adapter and handle CL_INVALID_KERNEL_DEFINITION in urKernelCreate (#18182)
Fixes oneapi-src/unified-runtime#2555 Also handles checking for CL_INVALID_KERNEL_DEFINITION inside urKernelCreate. --------- Co-authored-by: Kenneth Benzie (Benie) <[email protected]>
1 parent dae689e commit 6fe6915

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

unified-runtime/source/adapters/opencl/common.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ ur_result_t mapCLErrorToUR(cl_int Result) {
102102
return UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE;
103103
case CL_INVALID_SPEC_ID:
104104
return UR_RESULT_ERROR_INVALID_SPEC_ID;
105+
case CL_INVALID_KERNEL:
106+
return UR_RESULT_ERROR_INVALID_KERNEL;
105107
default:
106108
return UR_RESULT_ERROR_UNKNOWN;
107109
}

unified-runtime/source/adapters/opencl/kernel.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ urKernelCreate(ur_program_handle_t hProgram, const char *pKernelName,
6767
cl_int CLResult;
6868
cl_kernel Kernel =
6969
clCreateKernel(hProgram->CLProgram, pKernelName, &CLResult);
70+
71+
if (CLResult == CL_INVALID_KERNEL_DEFINITION) {
72+
cl_adapter::setErrorMessage(
73+
"clCreateKernel failed with CL_INVALID_KERNEL_DEFINITION", CLResult);
74+
return UR_RESULT_ERROR_ADAPTER_SPECIFIC;
75+
}
76+
7077
CL_RETURN_ON_FAILURE(CLResult);
7178
auto URKernel = std::make_unique<ur_kernel_handle_t_>(Kernel, hProgram,
7279
hProgram->Context);

0 commit comments

Comments
 (0)