File tree 2 files changed +46
-0
lines changed
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,17 @@ EventImplPtr Scheduler::addHostAccessor(Requirement *Req) {
145
145
146
146
void Scheduler::releaseHostAccessor (Requirement *Req) {
147
147
Req->MBlockedCmd ->MCanEnqueue = true ;
148
+ MemObjRecord* Record = Req->MSYCLMemObj ->MRecord .get ();
149
+ auto EnqueueLeaves = [](std::vector<Command *> &Leaves) {
150
+ for (Command *Cmd : Leaves) {
151
+ EnqueueResultT Res;
152
+ bool Enqueued = GraphProcessor::enqueueCommand (Cmd, Res);
153
+ if (!Enqueued && EnqueueResultT::FAILED == Res.MResult )
154
+ throw runtime_error (" Enqueue process failed." );
155
+ }
156
+ };
157
+ EnqueueLeaves (Record->MReadLeaves );
158
+ EnqueueLeaves (Record->MWriteLeaves );
148
159
}
149
160
150
161
Scheduler::Scheduler () {
Original file line number Diff line number Diff line change
1
+ // RUN: %clangxx -fsycl %s -o %t.out
2
+ // RUN: env SYCL_PI_TRACE=1 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER
3
+ // ==---------------------- HostAccDestruction.cpp --------------------------==//
4
+ //
5
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ //
9
+ // ===----------------------------------------------------------------------===//
10
+
11
+ #include < CL/sycl.hpp>
12
+
13
+ int main () {
14
+ size_t size = 3 ;
15
+
16
+ cl::sycl::buffer<int , 1 > buf (size);
17
+ {
18
+ cl::sycl::queue q;
19
+ auto host_acc = buf.get_access <cl::sycl::access ::mode::read_write>();
20
+ q.submit ([&](cl::sycl::handler &cgh) {
21
+ auto acc = buf.get_access <cl::sycl::access ::mode::read_write>(cgh);
22
+ cgh.parallel_for <class SingleTask >(
23
+ cl::sycl::range<1 >{size},
24
+ [=](cl::sycl::id<1 > id) { (void )acc[id]; });
25
+ });
26
+ std::cout << " host acc destructor call" << std::endl;
27
+ }
28
+ std::cout << " end of scope" << std::endl;
29
+
30
+ return 0 ;
31
+ }
32
+
33
+ // CHECK:host acc destructor call
34
+ // CHECK:---> piEnqueueKernelLaunch(
35
+ // CHECK:end of scope
You can’t perform that action at this time.
0 commit comments