Skip to content

Commit 97d76dc

Browse files
Apply comments
1 parent 70eb1aa commit 97d76dc

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

sycl/source/detail/queue_impl.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ void queue_impl::addEvent(const event &Event) {
122122
/// but some events have no other owner. In this case,
123123
/// addSharedEvent will have the queue track the events via a shared pointer.
124124
void queue_impl::addSharedEvent(const event &Event) {
125+
assert(is_host() || !MSupportOOO);
125126
std::lock_guard<std::mutex> Lock(MMutex);
126127
// Events stored in MEventsShared are not released anywhere else aside from
127128
// calls to queue::wait/wait_and_throw, which a user application might not
@@ -254,26 +255,27 @@ void queue_impl::wait(const detail::code_location &CodeLoc) {
254255
// directly. Otherwise, only wait for unenqueued or host task events, starting
255256
// from the latest submitted task in order to minimize total amount of calls,
256257
// then handle the rest with piQueueFinish.
258+
bool SupportsPiFinish = !is_host() && MSupportOOO;
257259
for (auto EventImplWeakPtrIt = WeakEvents.rbegin();
258260
EventImplWeakPtrIt != WeakEvents.rend(); ++EventImplWeakPtrIt) {
259261
if (std::shared_ptr<event_impl> EventImplSharedPtr =
260262
EventImplWeakPtrIt->lock()) {
261263
// A nullptr PI event indicates that piQueueFinish will not cover it,
262264
// either because it's a host task event or an unenqueued one.
263-
if (is_host() || !MSupportOOO ||
264-
nullptr == EventImplSharedPtr->getHandleRef()) {
265+
if (!SupportsPiFinish || nullptr == EventImplSharedPtr->getHandleRef()) {
265266
EventImplSharedPtr->wait(EventImplSharedPtr);
266267
}
267268
}
268269
}
269-
if (!is_host() && MSupportOOO) {
270+
if (SupportsPiFinish) {
270271
const detail::plugin &Plugin = getPlugin();
271272
Plugin.call<detail::PiApiKind::piQueueFinish>(getHandleRef());
272273
for (std::weak_ptr<event_impl> &EventImplWeakPtr : WeakEvents)
273274
if (std::shared_ptr<event_impl> EventImplSharedPtr =
274275
EventImplWeakPtr.lock())
275276
EventImplSharedPtr->cleanupCommand(EventImplSharedPtr);
276-
assert(SharedEvents.empty());
277+
assert(SharedEvents.empty() && "Queues that support calling piQueueFinish "
278+
"shouldn't have shared events");
277279
} else {
278280
for (event &Event : SharedEvents)
279281
Event.wait();

sycl/unittests/queue/Wait.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ bool preparePiMock(platform &Plt) {
9191
<< std::endl;
9292
return false;
9393
}
94-
// TODO: Skip tests for CUDA temporarily
95-
if (detail::getSyclObjImpl(Plt)->getPlugin().getBackend() == backend::cuda) {
96-
std::cout << "Not run on CUDA - usm is not supported for CUDA backend yet"
97-
<< std::endl;
98-
return false;
99-
}
10094

10195
unittest::PiMock Mock{Plt};
10296
Mock.redefine<detail::PiApiKind::piQueueCreate>(redefinedQueueCreate);

0 commit comments

Comments
 (0)