From: Luo Xionghu <xionghu....@intel.com> Signed-off-by: Luo Xionghu <xionghu....@intel.com> --- kernels/compiler_math_3op.cl | 2 +- utests/CMakeLists.txt | 1 + utests/compiler_math_3op.cpp | 9 +++++---- 3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/kernels/compiler_math_3op.cl b/kernels/compiler_math_3op.cl index 95b0398..765627e 100644 --- a/kernels/compiler_math_3op.cl +++ b/kernels/compiler_math_3op.cl @@ -1,7 +1,7 @@ kernel void compiler_math_3op(global float *dst, global float *src1, global float *src2, global float *src3) { int i = get_global_id(0); const float x = src1[i], y = src2[i], z = src3[i]; - switch (i) { + switch (i%2) { case 0: dst[i] = mad(x, y, z); break; case 1: dst[i] = fma(x, y, z); break; default: dst[i] = 1.f; break; diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt index a1cf8e9..f16defe 100644 --- a/utests/CMakeLists.txt +++ b/utests/CMakeLists.txt @@ -228,6 +228,7 @@ set (utests_sources compiler_get_sub_group_size.cpp compiler_get_sub_group_id.cpp compiler_sub_group_shuffle.cpp + compiler_math_3op.cpp runtime_pipe_query.cpp compiler_pipe_builtin.cpp) diff --git a/utests/compiler_math_3op.cpp b/utests/compiler_math_3op.cpp index f90f9d6..50ee56d 100644 --- a/utests/compiler_math_3op.cpp +++ b/utests/compiler_math_3op.cpp @@ -5,7 +5,7 @@ static void cpu_compiler_math(float *dst, float *src1, float *src2, float *src3, int i) { const float x = src1[i], y = src2[i], z = src3[i]; - switch (i) { + switch (i%2) { case 0: dst[i] = x * y + z; break; case 1: dst[i] = x * y + z; break; default: dst[i] = 1.f; break; @@ -35,9 +35,9 @@ static void compiler_math_3op(void) OCL_MAP_BUFFER(2); OCL_MAP_BUFFER(3); for (uint32_t i = 0; i < 32; ++i) { - cpu_src1[i] = ((float*)buf_data[1])[i] = .1f * (rand() & 15); - cpu_src2[i] = ((float*)buf_data[2])[i] = .1f * (rand() & 15); - cpu_src3[i] = ((float*)buf_data[3])[i] = .1f * (rand() & 15); + cpu_src1[i] = ((float*)buf_data[1])[i] = .001f * (rand() & 15); + cpu_src2[i] = ((float*)buf_data[2])[i] = .002f * (rand() & 15); + cpu_src3[i] = ((float*)buf_data[3])[i] = .003f * (rand() & 15); } OCL_UNMAP_BUFFER(1); OCL_UNMAP_BUFFER(2); @@ -50,6 +50,7 @@ static void compiler_math_3op(void) for (int i = 0; i < 16; ++i) { const float cpu = cpu_dst[i]; const float gpu = ((float*)buf_data[0])[i]; + //printf("cpu:%f, gpu:%f\n", cpu, gpu); if (std::isinf(cpu)) OCL_ASSERT(std::isinf(gpu)); else if (std::isnan(cpu)) -- 2.1.4 _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/beignet