!12893 [MS][RDR] Add FuncGraph Clone Switch

From: @louie5
Reviewed-by: @zh_qh,@ouwenchang
Signed-off-by:
pull/12893/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit a744a5ea9e

@ -64,6 +64,7 @@
#endif #endif
#ifdef ENABLE_DUMP_IR #ifdef ENABLE_DUMP_IR
#include "debug/rdr/running_data_recorder.h" #include "debug/rdr/running_data_recorder.h"
#include "debug/rdr/recorder_manager.h"
#endif #endif
namespace mindspore { namespace mindspore {
@ -723,19 +724,21 @@ void Pipeline::Run() {
MS_LOG(EXCEPTION) << "Pipeline running to end, failed in step:" << action.first; MS_LOG(EXCEPTION) << "Pipeline running to end, failed in step:" << action.first;
} }
#ifdef ENABLE_DUMP_IR #ifdef ENABLE_DUMP_IR
MS_LOG(INFO) << "Clone func_graph."; if (mindspore::RecorderManager::Instance().RdrEnable()) {
std::string tag = GetBaseNameForIR(i, action.first); MS_LOG(INFO) << "Recording FuncGraph in pipeline using RDR.";
if (resource_->func_graph() != nullptr) { std::string tag = GetBaseNameForIR(i, action.first);
auto graph_clone = BasicClone(resource_->func_graph()); if (resource_->func_graph() != nullptr) {
if (graph_clone != nullptr) { auto graph_clone = BasicClone(resource_->func_graph());
mindspore::RDR::RecordAnfGraph(SUBMODULE_ID, tag, graph_clone, false, ".ir"); if (graph_clone != nullptr) {
mindspore::RDR::RecordAnfGraph(SUBMODULE_ID, tag, graph_clone, false, ".ir");
} else {
MS_LOG(WARNING) << "Clone FuncGraph failed in pipeline, no FuncGraph recording in RDR.";
}
} else { } else {
MS_LOG(WARNING) << "Clone func_graph failed in pipeline, no func_graph recording in RDR."; MS_LOG(WARNING) << "Pipeline Resource has no FuncGraph, no FuncGraph recording in RDR";
} }
} else { MS_LOG(INFO) << "Recording FuncGraph in pipeline end.";
MS_LOG(WARNING) << "Resource's func_graph is empty in pipeline, no func_graph recording in RDR";
} }
MS_LOG(INFO) << "Clone func_graph end.";
#endif #endif
if (MsContext::GetInstance()->get_param<bool>(MS_CTX_SAVE_GRAPHS_FLAG) && resource_->func_graph() != nullptr) { if (MsContext::GetInstance()->get_param<bool>(MS_CTX_SAVE_GRAPHS_FLAG) && resource_->func_graph() != nullptr) {
auto graph = resource_->func_graph(); auto graph = resource_->func_graph();

Loading…
Cancel
Save