@@ -95,45 +95,50 @@ void EventCompletionClbk(RT::PiEvent, pi_int32, void *data) {
95
95
EventImplPtr *Event = (reinterpret_cast <EventImplPtr *>(data));
96
96
RT::PiEvent &EventHandle = (*Event)->getHandleRef ();
97
97
const detail::plugin &Plugin = (*Event)->getPlugin ();
98
- Plugin.call <PiApiKind::piEventSetStatus>(EventHandle, CL_COMPLETE );
98
+ Plugin.call <PiApiKind::piEventSetStatus>(EventHandle, PI_EVENT_COMPLETE );
99
99
delete (Event);
100
100
}
101
101
102
102
// Method prepares PI event's from list sycl::event's
103
103
std::vector<EventImplPtr> Command::prepareEvents (ContextImplPtr Context) {
104
104
std::vector<EventImplPtr> Result;
105
105
std::vector<EventImplPtr> GlueEvents;
106
- for (EventImplPtr &Event : MDepsEvents) {
106
+ for (EventImplPtr &DepEvent : MDepsEvents) {
107
107
// Async work is not supported for host device.
108
- if (Event ->is_host ()) {
109
- Event ->waitInternal ();
108
+ if (DepEvent ->is_host ()) {
109
+ DepEvent ->waitInternal ();
110
110
continue ;
111
111
}
112
112
// The event handle can be null in case of, for example, alloca command,
113
113
// which is currently synchrounious, so don't generate OpenCL event.
114
- if (Event ->getHandleRef () == nullptr ) {
114
+ if (DepEvent ->getHandleRef () == nullptr ) {
115
115
continue ;
116
116
}
117
- ContextImplPtr EventContext = Event->getContextImpl ();
118
- const detail::plugin &Plugin = Event->getPlugin ();
119
- // If contexts don't match - connect them using user event
120
- if (EventContext != Context && !Context->is_host ()) {
117
+ ContextImplPtr DepEventContext = DepEvent->getContextImpl ();
121
118
119
+ // If contexts don't match - connect them using user event
120
+ if (DepEventContext != Context && !Context->is_host ()) {
122
121
EventImplPtr GlueEvent (new detail::event_impl ());
123
122
GlueEvent->setContextImpl (Context);
123
+ EventImplPtr *GlueEventCopy =
124
+ new EventImplPtr (GlueEvent); // To increase the reference count by 1.
125
+
124
126
RT::PiEvent &GlueEventHandle = GlueEvent->getHandleRef ();
127
+ auto Plugin = Context->getPlugin ();
128
+ auto DepPlugin = DepEventContext->getPlugin ();
129
+ // Add an event on the current context that
130
+ // is triggered when the DepEvent is complete
125
131
Plugin.call <PiApiKind::piEventCreate>(Context->getHandleRef (),
126
132
&GlueEventHandle);
127
- EventImplPtr *GlueEventCopy =
128
- new EventImplPtr (GlueEvent); // To increase the reference count by 1.
129
- Plugin.call <PiApiKind::piEventSetCallback>(
130
- Event->getHandleRef (), CL_COMPLETE, EventCompletionClbk,
133
+
134
+ DepPlugin.call <PiApiKind::piEventSetCallback>(
135
+ DepEvent->getHandleRef (), PI_EVENT_COMPLETE, EventCompletionClbk,
131
136
/* void *data=*/ (GlueEventCopy));
132
137
GlueEvents.push_back (GlueEvent);
133
138
Result.push_back (std::move (GlueEvent));
134
139
continue ;
135
140
}
136
- Result.push_back (Event );
141
+ Result.push_back (DepEvent );
137
142
}
138
143
MDepsEvents.insert (MDepsEvents.end (), GlueEvents.begin (), GlueEvents.end ());
139
144
return Result;
0 commit comments