diff options
-rw-r--r-- | utests/builtin_global_linear_id.cpp | 2 | ||||
-rw-r--r-- | utests/builtin_local_linear_id.cpp | 2 | ||||
-rw-r--r-- | utests/utest_helper.cpp | 29 | ||||
-rw-r--r-- | utests/utest_helper.hpp | 3 |
4 files changed, 36 insertions, 0 deletions
diff --git a/utests/builtin_global_linear_id.cpp b/utests/builtin_global_linear_id.cpp index 06807c20..cda7e840 100644 --- a/utests/builtin_global_linear_id.cpp +++ b/utests/builtin_global_linear_id.cpp @@ -29,6 +29,8 @@ dimension:3 #include "utest_helper.hpp" static void builtin_global_linear_id(void) { + if (!cl_check_ocl20()) + return; // Setup kernel and buffers int dim, err, i, buf_len=1; diff --git a/utests/builtin_local_linear_id.cpp b/utests/builtin_local_linear_id.cpp index 8d706d05..88cb3572 100644 --- a/utests/builtin_local_linear_id.cpp +++ b/utests/builtin_local_linear_id.cpp @@ -30,6 +30,8 @@ dimension:3 #include "utest_helper.hpp" static void builtin_local_linear_id(void) { + if (!cl_check_ocl20()) + return; // Setup kernel and buffers int dim, i, buf_len=1; diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp index 0ecbea31..da4cfbff 100644 --- a/utests/utest_helper.cpp +++ b/utests/utest_helper.cpp @@ -896,3 +896,32 @@ int cl_check_subgroups(void) return 1; } +int cl_check_ocl20(void) +{ + size_t param_value_size; + size_t ret_sz; + OCL_CALL(clGetDeviceInfo, device, CL_DEVICE_OPENCL_C_VERSION, 0, 0, ¶m_value_size); + if(param_value_size == 0) { + printf("Not OpenCL 2.0 device, "); + if(cl_check_beignet()) { + printf("Beignet extension test!"); + return 1; + } + return 0; + } + char* device_version_str = (char* )malloc(param_value_size * sizeof(char) ); + OCL_CALL(clGetDeviceInfo, device, CL_DEVICE_OPENCL_C_VERSION, param_value_size, (void*)device_version_str, &ret_sz); + OCL_ASSERT(ret_sz == param_value_size); + + if(!strstr(device_version_str, "2.0")) { + free(device_version_str); + printf("Not OpenCL 2.0 device, "); + if(cl_check_beignet()) { + printf("Beignet extension test!"); + return 1; + } + return 0; + } + free(device_version_str); + return 1; +} diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp index 7d050569..421e356a 100644 --- a/utests/utest_helper.hpp +++ b/utests/utest_helper.hpp @@ -296,4 +296,7 @@ typedef cl_int(clGetKernelSubGroupInfoKHR_cb)(cl_kernel, cl_device_id, const void *, size_t, void *, size_t *); extern clGetKernelSubGroupInfoKHR_cb* utestclGetKernelSubGroupInfoKHR; + +/* Check is cl version 2.0. */ +extern int cl_check_ocl20(void); #endif /* __UTEST_HELPER_HPP__ */ |