Browse Source

!8460 move dynamic shape mark before backend common optimization

From: @hwjiaorui
Reviewed-by: @jjfeing,@kisnwang
Signed-off-by: @jjfeing
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
b85f5de2fd
3 changed files with 6 additions and 5 deletions
  1. +0
    -3
      mindspore/ccsrc/backend/session/ascend_session.cc
  2. +5
    -0
      mindspore/ccsrc/backend/session/session_basic.cc
  3. +1
    -2
      mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc

+ 0
- 3
mindspore/ccsrc/backend/session/ascend_session.cc View File

@@ -121,9 +121,6 @@ GraphId AscendSession::CompileGraphImpl(const AnfNodePtrList &lst, const AnfNode
MS_LOG(INFO) << "Start"; MS_LOG(INFO) << "Start";
// construct graph, if successfully, graph_sum_ + 1 // construct graph, if successfully, graph_sum_ + 1
auto graph = ConstructKernelGraph(lst, outputs); auto graph = ConstructKernelGraph(lst, outputs);
// Update Graph Dynamic Shape Attr
UpdateGraphDynamicShapeAttr(NOT_NULL(graph));
graph->UpdateGraphDynamicAttr();
auto graph_id = graph->graph_id(); auto graph_id = graph->graph_id();
MS_LOG(INFO) << "Compile graph " << graph_id << " success"; MS_LOG(INFO) << "Compile graph " << graph_id << " success";
return graph_id; return graph_id;


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

@@ -851,6 +851,10 @@ KernelGraphPtr SessionBasic::ConstructKernelGraph(const AnfNodePtrList &lst, con
if (ExistSummaryNode(graph.get())) { if (ExistSummaryNode(graph.get())) {
graph->set_summary_node_exist(true); graph->set_summary_node_exist(true);
} }

// Update Graph Dynamic Shape Attr
UpdateGraphDynamicShapeAttr(NOT_NULL(graph));

opt::BackendCommonOptimization(graph); opt::BackendCommonOptimization(graph);
graph->SetInputNodes(); graph->SetInputNodes();
graph->SetOptimizerFlag(); graph->SetOptimizerFlag();
@@ -1493,6 +1497,7 @@ void SessionBasic::UpdateGraphDynamicShapeAttr(const NotNull<KernelGraphPtr> &ro
MS_LOG(INFO) << "Set Input Dynamic Shape Attr to Node:" << cnode->fullname_with_scope(); MS_LOG(INFO) << "Set Input Dynamic Shape Attr to Node:" << cnode->fullname_with_scope();
} }
} }
root_graph->UpdateGraphDynamicAttr();
} }


#if (ENABLE_CPU && (ENABLE_D || ENABLE_GPU)) #if (ENABLE_CPU && (ENABLE_D || ENABLE_GPU))


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

@@ -376,8 +376,7 @@ bool AscendKernelRuntime::GenTask(const session::KernelGraph *graph) {
InnerSetContext(); InnerSetContext();
if (graph->is_dynamic_shape()) { if (graph->is_dynamic_shape()) {
if (ConfigManager::GetInstance().dataset_mode() == DS_SINK_MODE) { if (ConfigManager::GetInstance().dataset_mode() == DS_SINK_MODE) {
MS_LOG(EXCEPTION)
<< "Dynamic shape is not supported with dataset_sink_mode=True. Please set dataset_sink_mode=False";
MS_LOG(EXCEPTION) << "Dynamic shape is not supported with sink mode.";
} }
if (DumpJsonParser::GetInstance().async_dump_enabled()) { if (DumpJsonParser::GetInstance().async_dump_enabled()) {
MS_LOG(EXCEPTION) << "Dynamic shape is not supported with asyn dump. Please use other debugging methods."; MS_LOG(EXCEPTION) << "Dynamic shape is not supported with asyn dump. Please use other debugging methods.";


Loading…
Cancel
Save