I just pushed this patch, but disable it from the utests currently. Thanks for the patch.
On Thu, Aug 22, 2013 at 07:23:38PM +0800, Chuanbo Weng wrote: > This unit test case trigger a known bug: > ASSERTION FAILED: TODO Boolean values cannot escape their definition > basic block. > > Signed-off-by: Chuanbo Weng <chuanbo.w...@intel.com> > --- > kernels/compiler_bool_cross_basic_block.cl | 21 ++++++++++ > utests/CMakeLists.txt | 1 + > utests/compiler_bool_cross_basic_block.cpp | 58 > ++++++++++++++++++++++++++++ > 3 files changed, 80 insertions(+) > create mode 100644 kernels/compiler_bool_cross_basic_block.cl > create mode 100644 utests/compiler_bool_cross_basic_block.cpp > > diff --git a/kernels/compiler_bool_cross_basic_block.cl > b/kernels/compiler_bool_cross_basic_block.cl > new file mode 100644 > index 0000000..dd48fe8 > --- /dev/null > +++ b/kernels/compiler_bool_cross_basic_block.cl > @@ -0,0 +1,21 @@ > +__kernel > +void compiler_bool_cross_basic_block(__global int *src, > + __global int *dst, > + int scale){ > + int id = (int)get_global_id(0); > + > + bool isRedRow = false; > + bool isRed; > + int val = src[id]; > + for (unsigned int i=0; i<scale; i++, isRedRow = !isRedRow) { > + if (isRedRow) { > + isRed= false; > + for (unsigned int j=0; j < scale; j++, isRed=!isRed) { > + if (isRed) { > + val++; > + } > + } > + } > + } > + dst[id] = val; > +} > diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt > index 97b7519..98db273 100644 > --- a/utests/CMakeLists.txt > +++ b/utests/CMakeLists.txt > @@ -135,6 +135,7 @@ set (utests_sources > compiler_long_asr.cpp > compiler_long_mult.cpp > compiler_long_cmp.cpp > + compiler_bool_cross_basic_block.cpp > utest_assert.cpp > utest.cpp > utest_file_map.cpp > diff --git a/utests/compiler_bool_cross_basic_block.cpp > b/utests/compiler_bool_cross_basic_block.cpp > new file mode 100644 > index 0000000..884c464 > --- /dev/null > +++ b/utests/compiler_bool_cross_basic_block.cpp > @@ -0,0 +1,58 @@ > +#include "utest_helper.hpp" > + > +static void cpu(int global_id, int *src, int *dst, int scale) { > + > + bool isRedRow = false; > + bool isRed; > + int val = src[global_id]; > + for (unsigned int i=0; i<scale; i++, isRedRow = !isRedRow) { > + if (isRedRow) { > + isRed= false; > + for (unsigned int j=0; j < scale; j++, isRed=!isRed) { > + if (isRed) { > + val++; > + } > + } > + } > + } > + dst[global_id] = val; > +} > + > +void compiler_bool_cross_basic_block(void){ > + > + const size_t n = 16; > + int cpu_dst[16], cpu_src[16]; > + int scale = 4; > + > + // Setup kernel and buffers > + OCL_CREATE_KERNEL("compiler_bool_cross_basic_block"); > + OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(int), NULL); > + OCL_CREATE_BUFFER(buf[1], 0, n * sizeof(int), NULL); > + OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); > + OCL_SET_ARG(1, sizeof(cl_mem), &buf[1]); > + OCL_SET_ARG(2, sizeof(int), &scale); > + globals[0] = 16; > + locals[0] = 16; > + > + OCL_MAP_BUFFER(0); > + for (int32_t i = 0; i < (int32_t) n; ++i) > + cpu_src[i] = ((int*)buf_data[0])[i] = i; > + OCL_UNMAP_BUFFER(0); > + > + // Run the kernel on GPU > + OCL_NDRANGE(1); > + > + // Run on CPU > + for (int32_t i = 0; i < (int32_t) n; ++i) > + cpu(i, cpu_src, cpu_dst, scale); > + > + // Compare > + OCL_MAP_BUFFER(1); > + for (int32_t i = 0; i < (int32_t) n; ++i) > + OCL_ASSERT(((int *)buf_data[1])[i] == cpu_dst[i]); > + OCL_UNMAP_BUFFER(1); > + > +} > + > + > +MAKE_UTEST_FROM_FUNCTION(compiler_bool_cross_basic_block) > -- > 1.7.9.5 > > _______________________________________________ > Beignet mailing list > Beignet@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/beignet