From 2f13967f17923f705cde85944a41bd627a753504 Mon Sep 17 00:00:00 2001 From: lichun Date: Sat, 28 Nov 2020 11:10:36 +0800 Subject: [PATCH] Fix the error of unexpected executor type --- ge/hybrid/node_executor/node_executor.cc | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/ge/hybrid/node_executor/node_executor.cc b/ge/hybrid/node_executor/node_executor.cc index 4055ec4d..842dce82 100755 --- a/ge/hybrid/node_executor/node_executor.cc +++ b/ge/hybrid/node_executor/node_executor.cc @@ -34,6 +34,15 @@ const char *const kEngineNameHccl = "ops_kernel_info_hccl"; const char *const kEngineNameRts = "DNN_VM_RTS_OP_STORE"; const char *const kEngineNameHostCpu = "DNN_VM_HOST_CPU_OP_STORE"; const char *const kOwnerGraphIsUnknown = "OwnerGraphIsUnknown"; + +bool IsGraphUnknown(ComputeGraph &graph) { + for (const auto &node : graph.GetDirectNode()) { + bool is_unknown_shape = false; + (void)AttrUtils::GetBool(node->GetOpDesc(), kOwnerGraphIsUnknown, is_unknown_shape); + return is_unknown_shape; + } + return false; +} } Status NodeExecutor::PrepareTask(NodeTask &task, TaskContext &context) const { GE_CHK_STATUS_RET_NOLOG(context.AllocateOutputs()); @@ -82,17 +91,16 @@ NodeExecutorManager::ExecutorType NodeExecutorManager::ResolveExecutorType(Node auto op_type = node.GetType(); if (op_type == PARTITIONEDCALL) { const auto &subgraph = NodeUtils::GetSubgraph(node, 0); - if (subgraph != nullptr) { - for (const auto &node : subgraph->GetDirectNode()) { - bool is_unknown_shape = false; - (void)AttrUtils::GetBool(node->GetOpDesc(), kOwnerGraphIsUnknown, is_unknown_shape); - if (is_unknown_shape) { - return ExecutorType::DYNAMIC_SUBGRAPH; - } else { - return ExecutorType::COMPILED_SUBGRAPH; - } - } + if (subgraph != nullptr && IsGraphUnknown(*subgraph)) { + GELOGD("node %s was marked as unknown shape in node executor.", node.GetName().c_str()); + return ExecutorType::DYNAMIC_SUBGRAPH; + } + bool is_dynamic = false; + (void) NodeUtils::GetNodeUnknownShapeStatus(node, is_dynamic); + if (is_dynamic) { + return ExecutorType::DYNAMIC_SUBGRAPH; } + return ExecutorType::COMPILED_SUBGRAPH; } // rts kernel store is assigned to NetOutput