Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit b1aab8f

Browse files
[SYCL] E2E test for host task scheduling fix (#1462)
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
1 parent 093f069 commit b1aab8f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

SYCL/Basic/host_task_depends.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)