diff options
author | Luo Xionghu <xionghu.luo@intel.com> | 2016-04-23 00:37:18 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-04-22 18:13:01 +0800 |
commit | 0eebe2536c8e76cd20867d1ca00ba4735736f629 (patch) | |
tree | 97b06ecf8d59cd8994d89ddbfe78f82773cfa413 /utests/builtin_kernel_block_motion_estimate_intel.cpp | |
parent | 2d5c0576f0bdf2ad739f3778623b85d15465ec83 (diff) | |
download | beignet-0eebe2536c8e76cd20867d1ca00ba4735736f629.tar.gz |
standalone utest for unified OpenCL implementation.
use the variable NOT_BUILD_STAND_ALONE_UTEST to control the build type:
for beignet build, set it to 1; for stand alone build, do NOT need set
it.
remove all clXXXIntel extension call and such kind of tests since we
intend to provide the unit test independently for viariant OpenCL
implementation; replace the clMapBufferIntel/clMapBufferGTTIntel
with clEnqueueMapBuffer/clEnqueueMapImage; link the utest binary to
libOpenCL to follow the icd standard; remove the useless env in
setenv.sh since we need make install the package after build.
v2:
fix the indent error;
use function pointer for extesion case like vme and libva since we link to libOpenCL;
v3: builtin_kernel_block_motion_estimate_intel released kernel twice;
v4:
find OpenCL library for standalone utest and link to libcl for not
standalone utest;
check default variables in setenv.sh whether empty before use.
Signed-off-by: Luo Xionghu <xionghu.luo@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/builtin_kernel_block_motion_estimate_intel.cpp')
-rw-r--r-- | utests/builtin_kernel_block_motion_estimate_intel.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/utests/builtin_kernel_block_motion_estimate_intel.cpp b/utests/builtin_kernel_block_motion_estimate_intel.cpp index 008b27c8..5a48753b 100644 --- a/utests/builtin_kernel_block_motion_estimate_intel.cpp +++ b/utests/builtin_kernel_block_motion_estimate_intel.cpp @@ -1,6 +1,11 @@ #include "utest_helper.hpp" #include <string.h> +typedef cl_accelerator_intel (OCLCREATEACCELERATORINTEL)(cl_context, cl_accelerator_type_intel accel_type, size_t desc_sz, const void* desc, cl_int* errcode_ret); +OCLCREATEACCELERATORINTEL * oclCreateAcceleratorIntel = NULL; +typedef cl_int (OCLRELEASEACCELERATORINTEL)(cl_accelerator_intel accel_type); +OCLRELEASEACCELERATORINTEL * oclReleaseAcceleratorIntel = NULL; + void builtin_kernel_block_motion_estimate_intel(void) { char* built_in_kernel_names; @@ -29,7 +34,16 @@ void builtin_kernel_block_motion_estimate_intel(void) CL_ME_SAD_ADJUST_MODE_NONE_INTEL, //0x0 CL_ME_SEARCH_PATH_RADIUS_16_12_INTEL //0x5 }; - cl_accelerator_intel accel = clCreateAcceleratorINTEL(ctx, CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL,sizeof(cl_motion_estimation_desc_intel), &vmedesc, &err); +#ifdef CL_VERSION_1_2 + oclCreateAcceleratorIntel = (OCLCREATEACCELERATORINTEL*)clGetExtensionFunctionAddressForPlatform(platform, "clCreateAcceleratorINTEL"); +#else + oclCreateAcceleratorIntel = (OCLCREATEACCELERATORINTEL*)clGetExtensionFunctionAddress("clCreateAcceleratorINTEL"); +#endif + if(!oclCreateAcceleratorIntel){ + fprintf(stderr, "Failed to get extension clCreateImageFromLibvaIntel\n"); + exit(1); + } + cl_accelerator_intel accel = oclCreateAcceleratorIntel(ctx, CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL,sizeof(cl_motion_estimation_desc_intel), &vmedesc, &err); OCL_ASSERT(accel != NULL); const size_t w = 71; //80 @@ -102,8 +116,16 @@ void builtin_kernel_block_motion_estimate_intel(void) } OCL_UNMAP_BUFFER(2); - clReleaseAcceleratorINTEL(accel); - clReleaseKernel(kernel); +#ifdef CL_VERSION_1_2 + oclReleaseAcceleratorIntel = (OCLRELEASEACCELERATORINTEL*)clGetExtensionFunctionAddressForPlatform(platform, "clReleaseAcceleratorINTEL"); +#else + oclReleaseAcceleratorIntel = (OCLRELEASEACCELERATORINTEL*)clGetExtensionFunctionAddress("clReleaseAcceleratorINTEL"); +#endif + if(!oclReleaseAcceleratorIntel){ + fprintf(stderr, "Failed to get extension clCreateImageFromLibvaIntel\n"); + exit(1); + } + oclReleaseAcceleratorIntel(accel); clReleaseProgram(built_in_prog); free(built_in_kernel_names); free(image_data1); |