[Beignet] [PATCH] add [opencl-1.2] API clCreateSubDevice.
xionghu.luo at intel.com
xionghu.luo at intel.com
Mon May 12 13:25:38 PDT 2014
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 9c22819..2077d02 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_SUCCESS;
}
cl_int
diff --git a/src/cl_device_id.c b/src/cl_device_id.c
index 2b443c6..37f49be 100644
--- a/src/cl_device_id.c
+++ b/src/cl_device_id.c
@@ -346,6 +346,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 5f7c9fe..6f8d25f 100644
--- a/src/cl_device_id.h
+++ b/src/cl_device_id.h
@@ -97,6 +97,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 110988a..88decd7 100644
--- a/src/cl_gt_device.h
+++ b/src/cl_gt_device.h
@@ -78,5 +78,10 @@ DECL_INFO_STRING(extensions, "")
DECL_INFO_STRING(built_in_kernels, "")
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,
--
1.8.1.2
More information about the Beignet
mailing list