@@ -192,21 +192,21 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
192192 // / @param EventImpl Event to associate with a node in map.
193193 // / @param NodeImpl Node to associate with event in map.
194194 void addEventForNode (std::shared_ptr<sycl::detail::event_impl> EventImpl,
195- const std::shared_ptr< node_impl> &NodeImpl) {
195+ node_impl &NodeImpl) {
196196 if (!(EventImpl->hasCommandGraph ()))
197197 EventImpl->setCommandGraph (shared_from_this ());
198- MEventsMap[EventImpl] = NodeImpl;
198+ MEventsMap[EventImpl] = & NodeImpl;
199199 }
200200
201201 // / Find the sycl event associated with a node.
202202 // / @param NodeImpl Node to find event for.
203203 // / @return Event associated with node.
204204 std::shared_ptr<sycl::detail::event_impl>
205- getEventForNode (std::shared_ptr< node_impl> NodeImpl) const {
205+ getEventForNode (node_impl & NodeImpl) const {
206206 ReadLock Lock (MMutex);
207207 if (auto EventImpl = std::find_if (
208208 MEventsMap.begin (), MEventsMap.end (),
209- [NodeImpl](auto &it) { return it.second == NodeImpl; });
209+ [& NodeImpl](auto &it) { return it.second == & NodeImpl; });
210210 EventImpl != MEventsMap.end ()) {
211211 return EventImpl->first ;
212212 }
@@ -220,13 +220,14 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
220220 // / the given event.
221221 // / @param EventImpl Event to find the node for.
222222 // / @return Node associated with the event.
223- std::shared_ptr< node_impl>
223+ node_impl &
224224 getNodeForEvent (std::shared_ptr<sycl::detail::event_impl> EventImpl) {
225225 ReadLock Lock (MMutex);
226226
227227 if (auto NodeFound = MEventsMap.find (EventImpl);
228228 NodeFound != std::end (MEventsMap)) {
229- return NodeFound->second ;
229+ // TODO: Is it guaranteed to be non-null?
230+ return *NodeFound->second ;
230231 }
231232
232233 throw sycl::exception (
@@ -238,9 +239,9 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
238239 // / found for a given event.
239240 // / @param Events Events to find nodes for.
240241 // / @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 (
242243 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{};
244245 NodeList.reserve (Events.size ());
245246
246247 ReadLock Lock (MMutex);
@@ -544,8 +545,7 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
544545 std::owner_less<std::weak_ptr<sycl::detail::queue_impl>>>
545546 MRecordingQueues;
546547 // / 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 *>
549549 MEventsMap;
550550 // / Map for every in-order queue thats recorded a node to the graph, what
551551 // / the last node added was. We can use this to create new edges on the last
0 commit comments