@@ -192,10 +192,7 @@ urKernelGetSubGroupInfo(ur_kernel_handle_t hKernel, ur_device_handle_t hDevice,
192192
193193 // We need to allow for the possibility that this device runs an older CL and
194194 // supports the original khr subgroup extension.
195- using ApiFuncT =
196- cl_int (CL_API_CALL *)(cl_kernel, cl_device_id, cl_kernel_sub_group_info,
197- size_t , const void *, size_t , void *, size_t *);
198- ApiFuncT GetKernelSubGroupInfo = nullptr ;
195+ cl_ext::clGetKernelSubGroupInfoKHR_fn GetKernelSubGroupInfo = nullptr ;
199196
200197 oclv::OpenCLVersion DevVer;
201198 CL_RETURN_ON_FAILURE (cl_adapter::getDeviceVersion (
@@ -210,16 +207,13 @@ urKernelGetSubGroupInfo(ur_kernel_handle_t hKernel, ur_device_handle_t hDevice,
210207 if (!SubgroupExtSupported) {
211208 return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
212209 }
213- cl_platform_id Platform;
214- CL_RETURN_ON_FAILURE (clGetDeviceInfo (
215- cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_PLATFORM,
216- sizeof (Platform), &Platform, nullptr ));
217- GetKernelSubGroupInfo =
218- reinterpret_cast <ApiFuncT>(clGetExtensionFunctionAddressForPlatform (
219- Platform, " clGetKernelSubGroupInfoKHR" ));
220- if (!GetKernelSubGroupInfo) {
221- return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
222- }
210+ cl_context Context = nullptr ;
211+ CL_RETURN_ON_FAILURE (clGetKernelInfo (cl_adapter::cast<cl_kernel>(hKernel),
212+ CL_KERNEL_CONTEXT, sizeof (Context),
213+ &Context, nullptr ));
214+ UR_RETURN_ON_FAILURE (cl_ext::getExtFuncFromContext (
215+ Context, cl_ext::ExtFuncPtrCache->clGetKernelSubGroupInfoKHRCache ,
216+ cl_ext::GetKernelSubGroupInfoName, &GetKernelSubGroupInfo));
223217 } else {
224218 GetKernelSubGroupInfo = clGetKernelSubGroupInfo;
225219 }
0 commit comments