Skip to content

Commit ceeda4a

Browse files
committed
Add missing mapping for CL_INVALID_KERNEL to UR OpenCL adapter and add check for CL_INVALID_KERNEL_DEFINITION inside urKernelCreate.
1 parent 2d51147 commit ceeda4a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ 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+
"urKernelCreate failing with CL_INVALID_KERNEL_DEFINITION",
74+
UR_RESULT_ERROR_ADAPTER_SPECIFIC);
75+
return UR_RESULT_ERROR_ADAPTER_SPECIFIC;
76+
}
77+
7078
CL_RETURN_ON_FAILURE(CLResult);
7179
auto URKernel = std::make_unique<ur_kernel_handle_t_>(Kernel, hProgram,
7280
hProgram->Context);

0 commit comments

Comments
 (0)