diff options
author | Rebecca N. Palmer <rebecca_palmer@zoho.com> | 2016-10-12 23:38:03 +0100 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-10-20 13:31:37 +0800 |
commit | 76f892abb0e8fa1e8ab60a926b84ba6fb14a5a7e (patch) | |
tree | ac5c95bab96d782e1fac4b003ccb9f7da1dea80d | |
parent | 26f23c2a73ff08ba0f64333972bb15ce1d7ec155 (diff) | |
download | beignet-76f892abb0e8fa1e8ab60a926b84ba6fb14a5a7e.tar.gz |
Utests: Allow testing cl_intel_accelerator via ICD
v3: Use extension check, not beignet check. Treat claiming
to have the extension but not having the kernel as a failure.
v4: Make extension check a function, use stderr.
Signed-off-by: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Reviewed-by: Chuanbo Weng <chuanbo.weng@intel.com>
-rw-r--r-- | utests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | utests/builtin_kernel_block_motion_estimate_intel.cpp | 6 | ||||
-rw-r--r-- | utests/utest_helper.cpp | 18 | ||||
-rw-r--r-- | utests/utest_helper.hpp | 3 |
4 files changed, 28 insertions, 3 deletions
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt index 6a903284..8b33666b 100644 --- a/utests/CMakeLists.txt +++ b/utests/CMakeLists.txt @@ -287,7 +287,8 @@ set (utests_sources multi_queue_events.cpp compiler_mix.cpp compiler_math_3op.cpp - compiler_bsort.cpp) + compiler_bsort.cpp + builtin_kernel_block_motion_estimate_intel.cpp) if (LLVM_VERSION_NODOT VERSION_GREATER 34) SET(utests_sources @@ -328,7 +329,6 @@ else(GEN_PCI_ID) endif(GEN_PCI_ID) if (NOT_BUILD_STAND_ALONE_UTEST) - SET(utests_sources ${utests_sources} builtin_kernel_block_motion_estimate_intel.cpp) ADD_CUSTOM_TARGET(kernel_bin.bin DEPENDS ${kernel_bin}.bin) endif (NOT_BUILD_STAND_ALONE_UTEST) diff --git a/utests/builtin_kernel_block_motion_estimate_intel.cpp b/utests/builtin_kernel_block_motion_estimate_intel.cpp index 15bf7611..092b1d52 100644 --- a/utests/builtin_kernel_block_motion_estimate_intel.cpp +++ b/utests/builtin_kernel_block_motion_estimate_intel.cpp @@ -8,6 +8,9 @@ OCLRELEASEACCELERATORINTEL * oclReleaseAcceleratorIntel = NULL; void builtin_kernel_block_motion_estimate_intel(void) { + if (!cl_check_motion_estimation()) { + return; + } char* built_in_kernel_names; size_t built_in_kernels_size; cl_int err = CL_SUCCESS; @@ -21,7 +24,8 @@ void builtin_kernel_block_motion_estimate_intel(void) if (strstr(built_in_kernel_names, "block_motion_estimate_intel") == NULL) { free(built_in_kernel_names); - return; + fprintf(stderr, "Can't find block_motion_estimate_intel built-in kernel"); + OCL_ASSERT(0); } cl_program built_in_prog = clCreateProgramWithBuiltInKernels(ctx, 1, &device, built_in_kernel_names, &err); diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp index d3fc069e..e87d2309 100644 --- a/utests/utest_helper.cpp +++ b/utests/utest_helper.cpp @@ -875,6 +875,24 @@ int cl_check_beignet(void) return 1; } +int cl_check_motion_estimation(void) +{ + std::string extStr; + size_t param_value_size; + OCL_CALL(clGetDeviceInfo, device, CL_DEVICE_EXTENSIONS, 0, 0, ¶m_value_size); + std::vector<char> param_value(param_value_size); + OCL_CALL(clGetDeviceInfo, device, CL_DEVICE_EXTENSIONS, param_value_size, + param_value.empty() ? NULL : ¶m_value.front(), ¶m_value_size); + if (!param_value.empty()) + extStr = std::string(¶m_value.front(), param_value_size-1); + + if (std::strstr(extStr.c_str(), "cl_intel_motion_estimation") == NULL) { + printf("No cl_intel_motion_estimation, Skip!"); + return 0; + } + return 1; +} + int cl_check_subgroups(void) { std::string extStr; diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp index 034a411a..b16aac71 100644 --- a/utests/utest_helper.hpp +++ b/utests/utest_helper.hpp @@ -307,6 +307,9 @@ typedef cl_int(clGetKernelSubGroupInfoKHR_cb)(cl_kernel, cl_device_id, size_t *); extern clGetKernelSubGroupInfoKHR_cb* utestclGetKernelSubGroupInfoKHR; +/* Check if cl_intel_motion_estimation enabled. */ +extern int cl_check_motion_estimation(void); + /* Check is cl version 2.0. */ extern int cl_check_ocl20(void); |