Skip to content

Commit

Permalink
Replace cl prefix with clIcd prefix for new entry points.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerilk committed Nov 28, 2023
1 parent c1d3502 commit 6b14a70
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 171 deletions.
22 changes: 11 additions & 11 deletions loader/icd.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ void khrIcdVendorAdd(const char *libraryName)
pfn_clGetExtensionFunctionAddress p_clGetExtensionFunctionAddress = NULL;
pfn_clIcdGetPlatformIDs p_clIcdGetPlatformIDs = NULL;
#if KHR_LOADER_MANAGED_DISPATCH
clGetFunctionAddressForPlatformKHR_fn p_clGetFunctionAddressForPlatform = NULL;
clSetPlatformDispatchDataKHR_fn p_clSetPlatformDispatchData = NULL;
clIcdGetFunctionAddressForPlatformKHR_fn p_clIcdGetFunctionAddressForPlatform = NULL;
clIcdSetPlatformDispatchDataKHR_fn p_clIcdSetPlatformDispatchData = NULL;
#endif
cl_uint i = 0;
cl_uint platformCount = 0;
Expand Down Expand Up @@ -109,9 +109,9 @@ void khrIcdVendorAdd(const char *libraryName)
}

#if KHR_LOADER_MANAGED_DISPATCH
// try to get clGetFunctionAddressForPlatformKHR and clSetPlatformDispatchDataKHR to detect cl_khr_icd2 support
p_clGetFunctionAddressForPlatform = (clGetFunctionAddressForPlatformKHR_fn)(size_t)p_clGetExtensionFunctionAddress("clGetFunctionAddressForPlatformKHR");
p_clSetPlatformDispatchData = (clSetPlatformDispatchDataKHR_fn)(size_t)p_clGetExtensionFunctionAddress("clSetPlatformDispatchDataKHR");
// try to get clIcdGetFunctionAddressForPlatformKHR and clIcdSetPlatformDispatchDataKHR to detect cl_khr_icd2 support
p_clIcdGetFunctionAddressForPlatform = (clIcdGetFunctionAddressForPlatformKHR_fn)(size_t)p_clGetExtensionFunctionAddress("clIcdGetFunctionAddressForPlatformKHR");
p_clIcdSetPlatformDispatchData = (clIcdSetPlatformDispatchDataKHR_fn)(size_t)p_clGetExtensionFunctionAddress("clIcdSetPlatformDispatchDataKHR");
#endif

// query the number of platforms available and allocate space to store them
Expand Down Expand Up @@ -149,14 +149,14 @@ void khrIcdVendorAdd(const char *libraryName)
}

#if KHR_LOADER_MANAGED_DISPATCH
if (KHR_ICD2_HAS_TAG(platforms[i]) && !p_clGetFunctionAddressForPlatform)
if (KHR_ICD2_HAS_TAG(platforms[i]) && !p_clIcdGetFunctionAddressForPlatform)
{
KHR_ICD_TRACE("found icd 2 object, but platform is missing clGetFunctionAddressForPlatformKHR");
KHR_ICD_TRACE("found icd 2 object, but platform is missing clIcdGetFunctionAddressForPlatformKHR\n");
continue;
}
if (KHR_ICD2_HAS_TAG(platforms[i]) && !p_clSetPlatformDispatchData)
if (KHR_ICD2_HAS_TAG(platforms[i]) && !p_clIcdSetPlatformDispatchData)
{
KHR_ICD_TRACE("found icd 2 object, but platform is missing clSetPlatformDispatchDataKHR");
KHR_ICD_TRACE("found icd 2 object, but platform is missing clIcdSetPlatformDispatchDataKHR\n");
continue;
}
#endif
Expand All @@ -174,8 +174,8 @@ void khrIcdVendorAdd(const char *libraryName)
// populate cl_khr_icd2 platform's loader managed dispatch tables
if (KHR_ICD2_HAS_TAG(platforms[i]))
{
khrIcd2PopulateDispatchTable(platforms[i], p_clGetFunctionAddressForPlatform, &vendor->dispData.dispatch);
p_clSetPlatformDispatchData(platforms[i], &vendor->dispData);
khrIcd2PopulateDispatchTable(platforms[i], p_clIcdGetFunctionAddressForPlatform, &vendor->dispData.dispatch);
p_clIcdSetPlatformDispatchData(platforms[i], &vendor->dispData);
KHR_ICD_TRACE("found icd 2 platform, using loader managed dispatch\n");
}
#endif
Expand Down
14 changes: 7 additions & 7 deletions loader/icd_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,24 @@
#define CL_ICD2_TAG_KHR ((size_t)0x4F50454E434C3331ULL)

typedef void * CL_API_CALL
clGetFunctionAddressForPlatformKHR_t(
clIcdGetFunctionAddressForPlatformKHR_t(
cl_platform_id platform,
const char* func_name);

typedef clGetFunctionAddressForPlatformKHR_t *
clGetFunctionAddressForPlatformKHR_fn;
typedef clIcdGetFunctionAddressForPlatformKHR_t *
clIcdGetFunctionAddressForPlatformKHR_fn;

typedef cl_int CL_API_CALL
clSetPlatformDispatchDataKHR_t(
clIcdSetPlatformDispatchDataKHR_t(
cl_platform_id platform,
void *disp_data);

typedef clSetPlatformDispatchDataKHR_t *
clSetPlatformDispatchDataKHR_fn;
typedef clIcdSetPlatformDispatchDataKHR_t *
clIcdSetPlatformDispatchDataKHR_fn;

extern void khrIcd2PopulateDispatchTable(
cl_platform_id platform,
clGetFunctionAddressForPlatformKHR_fn p_clGetFunctionAddressForPlatform,
clIcdGetFunctionAddressForPlatformKHR_fn p_clIcdGetFunctionAddressForPlatform,
struct _cl_icd_dispatch* dispatch);

#endif // defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) && !defined(CL_ICD2_TAG_KHR)
Expand Down
Loading

0 comments on commit 6b14a70

Please sign in to comment.