From a29681141390634a6263ad4ebf60bd44b3dbe1d4 Mon Sep 17 00:00:00 2001 From: lichun Date: Sat, 23 Jan 2021 18:08:43 +0800 Subject: [PATCH 1/2] Bugfix: fix the error in singleop scene --- ge/graph/partition/dynamic_shape_partition.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ge/graph/partition/dynamic_shape_partition.cc b/ge/graph/partition/dynamic_shape_partition.cc index 1c82eaf3..327a9f5b 100755 --- a/ge/graph/partition/dynamic_shape_partition.cc +++ b/ge/graph/partition/dynamic_shape_partition.cc @@ -51,6 +51,13 @@ using ClusterPtr = std::shared_ptr; static bool IsInExperimentalMode(const ComputeGraphPtr &root_graph) { for (const auto &node : root_graph->GetAllNodes()) { GE_CHECK_NOTNULL(node->GetOpDesc()); + // not do partition in single op scene. + bool is_singleop = false; + (void)AttrUtils::GetBool(node->GetOpDesc(), ATTR_DYNAMIC_SHAPE_SINGLE_AICPU, is_singleop); + if (is_singleop) { + return false; + } + for (const auto &input_desc : node->GetOpDesc()->GetAllInputsDesc()) { auto type = input_desc.GetDataType(); if (type == DT_STRING || type == DT_RESOURCE || type == DT_STRING_REF) { From b6b2ff8c0826d8270c95ab081eb9d0d98994bb61 Mon Sep 17 00:00:00 2001 From: lichun Date: Mon, 25 Jan 2021 11:48:49 +0800 Subject: [PATCH 2/2] Bugfix: fix the error in singleop scene --- ge/generator/ge_generator.cc | 2 +- ge/graph/partition/dynamic_shape_partition.cc | 2 +- ge/graph/passes/dynamic_single_op_reset_shape_pass.cc | 4 ++-- ge/graph/preprocess/graph_preprocess.cc | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ge/generator/ge_generator.cc b/ge/generator/ge_generator.cc index d032965b..fe7ea3bf 100644 --- a/ge/generator/ge_generator.cc +++ b/ge/generator/ge_generator.cc @@ -670,7 +670,7 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector &in const string &model_file_name, OpEngineType engine_type, ModelBufferData &model_buff, bool is_offline) { if (!is_offline) { - (void)AttrUtils::SetBool(op_desc, ATTR_DYNAMIC_SHAPE_SINGLE_AICPU, true); + (void)AttrUtils::SetBool(op_desc, ATTR_SINGLE_OP_SCENE, true); } if (CheckForSingleOp(op_desc, inputs, outputs) != SUCCESS) { diff --git a/ge/graph/partition/dynamic_shape_partition.cc b/ge/graph/partition/dynamic_shape_partition.cc index 327a9f5b..2a60765f 100755 --- a/ge/graph/partition/dynamic_shape_partition.cc +++ b/ge/graph/partition/dynamic_shape_partition.cc @@ -53,7 +53,7 @@ static bool IsInExperimentalMode(const ComputeGraphPtr &root_graph) { GE_CHECK_NOTNULL(node->GetOpDesc()); // not do partition in single op scene. bool is_singleop = false; - (void)AttrUtils::GetBool(node->GetOpDesc(), ATTR_DYNAMIC_SHAPE_SINGLE_AICPU, is_singleop); + (void)AttrUtils::GetBool(node->GetOpDesc(), ATTR_SINGLE_OP_SCENE, is_singleop); if (is_singleop) { return false; } diff --git a/ge/graph/passes/dynamic_single_op_reset_shape_pass.cc b/ge/graph/passes/dynamic_single_op_reset_shape_pass.cc index 6fa63642..293fd132 100644 --- a/ge/graph/passes/dynamic_single_op_reset_shape_pass.cc +++ b/ge/graph/passes/dynamic_single_op_reset_shape_pass.cc @@ -58,9 +58,9 @@ Status DynamicSingleOpResetShapePass::Run(ComputeGraphPtr graph) { continue; } - // pass node without attr: ATTR_DYNAMIC_SHAPE_SINGLE_AICPU + // pass node without attr: ATTR_SINGLE_OP_SCENE bool single_aicpu_unknown = false; - if (!AttrUtils::GetBool(node->GetOpDesc(), ATTR_DYNAMIC_SHAPE_SINGLE_AICPU, single_aicpu_unknown) || + if (!AttrUtils::GetBool(node->GetOpDesc(), ATTR_SINGLE_OP_SCENE, single_aicpu_unknown) || !single_aicpu_unknown) { continue; } diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index c6179095..63f1b131 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -1925,7 +1925,7 @@ void GraphPrepare::TypeConversionOfConstant() { for (ge::NodePtr &n : compute_graph_->GetAllNodes()) { // This can ensure that n is not a null pointer // No Conversion when called by aclOpCompile - (void)AttrUtils::GetBool(n->GetOpDesc(), ATTR_DYNAMIC_SHAPE_SINGLE_AICPU, is_acl_compile); + (void)AttrUtils::GetBool(n->GetOpDesc(), ATTR_SINGLE_OP_SCENE, is_acl_compile); if (is_acl_compile) { return; }