Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions sycl/source/detail/event_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ class event_impl {
}
bool needsCleanupAfterWait() { return MNeedsCleanupAfterWait; }

/// Checks if an event is in a fully intialized state. Default-constructed
/// events will return true only after having initialized its native event,
/// while other events will assume that they are fully initialized at
/// construction, relying on external sources to supply member data.
///
/// \return true if the event is considered to be in a fully initialized
/// state.
bool isInitialized() const noexcept { return MIsInitialized; }

private:
// When instrumentation is enabled emits trace event for event wait begin and
// returns the telemetry event generated for the wait
Expand Down
3 changes: 2 additions & 1 deletion sycl/source/detail/queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ class queue_impl {
// Host and interop tasks, however, are not submitted to low-level runtimes
// and require separate dependency management.
const CG::CGTYPE Type = Handler.getType();
event Event;
event Event = detail::createSyclObjFromImpl<event>(
std::make_shared<detail::event_impl>());

if (PostProcess) {
bool IsKernel = Type == CG::Kernel;
Expand Down
11 changes: 6 additions & 5 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,12 @@ Command *Command::processDepEvent(EventImplPtr DepEvent, const DepDesc &Dep,
const ContextImplPtr &WorkerContext = WorkerQueue->getContextImplPtr();

// 1. Async work is not supported for host device.
// 2. Some types of commands do not produce PI events after they are enqueued
// (e.g. alloca). Note that we can't check the pi event to make that
// distinction since the command might still be unenqueued at this point.
bool PiEventExpected =
!DepEvent->is_host() || getType() == CommandType::HOST_TASK;
// 2. Non-host events can be ignored if they are not fully initialized.
// 3. Some types of commands do not produce PI events after they are enqueued
// (e.g. alloca). Note that we can't check the pi event to make that
// distinction since the command might still be unenqueued at this point.
bool PiEventExpected = (!DepEvent->is_host() && DepEvent->isInitialized()) ||
getType() == CommandType::HOST_TASK;
if (auto *DepCmd = static_cast<Command *>(DepEvent->getCommand()))
PiEventExpected &= DepCmd->producesPiEvent();

Expand Down