@@ -19,10 +19,8 @@ namespace oneapi {
19
19
namespace experimental {
20
20
namespace detail {
21
21
22
- void *
23
- graph_mem_pool::malloc (size_t Size, usm::alloc AllocType,
24
- const std::vector<std::shared_ptr<node_impl>> &DepNodes,
25
- memory_pool_impl *MemPool) {
22
+ void *graph_mem_pool::malloc (size_t Size, usm::alloc AllocType,
23
+ nodes_range DepNodes, memory_pool_impl *MemPool) {
26
24
// We are potentially modifying contents of this memory pool and the owning
27
25
// graph, so take a lock here.
28
26
graph_impl::WriteLock Lock (MGraph.MMutex );
@@ -81,9 +79,9 @@ graph_mem_pool::malloc(size_t Size, usm::alloc AllocType,
81
79
}
82
80
83
81
std::optional<graph_mem_pool::alloc_info>
84
- graph_mem_pool::tryReuseExistingAllocation (
85
- size_t Size, usm::alloc AllocType, bool ReadOnly,
86
- const std::vector<std::shared_ptr<node_impl>> & DepNodes) {
82
+ graph_mem_pool::tryReuseExistingAllocation (size_t Size, usm::alloc AllocType,
83
+ bool ReadOnly,
84
+ nodes_range DepNodes) {
87
85
// If we have no dependencies this is a no-op because allocations must connect
88
86
// to a free node for reuse to be possible.
89
87
if (DepNodes.empty ()) {
@@ -119,8 +117,8 @@ graph_mem_pool::tryReuseExistingAllocation(
119
117
std::queue<node_impl *> NodesToCheck;
120
118
121
119
// Add all the dependent nodes to the queue, they will be popped first
122
- for (auto &Dep : DepNodes) {
123
- NodesToCheck.push (&* Dep);
120
+ for (node_impl &Dep : DepNodes) {
121
+ NodesToCheck.push (&Dep);
124
122
}
125
123
126
124
// Called when traversing over nodes to check if the current node is a free
@@ -175,10 +173,9 @@ graph_mem_pool::tryReuseExistingAllocation(
175
173
return std::nullopt ;
176
174
}
177
175
178
- void graph_mem_pool::markAllocationAsAvailable (
179
- void *Ptr, const std::shared_ptr<node_impl> &FreeNode) {
176
+ void graph_mem_pool::markAllocationAsAvailable (void *Ptr, node_impl &FreeNode) {
180
177
MFreeAllocations.push_back (Ptr);
181
- MAllocations.at (Ptr).LastFreeNode = FreeNode. get () ;
178
+ MAllocations.at (Ptr).LastFreeNode = & FreeNode;
182
179
}
183
180
184
181
} // namespace detail
0 commit comments