From: @zhangxiaokun9 Reviewed-by: @wqtshg,@xchu42 Signed-off-by: @ji_chentags/v1.2.0
| @@ -133,7 +133,6 @@ set(TRAIN_SRC_LIST | |||||
| "graph/load/model_manager/data_dumper.cc" | "graph/load/model_manager/data_dumper.cc" | ||||
| "graph/load/model_manager/data_inputer.cc" | "graph/load/model_manager/data_inputer.cc" | ||||
| "graph/load/model_manager/davinci_model.cc" | "graph/load/model_manager/davinci_model.cc" | ||||
| "graph/load/model_manager/davinci_model_parser.cc" | |||||
| "graph/load/model_manager/model_manager.cc" | "graph/load/model_manager/model_manager.cc" | ||||
| "graph/load/model_manager/model_utils.cc" | "graph/load/model_manager/model_utils.cc" | ||||
| "graph/load/model_manager/aipp_utils.cc" | "graph/load/model_manager/aipp_utils.cc" | ||||
| @@ -613,7 +612,6 @@ set(INFER_SRC_LIST | |||||
| "graph/load/model_manager/model_manager.cc" | "graph/load/model_manager/model_manager.cc" | ||||
| "graph/load/model_manager/data_inputer.cc" | "graph/load/model_manager/data_inputer.cc" | ||||
| "graph/load/model_manager/davinci_model.cc" | "graph/load/model_manager/davinci_model.cc" | ||||
| "graph/load/model_manager/davinci_model_parser.cc" | |||||
| "graph/load/model_manager/model_utils.cc" | "graph/load/model_manager/model_utils.cc" | ||||
| "graph/load/model_manager/aipp_utils.cc" | "graph/load/model_manager/aipp_utils.cc" | ||||
| "graph/load/model_manager/tbe_handle_store.cc" | "graph/load/model_manager/tbe_handle_store.cc" | ||||
| @@ -54,7 +54,7 @@ set(SRC_LIST | |||||
| "util.cc" | "util.cc" | ||||
| "properties_manager.cc" | "properties_manager.cc" | ||||
| "types.cc" | "types.cc" | ||||
| "model_parser/base.cc" | |||||
| "model_parser/model_parser.cc" | |||||
| "kernel_store.cc" | "kernel_store.cc" | ||||
| "tbe_kernel_store.cc" | "tbe_kernel_store.cc" | ||||
| "cust_aicpu_kernel_store.cc" | "cust_aicpu_kernel_store.cc" | ||||
| @@ -14,22 +14,15 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include <climits> | |||||
| #include "common/helper/model_cache_helper.h" | |||||
| #include <cstdio> | #include <cstdio> | ||||
| #include <fstream> | #include <fstream> | ||||
| #include <functional> | #include <functional> | ||||
| #include "common/ge/ge_util.h" | |||||
| #include "common/helper/model_cache_helper.h" | |||||
| #include "common/types.h" | |||||
| #include "framework/common/debug/ge_log.h" | |||||
| #include "framework/common/ge_types.h" | |||||
| #include "common/model_parser/model_parser.h" | |||||
| #include "framework/common/helper/model_helper.h" | #include "framework/common/helper/model_helper.h" | ||||
| #include "framework/common/util.h" | |||||
| #include "graph/detail/attributes_holder.h" | |||||
| #include "graph/detail/model_serialize_imp.h" | #include "graph/detail/model_serialize_imp.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| #include "graph/model.h" | |||||
| #include "graph/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||
| #include "graph/utils/tensor_utils.h" | #include "graph/utils/tensor_utils.h" | ||||
| #include "init/gelib.h" | #include "init/gelib.h" | ||||
| @@ -1682,7 +1675,7 @@ Status ModelCacheHelper::LoadOmModelFromCache(GeModelPtr &ge_model) const { | |||||
| string key_path; | string key_path; | ||||
| int32_t priority = 0; | int32_t priority = 0; | ||||
| ModelData model_data; | ModelData model_data; | ||||
| ret = DavinciModelParser::LoadFromFile(om_path.c_str(), key_path.c_str(), priority, model_data); | |||||
| ret = ModelParserBase::LoadFromFile(om_path.c_str(), key_path.c_str(), priority, model_data); | |||||
| if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
| GELOGW("LoadOmModelFromCache: Load model from file failed. ret = %u", ret); | GELOGW("LoadOmModelFromCache: Load model from file failed. ret = %u", ret); | ||||
| return ret; | return ret; | ||||
| @@ -16,15 +16,9 @@ | |||||
| #include "framework/common/helper/model_helper.h" | #include "framework/common/helper/model_helper.h" | ||||
| #include "common/ge/ge_util.h" | |||||
| #include "common/util/error_manager/error_manager.h" | |||||
| #include "framework/common/debug/log.h" | |||||
| #include "framework/common/util.h" | |||||
| #include "framework/common/debug/ge_log.h" | |||||
| #include "common/model_parser/model_parser.h" | |||||
| #include "framework/omg/version.h" | #include "framework/omg/version.h" | ||||
| #include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| #include "graph/utils/attr_utils.h" | |||||
| #include "graph/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||
| using std::string; | using std::string; | ||||
| @@ -464,7 +458,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c | |||||
| return ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA; | return ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA; | ||||
| } | } | ||||
| Status status = ge::DavinciModelParser::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); | |||||
| Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); | |||||
| if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
| GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); | GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); | ||||
| return ACL_ERROR_GE_PARAM_INVALID; | return ACL_ERROR_GE_PARAM_INVALID; | ||||
| @@ -513,7 +507,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod | |||||
| return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
| } | } | ||||
| Status status = ge::DavinciModelParser::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); | |||||
| Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); | |||||
| if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
| GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); | GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); | ||||
| return ACL_ERROR_GE_PARAM_INVALID; | return ACL_ERROR_GE_PARAM_INVALID; | ||||
| @@ -14,16 +14,13 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include "common/model_parser/base.h" | |||||
| #include "common/helper/model_helper.h" | |||||
| #include <securec.h> | |||||
| #include "common/model_parser/model_parser.h" | |||||
| #include <fstream> | #include <fstream> | ||||
| #include <memory> | |||||
| #include <string> | #include <string> | ||||
| #include "framework/common/debug/ge_log.h" | |||||
| #include "framework/common/debug/log.h" | |||||
| #include "framework/common/util.h" | |||||
| #include "securec.h" | |||||
| #include "common/helper/model_helper.h" | |||||
| namespace ge { | namespace ge { | ||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelParserBase::ModelParserBase() {} | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelParserBase::ModelParserBase() {} | ||||
| @@ -33,7 +33,6 @@ set(SRC_LIST | |||||
| "../model/ge_model.cc" | "../model/ge_model.cc" | ||||
| "../model/ge_root_model.cc" | "../model/ge_root_model.cc" | ||||
| "../graph/load/model_manager/davinci_model.cc" | "../graph/load/model_manager/davinci_model.cc" | ||||
| "../graph/load/model_manager/davinci_model_parser.cc" | |||||
| "../graph/load/model_manager/model_manager.cc" | "../graph/load/model_manager/model_manager.cc" | ||||
| "../graph/load/model_manager/tbe_handle_store.cc" | "../graph/load/model_manager/tbe_handle_store.cc" | ||||
| "../graph/load/model_manager/cpu_queue_schedule.cc" | "../graph/load/model_manager/cpu_queue_schedule.cc" | ||||
| @@ -16,7 +16,6 @@ | |||||
| #include "executor/ge_executor.h" | #include "executor/ge_executor.h" | ||||
| #include <cce/cce.h> | #include <cce/cce.h> | ||||
| #include <cce/compiler_stub.h> | |||||
| #include <ctime> | #include <ctime> | ||||
| #include <iostream> | #include <iostream> | ||||
| #include "common/debug/log.h" | #include "common/debug/log.h" | ||||
| @@ -24,19 +23,11 @@ | |||||
| #include "common/helper/model_helper.h" | #include "common/helper/model_helper.h" | ||||
| #include "common/profiling/profiling_manager.h" | #include "common/profiling/profiling_manager.h" | ||||
| #include "common/dump/dump_manager.h" | #include "common/dump/dump_manager.h" | ||||
| #include "common/util.h" | |||||
| #include "framework/common/debug/ge_log.h" | |||||
| #include "framework/common/util.h" | |||||
| #include "graph/execute/graph_execute.h" | #include "graph/execute/graph_execute.h" | ||||
| #include "graph/load/graph_loader.h" | #include "graph/load/graph_loader.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| #include "graph/load/model_manager/model_manager.h" | #include "graph/load/model_manager/model_manager.h" | ||||
| #include "graph/manager/graph_mem_allocator.h" | #include "graph/manager/graph_mem_allocator.h" | ||||
| #include "graph/model.h" | |||||
| #include "graph/utils/graph_utils.h" | |||||
| #include "mmpa/mmpa_api.h" | |||||
| #include "single_op/single_op_manager.h" | #include "single_op/single_op_manager.h" | ||||
| #include "graph/manager/graph_var_manager.h" | |||||
| #include "graph/load/model_manager/davinci_model.h" | #include "graph/load/model_manager/davinci_model.h" | ||||
| #include "opskernel_manager/ops_kernel_builder_manager.h" | #include "opskernel_manager/ops_kernel_builder_manager.h" | ||||
| @@ -19,12 +19,8 @@ | |||||
| #include <memory> | #include <memory> | ||||
| #include <string> | #include <string> | ||||
| #include "common/ge_inner_error_codes.h" | |||||
| #include "common/model_parser/base.h" | |||||
| #include "graph/load/model_manager/model_manager.h" | #include "graph/load/model_manager/model_manager.h" | ||||
| #include "omm/csa_interact.h" | #include "omm/csa_interact.h" | ||||
| #include "runtime/dev.h" | |||||
| #include "runtime/mem.h" | |||||
| namespace ge { | namespace ge { | ||||
| GraphExecutor::GraphExecutor() | GraphExecutor::GraphExecutor() | ||||
| @@ -20,19 +20,13 @@ | |||||
| #include <vector> | #include <vector> | ||||
| #include "common/helper/model_helper.h" | #include "common/helper/model_helper.h" | ||||
| #include "common/util.h" | |||||
| #include "common/model_parser/model_parser.h" | |||||
| #include "graph/ge_context.h" | #include "graph/ge_context.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| #include "graph/load/model_manager/model_manager.h" | #include "graph/load/model_manager/model_manager.h" | ||||
| #include "graph/manager/graph_var_manager.h" | #include "graph/manager/graph_var_manager.h" | ||||
| #include "omm/csa_interact.h" | #include "omm/csa_interact.h" | ||||
| #include "runtime/dev.h" | |||||
| namespace ge { | namespace ge { | ||||
| GraphLoader::GraphLoader() = default; | |||||
| GraphLoader::~GraphLoader() = default; | |||||
| Status GraphLoader::UnloadModel(uint32_t model_id) { | Status GraphLoader::UnloadModel(uint32_t model_id) { | ||||
| auto model_manager = ModelManager::GetInstance(); | auto model_manager = ModelManager::GetInstance(); | ||||
| GE_CHECK_NOTNULL(model_manager); | GE_CHECK_NOTNULL(model_manager); | ||||
| @@ -120,7 +114,6 @@ Status GraphLoader::GetMaxUsedMemory(uint32_t model_id, uint64_t &max_size) { | |||||
| Status GraphLoader::LoadDataFromFile(const std::string &path, const std::string &key_path, int32_t priority, | Status GraphLoader::LoadDataFromFile(const std::string &path, const std::string &key_path, int32_t priority, | ||||
| ModelData &model_data) { | ModelData &model_data) { | ||||
| Status ret; | |||||
| if (!CheckInputPathValid(path)) { | if (!CheckInputPathValid(path)) { | ||||
| GELOGE(ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID, "model path is invalid: %s", path.c_str()); | GELOGE(ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID, "model path is invalid: %s", path.c_str()); | ||||
| return ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID; | return ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID; | ||||
| @@ -132,16 +125,15 @@ Status GraphLoader::LoadDataFromFile(const std::string &path, const std::string | |||||
| return ACL_ERROR_GE_PARAM_INVALID; | return ACL_ERROR_GE_PARAM_INVALID; | ||||
| } | } | ||||
| ret = DavinciModelParser::LoadFromFile(path.c_str(), key_path.c_str(), priority, model_data); | |||||
| Status ret = ModelParserBase::LoadFromFile(path.c_str(), key_path.c_str(), priority, model_data); | |||||
| if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
| GELOGE(ret, "LoadModelFromFile: Load failed. ret = %u", ret); | GELOGE(ret, "LoadModelFromFile: Load failed. ret = %u", ret); | ||||
| if (model_data.model_data != nullptr) { | if (model_data.model_data != nullptr) { | ||||
| delete[] static_cast<char *>(model_data.model_data); | delete[] static_cast<char *>(model_data.model_data); | ||||
| model_data.model_data = nullptr; | model_data.model_data = nullptr; | ||||
| } | } | ||||
| return ret; | |||||
| } | } | ||||
| return SUCCESS; | |||||
| return ret; | |||||
| } | } | ||||
| Status GraphLoader::CommandHandle(const Command &command) { | Status GraphLoader::CommandHandle(const Command &command) { | ||||
| @@ -32,9 +32,9 @@ | |||||
| namespace ge { | namespace ge { | ||||
| class GraphLoader { | class GraphLoader { | ||||
| public: | public: | ||||
| GraphLoader(); | |||||
| GraphLoader() = default; | |||||
| virtual ~GraphLoader(); | |||||
| virtual ~GraphLoader() = default; | |||||
| GraphLoader(const GraphLoader &in) = delete; | GraphLoader(const GraphLoader &in) = delete; | ||||
| @@ -1,23 +0,0 @@ | |||||
| /** | |||||
| * Copyright 2020 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 "graph/load/model_manager/davinci_model_parser.h" | |||||
| namespace ge { | |||||
| DavinciModelParser::DavinciModelParser() {} | |||||
| DavinciModelParser::~DavinciModelParser() {} | |||||
| } // namespace ge | |||||
| @@ -1,46 +0,0 @@ | |||||
| /** | |||||
| * Copyright 2020 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. | |||||
| */ | |||||
| #ifndef GE_GRAPH_LOAD_NEW_MODEL_MANAGER_DAVINCI_MODEL_PARSER_H_ | |||||
| #define GE_GRAPH_LOAD_NEW_MODEL_MANAGER_DAVINCI_MODEL_PARSER_H_ | |||||
| #include <securec.h> | |||||
| #include <memory> | |||||
| #include "common/debug/log.h" | |||||
| #include "common/ge_types.h" | |||||
| #include "common/model_parser/base.h" | |||||
| #include "common/types.h" | |||||
| #include "common/util.h" | |||||
| namespace ge { | |||||
| class DavinciModelParser : public ModelParserBase { | |||||
| public: | |||||
| /// | |||||
| /// @ingroup hiai | |||||
| /// @brief constructor | |||||
| /// | |||||
| DavinciModelParser(); | |||||
| /// | |||||
| /// @ingroup hiai | |||||
| /// @brief destructor | |||||
| /// | |||||
| ~DavinciModelParser(); | |||||
| }; | |||||
| } // namespace ge | |||||
| #endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_DAVINCI_MODEL_PARSER_H_ | |||||
| @@ -18,23 +18,15 @@ | |||||
| #include <string> | #include <string> | ||||
| #include "mmpa/mmpa_api.h" | |||||
| #include "aicpu/aicpu_schedule/aicpu_op_type_list.h" | #include "aicpu/aicpu_schedule/aicpu_op_type_list.h" | ||||
| #include "common/model_parser/model_parser.h" | |||||
| #include "common/dump/dump_manager.h" | #include "common/dump/dump_manager.h" | ||||
| #include "common/l2_cache_optimize.h" | #include "common/l2_cache_optimize.h" | ||||
| #include "common/profiling/profiling_manager.h" | #include "common/profiling/profiling_manager.h" | ||||
| #include "common/properties_manager.h" | |||||
| #include "framework/common/debug/ge_log.h" | |||||
| #include "framework/common/util.h" | |||||
| #include "graph/common/ge_call_wrapper.h" | #include "graph/common/ge_call_wrapper.h" | ||||
| #include "graph/debug/ge_attr_define.h" | |||||
| #include "graph/load/model_manager/davinci_model.h" | #include "graph/load/model_manager/davinci_model.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| #include "model/ge_root_model.h" | #include "model/ge_root_model.h" | ||||
| #include "graph/common/local_context.h" | |||||
| #include "graph/utils/attr_utils.h" | |||||
| #include "common/formats/utils/formats_trans_utils.h" | #include "common/formats/utils/formats_trans_utils.h" | ||||
| #include "hybrid/hybrid_davinci_model.h" | |||||
| namespace ge { | namespace ge { | ||||
| thread_local uint32_t device_count = 0; | thread_local uint32_t device_count = 0; | ||||
| @@ -1403,7 +1395,7 @@ Status ModelManager::LaunchCustAicpuSo() { | |||||
| Status ModelManager::GetModelMemAndWeightSize(const ModelData &model, size_t &mem_size, size_t &weight_size) { | Status ModelManager::GetModelMemAndWeightSize(const ModelData &model, size_t &mem_size, size_t &weight_size) { | ||||
| uint8_t *model_data = nullptr; | uint8_t *model_data = nullptr; | ||||
| uint32_t model_len = 0; | uint32_t model_len = 0; | ||||
| Status ret = DavinciModelParser::ParseModelContent(model, model_data, model_len); | |||||
| Status ret = ModelParserBase::ParseModelContent(model, model_data, model_len); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ret != SUCCESS, return ACL_ERROR_GE_PARAM_INVALID, "parse model content failed!"); | GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ret != SUCCESS, return ACL_ERROR_GE_PARAM_INVALID, "parse model content failed!"); | ||||
| OmFileLoadHelper om_file_helper; | OmFileLoadHelper om_file_helper; | ||||
| @@ -23,7 +23,7 @@ | |||||
| #include <vector> | #include <vector> | ||||
| #include "common/debug/log.h" | #include "common/debug/log.h" | ||||
| #include "common/debug/memory_dumper.h" | #include "common/debug/memory_dumper.h" | ||||
| #include "common/model_parser/base.h" | |||||
| #include "common/model_parser/model_parser.h" | |||||
| #include "common/properties_manager.h" | #include "common/properties_manager.h" | ||||
| #include "common/string_util.h" | #include "common/string_util.h" | ||||
| #include "common/types.h" | #include "common/types.h" | ||||
| @@ -23,7 +23,7 @@ | |||||
| #include "common/debug/memory_dumper.h" | #include "common/debug/memory_dumper.h" | ||||
| #include "common/ge/ge_util.h" | #include "common/ge/ge_util.h" | ||||
| #include "common/helper/model_helper.h" | #include "common/helper/model_helper.h" | ||||
| #include "common/model_parser/base.h" | |||||
| #include "common/model_parser/model_parser.h" | |||||
| #include "common/model_saver.h" | #include "common/model_saver.h" | ||||
| #include "common/properties_manager.h" | #include "common/properties_manager.h" | ||||
| #include "common/string_util.h" | #include "common/string_util.h" | ||||
| @@ -24,7 +24,6 @@ | |||||
| #include <vector> | #include <vector> | ||||
| #include "common/helper/model_helper.h" | #include "common/helper/model_helper.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| #include "single_op/single_op.h" | #include "single_op/single_op.h" | ||||
| #include "single_op/stream_resource.h" | #include "single_op/stream_resource.h" | ||||
| @@ -19,7 +19,6 @@ add_subdirectory(depends/cce) | |||||
| add_subdirectory(depends/slog) | add_subdirectory(depends/slog) | ||||
| add_subdirectory(depends/mmpa) | add_subdirectory(depends/mmpa) | ||||
| add_subdirectory(depends/runtime) | add_subdirectory(depends/runtime) | ||||
| add_subdirectory(depends/omg) | |||||
| add_subdirectory(depends/hccl) | add_subdirectory(depends/hccl) | ||||
| add_subdirectory(depends/profiler) | add_subdirectory(depends/profiler) | ||||
| add_subdirectory(depends/error_manager) | add_subdirectory(depends/error_manager) | ||||
| @@ -29,6 +29,11 @@ include_directories(${GE_CODE_DIR}/inc/framework) | |||||
| include_directories(${GE_CODE_DIR}/metadef/inc/external) | include_directories(${GE_CODE_DIR}/metadef/inc/external) | ||||
| add_library(mmpa_stub SHARED ${SRCS}) | add_library(mmpa_stub SHARED ${SRCS}) | ||||
| target_compile_options(mmpa_stub PRIVATE | |||||
| -g | |||||
| ) | |||||
| target_link_libraries(mmpa_stub PRIVATE | target_link_libraries(mmpa_stub PRIVATE | ||||
| $<BUILD_INTERFACE:intf_pub> | $<BUILD_INTERFACE:intf_pub> | ||||
| -Wl,--no-as-needed | -Wl,--no-as-needed | ||||
| @@ -230,7 +230,16 @@ INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone) | |||||
| INT32 mmRealPath(const CHAR *path, CHAR *realPath, INT32 realPathLen) | INT32 mmRealPath(const CHAR *path, CHAR *realPath, INT32 realPathLen) | ||||
| { | { | ||||
| return 0; | |||||
| INT32 ret = EN_OK; | |||||
| if (path == nullptr || realPath == nullptr || realPathLen < MMPA_MAX_PATH) { | |||||
| return EN_INVALID_PARAM; | |||||
| } | |||||
| char *ptr = realpath(path, realPath); | |||||
| if (ptr == nullptr) { | |||||
| ret = EN_ERROR; | |||||
| } | |||||
| return ret; | |||||
| } | } | ||||
| INT32 mmGetErrorCode() | INT32 mmGetErrorCode() | ||||
| @@ -255,7 +264,7 @@ INT32 mmDlclose(VOID *handle) | |||||
| CHAR *mmDlerror() | CHAR *mmDlerror() | ||||
| { | { | ||||
| return ""; | |||||
| return dlerror(); | |||||
| } | } | ||||
| INT32 mmDladdr(VOID *addr, mmDlInfo *info) | INT32 mmDladdr(VOID *addr, mmDlInfo *info) | ||||
| @@ -1,59 +0,0 @@ | |||||
| # Copyright 2019-2020 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. | |||||
| # ============================================================================ | |||||
| #cmake_minimum_required(VERSION 2.8) | |||||
| project(OMG_CCE) | |||||
| set(CMAKE_CXX_STANDARD 11) | |||||
| include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) | |||||
| include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/cce) | |||||
| include_directories(${GE_CODE_DIR}/inc) | |||||
| include_directories(${GE_CODE_DIR}/metadef/inc) | |||||
| include_directories(${GE_CODE_DIR}/inc/framework) | |||||
| include_directories(${GE_CODE_DIR}/metadef/inc/graph) | |||||
| include_directories(${GE_CODE_DIR}/inc/external) | |||||
| include_directories(${GE_CODE_DIR}/metadef/inc/external) | |||||
| include_directories(${GE_CODE_DIR}/metadef/inc/external/graph) | |||||
| include_directories(${GE_CODE_DIR}/ge) | |||||
| include_directories(${CMAKE_BINARY_DIR}) | |||||
| include_directories(${CMAKE_BINARY_DIR}/proto/ge) | |||||
| set(PROTO_LIST | |||||
| "${GE_CODE_DIR}/metadef/proto/om.proto" | |||||
| "${GE_CODE_DIR}/metadef/proto/task.proto" | |||||
| ) | |||||
| protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) | |||||
| set(SRCS | |||||
| # "${GE_CODE_DIR}/src/ge/common/util.cc" | |||||
| "src/omg_stub.cc" | |||||
| ) | |||||
| add_library(omg_stub SHARED ${SRCS} ${PROTO_SRCS} ${PROTO_HDRS}) | |||||
| target_compile_definitions(omg_stub PRIVATE | |||||
| google=ascend_private | |||||
| ) | |||||
| target_link_libraries(omg_stub PRIVATE | |||||
| $<BUILD_INTERFACE:intf_pub> | |||||
| -Wl,--no-as-needed | |||||
| ascend_protobuf | |||||
| -Wl,--as-needed | |||||
| c_sec | |||||
| json | |||||
| ) | |||||
| @@ -1,878 +0,0 @@ | |||||
| /** | |||||
| * Copyright 2019-2020 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 <map> | |||||
| #include <fstream> | |||||
| #include <unordered_map> | |||||
| #include <google/protobuf/io/coded_stream.h> | |||||
| #include <google/protobuf/io/zero_copy_stream_impl.h> | |||||
| #include "mmpa/mmpa_api.h" | |||||
| #include "common/debug/log.h" | |||||
| #include "common/debug/memory_dumper.h" | |||||
| #include "common/types.h" | |||||
| #include "common/util.h" | |||||
| #include "common/string_util.h" | |||||
| #include "common/properties_manager.h" | |||||
| #include "common/model_parser/base.h" | |||||
| #include "graph/model.h" | |||||
| #include "cce/dnn.h" | |||||
| #include "ge/ge_api_types.h" | |||||
| #include "framework/common/ge_types.h" | |||||
| #include "graph/utils/op_desc_utils.h" | |||||
| #include "common/profiling/profiling_manager.h" | |||||
| using domi::domiTensorFormat_t; | |||||
| using namespace cce; | |||||
| using namespace ge; | |||||
| struct PROC_PARAM { | |||||
| uint8_t *model_name; | |||||
| // ISV Ek buffer | |||||
| uint8_t *model_key; | |||||
| uint32_t model_key_len; | |||||
| // ISV root certificate buffer | |||||
| uint8_t *root_cert; | |||||
| uint32_t root_cert_len; | |||||
| // ISV private key buffer | |||||
| uint8_t *pri_key; | |||||
| uint32_t pri_key_len; | |||||
| // Raw AI Module Image buffer | |||||
| uint8_t *ai_image; | |||||
| uint32_t ai_image_len; | |||||
| // ISV HW key buffer | |||||
| uint8_t *hw_key; | |||||
| uint32_t hw_key_len; | |||||
| }; | |||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| using namespace ge; | |||||
| namespace { | |||||
| const char FMK_STATUS_FILE_DIR_ENV[] = "FMK_STATUS_FILE_DIR"; | |||||
| const char JOBSTATE_FILE_NAME[] = "jobstateupdate_framework"; | |||||
| const char HCOM_DETECT_FILE_NAME[] = "hcom_detection_result"; | |||||
| const char FILE_SEPARATE[] = "/"; | |||||
| } // namespace | |||||
| #ifdef __cplusplus | |||||
| } | |||||
| #endif | |||||
| namespace ge { | |||||
| struct GeModelPartition { | |||||
| ModelPartitionType type_ = MODEL_DEF; | |||||
| uint8_t *data_ = nullptr; | |||||
| size_t size_ = 0; | |||||
| GeModelPartition() = default; | |||||
| GeModelPartition(const GeModelPartition &partition){}; | |||||
| GeModelPartition &operator=(const GeModelPartition &partition) = delete; | |||||
| ~GeModelPartition() { | |||||
| if (data_ != nullptr) { | |||||
| delete[] data_; | |||||
| data_ = nullptr; | |||||
| } | |||||
| } | |||||
| Status SetData(uint8_t *data, size_t size) { | |||||
| size_ = size; | |||||
| data_ = new (std::nothrow) uint8_t[size](); | |||||
| errno_t err; | |||||
| err = memcpy_s(data_, size_, data, size); | |||||
| if (err) { | |||||
| GELOGE(ge::FAILED, "[GeModel Partition] Error occur when copy GeModel Partition data."); | |||||
| return FAILED; | |||||
| } | |||||
| return SUCCESS; | |||||
| } | |||||
| Status SetType(ModelPartitionType type) { | |||||
| type_ = type; | |||||
| return SUCCESS; | |||||
| } | |||||
| }; | |||||
| struct OmFileContext { | |||||
| vector<GeModelPartition> partition_datas_; | |||||
| vector<char> partition_table_; | |||||
| uint32_t model_data_len_; | |||||
| }; | |||||
| class SubGraphInfo; | |||||
| using SubGraphInfoPtr = std::shared_ptr<ge::SubGraphInfo>; | |||||
| using GeModelPartitionPtr = std::shared_ptr<GeModelPartition>; | |||||
| using ModelPtr = std::shared_ptr<ge::Model>; | |||||
| class GeModel { | |||||
| public: | |||||
| explicit GeModel(const ModelPtr &model_ptr); | |||||
| ~GeModel() = default; | |||||
| GeModel(const GeModel &other) = delete; | |||||
| GeModel &operator=(const GeModel &other) = delete; | |||||
| ModelPtr GetModelPtr() const; | |||||
| Status AddPartition(uint8_t *data, size_t size, ModelPartitionType type); | |||||
| Status GetPartition(ModelPartitionType type, GeModelPartitionPtr &partition); | |||||
| uint8_t GetPlatformType() const; | |||||
| void SetPlatformType(const uint8_t platform_type) { platform_type_ = platform_type; } | |||||
| private: | |||||
| std::map<ModelPartitionType, GeModelPartitionPtr> partitions_; | |||||
| ModelPtr model_ = nullptr; | |||||
| uint8_t platform_type_ = {0}; | |||||
| }; | |||||
| using GeModelPtr = std::shared_ptr<ge::GeModel>; | |||||
| GeModel::GeModel(const ModelPtr &model_ptr) { this->model_ = model_ptr; } | |||||
| ModelPtr GeModel::GetModelPtr() const { return this->model_; } | |||||
| uint8_t GeModel::GetPlatformType() const { return platform_type_; } | |||||
| Status GeModel::AddPartition(uint8_t *data, size_t size, ModelPartitionType type) { | |||||
| if (size == 0) { | |||||
| return FAILED; | |||||
| } | |||||
| if (data == nullptr) { | |||||
| return FAILED; | |||||
| } | |||||
| auto iter = partitions_.find(type); | |||||
| if (iter != partitions_.end()) { | |||||
| return FAILED; | |||||
| } | |||||
| GeModelPartitionPtr partition = nullptr; | |||||
| GE_MAKE_SHARED(partition = std::make_shared<ge::GeModelPartition>(), return FAILED); | |||||
| Status ret = partition->SetType(type); | |||||
| if (ret != SUCCESS) { | |||||
| return FAILED; | |||||
| } | |||||
| ret = partition->SetData(data, size); | |||||
| if (ret != SUCCESS) { | |||||
| return FAILED; | |||||
| } | |||||
| partitions_.insert(std::pair<ModelPartitionType, GeModelPartitionPtr>(type, partition)); | |||||
| return SUCCESS; | |||||
| } | |||||
| Status GeModel::GetPartition(ModelPartitionType type, GeModelPartitionPtr &partition) { | |||||
| auto iter = partitions_.find(type); | |||||
| if (iter == partitions_.end()) { | |||||
| return FAILED; | |||||
| } | |||||
| partition = iter->second; | |||||
| return SUCCESS; | |||||
| } | |||||
| class OmFileSaveHelper { | |||||
| public: | |||||
| OmFileSaveHelper(); | |||||
| ~OmFileSaveHelper(); | |||||
| vector<GeModelPartition> &GetModelPartitions(); | |||||
| ModelPartitionTable *GetPartitionTable(); | |||||
| ModelFileHeader model_header_; | |||||
| ModelFileHeader &GetModelFileHeader() { return model_header_; } | |||||
| void AddPartition(GeModelPartition &partition); | |||||
| private: | |||||
| OmFileContext context_; | |||||
| }; | |||||
| OmFileSaveHelper::OmFileSaveHelper() {} | |||||
| OmFileSaveHelper::~OmFileSaveHelper() {} | |||||
| vector<GeModelPartition> &OmFileSaveHelper::GetModelPartitions() { | |||||
| static std::vector<GeModelPartition> tmp; | |||||
| return tmp; | |||||
| } | |||||
| ModelPartitionTable *OmFileSaveHelper::GetPartitionTable() { return nullptr; } | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void OmFileSaveHelper::AddPartition(GeModelPartition &partition) { | |||||
| context_.partition_datas_.push_back(partition); | |||||
| context_.model_data_len_ += partition.size_; | |||||
| } | |||||
| class ModelBuilder { | |||||
| public: | |||||
| ModelBuilder(ge::ComputeGraphPtr compute_graph, const std::vector<SubGraphInfoPtr> &subgraphs, | |||||
| const std::map<std::string, int> &stream_max_parallel_num, bool hcom_parallel, int mode); | |||||
| virtual ~ModelBuilder(); | |||||
| Status BuildModel(ge::Model &model_def); | |||||
| Status SaveWeightsToModel(ge::Model &model); | |||||
| Status SaveDataToModel(ge::Model &model, ge::GeModel &ge_model); | |||||
| Status PreBuildModel(); | |||||
| Status BuildModelForGetTask(ge::Model &model_def); | |||||
| ge::Buffer GetWeightBuffer() const; | |||||
| void SetModelVersion(ge::Model &model_def); | |||||
| public: | |||||
| ge::Buffer weight_buffer_; | |||||
| }; | |||||
| ModelBuilder::ModelBuilder(ge::ComputeGraphPtr compute_graph, const std::vector<SubGraphInfoPtr> &subgraphs, | |||||
| const std::map<std::string, int> &stream_max_parallel_num, bool hcom_parallel, int mode) { | |||||
| weight_buffer_ = ge::Buffer(4100000); | |||||
| } | |||||
| ModelBuilder::~ModelBuilder() {} | |||||
| Status ModelBuilder::SaveWeightsToModel(ge::Model &model) { return SUCCESS; } | |||||
| Status ModelBuilder::BuildModel(ge::Model &model_def) { return SUCCESS; } | |||||
| Status ModelBuilder::SaveDataToModel(ge::Model &model, ge::GeModel &ge_model) { return SUCCESS; } | |||||
| Status ModelBuilder::PreBuildModel() { return SUCCESS; } | |||||
| Status ModelBuilder::BuildModelForGetTask(ge::Model &model_def) { return SUCCESS; } | |||||
| void ModelBuilder::SetModelVersion(ge::Model &model_def) { return; } | |||||
| ge::Buffer ModelBuilder::GetWeightBuffer() const { return ge::Buffer(4100000); } | |||||
| } // namespace ge | |||||
| using ProcParam = struct PROC_PARAM; | |||||
| namespace ge { | |||||
| #include <iostream> | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NCHW_DIM_N = 0; | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NCHW_DIM_C = 1; | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NCHW_DIM_H = 2; | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NCHW_DIM_W = 3; | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NHWC_DIM_N = 0; | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NHWC_DIM_H = 1; | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NHWC_DIM_W = 2; | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NHWC_DIM_C = 3; | |||||
| const uint32_t MODEL_FILE_MAGIC_NUM = 0x444F4D49; | |||||
| const uint32_t MODEL_FILE_HEAD_LEN = 256; | |||||
| const uint32_t MODEL_VERSION = 0x10000000; | |||||
| const int MAX_FILE_SIZE_LIMIT = INT_MAX; | |||||
| bool FC_WEIGHT_COMPRESS_FLAG = false; | |||||
| bool ReadBytesFromBinaryFile(const char *file_name, char **buffer, int &length) { | |||||
| length = 10; | |||||
| *buffer = new (std::nothrow) char[10](); | |||||
| GE_CHK_BOOL_TRUE_EXEC_RET_STATUS(*buffer == nullptr, false, "new an object failed."); | |||||
| return true; | |||||
| } | |||||
| bool ReadProtoFromText(const char *file, google::protobuf::Message *message) { | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((nullptr == file || nullptr == message), return false, | |||||
| "incorrect parameter. nullptr == file || nullptr == message"); | |||||
| string real_path = RealPath(file); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(real_path.empty(), return false, "proto file path '%s' not valid", file); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(GetFileLength(real_path.c_str()) == -1, return false, "file size not valid."); | |||||
| std::ifstream fs(real_path.c_str(), std::ifstream::in); | |||||
| if (!fs.is_open()) { | |||||
| GELOGE(ge::FAILED, "proto file '%s' open fail.", file); | |||||
| return false; | |||||
| } | |||||
| google::protobuf::io::IstreamInputStream input(&fs); | |||||
| bool ret = google::protobuf::TextFormat::Parse(&input, message); | |||||
| GE_IF_BOOL_EXEC(ret != true, | |||||
| GELOGI("call [google::protobuf::TextFormat::Parse] func ret fail, please check your text file.")); | |||||
| fs.close(); | |||||
| return ret; | |||||
| } | |||||
| uint64_t GetCurrentTimestap() { return 0; } | |||||
| // get length of file | |||||
| long GetFileLength(const std::string &input_file) { | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(input_file.empty(), return -1, "input_file path is null."); | |||||
| string real_path = RealPath(input_file.c_str()); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(real_path.empty(), return -1, "input_file path '%s' not valid", input_file.c_str()); | |||||
| unsigned long long file_length = 0; | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(mmGetFileSize(input_file.c_str(), &file_length) != EN_OK, return -1, | |||||
| "open file failed."); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file_length <= 0), return -1, "file length <= 0, not valid."); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(file_length > MAX_FILE_SIZE_LIMIT, return -1, "file size %llu is out of limit: %d.", | |||||
| file_length, MAX_FILE_SIZE_LIMIT); | |||||
| return file_length; | |||||
| } | |||||
| string RealPath(const char *path) { | |||||
| string s = path; | |||||
| if (s.size() >= PATH_MAX) { | |||||
| return ""; | |||||
| } | |||||
| if (s == "." || s == "1") { | |||||
| return path; | |||||
| // for insert_aipp_op unittest | |||||
| } else if (s.substr(0, 3) == "llt") { | |||||
| return path; | |||||
| } else { | |||||
| return "22"; | |||||
| } | |||||
| } | |||||
| bool CheckInputPathValid(const string &file_path) { return true; } | |||||
| bool ReadProtoFromArray(const void *data, int size, Message *proto) { return true; } | |||||
| struct ModelPartition { | |||||
| ModelPartitionType type; | |||||
| uint8_t *data = 0; | |||||
| uint32_t size = 0; | |||||
| }; | |||||
| class InsertNewOpUtil { | |||||
| public: | |||||
| InsertNewOpUtil(); | |||||
| ~InsertNewOpUtil(); | |||||
| Status InsertNewOps(const ComputeGraphPtr &graph); | |||||
| Status InsertAippOps(ge::ComputeGraphPtr graph, std::string &aipp_config_path); | |||||
| Status Parse(const char *conf_path); | |||||
| }; | |||||
| InsertNewOpUtil::InsertNewOpUtil() {} | |||||
| Status InsertNewOpUtil::InsertNewOps(const ComputeGraphPtr &graph) { return SUCCESS; } | |||||
| Status InsertNewOpUtil::InsertAippOps(ge::ComputeGraphPtr graph, std::string &aipp_config_path) { return SUCCESS; } | |||||
| Status InsertNewOpUtil::Parse(const char *conf_path) { return SUCCESS; } | |||||
| Status InitOME() { return SUCCESS; } | |||||
| class GraphOptimizer { | |||||
| public: | |||||
| Status Optimize(); | |||||
| Status OptimizeAfterCal(); | |||||
| Status AdjustDataOpDesc(); | |||||
| Status InsertTransOp(); | |||||
| Status FusionFmkop(); | |||||
| Status Optimize4Cloud(); | |||||
| Status Optimize4FlowCtrl(); | |||||
| Status OptimizeBeforeBuild(); | |||||
| }; | |||||
| Status GraphOptimizer::Optimize() { return SUCCESS; } | |||||
| Status Init(Options options) { return SUCCESS; } | |||||
| Status Shutdown(Options options) { return SUCCESS; } | |||||
| class Session { | |||||
| public: | |||||
| // singleton | |||||
| static Session *Instance(); | |||||
| const uint32_t &DeviceId() const; | |||||
| }; | |||||
| const uint32_t &Session::DeviceId() const { return 0; } | |||||
| Session *Session::Instance() { | |||||
| static Session instance; | |||||
| return &instance; | |||||
| } | |||||
| struct OmgContext { | |||||
| domiTensorFormat_t format; | |||||
| // get input format from cmd | |||||
| std::unordered_map<std::string, domiTensorFormat_t> input_nodes_format_map; | |||||
| std::vector<domiTensorFormat_t> output_formats; | |||||
| // user-designate input dims | |||||
| std::vector<std::pair<std::string, std::vector<int64_t>>> user_input_dims; | |||||
| // global input dims | |||||
| std::map<std::string, std::vector<int64_t>> input_dims; | |||||
| // solve rename op e.g: Detectionoutput:SsdDetectiontOutput | |||||
| std::map<std::string, std::string> op_conf_map; | |||||
| // save output node of network: key is op name, value = index, index is the output index of op | |||||
| std::map<std::string, std::vector<int32_t>> out_nodes_map; | |||||
| // user-designate out nodes (this is used for determing the orders) | |||||
| std::vector<std::pair<std::string, int32_t>> user_out_nodes; | |||||
| // save the path of cutsom_aicpu | |||||
| std::vector<std::string> aicpu_op_run_paths; | |||||
| // save ddk | |||||
| std::string ddk_version; | |||||
| // save format | |||||
| domiTensorFormat_t net_format; | |||||
| FrameworkType type; | |||||
| // RunMode run_mode; | |||||
| bool train_flag = false; | |||||
| std::string output_type; | |||||
| /// save the name of network | |||||
| /// eg:faster-rcnn, based on FirstStageProcessor after scope_fusion is faster-rcnn | |||||
| /// then reorder conv+reshape of FirstStageBoxPredictor/BoxEncodingPredictor | |||||
| /// need to delete op of reshape | |||||
| std::string net_name; | |||||
| }; | |||||
| } // namespace ge | |||||
| namespace domi { | |||||
| ge::OmgContext &GetContext() { | |||||
| static ge::OmgContext tmp; | |||||
| return tmp; | |||||
| } | |||||
| } // namespace domi | |||||
| namespace ge { | |||||
| class OpUtils { | |||||
| public: | |||||
| static Status InitTensorDescriptor(const GeTensorDesc &tensor, ccTensorDescriptor_t &cc_tensor); | |||||
| static Status InitTensorDescriptor(int32_t format, int32_t data_type, const std::vector<int64_t> &dim, | |||||
| ccTensorDescriptor_t &cc_tensor, uint32_t real_dim_cnt); | |||||
| static void DestroyTensorDescriptor(ccTensorDescriptor_t &cc_tensor); | |||||
| }; | |||||
| Status OpUtils::InitTensorDescriptor(const GeTensorDesc &tensor, ccTensorDescriptor_t &cc_tensor) { | |||||
| ccCreatePoolingMaskDescriptor(&cc_tensor); | |||||
| return SUCCESS; | |||||
| } | |||||
| Status OpUtils::InitTensorDescriptor(int32_t format, int32_t data_type, const std::vector<int64_t> &dim, | |||||
| ccTensorDescriptor_t &cc_tensor, uint32_t real_dim_cnt) { | |||||
| Status ret = SUCCESS; | |||||
| return ret; | |||||
| } | |||||
| class FileSaver { | |||||
| public: | |||||
| Status SaveToFile(const string &file_path, ModelFileHeader &model_file_header, | |||||
| ModelPartitionTable &model_partition_table, const std::vector<ModelPartition> &partition_datas); | |||||
| Status SaveToFileWithEncrypt(const std::string file_path, const ProcParam proc_param, | |||||
| const ModelFileHeader *model_file_header, bool check_sum); | |||||
| }; | |||||
| Status FileSaver::SaveToFile(const string &file_path, ModelFileHeader &model_file_header, | |||||
| ModelPartitionTable &model_partition_table, | |||||
| const std::vector<ModelPartition> &partition_datas) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status FileSaver::SaveToFileWithEncrypt(const std::string file_path, const ProcParam proc_param, | |||||
| const ModelFileHeader *model_file_header, bool check_sum) { | |||||
| return SUCCESS; | |||||
| } | |||||
| class ModelSaver : public FileSaver {}; | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void OpUtils::DestroyTensorDescriptor( | |||||
| ccTensorDescriptor_t &cc_tensor) { | |||||
| if (nullptr != cc_tensor) { | |||||
| ccStatus_t ret = ccDestroyTensorDescriptor(&cc_tensor); | |||||
| GE_LOGE_IF(CC_STATUS_SUCCESS != ret, "ccDestroyTensorDescriptor failed. ret = %d", ret); | |||||
| cc_tensor = nullptr; | |||||
| } | |||||
| } | |||||
| } // namespace ge | |||||
| namespace domi { | |||||
| class OpRegistrationData {}; | |||||
| class OpRegistry { | |||||
| public: | |||||
| static OpRegistry *Instance(); | |||||
| std::vector<OpRegistrationData> registration_datas; | |||||
| ImplyType GetImplyType(const std::string &op_type); | |||||
| void GetOpTypeByImplyType(std::vector<std::string> &vec_op_type, const ImplyType &imply_type); | |||||
| }; | |||||
| OpRegistry *OpRegistry::Instance() { | |||||
| static OpRegistry instance; | |||||
| return &instance; | |||||
| } | |||||
| void OpRegistry::GetOpTypeByImplyType(std::vector<std::string> &vec_op_type, const ImplyType &imply_type) { | |||||
| if (imply_type == ImplyType::AI_CPU) { | |||||
| vec_op_type.push_back("square"); | |||||
| } | |||||
| } | |||||
| class OpRegistrationTbe { | |||||
| public: | |||||
| static OpRegistrationTbe *Instance(); | |||||
| bool Finalize(OpRegistrationData ®_data, bool is_train); | |||||
| }; | |||||
| OpRegistrationTbe *OpRegistrationTbe::Instance() { | |||||
| static OpRegistrationTbe instance; | |||||
| return &instance; | |||||
| } | |||||
| bool OpRegistrationTbe::Finalize(OpRegistrationData ®_data, bool is_train) { return true; } | |||||
| } // namespace domi | |||||
| namespace ge { | |||||
| class GraphPrepare { | |||||
| private: | |||||
| Status OptimizeForPreprocess(ge::ComputeGraphPtr &compute_graph); | |||||
| }; | |||||
| Status GraphPrepare::OptimizeForPreprocess(ge::ComputeGraphPtr &compute_graph) { return SUCCESS; } | |||||
| } // namespace ge | |||||
| namespace ge { | |||||
| Status GetOriginalType(const ge::NodePtr &node, string &type) { | |||||
| type = node->GetType(); | |||||
| GE_IF_BOOL_EXEC(type != FRAMEWORKOP, return SUCCESS); | |||||
| ge::AttrUtils::GetStr(node->GetOpDesc(), "original_type", type); | |||||
| return SUCCESS; | |||||
| } | |||||
| Status SetCycleEvent(const ge::NodePtr &node) { return SUCCESS; } | |||||
| Status SetStreamLabel(const ge::NodePtr &node, const std::string &label) { | |||||
| GE_CHECK_NOTNULL(node); | |||||
| OpDescPtr tmp_desc = AttrUtils::CloneOpDesc(node->GetOpDesc()); | |||||
| GE_CHECK_NOTNULL(tmp_desc); | |||||
| if (!AttrUtils::SetStr(tmp_desc, "_stream_label", label)) { | |||||
| GELOGE(ge::FAILED, "Op :%s set ATTR_NAME_STREAM_LABEL failed", node->GetName().c_str()); | |||||
| return FAILED; | |||||
| } | |||||
| return SUCCESS; | |||||
| } | |||||
| Status SetActiveLabelList(const ge::NodePtr &node, const std::vector<std::string> &label) { | |||||
| GE_CHECK_NOTNULL(node); | |||||
| OpDescPtr tmp_desc = node->GetOpDesc(); | |||||
| GE_CHECK_NOTNULL(tmp_desc); | |||||
| // add list of active_label | |||||
| if (!AttrUtils::SetListStr(tmp_desc, "_active_label", label)) { | |||||
| GELOGE(ge::FAILED, "Op: %s set ATTR_NAME_ACTIVE_LABEL_LIST failed", node->GetName().c_str()); | |||||
| return FAILED; | |||||
| } | |||||
| return SUCCESS; | |||||
| } | |||||
| Status SetSwitchBranchNodeLabel(const ge::NodePtr &node, const std::string &branch_label) { | |||||
| GE_CHECK_NOTNULL(node); | |||||
| OpDescPtr tmp_desc = node->GetOpDesc(); | |||||
| GE_CHECK_NOTNULL(tmp_desc); | |||||
| // add branch_label of switch | |||||
| if (!AttrUtils::SetStr(tmp_desc, "_switch_branch_node_label", branch_label)) { | |||||
| GELOGE(ge::FAILED, "Op :%s set ATTR_NAME_SWITCH_BRANCH_NODE_LABEL failed", node->GetName().c_str()); | |||||
| return FAILED; | |||||
| } | |||||
| return SUCCESS; | |||||
| } | |||||
| Status SetSwitchTrueBranchFlag(const ge::NodePtr &node, bool value) { | |||||
| GE_CHECK_NOTNULL(node); | |||||
| OpDescPtr tmp_desc = node->GetOpDesc(); | |||||
| GE_CHECK_NOTNULL(tmp_desc); | |||||
| // add switch_true_branch_flag | |||||
| if (!AttrUtils::SetBool(tmp_desc, "_switch_true_branch_flag", value)) { | |||||
| GELOGE(ge::FAILED, "Op :%s set ATTR_NAME_SWITCH_TRUE_BRANCH_FLAG failed", node->GetName().c_str()); | |||||
| return FAILED; | |||||
| } | |||||
| return SUCCESS; | |||||
| } | |||||
| Status SetOriginalNodeName(const ge::NodePtr &node, const std::string &orig_name) { | |||||
| GE_CHECK_NOTNULL(node); | |||||
| OpDescPtr tmp_desc = node->GetOpDesc(); | |||||
| GE_CHECK_NOTNULL(tmp_desc); | |||||
| // record original_node_name | |||||
| if (!AttrUtils::SetStr(tmp_desc, "_original_node_name", orig_name)) { | |||||
| GELOGE(ge::FAILED, "Op :%s set ATTR_NAME_ORIG_NODE_NAME failed", node->GetName().c_str()); | |||||
| return FAILED; | |||||
| } | |||||
| return SUCCESS; | |||||
| } | |||||
| Status SetCyclicDependenceFlag(const ge::NodePtr &node) { | |||||
| GE_CHECK_NOTNULL(node); | |||||
| OpDescPtr tmp_desc = node->GetOpDesc(); | |||||
| GE_CHECK_NOTNULL(tmp_desc); | |||||
| // add cyclic_dependence_flag | |||||
| if (!AttrUtils::SetBool(tmp_desc, "_cyclic_dependence_flag", true)) { | |||||
| GELOGE(ge::FAILED, "Op :%s set ATTR_NAME_CYCLIC_DEPENDENCE_FLAG failed", node->GetName().c_str()); | |||||
| return FAILED; | |||||
| } | |||||
| return SUCCESS; | |||||
| } | |||||
| Status SetNextIteration(const ge::NodePtr &node, const std::string &next) { | |||||
| GE_CHECK_NOTNULL(node); | |||||
| OpDescPtr tmp_desc = node->GetOpDesc(); | |||||
| GE_CHECK_NOTNULL(tmp_desc); | |||||
| if (!AttrUtils::SetStr(tmp_desc, "_next_iteration_node", next)) { | |||||
| GELOGE(ge::FAILED, "Op: %s set ATTR_NAME_NEXT_ITERATION failed", node->GetName().c_str()); | |||||
| return FAILED; | |||||
| } | |||||
| return SUCCESS; | |||||
| } | |||||
| } // namespace ge | |||||
| namespace cce { | |||||
| bool ccGetFuncState(ccFuncParamType_t type) { return true; } | |||||
| } // namespace cce | |||||
| namespace ge { | |||||
| Status UnloadModel(uint32_t model_id) { return SUCCESS; } | |||||
| Status GetInputOutputDescInfo(uint32_t model_id, vector<InputOutputDescInfo> &input_desc, | |||||
| vector<InputOutputDescInfo> &output_desc) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status DataInput(const InputData *input_data, OutputData *output_data) { return SUCCESS; } | |||||
| /* | |||||
| class ModelManager { | |||||
| public: | |||||
| static std::shared_ptr<ModelManager> GetInstance(); | |||||
| static void FinalizeForPtr(ModelManager *) {} | |||||
| Status DataInputTensor(uint32_t model_id, const std::vector<ge::TensorInfo> &inputs, | |||||
| std::vector<ge::TensorInfo> &outputs); | |||||
| Status DataInput(const InputData &input_data, OutputData &output_data); | |||||
| Status GetInputOutputDescInfo(const uint32_t model_id, std::vector<InputOutputDescInfo> &input_desc, | |||||
| std::vector<InputOutputDescInfo> &output_desc); | |||||
| Status GetInputOutputDescInfo(const uint32_t model_id, std::vector<InputOutputDescInfo> &input_desc, | |||||
| std::vector<InputOutputDescInfo> &output_desc, std::vector<uint32_t> &input_formats, | |||||
| std::vector<uint32_t> &output_formats); | |||||
| Status GetInputOutputDescInfoForZeroCopy(const uint32_t model_id, std::vector<InputOutputDescInfo> &input_desc, | |||||
| std::vector<InputOutputDescInfo> &output_desc, | |||||
| std::vector<uint32_t> &input_formats, std::vector<uint32_t> &output_formats); | |||||
| Status Stop(uint32_t model_id); | |||||
| Status Unload(uint32_t model_id); | |||||
| Status LoadModelOnline(uint32_t &model_id, std::shared_ptr<ge::Model> &model, | |||||
| std::shared_ptr<ModelListener> listener); | |||||
| Status Start(uint32_t model_id); | |||||
| Status GetMaxUsedMemory(const uint32_t model_id, uint64_t &max_size); | |||||
| Status LoadModelOffline(uint32_t &model_id, const ModelData &model, std::shared_ptr<ModelListener> listener = nullptr, | |||||
| void *dev_ptr = nullptr, size_t mem_size = 0, void *weight_ptr = nullptr, | |||||
| size_t weight_size = 0); | |||||
| Status LoadModelWithQ(uint32_t &model_id, const ModelData &model_data, const std::vector<uint32_t> &input_queue_ids, | |||||
| const std::vector<uint32_t> &output_queue_ids); | |||||
| Status HandleCommand(const Command &command); | |||||
| Status ExecuteModel(uint32_t model_id, rtStream_t stream, bool async_mode, const InputData &input_data, | |||||
| OutputData &output_data); | |||||
| void DestroyAicpuSession(uint64_t session_id); | |||||
| }; | |||||
| void ModelManager::DestroyAicpuSession(uint64_t session_id) {} | |||||
| std::shared_ptr<ModelManager> ModelManager::GetInstance() { | |||||
| static std::shared_ptr<ModelManager> instance_ptr = | |||||
| shared_ptr<ModelManager>(new ModelManager(), ModelManager::FinalizeForPtr); | |||||
| return instance_ptr; | |||||
| } | |||||
| Status ModelManager::DataInputTensor(uint32_t model_id, const std::vector<ge::TensorInfo> &inputs, | |||||
| std::vector<ge::TensorInfo> &outputs) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status ModelManager::DataInput(const InputData &input_data, OutputData &output_data) { return SUCCESS; } | |||||
| Status ModelManager::GetInputOutputDescInfo(const uint32_t model_id, std::vector<InputOutputDescInfo> &input_desc, | |||||
| std::vector<InputOutputDescInfo> &output_desc, | |||||
| std::vector<uint32_t> &input_formats, | |||||
| std::vector<uint32_t> &output_formats) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status ModelManager::GetInputOutputDescInfo(const uint32_t model_id, std::vector<InputOutputDescInfo> &input_desc, | |||||
| std::vector<InputOutputDescInfo> &output_desc) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status ModelManager::GetInputOutputDescInfoForZeroCopy(const uint32_t model_id, | |||||
| std::vector<InputOutputDescInfo> &input_desc, | |||||
| std::vector<InputOutputDescInfo> &output_desc, | |||||
| std::vector<uint32_t> &input_formats, | |||||
| std::vector<uint32_t> &output_formats) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status ModelManager::Stop(uint32_t model_id) { return SUCCESS; } | |||||
| Status ModelManager::Unload(uint32_t model_id) { return SUCCESS; } | |||||
| Status ModelManager::LoadModelOnline(uint32_t &model_id, std::shared_ptr<ge::Model> &model, | |||||
| std::shared_ptr<ModelListener> listener) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status ModelManager::Start(uint32_t model_id) { return SUCCESS; } | |||||
| Status ModelManager::GetMaxUsedMemory(const uint32_t model_id, uint64_t &max_size) { return SUCCESS; } | |||||
| Status ModelManager::LoadModelOffline(uint32_t &model_id, const ModelData &model, shared_ptr<ModelListener> listener, | |||||
| void *dev_ptr, size_t mem_size, void *weight_ptr, size_t weight_size) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status ModelManager::LoadModelWithQ(uint32_t &model_id, const ModelData &model_data, | |||||
| const std::vector<uint32_t> &input_queue_ids, | |||||
| const std::vector<uint32_t> &output_queue_ids) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status ModelManager::HandleCommand(const Command &command) { return SUCCESS; } | |||||
| Status ModelManager::ExecuteModel(uint32_t model_id, rtStream_t stream, bool async_mode, const InputData &input_data, | |||||
| OutputData &output_data) { | |||||
| return SUCCESS; | |||||
| } | |||||
| */ | |||||
| } // namespace ge | |||||
| namespace ge { | |||||
| enum JobState { | |||||
| JOBSTATE_WAITING = 1, | |||||
| JOBSTATE_RUNNING, | |||||
| JOBSTATE_KILLING, | |||||
| JOBSTATE_SUCCEED, | |||||
| JOBSTATE_FAILED, | |||||
| JOBSTATE_KILLED, | |||||
| JOBSTATE_UNKOWN | |||||
| }; | |||||
| enum JobSubState { | |||||
| JOBSUBSTATE_ENV_INIT = 201, | |||||
| JOBSUBSTATE_ENV_FIN, | |||||
| JOBSUBSTATE_RESOUCE_ALLOC, | |||||
| JOBSUBSTATE_MODEL_COMPILE, | |||||
| JOBSUBSTATE_GRAPH_PREPARE, | |||||
| JOBSUBSTATE_GRAPH_SPLIT, | |||||
| JOBSUBSTATE_GRAPH_OPTIMIZE, | |||||
| JOBSUBSTATE_GRAPH_BUILD, | |||||
| JOBSUBSTATE_GRAPH_LOAD, | |||||
| JOBSUBSTATE_GRAPH_EXEC, | |||||
| JOBSUBSTATE_GRAPH_UNLOAD, | |||||
| JOBSUBSTATE_OTHER | |||||
| }; | |||||
| enum ErrorModule { | |||||
| ERROR_MODULE_DRIVER = 0x01, | |||||
| ERROR_MODULE_RUNTIME = 0x04, | |||||
| ERROR_MODULE_CCE = 0x06, | |||||
| ERROR_MODULE_FMK = 0x08, | |||||
| ERROR_MODULE_HCCL = 0x12 | |||||
| }; | |||||
| class CsaInteract { | |||||
| public: | |||||
| CsaInteract &GetInstance(); | |||||
| void WriteErrorCode(uint32_t module_ret_errcode, ErrorModule error_module, JobSubState job_sub_state); | |||||
| void Init(int32_t dev_index, int64_t job_id); | |||||
| Status WriteJobState(JobState job_state, JobSubState job_sub_state = JOBSUBSTATE_OTHER, | |||||
| uint32_t module_ret_errcode = SUCCESS, ErrorModule error_module = ERROR_MODULE_FMK); | |||||
| // device index | |||||
| int32_t dev_index_; | |||||
| // job id | |||||
| int64_t job_id_; | |||||
| // is initialization complete | |||||
| bool is_init_; | |||||
| // current job state | |||||
| JobState curr_state_; | |||||
| // job state file | |||||
| std::string job_state_file_; | |||||
| // network connectivity detect file | |||||
| std::string hcom_detect_file_; | |||||
| // identification of internal errors that occurred during the training | |||||
| bool is_have_internal_error_; | |||||
| }; | |||||
| CsaInteract &CsaInteract::GetInstance() { | |||||
| static CsaInteract instance; | |||||
| return instance; | |||||
| } | |||||
| void CsaInteract::Init(int32_t dev_index, int64_t job_id) { | |||||
| if (!is_init_) { | |||||
| dev_index_ = dev_index; | |||||
| job_id_ = job_id; | |||||
| string csa_path_prefix; | |||||
| if (std::getenv(FMK_STATUS_FILE_DIR_ENV) != nullptr) { | |||||
| csa_path_prefix = std::getenv(FMK_STATUS_FILE_DIR_ENV); | |||||
| } | |||||
| if (!csa_path_prefix.empty()) { | |||||
| std::string job_state_file = csa_path_prefix + std::to_string(dev_index_) + FILE_SEPARATE + JOBSTATE_FILE_NAME; | |||||
| std::string hcom_detect_file = | |||||
| csa_path_prefix + std::to_string(dev_index_) + FILE_SEPARATE + HCOM_DETECT_FILE_NAME; | |||||
| job_state_file_ = RealPath(job_state_file.c_str()); | |||||
| hcom_detect_file_ = RealPath(hcom_detect_file.c_str()); | |||||
| } | |||||
| is_init_ = true; | |||||
| } | |||||
| } | |||||
| void CsaInteract::WriteErrorCode(uint32_t module_ret_errcode, ErrorModule error_module, JobSubState job_sub_state) {} | |||||
| } // namespace ge | |||||
| Status ModelParserBase::LoadFromFile(const char *model_path, const char *key, int32_t priority, | |||||
| ge::ModelData &model_data) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, uint32_t module_ret_errcode, | |||||
| ErrorModule error_module) { | |||||
| return SUCCESS; | |||||
| } | |||||
| namespace ge { | |||||
| static std::map<ge::DataType, uint32_t> data_type_to_length = { | |||||
| {DT_BOOL, sizeof(bool)}, {DT_INT64, sizeof(int64_t)}, {DT_UINT64, sizeof(int64_t)}, {DT_FLOAT, sizeof(float)}, | |||||
| {DT_INT32, sizeof(int32_t)}, {DT_UINT32, sizeof(int32_t)}, {DT_INT8, sizeof(char)}, {DT_UINT8, sizeof(char)}, | |||||
| {DT_INT16, sizeof(int16_t)}, {DT_UINT16, sizeof(int16_t)}, {DT_FLOAT16, sizeof(int16_t)}, {DT_DOUBLE, sizeof(double)}, | |||||
| }; | |||||
| class TypeUtils { | |||||
| public: | |||||
| static bool GetDataTypeLength(ge::DataType data_type, uint32_t &length); | |||||
| static bool CheckUint64MulOverflow(uint64_t a, uint32_t b); | |||||
| }; | |||||
| bool TypeUtils::GetDataTypeLength(ge::DataType data_type, uint32_t &length) { | |||||
| auto it = data_type_to_length.find(data_type); | |||||
| if (it != data_type_to_length.end()) { | |||||
| length = it->second; | |||||
| return true; | |||||
| } else { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| bool TypeUtils::CheckUint64MulOverflow(uint64_t a, uint32_t b) { | |||||
| // Not overflow | |||||
| if (a == 0) { | |||||
| return false; | |||||
| } | |||||
| if ((ULLONG_MAX / a) >= b) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| } // namespace ge | |||||
| @@ -27,8 +27,8 @@ rtError_t rtGetStreamId(rtStream_t stream, int32_t *stream_id) { | |||||
| } | } | ||||
| rtError_t rtCtxGetCurrent(rtContext_t *ctx) { | rtError_t rtCtxGetCurrent(rtContext_t *ctx) { | ||||
| int x = 1; | |||||
| *ctx = (void *)x; | |||||
| uintptr_t x = 1; | |||||
| *ctx = (rtContext_t *)x; | |||||
| return RT_ERROR_NONE; | return RT_ERROR_NONE; | ||||
| } | } | ||||
| @@ -163,7 +163,7 @@ rtError_t rtSetKernelReportCallback(rtKernelReportCallback callback) { | |||||
| rt_kernel_info.module_addr = (void *)100; | rt_kernel_info.module_addr = (void *)100; | ||||
| rt_kernel_info.module_size = 100; | rt_kernel_info.module_size = 100; | ||||
| rtStream_t stream; | |||||
| rtStream_t stream = nullptr; | |||||
| callback(stream, &rt_kernel_info); | callback(stream, &rt_kernel_info); | ||||
| return RT_ERROR_NONE; | return RT_ERROR_NONE; | ||||
| } | } | ||||
| @@ -200,7 +200,8 @@ rtError_t rtModelCreate(rtModel_t *model, uint32_t flag) { | |||||
| } | } | ||||
| rtError_t rtModelDestroy(rtModel_t model) { | rtError_t rtModelDestroy(rtModel_t model) { | ||||
| delete model; | |||||
| uint32_t *stub = static_cast<uint32_t *>(model); | |||||
| delete stub; | |||||
| return RT_ERROR_NONE; | return RT_ERROR_NONE; | ||||
| } | } | ||||
| @@ -135,6 +135,7 @@ set(COMMON_SRC_FILES | |||||
| "${GE_CODE_DIR}/ge/common/types.cc" | "${GE_CODE_DIR}/ge/common/types.cc" | ||||
| "${GE_CODE_DIR}/ge/common/fmk_error_codes.cc" | "${GE_CODE_DIR}/ge/common/fmk_error_codes.cc" | ||||
| "${GE_CODE_DIR}/ge/common/op/ge_op_utils.cc" | "${GE_CODE_DIR}/ge/common/op/ge_op_utils.cc" | ||||
| "${GE_CODE_DIR}/ge/common/context/ctx.cc" | |||||
| "${GE_CODE_DIR}/ge/graph/manager/util/variable_accelerate_ctrl.cc" | "${GE_CODE_DIR}/ge/graph/manager/util/variable_accelerate_ctrl.cc" | ||||
| "${GE_CODE_DIR}/ge/opskernel_manager/ops_kernel_manager.cc" | "${GE_CODE_DIR}/ge/opskernel_manager/ops_kernel_manager.cc" | ||||
| "${GE_CODE_DIR}/ge/generator/ge_generator.cc" | "${GE_CODE_DIR}/ge/generator/ge_generator.cc" | ||||
| @@ -163,7 +164,7 @@ set(COMMON_SRC_FILES | |||||
| "${GE_CODE_DIR}/ge/common/dump/dump_manager.cc" | "${GE_CODE_DIR}/ge/common/dump/dump_manager.cc" | ||||
| "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" | "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" | ||||
| "${GE_CODE_DIR}/ge/model/ge_root_model.cc" | "${GE_CODE_DIR}/ge/model/ge_root_model.cc" | ||||
| "${GE_CODE_DIR}/ge/common/model_parser/base.cc" | |||||
| "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" | |||||
| "${GE_CODE_DIR}/ge/graph/load/model_manager/data_dumper.cc" | "${GE_CODE_DIR}/ge/graph/load/model_manager/data_dumper.cc" | ||||
| "${GE_CODE_DIR}/ge/graph/manager/graph_manager.cc" | "${GE_CODE_DIR}/ge/graph/manager/graph_manager.cc" | ||||
| "${GE_CODE_DIR}/ge/common/dump/dump_server.cc" | "${GE_CODE_DIR}/ge/common/dump/dump_server.cc" | ||||
| @@ -393,14 +394,13 @@ set(DISTINCT_GRAPH_LOAD_SRC_FILES | |||||
| "${GE_CODE_DIR}/ge/graph/manager/util/debug.cc" | "${GE_CODE_DIR}/ge/graph/manager/util/debug.cc" | ||||
| "${GE_CODE_DIR}/ge/common/properties_manager.cc" | "${GE_CODE_DIR}/ge/common/properties_manager.cc" | ||||
| "${GE_CODE_DIR}/ge/common/profiling/profiling_manager.cc" | "${GE_CODE_DIR}/ge/common/profiling/profiling_manager.cc" | ||||
| "${GE_CODE_DIR}/ge/common/model_parser/base.cc" | |||||
| "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" | |||||
| "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" | "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" | ||||
| "${GE_CODE_DIR}/ge/common/util.cc" | "${GE_CODE_DIR}/ge/common/util.cc" | ||||
| "${GE_CODE_DIR}/ge/graph/load/model_manager/cpu_queue_schedule.cc" | "${GE_CODE_DIR}/ge/graph/load/model_manager/cpu_queue_schedule.cc" | ||||
| "${GE_CODE_DIR}/ge/graph/load/model_manager/data_dumper.cc" | "${GE_CODE_DIR}/ge/graph/load/model_manager/data_dumper.cc" | ||||
| "${GE_CODE_DIR}/ge/graph/load/model_manager/data_inputer.cc" | "${GE_CODE_DIR}/ge/graph/load/model_manager/data_inputer.cc" | ||||
| "${GE_CODE_DIR}/ge/graph/load/model_manager/davinci_model.cc" | "${GE_CODE_DIR}/ge/graph/load/model_manager/davinci_model.cc" | ||||
| "${GE_CODE_DIR}/ge/graph/load/model_manager/davinci_model_parser.cc" | |||||
| "${GE_CODE_DIR}/ge/graph/load/model_manager/model_manager.cc" | "${GE_CODE_DIR}/ge/graph/load/model_manager/model_manager.cc" | ||||
| "${GE_CODE_DIR}/ge/graph/load/model_manager/model_utils.cc" | "${GE_CODE_DIR}/ge/graph/load/model_manager/model_utils.cc" | ||||
| "${GE_CODE_DIR}/ge/graph/load/model_manager/tbe_handle_store.cc" | "${GE_CODE_DIR}/ge/graph/load/model_manager/tbe_handle_store.cc" | ||||
| @@ -458,7 +458,7 @@ set(GRAPH_BUILD_COMMON_SRC_FILES | |||||
| "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" | "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" | ||||
| "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" | "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" | ||||
| "${GE_CODE_DIR}/ge/common/thread_pool.cc" | "${GE_CODE_DIR}/ge/common/thread_pool.cc" | ||||
| "${GE_CODE_DIR}/ge/common/model_parser/base.cc" | |||||
| "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" | |||||
| "${GE_CODE_DIR}/ge/graph/build/run_context.cc" | "${GE_CODE_DIR}/ge/graph/build/run_context.cc" | ||||
| "${GE_CODE_DIR}/ge/graph/common/local_context.cc" | "${GE_CODE_DIR}/ge/graph/common/local_context.cc" | ||||
| ) | ) | ||||
| @@ -784,7 +784,6 @@ set(OTHERS_TEST_FILES | |||||
| ) | ) | ||||
| list(APPEND COMMON_SHARED_LIBRARIES | list(APPEND COMMON_SHARED_LIBRARIES | ||||
| omg_stub | |||||
| c_sec | c_sec | ||||
| slog_stub | slog_stub | ||||
| cce_ge_stub | cce_ge_stub | ||||
| @@ -34,7 +34,6 @@ | |||||
| #include "common/types.h" | #include "common/types.h" | ||||
| #include "graph/load/graph_loader.h" | #include "graph/load/graph_loader.h" | ||||
| #include "graph/load/model_manager/davinci_model.h" | #include "graph/load/model_manager/davinci_model.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| #include "graph/load/model_manager/model_manager.h" | #include "graph/load/model_manager/model_manager.h" | ||||
| #include "graph/load/model_manager/task_info/kernel_task_info.h" | #include "graph/load/model_manager/task_info/kernel_task_info.h" | ||||
| #include "graph/load/model_manager/task_info/kernel_ex_task_info.h" | #include "graph/load/model_manager/task_info/kernel_ex_task_info.h" | ||||
| @@ -109,6 +108,26 @@ static ge::OpDescPtr CreateOpDesc(string name = "", string type = "") { | |||||
| ge::AttrUtils::SetInt(op_desc, ge::ATTR_NAME_STREAM_SWITCH_COND, 0); | ge::AttrUtils::SetInt(op_desc, ge::ATTR_NAME_STREAM_SWITCH_COND, 0); | ||||
| return op_desc; | return op_desc; | ||||
| } | } | ||||
| TEST_F(UtestGeExecutor, load_data_from_file) { | |||||
| GeExecutor ge_executor; | |||||
| ge_executor.isInit_ = true; | |||||
| string test_smap = "/tmp/" + std::to_string(getpid()) + "_maps"; | |||||
| string self_smap = "/proc/" + std::to_string(getpid()) + "/maps"; | |||||
| string copy_smap = "cp " + self_smap + " " + test_smap; | |||||
| EXPECT_EQ(system(copy_smap.c_str()), 0); | |||||
| ModelData model_data; | |||||
| EXPECT_EQ(ge_executor.LoadDataFromFile(test_smap, model_data), SUCCESS); | |||||
| EXPECT_NE(model_data.model_data, nullptr); | |||||
| delete[] static_cast<char *>(model_data.model_data); | |||||
| model_data.model_data = nullptr; | |||||
| ge_executor.isInit_ = false; | |||||
| } | |||||
| /* | /* | ||||
| TEST_F(UtestGeExecutor, fail_UnloadModel_model_manager_stop_unload_error) { | TEST_F(UtestGeExecutor, fail_UnloadModel_model_manager_stop_unload_error) { | ||||
| uint32_t model_id = 1; | uint32_t model_id = 1; | ||||
| @@ -24,7 +24,6 @@ | |||||
| #include "common/helper/model_helper.h" | #include "common/helper/model_helper.h" | ||||
| #include "common/op/ge_op_utils.h" | #include "common/op/ge_op_utils.h" | ||||
| #include "common/types.h" | #include "common/types.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| #include "graph/op_desc.h" | #include "graph/op_desc.h" | ||||
| #include "graph/types.h" | #include "graph/types.h" | ||||
| #include "graph/utils/attr_utils.h" | #include "graph/utils/attr_utils.h" | ||||
| @@ -25,7 +25,6 @@ | |||||
| #include "common/op/ge_op_utils.h" | #include "common/op/ge_op_utils.h" | ||||
| #include "graph/load/graph_loader.h" | #include "graph/load/graph_loader.h" | ||||
| #include "graph/load/model_manager/davinci_model.h" | #include "graph/load/model_manager/davinci_model.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| using namespace std; | using namespace std; | ||||
| using namespace testing; | using namespace testing; | ||||
| @@ -21,7 +21,7 @@ | |||||
| #include "common/debug/log.h" | #include "common/debug/log.h" | ||||
| #include "common/l2_cache_optimize.h" | #include "common/l2_cache_optimize.h" | ||||
| #include "common/model_parser/base.h" | |||||
| #include "common/model_parser/model_parser.h" | |||||
| #include "common/properties_manager.h" | #include "common/properties_manager.h" | ||||
| #include "common/types.h" | #include "common/types.h" | ||||
| @@ -31,7 +31,6 @@ | |||||
| #include "common/op/ge_op_utils.h" | #include "common/op/ge_op_utils.h" | ||||
| #include "graph/load/graph_loader.h" | #include "graph/load/graph_loader.h" | ||||
| #include "graph/load/model_manager/davinci_model.h" | #include "graph/load/model_manager/davinci_model.h" | ||||
| #include "graph/load/model_manager/davinci_model_parser.h" | |||||
| #include "graph/load/model_manager/model_manager.h" | #include "graph/load/model_manager/model_manager.h" | ||||
| //#include "new_op_test_utils.h" | //#include "new_op_test_utils.h" | ||||
| #undef private | #undef private | ||||