提交 352d2462 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!3995 handle the bug which can't print in control flow

Merge pull request !3995 from Margaret_wangrui/handle_exec_order
......@@ -198,7 +198,7 @@ void KernelGraph::VisitNodeDescendants(const AnfNodePtr &node, std::queue<AnfNod
}
void KernelGraph::SetExecOrderByDefault() {
std::queue<AnfNodePtr> seed_nodes;
std::stack<AnfNodePtr> seed_nodes;
UpdateNodeEdgeList(&seed_nodes);
execution_order_.clear();
std::unordered_set<AnfNodePtr> visited_nodes;
......@@ -211,7 +211,7 @@ void KernelGraph::SetExecOrderByDefault() {
VisitNodeDescendants(last_communication_node, &communication_descendants, &visited_nodes);
last_communication_node = nullptr;
} else {
zero_input_nodes.push(seed_nodes.front());
zero_input_nodes.push(seed_nodes.top());
seed_nodes.pop();
}
// all reduce node descendant first, then common queue
......@@ -785,7 +785,7 @@ bool KernelGraph::HandleControlDependNode(const AnfNodePtr &node, std::queue<Anf
return true;
}
void KernelGraph::UpdateNodeEdgeList(std::queue<AnfNodePtr> *seed_nodes) {
void KernelGraph::UpdateNodeEdgeList(std::stack<AnfNodePtr> *seed_nodes) {
MS_EXCEPTION_IF_NULL(seed_nodes);
node_output_edges_.clear();
node_input_num_.clear();
......@@ -868,7 +868,7 @@ void KernelGraph::ReplaceGraphInput(const AnfNodePtr &old_parameter, const AnfNo
void KernelGraph::ReplaceNode(NotNull<AnfNodePtr> old_anf_node, NotNull<AnfNodePtr> new_anf_node) {
MS_EXCEPTION_IF_NULL(inputs_);
{
std::queue<AnfNodePtr> seed_nodes;
std::stack<AnfNodePtr> seed_nodes;
UpdateNodeEdgeList(&seed_nodes);
}
auto it = node_output_edges_.find(old_anf_node);
......@@ -894,7 +894,7 @@ void KernelGraph::ReplaceNode(NotNull<AnfNodePtr> old_anf_node, NotNull<AnfNodeP
FrontBackendlMapUpdate(old_anf_node, new_anf_node);
}
{
std::queue<AnfNodePtr> seed_nodes;
std::stack<AnfNodePtr> seed_nodes;
UpdateNodeEdgeList(&seed_nodes);
}
}
......
......@@ -17,6 +17,7 @@
#define MINDSPORE_CCSRC_BACKEND_SESSION_KERNEL_GRAPH_H
#include <vector>
#include <stack>
#include <unordered_map>
#include <memory>
#include <utility>
......@@ -170,7 +171,7 @@ class KernelGraph : public FuncGraph {
void VisitNodeDescendants(const AnfNodePtr &node, std::queue<AnfNodePtr> *visit_queue,
std::unordered_set<AnfNodePtr> *visited_nodes);
// update node edge list
void UpdateNodeEdgeList(std::queue<AnfNodePtr> *seed_nodes);
void UpdateNodeEdgeList(std::stack<AnfNodePtr> *seed_nodes);
// add node depend edge by data edge or control depend
void AddDependEdge(const AnfNodePtr &node, const AnfNodePtr &input, size_t depend_edge_num);
// handle control depend
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册