From: Michal Babej Date: Thu, 4 Apr 2024 17:27:15 +0000 (+0300) Subject: [PATCH] add regression test for issue #1435 X-Git-Tag: archive/raspbian/6.0-1+rpi1^2^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f4815b4fca08551eb777ec993afa2219e1414322;p=pocl.git [PATCH] add regression test for issue #1435 Gbp-Pq: Name 0003-add-regression-test-for-issue-1435.patch --- diff --git a/tests/regression/CMakeLists.txt b/tests/regression/CMakeLists.txt index 0e23c77..fd82ce6 100644 --- a/tests/regression/CMakeLists.txt +++ b/tests/regression/CMakeLists.txt @@ -48,7 +48,7 @@ set(PROGRAMS_TO_BUILD test_barrier_between_for_loops test_early_return test_autolocals_in_constexprs test_issue_553 test_issue_577 test_issue_757 test_flatten_barrier_subs test_alignment_with_dynamic_wg test_alignment_with_dynamic_wg2 test_alignment_with_dynamic_wg3 - test_issue_893 test_builtin_args + test_issue_893 test_issue_1435 test_builtin_args test_workitem_func_outside_kernel ) @@ -83,6 +83,8 @@ add_test_pocl(NAME "regression/test_issue_577" COMMAND "test_issue_577") add_test_pocl(NAME "regression/test_issue_757" COMMAND "test_issue_757") +add_test_pocl(NAME "regression/test_issue_1435" COMMAND "test_issue_1435") + add_test_pocl(NAME "regression/test_workitem_func_outside_kernel" COMMAND "test_workitem_func_outside_kernel") if(OPENCL_HEADER_VERSION GREATER 299) @@ -231,7 +233,7 @@ foreach(VARIANT ${VARIANTS}) "regression/test_issue_445_${VARIANT}" "regression/test_issue_553_${VARIANT}" "regression/test_issue_577_${VARIANT}" "regression/test_issue_757_${VARIANT}" "regression/test_llvm_segfault_issue_889_${VARIANT}" - "regression/test_issue_893_${VARIANT}" + "regression/test_issue_893_${VARIANT}" "regression/test_issue_1435_${VARIANT}" "regression/test_flatten_barrier_subs_${VARIANT}" "regression/test_workitem_func_outside_kernel_${VARIANT}" ${OCL_30_TESTS} diff --git a/tests/regression/test_issue_1435.cpp b/tests/regression/test_issue_1435.cpp new file mode 100644 index 0000000..0e85f1f --- /dev/null +++ b/tests/regression/test_issue_1435.cpp @@ -0,0 +1,133 @@ +/* + Github Issue #1435 +*/ + +#include "pocl_opencl.h" + +#define CL_HPP_ENABLE_EXCEPTIONS +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_TARGET_OPENCL_VERSION 120 +#include +#include +#include + +using namespace std; + +const char *SOURCE = R"RAW( + +__kernel void medfilt2d(__global float *image, // input image + __global float *result, // output array + __local float4 *l_data,// local storage 4x the number of threads + int khs1, // Kernel half-size along dim1 (nb lines) + int khs2, // Kernel half-size along dim2 (nb columns) + int height, // Image size along dim1 (nb lines) + int width) // Image size along dim2 (nb columns) +{ + int threadid = get_local_id(0); + int x = get_global_id(1); + + if (x < width) + { + union + { + float ary[8]; + float8 vec; + } output, input; + input.vec = (float8)(MAXFLOAT, MAXFLOAT, MAXFLOAT, MAXFLOAT, MAXFLOAT, MAXFLOAT, MAXFLOAT, MAXFLOAT); + int kfs1 = 2 * khs1 + 1; + int kfs2 = 2 * khs2 + 1; + int nbands = (kfs1 + 7) / 8; + for (int y=0; y(CL_PROGRAM_BINARIES, &binaries); + if (err == CL_SUCCESS) { + printf("OK\n"); + return EXIT_SUCCESS; + } else { + printf("FAIL\n"); + return EXIT_FAILURE; + } +}