[Beignet] [PATCH 11/13] Runtime: Add fp64 enable function for platform.

Yang, Rong R rong.r.yang at intel.com
Mon Oct 19 22:49:13 PDT 2015


Function cl_intel_platform_enable_fp64_extension and cl_intel_platform_enable_fp16_extension are almost same.
Can you merge them to one function? It is convenient to enable other extensions in future.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> junyan.he at inbox.com
> Sent: Friday, September 18, 2015 17:58
> To: beignet at lists.freedesktop.org
> Subject: [Beignet] [PATCH 11/13] Runtime: Add fp64 enable function for
> platform.
> 
> From: Junyan He <junyan.he at linux.intel.com>
> 
> We enable fp64 extension just on BDW platform. The platforms before Gen7
> will not have fp64 support.
> We will enable fp64 on gen8 later platforms after this feature is stable.
> 
> Signed-off-by: Junyan He <junyan.he at linux.intel.com>
> ---
>  src/cl_device_id.c  |  3 +++
>  src/cl_extensions.c | 21 +++++++++++++++++++++  src/cl_extensions.h |  2
> ++
>  3 files changed, 26 insertions(+)
> 
> diff --git a/src/cl_device_id.c b/src/cl_device_id.c index 1778292..59798aa
> 100644
> --- a/src/cl_device_id.c
> +++ b/src/cl_device_id.c
> @@ -407,6 +407,7 @@ brw_gt1_break:
>        intel_brw_gt1_device.platform = cl_get_platform_default();
>        ret = &intel_brw_gt1_device;
>        cl_intel_platform_enable_fp16_extension(ret);
> +      cl_intel_platform_enable_fp64_extension(ret);
>        break;
> 
>      case PCI_CHIP_BROADWLL_M_GT2:
> @@ -424,6 +425,7 @@ brw_gt2_break:
>        intel_brw_gt2_device.platform = cl_get_platform_default();
>        ret = &intel_brw_gt2_device;
>        cl_intel_platform_enable_fp16_extension(ret);
> +      cl_intel_platform_enable_fp64_extension(ret);
>        break;
> 
>      case PCI_CHIP_BROADWLL_M_GT3:
> @@ -443,6 +445,7 @@ brw_gt3_break:
>        intel_brw_gt3_device.platform = cl_get_platform_default();
>        ret = &intel_brw_gt3_device;
>        cl_intel_platform_enable_fp16_extension(ret);
> +      cl_intel_platform_enable_fp64_extension(ret);
>        break;
> 
>      case PCI_CHIP_CHV_0:
> diff --git a/src/cl_extensions.c b/src/cl_extensions.c index 3eb303f..35e99b2
> 100644
> --- a/src/cl_extensions.c
> +++ b/src/cl_extensions.c
> @@ -125,6 +125,27 @@
> cl_intel_platform_enable_fp16_extension(cl_device_id device)  }
> 
>  LOCAL void
> +cl_intel_platform_enable_fp64_extension(cl_device_id device) {
> +  cl_extensions_t new_ext;
> +  cl_platform_id pf = device->platform;
> +  int id;
> +  assert(pf);
> +
> +  memcpy(&new_ext, pf->internal_extensions, sizeof(new_ext));
> +
> +  for(id = BASE_EXT_START_ID; id <= BASE_EXT_END_ID; id++) {
> +    if (id == EXT_ID(khr_fp64))
> +      new_ext.extensions[id].base.ext_enabled = 1;  }
> +
> +  process_extension_str(&new_ext);
> +
> +  memcpy((char*)device->extensions, new_ext.ext_str,
> +sizeof(device->extensions));
> +  device->extensions_sz = strlen(new_ext.ext_str) + 1; }
> +
> +LOCAL void
>  cl_intel_platform_extension_init(cl_platform_id intel_platform)  {
>    static int ext_initialized = 0;
> diff --git a/src/cl_extensions.h b/src/cl_extensions.h index b4544e2..23cd9df
> 100644
> --- a/src/cl_extensions.h
> +++ b/src/cl_extensions.h
> @@ -97,4 +97,6 @@ cl_intel_platform_extension_init(cl_platform_id
> intel_platform);  extern void
> cl_intel_platform_enable_fp16_extension(cl_device_id device);  extern void
> +cl_intel_platform_enable_fp64_extension(cl_device_id device); extern
> +void
>  cl_intel_platform_get_default_extension(cl_device_id device);
> --
> 1.9.1
> 
> 
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list