Skip to content

Commit 333b711

Browse files
Fix attempting to get a plugin for host device
1 parent 92e35ae commit 333b711

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sycl/source/detail/queue_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,14 @@ void queue_impl::wait(const detail::code_location &CodeLoc) {
263263
WeakEvents.swap(MEventsWeak);
264264
SharedEvents.swap(MEventsShared);
265265
}
266-
const detail::plugin &Plugin = getPlugin();
267266
// If the queue is either a host one or does not support OOO (and we use
268267
// multiple in-order queues as a result of that), wait for each event
269268
// directly. Otherwise, only wait for unenqueued or host task events, starting
270269
// from the latest submitted task in order to minimize total amount of calls,
271270
// then handle the rest with piQueueFinish.
272271
// TODO the new workflow has worse performance with Level Zero, keep the old
273272
// behavior until this is addressed
274-
if (Plugin.getBackend() == backend::level_zero) {
273+
if (!is_host() && getPlugin().getBackend() == backend::level_zero) {
275274
for (std::weak_ptr<event_impl> &EventImplWeakPtr : WeakEvents)
276275
if (std::shared_ptr<event_impl> EventImplSharedPtr =
277276
EventImplWeakPtr.lock())
@@ -293,6 +292,7 @@ void queue_impl::wait(const detail::code_location &CodeLoc) {
293292
}
294293
}
295294
if (SupportsPiFinish) {
295+
const detail::plugin &Plugin = getPlugin();
296296
Plugin.call<detail::PiApiKind::piQueueFinish>(getHandleRef());
297297
for (std::weak_ptr<event_impl> &EventImplWeakPtr : WeakEvents)
298298
if (std::shared_ptr<event_impl> EventImplSharedPtr =

0 commit comments

Comments
 (0)