@@ -231,20 +231,20 @@ static std::string commandToName(Command::CommandType Type) {
231231}
232232#endif
233233
234- std::vector<ur_event_handle_t >
235- Command::getUrEvents ( const std::vector<EventImplPtr> &EventImpls ,
236- queue_impl *CommandQueue, bool IsHostTaskCommand) {
234+ std::vector<ur_event_handle_t > Command::getUrEvents (events_range Events,
235+ queue_impl *CommandQueue ,
236+ bool IsHostTaskCommand) {
237237 std::vector<ur_event_handle_t > RetUrEvents;
238- for (auto &EventImpl : EventImpls ) {
239- auto Handle = EventImpl-> getHandle ();
238+ for (event_impl &Event : Events ) {
239+ auto Handle = Event. getHandle ();
240240 if (Handle == nullptr )
241241 continue ;
242242
243243 // Do not add redundant event dependencies for in-order queues.
244244 // At this stage dependency is definitely ur task and need to check if
245245 // current one is a host task. In this case we should not skip ur event due
246246 // to different sync mechanisms for different task types on in-order queue.
247- if (CommandQueue && EventImpl-> getWorkerQueue ().get () == CommandQueue &&
247+ if (CommandQueue && Event. getWorkerQueue ().get () == CommandQueue &&
248248 CommandQueue->isInOrder () && !IsHostTaskCommand)
249249 continue ;
250250
@@ -254,39 +254,34 @@ Command::getUrEvents(const std::vector<EventImplPtr> &EventImpls,
254254 return RetUrEvents;
255255}
256256
257- std::vector<ur_event_handle_t >
258- Command::getUrEvents (const std::vector<EventImplPtr> &EventImpls) const {
259- return getUrEvents (EventImpls, MWorkerQueue.get (), isHostTask ());
257+ std::vector<ur_event_handle_t > Command::getUrEvents (events_range Events) const {
258+ return getUrEvents (Events, MWorkerQueue.get (), isHostTask ());
260259}
261260
262261// This function is implemented (duplicating getUrEvents a lot) as short term
263262// solution for the issue that barrier with wait list could not
264263// handle empty ur event handles when kernel is enqueued on host task
265264// completion.
266265std::vector<ur_event_handle_t >
267- Command::getUrEventsBlocking (const std::vector<EventImplPtr> &EventImpls,
268- bool HasEventMode) const {
266+ Command::getUrEventsBlocking (events_range Events, bool HasEventMode) const {
269267 std::vector<ur_event_handle_t > RetUrEvents;
270- for (auto &EventImpl : EventImpls ) {
268+ for (event_impl &Event : Events ) {
271269 // Throwaway events created with empty constructor will not have a context
272270 // (which is set lazily) calling getContextImpl() would set that
273271 // context, which we wish to avoid as it is expensive.
274272 // Skip host task and NOP events also.
275- if (EventImpl->isDefaultConstructed () || EventImpl->isHost () ||
276- EventImpl->isNOP ())
273+ if (Event.isDefaultConstructed () || Event.isHost () || Event.isNOP ())
277274 continue ;
278275
279276 // If command has not been enqueued then we have to enqueue it.
280277 // It may happen if async enqueue in a host task is involved.
281278 // Interoperability events are special cases and they are not enqueued, as
282279 // they don't have an associated queue and command.
283- if (!EventImpl->isInterop () && !EventImpl->isEnqueued ()) {
284- if (!EventImpl->getCommand () ||
285- !EventImpl->getCommand ()->producesPiEvent ())
280+ if (!Event.isInterop () && !Event.isEnqueued ()) {
281+ if (!Event.getCommand () || !Event.getCommand ()->producesPiEvent ())
286282 continue ;
287283 std::vector<Command *> AuxCmds;
288- Scheduler::getInstance ().enqueueCommandForCG (*EventImpl, AuxCmds,
289- BLOCKING);
284+ Scheduler::getInstance ().enqueueCommandForCG (Event, AuxCmds, BLOCKING);
290285 }
291286 // Do not add redundant event dependencies for in-order queues.
292287 // At this stage dependency is definitely ur task and need to check if
@@ -296,11 +291,11 @@ Command::getUrEventsBlocking(const std::vector<EventImplPtr> &EventImpls,
296291 // redundant events may still differ from the resulting event, so they are
297292 // kept.
298293 if (!HasEventMode && MWorkerQueue &&
299- EventImpl-> getWorkerQueue () == MWorkerQueue &&
300- MWorkerQueue-> isInOrder () && !isHostTask ())
294+ Event. getWorkerQueue () == MWorkerQueue && MWorkerQueue-> isInOrder () &&
295+ !isHostTask ())
301296 continue ;
302297
303- RetUrEvents.push_back (EventImpl-> getHandle ());
298+ RetUrEvents.push_back (Event. getHandle ());
304299 }
305300
306301 return RetUrEvents;
0 commit comments