Skip to content

Commit

Permalink
[SYCL] Update scheduler API in event methods
Browse files Browse the repository at this point in the history
Updated event::get_wait_list, event::wait_and_throw and event::wait
to use new scheduler.

Signed-off-by: Vlad Romanov <[email protected]>
  • Loading branch information
romanovvlad authored and bader committed May 27, 2019
1 parent 40ce2a7 commit 5334afc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,23 @@ void event_impl::wait(
// go via the slow path event waiting in the scheduler
waitInternal();
else
#ifdef SCHEDULER_20
detail::Scheduler::getInstance().waitForEvent(std::move(Self));
#else
simple_scheduler::Scheduler::getInstance().waitForEvent(Self);
#endif
}

void event_impl::wait_and_throw(
std::shared_ptr<cl::sycl::detail::event_impl> Self) {
wait(Self);
#ifdef SCHEDULER_20
for (auto &EventImpl :
detail::Scheduler::getInstance().getWaitList(std::move(Self)))
EventImpl->getQueue()->throw_asynchronous();
#else
cl::sycl::simple_scheduler::Scheduler::getInstance().throwForEvent(Self);
#endif
}

template <>
Expand Down
9 changes: 9 additions & 0 deletions sycl/source/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,17 @@ void event::wait_and_throw(const vector_class<event> &EventList) {
}

vector_class<event> event::get_wait_list() {
#ifdef SCHEDULER_20
vector_class<event> Result;

for (auto &EventImpl : detail::Scheduler::getInstance().getWaitList(impl))
Result.push_back(detail::createSyclObjFromImpl<event>(EventImpl));

return Result;
#else
return cl::sycl::simple_scheduler::Scheduler::getInstance().
getDepEvents(impl);
#endif
}

event::event(std::shared_ptr<detail::event_impl> event_impl)
Expand Down

0 comments on commit 5334afc

Please sign in to comment.