Skip to content

Commit f372df5

Browse files
authored
[SYCL][TEST] Fix incorrect usage of host accessor
The test tries to create second host accessor to the buffer while the first one still alive. This leads to hang. The patch moves the first host accessor to the scope so it is destructed before construction of the second host accessor. Signed-off-by: Vlad Romanov <[email protected]>
1 parent d43ee69 commit f372df5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

sycl/test/basic_tests/buffer/buffer.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -655,11 +655,15 @@ int main() {
655655
cl::sycl::buffer<char, 1> Buf_1(Size);
656656
cl::sycl::buffer<char, 1> Buf_2(Size / 2);
657657

658-
auto AccA = Buf_1.get_access<cl::sycl::access::mode::read_write>(Size / 2);
659-
auto AccB = Buf_2.get_access<cl::sycl::access::mode::read_write>(Size / 2);
660-
assert(AccA.get_size() == AccB.get_size());
661-
assert(AccA.get_range() == AccB.get_range());
662-
assert(AccA.get_count() == AccB.get_count());
658+
{
659+
auto AccA =
660+
Buf_1.get_access<cl::sycl::access::mode::read_write>(Size / 2);
661+
auto AccB =
662+
Buf_2.get_access<cl::sycl::access::mode::read_write>(Size / 2);
663+
assert(AccA.get_size() == AccB.get_size());
664+
assert(AccA.get_range() == AccB.get_range());
665+
assert(AccA.get_count() == AccB.get_count());
666+
}
663667

664668
auto AH0 = accessor<char, 0, access::mode::read_write,
665669
access::target::host_buffer>(Buf_1);

0 commit comments

Comments
 (0)