!12736 stop pipeline when the step graph is return const or parameter

From: @zhangbuxue
Reviewed-by: 
Signed-off-by:
pull/12736/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 790960f031

@ -452,7 +452,21 @@ static bool IsCtrlSink() {
return true;
}
bool CheckGraphOutputConstOrParameter(const FuncGraphPtr &func_graph) {
if (func_graph != nullptr) {
AnfNodePtr output = func_graph->output();
if (output != nullptr && (output->isa<ValueNode>() || output->isa<Parameter>())) {
return true;
}
}
return false;
}
bool TaskEmitAction(const ResourcePtr &res) {
if (MsContext::GetInstance()->get_param<int>(MS_CTX_EXECUTION_MODE) == kGraphMode &&
CheckGraphOutputConstOrParameter(res->func_graph())) {
return true;
}
if (res->func_graph() == nullptr) {
MS_LOG(EXCEPTION) << "TaskEmit args error";
}
@ -487,6 +501,10 @@ bool TaskEmitAction(const ResourcePtr &res) {
}
bool ExecuteAction(const ResourcePtr &res) {
if (MsContext::GetInstance()->get_param<int>(MS_CTX_EXECUTION_MODE) == kGraphMode &&
CheckGraphOutputConstOrParameter(res->func_graph())) {
return true;
}
if (res->results().count(kOutput) == 0) {
MS_LOG(EXCEPTION) << "Execute args error";
}

@ -724,12 +724,14 @@ void Pipeline::Run() {
if (!result) {
MS_LOG(EXCEPTION) << "Pipeline running to end, failed in step:" << action.first;
}
FuncGraphPtr graph = resource_->func_graph();
#ifdef ENABLE_DUMP_IR
if (mindspore::RecorderManager::Instance().RdrEnable()) {
MS_LOG(INFO) << "Recording FuncGraph in pipeline using RDR.";
std::string tag = GetBaseNameForIR(i, action.first);
if (resource_->func_graph() != nullptr) {
auto graph_clone = BasicClone(resource_->func_graph());
if (graph != nullptr) {
auto graph_clone = BasicClone(graph);
if (graph_clone != nullptr) {
mindspore::RDR::RecordAnfGraph(SUBMODULE_ID, tag, graph_clone, false, ".ir");
} else {
@ -741,23 +743,21 @@ void Pipeline::Run() {
MS_LOG(INFO) << "Recording FuncGraph in pipeline end.";
}
#endif
if (MsContext::GetInstance()->get_param<bool>(MS_CTX_SAVE_GRAPHS_FLAG) && resource_->func_graph() != nullptr) {
auto graph = resource_->func_graph();
if (graph != nullptr) {
user_graph = graph;
std::string base_name = GetBaseNameForIR(i, action.first);
// generate IR file in dot format, which can be converted to svg file using graphviz dot command
draw::Draw(base_name + ".dot", graph);
// generate IR file in human readable format
if (i == actions_.size() - 1) {
DumpIR(base_name + ".ir", graph, false, kWholeStack);
} else {
DumpIR(base_name + ".ir", graph, false, kTopStack);
}
// generate IR file in a heavily commented format, which can also be reloaded
ExportIR(base_name + ".dat", std::to_string(i), graph);
if (MsContext::GetInstance()->get_param<bool>(MS_CTX_SAVE_GRAPHS_FLAG) && graph != nullptr) {
user_graph = graph;
std::string base_name = GetBaseNameForIR(i, action.first);
// generate IR file in dot format, which can be converted to svg file using graphviz dot command
draw::Draw(base_name + ".dot", graph);
// generate IR file in human readable format
if (i == actions_.size() - 1) {
DumpIR(base_name + ".ir", graph, false, kWholeStack);
} else {
DumpIR(base_name + ".ir", graph, false, kTopStack);
}
// generate IR file in a heavily commented format, which can also be reloaded
ExportIR(base_name + ".dat", std::to_string(i), graph);
}
i++;
#ifdef ENABLE_TIMELINE

Loading…
Cancel
Save