Browse Source

Update DumpGraphs method with RDR, recording graph and execute order.

tags/v1.6.0
louie5 4 years ago
parent
commit
9e629e53c5
5 changed files with 4 additions and 31 deletions
  1. +0
    -3
      mindspore/ccsrc/backend/optimizer/ascend/ascend_backend_optimization.cc
  2. +0
    -11
      mindspore/ccsrc/backend/session/cpu_session.cc
  3. +0
    -8
      mindspore/ccsrc/backend/session/gpu_session.cc
  4. +4
    -0
      mindspore/ccsrc/backend/session/session_basic.cc
  5. +0
    -9
      mindspore/ccsrc/runtime/framework/graph_compiler.cc

+ 0
- 3
mindspore/ccsrc/backend/optimizer/ascend/ascend_backend_optimization.cc View File

@@ -474,9 +474,6 @@ void AscendBackendOptimization(const std::shared_ptr<session::KernelGraph> &kern
(void)optimizer2->Optimize(kernel_graph);
kernel_graph->SetExecOrderByDefault();
#ifdef ENABLE_DUMP_IR
const std::vector<CNodePtr> &exec_order = kernel_graph->execution_order();
std::string exec_order_name = "graph_exec_order." + std::to_string(kernel_graph->graph_id());
(void)mindspore::RDR::RecordGraphExecOrder(SubModuleId::SM_OPTIMIZER, exec_order_name, exec_order);
if (save_graphs) {
std::string file_name = "hwopt_d_end_graph_" + std::to_string(kernel_graph->graph_id()) + ".ir";
DumpIR(file_name, kernel_graph, true, kWholeStack);


+ 0
- 11
mindspore/ccsrc/backend/session/cpu_session.cc View File

@@ -133,17 +133,6 @@ GraphId CPUSession::CompileGraphImpl(const AnfNodePtrList &lst, const AnfNodePtr
auto execution_order = graph->execution_order();
Reorder(&execution_order);
graph->set_execution_order(execution_order);

#ifdef ENABLE_DUMP_IR
std::string name = "graph_build." + std::to_string(graph->graph_id());
DumpGraphParams dump_params = {true, static_cast<int>(kWholeStack)};
(void)mindspore::RDR::RecordAnfGraph(SubModuleId::SM_SESSION, name, graph, dump_params, ".ir");

const std::vector<CNodePtr> &exec_order = graph->execution_order();
std::string exec_order_name = "graph_exec_order." + std::to_string(graph->graph_id());
(void)mindspore::RDR::RecordGraphExecOrder(SubModuleId::SM_SESSION, exec_order_name, exec_order);
#endif

// runtime init
if (!runtime_.Init()) {
MS_LOG(EXCEPTION) << "Kernel runtime init error.";


+ 0
- 8
mindspore/ccsrc/backend/session/gpu_session.cc View File

@@ -461,14 +461,6 @@ GraphId GPUSession::CompileGraphImpl(const KernelGraphPtr &graph) {
}
// Build kernel if node is cnode
BuildKernel(graph);
#ifdef ENABLE_DUMP_IR
std::string name = "graph_build";
DumpGraphParams dump_params = {true, static_cast<int>(kWholeStack)};
(void)mindspore::RDR::RecordAnfGraph(SubModuleId::SM_SESSION, name, graph, dump_params, ".ir,.pb");
auto &kernels = graph->execution_order();
std::string exec_order_name = "graph_exec_order." + std::to_string(graph->graph_id());
(void)mindspore::RDR::RecordGraphExecOrder(SubModuleId::SM_SESSION, exec_order_name, kernels);
#endif
#ifndef ENABLE_SECURITY
// Get summary nodes.
SetSummaryNodes(graph.get());


+ 4
- 0
mindspore/ccsrc/backend/session/session_basic.cc View File

@@ -2737,6 +2737,10 @@ void SessionBasic::DumpGraphs(const std::vector<KernelGraphPtr> &graphs) {
std::string name = "graph_build." + std::to_string(graph->graph_id());
DumpGraphParams dump_params = {true, static_cast<int>(kWholeStack)};
(void)mindspore::RDR::RecordAnfGraph(SUBMODULE_ID, name, graph, dump_params, ".ir;.pb");

auto &kernels = graph->execution_order();
std::string exec_order_name = "graph_exec_order." + std::to_string(graph->graph_id());
(void)mindspore::RDR::RecordGraphExecOrder(SUBMODULE_ID, exec_order_name, kernels);
if (save_graphs) {
std::string file_name = "graph_build_" + std::to_string(graph->graph_id()) + ".ir";
DumpIR(file_name, graph, true, kWholeStack);


+ 0
- 9
mindspore/ccsrc/runtime/framework/graph_compiler.cc View File

@@ -488,15 +488,6 @@ GraphId GraphCompiler::CompileGraphImpl(const KernelGraphPtr &graph, const Devic
}
#endif

#ifdef ENABLE_DUMP_IR
std::string name = "graph_build";
DumpGraphParams dump_params = {true, static_cast<int>(kWholeStack)};
(void)mindspore::RDR::RecordAnfGraph(SubModuleId::SM_SESSION, name, graph, dump_params, ".ir,.pb");
auto &kernels = graph->execution_order();
std::string exec_order_name = "graph_exec_order." + std::to_string(graph->graph_id());
(void)mindspore::RDR::RecordGraphExecOrder(SubModuleId::SM_SESSION, exec_order_name, kernels);
#endif

device_context->EnableRuntimeCache(graph);
return graph->graph_id();
}


Loading…
Cancel
Save