diff options
author | Pan Xiuli <xiuli.pan@intel.com> | 2017-02-13 09:51:45 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2017-02-14 15:23:24 +0800 |
commit | 9e96ddfce7120e48730e39f4ce5a9d2e4fab10e9 (patch) | |
tree | 8048928a5edc3f9c204fdda2157bff2b88106a62 /src | |
parent | 3c31216a4ef148ba2e6048e30c62a7a7209407cb (diff) | |
download | beignet-9e96ddfce7120e48730e39f4ce5a9d2e4fab10e9.tar.gz |
Enable OpenCL 2.0 only where supported
This allows a single beignet binary to both offer 2.0 where
available, and still work on older hardware.
V2: Default to 1.2 when -cl-std is not set (required by the OpenCL spec,
and also likely to be faster).
V3: Only enable OpenCL 2.0 when llvm version is 39.
V4: Only enable OpenCL 2.0 on x64 host.
V5: Always return 32 as address bits.
Contributor: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Signed-off-by: Pan Xiuli <xiuli.pan@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cl_device_data.h | 2 | ||||
-rw-r--r-- | src/cl_gen9_device.h | 2 | ||||
-rw-r--r-- | src/cl_gt_device.h | 14 | ||||
-rw-r--r-- | src/cl_platform_id.c | 2 | ||||
-rw-r--r-- | src/cl_platform_id.h | 6 |
5 files changed, 18 insertions, 8 deletions
diff --git a/src/cl_device_data.h b/src/cl_device_data.h index 4ee4ca37..f3c52049 100644 --- a/src/cl_device_data.h +++ b/src/cl_device_data.h @@ -363,5 +363,7 @@ #define IS_GEN9(devid) (IS_SKYLAKE(devid) || IS_BROXTON(devid) || IS_KABYLAKE(devid)) +#define MAX_OCLVERSION(devid) (IS_GEN9(devid) ? 200 : 120) + #endif /* __CL_DEVICE_DATA_H__ */ diff --git a/src/cl_gen9_device.h b/src/cl_gen9_device.h index be30a496..b0a3ab8e 100644 --- a/src/cl_gen9_device.h +++ b/src/cl_gen9_device.h @@ -27,5 +27,7 @@ .max_mem_alloc_size = 4 * 1024 * 1024 * 1024ul, .global_mem_size = 4 * 1024 * 1024 * 1024ul, +#define GEN9_DEVICE 1 #include "cl_gt_device.h" +#undef GEN9_DEVICE diff --git a/src/cl_gt_device.h b/src/cl_gt_device.h index cf5ad7af..ca4f3c57 100644 --- a/src/cl_gt_device.h +++ b/src/cl_gt_device.h @@ -16,7 +16,15 @@ * * Author: Benjamin Segovia <benjamin.segovia@intel.com> */ - +#undef LIBCL_VERSION_STRING +#undef LIBCL_C_VERSION_STRING +#ifdef GEN9_DEVICE +#define LIBCL_VERSION_STRING GEN9_LIBCL_VERSION_STRING +#define LIBCL_C_VERSION_STRING GEN9_LIBCL_C_VERSION_STRING +#else +#define LIBCL_VERSION_STRING NONGEN9_LIBCL_VERSION_STRING +#define LIBCL_C_VERSION_STRING NONGEN9_LIBCL_C_VERSION_STRING +#endif /* Common fields for both all GT devices (IVB / SNB) */ .device_type = CL_DEVICE_TYPE_GPU, .device_id=0,/* == device_id (set when requested) */ @@ -39,11 +47,7 @@ .native_vector_width_float = 4, .native_vector_width_double = 2, .native_vector_width_half = 8, -#ifdef ENABLE_OPENCL_20 -.address_bits = 64, -#else .address_bits = 32, -#endif .svm_capabilities = CL_DEVICE_SVM_COARSE_GRAIN_BUFFER, .preferred_platform_atomic_alignment = 0, .preferred_global_atomic_alignment = 0, diff --git a/src/cl_platform_id.c b/src/cl_platform_id.c index 1f21f5dd..2afafb2c 100644 --- a/src/cl_platform_id.c +++ b/src/cl_platform_id.c @@ -32,7 +32,7 @@ static struct _cl_platform_id intel_platform_data = { DECL_INFO_STRING(profile, "FULL_PROFILE") - DECL_INFO_STRING(version, LIBCL_VERSION_STRING) + DECL_INFO_STRING(version, GEN9_LIBCL_VERSION_STRING) DECL_INFO_STRING(name, "Intel Gen OCL Driver") DECL_INFO_STRING(vendor, "Intel") DECL_INFO_STRING(icd_suffix_khr, "Intel") diff --git a/src/cl_platform_id.h b/src/cl_platform_id.h index 3fdb920c..89e08572 100644 --- a/src/cl_platform_id.h +++ b/src/cl_platform_id.h @@ -72,8 +72,10 @@ extern cl_int cl_get_platform_ids(cl_uint num_entries, #else #define LIBCL_DRIVER_VERSION_STRING _JOINT(LIBCL_DRIVER_VERSION_MAJOR, LIBCL_DRIVER_VERSION_MINOR) #endif -#define LIBCL_VERSION_STRING "OpenCL " _JOINT(LIBCL_C_VERSION_MAJOR, LIBCL_C_VERSION_MINOR) " beignet " LIBCL_DRIVER_VERSION_STRING BEIGNET_GIT_SHA1_STRING -#define LIBCL_C_VERSION_STRING "OpenCL C " _JOINT(LIBCL_C_VERSION_MAJOR, LIBCL_C_VERSION_MINOR) " beignet " LIBCL_DRIVER_VERSION_STRING BEIGNET_GIT_SHA1_STRING +#define GEN9_LIBCL_VERSION_STRING "OpenCL " _JOINT(LIBCL_C_VERSION_MAJOR, LIBCL_C_VERSION_MINOR) " beignet " LIBCL_DRIVER_VERSION_STRING BEIGNET_GIT_SHA1_STRING +#define GEN9_LIBCL_C_VERSION_STRING "OpenCL C " _JOINT(LIBCL_C_VERSION_MAJOR, LIBCL_C_VERSION_MINOR) " beignet " LIBCL_DRIVER_VERSION_STRING BEIGNET_GIT_SHA1_STRING +#define NONGEN9_LIBCL_VERSION_STRING "OpenCL 1.2 beignet " LIBCL_DRIVER_VERSION_STRING BEIGNET_GIT_SHA1_STRING +#define NONGEN9_LIBCL_C_VERSION_STRING "OpenCL C 1.2 beignet " LIBCL_DRIVER_VERSION_STRING BEIGNET_GIT_SHA1_STRING #endif /* __CL_PLATFORM_ID_H__ */ |