From: @louie5 Reviewed-by: @ouwenchang Signed-off-by:tags/v1.2.0-rc1
| @@ -34,7 +34,9 @@ | |||||
| #include "backend/optimizer/common/helper.h" | #include "backend/optimizer/common/helper.h" | ||||
| #include "utils/ms_context.h" | #include "utils/ms_context.h" | ||||
| #include "debug/common.h" | #include "debug/common.h" | ||||
| #ifdef ENABLE_DUMP_IR | |||||
| #include "debug/rdr/running_data_recorder.h" | #include "debug/rdr/running_data_recorder.h" | ||||
| #endif | |||||
| #include "common/thread_pool.h" | #include "common/thread_pool.h" | ||||
| #include "profiler/device/common/memory_profiling.h" | #include "profiler/device/common/memory_profiling.h" | ||||
| @@ -6,13 +6,18 @@ set(_DEBUG_SRC_LIST | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/trace.cc" | "${CMAKE_CURRENT_SOURCE_DIR}/trace.cc" | ||||
| "${CMAKE_CURRENT_SOURCE_DIR}/common.cc" | "${CMAKE_CURRENT_SOURCE_DIR}/common.cc" | ||||
| "${CMAKE_CURRENT_SOURCE_DIR}/env_config_parser.cc" | "${CMAKE_CURRENT_SOURCE_DIR}/env_config_parser.cc" | ||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/graph_exec_order_recorder.cc" | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/graph_recorder.cc" | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/string_recorder.cc" | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/recorder_manager.cc" | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/running_data_recorder.cc" | |||||
| ) | ) | ||||
| if(ENABLE_DUMP_IR) | |||||
| list(APPEND _DEBUG_SRC_LIST | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/graph_exec_order_recorder.cc" | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/graph_recorder.cc" | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/string_recorder.cc" | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/recorder_manager.cc" | |||||
| "${CMAKE_CURRENT_SOURCE_DIR}/rdr/running_data_recorder.cc" | |||||
| ) | |||||
| endif() | |||||
| if(ENABLE_DEBUGGER) | if(ENABLE_DEBUGGER) | ||||
| list(APPEND _DEBUG_SRC_LIST | list(APPEND _DEBUG_SRC_LIST | ||||
| "${CMAKE_CURRENT_SOURCE_DIR}/debugger/debugger.cc" | "${CMAKE_CURRENT_SOURCE_DIR}/debugger/debugger.cc" | ||||
| @@ -78,8 +78,17 @@ void DumpIRProto(const FuncGraphPtr &, const std::string &) { | |||||
| void GraphRecorder::Export() { | void GraphRecorder::Export() { | ||||
| bool save_flag = false; | bool save_flag = false; | ||||
| if (filename_.empty()) { | if (filename_.empty()) { | ||||
| filename_ = directory_ + module_ + "_" + tag_ + "_" + timestamp_; | |||||
| filename_ = module_ + "_" + tag_ + "_" + timestamp_; | |||||
| } | } | ||||
| if (filename_.length() > 255) { // 255: filename maximum length | |||||
| filename_ = filename_.substr(0, 255); | |||||
| } | |||||
| filename_ = directory_ + filename_; | |||||
| if (filename_.size() + 3 > PATH_MAX) { // 3: file format length | |||||
| MS_LOG(ERROR) << "File path " << filename_ << " is too long."; | |||||
| return; | |||||
| } | |||||
| if (graph_type_.find(".dat") != std::string::npos) { | if (graph_type_.find(".dat") != std::string::npos) { | ||||
| save_flag = true; | save_flag = true; | ||||
| AnfExporter exporter(std::to_string(id_)); | AnfExporter exporter(std::to_string(id_)); | ||||
| @@ -17,7 +17,9 @@ | |||||
| #include "runtime/device/memory_manager.h" | #include "runtime/device/memory_manager.h" | ||||
| #include <string> | #include <string> | ||||
| #include "backend/session/anf_runtime_algorithm.h" | #include "backend/session/anf_runtime_algorithm.h" | ||||
| #ifdef ENABLE_DUMP_IR | |||||
| #include "debug/rdr/running_data_recorder.h" | #include "debug/rdr/running_data_recorder.h" | ||||
| #endif | |||||
| #include "utils/ms_context.h" | #include "utils/ms_context.h" | ||||
| using mindspore::memreuse::BestFitMemReuse; | using mindspore::memreuse::BestFitMemReuse; | ||||