[Beignet] [PATCH V2 2/6] Utest: Add check for cl_intel_subgroups extension tests

Xiuli Pan xiuli.pan at intel.com
Thu Jul 7 03:09:31 UTC 2016


From: Pan Xiuli <xiuli.pan at intel.com>

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 at intel.com>
---
 utests/builtin_max_sub_group_size.cpp           |  4 ++-
 utests/builtin_num_sub_groups.cpp               |  4 ++-
 utests/builtin_sub_group_id.cpp                 |  4 ++-
 utests/builtin_sub_group_size.cpp               |  4 ++-
 utests/compiler_get_max_sub_group_size.cpp      |  2 ++
 utests/compiler_get_sub_group_local_id.cpp      |  2 ++
 utests/compiler_sub_group_shuffle.cpp           |  2 ++
 utests/compiler_subgroup_broadcast.cpp          |  8 +++++-
 utests/compiler_subgroup_buffer_block_read.cpp  | 10 ++++++-
 utests/compiler_subgroup_buffer_block_write.cpp | 10 ++++++-
 utests/compiler_subgroup_image_block_read.cpp   | 10 ++++++-
 utests/compiler_subgroup_image_block_write.cpp  | 10 ++++++-
 utests/compiler_subgroup_reduce.cpp             | 36 ++++++++++++++++++++++++-
 utests/compiler_subgroup_scan_exclusive.cpp     | 32 +++++++++++++++++++++-
 utests/compiler_subgroup_scan_inclusive.cpp     | 32 +++++++++++++++++++++-
 utests/utest_helper.cpp                         | 22 +++++++++++++++
 utests/utest_helper.hpp                         | 10 ++++++-
 17 files changed, 189 insertions(+), 13 deletions(-)

diff --git a/utests/builtin_max_sub_group_size.cpp b/utests/builtin_max_sub_group_size.cpp
index bb1423b..310d880 100644
--- a/utests/builtin_max_sub_group_size.cpp
+++ b/utests/builtin_max_sub_group_size.cpp
@@ -13,6 +13,8 @@ Now define local and global size as following:
 #include "utest_helper.hpp"
 static void builtin_max_sub_group_size(void)
 {
+  if(!cl_check_subgroups())
+    return;
 
   // Setup kernel and buffers
   size_t dim, i,local_sz = 1,buf_len = 1;
@@ -40,7 +42,7 @@ static void builtin_max_sub_group_size(void)
       locals[i - 1] = 0;
     }
 
-    OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*dim,locals,sizeof(size_t),&sub_sz,NULL);
+    OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*dim,locals,sizeof(size_t),&sub_sz,NULL);
     // Run the kernel
     OCL_NDRANGE( dim );
     clFinish(queue);
diff --git a/utests/builtin_num_sub_groups.cpp b/utests/builtin_num_sub_groups.cpp
index 78acb13..dcd691a 100644
--- a/utests/builtin_num_sub_groups.cpp
+++ b/utests/builtin_num_sub_groups.cpp
@@ -13,6 +13,8 @@ Now define local and global size as following:
 #include "utest_helper.hpp"
 static void builtin_num_sub_groups(void)
 {
+  if(!cl_check_subgroups())
+    return;
 
   // Setup kernel and buffers
   size_t dim, i,local_sz = 1,buf_len = 1;
@@ -40,7 +42,7 @@ static void builtin_num_sub_groups(void)
       locals[i - 1] = 0;
     }
 
-    OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR ,sizeof(size_t)*dim,locals,sizeof(size_t),&num_sub,NULL);
+    OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR ,sizeof(size_t)*dim,locals,sizeof(size_t),&num_sub,NULL);
     // Run the kernel
     OCL_NDRANGE( dim );
     clFinish(queue);
diff --git a/utests/builtin_sub_group_id.cpp b/utests/builtin_sub_group_id.cpp
index e81d173..89064bd 100644
--- a/utests/builtin_sub_group_id.cpp
+++ b/utests/builtin_sub_group_id.cpp
@@ -13,6 +13,8 @@ Now define local and global size as following:
 #include "utest_helper.hpp"
 static void builtin_sub_group_id(void)
 {
+  if(!cl_check_subgroups())
+    return;
 
   // Setup kernel and buffers
   size_t dim, i,local_sz = 1,buf_len = 1;
@@ -40,7 +42,7 @@ static void builtin_sub_group_id(void)
       locals[i - 1] = 0;
     }
 
