[Beignet] [PATCH] Runtime: Implement clGetExtensionFunctionAddressForPlatform.

Yang, Rong R rong.r.yang at intel.com
Wed Sep 10 00:35:42 PDT 2014


LGTM, thanks.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Zhigang Gong
> Sent: Wednesday, September 10, 2014 1:47 PM
> To: beignet at lists.freedesktop.org
> Cc: Zhigang Gong
> Subject: [Beignet] [PATCH] Runtime: Implement
> clGetExtensionFunctionAddressForPlatform.
> 
> 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
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list