[Beignet] [PATCH V2] add [opencl-1.2] API clCreateSubDevice.
He Junyan
junyan.he at inbox.com
Mon Jun 9 22:50:01 PDT 2014
That's OK
On Fri, 2014-06-06 at 05:07 +0800, xionghu.luo at intel.com wrote:
> From: Luo <xionghu.luo at intel.com>
>
> creates an array of sub-devices that each reference a non-intersecting
> set of compute units within in_device, according to a partition scheme
> given by properties.
> ---
> src/cl_api.c | 10 ++++++++--
> src/cl_device_id.c | 6 ++++++
> src/cl_device_id.h | 7 +++++++
> src/cl_gt_device.h | 7 ++++++-
> 4 files changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/src/cl_api.c b/src/cl_api.c
> index 8598088..8264970 100644
> --- a/src/cl_api.c
> +++ b/src/cl_api.c
> @@ -242,8 +242,14 @@ clCreateSubDevices(cl_device_id in_device,
> cl_device_id * out_devices,
> cl_uint * num_devices_ret)
> {
> - NOT_IMPLEMENTED;
> - return 0;
> + /* Check parameter consistency */
> + if (UNLIKELY(out_devices == NULL && num_devices_ret == NULL))
> + return CL_INVALID_VALUE;
> + if (UNLIKELY(in_device == NULL && properties == NULL))
> + return CL_INVALID_VALUE;
> +
> + *num_devices_ret = 0;
> + return CL_INVALID_DEVICE_PARTITION_COUNT;
> }
>
> cl_int
> diff --git a/src/cl_device_id.c b/src/cl_device_id.c
> index 8ec7741..df37519 100644
> --- a/src/cl_device_id.c
> +++ b/src/cl_device_id.c
> @@ -393,6 +393,12 @@ cl_get_device_info(cl_device_id device,
> DECL_STRING_FIELD(OPENCL_C_VERSION, opencl_c_version)
> DECL_STRING_FIELD(EXTENSIONS, extensions);
> DECL_STRING_FIELD(BUILT_IN_KERNELS, built_in_kernels)
> + DECL_FIELD(PARENT_DEVICE, parent_device)
> + DECL_FIELD(PARTITION_MAX_SUB_DEVICES, partition_max_sub_device)
> + DECL_FIELD(PARTITION_PROPERTIES, partition_property)
> + DECL_FIELD(PARTITION_AFFINITY_DOMAIN, affinity_domain)
> + DECL_FIELD(PARTITION_TYPE, partition_type)
> + DECL_FIELD(REFERENCE_COUNT, device_reference_count)
>
> case CL_DRIVER_VERSION:
> if (param_value_size_ret) {
> diff --git a/src/cl_device_id.h b/src/cl_device_id.h
> index 2bbe98e..a5449a7 100644
> --- a/src/cl_device_id.h
> +++ b/src/cl_device_id.h
> @@ -98,6 +98,13 @@ struct _cl_device_id {
> /* Kernel specific info that we're assigning statically */
> size_t wg_sz;
> size_t preferred_wg_sz_mul;
> + /* SubDevice specific info */
> + cl_device_id parent_device;
> + cl_uint partition_max_sub_device;
> + cl_device_partition_property partition_property[3];
> + cl_device_affinity_domain affinity_domain;
> + cl_device_partition_property partition_type[3];
> + cl_uint device_reference_count;
> };
>
> /* Get a device from the given platform */
> diff --git a/src/cl_gt_device.h b/src/cl_gt_device.h
> index cab2c58..b8bda5e 100644
> --- a/src/cl_gt_device.h
> +++ b/src/cl_gt_device.h
> @@ -101,5 +101,10 @@ DECL_INFO_STRING(built_in_kernels, "__cl_copy_region_align4;"
>
> DECL_INFO_STRING(driver_version, LIBCL_DRIVER_VERSION_STRING)
> #undef DECL_INFO_STRING
> -
> +.parent_device = NULL,
> +.partition_max_sub_device = 1,
> +.partition_property = {0},
> +.affinity_domain = 0,
> +.partition_type = {0},
> +.device_reference_count = 1,
>
More information about the Beignet
mailing list