From e5bbe368b86836ffb8fa09b46540a5bac65d59d9 Mon Sep 17 00:00:00 2001 From: yanqingshang Date: Mon, 1 Feb 2021 20:20:46 +0800 Subject: [PATCH] sync inc code --- configure.py | 1 - inc/graphengine/inc/external/ge/ge_api.h | 53 -- .../inc/external/ge/ge_api_error_codes.h | 57 -- .../inc/external/ge/ge_api_types.h | 127 +---- .../inc/external/ge/ge_error_codes.h | 61 --- inc/graphengine/inc/external/ge/ge_ir_build.h | 75 +-- inc/graphengine/inc/external/ge/ge_prof.h | 102 ++++ .../inc/framework/common/debug/ge_log.h | 90 ++-- .../inc/framework/common/debug/log.h | 35 +- .../inc/framework/common/fmk_error_codes.h | 8 +- .../framework/common/ge_compiler_options.h | 32 -- .../framework/common/ge_inner_error_codes.h | 17 +- .../inc/framework/common/ge_types.h | 33 +- .../framework/common/helper/model_helper.h | 72 +-- .../framework/common/helper/om_file_helper.h | 18 +- .../inc/framework/common/op/attr_value_util.h | 3 +- .../inc/framework/common/op/ge_op_utils.h | 158 +++++- .../inc/framework/common/op/op_parser_util.h | 6 + .../framework/common/profiling/ge_profiling.h | 46 -- .../common/profiling/ge_runner_profiling.h | 24 - .../inc/framework/common/scope_guard.h | 5 +- .../inc/framework/common/string_util.h | 5 +- .../inc/framework/common/taskdown_common.h | 71 --- inc/graphengine/inc/framework/common/types.h | 20 +- inc/graphengine/inc/framework/common/util.h | 122 ++--- .../inc/framework/engine/dnnengine.h | 1 - .../inc/framework/executor/ge_executor.h | 34 +- .../inc/framework/ge_runtime/task_info.h | 31 +- .../inc/framework/generator/ge_generator.h | 16 +- .../inc/framework/memory/memory_api.h | 16 +- .../inc/framework/memory/memory_assigner.h | 2 +- inc/graphengine/inc/framework/omg/omg.h | 5 +- .../inc/framework/omg/omg_inner_types.h | 14 +- .../inc/framework/omg/parser/model_parser.h | 78 ++- .../inc/framework/omg/parser/op_parser.h | 2 +- .../inc/framework/omg/parser/parser_factory.h | 2 +- .../framework/omg/parser/parser_inner_ctx.h | 39 +- .../inc/framework/omg/parser/parser_types.h | 510 ------------------ inc/metadef/inc/common/util/platform_info.h | 52 +- .../inc/common/util/platform_infos_def.h | 224 +------- inc/metadef/inc/external/graph/graph.h | 2 + inc/metadef/inc/external/graph/operator.h | 2 + inc/metadef/inc/external/graph/types.h | 29 +- .../scope/scope_fusion_pass_register.h | 5 +- inc/metadef/inc/graph/compute_graph.h | 7 + inc/metadef/inc/graph/debug/ge_attr_define.h | 16 + .../inc/graph/detail/attributes_holder.h | 3 +- inc/metadef/inc/graph/op_desc.h | 3 +- inc/metadef/inc/graph/tuning_utils.h | 2 +- inc/metadef/inc/graph/utils/graph_utils.h | 16 + inc/metadef/inc/graph/utils/node_utils.h | 2 +- inc/metadef/inc/graph/utils/op_desc_utils.h | 8 +- inc/metadef/inc/graph/utils/type_utils.h | 1 + inc/metadef/inc/register/op_kernel_registry.h | 5 +- inc/metadef/inc/register/op_registry.h | 3 +- .../inc/register/scope/scope_graph_impl.h | 16 +- inc/mmpa/sub_inc/mmpa_linux.h | 6 +- inc/mmpa/sub_inc/mmpa_win.h | 1 + inc/runtime/base.h | 64 ++- inc/runtime/config.h | 137 ++--- inc/runtime/context.h | 25 +- inc/runtime/dev.h | 55 +- inc/runtime/kernel.h | 91 ++-- inc/runtime/mem.h | 112 ++-- inc/toolchain/plog.h | 6 +- inc/toolchain/slog.h | 12 +- 66 files changed, 909 insertions(+), 1987 deletions(-) delete mode 100644 inc/graphengine/inc/external/ge/ge_error_codes.h create mode 100644 inc/graphengine/inc/external/ge/ge_prof.h delete mode 100644 inc/graphengine/inc/framework/common/ge_compiler_options.h delete mode 100644 inc/graphengine/inc/framework/common/profiling/ge_profiling.h delete mode 100644 inc/graphengine/inc/framework/common/profiling/ge_runner_profiling.h delete mode 100644 inc/graphengine/inc/framework/common/taskdown_common.h delete mode 100644 inc/graphengine/inc/framework/omg/parser/parser_types.h diff --git a/configure.py b/configure.py index 29878eaa3..ffaa3e784 100755 --- a/configure.py +++ b/configure.py @@ -135,7 +135,6 @@ def setup_ascend(env_path): print('ascend path: %s.' % ascend_path) with open(real_config_path('LINK_FLAGS'), 'a') as f: f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libtsdclient.so\n")) - f.write(os.path.join(ascend_path, "driver", "lib64", "common", "libc_sec.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libge_runner.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libfmk_parser.so\n")) f.write(os.path.join(ascend_path, "fwkacllib", "lib64", "libdatatransfer.so\n")) diff --git a/inc/graphengine/inc/external/ge/ge_api.h b/inc/graphengine/inc/external/ge/ge_api.h index 9c26ebf88..b4b9bb2af 100644 --- a/inc/graphengine/inc/external/ge/ge_api.h +++ b/inc/graphengine/inc/external/ge/ge_api.h @@ -29,26 +29,16 @@ namespace ge { typedef uint32_t (*pCallBackFunc)(uint32_t graph_id, const std::map ¶ms_list); -namespace session { -typedef uint32_t (*pCallBackFunc)(uint32_t graph_id, const std::map ¶ms_list); -} - // Initialize GE -ATTRIBUTED_DEPRECATED(Status GEInitialize(const std::map &)) Status GEInitialize(const std::map &options); -Status GEInitialize(const std::map &options); - // Finalize GE, release all resources Status GEFinalize(); class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session { public: - ATTRIBUTED_DEPRECATED(Session(const std::map &)) explicit Session(const std::map &options); - explicit Session(const std::map &options); - ~Session(); /// @@ -67,38 +57,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session { /// @param [in] options graph options /// @return Status result of function /// - ATTRIBUTED_DEPRECATED(Status AddGraph(uint32_t, const Graph &, const std::map &)) Status AddGraph(uint32_t graphId, const Graph &graph, const std::map &options); - /// - /// @ingroup client - /// @brief add a graph with a specific graphId and graphOptions - /// @param [in] graphId graph id - /// @param [in] graph the graph - /// @param [in] options graph options - /// @return Status result of function - /// - Status AddGraph(uint32_t graphId, const Graph &graph, const std::map &options); - - /// - /// @ingroup client - /// @brief add a copy graph with a specific graphId - /// @param [in] graphId graph id - /// @param [in] graph the graph - /// @return Status result of function - /// - Status AddGraphWithCopy(uint32_t graph_id, const Graph &graph); - - /// - /// @ingroup client - /// @brief add a copy graph with a specific graphId and graphOptions - /// @param [in] graphId graph id - /// @param [in] graph the graph - /// @param [in] options graph options - /// @return Status result of function - /// - Status AddGraphWithCopy(uint32_t graph_id, const Graph &graph, const std::map &options); - /// /// @ingroup ge_graph /// @brief remove a graph of the session with specific session id @@ -145,18 +105,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session { /// @param [out] var_values: variable values /// @return Status result of function /// - ATTRIBUTED_DEPRECATED(Status GetVariables(const std::vector &, std::vector &)) Status GetVariables(const std::vector &var_names, std::vector &var_values); - /// - /// @ingroup ge_graph - /// @brief get variables in the session with specific session id - /// @param [in] var_names: variable names - /// @param [out] var_values: variable values - /// @return Status result of function - /// - Status GetVariables(const std::vector &var_names, std::vector &var_values); - /// /// @ingroup ge_graph /// @brief register callback func with specific summary or checkpoint by users @@ -166,11 +116,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session { /// Please ensure that the implementation of the function is trusted. /// @return Status result of function /// - ATTRIBUTED_DEPRECATED(Status RegisterCallBackFunc(const char *, const session::pCallBackFunc &)) Status RegisterCallBackFunc(const std::string &key, const pCallBackFunc &callback); - Status RegisterCallBackFunc(const char *key, const session::pCallBackFunc &callback); - bool IsGraphNeedRebuild(uint32_t graphId); private: diff --git a/inc/graphengine/inc/external/ge/ge_api_error_codes.h b/inc/graphengine/inc/external/ge/ge_api_error_codes.h index e77f817c9..7b045d548 100644 --- a/inc/graphengine/inc/external/ge/ge_api_error_codes.h +++ b/inc/graphengine/inc/external/ge/ge_api_error_codes.h @@ -19,15 +19,8 @@ #include #include -#include "ge_error_codes.h" namespace ge { -#ifdef __GNUC__ -#define ATTRIBUTED_DEPRECATED(replacement) __attribute__((deprecated("Please use " #replacement " instead."))) -#else -#define ATTRIBUTED_DEPRECATED(replacement) __declspec(deprecated("Please use " #replacement " instead.")) -#endif - class StatusFactory { public: static StatusFactory *Instance() { @@ -43,17 +36,6 @@ class StatusFactory { err_desc_[err] = desc; } - void RegisterErrorNo(uint32_t err, const char *desc) { - if (desc == nullptr) { - return; - } - std::string error_desc = desc; - if (err_desc_.find(err) != err_desc_.end()) { - return; - } - err_desc_[err] = error_desc; - } - std::string GetErrDesc(uint32_t err) { auto iter_find = err_desc_.find(err); if (iter_find == err_desc_.end()) { @@ -73,7 +55,6 @@ class StatusFactory { class ErrorNoRegisterar { public: ErrorNoRegisterar(uint32_t err, const std::string &desc) { StatusFactory::Instance()->RegisterErrorNo(err, desc); } - ErrorNoRegisterar(uint32_t err, const char *desc) { StatusFactory::Instance()->RegisterErrorNo(err, desc); } ~ErrorNoRegisterar() {} }; @@ -85,49 +66,11 @@ class ErrorNoRegisterar { ((0xFF & (static_cast(modid))) << 12) | (0x0FFF & (static_cast(value))); \ const ErrorNoRegisterar g_##name##_errorno(name, desc); -#define GE_ERRORNO_EXTERNAL(name, desc) const ErrorNoRegisterar g_##name##_errorno(name, desc); - using Status = uint32_t; // General error code GE_ERRORNO(0, 0, 0, 0, 0, SUCCESS, 0, "success"); GE_ERRORNO(0b11, 0b11, 0b111, 0xFF, 0b11111, FAILED, 0xFFF, "failed"); /*lint !e401*/ - -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_PARAM_INVALID, "Parameter invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_NOT_INIT, "GE executor not initialized yet."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID, "Model file path invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, "Model id invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "Data size of model invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID, "Model addr invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID, "Queue id of model invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "The model loaded repeatedly."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, "Dynamic input addr invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID, "Dynamic input size invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID, "Dynamic batch size invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_AIPP_BATCH_EMPTY, "AIPP batch parameter empty."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_AIPP_NOT_EXIST, "AIPP parameter not exist."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_AIPP_MODE_INVALID, "AIPP mode invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_OP_TASK_TYPE_INVALID, "Task type invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID, "Kernel type invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_PLGMGR_PATH_INVALID, "Plugin path is invalid."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_TRANSSHAPE_FORMAT_INVALID, "Format is invalid when transferring shape."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_TRANSSHAPE_SHAPE_INVALID, "Shape is invalid when transferring shape."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_TRANSSHAPE_DATATYPE_INVALID, "Datatype is invalid when transferring shape."); - -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_MEMORY_ALLOCATION, "Memory allocation error."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "Failed to operate memory."); - -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_INTERNAL_ERROR, "Internal error."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_LOAD_MODEL, "Load model error."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_MODEL_PARTITION_FAILED, "Failed to load model partition."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_WEIGHT_PARTITION_FAILED, "Failed to load weight partition."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_TASK_PARTITION_FAILED, "Failed to load task partition."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_KERNEL_PARTITION_FAILED, "Failed to load op kernel partition."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "Failed to release the model data."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_COMMAND_HANDLE, "Command handle error."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_GET_TENSOR_INFO, "Get tensor info error."); -GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_UNLOAD_MODEL, "Load model error."); - } // namespace ge #endif // INC_EXTERNAL_GE_GE_API_ERROR_CODES_H_ diff --git a/inc/graphengine/inc/external/ge/ge_api_types.h b/inc/graphengine/inc/external/ge/ge_api_types.h index 250252f96..f91f05376 100644 --- a/inc/graphengine/inc/external/ge/ge_api_types.h +++ b/inc/graphengine/inc/external/ge/ge_api_types.h @@ -61,56 +61,11 @@ const char *const OPTION_EXEC_HCCL_FLAG = "ge.exec.hcclFlag"; const char *const OPTION_EXEC_ATOMIC_FLAG = "ge.exec.enable_atomic"; const char *const OPTION_EXEC_DISABLE_REUSED_MEMORY = "ge.exec.disableReuseMemory"; const char *const OPTION_EXEC_ENABLE_TAILING_OPTIMIZATION = "ge.exec.isTailingOptimization"; -// Dynamic input flag. ge.exec.dynamicInput=1, means enable dynaimc input, -// ge.exec.dynamicGraphExecuteMode, dynamic_execute[default] -const char *const OPTION_EXEC_DYNAMIC_INPUT = "ge.exec.dynamicInput"; -const char *const OPTION_EXEC_DYNAMIC_EXECUTE_MODE = "ge.exec.dynamicGraphExecuteMode"; -const char *const OPTION_EXEC_DATA_INPUTS_SHAPE_RANGE = "ge.exec.dataInputsShapeRange"; // Option key: memory init const char *const GRAPH_MEMORY_MAX_SIZE = "ge.graphMemoryMaxSize"; const char *const VARIABLE_MEMORY_MAX_SIZE = "ge.variableMemoryMaxSize"; -namespace configure_option { -const char *const STREAM_NUM = "ge.streamNum"; -const char *const HEAD_STREAM = "ge.headStream"; -const char *const PERF_LEVEL = "ge.perfLevel"; -const char *const ENCRYPT_MODE = "ge.encryptMode"; -const char *const EK_FILE = "ge.ekFile"; -const char *const CERT_FILE = "ge.certFile"; -const char *const HW_KEY_FILE = "ge.hwKeyFile"; -const char *const PRIVATE_KEY_FILE = "ge.privateKeyFile"; -const char *const FRAMEWORK_TYPE = "ge.frameworkType"; -const char *const CALIBRATION_CONF_FILE = "ge.calibrationConfFile"; -const char *const INSERT_OP_FILE = "ge.insertOpFile"; -const char *const OUTPUT_NODE_NAME = "ge.outputNodeName"; -const char *const COMPRESS_FLAG = "ge.compressFlag"; -const char *const PRECISION_MODE = "ge.exec.precision_mode"; -const char *const SINGLE_OP_FLAG = "ge.exec.single_op"; -const char *const TRAIN_FLAG = "ge.trainFlag"; -const char *const RUN_FLAG = "ge.runFlag"; -const char *const LOCAL_FMKOP_FLAG = "ge.enabledLocalFmkop"; -const char *const TBE_PLUGIN_PATH_FLAG = "ge.TBE_plugin_path"; -const char *const DDK_VERSION_FLAG = "ge.DDK_version"; -const char *const GE_FE_FLAG = "ge.feFlag"; -const char *const STREAM_MAX_PARALLEL_NUM = "ge.streamMaxParallelNum"; -const char *const OUTPUT_DATATYPE = "ge.outputDatatype"; -const char *const OP_SELECT_IMPL_MODE = "ge.opSelectImplmode"; -const char *const OPTYPELIST_FOR_IMPLMODE = "ge.optypelistForImplmode"; -const char *const HCOM_PARALLEL = "ge.hcomParallel"; -const char *const AUTO_TUNE_MODE = "ge.autoTuneMode"; -const char *const SOC_VERSION = "ge.socVersion"; -const char *const CORE_TYPE = "ge.engineType"; -const char *const AICORE_NUM = "ge.aicoreNum"; -const char *const L1_FUSION = "ge.l1Fusion"; -const char *const BUFFER_OPTIMIZE = "ge.bufferOptimize"; -const char *const ENABLE_SMALL_CHANNEL = "ge.enableSmallChannel"; -const char *const ENABLE_COMPRESS_WEIGHT = "ge.enableCompressWeight"; -const char *const FUSION_SWITCH_FILE = "ge.fusionSwitchFile"; -const char *const SAVE_ORIGINAL_MODEL = "ge.saveOriginalModel"; -const char *const ORIGINAL_MODEL_FILE = "ge.originalModelFile"; -const char *const INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16"; -const char *const OP_DEBUG_LEVEL = "ge.opDebugLevel"; -} // namespace configure_option + // Configure stream num by Session constructor options param, // its value should be int32_t type, default value is "1" const std::string STREAM_NUM = "ge.streamNum"; @@ -219,9 +174,6 @@ const std::string HCOM_PARALLEL = "ge.hcomParallel"; // configure whether to use dynamic batch size const char *const kDynamicBatchSize = "ge.dynamicBatchSize"; -const std::string INPUT_SHAPE = "ge.inputShape"; - -const std::string DYNAMIC_NODE_TYPE = "ge.dynamicNodeType"; // configure whether to use dynamic image size const char *const kDynamicImageSize = "ge.dynamicImageSize"; @@ -270,18 +222,6 @@ const char *const OPTION_GE_MAX_DUMP_OP_NUM = "ge.maxDumpOpNum"; // Its value should be "0" or "1", default value is "1" const char *const ENABLE_PRINT_OP_PASS = "ge.enablePrintOpPass"; -// Configure operator compilation path -// Its value should be file path, default value is "./" -const char *const DEBUG_DIR = "ge.debugDir"; - -// Configure operator compiler cache path -// Its value should be file path, default value is "./" -const char *const OP_COMPILER_CACHE_DIR = "ge.op_compiler_cache_dir"; - -// Configure operator compiler cache mode -// Its value should be "disable", "enable" or "force", default value is "disable" -const char *const OP_COMPILER_CACHE_MODE = "ge.op_compiler_cache_mode"; - // Configure whether to use single stream. // Its value should be "true" or "false", default value is "false" const char *const ENABLE_SINGLE_STREAM = "ge.enableSingleStream"; @@ -293,21 +233,9 @@ const std::string INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16"; // 0: close debug; 1: open TBE compiler; 2: open ccec compiler const std::string OP_DEBUG_LEVEL = "ge.opDebugLevel"; -// Configure model bank path -const std::string MDL_BANK_PATH_FLAG = "ge.mdl_bank_path"; - // Configure display_model_info flag const std::string DISPLAY_MODEL_INFO = "ge.display_model_info"; -// Configure op bank path -const std::string OP_BANK_PATH_FLAG = "ge.op_bank_path"; -const std::string OP_BANK_UPDATE_FLAG = "ge.op_bank_update"; - -// Configure for fix hcombroadcast format. -// when config model multi, broadcast format should be fixed -// 0: data multi; 1: model multi; -const std::string HCOM_MULTI_MODE = "ge.hcomMultiMode"; - // Graph run mode enum GraphRunMode { PREDICTION = 0, TRAIN }; @@ -348,11 +276,6 @@ namespace ir_option { static const char *const INPUT_FORMAT = "input_format"; static const char *const INPUT_SHAPE = "input_shape"; static const char *const OP_NAME_MAP = "op_name_map"; -static const char *const IS_DYNAMIC_INPUT = "is_dynamic_input"; -static const char *const IS_INPUT_ADJUST_HW_LAYOUT = "is_input_adjust_hw_layout"; -static const char *const IS_OUTPUT_ADJUST_HW_LAYOUT = "is_output_adjust_hw_layout"; -static const char *const ENABLE_SCOPE_FUSION_PASSES = "enable_scope_fusion_passes"; -static const char *const OUTPUT = "output"; static const char *const DYNAMIC_BATCH_SIZE = kDynamicBatchSize; static const char *const DYNAMIC_IMAGE_SIZE = kDynamicImageSize; static const char *const DYNAMIC_DIMS = kDynamicDims; @@ -375,43 +298,14 @@ static const char *const OUT_NODES = ge::OUTPUT_NODE_NAME.c_str(); static const char *const INPUT_FP16_NODES = ge::INPUT_FP16_NODES.c_str(); static const char *const LOG_LEVEL = "log"; static const char *const OPTYPELIST_FOR_IMPLMODE = ge::OPTYPELIST_FOR_IMPLMODE.c_str(); -static const char *const DEBUG_DIR = ge::DEBUG_DIR; -static const char *const OP_COMPILER_CACHE_DIR = ge::OP_COMPILER_CACHE_DIR; -static const char *const OP_COMPILER_CACHE_MODE = ge::OP_COMPILER_CACHE_MODE; -static const char *const MDL_BANK_PATH = ge::MDL_BANK_PATH_FLAG.c_str(); -static const char *const OP_BANK_PATH = ge::OP_BANK_PATH_FLAG.c_str(); -static const char *const OP_BANK_UPDATE = ge::OP_BANK_UPDATE_FLAG.c_str(); -static const char *const OP_DEBUG_LEVEL = ge::OP_DEBUG_LEVEL.c_str(); // for interface: aclgrphBuildModel -#ifdef __GNUC__ -const std::set ir_builder_suppported_options = {INPUT_FORMAT, - INPUT_SHAPE, - OP_NAME_MAP, - DYNAMIC_BATCH_SIZE, - DYNAMIC_IMAGE_SIZE, - DYNAMIC_DIMS, - INSERT_OP_FILE, - PRECISION_MODE, - EXEC_DISABLE_REUSED_MEMORY, - AUTO_TUNE_MODE, - OUTPUT_TYPE, - OUT_NODES, - INPUT_FP16_NODES, - LOG_LEVEL, - OP_DEBUG_LEVEL, - DEBUG_DIR, - OP_COMPILER_CACHE_DIR, - OP_COMPILER_CACHE_MODE, - MDL_BANK_PATH, - OP_BANK_PATH, - OP_BANK_UPDATE}; - -// for interface: aclgrphParse -const std::set ir_parser_suppported_options = { - INPUT_FP16_NODES, IS_INPUT_ADJUST_HW_LAYOUT, IS_OUTPUT_ADJUST_HW_LAYOUT, OUTPUT, - OUT_NODES, ENABLE_SCOPE_FUSION_PASSES}; - +const std::set ir_builder_suppported_options = { + INPUT_FORMAT, INPUT_SHAPE, OP_NAME_MAP, + DYNAMIC_BATCH_SIZE, DYNAMIC_IMAGE_SIZE, DYNAMIC_DIMS, + INSERT_OP_FILE, PRECISION_MODE, EXEC_DISABLE_REUSED_MEMORY, + AUTO_TUNE_MODE, OUTPUT_TYPE, OUT_NODES, + INPUT_FP16_NODES, LOG_LEVEL}; // for interface: aclgrphBuildInitialize const std::set global_options = {CORE_TYPE, SOC_VERSION, @@ -426,12 +320,7 @@ const std::set global_options = {CORE_TYPE, FUSION_SWITCH_FILE, ENABLE_SMALL_CHANNEL, OP_SELECT_IMPL_MODE, - OPTYPELIST_FOR_IMPLMODE, - OP_DEBUG_LEVEL, - DEBUG_DIR, - OP_COMPILER_CACHE_DIR, - OP_COMPILER_CACHE_MODE}; -#endif + OPTYPELIST_FOR_IMPLMODE}; } // namespace ir_option } // namespace ge diff --git a/inc/graphengine/inc/external/ge/ge_error_codes.h b/inc/graphengine/inc/external/ge/ge_error_codes.h deleted file mode 100644 index 041fc7ae5..000000000 --- a/inc/graphengine/inc/external/ge/ge_error_codes.h +++ /dev/null @@ -1,61 +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. - */ - -#ifndef INC_EXTERNAL_GE_GE_ERROR_CODES_H_ -#define INC_EXTERNAL_GE_GE_ERROR_CODES_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif -static const uint32_t ACL_ERROR_GE_PARAM_INVALID = 145000; -static const uint32_t ACL_ERROR_GE_EXEC_NOT_INIT = 145001; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID = 145002; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ID_INVALID = 145003; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID = 145006; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID = 145007; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID = 145008; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED = 145009; -static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID = 145011; -static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID = 145012; -static const uint32_t ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID = 145013; -static const uint32_t ACL_ERROR_GE_AIPP_BATCH_EMPTY = 145014; -static const uint32_t ACL_ERROR_GE_AIPP_NOT_EXIST = 145015; -static const uint32_t ACL_ERROR_GE_AIPP_MODE_INVALID = 145016; -static const uint32_t ACL_ERROR_GE_OP_TASK_TYPE_INVALID = 145017; -static const uint32_t ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID = 145018; -static const uint32_t ACL_ERROR_GE_PLGMGR_PATH_INVALID = 145019; -static const uint32_t ACL_ERROR_GE_TRANSSHAPE_FORMAT_INVALID = 145020; -static const uint32_t ACL_ERROR_GE_TRANSSHAPE_SHAPE_INVALID = 145021; -static const uint32_t ACL_ERROR_GE_TRANSSHAPE_DATATYPE_INVALID = 145022; -static const uint32_t ACL_ERROR_GE_MEMORY_ALLOCATION = 245000; -static const uint32_t ACL_ERROR_GE_MEMORY_OPERATE_FAILED = 245001; -static const uint32_t ACL_ERROR_GE_INTERNAL_ERROR = 545000; -static const uint32_t ACL_ERROR_GE_LOAD_MODEL = 545001; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_PARTITION_FAILED = 545002; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_WEIGHT_PARTITION_FAILED = 545003; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_TASK_PARTITION_FAILED = 545004; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_KERNEL_PARTITION_FAILED = 545005; -static const uint32_t ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA = 545006; -static const uint32_t ACL_ERROR_GE_COMMAND_HANDLE = 545007; -static const uint32_t ACL_ERROR_GE_GET_TENSOR_INFO = 545008; -static const uint32_t ACL_ERROR_GE_UNLOAD_MODEL = 545009; - -#ifdef __cplusplus -} // namespace ge -#endif -#endif // INC_EXTERNAL_GE_GE_ERROR_CODES_H_ diff --git a/inc/graphengine/inc/external/ge/ge_ir_build.h b/inc/graphengine/inc/external/ge/ge_ir_build.h index afaf42ac1..acf6991a9 100644 --- a/inc/graphengine/inc/external/ge/ge_ir_build.h +++ b/inc/graphengine/inc/external/ge/ge_ir_build.h @@ -1,18 +1,18 @@ /** -* 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. -*/ + * 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. + */ #ifndef INC_EXTERNAL_GE_IR_BUILD_H_ #define INC_EXTERNAL_GE_IR_BUILD_H_ @@ -24,9 +24,9 @@ #include "graph/ge_error_codes.h" namespace { -const int IR_MAJOR_VERSION = 1; -const int IR_MINOR_VERSION = 0; -const int IR_PATCH_VERSION = 0; +#define IR_MAJOR_VERSION (int(1)) +#define IR_MINOR_VERSION (int(0)) +#define IR_PATCH_VERSION (int(0)) } // namespace namespace ge { @@ -44,11 +44,8 @@ struct ModelBufferData { * @retval GRAPH_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ATTRIBUTED_DEPRECATED(graphStatus aclgrphBuildInitialize(std::map &)) graphStatus aclgrphBuildInitialize(std::map global_options); -graphStatus aclgrphBuildInitialize(std::map &global_options); - /** * @ingroup AscendCL * @brief build model.Notice the model is stored in buffer @@ -66,14 +63,9 @@ void aclgrphBuildFinalize(); * @retval GRAPH_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ATTRIBUTED_DEPRECATED(graphStatus aclgrphBuildModel(const ge::Graph &, const std::map &, - ModelBufferData &)) graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, ModelBufferData &model); -graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, - ModelBufferData &model); - /** * @ingroup AscendCL * @brief save model buffer to file @@ -83,11 +75,8 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &inputs, - const std::vector &outputs, Graph &graph); - -}; // namespace ge -#endif // INC_EXTERNAL_GE_IR_BUILD_H_ +}; // namespace ge +#endif diff --git a/inc/graphengine/inc/external/ge/ge_prof.h b/inc/graphengine/inc/external/ge/ge_prof.h new file mode 100644 index 000000000..658cea76b --- /dev/null +++ b/inc/graphengine/inc/external/ge/ge_prof.h @@ -0,0 +1,102 @@ +/** + * 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. + */ + +#ifndef INC_EXTERNAL_GE_GE_PROF_H_ +#define INC_EXTERNAL_GE_GE_PROF_H_ + +#include +#include +#include + +#include "ge/ge_api_error_codes.h" + +namespace ge { +enum ProfDataTypeConfig { + kProfTaskTime = 0x0002, + kProfAiCoreMetrics = 0x0004, + kProfAicpuTrace = 0x0008, + kProfTrainingTrace = 0x0800, + kProfHcclTrace = 0x1000 +}; + +enum ProfilingAicoreMetrics { + kAicoreArithmaticThroughput = 0, + kAicorePipeline = 1, + kAicoreSynchronization = 2, + kAicoreMemory = 3, + kAicoreInternalMemory = 4, + kAicoreStall = 5 +}; + +typedef struct ProfAicoreEvents ProfAicoreEvents; +typedef struct aclgrphProfConfig aclgrphProfConfig; + +/// +/// @ingroup AscendCL +/// @brief Initialize the profiling and set profiling configuration path +/// @param [in] profiler_path: configuration path of profiling +/// @param [in] length: length of configuration path +/// @return Status result of function +/// +Status aclgrphProfInit(const char *profiler_path, uint32_t length); + +/// +/// @ingroup AscendCL +/// @brief Finalize profiling +/// @return Status result of function +/// +Status aclgrphProfFinalize(); + +/// +/// @ingroup AscendCL +/// @brief Create data of type aclgrphProfConfig +/// @param [in] deviceid_list: device id list +/// @param [in] device_nums: device numbers +/// @param [in] aicore_metrics: type of aicore metrics +/// @param [in] aicore_events: pointer to aicore events be reserved, only support NULL now +/// @param [in] data_type_config: modules need profiling +/// @return Status result of function +/// +aclgrphProfConfig *aclgrphProfCreateConfig(uint32_t *deviceid_list, uint32_t device_nums, + ProfilingAicoreMetrics aicore_metrics, ProfAicoreEvents *aicore_events, + uint64_t data_type_config); + +/// +/// @ingroup AscendCL +/// @brief Destroy data of type aclgrphProfConfig +/// @param [in] profiler_config: config of profiling +/// @return Status result of function +/// +Status aclgrphProfDestroyConfig(aclgrphProfConfig *profiler_config); + +/// +/// @ingroup AscendCL +/// @brief Start profiling of modules which is configured by profiler config +/// @param [in] profiler_config: config of profiling +/// @return Status result of function +/// +Status aclgrphProfStart(aclgrphProfConfig *profiler_config); + +/// +/// @ingroup AscendCL +/// @brief Stop profiling of modules which is configured by profiler config +/// @param [in] profiler_config: config of profiling +/// @return Status result of function +/// +Status aclgrphProfStop(aclgrphProfConfig *profiler_config); +} // namespace ge + +#endif // INC_EXTERNAL_GE_GE_PROF_H_ diff --git a/inc/graphengine/inc/framework/common/debug/ge_log.h b/inc/graphengine/inc/framework/common/debug/ge_log.h index 07cd1664f..6ac000373 100644 --- a/inc/graphengine/inc/framework/common/debug/ge_log.h +++ b/inc/graphengine/inc/framework/common/debug/ge_log.h @@ -18,74 +18,63 @@ #define INC_FRAMEWORK_COMMON_DEBUG_GE_LOG_H_ #include - -#include "framework/common/ge_inner_error_codes.h" -#include "toolchain/slog.h" -#ifdef __GNUC__ #include #include -#else -#include "mmpa/mmpa_api.h" -#endif -#ifdef __cplusplus -extern "C" { -#endif +#include "framework/common/ge_inner_error_codes.h" +#include "toolchain/slog.h" #define GE_MODULE_NAME static_cast(GE) // trace status of log enum TraceStatus { TRACE_INIT = 0, TRACE_RUNNING, TRACE_WAITING, TRACE_STOP }; -class GeLog { - public: - static uint64_t GetTid() { -#ifdef __GNUC__ - thread_local static uint64_t tid = static_cast(syscall(__NR_gettid)); -#else - thread_local static uint64_t tid = static_cast(GetCurrentThreadId()); -#endif - return tid; - } -}; +#define GELOGE(ERROR_CODE, ...) GE_LOG_ERROR(GE_MODULE_NAME, ERROR_CODE, __VA_ARGS__) +#define GELOGW(...) GE_LOG_WARN(GE_MODULE_NAME, __VA_ARGS__) +#define GELOGI(...) GE_LOG_INFO(GE_MODULE_NAME, __VA_ARGS__) +#define GELOGD(...) GE_LOG_DEBUG(GE_MODULE_NAME, __VA_ARGS__) +#define GEEVENT(...) GE_LOG_EVENT(GE_MODULE_NAME, __VA_ARGS__) +#define GELOGO(...) GE_LOG_OPLOG(GE_MODULE_NAME, __VA_ARGS__) +#define GELOGT(VALUE, ...) GE_LOG_TRACE(GE_MODULE_NAME, VALUE, __VA_ARGS__) inline bool IsLogEnable(int module_name, int log_level) { int32_t enable = CheckLogLevel(module_name, log_level); // 1:enable, 0:disable - return (enable == 1); + if (enable == 1) { + return true; + } + return false; } -#define GELOGE(ERROR_CODE, fmt, ...) \ - dlog_error(GE_MODULE_NAME, "%lu %s: ErrorNo: %d(%s) " fmt, GeLog::GetTid(), __FUNCTION__, ERROR_CODE, \ - ((GE_GET_ERRORNO_STR(ERROR_CODE)).c_str()), ##__VA_ARGS__) -#define GELOGW(fmt, ...) \ - if (IsLogEnable(GE_MODULE_NAME, DLOG_WARN)) \ - dlog_warn(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__) -#define GELOGI(fmt, ...) \ - if (IsLogEnable(GE_MODULE_NAME, DLOG_INFO)) \ - dlog_info(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__) -#define GELOGD(fmt, ...) \ - if (IsLogEnable(GE_MODULE_NAME, DLOG_DEBUG)) \ - dlog_debug(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__) +inline pid_t GetTid() { + thread_local static pid_t tid = syscall(__NR_gettid); + return tid; +} -#define GEEVENT(fmt, ...) dlog_event(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__) +#define GE_LOG_ERROR(MOD_NAME, ERROR_CODE, fmt, ...) \ + dlog_error(MOD_NAME, "%lu %s: ErrorNo: %d(%s) " fmt, GetTid(), __FUNCTION__, ERROR_CODE, \ + ((GE_GET_ERRORNO_STR(ERROR_CODE)).c_str()), ##__VA_ARGS__) +#define GE_LOG_WARN(MOD_NAME, fmt, ...) \ + if (IsLogEnable(MOD_NAME, DLOG_WARN)) dlog_warn(MOD_NAME, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__) +#define GE_LOG_INFO(MOD_NAME, fmt, ...) \ + if (IsLogEnable(MOD_NAME, DLOG_INFO)) dlog_info(MOD_NAME, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__) +#define GE_LOG_DEBUG(MOD_NAME, fmt, ...) \ + if (IsLogEnable(MOD_NAME, DLOG_DEBUG)) dlog_debug(MOD_NAME, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__) +#define GE_LOG_EVENT(MOD_NAME, fmt, ...) dlog_event(MOD_NAME, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__) +#define GE_LOG_OPLOG(MOD_NAME, fmt, ...) \ + Dlog(MOD_NAME, DLOG_OPLOG, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__) -#define GELOGT(VALUE, fmt, ...) \ - do { \ - TraceStatus stat = VALUE; \ - const char *const TraceStatStr[] = {"INIT", "RUNNING", "WAITING", "STOP"}; \ - int idx = static_cast(stat); \ - char *k = const_cast("status"); \ - char *v = const_cast(TraceStatStr[idx]); \ - KeyValue kv = {k, v}; \ - DlogWithKV(static_cast(GE_MODULE_NAME), DLOG_TRACE, &kv, 1, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, \ - ##__VA_ARGS__); \ +#define GE_LOG_TRACE(MOD_NAME, value, fmt, ...) \ + do { \ + TraceStatus stat = value; \ + const char *const TraceStatStr[] = {"INIT", "RUNNING", "WAITING", "STOP"}; \ + int idx = static_cast(stat); \ + char *k = const_cast("status"); \ + char *v = const_cast(TraceStatStr[idx]); \ + KeyValue kv = {k, v}; \ + DlogWithKV(static_cast(MOD_NAME), DLOG_TRACE, &kv, 1, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__); \ } while (0) -#define GE_LOG_ERROR(MOD_NAME, ERROR_CODE, fmt, ...) \ - dlog_error(MOD_NAME, "%lu %s: ErrorNo: %d(%s) " fmt, GeLog::GetTid(), __FUNCTION__, ERROR_CODE, \ - ((GE_GET_ERRORNO_STR(ERROR_CODE)).c_str()), ##__VA_ARGS__) - // print memory when it is greater than 1KB. #define GE_PRINT_DYNAMIC_MEMORY(FUNC, PURPOSE, SIZE) \ do { \ @@ -93,7 +82,4 @@ inline bool IsLogEnable(int module_name, int log_level) { GELOGI("MallocMemory, func=%s, size=%zu, purpose=%s", (#FUNC), static_cast(SIZE), (PURPOSE)); \ } \ } while (0); -#ifdef __cplusplus -} -#endif #endif // INC_FRAMEWORK_COMMON_DEBUG_GE_LOG_H_ diff --git a/inc/graphengine/inc/framework/common/debug/log.h b/inc/graphengine/inc/framework/common/debug/log.h index 31281cd65..dbf22ead8 100644 --- a/inc/graphengine/inc/framework/common/debug/log.h +++ b/inc/graphengine/inc/framework/common/debug/log.h @@ -18,17 +18,15 @@ #define INC_FRAMEWORK_COMMON_DEBUG_LOG_H_ #include -#include #include "runtime/rt.h" #include "common/string_util.h" #include "common/util.h" -#include "common/util/error_manager/error_manager.h" #include "framework/common/debug/ge_log.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(...) GE_LOG_ERROR(GE_MODULE_NAME, ge::FAILED, __VA_ARGS__) #else #include #if defined(BUILD_VERSION_PERF) @@ -255,35 +253,4 @@ exec_expr1; \ } -#define GE_ERRORLOG_AND_ERRORMSG(_status, errormsg) \ - { \ - GELOGE(_status, "%s", errormsg); \ - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {errormsg}); \ - } - -#define GE_WARNINGLOG_AND_ERRORMSG(errormsg) \ - { \ - GELOGW("%s", errormsg); \ - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {errormsg}); \ - } - -#define GE_CHK_LOG_AND_ERRORMSG(expr, _status, errormsg) \ - do { \ - bool b = (expr); \ - if (!b) { \ - GELOGE(_status, "%s", errormsg); \ - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {errormsg}); \ - return _status; \ - } \ - } while (0) - -template -std::string FmtToStr(const T &t) { - std::string fmt; - std::stringstream st; - st << "[" << t << "]"; - fmt = st.str(); - return fmt; -} - #endif // INC_FRAMEWORK_COMMON_DEBUG_LOG_H_ diff --git a/inc/graphengine/inc/framework/common/fmk_error_codes.h b/inc/graphengine/inc/framework/common/fmk_error_codes.h index 358fca04d..ec1f26d05 100644 --- a/inc/graphengine/inc/framework/common/fmk_error_codes.h +++ b/inc/graphengine/inc/framework/common/fmk_error_codes.h @@ -23,6 +23,10 @@ #include "framework/common/fmk_types.h" #include "register/register_error_codes.h" +#define MODID_OMG 1 // OMG module ID +#define MODID_OME 2 // OME module ID +#define MODID_CALIBRATION 3 // Calibration module ID + // Each module uses the following four macros to define error codes: #define DECLARE_ERRORNO_OMG(name, value) DECLARE_ERRORNO(SYSID_FWK, MODID_OMG, name, value) #define DECLARE_ERRORNO_OME(name, value) DECLARE_ERRORNO(SYSID_FWK, MODID_OME, name, value) @@ -33,10 +37,6 @@ // Interface for Obtaining Error Code Description #define GET_ERRORNO_STR(value) domi::StatusFactory::Instance()->GetErrDesc(value) -const int MODID_OMG = 1; // OMG module ID -const int MODID_OME = 2; // OME module ID -const int MODID_CALIBRATION = 3; // Calibration module ID - namespace domi { class StatusFactory { public: diff --git a/inc/graphengine/inc/framework/common/ge_compiler_options.h b/inc/graphengine/inc/framework/common/ge_compiler_options.h deleted file mode 100644 index 5c9473466..000000000 --- a/inc/graphengine/inc/framework/common/ge_compiler_options.h +++ /dev/null @@ -1,32 +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 INC_FRAMEWORK_COMMON_GE_COMPILER_OPTIONS_H_ -#define INC_FRAMEWORK_COMMON_GE_COMPILER_OPTIONS_H_ - -namespace ge { -#ifdef __GNUC__ -#define GE_ATTRIBUTE_UNUSED __attribute__((unused)) -#define GE_FUNCTION_IDENTIFIER __PRETTY_FUNCTION__ -#define GE_BUILTIN_PREFETCH(args_addr) __builtin_prefetch(args_addr) -#else -#define GE_ATTRIBUTE_UNUSED -#define GE_FUNCTION_IDENTIFIER __FUNCSIG__ -#define GE_BUILTIN_PREFETCH(args_addr) -#endif -} // namespace ge - -#endif // INC_FRAMEWORK_COMMON_GE_COMPILER_OPTIONS_H_ \ No newline at end of file diff --git a/inc/graphengine/inc/framework/common/ge_inner_error_codes.h b/inc/graphengine/inc/framework/common/ge_inner_error_codes.h index 3697a5261..3ab6cf06c 100644 --- a/inc/graphengine/inc/framework/common/ge_inner_error_codes.h +++ b/inc/graphengine/inc/framework/common/ge_inner_error_codes.h @@ -125,13 +125,13 @@ GE_ERRORNO_CLIENT(GE_CLI_GE_ALREADY_INITIALIZED, 10, "GE is already initialized. GE_ERRORNO_CLIENT(GE_CLI_GE_NOT_INITIALIZED, 11, "GE is not yet initialized or is finalized."); // 1343229963 // Init module error code definition -GE_ERRORNO_INIT(GE_MULTI_INIT, 0, "Multiple initializations are not supported."); // 1343234048 -GE_ERRORNO_INIT(GE_FINALIZE_NOT_INIT, 1, "Finalize is not allowed before initialization."); // 1343234049 -GE_ERRORNO_INIT(GE_MULTI_FINALIZE, 2, "Multiple finalizations are not supported."); // 1343234050 -GE_ERRORNO_INIT(GE_PROF_MULTI_INIT, 3, "Multiple profiling initializations are not supported."); // 1343234051 -GE_ERRORNO_INIT(GE_PROF_NOT_INIT, 4, "Profing initializations have not been done."); // 1343234052 +GE_ERRORNO_INIT(GE_MULTI_INIT, 0, "Multiple initializations are not supported."); // 1343234048 +GE_ERRORNO_INIT(GE_FINALIZE_NOT_INIT, 1, "Finalize is not allowed before initialization."); // 1343234049 +GE_ERRORNO_INIT(GE_MULTI_FINALIZE, 2, "Multiple finalizations are not supported."); // 1343234050 +GE_ERRORNO_INIT(GE_PROF_MULTI_INIT, 3, "Multiple profiling initializations are not supported."); // 1343234051 +GE_ERRORNO_INIT(GE_PROF_NOT_INIT, 4, "Profing initializations have not been done."); // 1343234052 GE_ERRORNO_INIT(GE_PROF_MODE_CONFLICT, 5, - "Profiling command mode which is preferred is running, the api mode will not work."); // 1343234053 + "Profiling command mode which is preferred is running, the api mode will not work."); // 1343234053 // Session module error code definition GE_ERRORNO_SESSION(GE_SESS_INIT_FAILED, 0, "Failed to initialize session."); // 1343238144 @@ -216,8 +216,8 @@ GE_ERRORNO_ENGINE(GE_ENG_FINALIZE_FAILED, 1, "Engine finalize failed."); GE_ERRORNO_ENGINE(GE_ENG_MEMTYPE_ERROR, 2, "Memory type HBM is necessary when engine is in device"); // 1343246338 // Optimize errocode -GE_ERRORNO_GRAPH(TO_BE_DELETED, 63, "The node of the graph to be deleted."); // 1343242303 -GE_ERRORNO_GRAPH(NOT_CHANGED, 64, "The node of the graph no changed."); // 1343242304 +GE_ERRORNO_GRAPH(TO_BE_DELETED, 63, "The node of the graph to be deleted."); // 1343242303 +GE_ERRORNO_GRAPH(NOT_CHANGED, 64, "The node of the graph no changed."); // 1343242304 // Ops module error code definition GE_ERRORNO_OPS(GE_OPS_KERNEL_STORE_INIT_FAILED, 0, "Failed to initialize OpsKernelInfoStore."); // 1343250432 @@ -304,7 +304,6 @@ GE_ERRORNO_EXECUTOR(GE_EXEC_ALLOC_WEIGHT_MEM_FAILED, 16, "Failed to allocate wei GE_ERRORNO_EXECUTOR(GE_EXEC_ALLOC_VAR_MEM_FAILED, 17, "Failed to allocate variable memory."); GE_ERRORNO_EXECUTOR(GE_AIPP_NOT_EXIST, 18, "GE AIPP is not exist."); GE_ERRORNO_EXECUTOR(GE_DYNAMIC_AIPP_NOT_SUPPORT_QUERY, 19, "GE Dynamic AIPP is not support to query temporarily."); -GE_ERRORNO_EXECUTOR(GE_EXEC_ALLOC_P2P_MEM_FAILED, 20, "Failed to allocate P2P memory"); // Generator module error code definition GE_ERRORNO_GENERATOR(GE_GENERATOR_GRAPH_MANAGER_INIT_FAILED, 1, "Graph manager initialize failed."); diff --git a/inc/graphengine/inc/framework/common/ge_types.h b/inc/graphengine/inc/framework/common/ge_types.h index 9ca77f1c9..6033521ce 100644 --- a/inc/graphengine/inc/framework/common/ge_types.h +++ b/inc/graphengine/inc/framework/common/ge_types.h @@ -37,12 +37,9 @@ enum FrameworkType { MINDSPORE = 1, TENSORFLOW = 3, ANDROID_NN, - ONNX, + FRAMEWORK_RESERVED, }; -const std::map kFwkTypeToStr = { - {"0", "Caffe"}, {"1", "MindSpore"}, {"3", "TensorFlow"}, {"4", "Android_NN"}, {"5", "Onnx"}}; - enum OpEngineType { ENGINE_SYS = 0, // default engine ENGINE_AICORE = 1, @@ -56,11 +53,6 @@ enum InputAippType { DATA_WITHOUT_AIPP = 0, DATA_WITH_STATIC_AIPP, DATA_WITH_DYN const char *const GE_ENGINE_ATTR_MEM_TYPE_HBM = "HBM"; const char *const GE_OPTION_EXEC_PLACEMENT = "ge.exec.placement"; -// profiling data -const uint32_t kTaskTypeAicore = 0; -const uint32_t kTaskTypeAicpu = 1; -const uint32_t kTaskTypeInvalid = 0xFFFF; - // Data cache, including data address and length struct DataBuffer { public: @@ -78,15 +70,14 @@ struct DataBuffer { /// @brief External input data /// struct InputData { - uint32_t index; // Index of input data - uint32_t timestamp; // Data creation time - uint32_t timeout; // Processing timeout - uint32_t model_id; // Model ID required for data processing - uint64_t request_id = 0; // Request ID - std::vector blobs; // Actual input data, currently only supports one input - bool is_dynamic_batch = false; // Whether is dynamic batch size scene, default:false - std::string batch_label; // Gear used for current inference in dynamic batch scene - std::vector> shapes; // Input shapes + uint32_t index; // Index of input data + uint32_t timestamp; // Data creation time + uint32_t timeout; // Processing timeout + uint32_t model_id; // Model ID required for data processing + uint64_t request_id = 0; // Request ID + std::vector blobs; // Actual input data, currently only supports one input + bool is_dynamic_batch = false; // Whether is dynamic batch size scene, default:false + std::string batch_label; // Gear used for current inference in dynamic batch scene }; /// Output result structure definition @@ -114,7 +105,6 @@ struct ShapeDescription { int64_t height = 0; int64_t width = 0; std::vector dims; - std::vector> shape_ranges; }; // Definition of input and output description information @@ -254,9 +244,6 @@ struct TaskDescInfo { uint32_t block_dim; uint32_t task_id; uint32_t stream_id; - std::string shape_type; - int64_t cur_iter_num; - uint32_t task_type; }; // Profiling info of graph @@ -270,8 +257,6 @@ struct ComputeGraphDescInfo { std::vector output_format; std::vector> output_shape; std::vector output_data_type; - uint32_t task_id; - uint32_t stream_id; }; struct OpDescInfo { diff --git a/inc/graphengine/inc/framework/common/helper/model_helper.h b/inc/graphengine/inc/framework/common/helper/model_helper.h index 4a169ddae..8f43c2aad 100644 --- a/inc/graphengine/inc/framework/common/helper/model_helper.h +++ b/inc/graphengine/inc/framework/common/helper/model_helper.h @@ -25,7 +25,6 @@ #include "common/types.h" #include "graph/model.h" #include "model/ge_model.h" -#include "model/ge_root_model.h" namespace ge { class ModelHelper { @@ -33,70 +32,43 @@ class ModelHelper { ModelHelper() = default; ~ModelHelper(); - Status SaveToOmModel(const GeModelPtr &ge_model, const SaveParam &save_param, const std::string &output_file, - ge::ModelBufferData &model); - Status SaveToOmRootModel(const GeRootModelPtr &ge_root_model, const SaveParam &save_param, const string &output_file, - ModelBufferData &model, bool is_unknown_shape); - Status SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::string &output_file); - Status LoadModel(const ge::ModelData &model_data); - Status LoadRootModel(const ge::ModelData &model_data); - Status GetModelBufferData(ge::ModelBufferData &model); + Status SaveToOmModel(const GeModelPtr& ge_model, const SaveParam& save_param, const std::string& output_file, + ge::ModelBufferData& model); + Status SaveOriginalGraphToOmModel(const ge::Graph& graph, const std::string& output_file); + Status LoadModel(const ge::ModelData& model_data); + Status GetModelBufferData(ge::ModelBufferData& model); - const ModelFileHeader *GetFileHeader() const { return file_header_; } + const ModelFileHeader* GetFileHeader() const { return file_header_; } GeModelPtr GetGeModel(); - GeRootModelPtr GetGeRootModel(); void SetSaveMode(bool val) { is_offline_ = val; } bool GetSaveMode(void) const { return is_offline_; } - bool GetModelType() const { return is_unknown_shape_model_; }; - Status GetBaseNameFromFileName(const std::string &file_name, std::string &base_name); - Status GetModelNameFromMergedGraphName(const std::string &graph_name, std::string &model_name); + Status GetBaseNameFromFileName(const std::string& file_name, std::string& base_name); + Status GetModelNameFromMergedGraphName(const std::string& graph_name, std::string& model_name); private: bool is_assign_model_ = false; bool is_offline_ = true; - bool is_unknown_shape_model_ = false; - ModelFileHeader *file_header_ = nullptr; + ModelFileHeader* file_header_ = nullptr; // Encrypted model need delete temp model and unencrypted model need not delete model - uint8_t *model_addr_tmp_ = nullptr; + uint8_t* model_addr_tmp_ = nullptr; uint32_t model_len_tmp_ = 0; GeModelPtr model_; - GeRootModelPtr root_model_; - ModelHelper(const ModelHelper &); - ModelHelper &operator=(const ModelHelper &); - Status GenerateGeModel(OmFileLoadHelper &om_load_helper); - Status GenerateGeRootModel(OmFileLoadHelper &om_load_helper); - Status LoadModelData(OmFileLoadHelper &om_load_helper); - void SetModelToGeModel(GeModelPtr &ge_model, Model &model); - Status LoadModelData(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index); - Status LoadWeights(OmFileLoadHelper &om_load_helper); - Status LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index); - Status LoadTask(OmFileLoadHelper &om_load_helper); - Status LoadTask(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index); - Status LoadTBEKernelStore(OmFileLoadHelper &om_load_helper); - Status LoadTBEKernelStore(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index); - Status LoadCustAICPUKernelStore(OmFileLoadHelper &om_load_helper); - Status LoadCustAICPUKernelStore(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index); + ModelHelper(const ModelHelper&); + ModelHelper& operator=(const ModelHelper&); + Status GenerateGeModel(OmFileLoadHelper& om_load_helper); + Status LoadModelData(OmFileLoadHelper& om_load_helper); + void SetModelToGeModel(ge::Model& model); + Status SaveSizeToModelDef(const GeModelPtr& ge_model); + Status LoadWeights(OmFileLoadHelper& om_load_helper); + Status LoadTask(OmFileLoadHelper& om_load_helper); + Status LoadTBEKernelStore(OmFileLoadHelper& om_load_helper); + Status LoadCustAICPUKernelStore(OmFileLoadHelper& om_load_helper); Status ReleaseLocalModelData() noexcept; - Status SaveModelPartition(std::shared_ptr &om_file_save_helper, ModelPartitionType type, - const uint8_t *data, size_t size, size_t model_index); - Status SaveModelDef(shared_ptr &om_file_save_helper, const GeModelPtr &ge_model, - Buffer &model_buffer, size_t model_index = 0); - Status SaveSizeToModelDef(const GeModelPtr &ge_model); - Status SaveModelWeights(shared_ptr &om_file_save_helper, const GeModelPtr &ge_model, - size_t model_index = 0); - Status SaveModelTbeKernel(shared_ptr &om_file_save_helper, const GeModelPtr &ge_model, - size_t model_index = 0); - Status SaveModelCustAICPU(shared_ptr &om_file_save_helper, const GeModelPtr &ge_model, - size_t model_index = 0); - Status SaveModelTaskDef(shared_ptr &om_file_save_helper, const GeModelPtr &ge_model, - Buffer &task_buffer, size_t model_index = 0); - Status SaveModelHeader(shared_ptr &om_file_save_helper, const GeModelPtr &ge_model, - size_t model_num = 1); - Status SaveAllModelPartiton(shared_ptr &om_file_save_helper, const GeModelPtr &ge_model, - Buffer &model_buffer, Buffer &task_buffer, size_t model_index = 0); + Status SaveModelPartition(std::shared_ptr& om_file_save_helper, ModelPartitionType type, + const uint8_t* data, size_t size); }; } // namespace ge #endif // INC_FRAMEWORK_COMMON_HELPER_MODEL_HELPER_H_ diff --git a/inc/graphengine/inc/framework/common/helper/om_file_helper.h b/inc/graphengine/inc/framework/common/helper/om_file_helper.h index 98ad55d77..fec7e2940 100644 --- a/inc/graphengine/inc/framework/common/helper/om_file_helper.h +++ b/inc/graphengine/inc/framework/common/helper/om_file_helper.h @@ -39,7 +39,7 @@ struct ModelPartition { struct OmFileContext { std::vector partition_datas_; std::vector partition_table_; - uint32_t model_data_len_ = 0; + uint32_t model_data_len_; }; struct SaveParam { @@ -57,23 +57,15 @@ class OmFileLoadHelper { Status Init(uint8_t *model_data, const uint32_t model_data_size); - Status Init(uint8_t *model_data, const uint32_t model_data_size, uint32_t model_num); - Status GetModelPartition(ModelPartitionType type, ModelPartition &partition); - Status GetModelPartition(ModelPartitionType type, ModelPartition &partition, size_t model_index); - OmFileContext context_; - vector model_contexts_; - private: Status CheckModelValid(const ge::ModelData &model) const; Status LoadModelPartitionTable(uint8_t *model_data, const uint32_t model_data_size); - Status LoadModelPartitionTable(uint8_t *model_data, const uint32_t model_data_size, uint32_t model_num); - bool is_inited_{false}; }; @@ -87,8 +79,6 @@ class OmFileSaveHelper { Status AddPartition(ModelPartition &partition); - Status AddPartition(ModelPartition &partition, size_t cur_index); - const std::vector &GetModelPartitions() const; Status SaveModel(const SaveParam &save_param, const char *target_file, ge::ModelBufferData &model, @@ -96,14 +86,8 @@ class OmFileSaveHelper { Status SaveModelToFile(const char *output_file, ge::ModelBufferData &model, bool is_offline = true); - vector model_contexts_; - ModelFileHeader model_header_; OmFileContext context_; - - ModelPartitionTable *GetPartitionTable(size_t cur_ctx_index); - - Status SaveRootModel(const SaveParam &save_param, const char *output_file, ModelBufferData &model, bool is_offline); }; } // namespace ge #endif // INC_FRAMEWORK_COMMON_HELPER_OM_FILE_HELPER_H_ diff --git a/inc/graphengine/inc/framework/common/op/attr_value_util.h b/inc/graphengine/inc/framework/common/op/attr_value_util.h index e3803b781..8a90cfa2a 100644 --- a/inc/graphengine/inc/framework/common/op/attr_value_util.h +++ b/inc/graphengine/inc/framework/common/op/attr_value_util.h @@ -21,6 +21,7 @@ #include #include +#include "common/types.h" #include "graph/debug/ge_attr_define.h" #include "proto/om.pb.h" @@ -155,6 +156,6 @@ bool GetAttrDefListValue(const std::string &key, int idx, int32_t *value, const bool GetAttrDefListValue(const std::string &key, int idx, uint32_t *value, const AttrDefMap &attr); bool GetAttrDefListValue(const std::string &key, int idx, float *value, const AttrDefMap &attr); bool GetAttrDefListValue(const std::string &key, int idx, double *value, const AttrDefMap &attr); -} +} // namespace ge #endif // INC_FRAMEWORK_COMMON_OP_ATTR_VALUE_UTIL_H_ diff --git a/inc/graphengine/inc/framework/common/op/ge_op_utils.h b/inc/graphengine/inc/framework/common/op/ge_op_utils.h index aa50c8a1a..87cf54d89 100644 --- a/inc/graphengine/inc/framework/common/op/ge_op_utils.h +++ b/inc/graphengine/inc/framework/common/op/ge_op_utils.h @@ -17,12 +17,12 @@ #ifndef INC_FRAMEWORK_COMMON_OP_GE_OP_UTILS_H_ #define INC_FRAMEWORK_COMMON_OP_GE_OP_UTILS_H_ +#include #include #include #include "common/op/attr_value_util.h" -#include "register/register_types.h" -#include "register/register_error_codes.h" +#include "common/types.h" #include "common/util.h" #include "graph/attr_value.h" #include "graph/ge_tensor.h" @@ -31,6 +31,7 @@ #include "proto/insert_op.pb.h" namespace ge { +using namespace cce; using domi::Status; // Add Sub Mul @@ -74,7 +75,18 @@ class OpUtils { static inline bool CheckEnumValid(int32_t check_value, int32_t min_enum_value, int32_t max_enum_value) { return check_value < min_enum_value ? false : (check_value >= max_enum_value ? false : true); } - + /// + /// @ingroup domi_omg + /// @brief Convert the dimension of array according to different format + /// @param [in] src_format src_shape format + /// @param [in] src Dimension array to be converted + /// @param [in] dst_format Target format after conversion + /// @param [out] dst Dimension array after conversion + /// @return SUCCESS success + /// @return FAILED fail + /// + static bool ConvertDim(ccTensorFormat_t src_format, const std::vector &src, ccTensorFormat_t dst_format, + std::vector &dst); /// /// @ingroup domi_omg /// @brief Determine whether to manually calculate the tensor size based on the values of format and dim @@ -84,6 +96,73 @@ class OpUtils { /// @return false skip /// static bool IsComputDimsSize(const int32_t format, const uint32_t real_dim_cnt); + /// + /// @ingroup domi_ome + /// @brief Initialize the tensor description, which is used for input and output. + /// @param [in] model_tensor Tensor information defined by the offline model + /// @param [out] cc_tensor Tensor definition used by CC + /// @return SUCCESS success + /// @return FAILED fail + /// + static Status InitTensorDescriptor(const ge::GeTensorDesc &model_tensor, ccTensorDescriptor_t &cc_tensor); + /// + /// @ingroup domi_ome + /// @brief Initialize the tensor description, which is used for input and output. + /// @param [in] model_tensor Tensor information defined by the offline model + /// @param [in] dst_data_type data_type of the target cc_tensor + /// @param [out] cc_tensor Tensor definition used by CC + /// @return SUCCESS success + /// @return FAILED fail + /// + static Status InitTensorDescriptor(const ge::GeTensorDesc &model_tensor, int32_t dst_data_type, + ccTensorDescriptor_t &cc_tensor); + /// + /// @ingroup domi_ome + /// @brief Initialize the tensor description for bias. + /// @param [in] model_tensor Tensor information defined by the offline model + /// @param [out] cc_tensor Tensor definition used by CC + /// @return SUCCESS success + /// @return FAILED fail + /// + /// + static Status InitTensorDescriptor(const ge::GeTensor &model_tensor, ccTensorDescriptor_t &cc_tensor); + /// + /// @ingroup domi_ome + /// @brief Initialize the tensor description for bias. + /// @param [in] model_tensor Tensor information defined by the offline model + /// @param [in] dst_data_type data_type of the target cc_tensor + /// @param [out] cc_tensor Tensor definition used by CC + /// @return SUCCESS success + /// @return FAILED fail + /// + static Status InitTensorDescriptor(const ge::GeTensor &model_tensor, int32_t dst_data_type, + ccTensorDescriptor_t &cc_tensor); + + static Status InitTensorDescriptor(int32_t format, int32_t data_type, const std::vector &dim, + ccTensorDescriptor_t &cc_tensor, uint32_t real_dim_cnt = 4); + /// + /// @ingroup domi_ome + /// @brief Destroys a tensor + /// @param [inout] cc_tensor Tensor definition used by CC + /// + static void DestroyTensorDescriptor(ccTensorDescriptor_t &cc_tensor) noexcept; + + /// + /// @ingroup domi_ome + /// @brief Destroys a tensor + /// @param [inout] cc_filter cc_filter Definition of the filter used by CC + /// + static void DestroyFilterDescriptor(ccFilterDescriptor_t &cc_filter); + + /// + /// @ingroup domi_ome + /// @brief Initializing Filter Description + /// @param [in] model_filter Filter information defined in the offline model + /// @param [out] cc_filter Definition of the filter used by CC + /// @return SUCCESS success + /// @return FAILED fail + /// + static Status InitFilterDescriptor(const ge::GeTensor &model_filter, ccFilterDescriptor_t &cc_filter); /// /// @brief Extract AIPP parameters from AttrDefMap and splice them @@ -129,7 +208,16 @@ class OpUtils { /// @param [out] output Data pointer after conversion. The format is HWCK /// static void TransDataKCHW2HWCK(const void *input, int64_t K, int64_t C, int64_t H, int64_t W, void *output); - + /// + /// @ingroup domi_omg + /// @brief Initialize the input and output description of the data node which is applied to filter weight in the + /// training network + /// @param [in] model_tensor input and output tensor information + /// @param [out] cc_tensor Tensor in CCE format after conversion + /// + static Status InitFilterTensorDescriptor(const ge::GeTensorDesc &model_tensor, ccFilterDescriptor_t &cc_tensor); + + static void SetTensorDescriptorAllOffsetQuantizeInfo(const GeTensorDesc &tensor, ccTensorDescriptor_t cc_tensor); static vector GetWeights(const ge::Node &node); static vector GetWeights(ge::ConstNodePtr node); static vector MutableWeights(const ge::Node &node); @@ -139,7 +227,69 @@ class OpUtils { static Status GetShapeDataFromConstTensor(const ConstGeTensorPtr &tensor, DataType type, std::vector &dims); private: + friend class CceTensorDescriptor; static uint32_t GetRealDimCnt(const GeTensorDesc &tensor_desc); }; + +class CceTensorDescriptor; + +using CceTensorDescriptorPtr = std::shared_ptr; + +class CceTensorDescriptor { + public: + explicit CceTensorDescriptor(ccTensorDescriptor_t cc_tensor); + CceTensorDescriptor(const CceTensorDescriptor &) = delete; + CceTensorDescriptor &operator=(const CceTensorDescriptor &) = delete; + + ~CceTensorDescriptor(); + + ccTensorDescriptor_t GetPtr() { return cc_tensor_; } + + /// + /// @brief Initializes the tensor based on shape information. + /// @param[in] format data permutation format + /// @param[in] data_type Data Type + /// @param[in] dim dim information + /// @return return code + /// + Status InitTensor(int32_t format, int32_t data_type, const std::vector &dims); + + Status InitTensor(int32_t format, int32_t data_type, const ge::GeShape &shape); + + /// + /// @brief get format of tensor + /// @param[out] format format of the tensor + /// @return return code + /// + Status GetFormat(ccTensorFormat_t *format); + + /// + /// @brief Obtains the size of the tensor. + /// @param[out] size size of Tensor + /// @return return code + /// + Status GetTensorSizeInBytes(uint32_t *size); + + /// + /// @brief transform tensor between 4d(NCHW) and 5d(NC1HWC0) + /// @param [in] xDesc descriptor of input tensor + /// @param [in] x point to input data in host memory + /// @param [in] dataTypeTransmode mode of data type transform + /// @param [in] yDesc descriptor of output tensor + /// @param [in|out] y point to output data in host memory + /// @param [in] ySizeInBytes size of outputData + /// @return return code + /// + static Status TransTensor(const ccTensorDescriptor_t xDesc, const void *x, const CceTensorDescriptorPtr &yDesc, + void *y, uint32_t ySizeInBytes); + + /// + /// @brief CceTensorDescriptor Static Constructor + /// @return CceTensorDescriptor smart pointer + /// + static CceTensorDescriptorPtr Create(); + + ccTensorDescriptor_t cc_tensor_ = nullptr; +}; } // namespace ge #endif // INC_FRAMEWORK_COMMON_OP_GE_OP_UTILS_H_ diff --git a/inc/graphengine/inc/framework/common/op/op_parser_util.h b/inc/graphengine/inc/framework/common/op/op_parser_util.h index 43254ca95..49b4350a4 100644 --- a/inc/graphengine/inc/framework/common/op/op_parser_util.h +++ b/inc/graphengine/inc/framework/common/op/op_parser_util.h @@ -17,6 +17,7 @@ #ifndef INC_FRAMEWORK_COMMON_OP_OP_PARSER_UTIL_H_ #define INC_FRAMEWORK_COMMON_OP_OP_PARSER_UTIL_H_ +#include #include #include #include @@ -30,7 +31,10 @@ const uint32_t NORMAL_OUTPUT_NUM = 1; const uint32_t NORMAL_WORKSPACE_NUM = 0; const int32_t NORMAL_1D_DIM_NUM = 1; const int32_t NORMAL_SCALE_DIM_NUM = 0; +const int NORMAL_TENSOR_FORMAT = static_cast(cce::CC_TENSOR_NC1HWC0); const int NORMAL_TENSOR_SIZE = 4; +const int NORMAL_DEVICE_DATA_TYPE = static_cast(cce::CC_DATA_HALF); +const int DEFAULT_POOLING_MODE = static_cast(cce::CC_POOLING_MAX); const uint32_t DEFAULT_REAL_DIM_CNT = 4; // const @@ -179,6 +183,7 @@ const int32_t SSD_DETECTIONOUTPUT_BACKGROUND_LABEL_ID_DEFAULT_VALUE = 0; const float SSD_DETECTIONOUTPUT_NMS_THRESHOLD_DEFAULT_VALUE = 0.3; const int32_t SSD_DETECTIONOUTPUT_TOP_K_DEFAULT_VALUE = 200; const float SSD_DETECTIONOUTPUT_ETA_DEFAULT_VALUE = 1.0; +const int SSD_DETECTIONOUTPUT_CODE_TYPE_DEFAULT_VALUE = static_cast(cce::CC_BOX_CENTER_SIZE); const int32_t SSD_DETECTIONOUTPUT_KEEP_TOP_K_DEFAULT_VALUE = 200; const bool SSD_DETECTIONOUTPUT_VARIANCE_ENCODED_IN_TARGET_DEFAULT_VALUE = false; const float SSD_DETECTIONOUTPUT_CONFIDENCE_THRESHOLD_DEFAULT_VALUE = 0.1; @@ -195,6 +200,7 @@ const float REFINEDET_DETECTIONOUTPUT_NMS_THRESHOLD_DEFAULT_VALUE = 0.3; const int32_t REFINEDET_DETECTIONOUTPUT_TOP_K_DEFAULT_VALUE = 200; const float REFINEDET_DETECTIONOUTPUT_ETA_DEFAULT_VALUE = 1.0; const bool REFINEDET_DETECTIONOUTPUT_VARIANCE_ENCODED_IN_TARGET_DEFAULT_VALUE = false; +const int REFINEDET_DETECTIONOUTPUT_CODE_TYPE_DEFAULT_VALUE = static_cast(cce::CC_BOX_CENTER_SIZE); const int32_t REFINEDET_DETECTIONOUTPUT_KEEP_TOP_K_DEFAULT_VALUE = 200; const float REFINEDET_DETECTIONOUTPUT_CONFIDENCE_THRESHOLD_DEFAULT_VALUE = 0.1; const float REFINEDET_DETECTIONOUTPUT_OBJECTNESS_SCORE_DEFAULT_VALUE = 0; diff --git a/inc/graphengine/inc/framework/common/profiling/ge_profiling.h b/inc/graphengine/inc/framework/common/profiling/ge_profiling.h deleted file mode 100644 index 836997541..000000000 --- a/inc/graphengine/inc/framework/common/profiling/ge_profiling.h +++ /dev/null @@ -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 INC_FRAMEWORK_COMMON_GE_PROFILING_H_ -#define INC_FRAMEWORK_COMMON_GE_PROFILING_H_ - -#include "ge/ge_api_error_codes.h" -#include "toolchain/prof_callback.h" - -const int MAX_DEV_NUM = 64; - -enum ProfCommandHandleType { - kProfCommandhandleInit = 0, - kProfCommandhandleStart, - kProfCommandhandleStop, - kProfCommandhandleFinalize, - kProfCommandhandleModelSubscribe, - kProfCommandhandleModelUnsubscribe -}; - -struct ProfCommandHandleData { - uint64_t profSwitch; - uint32_t devNums; // length of device id list - uint32_t devIdList[MAX_DEV_NUM]; - uint32_t modelId; -}; - -ge::Status RegProfCtrlCallback(MsprofCtrlCallback func); -ge::Status RegProfSetDeviceCallback(MsprofSetDeviceCallback func); -ge::Status RegProfReporterCallback(MsprofReporterCallback func); -ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t len); - -#endif // INC_FRAMEWORK_COMMON_GE_PROFILING_H_ diff --git a/inc/graphengine/inc/framework/common/profiling/ge_runner_profiling.h b/inc/graphengine/inc/framework/common/profiling/ge_runner_profiling.h deleted file mode 100644 index d2eff767b..000000000 --- a/inc/graphengine/inc/framework/common/profiling/ge_runner_profiling.h +++ /dev/null @@ -1,24 +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 INC_FRAMEWORK_COMMON_GE_RUNNER_PROFILING_H_ -#define INC_FRAMEWORK_COMMON_GE_RUNNER_PROFILING_H_ - -#include "profiling/ge_profiling.h" - -bool IsInitialize(); - -#endif // INC_FRAMEWORK_COMMON_GE_RUNNER_PROFILING_H_ diff --git a/inc/graphengine/inc/framework/common/scope_guard.h b/inc/graphengine/inc/framework/common/scope_guard.h index 001a0e757..2154648de 100644 --- a/inc/graphengine/inc/framework/common/scope_guard.h +++ b/inc/graphengine/inc/framework/common/scope_guard.h @@ -42,8 +42,9 @@ class ScopeGuard { if (on_exit_scope_ != nullptr) { try { on_exit_scope_(); - } catch (std::bad_function_call &e) { } - catch (...) { } + } catch (std::bad_function_call &e) { + } catch (...) { + } } } } diff --git a/inc/graphengine/inc/framework/common/string_util.h b/inc/graphengine/inc/framework/common/string_util.h index de19807c3..3e4bf0935 100644 --- a/inc/graphengine/inc/framework/common/string_util.h +++ b/inc/graphengine/inc/framework/common/string_util.h @@ -17,7 +17,6 @@ #ifndef INC_FRAMEWORK_COMMON_STRING_UTIL_H_ #define INC_FRAMEWORK_COMMON_STRING_UTIL_H_ -#include #include #include @@ -38,7 +37,7 @@ class StringUtils { return s; } // lint -esym(551,*) - static std::string &Rtrim(std::string &s) { /*lint !e618*/ + static std::string &Rtrim(std::string &s) { /*lint !e618*/ #if __cplusplus >= 201103L (void)s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int c) { return !std::isspace(c); })); #else @@ -62,8 +61,10 @@ class StringUtils { /// @param [in] delim separator /// @return string array after segmentation /// + /*lint -e1077*/ static std::vector Split(const std::string &str, char delim) { std::vector elems; + /*lint +e1077*/ if (str.empty()) { elems.emplace_back(""); diff --git a/inc/graphengine/inc/framework/common/taskdown_common.h b/inc/graphengine/inc/framework/common/taskdown_common.h deleted file mode 100644 index 090e7e260..000000000 --- a/inc/graphengine/inc/framework/common/taskdown_common.h +++ /dev/null @@ -1,71 +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 INC_FRAMEWORK_COMMON_TASKDOWN_COMMON_H_ -#define INC_FRAMEWORK_COMMON_TASKDOWN_COMMON_H_ - -#include "runtime/rt.h" - -namespace ge { - -const int CC_FUSION_OP_MAX = 32; - -typedef enum tagCcStatus { - CC_STATUS_SUCCESS = 0, /**< succ */ - CC_STATUS_NOT_INITIALIZED = 1, /**< not init */ - CC_STATUS_ALLOC_FAILED = 2, /**< alloc mem failed */ - CC_STATUS_BAD_PARAM = 3, /**< para check failed */ - CC_STATUS_INTERNAL_ERROR = 4, /**< internal error */ - CC_STATUS_KERNEL_ERROR = 5, /**< kernel error */ - CC_STATUS_RUNTIME_ERROR = 6, /**< runtime error */ - CC_STATUS_NOT_SUPPORTED = 7, /**< unsupport error */ - CC_STATUS_INVALID_VALUE = 7, /**< invalid value error for blas*/ - CC_STATUS_RESERVED /**< just for check */ -} ccStatus_t; - -typedef enum tagccKernelType { - CCE_AI_CORE = 0, /* cce aicore */ - CCE_AI_CPU = 1, /* cce aicpu */ - TE = 2, /* te operator*/ - CUSTOMIZED = 3, /* customized operator */ - TE_AI_CORE = 4, /* te aicore operator*/ - TE_AI_CPU = 5, /* te aicpu operator */ - AI_CPU = 6, /* aicpu */ - CUST_AI_CPU = 7, /* custom aicpu*/ - INVALID = 8, /* unknown kernel type */ -} ccKernelType; - -typedef struct tagOpContext { - ccKernelType kernelType; - uint32_t opId; - uint32_t kernelFuncId; - uint32_t opIndex; - uint32_t opCount; - uint32_t opIndex2[CC_FUSION_OP_MAX]; - bool isFlowtable; - uint16_t *argsOffset; - uint32_t argsCount; - uint64_t genDataBaseAddr; - uint64_t genDataBaseSize; - uint64_t genWeightBaseAddr; - uint64_t genWeightBaseSize; - uint64_t genVariableBaseAddr; - uint64_t genVariableBaseSize; - uint64_t l2ctrlSize; -} ccOpContext; -} // namespace ge - -#endif // INC_FRAMEWORK_COMMON_TASKDOWN_COMMON_H_ diff --git a/inc/graphengine/inc/framework/common/types.h b/inc/graphengine/inc/framework/common/types.h index 2dbb1753d..ad284d076 100644 --- a/inc/graphengine/inc/framework/common/types.h +++ b/inc/graphengine/inc/framework/common/types.h @@ -18,6 +18,7 @@ #define INC_FRAMEWORK_COMMON_TYPES_H_ #include +#include #include #include #include @@ -69,7 +70,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROFIL FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROFILE_STOP_VALUE; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::map PROFILE_COMPONENT_MAP; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROFILE_CONFIG; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROFILE_MODEL_ID; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string MODEL_ATTR_TASKS; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string MODEL_ATTR_TASK_GEN_BASE_ADDR; @@ -431,13 +431,10 @@ REGISTER_OPTYPE_DECLARE(HCOMBROADCAST, "HcomBroadcast"); REGISTER_OPTYPE_DECLARE(HCOMALLGATHER, "HcomAllGather"); REGISTER_OPTYPE_DECLARE(HCOMALLREDUCE, "HcomAllReduce"); REGISTER_OPTYPE_DECLARE(HCOMREDUCESCATTER, "HcomReduceScatter"); -REGISTER_OPTYPE_DECLARE(HCOMREDUCE, "HcomReduce"); REGISTER_OPTYPE_DECLARE(HCOMSEND, "HcomSend"); REGISTER_OPTYPE_DECLARE(HCOMRECEIVE, "HcomReceive"); REGISTER_OPTYPE_DECLARE(HCOMREMOTEREAD, "HcomRemoteRead"); -REGISTER_OPTYPE_DECLARE(HCOMREMOTEREFREAD, "HcomRemoteRefRead"); REGISTER_OPTYPE_DECLARE(HCOMREMOTEWRITE, "HcomRemoteWrite"); -REGISTER_OPTYPE_DECLARE(HCOMREMOTESCATTERWRITE, "HcomRemoteScatterWrite"); REGISTER_OPTYPE_DECLARE(VARASSIGN, "VarAssign"); REGISTER_OPTYPE_DECLARE(VARISINITIALIZEDOP, "VarIsInitializedOp"); @@ -451,7 +448,6 @@ REGISTER_OPTYPE_DECLARE(MEMCPYASYNC, "MemcpyAsync"); REGISTER_OPTYPE_DECLARE(MEMCPYADDRASYNC, "MemcpyAddrAsync"); REGISTER_OPTYPE_DECLARE(STREAMMERGE, "StreamMerge"); REGISTER_OPTYPE_DECLARE(ENDGRAPH, "EndGraph"); -REGISTER_OPTYPE_DECLARE(MODELEXIT, "ModelExit"); REGISTER_OPTYPE_DECLARE(SEND, "Send"); REGISTER_OPTYPE_DECLARE(RECV, "Recv"); REGISTER_OPTYPE_DECLARE(ENDOFSEQUENCE, "EndOfSequence"); @@ -527,13 +523,7 @@ REGISTER_OPTYPE_DECLARE(HVDCALLBACKALLGATHER, "HorovodAllgather"); REGISTER_OPTYPE_DECLARE(HVDCALLBACKBROADCAST, "HorovodBroadcast"); REGISTER_OPTYPE_DECLARE(HVDWAIT, "HorovodWait"); -// aicpu op for online_infer dynamic_dims -REGISTER_OPTYPE_DECLARE(GETDYNAMICDIMS, "GetDynamicDims"); - -// profiling training trace node -REGISTER_OPTYPE_DECLARE(PROFILINGTRAININGTRACE, "ProfilingTrainingTrace"); - -enum InputMode { INPUT = 0, CONST_INPUT }; +enum InputMode { INPUT = 0, CONST }; // Definition of the processing status enum of the process module enum ModelProcessState { @@ -609,7 +599,7 @@ static constexpr uint32_t MODEL_FILE_CHECKSUM_LENGTH = 64; /// /// @brief length of the reserved field in the model file header /// -static constexpr uint32_t MODEL_FILE_RESERVED_LENGTH = 75; +static constexpr uint32_t MODEL_FILE_RESERVED_LENGTH = 79; /// /// @ingroup domi_omg @@ -847,10 +837,9 @@ struct ModelFileHeader { uint32_t ops = 0; // Computing power (Kops) uint8_t userdefineinfo[USER_DEFINE_INFO_LENGTH] = {0}; // User-defined information. The value contains 32 characters uint32_t om_ir_version = 0; - uint32_t model_num = 0; uint8_t platform_version[PLATFORM_VERSION_LEN] = {0}; uint8_t platform_type = {0}; - uint8_t reserved[MODEL_FILE_RESERVED_LENGTH] = {0}; // Reserved field 75 + uint8_t reserved[MODEL_FILE_RESERVED_LENGTH] = {0}; // Reserved field 79 }; static constexpr uint8_t TARGET_TYPE_LTTE_8BIT = 0; @@ -1098,7 +1087,6 @@ struct BasicInfo { uint32_t total_size; // total memory size }; #pragma pack() // Cancels single-byte alignment -enum class MemorySizeCalcType { NORMAL = 0, ALWAYS_EMPTY }; } // namespace ge namespace domi { diff --git a/inc/graphengine/inc/framework/common/util.h b/inc/graphengine/inc/framework/common/util.h index 42ab38683..b1c278d8d 100644 --- a/inc/graphengine/inc/framework/common/util.h +++ b/inc/graphengine/inc/framework/common/util.h @@ -30,12 +30,12 @@ #include "framework/common/ge_inner_error_codes.h" #include "mmpa/mmpa_api.h" -#define GE_CHECK_POSITIVE_SIZE_RANGE(size) \ - do { \ - if (size <= 0) { \ - DOMI_LOGE("param[%s] is not a positive number", #size); \ - return PARAM_INVALID; \ - } \ +#define GE_CHECK_POSITIVE_SIZE_RANGE(size) \ + do { \ + if (size <= 0) { \ + DOMI_LOGE("param[%s] is not a positive number", #size); \ + return PARAM_INVALID; \ + } \ } while (0) #define CHECK_FALSE_EXEC(expr, exec_expr, ...) \ @@ -113,84 +113,84 @@ } while (0) // Check if the parameter is null. If yes, return PARAM_INVALID and record the error -#define GE_CHECK_NOTNULL(val) \ - do { \ - if (val == nullptr) { \ - DOMI_LOGE("param[%s] must not be null.", #val); \ - return ge::PARAM_INVALID; \ - } \ +#define GE_CHECK_NOTNULL(val) \ + do { \ + if (val == nullptr) { \ + DOMI_LOGE("param[%s] must not be null.", #val); \ + return ge::PARAM_INVALID; \ + } \ } while (0) // Check if the parameter is null. If yes, just return and record the error -#define GE_CHECK_NOTNULL_JUST_RETURN(val) \ - do { \ - if (val == nullptr) { \ - DOMI_LOGE("param[%s] must not be null.", #val); \ - return; \ - } \ +#define GE_CHECK_NOTNULL_JUST_RETURN(val) \ + do { \ + if (val == nullptr) { \ + DOMI_LOGE("param[%s] must not be null.", #val); \ + return; \ + } \ } while (0) // Check whether the parameter is null. If so, execute the exec_expr expression and record the error log -#define GE_CHECK_NOTNULL_EXEC(val, exec_expr) \ - do { \ - if (val == nullptr) { \ - DOMI_LOGE("param[%s] must not be null.", #val); \ - exec_expr; \ - } \ +#define GE_CHECK_NOTNULL_EXEC(val, exec_expr) \ + do { \ + if (val == nullptr) { \ + DOMI_LOGE("param[%s] must not be null.", #val); \ + exec_expr; \ + } \ } while (0) // Check whether the parameter is null. If yes, return directly and record the error log -#define GE_RT_VOID_CHECK_NOTNULL(val) \ - do { \ - if (val == nullptr) { \ - DOMI_LOGE("param[%s] must not be null.", #val); \ - return; \ - } \ +#define GE_RT_VOID_CHECK_NOTNULL(val) \ + do { \ + if (val == nullptr) { \ + DOMI_LOGE("param[%s] must not be null.", #val); \ + return; \ + } \ } while (0) // Check if the parameter is null. If yes, return false and record the error log -#define GE_RT_FALSE_CHECK_NOTNULL(val) \ - do { \ - if (val == nullptr) { \ - DOMI_LOGE("param[%s] must not be null.", #val); \ - return false; \ - } \ +#define GE_RT_FALSE_CHECK_NOTNULL(val) \ + do { \ + if (val == nullptr) { \ + DOMI_LOGE("param[%s] must not be null.", #val); \ + return false; \ + } \ } while (0) // Check if the parameter is out of bounds -#define GE_CHECK_SIZE(size) \ - do { \ - if (size == 0) { \ - DOMI_LOGE("param[%s] is out of range", #size); \ - return ge::PARAM_INVALID; \ - } \ +#define GE_CHECK_SIZE(size) \ + do { \ + if (size == 0) { \ + DOMI_LOGE("param[%s] is out of range", #size); \ + return ge::PARAM_INVALID; \ + } \ } while (0) // Check if the container is empty -#define GE_CHECK_VECTOR_NOT_EMPTY(vector) \ - do { \ - if (vector.empty()) { \ - DOMI_LOGE("param[%s] is empty!", #vector); \ - return ge::FAILED; \ - } \ +#define GE_CHECK_VECTOR_NOT_EMPTY(vector) \ + do { \ + if (vector.empty()) { \ + DOMI_LOGE("param[%s] is empty!", #vector); \ + return ge::FAILED; \ + } \ } while (0) // Check if the value on the left is greater than or equal to the value on the right -#define GE_CHECK_GE(lhs, rhs) \ - do { \ - if (lhs < rhs) { \ - DOMI_LOGE("param[%s] is less than[%s]", #lhs, #rhs); \ - return ge::PARAM_INVALID; \ - } \ +#define GE_CHECK_GE(lhs, rhs) \ + do { \ + if (lhs < rhs) { \ + DOMI_LOGE("param[%s] is less than[%s]", #lhs, #rhs); \ + return ge::PARAM_INVALID; \ + } \ } while (0) // Check if the value on the left is less than or equal to the value on the right -#define GE_CHECK_LE(lhs, rhs) \ - do { \ - if (lhs > rhs) { \ - DOMI_LOGE("param[%s] is greater than[%s]", #lhs, #rhs); \ - return ge::PARAM_INVALID; \ - } \ +#define GE_CHECK_LE(lhs, rhs) \ + do { \ + if (lhs > rhs) { \ + DOMI_LOGE("param[%s] is greater than[%s]", #lhs, #rhs); \ + return ge::PARAM_INVALID; \ + } \ } while (0) #define GE_DELETE_NEW_SINGLE(var) \ @@ -345,7 +345,7 @@ std::string ToString(const google::protobuf::RepeatedField &rpd_field) { /// @return Timestamp, in microseconds (US) /// /// -uint64_t GetCurrentTimestamp(); +uint64_t GetCurrentTimestap(); /// /// @ingroup domi_common diff --git a/inc/graphengine/inc/framework/engine/dnnengine.h b/inc/graphengine/inc/framework/engine/dnnengine.h index 1bcf5e07c..65897ac5d 100644 --- a/inc/graphengine/inc/framework/engine/dnnengine.h +++ b/inc/graphengine/inc/framework/engine/dnnengine.h @@ -30,7 +30,6 @@ enum PriorityEnum { COST_0 = 0, COST_1, COST_2, - COST_3, COST_9 = 9, COST_10 = 10, }; diff --git a/inc/graphengine/inc/framework/executor/ge_executor.h b/inc/graphengine/inc/framework/executor/ge_executor.h index 3136e1721..6e82bb96f 100644 --- a/inc/graphengine/inc/framework/executor/ge_executor.h +++ b/inc/graphengine/inc/framework/executor/ge_executor.h @@ -30,6 +30,8 @@ #include "runtime/base.h" namespace ge { +class ModelListenerAdapter; + class SingleOp; class DynamicSingleOp; @@ -53,8 +55,14 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { ge::Status Initialize(); ge::Status Finalize(); + // Load model + ge::Status LoadModelOffline(uint32_t &model_id, const std::string &path, const std::string &key, int32_t priority, + std::shared_ptr listener); + ge::Status UnloadModel(uint32_t modelId); + ge::Status RunModel(const ge::RunModelData &input_data, ge::RunModelData &output_data); + // Get input and output descriptor ge::Status GetModelDescInfo(uint32_t model_id, std::vector &input_desc, std::vector &output_desc, bool new_model_desc = false); @@ -157,6 +165,12 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { ge::Status GetAippType(uint32_t model_id, uint32_t index, InputAippType &type, size_t &aipp_index); + ge::Status GetModelDescInfoForZeroCopy(uint32_t model_id, std::vector &input_desc, + std::vector &output_desc); + + ge::Status LoadModel(uint32_t &model_id, const ge::ModelData &model_data, + std::shared_ptr listener); + ge::Status CommandHandle(const ge::Command &command); ge::Status SetDump(const DumpConfig &dump_config); @@ -220,22 +234,6 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { ge::Status ExecModel(uint32_t model_id, void *stream, const ge::RunModelData &input_data, ge::RunModelData &output_data, bool async_mode = false); - /// - /// @ingroup ge - /// @brief Synchronous execution of offline model(Do not create thread) - /// @param [in] uint32_t model_id: Model ID to execute - /// @param [in] void* stream: stream to execute - /// @param [in] bool async_mode: is asynchronize mode. - /// @param [in] const domi::InputData *input_data: Model input data - /// @param [in] const std::vector &input_desc: description of model input data - /// @param [out] domi::OutputData *output_data: Model output data - /// @param [out] std::vector &output_desc: description of model output data - /// @return SUCCESS handle successfully / others handle failed - /// - ge::Status ExecModel(uint32_t model_id, void *stream, const ge::RunModelData &run_input_data, - const std::vector &input_desc, ge::RunModelData &run_output_data, - std::vector &output_desc, bool async_mode = false); - /// /// @ingroup ge /// @brief Get weight memory size from model file @@ -272,8 +270,6 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { static ge::Status ReleaseSingleOpResource(void *stream); - static ge::Status GetDeviceIdByModelId(uint32_t model_id, uint32_t &device_id); - ge::Status GetBatchInfoSize(uint32_t model_id, size_t &shape_count); ge::Status GetOrigInputInfo(uint32_t model_id, uint32_t index, OriginInputInfo &orig_input_info); ge::Status GetAllAippInputOutputDims(uint32_t model_id, uint32_t index, std::vector &input_dims, @@ -283,6 +279,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { private: static bool isInit_; }; + +ge::Status ModelInfoParser(const ge::ModelData &model, ge::ModelInfo &model_info); } // namespace ge #endif // INC_FRAMEWORK_EXECUTOR_GE_EXECUTOR_H_ diff --git a/inc/graphengine/inc/framework/ge_runtime/task_info.h b/inc/graphengine/inc/framework/ge_runtime/task_info.h index f59c6454e..e36c43334 100644 --- a/inc/graphengine/inc/framework/ge_runtime/task_info.h +++ b/inc/graphengine/inc/framework/ge_runtime/task_info.h @@ -18,6 +18,7 @@ #define INC_FRAMEWORK_GE_RUNTIME_TASK_INFO_H_ #include +#include #include #include #include @@ -218,9 +219,9 @@ class LabelSwitchTaskInfo : public TaskInfo { label_list_(label_list), cond_(cond) {} ~LabelSwitchTaskInfo() override {} - uint32_t label_size() const { return label_size_; } - const std::vector &label_list() const { return label_list_; } - void *cond() const { return cond_; } + uint32_t label_size() { return label_size_; }; + const std::vector &label_list() { return label_list_; }; + void *cond() { return cond_; }; private: uint32_t label_size_; @@ -235,7 +236,7 @@ class EventTaskInfo : public TaskInfo { protected: EventTaskInfo(const std::string &op_name, uint32_t stream_id, TaskInfoType type, uint32_t event_id) : TaskInfo(op_name, stream_id, type, false), event_id_(event_id) {} - ~EventTaskInfo() override {} + virtual ~EventTaskInfo() override {} uint32_t event_id_; }; @@ -271,13 +272,16 @@ class FusionEndTaskInfo : public TaskInfo { class HcclTaskInfo : public TaskInfo { public: HcclTaskInfo(const std::string &op_name, uint32_t stream_id, const std::string hccl_type, void *input_data_addr, - void *output_data_addr, int64_t workspace_size, int64_t hccl_stream_num, + void *output_data_addr, void *workspace_addr, int64_t workspace_size, int64_t hccl_stream_num, const std::vector &private_def, void *ops_kernel_store, int32_t count, int64_t root_id, - int64_t op_type, int64_t data_type, const std::string &group, bool dump_flag) + int64_t op_type, int64_t data_type, const std::string &group, + std::function hcom_bind_model, std::function hcom_unbind_model, + std::function, void *)> hcom_distribute_task, bool dump_flag) : TaskInfo(op_name, stream_id, TaskInfoType::HCCL, dump_flag), hccl_type_(hccl_type), input_data_addr_(input_data_addr), output_data_addr_(output_data_addr), + workspace_addr_(workspace_addr), workspace_size_(workspace_size), hccl_stream_num_(hccl_stream_num), private_def_(private_def), @@ -286,12 +290,16 @@ class HcclTaskInfo : public TaskInfo { root_id_(root_id), op_type_(op_type), data_type_(data_type), - group_(group) {} + group_(group), + hcom_bind_model_(hcom_bind_model), + hcom_unbind_model_(hcom_unbind_model), + hcom_distribute_task_(hcom_distribute_task) {} ~HcclTaskInfo() override {} const std::string &hccl_type() const { return hccl_type_; } void *input_data_addr() const { return input_data_addr_; } void *output_data_addr() const { return output_data_addr_; } + void *workspace_addr() const { return workspace_addr_; } int64_t workspace_size() const { return workspace_size_; } int64_t hccl_stream_num() const { return hccl_stream_num_; } const std::vector &private_def() const { return private_def_; } @@ -301,11 +309,17 @@ class HcclTaskInfo : public TaskInfo { int64_t op_type() const { return op_type_; } int64_t data_type() const { return data_type_; } const std::string &group() const { return group_; } + std::function hcom_bind_model() const { return hcom_bind_model_; } + std::function hcom_unbind_model() const { return hcom_unbind_model_; } + std::function, void *)> hcom_distribute_task() const { + return hcom_distribute_task_; + } private: std::string hccl_type_; void *input_data_addr_; void *output_data_addr_; + void *workspace_addr_; int64_t workspace_size_; int64_t hccl_stream_num_; std::vector private_def_; @@ -315,6 +329,9 @@ class HcclTaskInfo : public TaskInfo { int64_t op_type_; int64_t data_type_; std::string group_; + std::function hcom_bind_model_; + std::function hcom_unbind_model_; + std::function, void *)> hcom_distribute_task_; }; class ProfilerTraceTaskInfo : public TaskInfo { diff --git a/inc/graphengine/inc/framework/generator/ge_generator.h b/inc/graphengine/inc/framework/generator/ge_generator.h index e0904965a..37bca8971 100644 --- a/inc/graphengine/inc/framework/generator/ge_generator.h +++ b/inc/graphengine/inc/framework/generator/ge_generator.h @@ -74,22 +74,11 @@ class GeGenerator { /// @param [in] op_desc: the OP description. /// @param [in] inputs: input tensors. /// @param [in] outputs: output tensors. - /// @param [in] engine_type: engine type. - /// @param [out] model_buff: model buff of op. + /// @param [in] engine_type: specific engine. + /// @param [out] model_buff: model buff of single op. /// @return SUCCESS or FAILED Status BuildSingleOpModel(OpDescPtr &op_desc, const vector &inputs, const vector &outputs, OpEngineType engine_type, ModelBufferData &model_buff); - /// - /// @ingroup ge - /// @brief: Build single Op into model buff. - /// @param [in] op_desc: the OP description. - /// @param [in] inputs: input tensors. - /// @param [in] outputs: output tensors. - /// @param [in] graph_name: graph name. - /// @param [out] graph: graph of single op. - /// @return SUCCESS or FAILED - Status BuildSingleOpGraph(OpDescPtr &op_desc, const vector &inputs, const vector &outputs, - std::string graph_name, Graph &graph); private: Status GenerateModel(const Graph &graph, const string &file_name_prefix, const vector &inputs, @@ -97,7 +86,6 @@ class GeGenerator { Status BuildSingleOp(OpDescPtr &op_desc, const vector &inputs, const vector &outputs, const string &model_file_name, OpEngineType engine_type, ModelBufferData &model_buff, bool is_offline = true); - Status CheckForSingleOp(OpDescPtr &op_desc, const vector &inputs, const vector &outputs); class Impl; diff --git a/inc/graphengine/inc/framework/memory/memory_api.h b/inc/graphengine/inc/framework/memory/memory_api.h index d8b06125c..ebb7e68cc 100644 --- a/inc/graphengine/inc/framework/memory/memory_api.h +++ b/inc/graphengine/inc/framework/memory/memory_api.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * 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. @@ -21,7 +21,6 @@ #include #include "ge/ge_api_error_codes.h" -#include "graph//types.h" #include "runtime/mem.h" namespace ge { @@ -36,12 +35,6 @@ struct HostVarInfo { uint64_t var_size; }; -struct TensorInfo { - std::string var_name; - std::vector dims; - DataType data_type; -}; - /// /// \param size [in] rdma pool memory size to be allocated. /// \param mem_type [in] memory type for rdma pool. @@ -54,13 +47,6 @@ Status InitRdmaPool(size_t size, rtMemType_t mem_type = RT_MEMORY_HBM); /// \return Status result of function Status RdmaRemoteRegister(const std::vector &var_info, rtMemType_t mem_type = RT_MEMORY_HBM); -/// -/// \param tensor_info [in] description for tensor stored shared memory. -/// \param dev_addr [out] malloced shared memory addr. -/// \param memory_size [out] malloced shared memory size. -/// \return Status result of function -Status MallocSharedMemory(const TensorInfo &tensor_info, uint64_t &dev_addr, uint64_t &memory_size); - /// /// \param var_name [in] var_name name of host variable. /// \param base_addr [out] base_addr vase addr of host variable. diff --git a/inc/graphengine/inc/framework/memory/memory_assigner.h b/inc/graphengine/inc/framework/memory/memory_assigner.h index 4552fa7c1..bbec014ba 100644 --- a/inc/graphengine/inc/framework/memory/memory_assigner.h +++ b/inc/graphengine/inc/framework/memory/memory_assigner.h @@ -33,7 +33,7 @@ class MemoryAssigner { MemoryAssigner &operator=(const MemoryAssigner &) = delete; - Status AssignMemory(bool is_loop_graph, map &mem_offset, size_t &zero_copy_mem_size); + Status AssignMemory(bool is_loop_graph, size_t &mem_offset, size_t &zero_copy_mem_size); private: ge::ComputeGraphPtr compute_graph_; diff --git a/inc/graphengine/inc/framework/omg/omg.h b/inc/graphengine/inc/framework/omg/omg.h index 62332b8db..56778d735 100644 --- a/inc/graphengine/inc/framework/omg/omg.h +++ b/inc/graphengine/inc/framework/omg/omg.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * 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. @@ -21,6 +21,7 @@ #include #include #include +#include "framework/common/types.h" #include "framework/omg/omg_inner_types.h" #include "framework/omg/parser/parser_inner_ctx.h" #include "proto/ge_ir.pb.h" @@ -91,6 +92,8 @@ void GetGroupName(ge::proto::ModelDef &model); void FindParserSo(const string &path, vector &fileList, string &caffe_parser_path); +Status CheckCustomAiCpuOpLib(); + Status DumpInfershapeJson(const ge::Graph &graph, const char *json_file); Status SetOutputNodeInfo(ge::Graph &graph, const std::string &output_type, const std::string &output_format); diff --git a/inc/graphengine/inc/framework/omg/omg_inner_types.h b/inc/graphengine/inc/framework/omg/omg_inner_types.h index 1049b6b51..2ab7e2709 100644 --- a/inc/graphengine/inc/framework/omg/omg_inner_types.h +++ b/inc/graphengine/inc/framework/omg/omg_inner_types.h @@ -25,8 +25,8 @@ #include #include #include "framework/common/fmk_error_codes.h" +#include "framework/common/types.h" #include "register/register_fmk_types.h" -#include "graph/node.h" using domi::DOMI_TENSOR_ND; using domi::DOMI_TENSOR_RESERVED; @@ -93,8 +93,6 @@ struct OmgContext { std::map> out_nodes_map; // user-designate out nodes (this is used for determing the orders) std::vector> user_out_nodes; - // default out nodes (this is used for determing the orders) - std::vector> default_out_nodes; // save the output node of the network, value = topName, // topName indicates the output name of the operator. std::vector user_out_nodes_top_vec; @@ -102,8 +100,8 @@ struct OmgContext { std::vector net_out_nodes; // net out nodes top names(only caffe has top) std::vector out_top_names; - // net data nodes top names(only caffe has top) - std::vector data_top_names; + // path for the aicpu custom operator so_file + std::vector aicpu_op_run_paths; // preferential format used by the entire network domiTensorFormat_t net_format = DOMI_TENSOR_RESERVED; domi::FrameworkType type = domi::FRAMEWORK_RESERVED; @@ -117,12 +115,6 @@ struct OmgContext { std::string dynamic_batch_size; std::string dynamic_image_size; std::string dynamic_dims; - std::string dynamic_node_type; - std::vector> user_real_input_dims; - std::vector cur_dynamic_dims; - bool need_multi_batch = false; - std::vector data_nodes; - std::vector getnext_nosink_nodes; }; } // namespace ge diff --git a/inc/graphengine/inc/framework/omg/parser/model_parser.h b/inc/graphengine/inc/framework/omg/parser/model_parser.h index 9eda685da..3a8aa6ced 100644 --- a/inc/graphengine/inc/framework/omg/parser/model_parser.h +++ b/inc/graphengine/inc/framework/omg/parser/model_parser.h @@ -18,7 +18,7 @@ #define INC_FRAMEWORK_OMG_PARSER_MODEL_PARSER_H_ #include -#include "framework/omg/parser/parser_types.h" +#include "framework/common/types.h" #include "framework/omg/omg_inner_types.h" #include "graph/attr_value.h" #include "graph/compute_graph.h" @@ -36,7 +36,7 @@ using Status = domi::Status; namespace domi { using GetGraphCallback = std::function( - const google::protobuf::Message *root_proto, const std::string &graph)>; + const google::protobuf::Message *root_proto, const std::string &graph)>; class ModelParser { public: ModelParser() {} @@ -44,20 +44,19 @@ class ModelParser { virtual ~ModelParser() {} /** - * @ingroup domi_omg - * @brief Analyze network model data - * @param [in] file Network model file path - * @param [in|out] graph Save the network information after analysis - * @return SUCCESS - * @return Others failed - */ + * @ingroup domi_omg + * @brief Analyze network model data + * @param [in] file Network model file path + * @param [in|out] graph Save the network information after analysis + * @return SUCCESS + * @return Others failed + */ virtual Status Parse(const char *file, ge::Graph &graph) = 0; /** * @ingroup domi_omg * @brief Parse relevant data from memory and save it to graph * @param [in] input Model file memory data - * @param [in] input Model file memory size * @param [in|out] graph A graph for saving the model information after analysis * @return SUCCESS * @return FAILED @@ -66,46 +65,35 @@ class ModelParser { virtual Status ParseFromMemory(const char *data, uint32_t size, ge::ComputeGraphPtr &graph) = 0; /** - * @ingroup domi_omg - * @brief Parse relevant data from memory and save it to graph - * @param [in] input Model file memory data - * @param [in] input Model file memory size - * @param [in|out] graph A graph for saving the model information after analysis - * @return SUCCESS - * @return FAILED - * @author - */ - virtual Status ParseFromMemory(const char *data, uint32_t size, ge::Graph &graph) = 0; - - /** - * @ingroup domi_omg - * @brief Analyze network model data - * @param [in] proto network model - * @param [in|out] graph Save the network information after analysis - * @return SUCCESS - * @return Others failed - */ + * @ingroup domi_omg + * @brief Analyze network model data + * @param [in] proto network model + * @param [in|out] graph Save the network information after analysis + * @return SUCCESS + * @return Others failed + */ virtual Status ParseProto(const google::protobuf::Message *proto, ge::ComputeGraphPtr &graph) = 0; /** - * @ingroup domi_omg - * @brief Analyze callback model data in subgraph - * @param [in] proto network model - * @param [in] callback callback of subgraph - * @param [in|out] graph Save the network information after analysis - * @return SUCCESS - * @return Others failed - */ - virtual Status ParseProtoWithSubgraph(const google::protobuf::Message *proto, GetGraphCallback callback, + * @ingroup domi_omg + * @brief Analyze callback model data in subgraph + * @param [in] proto network model + * @param [in] callback callback of subgraph + * @param [in|out] graph Save the network information after analysis + * @return SUCCESS + * @return Others failed + */ + virtual Status ParseProtoWithSubgraph(const google::protobuf::Message *proto, + GetGraphCallback callback, ge::ComputeGraphPtr &graph) = 0; /** - * @ingroup domi_omg - * @brief Convert model files to JSON format - * @param [in] model_file Model file path to be converted - * @param [out] json_file Converted JSON file path - * @return SUCCESS - * @return Others failed - */ + * @ingroup domi_omg + * @brief Convert model files to JSON format + * @param [in] model_file Model file path to be converted + * @param [out] json_file Converted JSON file path + * @return SUCCESS + * @return Others failed + */ virtual Status ToJson(const char *model_file, const char *json_file) { return domi::SUCCESS; } /* diff --git a/inc/graphengine/inc/framework/omg/parser/op_parser.h b/inc/graphengine/inc/framework/omg/parser/op_parser.h index 087bad32e..251c04479 100644 --- a/inc/graphengine/inc/framework/omg/parser/op_parser.h +++ b/inc/graphengine/inc/framework/omg/parser/op_parser.h @@ -18,7 +18,7 @@ #define INC_FRAMEWORK_OMG_PARSER_OP_PARSER_H_ #include -#include "framework/omg/parser/parser_types.h" +#include "common/types.h" #include "omg/omg_inner_types.h" #include "proto/om.pb.h" #include "graph/ge_tensor.h" diff --git a/inc/graphengine/inc/framework/omg/parser/parser_factory.h b/inc/graphengine/inc/framework/omg/parser/parser_factory.h index 4845606f7..90d441d71 100644 --- a/inc/graphengine/inc/framework/omg/parser/parser_factory.h +++ b/inc/graphengine/inc/framework/omg/parser/parser_factory.h @@ -21,8 +21,8 @@ #include #include #include +#include "framework/common/types.h" #include "framework/omg/omg_inner_types.h" -#include "framework/omg/parser/parser_types.h" using Status = domi::Status; diff --git a/inc/graphengine/inc/framework/omg/parser/parser_inner_ctx.h b/inc/graphengine/inc/framework/omg/parser/parser_inner_ctx.h index 5d91bd46b..53f798955 100644 --- a/inc/graphengine/inc/framework/omg/parser/parser_inner_ctx.h +++ b/inc/graphengine/inc/framework/omg/parser/parser_inner_ctx.h @@ -29,43 +29,12 @@ namespace ge { struct ParserContext { - // format of the input specified by the command line - std::unordered_map input_nodes_format_map; - std::vector output_formats; - // user-designate input dims - std::vector>> user_input_dims; std::unordered_map> input_dims; - // resolve the mapping between operators with the same name and corresponding network. format e.g. - // Detectionoutput:SsdDetectiontOutput - std::map op_conf_map; - // user-designate out nodes (this is used for determing the orders) - std::vector> user_out_nodes; - // default out nodes (this is used for determing the orders) - std::vector> default_out_nodes; - // save the output node of the network. key = operator name, value = index, index indicates the output index of the - // operator - std::map> out_nodes_map; - // save the output node of the network, value = topName, - // topName indicates the output name of the operator. - std::vector user_out_nodes_top_vec; - // net out nodes (where user_out_nodes or leaf nodes) - std::vector net_out_nodes; - // net data nodes top names(only caffe has top) - std::vector data_top_names; - // net out nodes top names(only caffe has top) - std::vector out_top_names; - // Whether to use dynamic batch size or dynamic image size - bool is_dynamic_input = false; - bool train_flag = false; domi::domiTensorFormat_t format = domi::DOMI_TENSOR_ND; - domi::FrameworkType type = domi::FRAMEWORK_RESERVED; - RunMode run_mode = GEN_OM_MODEL; - // save caffe custom proto path, used by caffe parse - std::string custom_proto_path; - // save caffe proto path, used by caffe parse - std::string caffe_proto_path; - // name of the pass that needs to take effect - std::string enable_scope_fusion_passes; + RunMode run_mode = ONLY_PRE_CHECK; + std::string custom_proto_path; // save caffe custom proto path, used by caffe parse + std::string caffe_proto_path; // save caffe proto path, used by caffe parse + std::string enable_scope_fusion_passes; // name of the pass that needs to take effect }; ParserContext &GetParserContext(); diff --git a/inc/graphengine/inc/framework/omg/parser/parser_types.h b/inc/graphengine/inc/framework/omg/parser/parser_types.h deleted file mode 100644 index f3b7f00a8..000000000 --- a/inc/graphengine/inc/framework/omg/parser/parser_types.h +++ /dev/null @@ -1,510 +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. - */ - -#ifndef PARSER_COMMON_TYPES_H_ -#define PARSER_COMMON_TYPES_H_ - -#include -#include - -#include "register/register_types.h" - -#if !defined(__ANDROID__) && !defined(ANDROID) -#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 -#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 parser { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DATA; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *AIPPDATA; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONVOLUTION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CORRELATION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CORRELATIONV2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DECONVOLUTION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *POOLING; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ELTWISE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RELU; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RELU6; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SIGMOID; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ABSVAL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TANH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PRELU; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BATCHNORM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FUSIONBATCHNORM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SCALE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FULL_CONNECTION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SOFTMAX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PLUS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACTIVATION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FLATTEN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ADD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SUB; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MUL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MATMUL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RSQRT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BIASADD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESHAPE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFORMAT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPCONVOLUTION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DROPOUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DROPOUTGENMASK; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DROPOUTDOMASK; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCAT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ROIPOOLING; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PROPOSAL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FSRDETECTIONOUTPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DETECTIONPOSTPROCESS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LRN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSDATA; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PERMUTE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDNORMALIZE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDPRIORBOX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NETOUTPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDDETECTIONOUTPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFINEDETDETECTIONOUTPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CHANNELAXPY; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PSROIPOOLING; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *POWER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *POW; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ROIALIGN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PYTHON; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FREESPACEEXTRACT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPATIALTF; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SHAPE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SHAPEN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ARGMAX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GATHERND; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GATHER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REALDIV; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PACK; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SLICE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SLICED; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FLOORDIV; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQUEEZE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *UNSQUEEZE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STRIDEDSLICE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RANGE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RPNPROPOSALS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DECODEBBOX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PADV2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MIRRORPAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TILE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SIZE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CLIPBOXES; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTRCNNPREDICTIONS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPLIT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPLITV; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EXPANDDIMS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EMPTY; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MEAN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GREATER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SWITCH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SWITCHN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MERGE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SYMBOLICGRADIENT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REMOTECALL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *_IF; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STATELESSIF; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *IF; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CASE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *_WHILE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *WHILE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STATELESSWHILE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FOR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PARTITIONEDCALL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STATEFULPARTITIONEDCALL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FAKEPARAM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSPOSE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSPOSED; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CAST; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REGION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *YOLO; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *YOLODETECTIONOUTPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FILL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REVERSE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *UNPACK; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *YOLO2REORG; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCESUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONSTANT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESIZEBILINEAR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESIZEBILINEARGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MAXIMUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FRAMEWORKOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ARG; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FUSEDBATCHNORMGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LSTM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HIGHWAY; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RNN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATTENTIONDECODER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOGICAL_NOT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOGICAL_AND; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOGICAL_OR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EQUAL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NOTEQUAL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *INTERP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SHUFFLECHANNEL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *AIPP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MULTISHAPE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RECIPROCAL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SELU; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ELU; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACOSH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASINH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MINIMUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CLIP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *L2NORMALIZE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CROPANDRESIZE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *UNUSEDCONST; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPARSETODENSE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NONMAXSUPPRESSION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TOPKV2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *INVERTPERMUTATION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MULTINOMIAL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REVERSESEQUENCE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEPROD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEMAX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEMIN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EXTRACTIMAGEPATCHES; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQRT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEALL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESIZENEARESTNEIGHBOR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPACETOBATCHND; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BATCHTOSPACEND; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSERT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GREATEREQUAL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FLOOR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RANDOMUNIFORM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BATCHMATMUL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPACETODEPTH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHTOSPACE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RINT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATAN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATAN2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATANH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACOS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASIN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NEG; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOG; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TAN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ROUND; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *UPSAMPLE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FLOORMOD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LESS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LESSEQUAL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ONEHOT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFSWITCH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFMERGE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ENTER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFENTER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOOPCOND; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NEXTITERATION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFNEXTITERATION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EXIT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFEXIT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONTROLTRIGGER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ZEROSLIKE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EXP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *WHERE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FAKEQUANTWITHMINMAXVARS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SOFTPLUS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SOFTSIGN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *COSH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SINH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQUAREDDIFFERENCE; -// for retinanet scope fusion -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REQUIREDSPACETOBATCHPADDINGS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDPOSTPROCESSOR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETBOXES; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINAMULTIANCHORS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETCLIPPEDBOXES; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETFILTEREDDETECTIONS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETPOSTPROCESSOR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETANCHORS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNMAP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNMAP1; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNSECONDSTAGEPOSTPROCESSOR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNROIINTERPOOLING; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNFIRSTSTAGEPOSTPROCESSOR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNGRIDANCHORGENERATOR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ROIINTERPOOLING; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNCLIPTOWINDOW; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EMBEDLOOKUP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HASHLOOKUP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LSH_PROJ; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SVDF; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDANCHORGENERATOR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *IDENTITY; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *IDENTITYN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PLACEHOLDERWITHDEFAULT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SELECT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GETSPAN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STOPGRADIENT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PREVENTGRADIENT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GUARANTEECONST; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BROADCASTGRADIENTARGS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BROADCASTARGS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONFUSIONMATRIX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RANK; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PLACEHOLDER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *END; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BASICLSTMCELL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GETNEXT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *INITDATA; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFIDENTITY; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BITCAST; - -/***************Ann special operator*************************/ -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_MEAN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_CONVOLUTION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_DEPCONVOLUTION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_FULLCONNECTION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_NETOUTPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_DATA; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_RESHAPE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_ADD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_MUL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_SUB; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_DIV; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_DEQUANTIZE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_QUANTIZE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_PAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_RESIZE_BILINEAR; - -/***************************************************/ -/******************Training operator*************************/ -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GATHERV2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONVGRADFILTER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONV2D; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONV2DBACKPROPINPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FUSEDBATCHNORM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BIASADDGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACTIVATIONGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MAXPOOLWITHARGMAX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MAXPOOLGRADWITHARGMAX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPARSESOFTMAXCROSSENTROPYWITHLOGITS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SNAPSHOT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VAR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MEANGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSLATE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ADDN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *L2LOSS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MULTIPLY; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HUBERLOSSGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HUBERLOSS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NEGATIVE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDCAST; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPARSESOFTMAXCROSSENTROPY; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPARSESOFTMAXCROSSENTROPYGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDSQUEEZEFUSION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCATFOUR2FIVE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCATFIVE2FOUR; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDREALDIVTILEMUL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDSUMMULREALDIVMEAN; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARIABLEV2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARHANDLEOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TEMPORARYVARIABLE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DESTROYTEMPORARYVARIABLE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARIABLE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNVARIABLEOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNADD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNADDVARIABLEOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNSUB; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNSUBVARIABLEOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYMOMENTUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESOURCEAPPLYMOMENTUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SGD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NOOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *READVARIABLEOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PARALLELCONCATSTART; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONSTANTOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISECONV2DBACKPROPFILTER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISECONV2DBACKPORPINPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISECONV2DFORWARDNATIVE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DROPOUTGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYRMSPROPMIXEDPRECISION; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYRMSPROP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RELU6GRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *AVGPOOLGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCATV2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCATOFFSET; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LAYERNORMGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LAYERNORM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LARS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DYNAMICSTITCH; - -/***************************************************/ -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQUARE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMBROADCAST; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMALLGATHER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMALLREDUCE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMREDUCESCATTER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMSEND; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMRECEIVE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMREMOTEREAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMREMOTEREFREAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMREMOTEWRITE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMREMOTESCATTERWRITE; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARASSIGN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARISINITIALIZEDOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LogTimeStamp; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ISVARIABLEINITIALIZED; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STREAMSWITCH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STREAMSWITCHN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STREAMACTIVE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MEMCPYASYNC; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MEMCPYADDRASYNC; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STREAMMERGE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ENDGRAPH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SEND; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RECV; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ENDOFSEQUENCE; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELSET; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELGOTO; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELGOTOEX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELSWITCH; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELSWITCHBYINDEX; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATOMICADDRCLEAN; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ABS_GRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACCUMULATE_N_V2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACOS_GRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACOSH_GRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANY; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPROXIMATE_EQUAL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASIN_GRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASINH_GRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATAN_GRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BROADCAST_TO; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ELU_GRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ADD_V2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DATAFORMATDIMMAP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DATAFORMATVECPERMUTE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BESSELI0E; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BESSELI1E; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADADELTA; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADAGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADAGRADDA; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADAM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADAMAX; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADDSIGN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYCENTEREDRMSPROP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYFTRL; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYFTRLV2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYGRADIENTDESCENT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYPOWERSIGN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYPROXIMALADAGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYPROXIMALGRADIENTDESCENT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEQUANTIZE; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FOCAL_LOSS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FOCAL_LOSS_GRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SMOOTHL1_LOSS; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SMOOTHL1_LOSS_grad; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEMEAN; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCAT_V2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ONEHOT_V2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SLICE_V2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TILE_V2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SUM_V2; -// Common type when the operator has the same name -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DETECTIONOUTPUT; -// Custom operator -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CUSTOMOP; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CUSTOMOP_NCHW; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CUSTOMOP_NHWC; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CUSTOMOP_NC1HWC0; - -// Depthwise 4d_2_6d,6d_2_4d -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISEWEIGHT4D26D; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISEWEIGHT6D24D; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQRTGRAD; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SIGMOIDGRAD; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSSHAPE; - -// Horovod operator -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HVDCALLBACKALLREDUCE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HVDCALLBACKALLGATHER; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HVDCALLBACKBROADCAST; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HVDWAIT; - -/// -/// @brief Magic number of model file -/// -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t MODEL_FILE_MAGIC_NUM; // magic number - -/// -/// @brief Model head length -/// -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t MODEL_FILE_HEAD_LEN; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t MODEL_VERSION; ///< Model version 1.0/// - -// alpha default value -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const float ALPHA_DEFAULT_VALUE; - -// beta default value -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const float BETA_DEFAULT_VALUE; - -/// -/// @ingroup domi_omg -/// @brief INPUT node type -/// -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string INPUT_TYPE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DUMMY_DATA; - -// dim default size value -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY static const int32_t DIM_DEFAULT_SIZE = 4; - -// for fusion op plugin -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string ATTR_NAME_FUSIONOP_ORIGINAL_TYPE; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string ATTR_NAME_INPUT_TENSOR_DESC; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string ATTR_NAME_OUTPUT_TENSOR_DESC; - -// DATA node type -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DATA_TYPE; - -// framework Operator Type -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string FRAMEWORK_OP_TYPE; - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string NODE_NAME_NET_OUTPUT; - -#pragma pack() // Cancels single-byte alignment -} // namespace parser -} // namespace ge - -#endif // PARSER_COMMON_TYPES_H_ diff --git a/inc/metadef/inc/common/util/platform_info.h b/inc/metadef/inc/common/util/platform_info.h index af12fc853..81358649c 100644 --- a/inc/metadef/inc/common/util/platform_info.h +++ b/inc/metadef/inc/common/util/platform_info.h @@ -36,7 +36,8 @@ class PlatformInfoManager { PlatformInfo &platform_info, OptionalInfo &opti_compilation_info); - uint32_t GetPlatformInfoWithOutSocVersion(PlatformInfo &platform_info, OptionalInfo &opti_compilation_info); + uint32_t GetPlatformInfoWithOutSocVersion(PlatformInfo &platform_info, + OptionalInfo &opti_compilation_info); void SetOptionalCompilationInfo(OptionalInfo &opti_compilation_info); @@ -44,7 +45,8 @@ class PlatformInfoManager { PlatFormInfos &platform_info, OptionalInfos &opti_compilation_info); - uint32_t GetPlatformInfoWithOutSocVersion(PlatFormInfos &platform_info, OptionalInfos &opti_compilation_info); + uint32_t GetPlatformInfoWithOutSocVersion(PlatFormInfos &platform_info, + OptionalInfos &opti_compilation_info); void SetOptionalCompilationInfo(OptionalInfos &opti_compilation_info); @@ -112,51 +114,16 @@ class PlatformInfoManager { std::string &soc_version, PlatformInfo &platform_info_temp); - void ParseVersion(std::map &version_map, - std::string &soc_version, - PlatFormInfos &platform_info_temp); - - void ParseSocInfo(std::map &soc_info_map, PlatFormInfos &platform_info_temp); - - void ParseCubeOfAICoreSpec(std::map &ai_core_spec_map, - PlatFormInfos &platform_info_temp); - - void ParseBufferOfAICoreSpec(std::map &ai_core_spec_map, - PlatFormInfos &platform_info_temp); - - void ParseUBOfAICoreSpec(std::map &ai_core_spec_map, - PlatFormInfos &platform_info_temp); - - void ParseUnzipOfAICoreSpec(std::map &ai_core_spec_map, - PlatFormInfos &platform_info_temp); - - void ParseAICoreSpec(std::map &ai_core_spec_map, - PlatFormInfos &platform_info_temp); - - void ParseBufferOfAICoreMemoryRates(std::map &ai_core_memory_rates_map, - PlatFormInfos &platform_info_temp); - - void ParseAICoreMemoryRates(std::map &ai_core_memory_rates_map, - PlatFormInfos &platform_info_temp); - - void ParseUBOfAICoreMemoryRates(std::map &ai_core_memory_rates_map, - PlatFormInfos &platform_info_temp); - void ParseAICoreintrinsicDtypeMap(std::map &ai_coreintrinsic_dtype_map, PlatFormInfos &platform_info_temp); - void ParseVectorCoreSpec(std::map &vector_core_spec_map, - PlatFormInfos &platform_info_temp); - - void ParseVectorCoreMemoryRates(std::map &vector_core_memory_rates_map, - PlatFormInfos &platform_info_temp); - - void ParseCPUCache(std::map &CPUCacheMap, - PlatFormInfos &platform_info_temp); - void ParseVectorCoreintrinsicDtypeMap(std::map &vector_coreintrinsic_dtype_map, PlatFormInfos &platform_info_temp); + void ParsePlatformRes(const std::string &label, + std::map &platform_res_map, + PlatFormInfos &platform_info_temp); + uint32_t ParsePlatformInfo(std::map> &content_info_map, std::string &soc_version, PlatFormInfos &platform_info_temp); @@ -166,8 +133,11 @@ class PlatformInfoManager { private: bool init_flag_; std::map platform_info_map_; + OptionalInfo opti_compilation_info_; + std::map platform_infos_map_; + OptionalInfos opti_compilation_infos_; }; } // namespace fe diff --git a/inc/metadef/inc/common/util/platform_infos_def.h b/inc/metadef/inc/common/util/platform_infos_def.h index be72061c5..b0d5e5315 100644 --- a/inc/metadef/inc/common/util/platform_infos_def.h +++ b/inc/metadef/inc/common/util/platform_infos_def.h @@ -24,238 +24,18 @@ #include "platform_info_def.h" namespace fe { -class StrInfoImpl; -using StrInfoImplPtr = std::shared_ptr; -class StrInfos { - public: - bool Init(); - std::string GetAIcVersion(); - std::string GetCcecAIcVersion(); - std::string GetCcecAIvVersion(); - std::string IsSupportAICpuCompiler(); - - void SetAIcVersion(std::string &aic_version); - void SetCcecAIcVersion(std::string &ccec_aic_version); - void SetCcecAIvVersion(std::string &ccec_aiv_version); - void SetIsSupportAICpuCompiler(std::string &is_support_ai_cpu_compiler); - private: - StrInfoImplPtr str_info_impl_{nullptr}; -}; - -class SoCInfoImpl; -using SoCInfoImplPtr = std::shared_ptr; -class SoCInfos { - public: - bool Init(); - uint32_t GetAICoreCnt(); - uint32_t GetVectorCoreCnt(); - uint32_t GetAICpuCnt(); - MemoryType GetMemType(); - uint64_t GetMemSize(); - L2Type GetL2Type(); - uint64_t GetL2Size(); - uint32_t GetL2PageNum(); - - void SetAICoreCnt(uint32_t ai_core_cnt); - void SetVectorCoreCnt(uint32_t vector_core_cnt); - void SetAICpuCnt(uint32_t ai_cpu_cnt); - void SetMemType(MemoryType memory_type); - void SetMemSize(uint64_t memory_size); - void SetL2Type(L2Type l2_type); - void SetL2Size(uint64_t l2_size); - void SetL2PageNum(uint32_t l2_page_num); - private: - SoCInfoImplPtr soc_info_impl_{nullptr}; -}; - -class AICoreSpecImpl; -using AICoreSpecImplPtr = std::shared_ptr; -class AICoreSpecs { - public: - bool Init(); - double GetCubeFreq(); - uint64_t GetCubeMSize(); - uint64_t GetCubeNSize(); - uint64_t GetCubeKSize(); - uint64_t GetVecCalcSize(); - uint64_t GetL0aSize(); - uint64_t GetL0bSize(); - uint64_t GetL0cSize(); - uint64_t GetL1Size(); - uint64_t GetSmaskBuffer(); - uint64_t GetUBSize(); - uint64_t GetUBBlockSize(); - uint64_t GetUBBankSize(); - uint64_t GetUBBankNum(); - uint64_t GetUBBurstInOneBlock(); - uint64_t GetUBBankGroupNum(); - uint32_t GetUnzipEngines(); - uint32_t GetUnzipMaxRatios(); - uint32_t GetUnzipChannels(); - uint8_t GetUnzipIsTight(); - uint8_t GetCubeVectorSplit(); - - void SetCubeFreq(double cube_freq); - void SetCubeMSize(uint64_t cube_m_size); - void SetCubeNSize(uint64_t cube_n_size); - void SetCubeKSize(uint64_t cube_k_size); - void SetVecCalcSize(uint64_t vec_calc_size); - void SetL0aSize(uint64_t l0_a_size); - void SetL0bSize(uint64_t l0_b_size); - void SetL0cSize(uint64_t l0_c_size); - void SetL1Size(uint64_t l1_size); - void SetSmaskBuffer(uint64_t smask_buffer); - void SetUBSize(uint64_t ub_size); - void SetUBBlockSize(uint64_t ubblock_size); - void SetUBBankSize(uint64_t ubbank_size); - void SetUBBankNum(uint64_t ubbank_num); - void SetUBBurstInOneBlock(uint64_t ubburst_in_one_block); - void SetUBBankGroupNum(uint64_t ubbank_group_num); - void SetUnzipEngines(uint32_t unzip_engines); - void SetUnzipMaxRatios(uint32_t unzip_max_ratios); - void SetUnzipChannels(uint32_t unzip_channels); - void SetUnzipIsTight(uint8_t unzip_is_tight); - void SetCubeVectorSplit(uint8_t cube_vector_split); - private: - AICoreSpecImplPtr aicore_spec_impl_{nullptr}; -}; - -class AICoreMemRateImpl; -using AICoreMemRateImplPtr = std::shared_ptr; -class AICoreMemRates { - public: - bool Init(); - double GetDdrRate(); - double GetDdrReadRate(); - double GetDdrWriteRate(); - double GetL2Rate(); - double GetL2ReadRate(); - double GetL2WriteRate(); - double GetL1ToL0aRate(); - double GetL1ToL0bRate(); - double GetL1ToUBRate(); - double GetL0cToUBRate(); - double GetUBToL2Rate(); - double GetUBToDdrRate(); - double GetUBToL1Rate(); - - void SetDdrRate(double ddr_rate); - void SetDdrReadRate(double ddr_read_rate); - void SetDdrWriteRate(double ddr_write_rate); - void SetL2Rate(double l2_rate); - void SetL2ReadRate(double l2_read_rate); - void SetL2WriteRate(double l2_write_rate); - void SetL1ToL0aRate(double l1_to_l0_a_rate); - void SetL1ToL0bRate(double l1_to_l0_b_rate); - void SetL1ToUBRate(double l1_to_ub_rate); - void SetL0cToUBRate(double l0_c_to_ub_rate); - void SetUBToL2Rate(double ub_to_l2_rate); - void SetUBToDdrRate(double ub_to_ddr_rate); - void SetUBToL1Rate(double ub_to_l1_rate); - private: - AICoreMemRateImplPtr aicore_mem_rate_impl_{nullptr}; -}; - -class VectorCoreSpecImpl; -using VectorCoreSpecImplPtr = std::shared_ptr; -class VectorCoreSpecs { - public: - bool Init(); - double GetVecFreq(); - uint64_t GetVecCalcSize(); - uint64_t GetSmaskBuffer(); - uint64_t GetUBSize(); - uint64_t GetUBBlockSize(); - uint64_t GetUBBankSize(); - uint64_t GetUBBankNum(); - uint64_t GetUBBurstInOneBlock(); - uint64_t GetUBBankGroupNum(); - uint64_t GetVectorRegSize(); - uint64_t GetPredicateRegSize(); - uint64_t GetAddressRegSize(); - uint64_t GetAlignmentRegSize(); - - void SetVecFreq(double vec_freq); - void SetVecCalcSize(uint64_t vec_calc_size); - void SetSmaskBuffer(uint64_t smask_buffer); - void SetUBSize(uint64_t ub_size); - void SetUBBlockSize(uint64_t ubblock_size); - void SetUBBankSize(uint64_t ubbank_size); - void SetUBBankNum(uint64_t ubbank_num); - void SetUBBurstInOneBlock(uint64_t ubburst_in_one_block); - void SetUBBankGroupNum(uint64_t ubbank_group_num); - void SetVectorRegSize(uint64_t vector_reg_size); - void SetPredicateRegSize(uint64_t predicate_reg_size); - void SetAddressRegSize(uint64_t address_reg_size); - void SetAlignmentRegSize(uint64_t alignment_reg_size); - private: - VectorCoreSpecImplPtr vector_core_spec_impl_{nullptr}; -}; - -class VectorCoreMemRateImpl; -using VectorCoreMemRateImplPtr = std::shared_ptr; -class VectorCoreMemRates { - public: - bool Init(); - double GetDdrRate(); - double GetDdrReadRate(); - double GetDdrWriteRate(); - double GetL2Rate(); - double GetL2ReadRate(); - double GetL2WriteRate(); - double GetUBToL2Rate(); - double GetUBToDdrRate(); - - void SetDdrRate(double ddr_rate); - void SetDdrReadRate(double ddr_read_rate); - void SetDdrWriteRate(double ddr_write_rate); - void SetL2Rate(double l2_rate); - void SetL2ReadRate(double l2_read_rate); - void SetL2WriteRate(double l2_write_rate); - void SetUBToL2Rate(double ub_to_l2_rate); - void SetUBToDdrRate(double ub_to_ddr_rate); - private: - VectorCoreMemRateImplPtr vector_core_mem_rate_impl_{nullptr}; -}; - -class CPUCacheImpl; -using CPUCacheImplPtr = std::shared_ptr; -class CPUCaches { - public: - bool Init(); - uint32_t GetAICPUSyncBySW(); - uint32_t GetTSCPUSyncBySW(); - - void SetAICPUSyncBySW(uint32_t AICPUSyncBySW); - void SetTSCPUSyncBySW(uint32_t TSCPUSyncBySW); - private: - CPUCacheImplPtr cpu_cache_impl_{nullptr}; -}; - class PlatFormInfosImpl; using PlatFormInfosImplPtr = std::shared_ptr; class PlatFormInfos { public: bool Init(); - StrInfos GetStrInfo(); - SoCInfos GetSocInfo(); - AICoreSpecs GetAICoreSpec(); - AICoreMemRates GetAICoreMemRates(); std::map> GetAICoreIntrinsicDtype(); - VectorCoreSpecs GetVectorCoreSpec(); - VectorCoreMemRates GetVectorCoreMemRates(); - CPUCaches GetCPUCache(); std::map> GetVectorCoreIntrinsicDtype(); + bool GetPlatformRes(const std::string &label, const std::string &key, std::string &val); - void SetStrInfo(StrInfos &str_infos); - void SetSocInfo(SoCInfos &SoC_infos); - void SetAICoreSpec(AICoreSpecs &AICore_specs); - void SetAICoreMemRates(AICoreMemRates &AICore_mem_rates); void SetAICoreIntrinsicDtype(std::map> &intrinsic_dtypes); - void SetVectorCoreSpec(VectorCoreSpecs &vector_core_specs); - void SetVectorCoreMemRates(VectorCoreMemRates &vectorcore_mem_rates); - void SetCPUCache(CPUCaches &CPU_caches); void SetVectorCoreIntrinsicDtype(std::map> &intrinsic_dtypes); + void SetPlatformRes(const std::string &label, std::map &res); private: PlatFormInfosImplPtr platform_infos_impl_{nullptr}; diff --git a/inc/metadef/inc/external/graph/graph.h b/inc/metadef/inc/external/graph/graph.h index 651e0cf97..0bf1e8d42 100644 --- a/inc/metadef/inc/external/graph/graph.h +++ b/inc/metadef/inc/external/graph/graph.h @@ -115,6 +115,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Graph { graphStatus AddControlEdge(GNode &src_node, GNode &dst_node); + graphStatus CopyFrom(const Graph &src_graph); + static GraphPtr ConstructFromInputs(const std::vector &inputs, const AscendString &name); private: diff --git a/inc/metadef/inc/external/graph/operator.h b/inc/metadef/inc/external/graph/operator.h index 81c55757e..5dc04137d 100644 --- a/inc/metadef/inc/external/graph/operator.h +++ b/inc/metadef/inc/external/graph/operator.h @@ -69,6 +69,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Operator { friend class OperatorImpl; friend class GraphBuilderImpl; friend class NodeUtils; + friend class OpDescUtils; + friend class GraphUtils; using OpInt = int64_t; using OpFloat = float; diff --git a/inc/metadef/inc/external/graph/types.h b/inc/metadef/inc/external/graph/types.h index 28c83fdab..f70ab7f6c 100644 --- a/inc/metadef/inc/external/graph/types.h +++ b/inc/metadef/inc/external/graph/types.h @@ -111,17 +111,17 @@ enum Format { FORMAT_ND, // Nd Tensor FORMAT_NC1HWC0, // NC1HWC0 FORMAT_FRACTAL_Z, // FRACTAL_Z - FORMAT_NC1C0HWPAD, + FORMAT_NC1C0HWPAD = 5, FORMAT_NHWC1C0, FORMAT_FSR_NCHW, FORMAT_FRACTAL_DECONV, FORMAT_C1HWNC0, - FORMAT_FRACTAL_DECONV_TRANSPOSE, + FORMAT_FRACTAL_DECONV_TRANSPOSE = 10, FORMAT_FRACTAL_DECONV_SP_STRIDE_TRANS, FORMAT_NC1HWC0_C04, // NC1HWC0, C0 is 4 FORMAT_FRACTAL_Z_C04, // FRACZ, C0 is 4 FORMAT_CHWN, - FORMAT_FRACTAL_DECONV_SP_STRIDE8_TRANS, + FORMAT_FRACTAL_DECONV_SP_STRIDE8_TRANS = 15, FORMAT_HWCN, FORMAT_NC1KHKWHWC0, // KH,KW kernel h& kernel w maxpooling max output format FORMAT_BN_WEIGHT, @@ -130,27 +130,30 @@ enum Format { FORMAT_HASHTABLE_LOOKUP_KEYS, FORMAT_HASHTABLE_LOOKUP_VALUE, FORMAT_HASHTABLE_LOOKUP_OUTPUT, - FORMAT_HASHTABLE_LOOKUP_HITS = 24, - FORMAT_C1HWNCoC0, + FORMAT_HASHTABLE_LOOKUP_HITS, + FORMAT_C1HWNCoC0 = 25, FORMAT_MD, FORMAT_NDHWC, FORMAT_FRACTAL_ZZ, FORMAT_FRACTAL_NZ, - FORMAT_NCDHW, + FORMAT_NCDHW = 30, FORMAT_DHWCN, // 3D filter input tensor format FORMAT_NDC1HWC0, FORMAT_FRACTAL_Z_3D, FORMAT_CN, - FORMAT_NC, + FORMAT_NC = 35, FORMAT_DHWNC, FORMAT_FRACTAL_Z_3D_TRANSPOSE, // 3D filter(transpose) input tensor format FORMAT_FRACTAL_ZN_LSTM, FORMAT_FRACTAL_Z_G, - FORMAT_RESERVED, + FORMAT_RESERVED = 40, FORMAT_ALL, - FORMAT_NULL + FORMAT_NULL, + // Add new formats definition here + FORMAT_END }; + // for unknown shape op type enum UnknowShapeOpType { DEPEND_IN_SHAPE = 1, // op out shape get by input shape @@ -169,6 +172,14 @@ enum DeviceType { CPU = 1, }; +/** + * Get a format name from enum + * @param format + * @return + */ +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY +const char *GetFormatName(Format format); + class TensorTypeImpl; struct TensorType { explicit TensorType(DataType dt); diff --git a/inc/metadef/inc/external/register/scope/scope_fusion_pass_register.h b/inc/metadef/inc/external/register/scope/scope_fusion_pass_register.h index 9df4dd84f..5602ff1d2 100644 --- a/inc/metadef/inc/external/register/scope/scope_fusion_pass_register.h +++ b/inc/metadef/inc/external/register/scope/scope_fusion_pass_register.h @@ -355,10 +355,7 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeFusionPassRegistry { using CreateFn = ScopeBasePass *(*)(); ~ScopeFusionPassRegistry(); - static ScopeFusionPassRegistry &GetInstance() { - static ScopeFusionPassRegistry instance; - return instance; - } + static ScopeFusionPassRegistry& GetInstance(); ATTRIBUTED_DEPRECATED(void RegisterScopeFusionPass(const char *, CreateFn, bool)) void RegisterScopeFusionPass(const std::string &pass_name, CreateFn create_fn, bool is_general); diff --git a/inc/metadef/inc/graph/compute_graph.h b/inc/metadef/inc/graph/compute_graph.h index 9e705a063..07debd552 100644 --- a/inc/metadef/inc/graph/compute_graph.h +++ b/inc/metadef/inc/graph/compute_graph.h @@ -131,6 +131,7 @@ class ComputeGraph : public std::enable_shared_from_this, public A graphStatus InferOriginFormat(); graphStatus InferShapeInNeed(); graphStatus InsertEventNodes(); + graphStatus InsertGraphEvents(); bool operator==(const ComputeGraph &r_compute_graph) const; /*lint +e504*/ @@ -252,6 +253,12 @@ class ComputeGraph : public std::enable_shared_from_this, public A void SetNodesOwner(); + /** + * Move Send Event nodes after it`s control node + * Move Recv Event nodes before it`s control node + */ + graphStatus ReorderEventNodes(); + /** * To improve preformace of list.size(), we should keep counter on nodes_.size() * Use follow function to add/erase node from nodes_ diff --git a/inc/metadef/inc/graph/debug/ge_attr_define.h b/inc/metadef/inc/graph/debug/ge_attr_define.h index 03cf21e33..e15e0ee4d 100644 --- a/inc/metadef/inc/graph/debug/ge_attr_define.h +++ b/inc/metadef/inc/graph/debug/ge_attr_define.h @@ -1114,6 +1114,9 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_HOR GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_HCCL_FUSED_GROUP; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_HCCL_FUSED_FLAG; +// for parallel group +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_PARALLEL_GROUP; + // dynamic shape attrs GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_DYNAMIC_SHAPE_FIXED_ADDR; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_DYNAMIC_SHAPE_FIXED_ADDR_INDEX; @@ -1146,6 +1149,9 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_STA GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_ZERO_COPY_BASIC_OFFSET; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_ZERO_COPY_RELATIVE_OFFSET; +// mark node cannot be deleted +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_CANNOT_BE_DELETED; + // The processing mode of INF and NAN during floating-point number calculation. GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_FP_CEILING_MODE; // count of data from getnext_sink @@ -1168,6 +1174,16 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAM GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_INSERT_PROFILILNG_TASK_LOG_ID; // padding dimmension type GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_RESHAPE_INFER_TYPE; + +// mark single op scene +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_SINGLE_OP_SCENE; + +//for fe judge whether trans/cast op is inserted +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_FORMAT_CONTINUOUS; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_REFRESH_CONTINUOUS_FLAG; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_FORMAT_AGNOSTIC; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_FORMAT_AGNOSTIC_EXCEPT_OUTPUT; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_FORMAT_AGNOSTIC_EXCEPT_INPUT; } // namespace ge /*lint +e618*/ diff --git a/inc/metadef/inc/graph/detail/attributes_holder.h b/inc/metadef/inc/graph/detail/attributes_holder.h index 0273ce993..49d75e6b2 100644 --- a/inc/metadef/inc/graph/detail/attributes_holder.h +++ b/inc/metadef/inc/graph/detail/attributes_holder.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -146,7 +147,7 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY AttrHolder { protected: graphStatus AddRequiredAttr(const std::string &name); - const std::unordered_set GetAllAttrNames() const; + const std::set GetAllAttrNames() const; const std::map GetAllAttrs() const; // lint !e1073 virtual ProtoAttrMapHelper MutableAttrMap() = 0; diff --git a/inc/metadef/inc/graph/op_desc.h b/inc/metadef/inc/graph/op_desc.h index a86adf439..4dddb1a56 100644 --- a/inc/metadef/inc/graph/op_desc.h +++ b/inc/metadef/inc/graph/op_desc.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "detail/attributes_holder.h" @@ -320,7 +321,7 @@ class OpDesc : public std::enable_shared_from_this, public AttrHolder { vector inputs_desc_{}; map input_name_idx_{}; vector register_input_name_{}; - std::unordered_set optional_input_names_{}; + std::set optional_input_names_{}; vector outputs_desc_{}; map output_name_idx_{}; vector register_output_name_{}; diff --git a/inc/metadef/inc/graph/tuning_utils.h b/inc/metadef/inc/graph/tuning_utils.h index fe07dde18..f19a9c3c4 100644 --- a/inc/metadef/inc/graph/tuning_utils.h +++ b/inc/metadef/inc/graph/tuning_utils.h @@ -67,7 +67,7 @@ const std::set build_step_options = { using SubgraphCreateOutNode = std::unordered_map; using NodetoNodeMap = std::unordered_map; using NodeVec = std::vector; -using NodeNametoNodeNameMap = std::unordered_map; +using NodeNametoNodeNameMap = std::map; using NodetoNodeNameMap = std::unordered_map; class TuningUtils { public: diff --git a/inc/metadef/inc/graph/utils/graph_utils.h b/inc/metadef/inc/graph/utils/graph_utils.h index 18c9d934e..7711c93f8 100644 --- a/inc/metadef/inc/graph/utils/graph_utils.h +++ b/inc/metadef/inc/graph/utils/graph_utils.h @@ -183,6 +183,22 @@ class GraphUtils { static graphStatus InsertTransNode(ComputeGraphPtr compute_graph, const InDataAnchorPtr &in_data_anchor, const std::vector &vec_op_desc); + static graphStatus CopyGraph(const Graph &src_graph, Graph &dst_graph); + + static graphStatus CopyComputeGraph(const ComputeGraphPtr &src_compute_graph, + ComputeGraphPtr &dst_compute_graph, + std::map &node_old_2_new, + std::map &op_desc_old_2_new, + int32_t &depth); + + static graphStatus CopyMembers(const ComputeGraphPtr &src_compute_graph, + ComputeGraphPtr &dst_compute_graph, + const std::unordered_map &all_new_nodes); + + static graphStatus CopyGraphImpl(const Graph &src_graph, Graph &dst_graph, + const std::map &node_old_2_new, + const std::map &op_desc_old_2_new); + /// /// @brief Insert node: src->insert_node:input_index, insert_node:output_index->dst /// @param [in] src diff --git a/inc/metadef/inc/graph/utils/node_utils.h b/inc/metadef/inc/graph/utils/node_utils.h index 77555629a..418f45e8c 100644 --- a/inc/metadef/inc/graph/utils/node_utils.h +++ b/inc/metadef/inc/graph/utils/node_utils.h @@ -86,7 +86,7 @@ class NodeUtils { static std::vector GetAllSubgraphs(const Node &node); static ComputeGraphPtr GetSubgraph(const Node &node, uint32_t index); static graphStatus SetSubgraph(Node &node, uint32_t index, const ComputeGraphPtr &subgraph); - + static NodePtr CreatNodeWithoutGraph(const OpDescPtr op_desc); /// /// Check if node is input of subgraph /// @param [in] node diff --git a/inc/metadef/inc/graph/utils/op_desc_utils.h b/inc/metadef/inc/graph/utils/op_desc_utils.h index 4589180d7..0158ddd74 100644 --- a/inc/metadef/inc/graph/utils/op_desc_utils.h +++ b/inc/metadef/inc/graph/utils/op_desc_utils.h @@ -79,7 +79,13 @@ class OpDescUtils { static Operator CreateOperatorFromOpDesc(OpDescPtr op_desc); static Operator CreateOperatorFromNode(ge::ConstNodePtr node_ptr); static OpDescPtr GetOpDescFromOperator(const Operator& oprt); - + static graphStatus CopyOperatorLinks(const std::map &src_op_list, + std::map &dst_op_list); + static graphStatus CopyOperators(ComputeGraphPtr &dst_compute_graph, + const std::map &node_old_2_new, + const std::map &op_desc_old_2_new, + const std::map &src_op_list, + std::map &dst_op_list); static OpDescPtr CreateConstOp(const GeTensorPtr& tensor_ptr); static graphStatus SetSubgraphInstanceName(const std::string &subgraph_name, diff --git a/inc/metadef/inc/graph/utils/type_utils.h b/inc/metadef/inc/graph/utils/type_utils.h index 813827648..c8a1051c4 100644 --- a/inc/metadef/inc/graph/utils/type_utils.h +++ b/inc/metadef/inc/graph/utils/type_utils.h @@ -18,6 +18,7 @@ #define INC_GRAPH_UTILS_TYPE_UTILS_H_ #include +#include #include #include #include "graph/def_types.h" diff --git a/inc/metadef/inc/register/op_kernel_registry.h b/inc/metadef/inc/register/op_kernel_registry.h index 5fed8960e..35fcc8573 100644 --- a/inc/metadef/inc/register/op_kernel_registry.h +++ b/inc/metadef/inc/register/op_kernel_registry.h @@ -27,10 +27,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpKernelRegistry { using CreateFn = HostCpuOp* (*)(); ~OpKernelRegistry(); - static OpKernelRegistry& GetInstance() { - static OpKernelRegistry instance; - return instance; - } + static OpKernelRegistry& GetInstance(); bool IsRegistered(const std::string &op_type); diff --git a/inc/metadef/inc/register/op_registry.h b/inc/metadef/inc/register/op_registry.h index 318eb3ba7..f7e37390c 100644 --- a/inc/metadef/inc/register/op_registry.h +++ b/inc/metadef/inc/register/op_registry.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "register/register.h" @@ -88,7 +89,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistry { std::unordered_map fusion_parse_params_by_op_fn_map_; std::unordered_map op_types_to_parse_subgraph_post_func_; std::unordered_map> remove_input_configure_map_; - std::unordered_map origin_type_to_om_type_; + std::map origin_type_to_om_type_; std::unordered_map parse_op_to_graph_fn_map_; std::unordered_map op_types_to_parse_subgraph_post_func_v2_; }; diff --git a/inc/metadef/inc/register/scope/scope_graph_impl.h b/inc/metadef/inc/register/scope/scope_graph_impl.h index ffc176e0c..f2bb48ff2 100644 --- a/inc/metadef/inc/register/scope/scope_graph_impl.h +++ b/inc/metadef/inc/register/scope/scope_graph_impl.h @@ -42,6 +42,7 @@ class Scope::ScopeImpl { void AddNode(ge::OperatorPtr &node_def); const std::vector &Nodes() const { return nodes_; } const std::unordered_map &AllNodesMap(); + const std::map &AllNodesMapNew(); void AddSubScope(Scope *scope) { sub_scopes_[scope->Name()] = scope; } Scope *GetSubScope(const std::string &scope_name) const; const std::unordered_map &GetSubScopes() const { return sub_scopes_; } @@ -57,10 +58,11 @@ class Scope::ScopeImpl { std::string name_; std::string sub_type_; Scope *father_scope_; - std::unordered_map op_nums_; + std::map op_nums_; std::unordered_map sub_scopes_; std::vector nodes_; std::unordered_map all_nodes_map_; + std::map all_nodes_map_new_; std::vector all_sub_scopes_; }; @@ -112,8 +114,8 @@ class FusionScopesResult::FusionScopesResultImpl { const std::vector &Nodes() const { return nodes_; } void AddScopes(const std::vector &scopes) { scopes_.insert(scopes_.end(), scopes.begin(), scopes.end()); } const std::vector &Scopes() const { return scopes_; } - const std::unordered_map> &GetInputs() const { return inputs_; } - const std::unordered_map> &GetOutputs() const { return outputs_; } + const std::map> &GetInputs() const { return inputs_; } + const std::map> &GetOutputs() const { return outputs_; } void InsertInputs(const std::string &inner_op_name, const std::vector &index_map); void InsertOutputs(const std::string &inner_op_name, const std::vector &index_map); bool FindNodes(const std::string &node_name) const; @@ -131,8 +133,8 @@ class FusionScopesResult::FusionScopesResultImpl { std::string description_; std::vector scopes_; std::vector nodes_; - std::unordered_map> inputs_; - std::unordered_map> outputs_; + std::map> inputs_; + std::map> outputs_; std::vector inner_node_infos_; }; @@ -177,6 +179,7 @@ class ScopeGraph::ScopeGraphImpl { FusionScopesResult *GetFusionScopesResults(const domi::tensorflow::NodeDef *node_def) const; FusionScopesResult *GetFusionScopesResults(const string &node_name) const; const std::unordered_map &GetNodesMap() const { return nodes_map_; } + const std::map &GetNodesMapNew() const { return nodes_map_new_; } bool IsFusionOpChild(const std::string &node_name, std::vector &info_list); bool FusionOpChildIgnore(const ScopeFusionOpInfo &info); bool IsFusionOp(const domi::tensorflow::NodeDef *node_def); @@ -188,7 +191,8 @@ class ScopeGraph::ScopeGraphImpl { void CheckScopesResult(FusionScopesResult *fusion_node); std::unordered_map fusion_results_; std::unordered_map nodes_map_; + std::map nodes_map_new_; ScopeTree *scope_tree_; }; } // namespace ge -#endif // REGISTER_SCOPE_SCOPE_GRAPH_IMPL_H_ \ No newline at end of file +#endif // REGISTER_SCOPE_SCOPE_GRAPH_IMPL_H_ diff --git a/inc/mmpa/sub_inc/mmpa_linux.h b/inc/mmpa/sub_inc/mmpa_linux.h index ad48f70b6..993f36ba9 100644 --- a/inc/mmpa/sub_inc/mmpa_linux.h +++ b/inc/mmpa/sub_inc/mmpa_linux.h @@ -50,7 +50,7 @@ typedef int (*mmFilter)(const mmDirent *entry); typedef int (*mmFilter2)(const mmDirent2 *entry); typedef int (*mmSort)(const mmDirent **a, const mmDirent **b); typedef int (*mmSort2)(const mmDirent2 **a, const mmDirent2 **b); -typedef size_t mmSize_t; +typedef size_t mmSize_t; //lint !e410 !e1051 typedef off_t mmOfft_t; typedef pid_t mmPid_t; typedef long MM_LONG; @@ -279,8 +279,10 @@ typedef struct { #define M_NAME_MAX MAX_FNAME #define M_F_OK F_OK -#define M_R_OK R_OK +#define M_X_OK X_OK #define M_W_OK W_OK +#define M_R_OK R_OK + #define MM_DT_DIR DT_DIR #define MM_DT_REG DT_REG diff --git a/inc/mmpa/sub_inc/mmpa_win.h b/inc/mmpa/sub_inc/mmpa_win.h index cecdd4a7d..49e97a5d8 100644 --- a/inc/mmpa/sub_inc/mmpa_win.h +++ b/inc/mmpa/sub_inc/mmpa_win.h @@ -322,6 +322,7 @@ typedef VOID (*mmPf)(VOID); #define M_NAME_MAX _MAX_FNAME #define M_F_OK 0 +#define M_X_OK 1 #define M_W_OK 2 #define M_R_OK 4 diff --git a/inc/runtime/base.h b/inc/runtime/base.h index 07c8425d6..5b246eedd 100644 --- a/inc/runtime/base.h +++ b/inc/runtime/base.h @@ -41,12 +41,12 @@ static const int32_t RT_ERROR_NONE = 0; // success * @brief runtime exception numbers. */ typedef enum tagRtExceptionType { - RT_EXCEPTION_NONE = 0, - RT_EXCEPTION_TS_DOWN = 1, - RT_EXCEPTION_TASK_TIMEOUT = 2, - RT_EXCEPTION_TASK_FAILURE = 3, - RT_EXCEPTION_DEV_RUNNING_DOWN = 4, - RT_EXCEPTION_STREAM_ID_FREE_FAILED = 5 + RT_EXCEPTION_NONE = 0, + RT_EXCEPTION_TS_DOWN = 1, + RT_EXCEPTION_TASK_TIMEOUT = 2, + RT_EXCEPTION_TASK_FAILURE = 3, + RT_EXCEPTION_DEV_RUNNING_DOWN = 4, + RT_EXCEPTION_STREAM_ID_FREE_FAILED = 5 } rtExceptionType; /** @@ -54,12 +54,12 @@ typedef enum tagRtExceptionType { * @brief Switch type. */ typedef enum tagRtCondition { - RT_EQUAL = 0, - RT_NOT_EQUAL, - RT_GREATER, - RT_GREATER_OR_EQUAL, - RT_LESS, - RT_LESS_OR_EQUAL + RT_EQUAL = 0, + RT_NOT_EQUAL, + RT_GREATER, + RT_GREATER_OR_EQUAL, + RT_LESS, + RT_LESS_OR_EQUAL } rtCondition_t; /** @@ -67,17 +67,17 @@ typedef enum tagRtCondition { * @brief Data Type of Extensible Switch Task. */ typedef enum tagRtSwitchDataType { - RT_SWITCH_INT32 = 0, - RT_SWITCH_INT64 = 1, + RT_SWITCH_INT32 = 0, + RT_SWITCH_INT64 = 1, } rtSwitchDataType_t; typedef enum tagRtStreamFlagType { - RT_HEAD_STREAM = 0, // first stream - RT_INVALID_FLAG = 0xFFFFFFFF, + RT_HEAD_STREAM = 0, // first stream + RT_INVALID_FLAG = 0xFFFFFFFF, } rtStreamFlagType_t; typedef enum tagRtLimitType { - RT_LIMIT_TYPE_LOW_POWER_TIMEOUT = 0, // timeout for power down , ms + RT_LIMIT_TYPE_LOW_POWER_TIMEOUT = 0, // timeout for power down , ms } rtLimitType_t; typedef struct rtExceptionInfo { @@ -85,6 +85,7 @@ typedef struct rtExceptionInfo { uint32_t streamid; uint32_t tid; uint32_t deviceid; + uint32_t retcode; } rtExceptionInfo; typedef void (*rtErrorCallback)(rtExceptionType); @@ -111,6 +112,10 @@ typedef void *rtEvent_t; */ typedef void *rtLabel_t; +/** + * @ingroup dvrt_base + * @brief model handle. + */ typedef void *rtModel_t; /** @@ -135,13 +140,13 @@ RTS_API rtError_t rtProfilerConfig(uint16_t type); * @ingroup profiling_base * @brief start rts profiler. */ -RTS_API rtError_t rtProfilerStart(uint64_t profConfig, int32_t numsDev, uint32_t* deviceList); +RTS_API rtError_t rtProfilerStart(uint64_t profConfig, int32_t numsDev, uint32_t *deviceList); /** * @ingroup profiling_base * @brief stop rts profiler. */ -RTS_API rtError_t rtProfilerStop(uint64_t profConfig, int32_t numsDev, uint32_t* deviceList); +RTS_API rtError_t rtProfilerStop(uint64_t profConfig, int32_t numsDev, uint32_t *deviceList); /** * @ingroup profiling_base @@ -218,6 +223,14 @@ typedef void *rtNotify_t; */ RTS_API rtError_t rtLabelCreate(rtLabel_t *label); +/** + * @ingroup dvrt_base + * @brief create label instance + * @param [out] label created label + * @param [in] model label set model + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ RTS_API rtError_t rtLabelCreateV2(rtLabel_t *label, rtModel_t model); /** @@ -295,8 +308,6 @@ RTS_API rtError_t rtLabelSwitchByIndex(void *ptr, uint32_t max, void *labelInfoP */ RTS_API rtError_t rtLabelGotoEx(rtLabel_t label, rtStream_t stream); -rtError_t rtLabelCreateExV2(rtLabel_t *label, rtModel_t model, rtStream_t stream); - /** * @ingroup dvrt_base * @brief labels to dev info @@ -319,6 +330,17 @@ RTS_API rtError_t rtLabelListCpy(rtLabel_t *label, uint32_t labelNumber, void *d */ RTS_API rtError_t rtLabelCreateEx(rtLabel_t *label, rtStream_t stream); +/** + * @ingroup dvrt_base + * @brief labels to dev info + * @param [out] label created label handle + * @param [in] model label bind model + * @param [in] stream label bind stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +rtError_t rtLabelCreateExV2(rtLabel_t *label, rtModel_t model, rtStream_t stream); + /** * @ingroup dvrt_base * @brief get current thread last stream id and task id diff --git a/inc/runtime/config.h b/inc/runtime/config.h index f003671e4..ee1046931 100644 --- a/inc/runtime/config.h +++ b/inc/runtime/config.h @@ -24,105 +24,107 @@ extern "C" { #endif #define PLAT_COMBINE(arch, chip, ver) ((arch << 16) | (chip << 8) | (ver)) -#define PLAT_GET_ARCH(type) ((type >> 16) & 0xffff) -#define PLAT_GET_CHIP(type) ((type >> 8) & 0xff) -#define PLAT_GET_VER(type) (type & 0xff) +#define PLAT_GET_ARCH(type) ((type >> 16) & 0xffff) +#define PLAT_GET_CHIP(type) ((type >> 8) & 0xff) +#define PLAT_GET_VER(type) (type & 0xff) typedef enum tagRtArchType { - ARCH_BEGIN = 0, - ARCH_V100 = ARCH_BEGIN, - ARCH_V200, - ARCH_END, + ARCH_BEGIN = 0, + ARCH_V100 = ARCH_BEGIN, + ARCH_V200, + ARCH_END, } rtArchType_t; typedef enum tagRtChipType { - CHIP_BEGIN = 0, - CHIP_MINI = CHIP_BEGIN, - CHIP_CLOUD, - CHIP_MDC, - CHIP_LHISI, - CHIP_DC, - CHIP_CLOUD_V2, - CHIP_END, + CHIP_BEGIN = 0, + CHIP_MINI = CHIP_BEGIN, + CHIP_CLOUD, + CHIP_MDC, + CHIP_LHISI, + CHIP_DC, + CHIP_CLOUD_V2, + CHIP_END, } rtChipType_t; typedef enum tagRtVersion { - VER_BEGIN = 0, - VER_NA = VER_BEGIN, - VER_ES, - VER_CS, - VER_SD3403, - VER_END, + VER_BEGIN = 0, + VER_NA = VER_BEGIN, + VER_ES, + VER_CS, + VER_SD3403, + VER_END, } rtVersion_t; /* match rtChipType_t */ typedef enum tagRtPlatformType { - PLATFORM_BEGIN = 0, - PLATFORM_MINI_V1 = PLATFORM_BEGIN, - PLATFORM_CLOUD_V1, - PLATFORM_MINI_V2, - PLATFORM_LHISI_ES, - PLATFORM_LHISI_CS, - PLATFORM_DC, - PLATFORM_CLOUD_V2, - PLATFORM_END, + PLATFORM_BEGIN = 0, + PLATFORM_MINI_V1 = PLATFORM_BEGIN, + PLATFORM_CLOUD_V1, + PLATFORM_MINI_V2, + PLATFORM_LHISI_ES, + PLATFORM_LHISI_CS, + PLATFORM_DC, + PLATFORM_CLOUD_V2, + PLATFORM_END, } rtPlatformType_t; typedef enum tagRtCubeFracMKNFp16 { - RT_CUBE_MKN_FP16_2_16_16 = 0, - RT_CUBE_MKN_FP16_4_16_16, - RT_CUBE_MKN_FP16_16_16_16, - RT_CUBE_MKN_FP16_Default, + RT_CUBE_MKN_FP16_2_16_16 = 0, + RT_CUBE_MKN_FP16_4_16_16, + RT_CUBE_MKN_FP16_16_16_16, + RT_CUBE_MKN_FP16_Default, } rtCubeFracMKNFp16_t; typedef enum tagRtCubeFracMKNInt8 { - RT_CUBE_MKN_INT8_2_32_16 = 0, - RT_CUBE_MKN_INT8_4_32_4, - RT_CUBE_MKN_INT8_4_32_16, - RT_CUBE_MKN_INT8_16_32_16, - RT_CUBE_MKN_INT8_Default, + RT_CUBE_MKN_INT8_2_32_16 = 0, + RT_CUBE_MKN_INT8_4_32_4, + RT_CUBE_MKN_INT8_4_32_16, + RT_CUBE_MKN_INT8_16_32_16, + RT_CUBE_MKN_INT8_Default, } rtCubeFracMKNInt8_t; typedef enum tagRtVecFracVmulMKNFp16 { - RT_VEC_VMUL_MKN_FP16_1_16_16 = 0, - RT_VEC_VMUL_MKN_FP16_Default, + RT_VEC_VMUL_MKN_FP16_1_16_16 = 0, + RT_VEC_VMUL_MKN_FP16_Default, } rtVecFracVmulMKNFp16_t; typedef enum tagRtVecFracVmulMKNInt8 { - RT_VEC_VMUL_MKN_INT8_1_32_16 = 0, - RT_VEC_VMUL_MKN_INT8_Default, + RT_VEC_VMUL_MKN_INT8_1_32_16 = 0, + RT_VEC_VMUL_MKN_INT8_Default, } rtVecFracVmulMKNInt8_t; typedef struct tagRtAiCoreSpec { - uint32_t cubeFreq; - uint32_t cubeMSize; - uint32_t cubeKSize; - uint32_t cubeNSize; - rtCubeFracMKNFp16_t cubeFracMKNFp16; - rtCubeFracMKNInt8_t cubeFracMKNInt8; - rtVecFracVmulMKNFp16_t vecFracVmulMKNFp16; - rtVecFracVmulMKNInt8_t vecFracVmulMKNInt8; + uint32_t cubeFreq; + uint32_t cubeMSize; + uint32_t cubeKSize; + uint32_t cubeNSize; + rtCubeFracMKNFp16_t cubeFracMKNFp16; + rtCubeFracMKNInt8_t cubeFracMKNInt8; + rtVecFracVmulMKNFp16_t vecFracVmulMKNFp16; + rtVecFracVmulMKNInt8_t vecFracVmulMKNInt8; } rtAiCoreSpec_t; typedef struct tagRtAiCoreRatesPara { - uint32_t ddrRate; - uint32_t l2Rate; - uint32_t l2ReadRate; - uint32_t l2WriteRate; - uint32_t l1ToL0ARate; - uint32_t l1ToL0BRate; - uint32_t l0CToUBRate; - uint32_t ubToL2; - uint32_t ubToDDR; - uint32_t ubToL1; + uint32_t ddrRate; + uint32_t l2Rate; + uint32_t l2ReadRate; + uint32_t l2WriteRate; + uint32_t l1ToL0ARate; + uint32_t l1ToL0BRate; + uint32_t l0CToUBRate; + uint32_t ubToL2; + uint32_t ubToDDR; + uint32_t ubToL1; } rtAiCoreMemoryRates_t; typedef struct tagRtMemoryConfig { - uint32_t flowtableSize; - uint32_t compilerSize; + uint32_t flowtableSize; + uint32_t compilerSize; } rtMemoryConfig_t; -typedef struct tagRtPlatformConfig { uint32_t platformConfig; } rtPlatformConfig_t; +typedef struct tagRtPlatformConfig { + uint32_t platformConfig; +} rtPlatformConfig_t; /** * @ingroup @@ -164,7 +166,6 @@ RTS_API rtError_t rtGetAiCoreMemoryRates(rtAiCoreMemoryRates_t *aiCoreMemoryRate */ RTS_API rtError_t rtGetMemoryConfig(rtMemoryConfig_t *memoryConfig); - /** * @ingroup * @brief get l2 buffer Info,virtual baseaddr,Size @@ -175,14 +176,16 @@ RTS_API rtError_t rtMemGetL2Info(rtStream_t stream, void **ptr, uint32_t *size); /** * @ingroup - * @brief get runtime version. The version is returned as (1000 major + 10 minor). For example, RUNTIME 9.2 would be represented by 9020. + * @brief get runtime version. The version is returned as (1000 major + 10 minor). For example, RUNTIME 9.2 would be + * represented by 9020. * @param [out] runtimeVersion * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtGetRuntimeVersion(uint32_t *runtimeVersion); + #if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) } #endif -#endif // __CCE_RUNTIME_STREAM_H__ +#endif // __CCE_RUNTIME_STREAM_H__ diff --git a/inc/runtime/context.h b/inc/runtime/context.h index 4be49a8ca..e95d4c894 100644 --- a/inc/runtime/context.h +++ b/inc/runtime/context.h @@ -30,24 +30,24 @@ extern "C" { typedef void *rtContext_t; typedef enum tagDryRunFlag { - RT_DRYRUN_FLAG_FALSE = 0, - RT_DRYRUN_FLAG_TRUE = 1, + RT_DRYRUN_FLAG_FALSE = 0, + RT_DRYRUN_FLAG_TRUE = 1, } rtDryRunFlag_t; typedef enum tagCtxMode { - RT_CTX_NORMAL_MODE = 0, - RT_CTX_GEN_MODE = 1, + RT_CTX_NORMAL_MODE = 0, + RT_CTX_GEN_MODE = 1, } rtCtxMode_t; typedef struct tagRtGroupInfo { - int32_t groupId; - uint32_t flag; - uint32_t aicoreNum; - uint32_t aicpuNum; - uint32_t aivectorNum; - uint32_t sdmaNum; - uint32_t activeStreamNum; - void* extrPtr; + int32_t groupId; + uint32_t flag; + uint32_t aicoreNum; + uint32_t aicpuNum; + uint32_t aivectorNum; + uint32_t sdmaNum; + uint32_t activeStreamNum; + void *extrPtr; } rtGroupInfo_t; /** @@ -156,6 +156,7 @@ RTS_API rtError_t rtGetGroupCount(uint32_t *count); * @return RT_ERROR_NONE for ok */ RTS_API rtError_t rtSetCtxINFMode(bool mode); + #if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) } #endif diff --git a/inc/runtime/dev.h b/inc/runtime/dev.h index d1a91a9bb..49f6a3f66 100644 --- a/inc/runtime/dev.h +++ b/inc/runtime/dev.h @@ -27,44 +27,44 @@ extern "C" { #define RT_CAPABILITY_NOT_SUPPORT (0x0) typedef struct tagRTDeviceInfo { - uint8_t env_type; // 0: FPGA 1: EMU 2: ESL - uint32_t ctrl_cpu_ip; - uint32_t ctrl_cpu_id; - uint32_t ctrl_cpu_core_num; - uint32_t ctrl_cpu_endian_little; - uint32_t ts_cpu_core_num; - uint32_t ai_cpu_core_num; - uint32_t ai_core_num; - uint32_t ai_core_freq; - uint32_t ai_cpu_core_id; - uint32_t ai_core_id; - uint32_t aicpu_occupy_bitmap; - uint32_t hardware_version; - uint32_t ts_num; + uint8_t env_type; // 0: FPGA 1: EMU 2: ESL + uint32_t ctrl_cpu_ip; + uint32_t ctrl_cpu_id; + uint32_t ctrl_cpu_core_num; + uint32_t ctrl_cpu_endian_little; + uint32_t ts_cpu_core_num; + uint32_t ai_cpu_core_num; + uint32_t ai_core_num; + uint32_t ai_core_freq; + uint32_t ai_cpu_core_id; + uint32_t ai_core_id; + uint32_t aicpu_occupy_bitmap; + uint32_t hardware_version; + uint32_t ts_num; } rtDeviceInfo_t; typedef enum tagRtRunMode { - RT_RUN_MODE_OFFLINE = 0, - RT_RUN_MODE_ONLINE = 1, - RT_RUN_MODE_AICPU_SCHED = 2, - RT_RUN_MODE_RESERVED + RT_RUN_MODE_OFFLINE = 0, + RT_RUN_MODE_ONLINE = 1, + RT_RUN_MODE_AICPU_SCHED = 2, + RT_RUN_MODE_RESERVED } rtRunMode; typedef enum tagRtAicpuDeployType { - AICPU_DEPLOY_CROSS_OS = 0x0, - AICPU_DEPLOY_CROSS_PROCESS = 0x1, - AICPU_DEPLOY_CROSS_THREAD = 0x2, - AICPU_DEPLOY_RESERVED + AICPU_DEPLOY_CROSS_OS = 0x0, + AICPU_DEPLOY_CROSS_PROCESS = 0x1, + AICPU_DEPLOY_CROSS_THREAD = 0x2, + AICPU_DEPLOY_RESERVED } rtAicpuDeployType_t; typedef enum tagRtFeatureType { - FEATURE_TYPE_MEMCPY = 0, - FEATURE_TYPE_RSV + FEATURE_TYPE_MEMCPY = 0, + FEATURE_TYPE_RSV } rtFeatureType_t; typedef enum tagMemcpyInfo { - MEMCPY_INFO_SUPPORT_ZEROCOPY = 0, - MEMCPY_INFO_RSV + MEMCPY_INFO_SUPPORT_ZEROCOPY = 0, + MEMCPY_INFO_RSV } rtMemcpyInfo_t; /** @@ -185,7 +185,7 @@ RTS_API rtError_t rtDisableP2P(uint32_t devIdDes, uint32_t phyIdSrc); * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ -RTS_API rtError_t rtDeviceCanAccessPeer(int32_t* canAccessPeer, uint32_t device, uint32_t peerDevice); +RTS_API rtError_t rtDeviceCanAccessPeer(int32_t *canAccessPeer, uint32_t device, uint32_t peerDevice); /** * @ingroup dvrt_dev @@ -356,6 +356,7 @@ RTS_API rtError_t rtSetDeviceWithoutTsd(int32_t device); * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtDeviceResetWithoutTsd(int32_t device); + #if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) } #endif diff --git a/inc/runtime/kernel.h b/inc/runtime/kernel.h index 18200fa2f..dc16ca585 100644 --- a/inc/runtime/kernel.h +++ b/inc/runtime/kernel.h @@ -29,15 +29,15 @@ extern "C" { * @brief shared memory data control */ typedef struct tagRtSmData { - uint64_t L2_mirror_addr; // preload or swap source address - uint32_t L2_data_section_size; // every data size - uint8_t L2_preload; // 1 - preload from mirrorAddr, 0 - no preload - uint8_t modified; // 1 - data will be modified by kernel, 0 - no modified - uint8_t priority; // data priority - int8_t prev_L2_page_offset_base; // remap source section offset - uint8_t L2_page_offset_base; // remap destination section offset - uint8_t L2_load_to_ddr; // 1 - need load out, 0 - no need - uint8_t reserved[2]; // reserved + uint64_t L2_mirror_addr; // preload or swap source address + uint32_t L2_data_section_size; // every data size + uint8_t L2_preload; // 1 - preload from mirrorAddr, 0 - no preload + uint8_t modified; // 1 - data will be modified by kernel, 0 - no modified + uint8_t priority; // data priority + int8_t prev_L2_page_offset_base; // remap source section offset + uint8_t L2_page_offset_base; // remap destination section offset + uint8_t L2_load_to_ddr; // 1 - need load out, 0 - no need + uint8_t reserved[2]; // reserved } rtSmData_t; /** @@ -45,12 +45,12 @@ typedef struct tagRtSmData { * @brief shared memory description */ typedef struct tagRtSmCtrl { - rtSmData_t data[8]; // data description - uint64_t size; // max page Num - uint8_t remap[64]; /* just using for static remap mode, default:0xFF + rtSmData_t data[8]; // data description + uint64_t size; // max page Num + uint8_t remap[64]; /* just using for static remap mode, default:0xFF array index: virtual l2 page id, array value: physic l2 page id */ - uint8_t l2_in_main; // 0-DDR, 1-L2, default:0xFF - uint8_t reserved[3]; + uint8_t l2_in_main; // 0-DDR, 1-L2, default:0xFF + uint8_t reserved[3]; } rtSmDesc_t; typedef rtSmDesc_t rtL2Ctrl_t; @@ -60,10 +60,10 @@ typedef rtSmDesc_t rtL2Ctrl_t; * @brief device binary type */ typedef struct tagRtDevBinary { - uint32_t magic; // magic number - uint32_t version; // version of binary - const void *data; // binary data - uint64_t length; // binary length + uint32_t magic; // magic number + uint32_t version; // version of binary + const void *data; // binary data + uint64_t length; // binary length } rtDevBinary_t; /** @@ -73,15 +73,15 @@ typedef struct tagRtDevBinary { #define ONLINE_PROF_MAX_PMU_NUM (8) typedef struct ProfilefDataInfo { - const void *stubFunc; - uint32_t blockDim; - const void *args; - uint32_t argsSize; - rtSmDesc_t *smDesc; - rtStream_t stream; - uint64_t totalcycle; - uint64_t ovcycle; - uint64_t pmu_cnt[ONLINE_PROF_MAX_PMU_NUM]; + const void *stubFunc; + uint32_t blockDim; + const void *args; + uint32_t argsSize; + rtSmDesc_t *smDesc; + rtStream_t stream; + uint64_t totalcycle; + uint64_t ovcycle; + uint64_t pmu_cnt[ONLINE_PROF_MAX_PMU_NUM]; } rtProfDataInfo_t; /** @@ -89,12 +89,12 @@ typedef struct ProfilefDataInfo { * @brief function mode type */ typedef enum { - FUNC_MODE_NORMAL = 0, - FUNC_MODE_PCTRACE_USERPROFILE_RECORDLOOP, - FUNC_MODE_PCTRACE_USERPROFILE_SKIPLOOP, - FUNC_MODE_PCTRACE_CYCLECNT_RECORDLOOP, - FUNC_MODE_PCTRACE_CYCLECNT_SKIPLOOP, - FUNC_MODE_BUTT + FUNC_MODE_NORMAL = 0, + FUNC_MODE_PCTRACE_USERPROFILE_RECORDLOOP, + FUNC_MODE_PCTRACE_USERPROFILE_SKIPLOOP, + FUNC_MODE_PCTRACE_CYCLECNT_RECORDLOOP, + FUNC_MODE_PCTRACE_CYCLECNT_SKIPLOOP, + FUNC_MODE_BUTT } rtFuncModeType_t; /** @@ -102,23 +102,23 @@ typedef enum { * @brief kernel info */ typedef struct rtKernelInfo { - uint64_t task_offset; // kernel offset in module - /* flowtable */ - void *arg; // launch kernel arg - uint32_t arg_size; - /* module */ - void *module_addr; // module::baseaddr_ - uint32_t module_size; -} * rtKernelInfo_t; + uint64_t task_offset; // kernel offset in module + /* flowtable */ + void *arg; // launch kernel arg + uint32_t arg_size; + /* module */ + void *module_addr; // module::baseaddr_ + uint32_t module_size; +} *rtKernelInfo_t; /** * @ingroup rt_KernelConfigDump * @brief device dump type */ typedef enum tagRtDumpKind { - RT_DATA_DUMP_KIND_INVALID = -1, - RT_DATA_DUMP_KIND_DUMP = 0, - RT_DATA_DUMP_KIND_RESERVED + RT_DATA_DUMP_KIND_INVALID = -1, + RT_DATA_DUMP_KIND_DUMP = 0, + RT_DATA_DUMP_KIND_RESERVED } rtDumpKind_t; /** @@ -386,7 +386,7 @@ RTS_API rtError_t rtCpuKernelLaunchWithFlag(const void *soName, const void *kern * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ - RTS_API rtError_t rtDumpAddrSet(rtModel_t model, void *addr, uint32_t dumpSize, uint32_t flag); +RTS_API rtError_t rtDumpAddrSet(rtModel_t model, void *addr, uint32_t dumpSize, uint32_t flag); /** * @ingroup rt_kernel @@ -413,6 +413,7 @@ RTS_API rtError_t rtDatadumpInfoLoad(const void *dumpInfo, uint32_t length); RTS_API rtError_t rtConfigureCall(uint32_t numBlocks, rtSmDesc_t *smDesc = nullptr, rtStream_t stream = nullptr); #else RTS_API rtError_t rtConfigureCall(uint32_t numBlocks, rtSmDesc_t *smDesc, rtStream_t stream); + #endif #endif // __CLANG_CCE_RUNTIME_H__ diff --git a/inc/runtime/mem.h b/inc/runtime/mem.h index 5752c6815..30af85d96 100644 --- a/inc/runtime/mem.h +++ b/inc/runtime/mem.h @@ -34,7 +34,7 @@ extern "C" { */ #define RT_MEMORY_DEFAULT ((uint32_t)0x0) // default memory on device #define RT_MEMORY_HBM ((uint32_t)0x2) // HBM memory on device -#define RT_MEMORY_RDMA_HBM ((uint32_t)0x3) +#define RT_MEMORY_RDMA_HBM ((uint32_t)0x3) // RDMA-HBM memory on device #define RT_MEMORY_DDR ((uint32_t)0x4) // DDR memory on device #define RT_MEMORY_SPM ((uint32_t)0x8) // shared physical memory on device #define RT_MEMORY_P2P_HBM ((uint32_t)0x10) // HBM memory on other 4P device @@ -90,40 +90,40 @@ typedef uint32_t rtMemType_t; * @brief memory copy type */ typedef enum tagRtMemcpyKind { - RT_MEMCPY_HOST_TO_HOST = 0, // host to host - RT_MEMCPY_HOST_TO_DEVICE, // host to device - RT_MEMCPY_DEVICE_TO_HOST, // device to host - RT_MEMCPY_DEVICE_TO_DEVICE, // device to device, 1P && P2P - RT_MEMCPY_MANAGED, // managed memory - RT_MEMCPY_ADDR_DEVICE_TO_DEVICE, - RT_MEMCPY_HOST_TO_DEVICE_EX, // host to device ex (only used for 8 bytes) - RT_MEMCPY_DEVICE_TO_HOST_EX, // device to host ex - RT_MEMCPY_RESERVED, + RT_MEMCPY_HOST_TO_HOST = 0, // host to host + RT_MEMCPY_HOST_TO_DEVICE, // host to device + RT_MEMCPY_DEVICE_TO_HOST, // device to host + RT_MEMCPY_DEVICE_TO_DEVICE, // device to device, 1P && P2P + RT_MEMCPY_MANAGED, // managed memory + RT_MEMCPY_ADDR_DEVICE_TO_DEVICE, + RT_MEMCPY_HOST_TO_DEVICE_EX, // host to device ex (only used for 8 bytes) + RT_MEMCPY_DEVICE_TO_HOST_EX, // device to host ex + RT_MEMCPY_RESERVED, } rtMemcpyKind_t; typedef enum tagRtMemInfoType { - RT_MEMORYINFO_DDR, - RT_MEMORYINFO_HBM, - RT_MEMORYINFO_DDR_HUGE, // Hugepage memory of DDR - RT_MEMORYINFO_DDR_NORMAL, // Normal memory of DDR - RT_MEMORYINFO_HBM_HUGE, // Hugepage memory of HBM - RT_MEMORYINFO_HBM_NORMAL, // Normal memory of HBM - RT_MEMORYINFO_DDR_P2P_HUGE, // Hugepage memory of DDR - RT_MEMORYINFO_DDR_P2P_NORMAL, // Normal memory of DDR - RT_MEMORYINFO_HBM_P2P_HUGE, // Hugepage memory of HBM - RT_MEMORYINFO_HBM_P2P_NORMAL, // Normal memory of HBM + RT_MEMORYINFO_DDR, + RT_MEMORYINFO_HBM, + RT_MEMORYINFO_DDR_HUGE, // Hugepage memory of DDR + RT_MEMORYINFO_DDR_NORMAL, // Normal memory of DDR + RT_MEMORYINFO_HBM_HUGE, // Hugepage memory of HBM + RT_MEMORYINFO_HBM_NORMAL, // Normal memory of HBM + RT_MEMORYINFO_DDR_P2P_HUGE, // Hugepage memory of DDR + RT_MEMORYINFO_DDR_P2P_NORMAL, // Normal memory of DDR + RT_MEMORYINFO_HBM_P2P_HUGE, // Hugepage memory of HBM + RT_MEMORYINFO_HBM_P2P_NORMAL, // Normal memory of HBM } rtMemInfoType_t; typedef enum tagRtRecudeKind { - RT_MEMCPY_SDMA_AUTOMATIC_ADD = 10, // D2D, SDMA inline reduce, include 1P, and P2P - RT_RECUDE_KIND_END + RT_MEMCPY_SDMA_AUTOMATIC_ADD = 10, // D2D, SDMA inline reduce, include 1P, and P2P + RT_RECUDE_KIND_END } rtRecudeKind_t; typedef enum tagRtDataType { - RT_DATA_TYPE_FP32 = 0, // fp32 - RT_DATA_TYPE_FP16 = 1, // fp16 - RT_DATA_TYPE_INT16 = 2, // int16 - RT_DATA_TYPE_END + RT_DATA_TYPE_FP32 = 0, // fp32 + RT_DATA_TYPE_FP16 = 1, // fp16 + RT_DATA_TYPE_INT16 = 2, // int16 + RT_DATA_TYPE_END } rtDataType_t; /** @@ -131,10 +131,10 @@ typedef enum tagRtDataType { * @brief memory copy channel type */ typedef enum tagRtMemcpyChannelType { - RT_MEMCPY_CHANNEL_TYPE_INNER = 0, // 1P - RT_MEMCPY_CHANNEL_TYPE_PCIe, - RT_MEMCPY_CHANNEL_TYPE_HCCs, // not support now - RT_MEMCPY_CHANNEL_TYPE_RESERVED, + RT_MEMCPY_CHANNEL_TYPE_INNER = 0, // 1P + RT_MEMCPY_CHANNEL_TYPE_PCIe, + RT_MEMCPY_CHANNEL_TYPE_HCCs, // not support now + RT_MEMCPY_CHANNEL_TYPE_RESERVED, } rtMemcpyChannelType_t; /** @@ -142,27 +142,27 @@ typedef enum tagRtMemcpyChannelType { * @brief ai core memory size */ typedef struct rtAiCoreMemorySize { - uint32_t l0ASize; - uint32_t l0BSize; - uint32_t l0CSize; - uint32_t l1Size; - uint32_t ubSize; - uint32_t l2Size; - uint32_t l2PageNum; - uint32_t blockSize; - uint64_t bankSize; - uint64_t bankNum; - uint64_t burstInOneBlock; - uint64_t bankGroupNum; + uint32_t l0ASize; + uint32_t l0BSize; + uint32_t l0CSize; + uint32_t l1Size; + uint32_t ubSize; + uint32_t l2Size; + uint32_t l2PageNum; + uint32_t blockSize; + uint64_t bankSize; + uint64_t bankNum; + uint64_t burstInOneBlock; + uint64_t bankGroupNum; } rtAiCoreMemorySize_t; /** * @ingroup dvrt_mem * @brief memory type */ -typedef enum tagRtMemoryType { - RT_MEMORY_TYPE_HOST = 1, - RT_MEMORY_TYPE_DEVICE = 2 , +typedef enum tagRtMemoryType { + RT_MEMORY_TYPE_HOST = 1, + RT_MEMORY_TYPE_DEVICE = 2, RT_MEMORY_TYPE_SVM = 3, RT_MEMORY_TYPE_DVPP = 4 } rtMemoryType_t; @@ -172,31 +172,31 @@ typedef enum tagRtMemoryType { * @brief memory attribute */ typedef struct tagRtPointerAttributes { - rtMemoryType_t memoryType; // host memory or device memory - rtMemoryType_t locationType; - uint32_t deviceID; // device ID - uint32_t pageSize; + rtMemoryType_t memoryType; // host memory or device memory + rtMemoryType_t locationType; + uint32_t deviceID; // device ID + uint32_t pageSize; } rtPointerAttributes_t; typedef struct rtMallocHostSharedMemoryIn { - const char* name; + const char *name; const uint64_t size; uint32_t flag; } rtMallocHostSharedMemoryIn; typedef struct rtMallocHostSharedMemoryOut { int fd; - void* ptr; - void* devPtr; + void *ptr; + void *devPtr; } rtMallocHostSharedMemoryOut; typedef struct rtFreeHostSharedMemoryIn { - const char* name; + const char *name; const uint64_t size; int fd; - void* ptr; - void* devPtr; + void *ptr; + void *devPtr; } rtFreeHostSharedMemoryIn; @@ -268,7 +268,7 @@ RTS_API rtError_t rtFreeHost(void *hostPtr); */ RTS_API rtError_t rtMallocHostSharedMemory(rtMallocHostSharedMemoryIn *in, - rtMallocHostSharedMemoryOut *out); + rtMallocHostSharedMemoryOut *out); /** * @ingroup dvrt_mem diff --git a/inc/toolchain/plog.h b/inc/toolchain/plog.h index 6099a2f4b..6134c3e6b 100644 --- a/inc/toolchain/plog.h +++ b/inc/toolchain/plog.h @@ -42,18 +42,18 @@ extern "C" { /** * @ingroup plog * @brief DlogReportInitialize: init log in service process before all device setting. - * @return 0: SUCCEED, others: FAILED + * @return: 0: SUCCEED, others: FAILED */ DLL_EXPORT int DlogReportInitialize(); /** * @ingroup plog * @brief DlogReportFinalize: release log resource in service process after all device reset. - * @return 0: SUCCEED, others: FAILED + * @return: 0: SUCCEED, others: FAILED */ DLL_EXPORT int DlogReportFinalize(); #ifdef __cplusplus } #endif // __cplusplus -#endif // D_PLOG_H_ \ No newline at end of file +#endif // D_PLOG_H_ diff --git a/inc/toolchain/slog.h b/inc/toolchain/slog.h index 8a0fb97db..7c4f7be24 100644 --- a/inc/toolchain/slog.h +++ b/inc/toolchain/slog.h @@ -449,10 +449,10 @@ DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr); * @param [in]fmt: log content */ #define DlogForC(moduleId, level, fmt, ...) \ - do { \ + do { \ if(CheckLogLevelForC(moduleId, level) == 1) { \ DlogInnerForC(moduleId, level, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ - } \ + } \ } while (0) /** @@ -466,10 +466,10 @@ DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr); * @param [in]fmt: log content */ #define DlogSubForC(moduleId, submodule, level, fmt, ...) \ - do { \ + do { \ if(CheckLogLevelForC(moduleId, level) == 1) { \ DlogInnerForC(moduleId, level, "[%s:%d][%s]" fmt, __FILE__, __LINE__, submodule, ##__VA_ARGS__); \ - } \ + } \ } while (0) /** @@ -484,10 +484,10 @@ DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr); * @param [in]fmt: log content */ #define DlogWithKVForC(moduleId, level, pstKVArray, kvNum, fmt, ...) \ - do { \ + do { \ if(CheckLogLevelForC(moduleId, level) == 1) { \ DlogWithKVInnerForC(moduleId, level, pstKVArray, kvNum, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ - } \ + } \ } while (0) /** -- Gitee