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