Browse Source

!851 Add debug log for task id and task name

Merge pull request !851 from caifubi/add-task-id-kernel-name-mapping-log
tags/v0.3.0-alpha
mindspore-ci-bot Gitee 5 years ago
parent
commit
6a7206f44f
4 changed files with 22 additions and 4 deletions
  1. +18
    -1
      mindspore/ccsrc/device/ascend/ascend_kernel_runtime.cc
  2. +1
    -0
      mindspore/ccsrc/device/ascend/ascend_kernel_runtime.h
  3. +2
    -0
      mindspore/ccsrc/device/ascend/profiling/profiling_utils.h
  4. +1
    -3
      mindspore/ccsrc/device/ascend/tasksink/task_generator.cc

+ 18
- 1
mindspore/ccsrc/device/ascend/ascend_kernel_runtime.cc View File

@@ -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;


+ 1
- 0
mindspore/ccsrc/device/ascend/ascend_kernel_runtime.h View File

@@ -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};


+ 2
- 0
mindspore/ccsrc/device/ascend/profiling/profiling_utils.h View File

@@ -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";


+ 1
- 3
mindspore/ccsrc/device/ascend/tasksink/task_generator.cc View File

@@ -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…
Cancel
Save