!8601 independent node use the somas's memory

From: @laiyongqiang
Reviewed-by: @kisnwang,@jjfeing
Signed-off-by: @jjfeing
pull/8601/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 07633f2a2a

@ -301,7 +301,7 @@ void Somas::IndependentNodeOutputProcess(const session::KernelGraph *graph) {
auto semi_reuse_output_tensors = iter->second->output_tensors_; auto semi_reuse_output_tensors = iter->second->output_tensors_;
for (auto &tensor : semi_reuse_output_tensors) { for (auto &tensor : semi_reuse_output_tensors) {
total_size += tensor->GetAlignedSize(); total_size += tensor->GetAlignedSize();
tensor->aligned_size_ = 0; tensor->lifelong_value_ = kLifeLongGraphAll;
} }
} }
} }

@ -543,7 +543,7 @@ void KernelRuntime::AssignNodeOutputMem(MemType type, const AnfNodePtr &node, in
if (node->isa<CNode>()) { if (node->isa<CNode>()) {
bool independent = AnfAlgo::IsIndependentNode(node->cast<CNodePtr>()); bool independent = AnfAlgo::IsIndependentNode(node->cast<CNodePtr>());
if (independent && (type == kReuseDynamicMem || type == kSomasReuseDynamicMem)) { if (independent && (type == kReuseDynamicMem)) {
MS_LOG(INFO) << "Independent node " << node->fullname_with_scope() << " disable memory reuse"; MS_LOG(INFO) << "Independent node " << node->fullname_with_scope() << " disable memory reuse";
type = kDynamicMem; type = kDynamicMem;
} }

Loading…
Cancel
Save