forked from mindspore-Ecosystem/mindspore
!851 Add debug log for task id and task name
Merge pull request !851 from caifubi/add-task-id-kernel-name-mapping-log
This commit is contained in:
commit
6a7206f44f
|
@ -343,6 +343,22 @@ bool AscendKernelRuntime::LoadTask(const session::KernelGraph *graph) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void AscendKernelRuntime::DebugTaskIdName(GraphId graph_id) {
|
||||
auto task_ids = ge::model_runner::ModelRunner::Instance().GetTaskIdList(graph_id);
|
||||
auto graph_task_names = ProfilingUtils::graph_kernel_name();
|
||||
auto iter = graph_task_names.find(graph_id);
|
||||
if (iter != graph_task_names.end()) {
|
||||
const auto &task_names = iter->second;
|
||||
if (task_ids.size() != task_names.size()) {
|
||||
MS_LOG(WARNING) << "Task_ids and task_names size not match";
|
||||
return;
|
||||
}
|
||||
for (size_t i = 0; i < task_ids.size(); ++i) {
|
||||
MS_LOG(INFO) << "Task_id:" << task_ids[i] << " task_name:" << task_names[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool AscendKernelRuntime::RunTask(const session::KernelGraph *graph) {
|
||||
MS_EXCEPTION_IF_NULL(graph);
|
||||
MS_LOG(INFO) << "RunTask start. GraphId:" << graph->graph_id();
|
||||
|
@ -363,7 +379,8 @@ bool AscendKernelRuntime::RunTask(const session::KernelGraph *graph) {
|
|||
|
||||
bool status = ge::model_runner::ModelRunner::Instance().RunModel(graph->graph_id(), input_tensors, output_tensors);
|
||||
if (!status) {
|
||||
MS_LOG(INFO) << "run task failed";
|
||||
MS_LOG(ERROR) << "run task failed";
|
||||
DebugTaskIdName(graph->graph_id());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -57,6 +57,7 @@ class AscendKernelRuntime : public KernelRuntime {
|
|||
void ReleaseDeviceRes() override;
|
||||
bool GraphWithEmptyTaskList(const session::KernelGraph *graph) const;
|
||||
bool CheckGraphIdValid(GraphId graph_id) const;
|
||||
static void DebugTaskIdName(GraphId graph_id) ;
|
||||
|
||||
rtContext_t rt_context_{nullptr};
|
||||
bool initialized_{false};
|
||||
|
|
|
@ -101,6 +101,8 @@ class ProfilingUtils {
|
|||
NotNull<session::KernelGraph *> graph_ptr,
|
||||
NotNull<std::vector<mindspore::CNodePtr> *> kernel_list);
|
||||
|
||||
static std::unordered_map<uint32_t, std::vector<std::string>> graph_kernel_name() { return graph_kernel_name_; }
|
||||
|
||||
inline static constexpr char kProfiling[] = "Profiling";
|
||||
inline static constexpr char kNotify[] = "notify";
|
||||
inline static constexpr char kProfilerTraceId[] = "profiler_trace_id";
|
||||
|
|
|
@ -147,9 +147,7 @@ bool TaskGenerator::LaunchAllKernel(const std::vector<CNodePtr> &anf_node_list,
|
|||
}
|
||||
current_op_index++;
|
||||
}
|
||||
if (ProfilingManager::GetInstance().IsProfiling()) {
|
||||
ProfilingUtils::SetGraphKernelName(graph_id, kernel_name_list);
|
||||
}
|
||||
ProfilingUtils::SetGraphKernelName(graph_id, kernel_name_list);
|
||||
return true;
|
||||
}
|
||||
} // namespace tasksink
|
||||
|
|
Loading…
Reference in New Issue