| @@ -208,7 +208,7 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr<OmFileSaveHelper> &om_file_s | |||||
| const GeModelPtr &ge_model, size_t model_num) { | const GeModelPtr &ge_model, size_t model_num) { | ||||
| // Save target/version to model_header | // Save target/version to model_header | ||||
| ModelFileHeader &model_header = om_file_save_helper->GetModelFileHeader(); | ModelFileHeader &model_header = om_file_save_helper->GetModelFileHeader(); | ||||
| model_header.platform_type = ge_model->GetPlatformType(); | |||||
| model_header.platform_type = TARGET_TYPE_MINI_8BIT; | |||||
| model_header.om_ir_version = ge_model->GetVersion(); | model_header.om_ir_version = ge_model->GetVersion(); | ||||
| model_header.model_num = model_num; | model_header.model_num = model_num; | ||||
| std::string platform_version = ge_model->GetPlatformVersion(); | std::string platform_version = ge_model->GetPlatformVersion(); | ||||
| @@ -511,7 +511,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod | |||||
| Status status = ModelParserBase::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; | ||||
| } | } | ||||
| @@ -542,7 +542,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod | |||||
| GELOGE(status, "GenerateGeRootModel failed"); | GELOGE(status, "GenerateGeRootModel failed"); | ||||
| return status; | return status; | ||||
| } | } | ||||
| GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true!"); | |||||
| GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true."); | |||||
| is_assign_model_ = true; | is_assign_model_ = true; | ||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| @@ -493,12 +493,7 @@ const std::string MODEL_ATTR_FUSION_MODEL_DEF = "fm"; | |||||
| const int MODEL_MAX_SIZE = INT32_MAX; // Max size of 2 GB minus 1 byte. | const int MODEL_MAX_SIZE = INT32_MAX; // Max size of 2 GB minus 1 byte. | ||||
| const uint64_t FILE_HEADER_MAX_SIZE = 3221225472; // Max size of 3 GB. | const uint64_t FILE_HEADER_MAX_SIZE = 3221225472; // Max size of 3 GB. | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| const uint64_t ALLOC_MEMORY_MAX_SIZE = 8589934592; // Max size of 8 GB. | const uint64_t ALLOC_MEMORY_MAX_SIZE = 8589934592; // Max size of 8 GB. | ||||
| #else | |||||
| const uint64_t ALLOC_MEMORY_MAX_SIZE = 536870912; // Max size of 512M. | |||||
| #endif | |||||
| /// | /// | ||||
| /// @brief Magic number of model file | /// @brief Magic number of model file | ||||
| @@ -35,7 +35,6 @@ | |||||
| #include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
| #include "graph/common/local_context.h" | #include "graph/common/local_context.h" | ||||
| #include "graph/optimize/common/params.h" | |||||
| #include "omg/omg_inner_types.h" | #include "omg/omg_inner_types.h" | ||||
| #include "runtime/mem.h" | #include "runtime/mem.h" | ||||
| @@ -1429,11 +1428,7 @@ MemoryBlock *BlockMemAssigner::ApplyOutMemory(const NodePtr &n, uint32_t index, | |||||
| auto owner_node = in_anchor->GetOwnerNode(); | auto owner_node = in_anchor->GetOwnerNode(); | ||||
| auto op_desc = owner_node->GetOpDesc(); | auto op_desc = owner_node->GetOpDesc(); | ||||
| GE_IF_BOOL_EXEC(op_desc == nullptr, continue); | GE_IF_BOOL_EXEC(op_desc == nullptr, continue); | ||||
| Params *instance = Params::Instance(); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(instance == nullptr, return nullptr, "Params instance is nullptr."); | |||||
| if (!((instance->GetTarget() == TARGET_TYPE_TINY) && (op_desc->GetType() == NETOUTPUT))) { | |||||
| out_count++; | |||||
| } | |||||
| out_count++; | |||||
| } | } | ||||
| block->ref_count_ = (reuse_input && out_count != 0) ? (block->ref_count_ + out_count - 1) | block->ref_count_ = (reuse_input && out_count != 0) ? (block->ref_count_ + out_count - 1) | ||||
| : (block->ref_count_ + out_count); | : (block->ref_count_ + out_count); | ||||
| @@ -34,7 +34,6 @@ | |||||
| #include "graph/ge_error_codes.h" | #include "graph/ge_error_codes.h" | ||||
| #include "graph/manager/graph_mem_allocator.h" | #include "graph/manager/graph_mem_allocator.h" | ||||
| #include "graph/manager/graph_var_manager.h" | #include "graph/manager/graph_var_manager.h" | ||||
| #include "graph/optimize/common/params.h" | |||||
| #include "graph/types.h" | #include "graph/types.h" | ||||
| #include "graph/utils/attr_utils.h" | #include "graph/utils/attr_utils.h" | ||||
| #include "graph/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||
| @@ -96,7 +95,6 @@ ModelBuilder::ModelBuilder(uint64_t session_id, ge::ComputeGraphPtr compute_grap | |||||
| max_mem_offset_(0), | max_mem_offset_(0), | ||||
| p2p_mem_offset_(0), | p2p_mem_offset_(0), | ||||
| zero_copy_mem_size_(0), | zero_copy_mem_size_(0), | ||||
| platform_type_(0), | |||||
| is_loop_graph_(false), | is_loop_graph_(false), | ||||
| is_l1_fusion_enable_(false) {} | is_l1_fusion_enable_(false) {} | ||||
| @@ -494,11 +492,6 @@ Status ModelBuilder::BuildModelDef(ge::Model &model) { | |||||
| GELOGI("Set event num: %ld.", event_num_); | GELOGI("Set event num: %ld.", event_num_); | ||||
| if (Params::Instance() == nullptr) { | |||||
| return FAILED; | |||||
| } | |||||
| platform_type_ = Params::Instance()->GetTarget_8bit(); | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| @@ -759,7 +752,6 @@ Status ModelBuilder::SaveDataToModel(ge::Model &model, ge::GeModel &ge_model) { | |||||
| ge_model.SetGraph(model.GetGraph()); | ge_model.SetGraph(model.GetGraph()); | ||||
| ge_model.SetVersion(model.GetVersion()); | ge_model.SetVersion(model.GetVersion()); | ||||
| ge_model.SetPlatformVersion(model.GetPlatformVersion()); | ge_model.SetPlatformVersion(model.GetPlatformVersion()); | ||||
| ge_model.SetPlatformType(platform_type_); | |||||
| ge_model.SetAttr(model.MutableAttrMap()); | ge_model.SetAttr(model.MutableAttrMap()); | ||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| @@ -120,7 +120,6 @@ class ModelBuilder { | |||||
| TBEKernelStore tbe_kernel_store_; | TBEKernelStore tbe_kernel_store_; | ||||
| CustAICPUKernelStore cust_aicpu_kernel_store_; | CustAICPUKernelStore cust_aicpu_kernel_store_; | ||||
| uint8_t platform_type_; | |||||
| bool is_loop_graph_; | bool is_loop_graph_; | ||||
| bool is_l1_fusion_enable_; | bool is_l1_fusion_enable_; | ||||
| }; | }; | ||||
| @@ -25,7 +25,6 @@ | |||||
| #include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
| #include "graph/compute_graph.h" | #include "graph/compute_graph.h" | ||||
| #include "graph/op_desc.h" | #include "graph/op_desc.h" | ||||
| #include "graph/optimize/common/params.h" | |||||
| #include "omg/omg_inner_types.h" | #include "omg/omg_inner_types.h" | ||||
| #include "runtime/mem.h" | #include "runtime/mem.h" | ||||
| @@ -1,62 +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_OPTIMIZE_COMMON_PARAMS_H_ | |||||
| #define GE_GRAPH_OPTIMIZE_COMMON_PARAMS_H_ | |||||
| #include <string> | |||||
| #include "common/singleton.h" | |||||
| #include "common/types.h" | |||||
| namespace ge { | |||||
| class Params : public Singleton<Params> { | |||||
| public: | |||||
| DECLARE_SINGLETON_CLASS(Params); | |||||
| void SetTarget(const char* target) { | |||||
| std::string tmp_target = (target != nullptr) ? target : ""; | |||||
| #if defined(__ANDROID__) || defined(ANDROID) | |||||
| target_ = "LITE"; | |||||
| target_8bit_ = TARGET_TYPE_LTTE_8BIT; | |||||
| #else | |||||
| target_ = "MINI"; | |||||
| target_8bit_ = TARGET_TYPE_MINI_8BIT; | |||||
| #endif | |||||
| if (tmp_target == "mini") { | |||||
| target_ = "MINI"; | |||||
| target_8bit_ = TARGET_TYPE_MINI_8BIT; | |||||
| } else if (tmp_target == "lite") { | |||||
| target_ = "LITE"; | |||||
| target_8bit_ = TARGET_TYPE_LTTE_8BIT; | |||||
| } | |||||
| } | |||||
| string GetTarget() const { return target_; } | |||||
| uint8_t GetTarget_8bit() const { return target_8bit_; } | |||||
| ~Params() override = default; | |||||
| private: | |||||
| Params() : target_("MINI") {} | |||||
| string target_; | |||||
| uint8_t target_8bit_ = TARGET_TYPE_MINI_8BIT; | |||||
| }; | |||||
| } // namespace ge | |||||
| #endif // GE_GRAPH_OPTIMIZE_COMMON_PARAMS_H_ | |||||
| @@ -32,7 +32,6 @@ | |||||
| #include "framework/common/types.h" | #include "framework/common/types.h" | ||||
| #include "framework/omg/omg_inner_types.h" | #include "framework/omg/omg_inner_types.h" | ||||
| #include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
| #include "graph/optimize/common/params.h" | |||||
| #include "graph/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||
| #include "graph/utils/node_utils.h" | #include "graph/utils/node_utils.h" | ||||
| #include "graph/utils/op_desc_utils.h" | #include "graph/utils/op_desc_utils.h" | ||||
| @@ -54,8 +54,6 @@ uint32_t GeModel::GetVersion() const { return this->version_; } | |||||
| std::string GeModel::GetPlatformVersion() const { return this->platform_version_; } | std::string GeModel::GetPlatformVersion() const { return this->platform_version_; } | ||||
| uint8_t GeModel::GetPlatformType() const { return this->platform_type_; } | |||||
| void GeModel::SetGraph(const Graph &graph) { this->graph_ = graph; } | void GeModel::SetGraph(const Graph &graph) { this->graph_ = graph; } | ||||
| void GeModel::SetModelTaskDef(const std::shared_ptr<domi::ModelTaskDef> &task) { this->task_ = task; } | void GeModel::SetModelTaskDef(const std::shared_ptr<domi::ModelTaskDef> &task) { this->task_ = task; } | ||||
| @@ -76,8 +74,6 @@ void GeModel::SetVersion(uint32_t version) { this->version_ = version; } | |||||
| void GeModel::SetPlatformVersion(const std::string &platform_version) { this->platform_version_ = platform_version; } | void GeModel::SetPlatformVersion(const std::string &platform_version) { this->platform_version_ = platform_version; } | ||||
| void GeModel::SetPlatformType(uint8_t platform_type) { this->platform_type_ = platform_type; } | |||||
| void GeModel::SetAttr(const ProtoAttrMapHelper &attrs) { attrs_ = attrs; } | void GeModel::SetAttr(const ProtoAttrMapHelper &attrs) { attrs_ = attrs; } | ||||
| ProtoAttrMapHelper GeModel::MutableAttrMap() { return attrs_; } | ProtoAttrMapHelper GeModel::MutableAttrMap() { return attrs_; } | ||||
| @@ -58,7 +58,6 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeModel : public AttrHolder | |||||
| void SetName(const std::string &name); | void SetName(const std::string &name); | ||||
| void SetVersion(uint32_t version); | void SetVersion(uint32_t version); | ||||
| void SetPlatformVersion(const std::string &platform_version); | void SetPlatformVersion(const std::string &platform_version); | ||||
| void SetPlatformType(uint8_t platform_type); | |||||
| void SetAttr(const ProtoAttrMapHelper &attrs); | void SetAttr(const ProtoAttrMapHelper &attrs); | ||||
| @@ -93,7 +92,6 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeModel : public AttrHolder | |||||
| std::string name_; | std::string name_; | ||||
| uint32_t version_ = {0}; | uint32_t version_ = {0}; | ||||
| std::string platform_version_; | std::string platform_version_; | ||||
| uint8_t platform_type_ = {0}; | |||||
| uint32_t model_id_ = INVALID_MODEL_ID; | uint32_t model_id_ = INVALID_MODEL_ID; | ||||
| std::map<uint32_t, uint64_t> model_id_to_session_id_map_; | std::map<uint32_t, uint64_t> model_id_to_session_id_map_; | ||||
| }; | }; | ||||
| @@ -102,13 +102,11 @@ DEFINE_int32(mode, 0, | |||||
| "Optional; run mode, 0(default): model => framework model; 1: " | "Optional; run mode, 0(default): model => framework model; 1: " | ||||
| "framework model => json; 3: only pre-check; 5: txt => json."); | "framework model => json; 3: only pre-check; 5: txt => json."); | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| DEFINE_int32(encrypt_mode, -1, "Optional; the encrypt flag. 0: encrypt; -1(default): not encrypt"); | DEFINE_int32(encrypt_mode, -1, "Optional; the encrypt flag. 0: encrypt; -1(default): not encrypt"); | ||||
| DEFINE_string(encrypt_key, "", "Optional; the encrypt_key file."); | DEFINE_string(encrypt_key, "", "Optional; the encrypt_key file."); | ||||
| DEFINE_string(certificate, "", "Optional; the certificate file."); | DEFINE_string(certificate, "", "Optional; the certificate file."); | ||||
| DEFINE_string(hardware_key, "", "Optional; the ISV key file."); | DEFINE_string(hardware_key, "", "Optional; the ISV key file."); | ||||
| DEFINE_string(private_key, "", "Optional; the private key file."); | DEFINE_string(private_key, "", "Optional; the private key file."); | ||||
| #endif | |||||
| DEFINE_string(out_nodes, "", | DEFINE_string(out_nodes, "", | ||||
| "Optional; output nodes designated by users." | "Optional; output nodes designated by users." | ||||
| @@ -397,7 +395,6 @@ class GFlagUtils { | |||||
| "dynamic dims function does not support aipp"}); | "dynamic dims function does not support aipp"}); | ||||
| ret = ge::FAILED, "[Check][Param]dynamic dims function does not support aipp"); | ret = ge::FAILED, "[Check][Param]dynamic dims function does not support aipp"); | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!CheckEncryptModeValid(FLAGS_encrypt_mode), ret = ge::FAILED, | GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!CheckEncryptModeValid(FLAGS_encrypt_mode), ret = ge::FAILED, | ||||
| "[Check][EncryptMode]value %d not valid!!", FLAGS_encrypt_mode); | "[Check][EncryptMode]value %d not valid!!", FLAGS_encrypt_mode); | ||||
| @@ -418,7 +415,6 @@ class GFlagUtils { | |||||
| } else { // No encryption | } else { // No encryption | ||||
| GELOGI("ge will run without encrypt!"); | GELOGI("ge will run without encrypt!"); | ||||
| } | } | ||||
| #endif | |||||
| /** | /** | ||||
| * Check the validity of the I / O file path | * Check the validity of the I / O file path | ||||
| @@ -531,18 +527,10 @@ class GFlagUtils { | |||||
| private: | private: | ||||
| static bool CheckEncryptModeValid(const int encrypt_mode) { | static bool CheckEncryptModeValid(const int encrypt_mode) { | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| if (encrypt_mode != 0 && encrypt_mode != -1) { | if (encrypt_mode != 0 && encrypt_mode != -1) { | ||||
| DOMI_LOGE("encrypt mode must be 0 or -1"); | DOMI_LOGE("encrypt mode must be 0 or -1"); | ||||
| return false; | return false; | ||||
| } | } | ||||
| #else | |||||
| if (encrypt_mode != -1) { | |||||
| DOMI_LOGE("encrypt mode must be -1"); | |||||
| return false; | |||||
| } | |||||
| #endif | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -665,7 +653,6 @@ static bool CheckInputFormat() { | |||||
| return true; | return true; | ||||
| } | } | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| static void GetCustomOpPath(std::string &customop_path) { | static void GetCustomOpPath(std::string &customop_path) { | ||||
| GELOGI("Enter get custom op path schedule"); | GELOGI("Enter get custom op path schedule"); | ||||
| std::string fmk_type = ge::TypeUtils::FmkTypeToSerialString(static_cast<domi::FrameworkType>(FLAGS_framework)); | std::string fmk_type = ge::TypeUtils::FmkTypeToSerialString(static_cast<domi::FrameworkType>(FLAGS_framework)); | ||||
| @@ -806,8 +793,6 @@ void SaveCustomCaffeProtoPath() { | |||||
| return; | return; | ||||
| } | } | ||||
| #endif | |||||
| Status CreateInputsForInference(const ge::Graph &graph, vector<ge::GeTensor> &inputs) { | Status CreateInputsForInference(const ge::Graph &graph, vector<ge::GeTensor> &inputs) { | ||||
| auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); | auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); | ||||
| GE_CHECK_NOTNULL(compute_graph); | GE_CHECK_NOTNULL(compute_graph); | ||||
| @@ -1154,14 +1139,12 @@ domi::Status GenerateOmModel() { | |||||
| GE_CHK_BOOL_EXEC(ret == domi::SUCCESS, return domi::FAILED, | GE_CHK_BOOL_EXEC(ret == domi::SUCCESS, return domi::FAILED, | ||||
| "[Check][Flags] failed! Please check whether some atc params that include semicolons[;] use double " | "[Check][Flags] failed! Please check whether some atc params that include semicolons[;] use double " | ||||
| "quotation marks (\") to enclose each argument such as out_nodes, input_shape, dynamic_image_size"); | "quotation marks (\") to enclose each argument such as out_nodes, input_shape, dynamic_image_size"); | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| // Load custom operator Library | // Load custom operator Library | ||||
| LoadCustomOpLib(true); | LoadCustomOpLib(true); | ||||
| SaveCustomCaffeProtoPath(); | SaveCustomCaffeProtoPath(); | ||||
| GE_CHK_BOOL_EXEC(ret == domi::SUCCESS, return domi::FAILED, "[Check][Flags]check custom aicpu run so failed!"); | GE_CHK_BOOL_EXEC(ret == domi::SUCCESS, return domi::FAILED, "[Check][Flags]check custom aicpu run so failed!"); | ||||
| #endif | |||||
| const int f_stream_num = 1; | const int f_stream_num = 1; | ||||
| std::map<string, string> options; | std::map<string, string> options; | ||||
| @@ -1,161 +0,0 @@ | |||||
| LOCAL_PATH := $(call my-dir) | |||||
| include $(CLEAR_VARS) | |||||
| LOCAL_MODULE := atc | |||||
| LOCAL_CFLAGS += -Werror -Wno-deprecated-declarations | |||||
| LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -DCOMPILE_OMG_PACKAGE -O2 -Dgoogle=ascend_private | |||||
| LOCAL_SRC_FILES := \ | |||||
| main.cc \ | |||||
| single_op_parser.cc \ | |||||
| ../session/omg.cc \ | |||||
| ../ir_build/atc_ir_common.cc \ | |||||
| LOCAL_C_INCLUDES := \ | |||||
| $(LOCAL_PATH)/../ ./ \ | |||||
| $(TOPDIR)inc \ | |||||
| $(TOPDIR)metadef/inc \ | |||||
| $(TOPDIR)graphengine/inc \ | |||||
| $(TOPDIR)inc/external \ | |||||
| $(TOPDIR)metadef/inc/external \ | |||||
| $(TOPDIR)graphengine/inc/external \ | |||||
| $(TOPDIR)metadef/inc/external/graph \ | |||||
| $(TOPDIR)graphengine/inc/framework \ | |||||
| $(TOPDIR)libc_sec/include \ | |||||
| $(TOPDIR)metadef/inc/common/util \ | |||||
| $(TOPDIR)parser \ | |||||
| third_party/json/include \ | |||||
| third_party/gflags/include \ | |||||
| third_party/protobuf/include \ | |||||
| proto/om.proto \ | |||||
| proto/ge_ir.proto \ | |||||
| proto/task.proto \ | |||||
| proto/insert_op.proto \ | |||||
| LOCAL_SHARED_LIBRARIES := \ | |||||
| libc_sec \ | |||||
| libge_common \ | |||||
| libascend_protobuf \ | |||||
| libslog \ | |||||
| libgraph \ | |||||
| libregister \ | |||||
| liberror_manager \ | |||||
| libge_compiler \ | |||||
| libruntime_compile \ | |||||
| libparser_common \ | |||||
| liberror_manager \ | |||||
| LOCAL_STATIC_LIBRARIES := libgflags | |||||
| LOCAL_LDFLAGS := -lrt -ldl | |||||
| include $(BUILD_HOST_EXECUTABLE) | |||||
| include $(CLEAR_VARS) | |||||
| LOCAL_MODULE := atclib/atc.bin | |||||
| LOCAL_CFLAGS += -Werror -Wno-deprecated-declarations | |||||
| LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -DCOMPILE_OMG_PACKAGE -O2 -Dgoogle=ascend_private | |||||
| LOCAL_SRC_FILES := \ | |||||
| main.cc \ | |||||
| single_op_parser.cc \ | |||||
| ../session/omg.cc \ | |||||
| ../ir_build/atc_ir_common.cc \ | |||||
| LOCAL_C_INCLUDES := \ | |||||
| $(LOCAL_PATH)/../ ./ \ | |||||
| $(TOPDIR)inc \ | |||||
| $(TOPDIR)metadef/inc \ | |||||
| $(TOPDIR)graphengine/inc \ | |||||
| $(TOPDIR)inc/external \ | |||||
| $(TOPDIR)metadef/inc/external \ | |||||
| $(TOPDIR)graphengine/inc/external \ | |||||
| $(TOPDIR)metadef/inc/external/graph \ | |||||
| $(TOPDIR)graphengine/inc/framework \ | |||||
| $(TOPDIR)libc_sec/include \ | |||||
| $(TOPDIR)metadef/inc/common/util \ | |||||
| $(TOPDIR)parser \ | |||||
| third_party/json/include \ | |||||
| third_party/gflags/include \ | |||||
| third_party/protobuf/include \ | |||||
| proto/om.proto \ | |||||
| proto/ge_ir.proto \ | |||||
| proto/task.proto \ | |||||
| proto/insert_op.proto \ | |||||
| LOCAL_SHARED_LIBRARIES := \ | |||||
| libc_sec \ | |||||
| libge_common \ | |||||
| libascend_protobuf \ | |||||
| libslog \ | |||||
| libgraph \ | |||||
| libregister \ | |||||
| liberror_manager \ | |||||
| libge_compiler \ | |||||
| libruntime_compile \ | |||||
| libparser_common \ | |||||
| liberror_manager \ | |||||
| LOCAL_STATIC_LIBRARIES := libgflags | |||||
| LOCAL_LDFLAGS := -lrt -ldl | |||||
| include $(BUILD_HOST_EXECUTABLE) | |||||
| include $(CLEAR_VARS) | |||||
| LOCAL_MODULE := fwkacl/atc.bin | |||||
| LOCAL_CFLAGS += -Werror -Wno-deprecated-declarations | |||||
| LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -DCOMPILE_OMG_PACKAGE -O2 -Dgoogle=ascend_private | |||||
| LOCAL_SRC_FILES := \ | |||||
| main.cc \ | |||||
| single_op_parser.cc \ | |||||
| ../session/omg.cc \ | |||||
| ../ir_build/atc_ir_common.cc \ | |||||
| LOCAL_C_INCLUDES := \ | |||||
| $(LOCAL_PATH)/../ ./ \ | |||||
| $(TOPDIR)inc \ | |||||
| $(TOPDIR)metadef/inc \ | |||||
| $(TOPDIR)graphengine/inc \ | |||||
| $(TOPDIR)inc/external \ | |||||
| $(TOPDIR)metadef/inc/external \ | |||||
| $(TOPDIR)graphengine/inc/external \ | |||||
| $(TOPDIR)metadef/inc/external/graph \ | |||||
| $(TOPDIR)graphengine/inc/framework \ | |||||
| $(TOPDIR)libc_sec/include \ | |||||
| $(TOPDIR)metadef/inc/common/util \ | |||||
| $(TOPDIR)parser \ | |||||
| third_party/json/include \ | |||||
| third_party/gflags/include \ | |||||
| third_party/protobuf/include \ | |||||
| proto/om.proto \ | |||||
| proto/ge_ir.proto \ | |||||
| proto/task.proto \ | |||||
| proto/insert_op.proto \ | |||||
| LOCAL_SHARED_LIBRARIES := \ | |||||
| libc_sec \ | |||||
| libge_common \ | |||||
| libascend_protobuf \ | |||||
| libslog \ | |||||
| libgraph \ | |||||
| libregister \ | |||||
| liberror_manager \ | |||||
| libge_runner \ | |||||
| libruntime \ | |||||
| libparser_common \ | |||||
| liberror_manager \ | |||||
| LOCAL_STATIC_LIBRARIES := libgflags | |||||
| LOCAL_LDFLAGS := -lrt -ldl | |||||
| include $(BUILD_HOST_EXECUTABLE) | |||||
| @@ -1,191 +0,0 @@ | |||||
| syntax = "proto3"; | |||||
| package ge.proto; | |||||
| enum DataType | |||||
| { | |||||
| DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. | |||||
| DT_FLOAT = 1; // float type | |||||
| DT_FLOAT16 = 2; // fp16 type | |||||
| DT_INT8 = 3; // int8 type | |||||
| DT_UINT8 = 4; // uint8 type | |||||
| DT_INT16 = 5; // int16 type | |||||
| DT_UINT16 = 6; // uint16 type | |||||
| DT_INT32 = 7; // | |||||
| DT_INT64 = 8; // int64 type | |||||
| DT_UINT32 = 9; // unsigned int32 | |||||
| DT_UINT64 = 10; // unsigned int64 | |||||
| DT_BOOL = 11; // bool type | |||||
| DT_DOUBLE = 12; // double type | |||||
| DT_STRING = 13; // string type | |||||
| DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ | |||||
| DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ | |||||
| DT_COMPLEX64 = 16; // complex64 type | |||||
| DT_COMPLEX128 = 17; // complex128 type | |||||
| DT_QINT8 = 18; // qint8 type | |||||
| DT_QINT16 = 19; // qint16 type | |||||
| DT_QINT32 = 20; // qint32 type | |||||
| DT_QUINT8 = 21; // quint8 type | |||||
| DT_QUINT16 = 22; // quint16 type | |||||
| DT_RESOURCE = 23; // resource type | |||||
| DT_STRING_REF = 24; // string_ref type | |||||
| DT_DUAL = 25; /**< dual output type */ | |||||
| DT_VARIANT = 26; // variant type | |||||
| } | |||||
| message AttrDef | |||||
| { | |||||
| message ListValue | |||||
| { | |||||
| enum ListValueType{ | |||||
| VT_LIST_NONE = 0; | |||||
| VT_LIST_STRING = 1; | |||||
| VT_LIST_INT = 2; | |||||
| VT_LIST_FLOAT = 3; | |||||
| VT_LIST_BOOL = 4; | |||||
| VT_LIST_BYTES = 5; | |||||
| VT_LIST_TENSOR_DESC = 6; | |||||
| VT_LIST_TENSOR = 7; | |||||
| VT_LIST_GRAPH = 8; | |||||
| VT_LIST_NAMED_ATTRS = 9; | |||||
| VT_LIST_DATA_TYPE = 10; | |||||
| } | |||||
| repeated bytes s = 2; // "list(string)" | |||||
| repeated int64 i = 3; // "list(int)" | |||||
| repeated float f = 4; // "list(float)" | |||||
| repeated bool b = 5; // "list(bool)" | |||||
| repeated bytes bt = 7; | |||||
| repeated TensorDescriptor td = 8; | |||||
| repeated TensorDef t = 9; | |||||
| repeated GraphDef g = 10; | |||||
| repeated NamedAttrs na = 11; | |||||
| repeated int64 dt = 12; // list ge::DataType | |||||
| ListValueType val_type = 20; | |||||
| } | |||||
| message ListListInt{ | |||||
| message ListInt{ | |||||
| repeated int64 list_i = 1; // list int | |||||
| } | |||||
| repeated ListInt list_list_i = 1; // list list int | |||||
| } | |||||
| oneof value | |||||
| { | |||||
| bytes s = 2; // "string" | |||||
| int64 i = 3; // "int" | |||||
| float f = 4; // "float" | |||||
| bool b = 5; // "bool" | |||||
| bytes bt = 7; | |||||
| ListValue list = 1; // any "list(...)" | |||||
| NamedAttrs func = 10; // Used to support attr nesting | |||||
| TensorDescriptor td = 11; // GeTensorDesc type | |||||
| TensorDef t = 12; // GeTensor type | |||||
| GraphDef g = 13; // Graph type | |||||
| ListListInt list_list_int = 14; // List List Int type | |||||
| int64 dt = 15; // ge::DataType | |||||
| } | |||||
| } | |||||
| // A list of attr names and their values. The whole list is attached | |||||
| // with a string name. E.g., MatMul[T=float]. | |||||
| message NamedAttrs | |||||
| { | |||||
| string name = 1; | |||||
| map<string, AttrDef> attr = 2; | |||||
| } | |||||
| // Shape / dimension description, using row-major order | |||||
| message ShapeDef | |||||
| { | |||||
| repeated int64 dim = 1; // Size of each dimension | |||||
| } | |||||
| // Multidimensional data description | |||||
| message TensorDescriptor | |||||
| { | |||||
| string name = 1; // Optional parameter, tensor name | |||||
| DataType dtype = 2; // tensor datatype | |||||
| ShapeDef shape = 3; // Shape / dimension | |||||
| string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" | |||||
| bool has_out_attr = 9; | |||||
| int64 size = 10; | |||||
| int64 weight_size = 11; | |||||
| bool reuse_input = 12; | |||||
| bool output_tensor = 13; | |||||
| string device_type = 14; | |||||
| bool input_tensor =15; | |||||
| int64 real_dim_cnt = 16; | |||||
| int64 reuse_input_index = 17; | |||||
| int64 data_offset = 18; | |||||
| int64 cmps_size = 19; | |||||
| string cmps_tab = 20; | |||||
| int64 cmps_tab_offset = 21; | |||||
| map<string, AttrDef> attr = 5; // Set of extra parameter fields | |||||
| } | |||||
| // GeTensor definition | |||||
| message TensorDef | |||||
| { | |||||
| TensorDescriptor desc = 1; // Tensor description | |||||
| bytes data = 2; // Tensor data | |||||
| } | |||||
| // Operator description | |||||
| message OpDef | |||||
| { | |||||
| string name = 1; // name | |||||
| string type = 2; // type | |||||
| repeated string input = 5; // input original op name + outgoing index. op_name:index | |||||
| map<string, AttrDef> attr = 10; // Set of operator parameter fields | |||||
| bool has_out_attr = 20; | |||||
| int64 id = 21; | |||||
| int64 stream_id =22; | |||||
| repeated string input_name = 23; | |||||
| repeated string src_name = 24; | |||||
| repeated int64 src_index = 25; | |||||
| repeated string dst_name = 26; | |||||
| repeated int64 dst_index = 27; | |||||
| repeated int64 input_i = 28; | |||||
| repeated int64 output_i = 29; | |||||
| repeated int64 workspace = 30; | |||||
| repeated int64 workspace_bytes = 31; | |||||
| repeated bool is_input_const = 32; | |||||
| repeated TensorDescriptor input_desc = 33; | |||||
| repeated TensorDescriptor output_desc = 34; | |||||
| repeated string subgraph_name = 35; | |||||
| } | |||||
| // Graph definition | |||||
| message GraphDef | |||||
| { | |||||
| string name = 1; // name | |||||
| repeated string input = 4; // Graph input | |||||
| repeated string output = 5; // Graph output | |||||
| repeated OpDef op = 6; // List of operators | |||||
| map<string, AttrDef> attr = 11; // Extended field | |||||
| } | |||||
| // model definition | |||||
| message ModelDef | |||||
| { | |||||
| string name = 1; // name | |||||
| uint32 version = 2; // IR Proto verion | |||||
| string custom_version = 3; // User model version number, passed in by user | |||||
| repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef | |||||
| map<string, AttrDef> attr = 11; // Extended field | |||||
| } | |||||
| @@ -1,140 +0,0 @@ | |||||
| syntax = "proto3"; | |||||
| package domi; | |||||
| message InsertNewOps { | |||||
| repeated AippOpParams aipp_op = 1; | |||||
| repeated MultiShapeOpParams multi_shape_op = 2; | |||||
| } | |||||
| message AippOpParams { | |||||
| enum InputFormat { | |||||
| UNDEFINED = 0; | |||||
| YUV420SP_U8 = 1; | |||||
| XRGB8888_U8 = 2; | |||||
| RGB888_U8 = 3; | |||||
| YUV400_U8 = 4; | |||||
| NC1HWC0DI_FP16 = 5; | |||||
| NC1HWC0DI_S8 = 6; | |||||
| ARGB8888_U8 = 7; | |||||
| YUYV_U8 = 8; | |||||
| YUV422SP_U8 = 9; | |||||
| AYUV444_U8 = 10; | |||||
| RAW10 = 11; | |||||
| RAW12 = 12; | |||||
| RAW16 = 13; | |||||
| RAW24 = 14; | |||||
| RGB16 = 15; | |||||
| RGB20 = 16; | |||||
| RGB24 = 17; | |||||
| RGB8_IR = 18; | |||||
| RGB16_IR = 19; | |||||
| RGB24_IR = 20; | |||||
| } | |||||
| enum AippMode { | |||||
| undefined = 0; | |||||
| static = 1; | |||||
| dynamic = 2; | |||||
| } | |||||
| // AIPP模式,区分静态AIPP和动态AIPP | |||||
| AippMode aipp_mode = 1; | |||||
| // related_input_rank参数为必填,类型为整型,配置范围>=0, <=输入Data算子的个数,默认值为0。 | |||||
| // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 | |||||
| uint32 related_input_rank = 2; | |||||
| // related_input_name is optional and the top name of data node which inserts aipp | |||||
| string related_input_name = 6; | |||||
| // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 | |||||
| // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 | |||||
| // 配置值 <= Data算子输出边的个数。 | |||||
| repeated uint32 input_edge_idx = 3; | |||||
| // [Begin] 动态AIPP参数,配置静态AIPP时无效 | |||||
| uint32 max_src_image_size = 4; | |||||
| // 是否支持旋转。默认不支持,开启支持旋转时,会有额外的空间和性能损失 | |||||
| bool support_rotation = 5; | |||||
| // [End] 动态AIPP参数 | |||||
| // [Begin] 静态AIPP参数,配置动态AIPP时无效 | |||||
| InputFormat input_format = 51; | |||||
| bool csc_switch = 52; | |||||
| float cpadding_value = 53; | |||||
| bool rbuv_swap_switch = 54; | |||||
| bool ax_swap_switch = 55; | |||||
| bool single_line_mode = 56; | |||||
| int32 src_image_size_w = 57; | |||||
| int32 src_image_size_h = 58; | |||||
| bool crop = 59; | |||||
| int32 load_start_pos_w = 60; | |||||
| int32 load_start_pos_h = 61; | |||||
| int32 crop_size_w = 62; | |||||
| int32 crop_size_h = 63; | |||||
| bool resize = 64; | |||||
| int32 resize_output_w = 65; | |||||
| int32 resize_output_h = 66; | |||||
| bool padding = 67; | |||||
| int32 left_padding_size = 68; | |||||
| int32 right_padding_size = 69; | |||||
| int32 top_padding_size = 70; | |||||
| int32 bottom_padding_size = 71; | |||||
| float padding_value = 72; | |||||
| int32 mean_chn_0 = 10; | |||||
| int32 mean_chn_1 = 11; | |||||
| int32 mean_chn_2 = 12; | |||||
| int32 mean_chn_3 = 19; | |||||
| float min_chn_0 = 13; | |||||
| float min_chn_1 = 14; | |||||
| float min_chn_2 = 15; | |||||
| float min_chn_3 = 20; | |||||
| repeated float var_reci_chn_0 = 16; | |||||
| repeated float var_reci_chn_1 = 17; | |||||
| repeated float var_reci_chn_2 = 18; | |||||
| repeated float var_reci_chn_3 = 21; | |||||
| repeated int32 matrix_r0c0 = 30; | |||||
| repeated int32 matrix_r0c1 = 31; | |||||
| repeated int32 matrix_r0c2 = 32; | |||||
| repeated int32 matrix_r1c0 = 33; | |||||
| repeated int32 matrix_r1c1 = 34; | |||||
| repeated int32 matrix_r1c2 = 35; | |||||
| repeated int32 matrix_r2c0 = 36; | |||||
| repeated int32 matrix_r2c1 = 37; | |||||
| repeated int32 matrix_r2c2 = 38; | |||||
| repeated int32 output_bias_0 = 39; | |||||
| repeated int32 output_bias_1 = 40; | |||||
| repeated int32 output_bias_2 = 41; | |||||
| repeated int32 input_bias_0 = 42; | |||||
| repeated int32 input_bias_1 = 43; | |||||
| repeated int32 input_bias_2 = 44; | |||||
| // [End] 静态AIPP参数 | |||||
| // The n number that is used for raw/rgbir data into f16 transformation. | |||||
| // The transformation equation is x/(2^n). If set to 0, no transform is performed. | |||||
| uint32 raw_rgbir_to_f16_n = 45; | |||||
| } | |||||
| message MultiShapeOpParams { | |||||
| enum MultiShapeMode { | |||||
| batch = 0; //动态batch | |||||
| resolution = 1; //动态分辨率,扩展用 | |||||
| } | |||||
| MultiShapeMode mode = 1; //算子模式 | |||||
| uint32 related_input_rank = 2; //新增算子插入到哪个输入 | |||||
| repeated uint32 batch_list = 11; //batch_list值,batch_list的个数是2到8之间 | |||||
| } | |||||
| @@ -1,396 +0,0 @@ | |||||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or modify | |||||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * Apache License for more details at | |||||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||||
| */ | |||||
| syntax = "proto3"; | |||||
| package domi; | |||||
| enum TargetType | |||||
| { | |||||
| MINI = 0; | |||||
| TINY = 1; | |||||
| LITE = 2; | |||||
| } | |||||
| // offline model | |||||
| message ModelDef { | |||||
| string name = 1; | |||||
| uint32 version = 2; | |||||
| uint64 memory_size = 10; | |||||
| uint32 stream_num = 11; | |||||
| uint32 event_num = 12; | |||||
| uint64 weight_size = 13; | |||||
| uint32 label_num = 15; | |||||
| repeated OpDef op = 20; | |||||
| TargetType target_type = 23; | |||||
| map<string, AttrDef> attr = 30; | |||||
| }; | |||||
| // operator define | |||||
| message OpDef { | |||||
| string name = 1; | |||||
| string type = 2; | |||||
| uint32 id = 3; | |||||
| uint32 stream_id = 4; | |||||
| repeated string input_name = 5; | |||||
| repeated string src_name = 8; | |||||
| repeated int32 src_index = 9; | |||||
| repeated int64 input = 10; | |||||
| repeated int64 output = 11; | |||||
| repeated TensorDescriptor input_desc = 12; | |||||
| repeated TensorDescriptor output_desc = 13; | |||||
| repeated WeightDef weights = 14; | |||||
| repeated string dst_name = 15; | |||||
| repeated int32 dst_index = 16; | |||||
| repeated int64 workspace = 20; | |||||
| repeated uint32 workspace_bytes = 21; | |||||
| repeated string weight_name = 22; | |||||
| repeated bool is_input_const = 23; | |||||
| map<string, AttrDef> attr = 30; | |||||
| QuantizeFactorParams quantize_factor = 31; | |||||
| oneof op_params { | |||||
| // start at 100 here | |||||
| SendOpParams sender_param = 100; | |||||
| RecvOpParams receiver_param = 200; | |||||
| ConvolutionOpParams convolution_param = 300; | |||||
| PoolingOpParams pooling_param = 400; | |||||
| EltwiseOpParams eltwise_param = 500; | |||||
| BatchNormOpParams batchnorm_param = 600; | |||||
| ScaleOpParams scale_param = 700; | |||||
| FullConnectionOpParams full_connection_param = 800; | |||||
| SoftmaxOpParams softmax_param = 900; | |||||
| ActivationOpParams activation_param = 1000; | |||||
| ReshapeOpParams reshape_param = 1100; | |||||
| } | |||||
| }; | |||||
| message SendOpParams { | |||||
| uint32 event_id = 1; | |||||
| }; | |||||
| message RecvOpParams { | |||||
| uint32 event_id = 1; | |||||
| }; | |||||
| enum QuantizeScaleType | |||||
| { | |||||
| VECTOR_SCALE = 0; | |||||
| SCALAR_SCALE = 1; | |||||
| } | |||||
| enum QuantizeScaleMode | |||||
| { | |||||
| NORMAL_MODE = 0; | |||||
| SQRT_MODE = 1; | |||||
| } | |||||
| enum QuantizeAlgorithm | |||||
| { | |||||
| NON_OFFSET_ALGO = 0; | |||||
| HALF_OFFSET_ALGO = 1; | |||||
| ALL_OFFSET_ALGO = 2; | |||||
| } | |||||
| message QuantizeFactor | |||||
| { | |||||
| QuantizeScaleMode scale_mode = 1; | |||||
| bytes scale_value = 2; | |||||
| int64 scale_offset = 3; | |||||
| bytes offset_data_value = 4; | |||||
| int64 offset_data_offset = 5; | |||||
| bytes offset_weight_value = 6; | |||||
| int64 offset_weight_offset = 7; | |||||
| bytes offset_pad_value = 8; | |||||
| int64 offset_pad_offset = 9; | |||||
| }; | |||||
| message QuantizeCalcFactor | |||||
| { | |||||
| bytes offsetw = 1; | |||||
| int64 offsetw_offset = 2; | |||||
| bytes offsetd = 3; | |||||
| int64 offsetd_offset = 4; | |||||
| bytes scalereq = 5; | |||||
| int64 scaledreq_offset = 6; | |||||
| bytes offsetdnext = 7; | |||||
| int64 offsetdnext_offset = 8; | |||||
| } | |||||
| message QuantizeFactorParams | |||||
| { | |||||
| QuantizeAlgorithm quantize_algo = 1; | |||||
| QuantizeScaleType scale_type = 2; | |||||
| QuantizeFactor quantize_param = 3; | |||||
| QuantizeFactor dequantize_param = 4; | |||||
| QuantizeFactor requantize_param = 5; | |||||
| QuantizeCalcFactor quantizecalc_param = 6; | |||||
| }; | |||||
| message ConvolutionOpParams { | |||||
| int32 mode = 1; | |||||
| int32 algo = 2; | |||||
| int32 pad_mode = 3; | |||||
| uint32 group = 4; | |||||
| uint32 num_output = 5; | |||||
| repeated uint32 pad = 10; | |||||
| repeated uint32 stride = 11; | |||||
| repeated uint32 dilation = 12; | |||||
| repeated uint32 kernel = 13; | |||||
| float alpha = 20; | |||||
| float beta = 21; | |||||
| WeightDef filter = 40; | |||||
| WeightDef bias = 41; | |||||
| bool relu_flag = 62; | |||||
| repeated uint32 adj = 70; | |||||
| repeated uint32 target_shape = 71; | |||||
| repeated uint32 before_pad = 72; | |||||
| }; | |||||
| message PoolingOpParams { | |||||
| int32 mode = 1; | |||||
| int32 nan_opt = 2; | |||||
| int32 pad_mode = 3; | |||||
| bool global_pooling = 4; | |||||
| repeated uint32 window = 10; | |||||
| repeated uint32 pad = 11; | |||||
| repeated uint32 stride = 12; | |||||
| bool ceil_mode = 13; | |||||
| int32 data_mode = 14; | |||||
| float alpha = 20; | |||||
| float beta = 21; | |||||
| repeated uint32 before_pad = 22; | |||||
| }; | |||||
| message EltwiseOpParams { | |||||
| int32 mode = 1; | |||||
| repeated float coeff = 2; | |||||
| float alpha = 3; | |||||
| float beta = 4; | |||||
| repeated WeightDef weight = 5; | |||||
| bool relu_flag = 6; | |||||
| }; | |||||
| message ActivationOpParams { | |||||
| int32 mode = 1; | |||||
| float coef = 2; | |||||
| float alpha = 3; | |||||
| float beta = 4; | |||||
| }; | |||||
| message BatchNormOpParams { | |||||
| int32 mode = 1; | |||||
| float alpha = 2; | |||||
| float beta = 3; | |||||
| double epsilon = 4;//optinal,[default = 1e-5] | |||||
| bool use_global_stats = 5; //optinal,by default true,testing mode | |||||
| float moving_average_fraction = 6; //optinal,[default = .999]; | |||||
| WeightDef estimated_mean = 7; | |||||
| WeightDef estimated_variance = 8; | |||||
| WeightDef scale = 9; | |||||
| WeightDef bias = 10; | |||||
| }; | |||||
| message ScaleOpParams { | |||||
| WeightDef scale = 1; | |||||
| WeightDef bias = 2; | |||||
| }; | |||||
| message ReshapeOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| ShapeDef shape = 3; | |||||
| int32 axis = 4; | |||||
| int32 num_axes = 5; | |||||
| int32 format = 6; | |||||
| }; | |||||
| message SoftmaxOpParams { | |||||
| int32 algo = 1; | |||||
| int32 mode = 2; | |||||
| float alpha = 3; | |||||
| float beta = 4; | |||||
| }; | |||||
| message FullConnectionOpParams { | |||||
| WeightDef filter = 1; | |||||
| WeightDef bias = 2; | |||||
| uint32 num_output = 3; | |||||
| bool relu_flag = 12; | |||||
| }; | |||||
| message FlattenOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| int32 start_axis = 3; | |||||
| int32 end_axis = 4; | |||||
| } | |||||
| message AddLimitedOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| int32 axis = 3; | |||||
| bool broadcast = 4; | |||||
| repeated WeightDef weight = 10; | |||||
| }; | |||||
| message MulLimitedOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| int32 axis = 3; | |||||
| bool broadcast = 4; | |||||
| repeated WeightDef weight = 10; | |||||
| }; | |||||
| message AddOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| repeated WeightDef weight = 10; | |||||
| }; | |||||
| message MulOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| repeated WeightDef weight = 10; | |||||
| }; | |||||
| message SubOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| repeated WeightDef weight = 10; | |||||
| }; | |||||
| message BiasAddOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| WeightDef bias = 10; | |||||
| }; | |||||
| message MatMulOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| bool transposeX = 3; | |||||
| bool transposeW = 4; | |||||
| WeightDef filter = 10; | |||||
| WeightDef bias = 12; | |||||
| }; | |||||
| message RsqrtOpParams { | |||||
| float alpha = 1; | |||||
| float beta = 2; | |||||
| }; | |||||
| message WeightDef { | |||||
| int32 format = 1; | |||||
| int32 data_type = 2; | |||||
| ShapeDef shape = 3; | |||||
| bytes data = 4; | |||||
| int64 data_offset = 5; | |||||
| uint32 cmps_size = 6; | |||||
| bytes cmps_tab = 7; | |||||
| int64 cmps_tab_offset = 10; | |||||
| CompressInfo cmps_info = 8; | |||||
| AllOffsetQuantizeInfo alloffset_quantize_info = 11; | |||||
| } | |||||
| message ShapeDef { | |||||
| repeated int64 dim = 1; | |||||
| } | |||||
| enum DeviceType { | |||||
| NPU = 0; // In default, we will use NPU. | |||||
| CPU = 1; // CPU | |||||
| } | |||||
| message AllOffsetQuantizeInfo { | |||||
| float scale = 1; | |||||
| int32 offset = 2; | |||||
| } | |||||
| message TensorDescriptor { | |||||
| int32 format = 1; | |||||
| int32 data_type = 2; | |||||
| repeated int64 dim = 3; | |||||
| uint32 size = 4; | |||||
| bool reuse_input = 5; | |||||
| bool output_tensor = 7; | |||||
| DeviceType device_type = 8; | |||||
| bool input_tensor = 9; | |||||
| uint32 real_dim_cnt = 10; | |||||
| uint32 reuse_input_index = 11; | |||||
| AllOffsetQuantizeInfo alloffset_quantize_info = 12; | |||||
| } | |||||
| message CompressInfo { | |||||
| int32 blockRow = 1; // block row | |||||
| int32 blockCol = 2; // block col | |||||
| int32 fractalK = 3; // fractal K | |||||
| int32 fractalN = 4; // fractal N | |||||
| int32 lastFractalK = 5; // K of last fractal | |||||
| int32 lastFractalN = 6; // N of last fractal | |||||
| int32 cubeSize = 7; // cube's length | |||||
| int32 loadDir = 8; // data load directtiono 0:col load 1:row load | |||||
| } | |||||
| message AttrDef { | |||||
| message ListValue { | |||||
| repeated string s = 2; // "list(string)" | |||||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||||
| repeated float f = 4 [packed = true]; // "list(float)" | |||||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||||
| repeated uint32 u = 6 [packed = true]; // "list(uint)" | |||||
| repeated bytes bt = 7; | |||||
| } | |||||
| oneof value { | |||||
| string s = 2; // "string" | |||||
| int64 i = 3; // "int" | |||||
| float f = 4; // "float" | |||||
| bool b = 5; // "bool" | |||||
| uint32 u = 6; // "uint32" | |||||
| bytes bt = 7; | |||||
| ListValue list = 1; // any "list(...)" | |||||
| NamedAttrs func = 10; | |||||
| } | |||||
| } | |||||
| // A list of attr names and their values. The whole list is attached | |||||
| // with a string name. E.g., MatMul[T=float]. | |||||
| message NamedAttrs { | |||||
| string name = 1; | |||||
| map<string, AttrDef> attr = 2; | |||||
| } | |||||
| @@ -1,179 +0,0 @@ | |||||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or modify | |||||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * Apache License for more details at | |||||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||||
| */ | |||||
| syntax = "proto3"; | |||||
| package domi; | |||||
| message ModelTaskDef { | |||||
| string version = 1; | |||||
| map<string, string> attr = 9; // Extended field | |||||
| repeated TaskDef task = 10; | |||||
| uint64 memory_size = 11; | |||||
| uint32 stream_num = 12; | |||||
| uint32 event_num = 13; | |||||
| uint64 weight_size = 14; | |||||
| repeated bytes op = 15; // input/output opdef in bytes | |||||
| uint64 base_addr = 16; // base addr | |||||
| uint64 weight_addr = 17; // weight addr | |||||
| uint32 batch_num = 18; | |||||
| } | |||||
| message TaskDef { | |||||
| uint32 id = 1; | |||||
| uint32 type = 2; | |||||
| uint32 stream_id = 10; | |||||
| uint32 event_id = 11; | |||||
| KernelDef kernel = 20; | |||||
| KernelExDef kernel_ex = 21; | |||||
| KernelHcclDef kernel_hccl = 25; | |||||
| EventExDef event_ex = 26; | |||||
| LogTimeStampDef log_timestamp = 28; | |||||
| uint32 label_id = 30; | |||||
| MemcpyAsyncDef memcpy_async = 31; | |||||
| StreamSwitchDef stream_switch = 32; | |||||
| StreamActiveDef stream_active = 33; | |||||
| bytes private_def = 34; | |||||
| uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future | |||||
| StreamSwitchNDef stream_switch_n = 36; | |||||
| LabelSetDef label_set = 37; | |||||
| LabelGotoExDef label_goto_ex = 38; | |||||
| LabelSwitchByIndexDef label_switch_by_index = 39; | |||||
| KernelDefWithHandle kernel_with_handle = 40; | |||||
| } | |||||
| message KernelDef { | |||||
| KernelContext context = 1; | |||||
| string stub_func = 10; | |||||
| uint32 block_dim = 11; | |||||
| uint32 args_size = 12; | |||||
| bytes args = 13; | |||||
| bytes sm_desc = 14; | |||||
| bytes flowtable = 15; | |||||
| string so_name = 16; | |||||
| string kernel_name = 17; | |||||
| bytes kernel_ext_info = 18; | |||||
| uint32 kernel_ext_info_size = 19; | |||||
| } | |||||
| message KernelDefWithHandle { | |||||
| KernelContext context = 1; | |||||
| uint64 handle = 10; | |||||
| string dev_func = 11; | |||||
| uint32 block_dim = 12; | |||||
| uint32 args_size = 13; | |||||
| bytes args = 14; | |||||
| bytes sm_desc = 15; | |||||
| string original_kernel_key = 16; | |||||
| string node_info = 17; | |||||
| } | |||||
| message KernelContext { | |||||
| uint32 kernel_type = 1; | |||||
| uint32 op_id = 2; // OP type in CCE | |||||
| uint32 kernel_func_id = 3; | |||||
| uint32 op_index = 4; // TE/Custom operator | |||||
| bool is_flowtable = 5; // Identify whether args is a flowtable structure | |||||
| bytes args_offset = 6; // args offset information | |||||
| uint32 args_count = 7; // args count | |||||
| repeated uint32 origin_op_index = 8; | |||||
| } | |||||
| message KernelExDef { | |||||
| uint32 flags = 1; | |||||
| uint32 op_index = 4; | |||||
| uint32 args_size = 12; | |||||
| bytes args = 13; | |||||
| bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput | |||||
| uint32 task_info_size = 15; | |||||
| bytes kernel_ext_info = 16; | |||||
| uint32 kernel_ext_info_size = 17; | |||||
| } | |||||
| message KernelHcclDef { | |||||
| uint32 op_index = 8; | |||||
| string hccl_type = 9; | |||||
| } | |||||
| message EventExDef { | |||||
| uint32 op_index = 1; | |||||
| uint32 event_type = 2; | |||||
| } | |||||
| message LogTimeStampDef { | |||||
| uint64 logid = 1; | |||||
| bool notify = 2; | |||||
| uint32 flat = 3; | |||||
| } | |||||
| message MemcpyAsyncDef { | |||||
| uint64 dst = 1; | |||||
| uint64 dst_max = 2; | |||||
| uint64 src = 3; | |||||
| uint64 count = 4; | |||||
| uint32 kind = 5; | |||||
| uint32 op_index = 6; | |||||
| } | |||||
| message StreamSwitchDef { | |||||
| uint32 op_index = 1; | |||||
| uint32 true_stream_id = 2; | |||||
| int64 value = 3; | |||||
| uint64 value_ptr = 4; | |||||
| uint32 data_type = 5; | |||||
| } | |||||
| message StreamActiveDef { | |||||
| uint32 op_index = 1; | |||||
| uint32 active_stream_id = 2; | |||||
| } | |||||
| message StreamSwitchNDef { | |||||
| uint32 op_index = 1; | |||||
| uint32 size = 2; | |||||
| repeated int64 target_value = 3; | |||||
| repeated uint32 true_stream_id = 4; | |||||
| uint32 element_size = 5; | |||||
| uint32 data_type = 6; | |||||
| } | |||||
| message LabelSetDef { | |||||
| uint32 op_index = 1; | |||||
| uint32 label_id = 2; | |||||
| uint32 model_id = 3; | |||||
| } | |||||
| message LabelGotoExDef { | |||||
| uint32 op_index = 1; | |||||
| uint32 label_id = 2; | |||||
| uint32 model_id = 3; | |||||
| } | |||||
| message LabelSwitchByIndexDef { | |||||
| uint32 op_index = 1; | |||||
| uint32 label_max = 2; | |||||
| } | |||||
| @@ -36,7 +36,6 @@ | |||||
| #include "graph/compute_graph.h" | #include "graph/compute_graph.h" | ||||
| #include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
| #include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
| #include "graph/optimize/common/params.h" | |||||
| #include "graph/utils/type_utils.h" | #include "graph/utils/type_utils.h" | ||||
| #include "ir_build/atc_ir_common.h" | #include "ir_build/atc_ir_common.h" | ||||
| #include "omg/omg_inner_types.h" | #include "omg/omg_inner_types.h" | ||||
| @@ -690,8 +689,6 @@ FMK_FUNC_HOST_VISIBILITY Status ParseGraph(ge::Graph &graph, const std::map<stri | |||||
| // Prevent data residue in multiple calls | // Prevent data residue in multiple calls | ||||
| PreChecker::Instance().Clear(); | PreChecker::Instance().Clear(); | ||||
| Params::Instance()->SetTarget(target); | |||||
| // Create an empty computegraph | // Create an empty computegraph | ||||
| std::string om_name; | std::string om_name; | ||||
| ParseAtcParms(atc_params, "output", om_name); | ParseAtcParms(atc_params, "output", om_name); | ||||
| @@ -28,18 +28,7 @@ | |||||
| #include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
| #include "ge/ge_api_error_codes.h" | #include "ge/ge_api_error_codes.h" | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| #define DOMI_LOGE(fmt, ...) GE_LOG_ERROR(GE_MODULE_NAME, ge::FAILED, fmt, ##__VA_ARGS__) | #define DOMI_LOGE(fmt, ...) GE_LOG_ERROR(GE_MODULE_NAME, ge::FAILED, fmt, ##__VA_ARGS__) | ||||
| #else | |||||
| #include <android/log.h> | |||||
| #if defined(BUILD_VERSION_PERF) | |||||
| #define DOMI_LOGE(fmt, ...) | |||||
| #else | |||||
| // The Android system has strict log control. Do not modify the log. | |||||
| #define DOMI_LOGE(fmt, ...) \ | |||||
| __android_log_print(ANDROID_LOG_ERROR, "NPU_FMK", "%s %s(%d)::" #fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__) | |||||
| #endif | |||||
| #endif | |||||
| // ge marco | // ge marco | ||||
| #define GE_LOGI_IF(condition, ...) \ | #define GE_LOGI_IF(condition, ...) \ | ||||
| @@ -31,13 +31,8 @@ | |||||
| #include "framework/common/op_types.h" | #include "framework/common/op_types.h" | ||||
| #include "register/register_types.h" | #include "register/register_types.h" | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| #define DOMI_DYNAMIC_CAST static_cast | #define DOMI_DYNAMIC_CAST static_cast | ||||
| #define DOMI_DYNAMIC_POINTER_CAST std::static_pointer_cast | #define DOMI_DYNAMIC_POINTER_CAST std::static_pointer_cast | ||||
| #else | |||||
| #define DOMI_DYNAMIC_CAST static_cast | |||||
| #define DOMI_DYNAMIC_POINTER_CAST std::static_pointer_cast | |||||
| #endif | |||||
| namespace ge { | namespace ge { | ||||
| // dump | // dump | ||||
| @@ -78,12 +73,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string MODEL_ | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const int MODEL_MAX_SIZE; // Max size of 2 GB minus 1 byte. | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const int MODEL_MAX_SIZE; // Max size of 2 GB minus 1 byte. | ||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint64_t FILE_HEADER_MAX_SIZE; // Max size of 3 GB. | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint64_t FILE_HEADER_MAX_SIZE; // Max size of 3 GB. | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint64_t ALLOC_MEMORY_MAX_SIZE; // Max size of 8 GB. | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint64_t ALLOC_MEMORY_MAX_SIZE; // Max size of 8 GB. | ||||
| #else | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint64_t ALLOC_MEMORY_MAX_SIZE; // Max size of 512M. | |||||
| #endif | |||||
| template <typename K, typename V> | template <typename K, typename V> | ||||
| static std::pair<V, K> flip_pair(const std::pair<K, V> &p) { | static std::pair<V, K> flip_pair(const std::pair<K, V> &p) { | ||||
| @@ -855,9 +845,7 @@ struct ModelFileHeader { | |||||
| uint8_t reserved[MODEL_FILE_RESERVED_LENGTH] = {0}; // Reserved field 75 | uint8_t reserved[MODEL_FILE_RESERVED_LENGTH] = {0}; // Reserved field 75 | ||||
| }; | }; | ||||
| static constexpr uint8_t TARGET_TYPE_LTTE_8BIT = 0; | |||||
| static constexpr uint8_t TARGET_TYPE_MINI_8BIT = 1; | static constexpr uint8_t TARGET_TYPE_MINI_8BIT = 1; | ||||
| static constexpr uint8_t TARGET_TYPE_TINY_8BIT = 2; | |||||
| static constexpr int32_t PARTITION_TYPE_MODEL_DEF = 0; | static constexpr int32_t PARTITION_TYPE_MODEL_DEF = 0; | ||||
| static constexpr int32_t PARTITION_TYPE_WEIGHTS = 1; | static constexpr int32_t PARTITION_TYPE_WEIGHTS = 1; | ||||
| @@ -22,21 +22,12 @@ | |||||
| #include "register/register_types.h" | #include "register/register_types.h" | ||||
| #if !defined(__ANDROID__) && !defined(ANDROID) | |||||
| #ifndef DOMI_DYNAMIC_CAST | #ifndef DOMI_DYNAMIC_CAST | ||||
| #define DOMI_DYNAMIC_CAST static_cast | #define DOMI_DYNAMIC_CAST static_cast | ||||
| #endif | #endif | ||||
| #ifndef DOMI_DYNAMIC_POINTER_CAST | #ifndef DOMI_DYNAMIC_POINTER_CAST | ||||
| #define DOMI_DYNAMIC_POINTER_CAST std::static_pointer_cast | #define DOMI_DYNAMIC_POINTER_CAST std::static_pointer_cast | ||||
| #endif | #endif | ||||
| #else | |||||
| #ifndef DOMI_DYNAMIC_CAST | |||||
| #define DOMI_DYNAMIC_CAST static_cast | |||||
| #endif | |||||
| #ifndef DOMI_DYNAMIC_POINTER_CAST | |||||
| #define DOMI_DYNAMIC_POINTER_CAST std::static_pointer_cast | |||||
| #endif | |||||
| #endif | |||||
| namespace ge { | namespace ge { | ||||
| namespace parser { | namespace parser { | ||||
| @@ -25,7 +25,6 @@ | |||||
| #include "common/types.h" | #include "common/types.h" | ||||
| #include "graph/compute_graph.h" | #include "graph/compute_graph.h" | ||||
| #include "graph/op_desc.h" | #include "graph/op_desc.h" | ||||
| #include "graph/optimize/common/params.h" | |||||
| #include "graph/types.h" | #include "graph/types.h" | ||||
| #include "graph/utils/attr_utils.h" | #include "graph/utils/attr_utils.h" | ||||
| #include "graph/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||