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

[SYCL] E2E test for host task scheduling fix #1462

Merged
merged 1 commit into from
Dec 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions SYCL/Basic/host_task_depends.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out

#include <sycl/sycl.hpp>

using namespace sycl;
using namespace sycl::access;

void test() {
queue Q;
std::shared_ptr<std::mutex> Mutex(new std::mutex());
Mutex->lock();
{
auto E = Q.submit([&](handler &CGH) {
CGH.host_task([=]() { std::lock_guard<std::mutex> Guard(*Mutex); });
});
// Host task should block kernel enqueue but not cause dead lock here
Q.submit([&](handler &CGH) {
CGH.depends_on(E);
CGH.single_task([=]() {});
});
}
// Unblock kernel execution
Mutex->unlock();
Q.wait();
}

int main() {
test();
return 0;
}