diff --git a/ge/generator/ge_generator.cc b/ge/generator/ge_generator.cc index 875cb396..b6047a45 100644 --- a/ge/generator/ge_generator.cc +++ b/ge/generator/ge_generator.cc @@ -665,7 +665,6 @@ namespace { } Status CheckNoAicore(const ComputeGraphPtr &graph, bool &no_aicore) { - no_aicore = true; for (const auto &node : graph->GetDirectNode()) { GE_CHECK_NOTNULL(node); auto op_desc = node->GetOpDesc(); diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 840a7183..3446e12b 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -61,7 +61,7 @@ Status IfInferDepend(GeModelPtr &ge_model, bool &flag) { Status NeedHybridModel(GeModelPtr &ge_model, bool &flag) { bool infer_depend_flag = false; - GE_CHK_STATUS_RET_NOLOG(IfInferDepend(ge_model, infer_depend_flag)); + GE_CHK_STATUS_RET(IfInferDepend(ge_model, infer_depend_flag), "[Check][IfInferDepend] failed."); auto tasks = ge_model->GetModelTaskDefPtr()->task(); int32_t kernel_task_num = 0; for (int i = 0; i < tasks.size(); ++i) { @@ -531,7 +531,7 @@ Status SingleOpModel::BuildDynamicOp(StreamResource &resource, DynamicSingleOp & auto ge_model = model_helper_.GetGeModel(); GE_CHECK_NOTNULL(ge_model); bool need_hybrid_model = false; - GE_CHK_STATUS_RET_NOLOG(NeedHybridModel(ge_model, need_hybrid_model)); + GE_CHK_STATUS_RET_NOLOG(NeedHybridModel(ge_model, need_hybrid_model), "[Check][NeedHybridModel] failed."); if (need_hybrid_model) { GELOGD("Build single op HybridModel."); GE_CHK_STATUS_RET_NOLOG(hybrid::NodeExecutorManager::GetInstance().EnsureInitialized()); diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index eaf4564a..dadabaf6 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -17,7 +17,6 @@ #include #include -//#include "cce/taskdown_common.hpp" #include "graph/load/model_manager/model_utils.h" #include "graph/utils/graph_utils.h" #include "runtime/rt.h" @@ -196,4 +195,31 @@ TEST_F(UtestSingleOpModel, test_op_task_get_profiler_args) { ASSERT_EQ(model_id, 1); } +TEST_F(UtestSingleOpModel, test_build_dynamic_op) { + string model_data_str = "123456789"; + SingleOpModel model("model", model_data_str.c_str(), model_data_str.size()); + model.netoutput_op_ = make_shared("NetOutput", "NetOutput"); + model.model_helper_.model_ = ge::MakeShared(); + + // make graph + auto compute_graph = make_shared("graph"); + auto data_op = make_shared("Data", DATA); + auto data_node = compute_graph->AddNode(data_op); + auto graph = GraphUtils::CreateGraphFromComputeGraph(compute_graph); + model.model_helper_.model_->SetGraph(graph); + + // set task_def + auto model_task_def = make_shared(); + domi::TaskDef *task_def = model_task_def->add_task(); + task_def->set_type(RT_MODEL_TASK_KERNEL); + domi::KernelDef *kernel_def = task_def->mutable_kernel(); + domi::KernelContext *context = kernel_def->mutable_context(); + context->set_kernel_type(2); // ccKernelType::TE + model.model_helper_.model_->SetModelTaskDef(model_task_def); + + std::mutex stream_mu_; + DynamicSingleOp dynamic_single_op(0, &stream_mu_, nullptr); + StreamResource res((uintptr_t)1); + model.BuildDynamicOp(res, dynamic_single_op); +}