File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2
+ // RUN: %CPU_RUN_PLACEHOLDER %t.out
3
+
4
+ #include < sycl/sycl.hpp>
5
+
6
+ using namespace sycl ;
7
+ using namespace sycl ::access;
8
+
9
+ static constexpr size_t BUFFER_SIZE = 256 ;
10
+
11
+ void test () {
12
+ queue Q;
13
+ std::unique_ptr<host_accessor<int >> HostAcc;
14
+ {
15
+ buffer<int , 1 > Buffer{BUFFER_SIZE};
16
+ HostAcc.reset (new host_accessor (Buffer));
17
+ // Host accessor should block kernel execution
18
+ Q.submit ([&](handler &CGH) {
19
+ auto Acc = Buffer.template get_access <mode::write>(CGH);
20
+ CGH.parallel_for <class Test >(BUFFER_SIZE,
21
+ [=](item<1 > Id) { Acc[Id] = 0 ; });
22
+ });
23
+ // Buffer destructor should not wait till all operations completion here
24
+ }
25
+ // Unblock kernel execution
26
+ HostAcc.reset (nullptr );
27
+ Q.wait ();
28
+ }
29
+
30
+ int main () {
31
+ test ();
32
+ return 0 ;
33
+ }
You can’t perform that action at this time.
0 commit comments