From 509172b7805aca2514081e259b6f26cb74a3445a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Fri, 3 May 2019 01:16:46 +0800 Subject: [PATCH] cl20: Khronos Bug 16235: Allow the barrier test to pass in isolation (#262) The input buffer to tests in execute_block suite is set to some value (0xdeadbeef) but supposed to be reset in each test such so that observing 0 after executing the test guarantees that the status is that of the test and not a pre-existing value. This commit adds missing initialisation to block_barrier kernel code and removes an extra redundant barrier at the end. This test is the last in the suite. After executing other tests the input/output buffer is not being reset on a host side and therefore running the test after successful execution of the previous test (resulting in writing expected 0 into the buffer) was hiding the problem. Change-Id: Ia9310d095993703c32ee1f664aed9ff72b26367a Signed-off-by: Anastasia Stulova Signed-off-by: Kevin Petit --- test_conformance/device_execution/execute_block.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test_conformance/device_execution/execute_block.cpp b/test_conformance/device_execution/execute_block.cpp index e10b7c6e..99589605 100644 --- a/test_conformance/device_execution/execute_block.cpp +++ b/test_conformance/device_execution/execute_block.cpp @@ -928,15 +928,16 @@ static const char* block_barrier[] = NL, " size_t gid = get_group_id(0);" NL, " size_t idx = gid*lsz;" NL, "" + NL, " res[tid]=lsz;" + NL, " barrier(CLK_GLOBAL_MEM_FENCE);" NL, " int (^kernelBlock)(int) = ^(int a)" NL, " {" - NL, " atomic_inc(res+idx);" + NL, " atomic_dec(res+idx);" NL, " barrier(CLK_GLOBAL_MEM_FENCE);" - NL, " return (int)abs(a - b) - (res[idx] != lsz ? 0 : 1);" + NL, " return (int)abs(a - b) - (res[idx] != 0 ? 0 : 1);" NL, " };" NL, "" NL, " int d = kernelBlock(2);" - NL, " barrier(CLK_GLOBAL_MEM_FENCE);" NL, " res[tid] = d;" NL, "}" NL