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

Xiuli Pan xiuli.pan at intel.com
Wed Jun 15 22:11:19 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.

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 54863f6..bf7dc65 100644
--- a/utests/compiler_subgroup_reduce.cpp
+++ b/utests/compiler_subgroup_reduce.cpp
@@ -157,7 +157,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);
@@ -226,6 +226,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",
@@ -235,6 +237,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",
@@ -247,6 +251,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",
@@ -256,6 +262,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",
@@ -265,6 +273,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",
@@ -274,6 +284,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",
@@ -283,6 +295,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",
@@ -296,6 +310,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",
@@ -305,6 +321,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",
@@ -314,6 +332,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",
@@ -323,6 +343,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",
@@ -332,6 +354,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",
@@ -345,6 +369,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",
@@ -354,6 +380,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",
@@ -363,6 +391,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",
@@ -372,6 +402,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",
@@ -381,6 +413,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 abcec6e..302a8f5 100644
--- a/utests/compiler_subgroup_scan_exclusive.cpp
+++ b/utests/compiler_subgroup_scan_exclusive.cpp
@@ -139,7 +139,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);
@@ -207,6 +207,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",
@@ -216,6 +218,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",
@@ -225,6 +229,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",
@@ -234,6 +240,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",
@@ -243,6 +251,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",
@@ -256,6 +266,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",
@@ -265,6 +277,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",
@@ -274,6 +288,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",
@@ -283,6 +299,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",
@@ -292,6 +310,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",
@@ -305,6 +325,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",
@@ -314,6 +336,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",
@@ -323,6 +347,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",
@@ -332,6 +358,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",
@@ -341,6 +369,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 1528f09..e4bd0de 100644
--- a/utests/compiler_subgroup_scan_inclusive.cpp
+++ b/utests/compiler_subgroup_scan_inclusive.cpp
@@ -129,7 +129,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);
@@ -197,6 +197,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",
@@ -206,6 +208,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",
@@ -215,6 +219,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",
@@ -224,6 +230,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",
@@ -233,6 +241,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",
@@ -246,6 +256,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",
@@ -255,6 +267,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",
@@ -264,6 +278,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",
@@ -273,6 +289,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",
@@ -282,6 +300,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",
@@ -295,6 +315,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",
@@ -304,6 +326,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",
@@ -313,6 +337,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",
@@ -322,6 +348,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",
@@ -331,6 +359,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..7e452c1 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*) 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