forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHostAccDestruction.cpp
More file actions
39 lines (32 loc) · 1.21 KB
/
Copy pathHostAccDestruction.cpp
File metadata and controls
39 lines (32 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// RUN: %{build} -Wno-error=unused-command-line-argument -fsycl-dead-args-optimization -o %t.out
// RUN: env SYCL_UR_TRACE=1 %{run} %t.out 2>&1 | FileCheck %s
// Windows doesn't yet have full shutdown().
// UNSUPPORTED: ze_debug && windows
//==---------------------- HostAccDestruction.cpp --------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <iostream>
#include <sycl/detail/core.hpp>
int main() {
size_t size = 3;
sycl::buffer<int, 1> buf(size);
{
sycl::queue q;
auto host_acc = buf.get_host_access();
q.submit([&](sycl::handler &cgh) {
auto acc = buf.get_access<sycl::access::mode::read_write>(cgh);
cgh.parallel_for<class SingleTask>(
sycl::range<1>{size}, [=](sycl::id<1> id) { (void)acc[id]; });
});
std::cout << "host acc destructor call" << std::endl;
}
std::cout << "end of scope" << std::endl;
return 0;
}
// CHECK:host acc destructor call
// CHECK:---> urEnqueueKernelLaunch
// CHECK:end of scope