summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYang Rong <rong.r.yang@intel.com>2017-02-10 16:11:13 +0800
committerYang Rong <rong.r.yang@intel.com>2017-02-14 17:03:38 +0800
commitc6cde5ceb860047bcda176de564d2fc088932d68 (patch)
treedf77c3ae1de6f1359c1eefef858c6b37f9b44cdd /src
parent9e96ddfce7120e48730e39f4ce5a9d2e4fab10e9 (diff)
Runtime: fix get non support type device bug.
Only return support device type (GPU and default) in function cl_get_gt_device. Contributor: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Pan Xiuli <xiuli.pan@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/cl_device_id.c10
-rw-r--r--src/cl_device_id.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/cl_device_id.c b/src/cl_device_id.c
index 31f8616c..d4f4208e 100644
--- a/src/cl_device_id.c
+++ b/src/cl_device_id.c
@@ -255,12 +255,16 @@ static struct _cl_device_id intel_kbl_gt4_device = {
};
LOCAL cl_device_id
-cl_get_gt_device(void)
+cl_get_gt_device(cl_device_type device_type)
{
cl_device_id ret = NULL;
const int device_id = cl_driver_get_device_id();
cl_device_id device = NULL;
+ //cl_get_gt_device only return GPU type device.
+ if (((CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_DEFAULT) & device_type) == 0)
+ return NULL;
+
#define DECL_INFO_STRING(BREAK, STRUCT, FIELD, STRING) \
STRUCT.FIELD = STRING; \
STRUCT.JOIN(FIELD,_sz) = sizeof(STRING); \
@@ -877,7 +881,7 @@ cl_get_device_ids(cl_platform_id platform,
cl_device_id device;
/* Do we have a usable device? */
- device = cl_get_gt_device();
+ device = cl_get_gt_device(device_type);
if (device) {
cl_self_test_res ret = cl_self_test(device, SELF_TEST_PASS);
if (ret == SELF_TEST_ATOMIC_FAIL) {
@@ -1603,7 +1607,7 @@ cl_devices_list_check(cl_uint num_devices, const cl_device_id *devices)
}
// TODO: We now just support Gen Device.
- if (devices[i] != cl_get_gt_device()) {
+ if (devices[i] != cl_get_gt_device(devices[i]->device_type)) {
return CL_INVALID_DEVICE;
}
}
diff --git a/src/cl_device_id.h b/src/cl_device_id.h
index 9d8b5128..6b8f2ebe 100644
--- a/src/cl_device_id.h
+++ b/src/cl_device_id.h
@@ -154,7 +154,7 @@ extern cl_int cl_get_device_ids(cl_platform_id platform,
cl_uint * num_devices);
/* Get the intel GPU device we currently have in this machine (if any) */
-extern cl_device_id cl_get_gt_device(void);
+extern cl_device_id cl_get_gt_device(cl_device_type device_type);
/* Provide info about the device */
extern cl_int cl_get_device_info(cl_device_id device,