Skip to content

Commit 285cb5a

Browse files
author
Sergey Kanaev
committed
[SYCL] Add test
Signed-off-by: Sergey Kanaev <[email protected]>
1 parent 404208b commit 285cb5a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

sycl/test/host-interop-task/interop-task.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,36 @@ void test4() {
194194
});
195195
}
196196

197+
void test5() {
198+
buffer<int, 1> Buffer1{BUFFER_SIZE};
199+
buffer<int, 1> Buffer2{BUFFER_SIZE};
200+
201+
queue Q;
202+
203+
Q.submit([&](handler &CGH) {
204+
auto Acc = Buffer1.template get_access<mode::write>(CGH);
205+
206+
auto Kernel = [=](item<1> Id) { Acc[Id] = 123; };
207+
CGH.parallel_for<class Test5Init>(Acc.get_count(), Kernel);
208+
});
209+
210+
copy(Buffer1, Buffer2, Q);
211+
212+
{
213+
auto Acc = Buffer2.get_access<mode::read>();
214+
215+
for (size_t Idx =0; Idx < Acc.get_count(); ++Idx) {
216+
std::cout << "Second buffer [" << Idx << "] = " << Acc[Idx] << std::endl;
217+
assert(Acc[Idx] == 123);
218+
}
219+
}
220+
}
221+
197222
int main() {
198223
test1();
199224
test2();
200225
test3();
201226
test4();
227+
test5();
202228
return 0;
203229
}

0 commit comments

Comments
 (0)