diff --git a/mindspore/ccsrc/debug/debugger/debugger.cc b/mindspore/ccsrc/debug/debugger/debugger.cc index bfb7fabe755..7bfef96cfda 100644 --- a/mindspore/ccsrc/debug/debugger/debugger.cc +++ b/mindspore/ccsrc/debug/debugger/debugger.cc @@ -476,15 +476,6 @@ void Debugger::PostExecuteGraphDebugger() { DumpJsonParser::GetInstance().UpdateDumpIter(); return; } - for (const auto &graph_ptr : debugger_->GetGraphPtrList()) { - if (device_target_ == kAscendDevice) { - debugger_->SetGraphPtr(graph_ptr); - // load output for Ascend - debugger_->LoadGraphOutputs(); - // load parameters for Ascend - debugger_->LoadParametersAndConst(); - } - } // LoadParametersAndConst for all the graphs that have been run in the current step if (debugger_ && device_target_ == kGPUDevice) { for (auto graph : graph_ptr_step_vec_) { @@ -536,7 +527,7 @@ void Debugger::PostExecute() { if (debug_services_ != nullptr) { debug_services_->ResetLoadedTensors(); } else { - MS_LOG(ERROR) << "debug_services_ is nullptr"; + MS_LOG(DEBUG) << "debug_services_ is nullptr"; } } } diff --git a/mindspore/ccsrc/debug/debugger/debugger_utils.cc b/mindspore/ccsrc/debug/debugger/debugger_utils.cc index 4d751c671d7..f5555a6f5fe 100644 --- a/mindspore/ccsrc/debug/debugger/debugger_utils.cc +++ b/mindspore/ccsrc/debug/debugger/debugger_utils.cc @@ -184,6 +184,25 @@ std::string CheckDatasetSinkMode(const KernelGraphPtr &graph_ptr) { return error_info; } +void LoadDataForDump(const KernelGraphPtr &graph_ptr) { + auto context = MsContext::GetInstance(); + MS_EXCEPTION_IF_NULL(context); + if (context->get_param(MS_CTX_DEVICE_TARGET) != kAscendDevice) { + return; + } +#ifdef ENABLE_DEBUGGER + MS_LOG(INFO) << "Start load step"; + auto debugger = Debugger::GetInstance(); + MS_EXCEPTION_IF_NULL(debugger); + debugger->SetGraphPtr(graph_ptr); + // load output + debugger->LoadGraphOutputs(); + // load parameters + debugger->LoadParametersAndConst(); + +#endif +} + #ifdef ENABLE_D int32_t DumpDataCallBack(const DumpChunk *dump_chunk, int32_t size) { MS_LOG(DEBUG) << "ADX DumpDataCallBack is called"; diff --git a/mindspore/ccsrc/debug/debugger/debugger_utils.h b/mindspore/ccsrc/debug/debugger/debugger_utils.h index 53898ce902d..a53dc1df223 100644 --- a/mindspore/ccsrc/debug/debugger/debugger_utils.h +++ b/mindspore/ccsrc/debug/debugger/debugger_utils.h @@ -42,6 +42,8 @@ void ReadDataAndDump(const CNodePtr &cnode, const KernelLaunchInfo *launch_info_ std::string CheckDatasetSinkMode(const KernelGraphPtr &graph_ptr); +void LoadDataForDump(const KernelGraphPtr &graph_ptr); + #ifdef ENABLE_D // Callback function to dump ascend async mode int32_t DumpDataCallBack(const DumpChunk *dump_chunk, int32_t size); diff --git a/mindspore/ccsrc/runtime/framework/actor/debug_actor.cc b/mindspore/ccsrc/runtime/framework/actor/debug_actor.cc index 8a4bf46a4cc..2c9bf74634c 100644 --- a/mindspore/ccsrc/runtime/framework/actor/debug_actor.cc +++ b/mindspore/ccsrc/runtime/framework/actor/debug_actor.cc @@ -81,7 +81,9 @@ void DebugActor::DebugForGraph(const KernelGraphPtr &graph, const DeviceContext MS_EXCEPTION_IF_NULL(device_context); MS_EXCEPTION_IF_NULL(op_context); MS_EXCEPTION_IF_NULL(from_aid); - +#ifdef ENABLE_DEBUGGER + LoadDataForDump(graph); +#endif // Call back to the from actor to process after debug finished. ActorDispatcher::Send(*from_aid, &DebugAwareActor::OnDebugFinish, op_context); }