summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Richter <Simon.Richter@hogyros.de>2013-04-19 13:39:12 +0200
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-04-24 16:41:02 +0800
commit0c8f6feab9de4313b5466edcbbee5f4a63de0917 (patch)
treeeb9e90a7d56a0e5d4ac6296f185e5154b0ca8011
parent90a4f7b01a638933b4066c59bb729e06dd529b10 (diff)
Implement clGetDeviceInfo(..., CL_DRIVER_VERSION, ...)
This returns the library major/minor version. As it does not follow the usual naming scheme, the output code is duplicated. Signed-off-by: Simon Richter <Simon.Richter@hogyros.de> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--src/cl_device_id.c12
-rw-r--r--src/cl_device_id.h2
-rw-r--r--src/cl_gt_device.h1
-rw-r--r--src/cl_platform_id.h7
4 files changed, 20 insertions, 2 deletions
diff --git a/src/cl_device_id.c b/src/cl_device_id.c
index 114a0cef..6300b41a 100644
--- a/src/cl_device_id.c
+++ b/src/cl_device_id.c
@@ -230,6 +230,18 @@ cl_get_device_info(cl_device_id device,
DECL_STRING_FIELD(PROFILE, profile)
DECL_STRING_FIELD(OPENCL_C_VERSION, opencl_c_version)
DECL_STRING_FIELD(EXTENSIONS, extensions);
+
+ case CL_DRIVER_VERSION:
+ if (param_value_size_ret) {
+ *param_value_size_ret = device->driver_version_sz;
+ if (!param_value)
+ return CL_SUCCESS;
+ }
+ if (param_value_size < device->driver_version_sz)
+ return CL_INVALID_VALUE;
+ memcpy(param_value, device->driver_version, device->driver_version_sz);
+ return CL_SUCCESS;
+
default: return CL_INVALID_VALUE;
};
}
diff --git a/src/cl_device_id.h b/src/cl_device_id.h
index 610eaf6a..d199ecb3 100644
--- a/src/cl_device_id.h
+++ b/src/cl_device_id.h
@@ -83,12 +83,14 @@ struct _cl_device_id {
const char *profile;
const char *opencl_c_version;
const char *extensions;
+ const char *driver_version;
size_t name_sz;
size_t vendor_sz;
size_t version_sz;
size_t profile_sz;
size_t opencl_c_version_sz;
size_t extensions_sz;
+ size_t driver_version_sz;
/* Kernel specific info that we're assigning statically */
size_t wg_sz;
size_t compile_wg_sz[3];
diff --git a/src/cl_gt_device.h b/src/cl_gt_device.h
index 993017b5..f26cd8ae 100644
--- a/src/cl_gt_device.h
+++ b/src/cl_gt_device.h
@@ -72,6 +72,7 @@ DECL_INFO_STRING(version, OCL_VERSION_STRING)
DECL_INFO_STRING(profile, "FULL_PROFILE")
DECL_INFO_STRING(opencl_c_version, "OpenCL 1.10")
DECL_INFO_STRING(extensions, "")
+DECL_INFO_STRING(driver_version, LIBCL_VERSION_STRING)
#undef DECL_INFO_STRING
diff --git a/src/cl_platform_id.h b/src/cl_platform_id.h
index edd3aaeb..3a74028a 100644
--- a/src/cl_platform_id.h
+++ b/src/cl_platform_id.h
@@ -25,6 +25,8 @@
#include "cl_khr_icd.h"
#include "CL/cl.h"
+#include "src/OCLConfig.h"
+
struct _cl_platform_id {
DEFINE_ICD(dispatch)
const char *profile;
@@ -61,9 +63,10 @@ extern cl_int cl_get_platform_info(cl_platform_id platform,
#define OCL_VERSION_MINOR 0
#define _STR(x) #x
-#define _JOINT(x, y) "OpenCL " _STR(x) "." _STR(y)
+#define _JOINT(x, y) _STR(x) "." _STR(y)
-#define OCL_VERSION_STRING _JOINT(OCL_VERSION_MAJOR, OCL_VERSION_MINOR)
+#define OCL_VERSION_STRING "OpenCL " _JOINT(OCL_VERSION_MAJOR, OCL_VERSION_MINOR)
+#define LIBCL_VERSION_STRING _JOINT(LIBCL_VERSION_MAJOR, LIBCL_VERSION_MINOR)
#endif /* __CL_PLATFORM_ID_H__ */