[Beignet] [PATCH] Runtime: Implement clGetExtensionFunctionAddressForPlatform.

Zhigang Gong zhigang.gong at intel.com
Tue Sep 9 22:47:24 PDT 2014


From: Zhigang Gong <zhigang.gong at linux.intel.com>

It seems that this function is required by latest PyOpenCL.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/cl_api.c     | 19 +++++++++++++++++--
 src/cl_khr_icd.c |  2 +-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/cl_api.c b/src/cl_api.c
index 2370dc0..a8a4b74 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -3157,8 +3157,8 @@ error:
   if (strcmp(#x, func_name) == 0)       \
     return (void *)x;
 
-void*
-clGetExtensionFunctionAddress(const char *func_name)
+static void*
+internal_clGetExtensionFunctionAddress(const char *func_name)
 {
   if (func_name == NULL)
     return NULL;
@@ -3181,6 +3181,21 @@ clGetExtensionFunctionAddress(const char *func_name)
   return NULL;
 }
 
+void*
+clGetExtensionFunctionAddress(const char *func_name)
+{
+  return internal_clGetExtensionFunctionAddress(func_name);
+}
+
+void*
+clGetExtensionFunctionAddressForPlatform(cl_platform_id platform,
+                              const char *func_name)
+{
+  if (UNLIKELY(platform != NULL && platform != intel_platform))
+    return NULL;
+  return internal_clGetExtensionFunctionAddress(func_name);
+}
+
 #undef EXTFUNC
 
 cl_int
diff --git a/src/cl_khr_icd.c b/src/cl_khr_icd.c
index 6d49db0..50a0898 100644
--- a/src/cl_khr_icd.c
+++ b/src/cl_khr_icd.c
@@ -154,7 +154,7 @@ struct _cl_icd_dispatch const cl_khr_icd_dispatch = {
   clEnqueueMigrateMemObjects,
   clEnqueueMarkerWithWaitList,
   clEnqueueBarrierWithWaitList,
-  CL_1_2_NOTYET(clGetExtensionFunctionAddressForPlatform),
+  clGetExtensionFunctionAddressForPlatform,
   CL_GL_INTEROP(clCreateFromGLTexture),
   (void *) NULL,
   (void *) NULL,
-- 
1.8.3.2



More information about the Beignet mailing list