diff --git a/mindspore/ccsrc/pipeline/jit/pipeline.cc b/mindspore/ccsrc/pipeline/jit/pipeline.cc index 2b57e59421..874314feaa 100644 --- a/mindspore/ccsrc/pipeline/jit/pipeline.cc +++ b/mindspore/ccsrc/pipeline/jit/pipeline.cc @@ -64,6 +64,7 @@ #endif #ifdef ENABLE_DUMP_IR #include "debug/rdr/running_data_recorder.h" +#include "debug/rdr/recorder_manager.h" #endif namespace mindspore { @@ -723,19 +724,21 @@ void Pipeline::Run() { MS_LOG(EXCEPTION) << "Pipeline running to end, failed in step:" << action.first; } #ifdef ENABLE_DUMP_IR - MS_LOG(INFO) << "Clone func_graph."; - std::string tag = GetBaseNameForIR(i, action.first); - if (resource_->func_graph() != nullptr) { - auto graph_clone = BasicClone(resource_->func_graph()); - if (graph_clone != nullptr) { - mindspore::RDR::RecordAnfGraph(SUBMODULE_ID, tag, graph_clone, false, ".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_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 { - 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(WARNING) << "Resource's func_graph is empty in pipeline, no func_graph recording in RDR"; + MS_LOG(INFO) << "Recording FuncGraph in pipeline end."; } - MS_LOG(INFO) << "Clone func_graph end."; #endif if (MsContext::GetInstance()->get_param(MS_CTX_SAVE_GRAPHS_FLAG) && resource_->func_graph() != nullptr) { auto graph = resource_->func_graph();