Browse Source

!2173 gpu memreuse supports summary node

Merge pull request !2173 from limingqi107/gpu_memreuse_support_summary_node
tags/v0.5.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
058bcec347
3 changed files with 8 additions and 0 deletions
  1. +2
    -0
      mindspore/ccsrc/device/gpu/gpu_kernel_runtime.cc
  2. +4
    -0
      mindspore/ccsrc/pre_activate/mem_reuse/mem_reuse.cc
  3. +2
    -0
      mindspore/ccsrc/session/gpu_session.cc

+ 2
- 0
mindspore/ccsrc/device/gpu/gpu_kernel_runtime.cc View File

@@ -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;
}


+ 4
- 0
mindspore/ccsrc/pre_activate/mem_reuse/mem_reuse.cc View File

@@ -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() {


+ 2
- 0
mindspore/ccsrc/session/gpu_session.cc View File

@@ -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


Loading…
Cancel
Save