diff options
author | Pan Xiuli <xiuli.pan@intel.com> | 2017-01-24 16:47:58 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2017-02-10 14:22:05 +0800 |
commit | 8726605ea77b5633c1f31c71e5a20aadcc38ed44 (patch) | |
tree | 582ebf0dc1b9228a0aab149eda78ff655e27330c /utests/compiler_pipe_builtin.cpp | |
parent | 85b948d174d404d5a3af097b8b216442f3e2931b (diff) | |
download | beignet-8726605ea77b5633c1f31c71e5a20aadcc38ed44.tar.gz |
Utest: Add OCL20 into utest and check version in runtime
The utest should always be built and we can check ocl version at the
test begin.
Contributor: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Signed-off-by: Pan Xiuli <xiuli.pan@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/compiler_pipe_builtin.cpp')
-rw-r--r-- | utests/compiler_pipe_builtin.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/utests/compiler_pipe_builtin.cpp b/utests/compiler_pipe_builtin.cpp index c8ec077e..99270d19 100644 --- a/utests/compiler_pipe_builtin.cpp +++ b/utests/compiler_pipe_builtin.cpp @@ -8,11 +8,13 @@ typedef struct{ #define PIPE_BUILTIN(TYPE,GROUP) \ static void compiler_pipe_##GROUP##_##TYPE(void) \ { \ + if(!cl_check_ocl20(false))\ + return;\ const size_t w = 16; \ uint32_t ans_host = 0; \ uint32_t ans_device = 0; \ /* pipe write kernel*/ \ - OCL_CREATE_KERNEL_FROM_FILE("compiler_pipe_builtin", "compiler_pipe_"#GROUP"_write_"#TYPE); \ + OCL_CALL(cl_kernel_init, "compiler_pipe_builtin.cl", "compiler_pipe_"#GROUP"_write_"#TYPE, SOURCE, "-cl-std=CL2.0");\ OCL_CALL2(clCreatePipe, buf[0], ctx, 0, sizeof(TYPE), w, NULL);\ OCL_CREATE_BUFFER(buf[1], CL_MEM_READ_WRITE, w * sizeof(TYPE), NULL);\ OCL_MAP_BUFFER(1);\ @@ -26,7 +28,7 @@ static void compiler_pipe_##GROUP##_##TYPE(void) \ OCL_NDRANGE(1);\ OCL_CALL(clReleaseKernel, kernel);\ /* pipe read kernel */\ - OCL_CREATE_KERNEL_FROM_FILE("compiler_pipe_builtin", "compiler_pipe_"#GROUP"_read_"#TYPE);\ + OCL_CALL(cl_kernel_init, "compiler_pipe_builtin.cl", "compiler_pipe_"#GROUP"_read_"#TYPE, SOURCE, "-cl-std=CL2.0");\ OCL_CREATE_BUFFER(buf[2], CL_MEM_READ_WRITE, w * sizeof(TYPE), NULL);\ OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);\ OCL_SET_ARG(1, sizeof(cl_mem), &buf[2]);\ @@ -52,8 +54,9 @@ PIPE_BUILTIN(mystruct, workgroup) static void compiler_pipe_query(void) { const size_t w = 32; const size_t sz = 16; + if(!cl_check_ocl20(false)){return;} /* pipe write kernel */ - OCL_CREATE_KERNEL_FROM_FILE("compiler_pipe_builtin", "compiler_pipe_query"); + OCL_CALL(cl_kernel_init, "compiler_pipe_builtin.cl", "compiler_pipe_query", SOURCE, "-cl-std=CL2.0"); OCL_CALL2(clCreatePipe, buf[0], ctx, 0, sizeof(uint32_t), w, NULL); OCL_CREATE_BUFFER(buf[1], CL_MEM_READ_WRITE, sz * sizeof(uint32_t), NULL); OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); |