!30286 [MS][RDR] Export running data after graph compiled

Merge pull request !30286 from louie5/master
This commit is contained in:
i-robot 2022-02-21 12:25:19 +00:00 committed by Gitee
commit a068b7da19
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 10 additions and 12 deletions

View File

@ -27,7 +27,6 @@ void RecorderManager::UpdateRdrEnable() {
auto &config_parser = mindspore::EnvConfigParser::GetInstance();
rdr_enable_ = config_parser.RdrEnabled();
rdr_mode_ = config_parser.RdrMode();
rdr_mode_dup_ = rdr_mode_;
if (config_parser.HasRdrSetting()) {
#ifdef __linux__
if (!rdr_enable_) {
@ -107,22 +106,20 @@ void RecorderManager::TriggerAll() {
if (!trigger) {
MS_LOG(WARNING) << "There is no recorder to export.";
} else {
// Prevent duplicate data export by ClearResAtexit() in exceptional scenario.
rdr_mode_ = Exceptional;
MS_LOG(INFO) << "RDR exports all recorders.";
if (rdr_mode_ != Normal) {
MS_LOG(INFO) << "RDR exports all recorders in abnormal end scenario.";
}
}
}
void RecorderManager::Snapshot() {
if (rdr_mode_ != Normal) {
// Restore RDR mode value from early backup.
rdr_mode_ = rdr_mode_dup_;
if (!rdr_enable_ || rdr_mode_ != Normal) {
return;
}
RecorderManager::TriggerAll();
if (rdr_enable_) {
MS_LOG(INFO) << "RDR exports all recorders in normal end scenario.";
}
// Prevent duplicate data export by ClearResAtexit() in exceptional scenario.
ClearAll();
}
void RecorderManager::ClearAll() {

View File

@ -78,7 +78,6 @@ class RecorderManager {
bool rdr_enable_{false};
int rdr_mode_{Exceptional};
int rdr_mode_dup_{Exceptional};
bool rdr_has_record_mem_{false};
mutable std::mutex mtx_;

View File

@ -826,7 +826,9 @@ bool GraphExecutorPy::CompileInner(const py::object &source_obj, const py::tuple
// Save the compiled graph to MsPipeLine.
SaveCompiledGraph(phase);
#ifdef ENABLE_DUMP_IR
(void)mindspore::RDR::Snapshot();
#endif
opt::python_pass::PyPassManager::GetInstance()->ClearPipelineRes();
abstract::AnalysisContext::ClearContext();
// Reclaim all resource used by optimizer.