Browse Source

Fix profiling stream id bug

tags/v0.5.0-beta
caifubi 5 years ago
parent
commit
a49c6f0b13
7 changed files with 27 additions and 6 deletions
  1. +1
    -1
      graphengine
  2. +2
    -1
      mindspore/ccsrc/device/ascend/ascend_kernel_runtime.cc
  3. +2
    -1
      mindspore/ccsrc/device/ascend/profiling/profiling_utils.cc
  4. +2
    -1
      mindspore/ccsrc/device/ascend/profiling/profiling_utils.h
  5. +12
    -2
      mindspore/ccsrc/device/ascend/profiling/reporter/task_desc_reporter.cc
  6. +3
    -0
      mindspore/ccsrc/device/ascend/profiling/reporter/task_desc_reporter.h
  7. +5
    -0
      tests/ut/cpp/stub/ge/ge_task_launch_stub.cc

+ 1
- 1
graphengine

@@ -1 +1 @@
Subproject commit 45ca7863ac6410c8e2f83168481ddc6b43bcea33
Subproject commit c54db4343f83cb0c15cc3b5c9755926de27fa3af

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

@@ -367,7 +367,8 @@ bool AscendKernelRuntime::LoadTask(const session::KernelGraph *graph) {
}
if (ProfilingManager::GetInstance().IsProfiling()) {
auto task_ids = ge::model_runner::ModelRunner::Instance().GetTaskIdList(model_iter->first);
ProfilingUtils::ReportProfilingData(task_ids, NOT_NULL(graph));
auto stream_ids = ge::model_runner::ModelRunner::Instance().GetStreamIdList(model_iter->first);
ProfilingUtils::ReportProfilingData(task_ids, stream_ids, NOT_NULL(graph));
}
return true;
}


+ 2
- 1
mindspore/ccsrc/device/ascend/profiling/profiling_utils.cc View File

@@ -302,7 +302,7 @@ bool ProfilingUtils::ValidComputeGraph(NotNull<const session::KernelGraph *> gra
return false;
}

void ProfilingUtils::ReportProfilingData(const std::vector<uint32_t> &task_ids,
void ProfilingUtils::ReportProfilingData(const std::vector<uint32_t> &task_ids, const std::vector<uint32_t> &stream_ids,
NotNull<const session::KernelGraph *> graph) {
if (!ValidComputeGraph(graph)) {
MS_LOG(WARNING) << "Not a valid compute graph:" << graph->graph_id();
@@ -319,6 +319,7 @@ void ProfilingUtils::ReportProfilingData(const std::vector<uint32_t> &task_ids,
MS_EXCEPTION_IF_NULL(context);
TaskDescReporter task_reporter(context->device_id(), "vm.task_desc_info", ret->second);
task_reporter.set_task_ids(task_ids);
task_reporter.set_stream_ids(stream_ids);
task_reporter.ReportData();

GraphDescReporter graph_reporter(context->device_id(), "vm.graph_desc_info", ret->second);


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

@@ -87,7 +87,8 @@ class ProfilingUtils {
// Mapping task_id and kernel name for device to generate the time cost of specific kernel.
// Device calculate the time cost of the task which is marked by task id.
// But we need data of (kernel name , time cost)
static void ReportProfilingData(const std::vector<uint32_t> &task_ids, NotNull<const session::KernelGraph *> graph);
static void ReportProfilingData(const std::vector<uint32_t> &task_ids, const std::vector<uint32_t> &stream_ids,
NotNull<const session::KernelGraph *> graph);

// Get profiling trace point from envs.
// export PROFILING_FP_START='full name of the first cnode to execute'


+ 12
- 2
mindspore/ccsrc/device/ascend/profiling/reporter/task_desc_reporter.cc View File

@@ -40,12 +40,22 @@ void TaskDescReporter::ReportData() {
auto ascend_kernel_mod = dynamic_cast<kernel::AscendKernelMod *>(kernel_mod);
MS_EXCEPTION_IF_NULL(node);
MS_EXCEPTION_IF_NULL(ascend_kernel_mod);
auto desc_ptr = std::make_shared<TaskDesc>(node->fullname_with_scope(), task_ids_[task_index++],
ascend_kernel_mod->block_dim(), ascend_kernel_mod->stream_id());
// Check task_id and stream_id valid
CheckStreamTaskValid(task_index, task_index);
auto desc_ptr = std::make_shared<TaskDesc>(node->fullname_with_scope(), task_ids_[task_index],
ascend_kernel_mod->block_dim(), stream_ids_[task_index]);
prof_desc_.emplace_back(desc_ptr);
++task_index;
}
DescReporter::ReportData();
}

void TaskDescReporter::CheckStreamTaskValid(uint32_t task_id, uint32_t stream_id) {
if (task_id >= task_ids_.size() || stream_id >= stream_ids_.size()) {
MS_LOG(EXCEPTION) << "Index invalid. task_id:" << task_id << ", task_ids.size:" << task_ids_.size()
<< ", stream_id:" << stream_id << ", stream_ids.size:" << stream_ids_.size();
}
}
} // namespace ascend
} // namespace device
} // namespace mindspore

+ 3
- 0
mindspore/ccsrc/device/ascend/profiling/reporter/task_desc_reporter.h View File

@@ -32,9 +32,12 @@ class TaskDescReporter : public DescReporter {
~TaskDescReporter() override = default;
void ReportData() override;
void set_task_ids(const std::vector<uint32_t> &task_ids) { task_ids_ = task_ids; }
void set_stream_ids(const std::vector<uint32_t> &stream_ids) { stream_ids_ = stream_ids; }

private:
std::vector<uint32_t> task_ids_;
std::vector<uint32_t> stream_ids_;
void CheckStreamTaskValid(uint32_t task_id, uint32_t stream_id);
};
} // namespace ascend
} // namespace device


+ 5
- 0
tests/ut/cpp/stub/ge/ge_task_launch_stub.cc View File

@@ -40,6 +40,11 @@ const std::vector<uint32_t> &ModelRunner::GetTaskIdList(uint32_t model_id) const
static std::vector<uint32_t> task_id_list;
return task_id_list;
}

const std::vector<uint32_t> &ModelRunner::GetStreamIdList(uint32_t model_id) const {
static std::vector<uint32_t> stream_id_list;
return stream_id_list;
}
} // namespace model_runner
} // namespace ge



Loading…
Cancel
Save