@@ -533,10 +533,8 @@ void Command::waitForEvents(queue_impl *Queue,
533
533
RequiredEventsPerContext;
534
534
535
535
for (const EventImplPtr &Event : EventImpls) {
536
- ContextImplPtr Context = Event->getContextImpl ();
537
- assert (Context.get () &&
538
- " Only non-host events are expected to be waited for here" );
539
- RequiredEventsPerContext[Context.get ()].push_back (Event);
536
+ context_impl &Context = Event->getContextImpl ();
537
+ RequiredEventsPerContext[&Context].push_back (Event);
540
538
}
541
539
542
540
for (auto &CtxWithEvents : RequiredEventsPerContext) {
@@ -576,7 +574,7 @@ Command::Command(
576
574
MEvent->setSubmittedQueue (MWorkerQueue);
577
575
MEvent->setCommand (this );
578
576
if (MQueue)
579
- MEvent->setContextImpl (MQueue->getContextImplPtr ());
577
+ MEvent->setContextImpl (MQueue->getContextImpl ());
580
578
MEvent->setStateIncomplete ();
581
579
MEnqueueStatus = EnqueueResultT::SyclEnqueueReady;
582
580
@@ -781,9 +779,9 @@ Command *Command::processDepEvent(EventImplPtr DepEvent, const DepDesc &Dep,
781
779
782
780
Command *ConnectionCmd = nullptr ;
783
781
784
- ContextImplPtr DepEventContext = DepEvent->getContextImpl ();
782
+ context_impl & DepEventContext = DepEvent->getContextImpl ();
785
783
// If contexts don't match we'll connect them using host task
786
- if (DepEventContext != WorkerContext && WorkerContext) {
784
+ if (& DepEventContext != WorkerContext. get () && WorkerContext) {
787
785
Scheduler::GraphBuilder &GB = Scheduler::getInstance ().MGraphBuilder ;
788
786
ConnectionCmd = GB.connectDepEvent (this , DepEvent, Dep, ToCleanUp);
789
787
} else
@@ -1298,7 +1296,7 @@ ur_result_t ReleaseCommand::enqueueImp() {
1298
1296
1299
1297
std::shared_ptr<event_impl> UnmapEventImpl =
1300
1298
event_impl::create_device_event (*Queue);
1301
- UnmapEventImpl->setContextImpl (Queue->getContextImplPtr ());
1299
+ UnmapEventImpl->setContextImpl (Queue->getContextImpl ());
1302
1300
UnmapEventImpl->setStateIncomplete ();
1303
1301
ur_event_handle_t UREvent = nullptr ;
1304
1302
@@ -1516,7 +1514,7 @@ MemCpyCommand::MemCpyCommand(Requirement SrcReq,
1516
1514
MSrcReq(std::move(SrcReq)), MSrcAllocaCmd(SrcAllocaCmd),
1517
1515
MDstReq(std::move(DstReq)), MDstAllocaCmd(DstAllocaCmd) {
1518
1516
if (MSrcQueue) {
1519
- MEvent->setContextImpl (MSrcQueue->getContextImplPtr ());
1517
+ MEvent->setContextImpl (MSrcQueue->getContextImpl ());
1520
1518
}
1521
1519
1522
1520
MWorkerQueue = !MQueue ? MSrcQueue : MQueue;
@@ -1689,7 +1687,7 @@ MemCpyCommandHost::MemCpyCommandHost(Requirement SrcReq,
1689
1687
MSrcReq(std::move(SrcReq)), MSrcAllocaCmd(SrcAllocaCmd),
1690
1688
MDstReq(std::move(DstReq)), MDstPtr(DstPtr) {
1691
1689
if (MSrcQueue) {
1692
- MEvent->setContextImpl (MSrcQueue->getContextImplPtr ());
1690
+ MEvent->setContextImpl (MSrcQueue->getContextImpl ());
1693
1691
}
1694
1692
1695
1693
MWorkerQueue = !MQueue ? MSrcQueue : MQueue;
0 commit comments