提交 953f91ce 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!3739 not eliminate memcpy when nexe node is graph output

Merge pull request !3739 from laiyongqiang/eliminate_memcpy_bug
......@@ -56,12 +56,19 @@ const AnfNodePtr GetnextMemcpyElimination::Process(const FuncGraphPtr &graph, co
return nullptr;
}
// 3. next_node is not nop node and it has only one input which is memcpy's output
// 3. next_node is not nop node, not graph output and it has only one input which is memcpy's output
for (auto &item : next_nodes) {
auto next_node = item.first->cast<CNodePtr>();
if (opt::IsNopNode(next_node)) {
return nullptr;
}
auto graph_outputs = AnfAlgo::GetAllOutput(graph->output(), {prim::kPrimTupleGetItem});
auto iter = std::find(graph_outputs.begin(), graph_outputs.end(), next_node);
if (iter != graph_outputs.end()) {
return nullptr;
}
if (next_node->inputs().size() != 2) {
MS_LOG(DEBUG) << "next node has more than one input";
return nullptr;
......
......@@ -44,12 +44,14 @@ def test_getnext_memcpy_elimination(tag):
res = get_next()
res = memcpy_async_attr(res)
res = cast(res)
res = add(res)
return res
@fns
def after():
res = get_next()
res = cast(res)
res = add(res)
return res
return fns[tag]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册