diff --git a/ge/hybrid/node_executor/aicore/aicore_task_builder.cc b/ge/hybrid/node_executor/aicore/aicore_task_builder.cc index 2bf2cb36..c3db378b 100755 --- a/ge/hybrid/node_executor/aicore/aicore_task_builder.cc +++ b/ge/hybrid/node_executor/aicore/aicore_task_builder.cc @@ -70,7 +70,6 @@ Status AiCoreTaskBuilder::BuildTask(std::unique_ptr &node_task, auto atomic_task = std::unique_ptr(new(std::nothrow)AtomicAddrCleanOpTask()); GE_CHECK_NOTNULL(atomic_task); - atomic_task->SetSingleOp(is_single_op); GE_CHK_STATUS_RET(atomic_task->Init(*op_desc_, task_defs_.front()), "[%s] Failed to init task for AtomicAddrClean", op_desc_->GetName().c_str()); diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 1b776cc8..7fcb0b8f 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -43,20 +43,21 @@ using std::vector; namespace ge { namespace { const size_t kDataOutputNum = 1; -} // namespace -static Status IfInferDepend(GeModelPtr &ge_model, bool &flag) { - auto comp_graph = GraphUtils::GetComputeGraph(ge_model->GetGraph()); - for (const auto &node : comp_graph->GetAllNodes()) { - auto op_desc = node->GetOpDesc(); - GE_CHECK_NOTNULL(op_desc); - const auto &depends = op_desc->GetOpInferDepends(); - if (!depends.empty()) { - flag = true; - return SUCCESS; + +bool NeedHybridModel(GeModelPtr &ge_model) { + auto tasks = ge_model->GetModelTaskDefPtr()->task(); + int32_t kernel_task_num = 0; + for (int i = 0; i < tasks.size(); ++i) { + if (static_cast(tasks[i].type()) == RT_MODEL_TASK_KERNEL) { + kernel_task_num++; + if (kernel_task_num > 1) { + return true; + } } } - return SUCCESS; + return false; } +} // namespace SingleOpModel::SingleOpModel(const std::string &model_name, const void *model_data, uint32_t model_size) : model_name_(model_name), ori_model_data_(model_data), ori_model_size_(model_size) {} @@ -497,9 +498,7 @@ Status SingleOpModel::BuildDynamicOp(StreamResource &resource, DynamicSingleOp & auto ge_model = model_helper_.GetGeModel(); GE_CHECK_NOTNULL(ge_model); - bool infer_depend_flag = false; - GE_CHK_STATUS_RET_NOLOG(IfInferDepend(ge_model, infer_depend_flag)); - if (ge_model->GetModelTaskDefPtr()->task_size() > 1 || infer_depend_flag) { + if (NeedHybridModel(ge_model)) { GELOGD("Build single op HybridModel."); GE_CHK_STATUS_RET_NOLOG(hybrid::NodeExecutorManager::GetInstance().EnsureInitialized()); auto root_model = model_helper_.GetGeRootModel();