Browse Source

Move the whole graph nodes firstly for the single used graph when inline

tags/v1.2.0-rc1
yujianfeng 4 years ago
parent
commit
08e00b20a9
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