summaryrefslogtreecommitdiff
path: root/utests/utest_helper.cpp
diff options
context:
space:
mode:
authorPan Xiuli <xiuli.pan@intel.com>2016-06-16 05:55:24 +0800
committerYang Rong <rong.r.yang@intel.com>2016-07-15 18:25:06 +0800
commite606e2da5445e3103f5d106d0582d18a755e45a9 (patch)
treecd0e223bb72493ce16949ba68243476acb583e21 /utests/utest_helper.cpp
parent41020e3d184117ba4f81a49d07c7e0c3bbdeddc8 (diff)
downloadbeignet-e606e2da5445e3103f5d106d0582d18a755e45a9.tar.gz
Utest: Add check for cl_intel_subgroups extension tests
These tests can only run with cl_intel_subgroups extension, add check before runing the tests. Also refine the call of the extension API with function pointer. V2: Use clGetExtensionFunctionAddress to get extension API function Signed-off-by: Pan Xiuli <xiuli.pan@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/utest_helper.cpp')
-rw-r--r--utests/utest_helper.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index 76993d5e..0ecbea31 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -54,6 +54,7 @@ __thread void *buf_data[MAX_BUFFER_N] = {};
__thread size_t globals[3] = {};
__thread size_t locals[3] = {};
float ULPSIZE_FAST_MATH = 10000.;
+__attribute__ ((visibility ("internal"))) clGetKernelSubGroupInfoKHR_cb* utestclGetKernelSubGroupInfoKHR = NULL;
#ifdef HAS_EGL
Display *xDisplay;
@@ -874,3 +875,24 @@ int cl_check_beignet(void)
free(device_version_str);
return 1;
}
+
+int cl_check_subgroups(void)
+{
+ std::string extStr;
+ size_t param_value_size;
+ OCL_CALL(clGetDeviceInfo, device, CL_DEVICE_EXTENSIONS, 0, 0, &param_value_size);
+ std::vector<char> param_value(param_value_size);
+ OCL_CALL(clGetDeviceInfo, device, CL_DEVICE_EXTENSIONS, param_value_size,
+ param_value.empty() ? NULL : &param_value.front(), &param_value_size);
+ if (!param_value.empty())
+ extStr = std::string(&param_value.front(), param_value_size-1);
+
+ if (std::strstr(extStr.c_str(), "cl_intel_subgroups") == NULL) {
+ printf("No cl_intel_subgroups, Skip!");
+ return 0;
+ }
+ if(utestclGetKernelSubGroupInfoKHR == NULL)
+ utestclGetKernelSubGroupInfoKHR = (clGetKernelSubGroupInfoKHR_cb*) clGetExtensionFunctionAddress("clGetKernelSubGroupInfoKHR");
+ return 1;
+}
+