提交 058bcec3 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!2173 gpu memreuse supports summary node

Merge pull request !2173 from limingqi107/gpu_memreuse_support_summary_node
......@@ -190,6 +190,8 @@ void GPUKernelRuntime::InitKernelRefCount(const session::KernelGraph *graph) {
mem_reuse_util_ptr->SetReuseRefCount();
// Can't free the device address of graph output, so set the reference count of graph output specially.
mem_reuse_util_ptr->SetGraphOutputRefCount();
// Can't free the device address of summary nodes, so set the reference count of summary nodes specially.
mem_reuse_util_ptr->SetSummaryNodesRefCount();
auto graph_id = graph->graph_id();
mem_reuse_util_map_[graph_id] = mem_reuse_util_ptr;
}
......
......@@ -323,6 +323,10 @@ void MemReuseUtil::SetSummaryNodesRefCount() {
MS_LOG(WARNING) << "can't find summary node's kernel_def " << node->fullname_with_scope();
}
}
#ifdef MEM_REUSE_DEBUG
auto graph = *graph_;
MemReuseChecker::GetInstance().CheckMemReuseIR(total_refs_list_, kernel_def_ptr_list_, &graph);
#endif
}
void MemReuseUtil::SetGraphOutputRefCount() {
......
......@@ -162,6 +162,8 @@ GraphId GPUSession::CompileGraph(const AnfNodePtrList &lst, const AnfNodePtrList
auto execution_order = graph->execution_order();
Reorder(&execution_order);
graph->set_execution_order(execution_order);
// Get summary nodes.
GetSummaryNodes(graph.get());
// Remove NoOp from execution graph
opt::RemoveNopNode(graph.get());
// Alloc memory, including static memory and dynamic memory
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册