diff --git a/ocl_icd_loader.c b/ocl_icd_loader.c index 8d638e7..64c429a 100644 --- a/ocl_icd_loader.c +++ b/ocl_icd_loader.c @@ -499,6 +499,8 @@ static inline void _find_and_check_platforms(cl_uint num_icds) { #ifdef CL_ICD2_TAG_KHR clGetFunctionAddressForPlatformKHR_fn pltfn_fn_ptr = _get_function_addr(dlh, picd->ext_fn_ptr, "clGetFunctionAddressForPlatformKHR"); + clSetPlatformDispatchDataKHR_fn spltdd_fn_ptr = + _get_function_addr(dlh, picd->ext_fn_ptr, "clSetPlatformDispatchDataKHR"); #endif for(j=0; jpid)) + if (KHR_ICD2_HAS_TAG(p->pid) && !spltdd_fn_ptr) { + debug(D_WARN, "Found icd 2 platform, but it is missing clSetPlatformDispatchDataKHR, skipping it"); + continue; + } + + if (KHR_ICD2_HAS_TAG(p->pid)) { _populate_dispatch_table(p->pid, pltfn_fn_ptr, &p->disp_data.dispatch); - p->pid->disp_data = &p->disp_data; + spltdd_fn_ptr(p->pid, &p->disp_data); debug(D_LOG, "Found icd 2 pltform, using loader managed dispatch"); } #endif diff --git a/ocl_icd_loader.h b/ocl_icd_loader.h index 0b96490..463b968 100644 --- a/ocl_icd_loader.h +++ b/ocl_icd_loader.h @@ -92,6 +92,14 @@ clGetFunctionAddressForPlatformKHR_t( typedef clGetFunctionAddressForPlatformKHR_t * clGetFunctionAddressForPlatformKHR_fn; +typedef cl_int CL_API_CALL +clSetPlatformDispatchDataKHR_t( + cl_platform_id platform, + void *disp_data); + +typedef clSetPlatformDispatchDataKHR_t * +clSetPlatformDispatchDataKHR_fn; + __attribute__((visibility("hidden"))) extern void _populate_dispatch_table( cl_platform_id platform,