We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5847a3a commit 44e3353Copy full SHA for 44e3353
SYCL/Basic/host_task_depends.cpp
@@ -0,0 +1,31 @@
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
+void test() {
10
+ queue Q;
11
+ std::shared_ptr<std::mutex> Mutex(new std::mutex());
12
+ Mutex->lock();
13
+ {
14
+ auto E = Q.submit([&](handler &CGH) {
15
+ CGH.host_task([=]() { std::lock_guard<std::mutex> Guard(*Mutex); });
16
+ });
17
+ // Host task should block kernel enqueue but not cause dead lock here
18
+ Q.submit([&](handler &CGH) {
19
+ CGH.depends_on(E);
20
+ CGH.single_task([=]() {});
21
22
+ }
23
+ // Unblock kernel execution
24
+ Mutex->unlock();
25
+ Q.wait();
26
+}
27
28
+int main() {
29
+ test();
30
+ return 0;
31
0 commit comments