Skip to content

Commit 1851e28

Browse files
signal host as usual
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
1 parent 83a6d12 commit 1851e28

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

sycl/source/detail/event_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ event_impl::~event_impl() {
5454

5555
void event_impl::waitInternal(bool *Success) {
5656
auto Handle = this->getHandle();
57-
if (Handle) {
57+
if (!MIsHostEvent && Handle) {
5858
// Wait for the native event
5959
ur_result_t Err =
6060
getAdapter()->call_nocheck<UrApiKind::urEventWait>(1, &Handle);
@@ -92,7 +92,7 @@ void event_impl::waitInternal(bool *Success) {
9292
}
9393

9494
void event_impl::setComplete() {
95-
if (!this->getHandle()) {
95+
if (MIsHostEvent || !this->getHandle()) {
9696
{
9797
std::unique_lock<std::mutex> lock(MMutex);
9898
#ifndef NDEBUG

sycl/source/detail/scheduler/scheduler.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,17 +469,15 @@ void Scheduler::NotifyHostTaskCompletion(Command *Cmd) {
469469
ToCleanUp.push_back(Cmd);
470470
Cmd->MMarkedForCleanup = true;
471471
}
472-
472+
{
473+
std::lock_guard<std::mutex> Guard(Cmd->MBlockedUsersMutex);
474+
// update self-event status
475+
CmdEvent->setComplete();
476+
}
473477
if (auto NativeEvent = CmdEvent->getHandle()) {
474478
QueueImpl->getAdapter()->call<UrApiKind::urEventHostSignal>(NativeEvent);
475-
} else {
476-
{
477-
std::lock_guard<std::mutex> Guard(Cmd->MBlockedUsersMutex);
478-
// update self-event status
479-
CmdEvent->setComplete();
480-
}
479+
} else
481480
Scheduler::enqueueUnblockedCommands(Cmd->MBlockedUsers, Lock, ToCleanUp);
482-
}
483481
}
484482
QueueImpl->revisitUnenqueuedCommandsState(CmdEvent);
485483

sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ template <sycl::backend Backend> void InOrderQueueHostTaskDepsTestBody() {
8383
InOrderQueue.submit([&](sycl::handler &CGH) { CGH.host_task([=] {}); })
8484
.wait();
8585
EXPECT_EQ(EventCreated, Backend == sycl::backend::ext_oneapi_level_zero);
86-
EXPECT_EQ(GEventsWaitCounter,
87-
1u + size_t(Backend == sycl::backend::ext_oneapi_level_zero));
86+
EXPECT_EQ(GEventsWaitCounter, 1u);
8887
EXPECT_EQ(EventSignaled, Backend == sycl::backend::ext_oneapi_level_zero);
8988
}
9089

0 commit comments

Comments
 (0)