diff --git a/ge/plugin/engine/dnnengines.cc b/ge/plugin/engine/dnnengines.cc index f69cf769..5b06310c 100755 --- a/ge/plugin/engine/dnnengines.cc +++ b/ge/plugin/engine/dnnengines.cc @@ -52,7 +52,7 @@ Status VectorCoreDNNEngine::Initialize(const std::map Status VectorCoreDNNEngine::Finalize() { return SUCCESS; } void VectorCoreDNNEngine::GetAttributes(DNNEngineAttribute &attrs) const { attrs = engine_attribute_; } -#ifndef ONLY_COMPILE_OPEN_SRC + AICpuDNNEngine::AICpuDNNEngine(const std::string &engine_name) { engine_attribute_.engine_name = engine_name; engine_attribute_.compute_cost = COST_2; @@ -60,15 +60,7 @@ AICpuDNNEngine::AICpuDNNEngine(const std::string &engine_name) { engine_attribute_.engine_input_format = FORMAT_RESERVED; engine_attribute_.engine_output_format = FORMAT_RESERVED; } -#else -AICpuDNNEngine::AICpuDNNEngine(const std::string &engine_name) { - engine_attribute_.engine_name = engine_name; - engine_attribute_.compute_cost = COST_3; - engine_attribute_.runtime_type = DEVICE; - engine_attribute_.engine_input_format = FORMAT_RESERVED; - engine_attribute_.engine_output_format = FORMAT_RESERVED; -} -#endif + AICpuDNNEngine::AICpuDNNEngine(const DNNEngineAttribute &attrs) { engine_attribute_ = attrs; } Status AICpuDNNEngine::Initialize(const std::map &options) { return SUCCESS; } @@ -76,7 +68,7 @@ Status AICpuDNNEngine::Initialize(const std::map &opti Status AICpuDNNEngine::Finalize() { return SUCCESS; } void AICpuDNNEngine::GetAttributes(DNNEngineAttribute &attrs) const { attrs = engine_attribute_; } -#ifndef ONLY_COMPILE_OPEN_SRC + AICpuTFDNNEngine::AICpuTFDNNEngine(const std::string &engine_name) { engine_attribute_.engine_name = engine_name; engine_attribute_.compute_cost = COST_3; @@ -84,15 +76,7 @@ AICpuTFDNNEngine::AICpuTFDNNEngine(const std::string &engine_name) { engine_attribute_.engine_input_format = FORMAT_RESERVED; engine_attribute_.engine_output_format = FORMAT_RESERVED; } -#else -AICpuTFDNNEngine::AICpuTFDNNEngine(const std::string &engine_name) { - engine_attribute_.engine_name = engine_name; - engine_attribute_.compute_cost = COST_2; - engine_attribute_.runtime_type = DEVICE; - engine_attribute_.engine_input_format = FORMAT_RESERVED; - engine_attribute_.engine_output_format = FORMAT_RESERVED; -} -#endif + AICpuTFDNNEngine::AICpuTFDNNEngine(const DNNEngineAttribute &attrs) { engine_attribute_ = attrs; } Status AICpuTFDNNEngine::Initialize(const std::map &options) { return SUCCESS; } diff --git a/ge/plugin/engine/engine_manage.cc b/ge/plugin/engine/engine_manage.cc index 0fdfb672..fd713566 100644 --- a/ge/plugin/engine/engine_manage.cc +++ b/ge/plugin/engine/engine_manage.cc @@ -92,11 +92,9 @@ void RegisterAiCpuEngine() { const std::string vm_aicpu = "DNN_VM_AICPU_ASCEND"; std::vector mem_type_aicpu; mem_type_aicpu.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); -#ifndef ONLY_COMPILE_OPEN_SRC + DNNEngineAttribute attr_aicpu = {vm_aicpu, mem_type_aicpu, COST_2, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; -#else - DNNEngineAttribute attr_aicpu = {vm_aicpu, mem_type_aicpu, COST_3, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; -#endif + DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu); if (vm_engine_ptr == nullptr) { GELOGE(ge::FAILED, "make vm_engine_ptr failed"); @@ -111,11 +109,9 @@ void RegisterAiCpuTFEngine() { const std::string vm_aicpu_tf = "DNN_VM_AICPU"; std::vector mem_type_aicpu_tf; mem_type_aicpu_tf.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); -#ifndef ONLY_COMPILE_OPEN_SRC + DNNEngineAttribute attr_aicpu_tf = {vm_aicpu_tf, mem_type_aicpu_tf, COST_3, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; -#else - DNNEngineAttribute attr_aicpu_tf = {vm_aicpu_tf, mem_type_aicpu_tf, COST_2, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; -#endif + DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu_tf); if (vm_engine_ptr == nullptr) { GELOGE(ge::FAILED, "make vm_engine_ptr failed");