@@ -61,8 +61,8 @@ static cl_int mapURKernelInfoToCL(ur_kernel_info_t URPropName) {
6161 return CL_KERNEL_PROGRAM;
6262 case UR_KERNEL_INFO_ATTRIBUTES:
6363 return CL_KERNEL_ATTRIBUTES;
64+ // NUM_REGS doesn't have a CL equivalent
6465 case UR_KERNEL_INFO_NUM_REGS:
65- return CL_KERNEL_NUM_ARGS;
6666 default :
6767 return -1 ;
6868 }
@@ -73,33 +73,20 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetInfo(ur_kernel_handle_t hKernel,
7373 size_t propSize,
7474 void *pPropValue,
7575 size_t *pPropSizeRet) {
76- // We need this little bit of ugliness because the UR NUM_ARGS property is
77- // size_t whereas the CL one is cl_uint. We should consider changing that see
78- // #1038
79- if (propName == UR_KERNEL_INFO_NUM_ARGS) {
80- if (pPropSizeRet)
81- *pPropSizeRet = sizeof (size_t );
82- cl_uint NumArgs = 0 ;
83- CL_RETURN_ON_FAILURE (clGetKernelInfo (cl_adapter::cast<cl_kernel>(hKernel),
84- mapURKernelInfoToCL (propName),
85- sizeof (NumArgs), &NumArgs, nullptr ));
86- if (pPropValue) {
87- if (propSize != sizeof (size_t ))
88- return UR_RESULT_ERROR_INVALID_SIZE;
89- *static_cast <size_t *>(pPropValue) = static_cast <size_t >(NumArgs);
90- }
91- } else {
92- size_t CheckPropSize = 0 ;
93- cl_int ClResult = clGetKernelInfo (cl_adapter::cast<cl_kernel>(hKernel),
94- mapURKernelInfoToCL (propName), propSize,
95- pPropValue, &CheckPropSize);
96- if (pPropValue && CheckPropSize != propSize) {
97- return UR_RESULT_ERROR_INVALID_SIZE;
98- }
99- CL_RETURN_ON_FAILURE (ClResult);
100- if (pPropSizeRet) {
101- *pPropSizeRet = CheckPropSize;
102- }
76+ // OpenCL doesn't have a way to support this.
77+ if (propName == UR_KERNEL_INFO_NUM_REGS) {
78+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
79+ }
80+ size_t CheckPropSize = 0 ;
81+ cl_int ClResult = clGetKernelInfo (cl_adapter::cast<cl_kernel>(hKernel),
82+ mapURKernelInfoToCL (propName), propSize,
83+ pPropValue, &CheckPropSize);
84+ if (pPropValue && CheckPropSize != propSize) {
85+ return UR_RESULT_ERROR_INVALID_SIZE;
86+ }
87+ CL_RETURN_ON_FAILURE (ClResult);
88+ if (pPropSizeRet) {
89+ *pPropSizeRet = CheckPropSize;
10390 }
10491
10592 return UR_RESULT_SUCCESS;
0 commit comments