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 <anastasia.stulova@arm.com>
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
Kévin Petit
2019-05-03 01:16:46 +08:00
committed by GitHub
parent d536a019d1
commit 509172b780

View File

@@ -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