From 49d0674f693f71d138294b5cf7f2f3bda5290c1e Mon Sep 17 00:00:00 2001 From: Michal Babej Date: Mon, 20 Sep 2021 09:12:24 +0300 Subject: [PATCH] [PATCH 18/90] Fix tests/regression/test_alignment_with_dynamic_wg.cpp Don't rebuild the program inside loop iteration, instead create a new one on each iteration. Gbp-Pq: Name 0018-Fix-tests-regression-test_alignment_with_dynamic_wg..patch --- tests/regression/test_alignment_with_dynamic_wg.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/regression/test_alignment_with_dynamic_wg.cpp b/tests/regression/test_alignment_with_dynamic_wg.cpp index 281d66d..f049184 100644 --- a/tests/regression/test_alignment_with_dynamic_wg.cpp +++ b/tests/regression/test_alignment_with_dynamic_wg.cpp @@ -48,8 +48,7 @@ __kernel void test(global uint *output, global const uint* trialValue){ bool test_invocation(unsigned x, unsigned y, unsigned z, const std::string &arg_x, const std::string &arg_y, - const std::string &arg_z, cl::CommandQueue &queue, - cl::Program &program) { + const std::string &arg_z, cl::CommandQueue &queue) { unsigned expected_sum = x * y * z * 4; @@ -57,6 +56,7 @@ bool test_invocation(unsigned x, unsigned y, unsigned z, assert(local_size > 0); assert(local_size <= 256); + cl::Program program(SOURCE); std::string options = "-cl-std=CL1.2"; options += " -DX=" + arg_x + " -DY=" + arg_y + " -DZ=" + arg_z; program.build(options.c_str()); @@ -107,7 +107,6 @@ bool test_invocation(unsigned x, unsigned y, unsigned z, int main(int argc, char *argv[]) { cl::Device device = cl::Device::getDefault(); cl::CommandQueue queue = cl::CommandQueue::getDefault(); - cl::Program program(SOURCE); if (argc < 4) { std::cout << "USAGE: $0 X Y Z\n"; @@ -122,13 +121,13 @@ int main(int argc, char *argv[]) { unsigned y = std::stoi(argv[2]); unsigned z = std::stoi(argv[3]); - if (!test_invocation(x, y, z, arg_x, arg_y, arg_z, queue, program)) + if (!test_invocation(x, y, z, arg_x, arg_y, arg_z, queue)) return 1; - if (!test_invocation(y, z, x, arg_y, arg_z, arg_x, queue, program)) + if (!test_invocation(y, z, x, arg_y, arg_z, arg_x, queue)) return 1; - if (!test_invocation(z, x, y, arg_z, arg_x, arg_y, queue, program)) + if (!test_invocation(z, x, y, arg_z, arg_x, arg_y, queue)) return 1; return 0; -- 2.30.2