Browse Source

!1396 Cancel NoOp optimizer on gpu backend until memory reuse ready

Merge pull request !1396 from chenweifeng/NoOp
tags/v0.3.0-alpha
mindspore-ci-bot Gitee 5 years ago
parent
commit
2fef359c4d
2 changed files with 4 additions and 4 deletions
  1. +1
    -1
      mindspore/ccsrc/pre_activate/common/helper.cc
  2. +3
    -3
      mindspore/ccsrc/session/gpu_session.cc

+ 1
- 1
mindspore/ccsrc/pre_activate/common/helper.cc View File

@@ -381,7 +381,7 @@ tensor::TensorPtr CreateTupleTensor(const ValueTuplePtr &value_tuple) {
bool IsNopNode(const AnfNodePtr &node) {
auto context_ptr = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(context_ptr);
if (context_ptr->device_target() != kAscendDevice && context_ptr->device_target() != kGPUDevice) {
if (context_ptr->device_target() != kAscendDevice) {
return false;
}
static std::unordered_set<std::string> nop_nodes = {prim::kPrimReshape->name(), kExpandDimsOpName,


+ 3
- 3
mindspore/ccsrc/session/gpu_session.cc View File

@@ -70,7 +70,7 @@ void GPUSession::AllocateMemory(KernelGraph *kernel_graph) const {
MS_EXCEPTION_IF_NULL(kernel_graph);
auto runtime_instance = device::KernelRuntimeManager::Instance().GetSingleKernelRuntime(kGPUDevice, device_id_);
MS_EXCEPTION_IF_NULL(runtime_instance);
opt::RemoveNopNode(kernel_graph);
// opt::RemoveNopNode(kernel_graph);
runtime_instance->AssignMemory(kernel_graph);
}

@@ -79,7 +79,7 @@ void GPUSession::RunOpAllocateMemory(const std::vector<tensor::TensorPtr> &input
MS_EXCEPTION_IF_NULL(kernel_graph);
auto runtime_instance = device::KernelRuntimeManager::Instance().GetSingleKernelRuntime(kGPUDevice, device_id_);
MS_EXCEPTION_IF_NULL(runtime_instance);
opt::RemoveNopNode(kernel_graph);
// opt::RemoveNopNode(kernel_graph);
runtime_instance->RunOpAssignMemory(input_tensors, kernel_graph);
}

@@ -106,7 +106,7 @@ GraphId GPUSession::CompileGraph(const AnfNodePtrList &lst, const AnfNodePtrList
// Assign CUDA streams
AssignStream(graph);
// Remove NoOp from execution graph
opt::HideNopNode(graph.get());
// opt::HideNopNode(graph.get());
// Build kernel if node is cnode
BuildKernel(graph);
// Set graph execution order before memory alloc, ensure that memory alloc is according to the reorder graph


Loading…
Cancel
Save