summaryrefslogtreecommitdiff
path: root/utests/compiler_reqd_sub_group_size.cpp
diff options
context:
space:
mode:
authorPan Xiuli <xiuli.pan@intel.com>2017-06-15 16:44:50 +0800
committerYang Rong <rong.r.yang@intel.com>2017-06-16 16:34:32 +0800
commit79b8dd9ac8af9edaf65659d8ee95ba09a34fcd51 (patch)
tree159c4729b9157508e1f56e9fa8aaff395d47a15c /utests/compiler_reqd_sub_group_size.cpp
parent521ac708db7f6b679aa32c7fced3ee953ae61867 (diff)
downloadbeignet-79b8dd9ac8af9edaf65659d8ee95ba09a34fcd51.tar.gz
Utset: Add test case for cl_intel_required_subgroup_size extension
Check the device supported subgroup sizes, and use intel_reqd_sub_group_size to build kernels in these size. Then check if there is spill for each kernel. V2: Fix memory leak Signed-off-by: Pan Xiuli <xiuli.pan@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/compiler_reqd_sub_group_size.cpp')
-rw-r--r--utests/compiler_reqd_sub_group_size.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/utests/compiler_reqd_sub_group_size.cpp b/utests/compiler_reqd_sub_group_size.cpp
new file mode 100644
index 00000000..37d96fe5
--- /dev/null
+++ b/utests/compiler_reqd_sub_group_size.cpp
@@ -0,0 +1,46 @@
+#include "utest_helper.hpp"
+#include<string>
+#include<sstream>
+#include<iostream>
+
+using namespace std;
+
+void compiler_reqd_sub_group_size(void)
+{
+ if (!cl_check_reqd_subgroup())
+ return;
+
+ size_t param_value_size;
+ OCL_CALL(clGetDeviceInfo, device, CL_DEVICE_SUB_GROUP_SIZES_INTEL,
+ 0, NULL, &param_value_size);
+
+ size_t* param_value = new size_t[param_value_size];
+ OCL_CALL(clGetDeviceInfo, device, CL_DEVICE_SUB_GROUP_SIZES_INTEL,
+ param_value_size, param_value, NULL);
+
+ const char* opt = "-D SIMD_SIZE=";
+ for( uint32_t i = 0; i < param_value_size / sizeof(size_t) ; ++i)
+ {
+ ostringstream ss;
+ uint32_t simd_size = param_value[i];
+ ss << opt << simd_size;
+ //cout << "options: " << ss.str() << endl;
+ OCL_CALL(cl_kernel_init, "compiler_reqd_sub_group_size.cl", "compiler_reqd_sub_group_size",
+ SOURCE, ss.str().c_str());
+ size_t SIMD_SIZE = 0;
+ OCL_CALL(utestclGetKernelSubGroupInfoKHR,kernel,device, CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL,0, NULL,sizeof(size_t),&SIMD_SIZE,NULL);
+ //cout << SIMD_SIZE << " with " << simd_size << endl;
+ OCL_ASSERT(SIMD_SIZE == simd_size);
+
+ cl_ulong SPILL_SIZE = 0xFFFFFFFF;
+ OCL_CALL(clGetKernelWorkGroupInfo, kernel, device, CL_KERNEL_SPILL_MEM_SIZE_INTEL, sizeof(cl_ulong), &SPILL_SIZE, NULL);
+ //cout << "spill size: " << SPILL_SIZE << endl;
+ OCL_ASSERT(SPILL_SIZE == 0);
+
+ clReleaseProgram(program);
+ program = NULL;
+ }
+ delete[] param_value;
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_reqd_sub_group_size);