-    OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*dim,locals,sizeof(size_t),&max_sub_sz,NULL);
+    OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*dim,locals,sizeof(size_t),&max_sub_sz,NULL);
     // Run the kernel
     OCL_NDRANGE( dim );
     clFinish(queue);
diff --git a/utests/builtin_sub_group_size.cpp b/utests/builtin_sub_group_size.cpp
index 1dc24ed..7f7c3e4 100644
--- a/utests/builtin_sub_group_size.cpp
+++ b/utests/builtin_sub_group_size.cpp
@@ -13,6 +13,8 @@ Now define local and global size as following:
 #include "utest_helper.hpp"
 static void builtin_sub_group_size(void)
 {
+  if(!cl_check_subgroups())
+    return;
 
   // Setup kernel and buffers
   size_t dim, i,local_sz = 1,buf_len = 1;
@@ -40,7 +42,7 @@ static void builtin_sub_group_size(void)
       locals[i - 1] = 0;
     }
 
-    OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*dim,locals,sizeof(size_t),&max_sub_sz,NULL);
+    OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*dim,locals,sizeof(size_t),&max_sub_sz,NULL);
     // Run the kernel
     OCL_NDRANGE( dim );
     clFinish(queue);
diff --git a/utests/compiler_get_max_sub_group_size.cpp b/utests/compiler_get_max_sub_group_size.cpp
index 1a4e074..6f56b33 100644
--- a/utests/compiler_get_max_sub_group_size.cpp
+++ b/utests/compiler_get_max_sub_group_size.cpp
@@ -2,6 +2,8 @@
 
 void compiler_get_max_sub_group_size(void)
 {
+  if(!cl_check_subgroups())
+    return;
   const size_t n = 256;
 
   // Setup kernel and buffers
diff --git a/utests/compiler_get_sub_group_local_id.cpp b/utests/compiler_get_sub_group_local_id.cpp
index 2df4e9b..84fbce0 100644
--- a/utests/compiler_get_sub_group_local_id.cpp
+++ b/utests/compiler_get_sub_group_local_id.cpp
@@ -2,6 +2,8 @@
 
 void compiler_get_sub_group_local_id(void)
 {
+  if(!cl_check_subgroups())
+    return;
   const size_t n = 256;
 
   // Setup kernel and buffers
diff --git a/utests/compiler_sub_group_shuffle.cpp b/utests/compiler_sub_group_shuffle.cpp
index 4ba8b99..f33e9de 100644
--- a/utests/compiler_sub_group_shuffle.cpp
+++ b/utests/compiler_sub_group_shuffle.cpp
@@ -2,6 +2,8 @@
 
 void compiler_sub_group_shuffle(void)
 {
+  if(!cl_check_subgroups())
+    return;
   const size_t n = 32;
   const int32_t buf_size = 4 * n + 1;
 
diff --git a/utests/compiler_subgroup_broadcast.cpp b/utests/compiler_subgroup_broadcast.cpp
index f029483..2835161 100644
--- a/utests/compiler_subgroup_broadcast.cpp
+++ b/utests/compiler_subgroup_broadcast.cpp
@@ -101,7 +101,7 @@ static void subgroup_generic(T* input,
   globals[0] = WG_GLOBAL_SIZE;
   locals[0] = WG_LOCAL_SIZE;
   size_t SIMD_SIZE = 0;
-  OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
+  OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
 
   cl_uint SIMD_ID = 10;
   /* input and expected data */
@@ -154,6 +154,8 @@ static void subgroup_generic(T* input,
  */
 void compiler_subgroup_broadcast_imm_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_broadcast",
@@ -163,6 +165,8 @@ void compiler_subgroup_broadcast_imm_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_broadcast_imm_int);
 void compiler_subgroup_broadcast_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_broadcast",
@@ -172,6 +176,8 @@ void compiler_subgroup_broadcast_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_broadcast_int);
 void compiler_subgroup_broadcast_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_broadcast",
diff --git a/utests/compiler_subgroup_buffer_block_read.cpp b/utests/compiler_subgroup_buffer_block_read.cpp
index 334ec76..9707f19 100644
--- a/utests/compiler_subgroup_buffer_block_read.cpp
+++ b/utests/compiler_subgroup_buffer_block_read.cpp
@@ -104,7 +104,7 @@ static void subgroup_generic(T* input,
   globals[0] = WG_GLOBAL_SIZE;
   locals[0] = WG_LOCAL_SIZE;
   size_t SIMD_SIZE = 0;
-  OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
+  OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
 
   size_t buf_sz = VEC_SIZE * WG_GLOBAL_SIZE;
   /* input and expected data */
@@ -158,6 +158,8 @@ static void subgroup_generic(T* input,
  */
 void compiler_subgroup_buffer_block_read1(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_buffer_block_read",
@@ -167,6 +169,8 @@ void compiler_subgroup_buffer_block_read1(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_buffer_block_read1);
 void compiler_subgroup_buffer_block_read2(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_buffer_block_read",
@@ -176,6 +180,8 @@ void compiler_subgroup_buffer_block_read2(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_buffer_block_read2);
 void compiler_subgroup_buffer_block_read4(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_buffer_block_read",
@@ -185,6 +191,8 @@ void compiler_subgroup_buffer_block_read4(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_buffer_block_read4);
 void compiler_subgroup_buffer_block_read8(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_buffer_block_read",
diff --git a/utests/compiler_subgroup_buffer_block_write.cpp b/utests/compiler_subgroup_buffer_block_write.cpp
index fb50a94..6b257c5 100644
--- a/utests/compiler_subgroup_buffer_block_write.cpp
+++ b/utests/compiler_subgroup_buffer_block_write.cpp
@@ -104,7 +104,7 @@ static void subgroup_generic(T* input,
   globals[0] = WG_GLOBAL_SIZE;
   locals[0] = WG_LOCAL_SIZE;
   size_t SIMD_SIZE = 0;
-  OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
+  OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
 
   size_t buf_sz = VEC_SIZE * WG_GLOBAL_SIZE;
   /* input and expected data */
@@ -158,6 +158,8 @@ static void subgroup_generic(T* input,
  */
 void compiler_subgroup_buffer_block_write1(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_buffer_block_write",
@@ -167,6 +169,8 @@ void compiler_subgroup_buffer_block_write1(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_buffer_block_write1);
 void compiler_subgroup_buffer_block_write2(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_buffer_block_write",
@@ -176,6 +180,8 @@ void compiler_subgroup_buffer_block_write2(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_buffer_block_write2);
 void compiler_subgroup_buffer_block_write4(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_buffer_block_write",
@@ -185,6 +191,8 @@ void compiler_subgroup_buffer_block_write4(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_buffer_block_write4);
 void compiler_subgroup_buffer_block_write8(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_buffer_block_write",
diff --git a/utests/compiler_subgroup_image_block_read.cpp b/utests/compiler_subgroup_image_block_read.cpp
index daccaa5..02c8f07 100644
--- a/utests/compiler_subgroup_image_block_read.cpp
+++ b/utests/compiler_subgroup_image_block_read.cpp
@@ -96,7 +96,7 @@ static void subgroup_generic(T* input,
   globals[0] = WG_GLOBAL_SIZE;
   locals[0] = WG_LOCAL_SIZE;
   size_t SIMD_SIZE = 0;
-  OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
+  OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
 
   size_t buf_sz = VEC_SIZE * WG_GLOBAL_SIZE;
   /* input and expected data */
@@ -153,6 +153,8 @@ static void subgroup_generic(T* input,
  */
 void compiler_subgroup_image_block_read1(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_image_block_read",
@@ -162,6 +164,8 @@ void compiler_subgroup_image_block_read1(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_image_block_read1);
 void compiler_subgroup_image_block_read2(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_image_block_read",
@@ -171,6 +175,8 @@ void compiler_subgroup_image_block_read2(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_image_block_read2);
 void compiler_subgroup_image_block_read4(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_image_block_read",
@@ -180,6 +186,8 @@ void compiler_subgroup_image_block_read4(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_image_block_read4);
 void compiler_subgroup_image_block_read8(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_image_block_read",
diff --git a/utests/compiler_subgroup_image_block_write.cpp b/utests/compiler_subgroup_image_block_write.cpp
index 9ef2127..2b85167 100644
--- a/utests/compiler_subgroup_image_block_write.cpp
+++ b/utests/compiler_subgroup_image_block_write.cpp
@@ -96,7 +96,7 @@ static void subgroup_generic(T* input,
   globals[0] = WG_GLOBAL_SIZE;
   locals[0] = WG_LOCAL_SIZE;
   size_t SIMD_SIZE = 0;
-  OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
+  OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
 
   size_t buf_sz = VEC_SIZE * WG_GLOBAL_SIZE;
   /* input and expected data */
@@ -157,6 +157,8 @@ static void subgroup_generic(T* input,
  */
 void compiler_subgroup_image_block_write1(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_image_block_write",
@@ -166,6 +168,8 @@ void compiler_subgroup_image_block_write1(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_image_block_write1);
 void compiler_subgroup_image_block_write2(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_image_block_write",
@@ -175,6 +179,8 @@ void compiler_subgroup_image_block_write2(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_image_block_write2);
 void compiler_subgroup_image_block_write4(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_image_block_write",
@@ -184,6 +190,8 @@ void compiler_subgroup_image_block_write4(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_image_block_write4);
 void compiler_subgroup_image_block_write8(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_image_block_write",
diff --git a/utests/compiler_subgroup_reduce.cpp b/utests/compiler_subgroup_reduce.cpp
index 1cd8fe4..3c3df06 100644
--- a/utests/compiler_subgroup_reduce.cpp
+++ b/utests/compiler_subgroup_reduce.cpp
@@ -158,7 +158,7 @@ static void subgroup_generic(WG_FUNCTION wg_func,
   globals[0] = WG_GLOBAL_SIZE;
   locals[0] = WG_LOCAL_SIZE;
   size_t SIMD_SIZE = 0;
-  OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
+  OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
 
   /* input and expected data */
   generate_data(wg_func, input, expected, SIMD_SIZE);
@@ -227,6 +227,8 @@ static void subgroup_generic(WG_FUNCTION wg_func,
  */
 void compiler_subgroup_any(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -236,6 +238,8 @@ void compiler_subgroup_any(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_any);
 void compiler_subgroup_all(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -248,6 +252,8 @@ MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_all);
  */
 void compiler_subgroup_reduce_add_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -257,6 +263,8 @@ void compiler_subgroup_reduce_add_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_reduce_add_int);
 void compiler_subgroup_reduce_add_uint(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -266,6 +274,8 @@ void compiler_subgroup_reduce_add_uint(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_reduce_add_uint);
 void compiler_subgroup_reduce_add_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_long *input = NULL;
   cl_long *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -275,6 +285,8 @@ void compiler_subgroup_reduce_add_long(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_reduce_add_long);
 void compiler_subgroup_reduce_add_ulong(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_ulong *input = NULL;
   cl_ulong *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -284,6 +296,8 @@ void compiler_subgroup_reduce_add_ulong(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_reduce_add_ulong);
 void compiler_subgroup_reduce_add_float(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_float *input = NULL;
   cl_float *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -297,6 +311,8 @@ MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_reduce_add_float);
  */
 void compiler_subgroup_reduce_max_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -306,6 +322,8 @@ void compiler_subgroup_reduce_max_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_reduce_max_int);
 void compiler_subgroup_reduce_max_uint(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -315,6 +333,8 @@ void compiler_subgroup_reduce_max_uint(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_reduce_max_uint);
 void compiler_subgroup_reduce_max_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_long *input = NULL;
   cl_long *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -324,6 +344,8 @@ void compiler_subgroup_reduce_max_long(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_reduce_max_long);
 void compiler_subgroup_reduce_max_ulong(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_ulong *input = NULL;
   cl_ulong *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -333,6 +355,8 @@ void compiler_subgroup_reduce_max_ulong(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_reduce_max_ulong);
 void compiler_subgroup_reduce_max_float(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_float *input = NULL;
   cl_float *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -346,6 +370,8 @@ MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_reduce_max_float);
  */
 void compiler_subgroup_reduce_min_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -355,6 +381,8 @@ void compiler_subgroup_reduce_min_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_reduce_min_int);
 void compiler_subgroup_reduce_min_uint(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -364,6 +392,8 @@ void compiler_subgroup_reduce_min_uint(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_reduce_min_uint);
 void compiler_subgroup_reduce_min_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_long *input = NULL;
   cl_long *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -373,6 +403,8 @@ void compiler_subgroup_reduce_min_long(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_reduce_min_long);
 void compiler_subgroup_reduce_min_ulong(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_ulong *input = NULL;
   cl_ulong *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
@@ -382,6 +414,8 @@ void compiler_subgroup_reduce_min_ulong(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_reduce_min_ulong);
 void compiler_subgroup_reduce_min_float(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_float *input = NULL;
   cl_float *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_reduce",
diff --git a/utests/compiler_subgroup_scan_exclusive.cpp b/utests/compiler_subgroup_scan_exclusive.cpp
index 758179e..1a21b59 100644
--- a/utests/compiler_subgroup_scan_exclusive.cpp
+++ b/utests/compiler_subgroup_scan_exclusive.cpp
@@ -140,7 +140,7 @@ static void subgroup_generic(WG_FUNCTION wg_func,
   globals[0] = WG_GLOBAL_SIZE;
   locals[0] = WG_LOCAL_SIZE;
   size_t SIMD_SIZE = 0;
-  OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
+  OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
 
   /* input and expected data */
   generate_data(wg_func, input, expected, SIMD_SIZE);
@@ -208,6 +208,8 @@ static void subgroup_generic(WG_FUNCTION wg_func,
  */
 void compiler_subgroup_scan_exclusive_add_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -217,6 +219,8 @@ void compiler_subgroup_scan_exclusive_add_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_exclusive_add_int);
 void compiler_subgroup_scan_exclusive_add_uint(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -226,6 +230,8 @@ void compiler_subgroup_scan_exclusive_add_uint(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_exclusive_add_uint);
 void compiler_subgroup_scan_exclusive_add_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_long *input = NULL;
   cl_long *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -235,6 +241,8 @@ void compiler_subgroup_scan_exclusive_add_long(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_exclusive_add_long);
 void compiler_subgroup_scan_exclusive_add_ulong(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_ulong *input = NULL;
   cl_ulong *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -244,6 +252,8 @@ void compiler_subgroup_scan_exclusive_add_ulong(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_exclusive_add_ulong);
 void compiler_subgroup_scan_exclusive_add_float(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_float *input = NULL;
   cl_float *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -257,6 +267,8 @@ MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_exclusive_add_float);
  */
 void compiler_subgroup_scan_exclusive_max_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -266,6 +278,8 @@ void compiler_subgroup_scan_exclusive_max_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_exclusive_max_int);
 void compiler_subgroup_scan_exclusive_max_uint(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -275,6 +289,8 @@ void compiler_subgroup_scan_exclusive_max_uint(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_exclusive_max_uint);
 void compiler_subgroup_scan_exclusive_max_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_long *input = NULL;
   cl_long *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -284,6 +300,8 @@ void compiler_subgroup_scan_exclusive_max_long(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_exclusive_max_long);
 void compiler_subgroup_scan_exclusive_max_ulong(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_ulong *input = NULL;
   cl_ulong *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -293,6 +311,8 @@ void compiler_subgroup_scan_exclusive_max_ulong(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_exclusive_max_ulong);
 void compiler_subgroup_scan_exclusive_max_float(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_float *input = NULL;
   cl_float *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -306,6 +326,8 @@ MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_exclusive_max_float);
  */
 void compiler_subgroup_scan_exclusive_min_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -315,6 +337,8 @@ void compiler_subgroup_scan_exclusive_min_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_exclusive_min_int);
 void compiler_subgroup_scan_exclusive_min_uint(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -324,6 +348,8 @@ void compiler_subgroup_scan_exclusive_min_uint(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_exclusive_min_uint);
 void compiler_subgroup_scan_exclusive_min_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_long *input = NULL;
   cl_long *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -333,6 +359,8 @@ void compiler_subgroup_scan_exclusive_min_long(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_exclusive_min_long);
 void compiler_subgroup_scan_exclusive_min_ulong(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_ulong *input = NULL;
   cl_ulong *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
@@ -342,6 +370,8 @@ void compiler_subgroup_scan_exclusive_min_ulong(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_exclusive_min_ulong);
 void compiler_subgroup_scan_exclusive_min_float(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_float *input = NULL;
   cl_float *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_exclusive",
diff --git a/utests/compiler_subgroup_scan_inclusive.cpp b/utests/compiler_subgroup_scan_inclusive.cpp
index 013d599..fa32855 100644
--- a/utests/compiler_subgroup_scan_inclusive.cpp
+++ b/utests/compiler_subgroup_scan_inclusive.cpp
@@ -130,7 +130,7 @@ static void subgroup_generic(WG_FUNCTION wg_func,
   globals[0] = WG_GLOBAL_SIZE;
   locals[0] = WG_LOCAL_SIZE;
   size_t SIMD_SIZE = 0;
-  OCL_CALL(clGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
+  OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device,CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR,sizeof(size_t)*1,locals,sizeof(size_t),&SIMD_SIZE,NULL);
 
   /* input and expected data */
   generate_data(wg_func, input, expected, SIMD_SIZE);
@@ -198,6 +198,8 @@ static void subgroup_generic(WG_FUNCTION wg_func,
  */
 void compiler_subgroup_scan_inclusive_add_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -207,6 +209,8 @@ void compiler_subgroup_scan_inclusive_add_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_inclusive_add_int);
 void compiler_subgroup_scan_inclusive_add_uint(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -216,6 +220,8 @@ void compiler_subgroup_scan_inclusive_add_uint(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_inclusive_add_uint);
 void compiler_subgroup_scan_inclusive_add_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_long *input = NULL;
   cl_long *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -225,6 +231,8 @@ void compiler_subgroup_scan_inclusive_add_long(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_inclusive_add_long);
 void compiler_subgroup_scan_inclusive_add_ulong(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_ulong *input = NULL;
   cl_ulong *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -234,6 +242,8 @@ void compiler_subgroup_scan_inclusive_add_ulong(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_inclusive_add_ulong);
 void compiler_subgroup_scan_inclusive_add_float(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_float *input = NULL;
   cl_float *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -247,6 +257,8 @@ MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_inclusive_add_float);
  */
 void compiler_subgroup_scan_inclusive_max_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -256,6 +268,8 @@ void compiler_subgroup_scan_inclusive_max_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_inclusive_max_int);
 void compiler_subgroup_scan_inclusive_max_uint(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -265,6 +279,8 @@ void compiler_subgroup_scan_inclusive_max_uint(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_inclusive_max_uint);
 void compiler_subgroup_scan_inclusive_max_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_long *input = NULL;
   cl_long *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -274,6 +290,8 @@ void compiler_subgroup_scan_inclusive_max_long(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_inclusive_max_long);
 void compiler_subgroup_scan_inclusive_max_ulong(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_ulong *input = NULL;
   cl_ulong *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -283,6 +301,8 @@ void compiler_subgroup_scan_inclusive_max_ulong(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_inclusive_max_ulong);
 void compiler_subgroup_scan_inclusive_max_float(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_float *input = NULL;
   cl_float *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -296,6 +316,8 @@ MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_inclusive_max_float);
  */
 void compiler_subgroup_scan_inclusive_min_int(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_int *input = NULL;
   cl_int *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -305,6 +327,8 @@ void compiler_subgroup_scan_inclusive_min_int(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_inclusive_min_int);
 void compiler_subgroup_scan_inclusive_min_uint(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_uint *input = NULL;
   cl_uint *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -314,6 +338,8 @@ void compiler_subgroup_scan_inclusive_min_uint(void)
 MAKE_UTEST_FROM_FUNCTION(compiler_subgroup_scan_inclusive_min_uint);
 void compiler_subgroup_scan_inclusive_min_long(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_long *input = NULL;
   cl_long *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -323,6 +349,8 @@ void compiler_subgroup_scan_inclusive_min_long(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_inclusive_min_long);
 void compiler_subgroup_scan_inclusive_min_ulong(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_ulong *input = NULL;
   cl_ulong *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
@@ -332,6 +360,8 @@ void compiler_subgroup_scan_inclusive_min_ulong(void)
 MAKE_UTEST_FROM_FUNCTION_WITH_ISSUE(compiler_subgroup_scan_inclusive_min_ulong);
 void compiler_subgroup_scan_inclusive_min_float(void)
 {
+  if(!cl_check_subgroups())
+    return;
   cl_float *input = NULL;
   cl_float *expected = NULL;
   OCL_CREATE_KERNEL_FROM_FILE("compiler_subgroup_scan_inclusive",
diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index 76993d5..0ecbea3 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;
+}
+
diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp
index a89f197..7d05056 100644
--- a/utests/utest_helper.hpp
+++ b/utests/utest_helper.hpp
@@ -287,5 +287,13 @@ extern int cl_check_double(void);
 
 /* Check is beignet device. */
 extern int cl_check_beignet(void);
-#endif /* __UTEST_HELPER_HPP__ */
 
+/* Check is intel subgroups enabled. */
+extern int cl_check_subgroups(void);
+
+typedef cl_int(clGetKernelSubGroupInfoKHR_cb)(cl_kernel, cl_device_id,
+                                              cl_kernel_sub_group_info, size_t,
+                                              const void *, size_t, void *,
+                                              size_t *);
+extern clGetKernelSubGroupInfoKHR_cb* utestclGetKernelSubGroupInfoKHR;
+#endif /* __UTEST_HELPER_HPP__ */
-- 
2.7.4



More information about the Beignet mailing list