Skip to content

Commit e49c6fc

Browse files
[SYCL][NFC] Rename misleading queue_impl::MSupportOOO variable (#8342)
The variable is supposed to indicate that we failed to create an OOO native queue and we need to emulate it if its value is false. Rename to MEmulateOOO to avoid confusion with in-order/out-of-order SYCL queues.
1 parent ece344b commit e49c6fc

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

sycl/source/detail/queue_impl.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ event queue_impl::memset(const std::shared_ptr<detail::queue_impl> &Self,
117117
}
118118
}
119119
// Track only if we won't be able to handle it with piQueueFinish.
120-
if (!MSupportOOO)
120+
if (MEmulateOOO)
121121
addSharedEvent(ResEvent);
122122
return MDiscardEvents ? createDiscardedEvent() : ResEvent;
123123
}
@@ -180,7 +180,7 @@ event queue_impl::memcpy(const std::shared_ptr<detail::queue_impl> &Self,
180180
}
181181
}
182182
// Track only if we won't be able to handle it with piQueueFinish.
183-
if (!MSupportOOO)
183+
if (MEmulateOOO)
184184
addSharedEvent(ResEvent);
185185
return MDiscardEvents ? createDiscardedEvent() : ResEvent;
186186
}
@@ -224,7 +224,7 @@ event queue_impl::mem_advise(const std::shared_ptr<detail::queue_impl> &Self,
224224
}
225225
}
226226
// Track only if we won't be able to handle it with piQueueFinish.
227-
if (!MSupportOOO)
227+
if (MEmulateOOO)
228228
addSharedEvent(ResEvent);
229229
return MDiscardEvents ? createDiscardedEvent() : ResEvent;
230230
}
@@ -237,12 +237,12 @@ void queue_impl::addEvent(const event &Event) {
237237
// if there is no command on the event, we cannot track it with MEventsWeak
238238
// as that will leave it with no owner. Track in MEventsShared only if we're
239239
// unable to call piQueueFinish during wait.
240-
if (is_host() || !MSupportOOO)
240+
if (is_host() || MEmulateOOO)
241241
addSharedEvent(Event);
242242
}
243243
// As long as the queue supports piQueueFinish we only need to store events
244244
// for unenqueued commands and host tasks.
245-
else if (is_host() || !MSupportOOO || EImpl->getHandleRef() == nullptr) {
245+
else if (is_host() || MEmulateOOO || EImpl->getHandleRef() == nullptr) {
246246
std::weak_ptr<event_impl> EventWeakPtr{EImpl};
247247
std::lock_guard<std::mutex> Lock{MMutex};
248248
MEventsWeak.push_back(std::move(EventWeakPtr));
@@ -253,7 +253,7 @@ void queue_impl::addEvent(const event &Event) {
253253
/// but some events have no other owner. In this case,
254254
/// addSharedEvent will have the queue track the events via a shared pointer.
255255
void queue_impl::addSharedEvent(const event &Event) {
256-
assert(is_host() || !MSupportOOO);
256+
assert(is_host() || MEmulateOOO);
257257
std::lock_guard<std::mutex> Lock(MMutex);
258258
// Events stored in MEventsShared are not released anywhere else aside from
259259
// calls to queue::wait/wait_and_throw, which a user application might not
@@ -388,7 +388,7 @@ void queue_impl::wait(const detail::code_location &CodeLoc) {
388388
// directly. Otherwise, only wait for unenqueued or host task events, starting
389389
// from the latest submitted task in order to minimize total amount of calls,
390390
// then handle the rest with piQueueFinish.
391-
const bool SupportsPiFinish = !is_host() && MSupportOOO;
391+
const bool SupportsPiFinish = !is_host() && !MEmulateOOO;
392392
for (auto EventImplWeakPtrIt = WeakEvents.rbegin();
393393
EventImplWeakPtrIt != WeakEvents.rend(); ++EventImplWeakPtrIt) {
394394
if (std::shared_ptr<event_impl> EventImplSharedPtr =

sycl/source/detail/queue_impl.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ class queue_impl {
449449
// If creating out-of-order queue failed and this property is not
450450
// supported (for example, on FPGA), it will return
451451
// PI_ERROR_INVALID_QUEUE_PROPERTIES and will try to create in-order queue.
452-
if (MSupportOOO && Error == PI_ERROR_INVALID_QUEUE_PROPERTIES) {
453-
MSupportOOO = false;
452+
if (!MEmulateOOO && Error == PI_ERROR_INVALID_QUEUE_PROPERTIES) {
453+
MEmulateOOO = true;
454454
Queue = createQueue(QueueOrder::Ordered);
455455
} else {
456456
Plugin.checkPiResult(Error);
@@ -493,7 +493,7 @@ class queue_impl {
493493
/// \return a raw PI queue handle. The returned handle is not retained. It
494494
/// is caller responsibility to make sure queue is still alive.
495495
RT::PiQueue &getHandleRef() {
496-
if (MSupportOOO)
496+
if (!MEmulateOOO)
497497
return MQueues[0];
498498

499499
return getExclusiveQueueHandleRef();
@@ -713,8 +713,9 @@ class queue_impl {
713713
size_t MNextQueueIdx = 0;
714714

715715
const bool MHostQueue = false;
716-
// Assume OOO support by default.
717-
bool MSupportOOO = true;
716+
/// Indicates that a native out-of-order queue could not be created and we
717+
/// need to emulate it with multiple native in-order queues.
718+
bool MEmulateOOO = false;
718719

719720
// Buffer to store assert failure descriptor
720721
buffer<AssertHappened, 1> MAssertHappenedBuffer;

0 commit comments

Comments
 (0)