Browse Source

!11331 Move the whole graph nodes firstly for the single used graph when doing inline

From: @ginfung
Reviewed-by: @zh_qh,@wang_zi_dong
Signed-off-by: @zh_qh
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 4 years ago
parent
commit
2aba240992
1 changed files with 9 additions and 9 deletions
  1. +9
    -9
      mindspore/ccsrc/frontend/optimizer/irpass/inline.h

+ 9
- 9
mindspore/ccsrc/frontend/optimizer/irpass/inline.h View File

@@ -141,15 +141,6 @@ class InlinerBase : public AnfVisitor {
} }


if (IsUniqueUse(nullptr, fg, nullptr)) { if (IsUniqueUse(nullptr, fg, nullptr)) {
// The other branch calling the last after block.
if (fg->has_flag(FUNC_GRAPH_FLAG_AFTER_BLOCK)) {
// Check if parameters' changed.
auto param_simplified_caller = SimplifyAfterParameter(fg, node, args);
if (param_simplified_caller != nullptr) {
return param_simplified_caller;
}
}

// For the single used fg, including non-after and after not matched above, // For the single used fg, including non-after and after not matched above,
// we move the whole fg nodes. // we move the whole fg nodes.
if (use_move_) { if (use_move_) {
@@ -160,6 +151,15 @@ class InlinerBase : public AnfVisitor {
mng->MoveAllCNodeDropGraph(fg, node->func_graph(), inputs[0]->scope()); mng->MoveAllCNodeDropGraph(fg, node->func_graph(), inputs[0]->scope());
return out_node; return out_node;
} }

// The other branch calling the last after block.
if (fg->has_flag(FUNC_GRAPH_FLAG_AFTER_BLOCK)) {
// Check if parameters' changed.
auto param_simplified_caller = SimplifyAfterParameter(fg, node, args);
if (param_simplified_caller != nullptr) {
return param_simplified_caller;
}
}
} else { } else {
// We don't expand the middle multiple used after block, except the last one. // We don't expand the middle multiple used after block, except the last one.
if (GraphHasBranch(fg)) { if (GraphHasBranch(fg)) {


Loading…
Cancel
Save