@@ -192,21 +192,21 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
192
192
// / @param EventImpl Event to associate with a node in map.
193
193
// / @param NodeImpl Node to associate with event in map.
194
194
void addEventForNode (std::shared_ptr<sycl::detail::event_impl> EventImpl,
195
- const std::shared_ptr< node_impl> &NodeImpl) {
195
+ node_impl &NodeImpl) {
196
196
if (!(EventImpl->hasCommandGraph ()))
197
197
EventImpl->setCommandGraph (shared_from_this ());
198
- MEventsMap[EventImpl] = NodeImpl;
198
+ MEventsMap[EventImpl] = & NodeImpl;
199
199
}
200
200
201
201
// / Find the sycl event associated with a node.
202
202
// / @param NodeImpl Node to find event for.
203
203
// / @return Event associated with node.
204
204
std::shared_ptr<sycl::detail::event_impl>
205
- getEventForNode (std::shared_ptr< node_impl> NodeImpl) const {
205
+ getEventForNode (node_impl & NodeImpl) const {
206
206
ReadLock Lock (MMutex);
207
207
if (auto EventImpl = std::find_if (
208
208
MEventsMap.begin (), MEventsMap.end (),
209
- [NodeImpl](auto &it) { return it.second == NodeImpl; });
209
+ [& NodeImpl](auto &it) { return it.second == & NodeImpl; });
210
210
EventImpl != MEventsMap.end ()) {
211
211
return EventImpl->first ;
212
212
}
@@ -220,13 +220,14 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
220
220
// / the given event.
221
221
// / @param EventImpl Event to find the node for.
222
222
// / @return Node associated with the event.
223
- std::shared_ptr< node_impl>
223
+ node_impl &
224
224
getNodeForEvent (std::shared_ptr<sycl::detail::event_impl> EventImpl) {
225
225
ReadLock Lock (MMutex);
226
226
227
227
if (auto NodeFound = MEventsMap.find (EventImpl);
228
228
NodeFound != std::end (MEventsMap)) {
229
- return NodeFound->second ;
229
+ // TODO: Is it guaranteed to be non-null?
230
+ return *NodeFound->second ;
230
231
}
231
232
232
233
throw sycl::exception (
@@ -238,9 +239,9 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
238
239
// / found for a given event.
239
240
// / @param Events Events to find nodes for.
240
241
// / @return A list of node counterparts for each event, in the same order.
241
- std::vector<std::shared_ptr< node_impl> > getNodesForEvents (
242
+ std::vector<node_impl * > getNodesForEvents (
242
243
const std::vector<std::shared_ptr<sycl::detail::event_impl>> &Events) {
243
- std::vector<std::shared_ptr< node_impl> > NodeList{};
244
+ std::vector<node_impl * > NodeList{};
244
245
NodeList.reserve (Events.size ());
245
246
246
247
ReadLock Lock (MMutex);
@@ -544,8 +545,7 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
544
545
std::owner_less<std::weak_ptr<sycl::detail::queue_impl>>>
545
546
MRecordingQueues;
546
547
// / Map of events to their associated recorded nodes.
547
- std::unordered_map<std::shared_ptr<sycl::detail::event_impl>,
548
- std::shared_ptr<node_impl>>
548
+ std::unordered_map<std::shared_ptr<sycl::detail::event_impl>, node_impl *>
549
549
MEventsMap;
550
550
// / Map for every in-order queue thats recorded a node to the graph, what
551
551
// / the last node added was. We can use this to create new edges on the last
0 commit comments