Browse Source

!27623 Fix ref count for local tensor.

Merge pull request !27623 from gaoyong10/runtime_second14
tags/v1.6.0
i-robot Gitee 4 years ago
parent
commit
069453558e
2 changed files with 4 additions and 1 deletions
  1. +1
    -1
      mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc
  2. +3
    -0
      mindspore/ccsrc/runtime/framework/control_node_parser.cc

+ 1
- 1
mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc View File

@@ -1090,7 +1090,7 @@ void AnfRuntimeAlgorithm::SetWorkspaceAddr(const DeviceAddressPtr &addr, size_t
auto kernel_info = dynamic_cast<device::KernelInfo *>(node->kernel_info());
MS_EXCEPTION_IF_NULL(kernel_info);
if (!kernel_info->SetWorkspaceAddr(addr, output_idx)) {
MS_LOG(EXCEPTION) << "Node " << node->DebugString() << "set adr" << output_idx << " fail。"
MS_LOG(EXCEPTION) << "Node " << node->DebugString() << "set output index:" << output_idx << " fail。"
<< " trace: " << trace::DumpSourceLines(node);
}
}


+ 3
- 0
mindspore/ccsrc/runtime/framework/control_node_parser.cc View File

@@ -15,6 +15,7 @@
*/

#include "runtime/framework/control_node_parser.h"
#include "runtime/framework/actor/actor_common.h"
#include "abstract/utils.h"
#include "ir/tensor.h"

@@ -411,6 +412,7 @@ void CreateDeviceTensorForValueNode(const KernelWithIndex &front_node_with_index
MS_EXCEPTION_IF_NULL(address);
MS_LOG(DEBUG) << "Create addr for node:" << AnfAlgo::GetNodeDebugString(front_node) << " addr:" << address;
AnfAlgo::SetOutputAddr(address, front_node_with_index.second, front_node.get());
UpdateRefCount(address.get(), true);
}

// Create a device tensor for front node.
@@ -437,6 +439,7 @@ void CreateDeviceTensorForFrontNode(const KernelWithIndex &front_node_with_index
MS_EXCEPTION_IF_NULL(address);
MS_LOG(DEBUG) << "Create addr for node:" << AnfAlgo::GetNodeDebugString(node) << " addr:" << address;
AnfAlgo::SetOutputAddr(address, front_node_with_index.second, node.get());
UpdateRefCount(address.get(), true);
}

// Fetch all funcgraph by a seed graph, if a calls b, b calls c, and c calls a, return a set of a, b, c.


Loading…
Cancel
Save