/** * Copyright 2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "stub_engine.h" #include #include #include #include #include "framework/common/debug/ge_log.h" #include "common/ge/ge_util.h" #include "host_cpu_engine/common/constant/constant.h" #include "host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_info.h" namespace fe { AICEngine &AICEngine::Instance() { static AICEngine instance; return instance; } Status AICEngine::Initialize(const std::map &options) { if (ops_kernel_store_ == nullptr) { ops_kernel_store_ = MakeShared(); if (ops_kernel_store_ == nullptr) { GELOGE(FAILED, "[Create][AICEngine]Make HostCpuOpsKernelInfoStore failed."); REPORT_INNER_ERROR("E19999", "AICEngine::Initialize failed for new AICEngine."); return FAILED; } } return SUCCESS; } void AICEngine::GetOpsKernelInfoStores(std::map &ops_kernel_map) { if (ops_kernel_store_ != nullptr) { // add buildin opsKernel to opsKernelInfoMap ops_kernel_map[kHostCpuOpKernelLibName] = ops_kernel_store_; } } void AICEngine::GetGraphOptimizerObjs(std::map &) { // no optimizer for host cpu engine } Status AICEngine::Finalize() { ops_kernel_store_ = nullptr; return SUCCESS; } } // namespace fe ge::Status Initialize(const std::map &options) { return fe::AICEngine::Instance().Initialize(options); } void GetOpsKernelInfoStores(std::map &ops_kernel_map) { fe::AICEngine::Instance().GetOpsKernelInfoStores(ops_kernel_map); } void GetGraphOptimizerObjs(std::map &graph_optimizers) { fe::AICEngine::Instance().GetGraphOptimizerObjs(graph_optimizers); } ge::Status Finalize() { return fe::AICEngine::Instance().Finalize(); }