diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 16494a33..e0696c75 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -703,11 +703,13 @@ target_compile_definitions(ge_runner PRIVATE FMK_SUPPORT_DUMP DAVINCI_CLOUD google=ascend_private + FUNC_VISIBILITY ) target_compile_options(ge_runner PRIVATE -O2 -fno-common + -fvisibility=hidden $<$:-Werror=unused-variable> $<$:-Werror=unused-const-variable -Werror=format> ) @@ -738,6 +740,10 @@ target_include_directories(ge_runner SYSTEM PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain ) +target_link_options(ge_runner PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(ge_runner PRIVATE $ adump_server @@ -772,11 +778,13 @@ target_compile_definitions(ge_compiler PRIVATE FMK_HOST_INFER COMPILE_OMG_PACKAGE google=ascend_private + FUNC_VISIBILITY ) target_compile_options(ge_compiler PRIVATE -O2 -fno-common + -fvisibility=hidden $<$:-Werror=unused-variable> $<$:-Werror=unused-const-variable -Werror=format> ) @@ -807,6 +815,10 @@ target_include_directories(ge_compiler SYSTEM PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain ) +target_link_options(ge_compiler PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(ge_compiler PRIVATE $ static_mmpa @@ -868,6 +880,7 @@ target_compile_options(opensrc_ascendcl PRIVATE -O2 -fvisibility=hidden ) + target_link_options(opensrc_ascendcl PRIVATE -rdynamic -Wl,--allow-multiple-definition @@ -875,6 +888,7 @@ target_link_options(opensrc_ascendcl PRIVATE -Wl,-Bsymbolic -Wl,--exclude-libs,ALL ) + target_link_libraries(opensrc_ascendcl PRIVATE -Wl,--whole-archive ge_executor diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index 0172628c..22b1a7ea 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -12,7 +12,7 @@ set(PROTO_LIST "${METADEF_DIR}/proto/tensorflow/tensor.proto" "${METADEF_DIR}/proto/tensorflow/tensor_shape.proto" "${METADEF_DIR}/proto/tensorflow/types.proto" - "${METADEF_DIR}/proto/tensorflow/versions.proto" + "${METADEF_DIR}/proto/tensorflow/versions.proto" ) protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) @@ -73,6 +73,7 @@ target_compile_definitions(ge_common PRIVATE FMK_SUPPORT_DUMP OS_CENTOS google=ascend_private + FUNC_VISIBILITY ) target_compile_options(ge_common PRIVATE @@ -105,6 +106,10 @@ target_include_directories(ge_common PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain ) +target_link_options(ge_common PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(ge_common PRIVATE $ static_mmpa @@ -132,6 +137,7 @@ target_compile_definitions(ge_common_static PRIVATE $,OS_TYPE=WIN,OS_TYPE=0> $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> LOG_CPP + FUNC_VISIBILITY ) target_compile_options(ge_common_static PRIVATE @@ -181,6 +187,7 @@ target_compile_definitions(ge_common PRIVATE OS_CENTOS google=ascend_private LOG_CPP + FUNC_VISIBILITY ) target_compile_options(ge_common PRIVATE @@ -208,6 +215,10 @@ target_include_directories(ge_common PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain ) +target_link_options(ge_common PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(ge_common PRIVATE $ ascend_protobuf_static diff --git a/ge/common/helper/model_cache_helper.cc b/ge/common/helper/model_cache_helper.cc index bf8c3ce0..67d934df 100755 --- a/ge/common/helper/model_cache_helper.cc +++ b/ge/common/helper/model_cache_helper.cc @@ -598,7 +598,7 @@ bool ModelCacheHelper::IsAllocatedGraphIdSameAsCache(Json &json) const { return false; } // Compare allocated graph id info between json and VarManager - std::unordered_map allocated_graph_id; + std::map allocated_graph_id; auto ret = ParseAllocatedGraphIdFromJson(json, allocated_graph_id); if (ret != SUCCESS) { GELOGW("Fail to parse AllocatedGraphId from Json."); @@ -667,7 +667,7 @@ bool ModelCacheHelper::IsChangedGraphIdSameAsCache(Json &json) const { return false; } // Compare variable changed graph id info between json and VarManager - std::unordered_map changed_graph_id; + std::map changed_graph_id; auto ret = ParseChangedGraphIdFromJson(json, changed_graph_id); if (ret != SUCCESS) { GELOGW("Fail to parse ChangedGraphId from Json."); @@ -732,7 +732,7 @@ bool ModelCacheHelper::IsVarAddrMgrMapSameAsCache(Json &json) const { } // Compare variable address info between json and VarManager std::vector> var_addr_mgr_vector; - std::unordered_set var_offset_set; + std::set var_offset_set; auto ret = ParseVarAddrMgrMapFromJson(json, var_addr_mgr_vector, var_offset_set); if (ret != SUCCESS) { GELOGW("Fail to parse VarAddrMgrMap from Json."); @@ -942,7 +942,7 @@ Status ModelCacheHelper::RecoverAllocatedGraphId(const Json &json) const { GELOGW("Input param json type should be null or array."); return PARAM_INVALID; } - std::unordered_map allocated_graph_id; + std::map allocated_graph_id; auto ret = ParseAllocatedGraphIdFromJson(json, allocated_graph_id); if (ret != SUCCESS) { GELOGW("Fail to parse AllocatedGraphId from Json."); @@ -963,7 +963,7 @@ Status ModelCacheHelper::RecoverChangedGraphId(const Json &json) const { GELOGW("Input param json type should be null or array."); return PARAM_INVALID; } - std::unordered_map changed_graph_id; + std::map changed_graph_id; auto ret = ParseChangedGraphIdFromJson(json, changed_graph_id); if (ret != SUCCESS) { GELOGW("Fail to parse AllocatedGraphId from Json."); @@ -985,7 +985,7 @@ Status ModelCacheHelper::RecoverVarAddrAndTensorDesc(const Json &json) const { return PARAM_INVALID; } std::vector> var_addr_mgr_vector; - std::unordered_set var_offset_set; + std::set var_offset_set; auto ret = ParseVarAddrMgrMapFromJson(json, var_addr_mgr_vector, var_offset_set); if (ret != SUCCESS) { GELOGW("Fail to parse VarAddrMgrMap from Json."); @@ -1508,7 +1508,7 @@ Status ModelCacheHelper::ParseMemResourceFromJson(const Json &json, map> &var_addr_mgr_vector, - std::unordered_set &var_offset_set) { + std::set &var_offset_set) { if (!(json.is_array() || json.is_null())) { GELOGW("Input param json type should be null or array."); return PARAM_INVALID; @@ -1606,7 +1606,7 @@ Status ModelCacheHelper::ParseTransRoadsFromJson( } Status ModelCacheHelper::ParseChangedGraphIdFromJson(const Json &json, - std::unordered_map &changed_graph_id) { + std::map &changed_graph_id) { if (!(json.is_array() || json.is_null())) { GELOGW("Input param json type should be null or array."); return PARAM_INVALID; @@ -1624,7 +1624,7 @@ Status ModelCacheHelper::ParseChangedGraphIdFromJson(const Json &json, } Status ModelCacheHelper::ParseAllocatedGraphIdFromJson(const Json &json, - std::unordered_map &allocated_graph_id) { + std::map &allocated_graph_id) { if (!(json.is_array() || json.is_null())) { GELOGW("Input param json type should be null or array."); return PARAM_INVALID; diff --git a/ge/common/helper/model_cache_helper.h b/ge/common/helper/model_cache_helper.h index 68381e96..398d6c03 100755 --- a/ge/common/helper/model_cache_helper.h +++ b/ge/common/helper/model_cache_helper.h @@ -95,15 +95,15 @@ class ModelCacheHelper { static Status ParseMemResourceFromJson(const Json &json, map &mem_resource); static Status ParseVarAddrMgrMapFromJson(const Json &json, std::vector> &var_addr_mgr_vector, - std::unordered_set &var_offset_set); + std::set &var_offset_set); static Status ParseCurVarTensorDescMapFromJson( const Json &json, std::unordered_map &cur_var_tensor_desc_map); static Status ParseTransRoadsFromJson(const Json &json, std::unordered_map> &trans_roads); static Status ParseChangedGraphIdFromJson(const Json &json, - std::unordered_map &changed_graph_id); + std::map &changed_graph_id); static Status ParseAllocatedGraphIdFromJson(const Json &json, - std::unordered_map &allocated_graph_id); + std::map &allocated_graph_id); static Status ParseBroadcastInfoFromJson(const Json &json, std::unordered_map &var_broadcast_info); static Status GetVarNameFromVarKey(const string &var_key, const GeTensorDesc &tensor_desc, string &var_name); diff --git a/ge/common/profiling/ge_profiling.cc b/ge/common/profiling/ge_profiling.cc index 9060f82b..08fdc0ae 100644 --- a/ge/common/profiling/ge_profiling.cc +++ b/ge/common/profiling/ge_profiling.cc @@ -88,7 +88,7 @@ bool isProfConfigValid(const uint32_t *deviceid_list, uint32_t device_nums) { return false; } - std::unordered_set record; + std::set record; for (size_t i = 0; i < device_nums; ++i) { uint32_t dev_id = deviceid_list[i]; if (dev_id >= static_cast(dev_count)) { diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 6cfbd9ad..8e56dc50 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -214,12 +214,14 @@ target_compile_options(ge_executor_shared PRIVATE -Werror -O2 -Wno-deprecated-declarations + -fvisibility=hidden ) target_compile_definitions(ge_executor_shared PRIVATE PROTOBUF_INLINE_NOT_IN_HEADERS=0 DAVINCI_SUPPORT_PROFILING google=ascend_private + FUNC_VISIBILITY ) target_include_directories(ge_executor_shared PRIVATE @@ -240,6 +242,10 @@ target_include_directories(ge_executor_shared PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(ge_executor_shared PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(ge_executor_shared PRIVATE $ msprofiler diff --git a/ge/ge_local_engine/CMakeLists.txt b/ge/ge_local_engine/CMakeLists.txt index 7189e8ff..cbc00d27 100755 --- a/ge/ge_local_engine/CMakeLists.txt +++ b/ge/ge_local_engine/CMakeLists.txt @@ -27,10 +27,12 @@ add_library(ge_local_engine SHARED ${SRC_LIST} ${PROTO_HDRS}) target_compile_options(ge_local_engine PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(ge_local_engine PRIVATE google=ascend_private + FUNC_VISIBILITY ) target_include_directories(ge_local_engine PRIVATE @@ -51,6 +53,10 @@ target_include_directories(ge_local_engine PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(ge_local_engine PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(ge_local_engine PRIVATE $ -Wl,--no-as-needed @@ -67,11 +73,13 @@ add_library(atc_ge_local_engine SHARED ${SRC_LIST} ${PROTO_HDRS}) target_compile_options(atc_ge_local_engine PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(atc_ge_local_engine PRIVATE COMPILE_OMG_PACKAGE google=ascend_private + FUNC_VISIBILITY ) target_include_directories(atc_ge_local_engine PRIVATE @@ -92,6 +100,10 @@ target_include_directories(atc_ge_local_engine PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(atc_ge_local_engine PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(atc_ge_local_engine PRIVATE $ -Wl,--no-as-needed @@ -113,10 +125,12 @@ add_library(ge_local_opskernel_builder SHARED ${OPS_KERNEL_SRC_LIST} ${PROTO_HDR target_compile_options(ge_local_opskernel_builder PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(ge_local_opskernel_builder PRIVATE google=ascend_private + FUNC_VISIBILITY ) target_include_directories(ge_local_opskernel_builder PRIVATE @@ -137,6 +151,10 @@ target_include_directories(ge_local_opskernel_builder PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(ge_local_opskernel_builder PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(ge_local_opskernel_builder PRIVATE $ -Wl,--no-as-needed @@ -154,10 +172,12 @@ add_library(atc_ge_local_opskernel_builder SHARED ${OPS_KERNEL_SRC_LIST} ${PROTO target_compile_options(atc_ge_local_opskernel_builder PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(atc_ge_local_opskernel_builder PRIVATE google=ascend_private + FUNC_VISIBILITY ) target_include_directories(atc_ge_local_opskernel_builder PRIVATE @@ -178,6 +198,10 @@ target_include_directories(atc_ge_local_opskernel_builder PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(atc_ge_local_opskernel_builder PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(atc_ge_local_opskernel_builder PRIVATE $ -Wl,--no-as-needed @@ -200,11 +224,13 @@ add_library(ge_local_opskernel_builder_static STATIC ${OPS_KERNEL_SRC_LIST} ${PR target_compile_options(ge_local_opskernel_builder_static PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(ge_local_opskernel_builder_static PRIVATE google=ascend_private LOG_CPP + FUNC_VISIBILITY ) target_include_directories(ge_local_opskernel_builder_static PRIVATE diff --git a/ge/ge_local_engine/engine/ge_local_engine.h b/ge/ge_local_engine/engine/ge_local_engine.h index 65dfe65b..9eedb533 100644 --- a/ge/ge_local_engine/engine/ge_local_engine.h +++ b/ge/ge_local_engine/engine/ge_local_engine.h @@ -17,6 +17,20 @@ #ifndef GE_GE_LOCAL_ENGINE_ENGINE_GE_LOCAL_ENGINE_H_ #define GE_GE_LOCAL_ENGINE_ENGINE_GE_LOCAL_ENGINE_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include #include @@ -32,7 +46,7 @@ namespace ge_local { * ge local engine. * Used for the ops not belong to any engine. eg:netoutput */ -class GeLocalEngine { +class GE_FUNC_VISIBILITY GeLocalEngine { public: /** * get GeLocalEngine instance. @@ -94,25 +108,25 @@ extern "C" { * When Ge start, GE will invoke this interface * @return The status whether initialize successfully */ -ge::Status Initialize(const map &options); +GE_FUNC_VISIBILITY ge::Status Initialize(const map &options); /** * After the initialize, GE will invoke this interface to get the Ops kernel Store * @param ops_kernel_map The ge local's ops kernel info */ -void GetOpsKernelInfoStores(std::map &ops_kernel_map); +GE_FUNC_VISIBILITY void GetOpsKernelInfoStores(std::map &ops_kernel_map); /** * After the initialize, GE will invoke this interface to get the Graph Optimizer * @param graph_optimizers The ge local's Graph Optimizer objs */ -void GetGraphOptimizerObjs(std::map &graph_optimizers); +GE_FUNC_VISIBILITY void GetGraphOptimizerObjs(std::map &graph_optimizers); /** * When the graph finished, GE will invoke this interface * @return The status whether initialize successfully */ -ge::Status Finalize(); +GE_FUNC_VISIBILITY ge::Status Finalize(); } #endif // GE_GE_LOCAL_ENGINE_ENGINE_GE_LOCAL_ENGINE_H_ diff --git a/ge/ge_local_engine/engine/host_cpu_engine.h b/ge/ge_local_engine/engine/host_cpu_engine.h index 0b99ecac..fdec212e 100644 --- a/ge/ge_local_engine/engine/host_cpu_engine.h +++ b/ge/ge_local_engine/engine/host_cpu_engine.h @@ -16,6 +16,20 @@ #ifndef GE_GE_LOCAL_ENGINE_ENGINE_HOST_CPU_ENGINE_H_ #define GE_GE_LOCAL_ENGINE_ENGINE_HOST_CPU_ENGINE_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include "framework/common/ge_inner_error_codes.h" #include "graph/node.h" @@ -23,7 +37,7 @@ #include "external/../register/register.h" namespace ge { -class HostCpuEngine { +class GE_FUNC_VISIBILITY HostCpuEngine { public: ~HostCpuEngine() = default; diff --git a/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.h b/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.h index 8a7dafe2..38653554 100644 --- a/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.h +++ b/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.h @@ -22,7 +22,7 @@ namespace ge { namespace ge_local { -class GeLocalOpsKernelBuilder : public OpsKernelBuilder { +class GE_FUNC_VISIBILITY GeLocalOpsKernelBuilder : public OpsKernelBuilder { public: ~GeLocalOpsKernelBuilder() override; Status Initialize(const map &options) override; diff --git a/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.h b/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.h index cdfbeffa..d35b01c7 100755 --- a/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.h +++ b/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.h @@ -17,6 +17,20 @@ #ifndef GE_GE_LOCAL_ENGINE_OPS_KERNEL_STORE_GE_LOCAL_OPS_KERNEL_INFO_H_ #define GE_GE_LOCAL_ENGINE_OPS_KERNEL_STORE_GE_LOCAL_OPS_KERNEL_INFO_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include #include @@ -25,7 +39,7 @@ namespace ge { namespace ge_local { -class GeLocalOpsKernelInfoStore : public OpsKernelInfoStore { +class GE_FUNC_VISIBILITY GeLocalOpsKernelInfoStore : public OpsKernelInfoStore { public: GeLocalOpsKernelInfoStore() = default; diff --git a/ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.h b/ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.h index 55587b2e..e9efe0aa 100644 --- a/ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.h +++ b/ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.h @@ -21,7 +21,7 @@ namespace ge { namespace ge_local { -class GeDeletedOp : public Op { +class GE_FUNC_VISIBILITY GeDeletedOp : public Op { public: GeDeletedOp(const Node &node, RunContext &run_context); diff --git a/ge/ge_local_engine/ops_kernel_store/op/no_op.h b/ge/ge_local_engine/ops_kernel_store/op/no_op.h index 40e5766b..85b6bb58 100644 --- a/ge/ge_local_engine/ops_kernel_store/op/no_op.h +++ b/ge/ge_local_engine/ops_kernel_store/op/no_op.h @@ -21,7 +21,7 @@ namespace ge { namespace ge_local { -class NoOp : public Op { +class GE_FUNC_VISIBILITY NoOp : public Op { public: NoOp(const Node &node, RunContext &run_context); diff --git a/ge/ge_local_engine/ops_kernel_store/op/op.h b/ge/ge_local_engine/ops_kernel_store/op/op.h index c5a3df7a..b75a8bed 100644 --- a/ge/ge_local_engine/ops_kernel_store/op/op.h +++ b/ge/ge_local_engine/ops_kernel_store/op/op.h @@ -29,7 +29,7 @@ namespace ge_local { /** * The base class for all op. */ -class Op { +class GE_FUNC_VISIBILITY Op { public: Op(const Node &node, RunContext &run_context); diff --git a/ge/ge_local_engine/ops_kernel_store/op/op_factory.h b/ge/ge_local_engine/ops_kernel_store/op/op_factory.h index 0faab508..8dd411b6 100644 --- a/ge/ge_local_engine/ops_kernel_store/op/op_factory.h +++ b/ge/ge_local_engine/ops_kernel_store/op/op_factory.h @@ -32,7 +32,7 @@ using OP_CREATOR_FUNC = std::function(const Node &, RunConte /** * manage all the op, support create op. */ -class OpFactory { +class GE_FUNC_VISIBILITY OpFactory { public: static OpFactory &Instance(); @@ -72,7 +72,7 @@ class OpFactory { std::vector all_ops_; }; -class OpRegistrar { +class GE_FUNC_VISIBILITY OpRegistrar { public: OpRegistrar(const std::string &type, const OP_CREATOR_FUNC &func) { OpFactory::Instance().RegisterCreator(type, func); diff --git a/ge/ge_runtime/CMakeLists.txt b/ge/ge_runtime/CMakeLists.txt index 56b5ab41..b00dd5b3 100644 --- a/ge/ge_runtime/CMakeLists.txt +++ b/ge/ge_runtime/CMakeLists.txt @@ -27,7 +27,7 @@ target_compile_options(ge_runtime PRIVATE -fno-common ) -target_compile_definitions(ge_runtime PRIVATE +target_compile_definitions(ge_runtime PRIVATE PROTOBUF_INLINE_NOT_IN_HEADERS=0 LOG_CPP ) @@ -53,6 +53,10 @@ target_include_directories(ge_runtime PRIVATE ${CMAKE_BINARY_DIR}/proto/ge ) +target_link_options(ge_runtime PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(ge_runtime PRIVATE $ -Wl,--no-as-needed diff --git a/ge/graph/build/memory/block_mem_assigner.h b/ge/graph/build/memory/block_mem_assigner.h index 4401108d..ea1c5989 100755 --- a/ge/graph/build/memory/block_mem_assigner.h +++ b/ge/graph/build/memory/block_mem_assigner.h @@ -464,7 +464,7 @@ class BlockMemAssigner : public MemAssigner { std::unordered_map> node_continuous_input_blocks_; - std::unordered_map node_continuous_input_counts_; + std::map node_continuous_input_counts_; // reuse memory vector op_no_reuse_mem_vec_; diff --git a/ge/graph/build/task_generator.cc b/ge/graph/build/task_generator.cc index 8bd7d32e..330f523e 100755 --- a/ge/graph/build/task_generator.cc +++ b/ge/graph/build/task_generator.cc @@ -211,7 +211,7 @@ Status TaskGenerator::SaveFusionNodes(map> &fusion // and it have no attr or group attr different // which means bad case, return error bool call_check = true; - std::unordered_set input_group_ids; + std::set input_group_ids; for (const auto &input_node : node->GetInNodes()) { auto iter = nodes_with_group_attr.find(input_node); if (iter == nodes_with_group_attr.end()) { diff --git a/ge/graph/common/transop_util.h b/ge/graph/common/transop_util.h index 3332e1fb..883ae41b 100644 --- a/ge/graph/common/transop_util.h +++ b/ge/graph/common/transop_util.h @@ -44,7 +44,7 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY TransOpUtil { static TransOpUtil &Instance(); - typedef std::unordered_map transop_index_op; + typedef std::map transop_index_op; transop_index_op transop_index_map_; }; } // namespace ge diff --git a/ge/graph/load/model_manager/ts_mem_mall.h b/ge/graph/load/model_manager/ts_mem_mall.h index 64a64930..74ce5a16 100644 --- a/ge/graph/load/model_manager/ts_mem_mall.h +++ b/ge/graph/load/model_manager/ts_mem_mall.h @@ -100,8 +100,8 @@ class TsMemMall { private: std::mutex mem_mutex_; - std::unordered_map mem_store_size_; - std::unordered_map mem_store_addr_; + std::map mem_store_size_; + std::map mem_store_addr_; rtMemType_t mem_type_; }; } // namespace ge diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index b6598f11..8b57858d 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -131,7 +131,7 @@ bool IsTailingOptimization() { } ge::Status CheckFpCeilingMode() { - static const std::unordered_set kValidFpCeilingMode = {"0", "1", "2"}; + static const std::set kValidFpCeilingMode = {"0", "1", "2"}; string mode; auto ret = ge::GetContext().GetOption("ge.fpCeilingMode", mode); if (ret == ge::GRAPH_SUCCESS) { diff --git a/ge/graph/manager/graph_var_manager.h b/ge/graph/manager/graph_var_manager.h index 924ddcb7..0da12f9c 100755 --- a/ge/graph/manager/graph_var_manager.h +++ b/ge/graph/manager/graph_var_manager.h @@ -170,8 +170,8 @@ class VarResource { std::unordered_map var_addr_mgr_map_; std::unordered_map cur_var_tensor_desc_map_; std::unordered_map> var_to_trans_road_; - std::unordered_map var_names_to_changed_graph_id_; - std::unordered_map var_names_to_allocated_graph_id_; + std::map var_names_to_changed_graph_id_; + std::map var_names_to_allocated_graph_id_; std::map> var_broad_cast_info_; }; diff --git a/ge/graph/partition/graph_partition.cc b/ge/graph/partition/graph_partition.cc index fbc13920..d584337e 100755 --- a/ge/graph/partition/graph_partition.cc +++ b/ge/graph/partition/graph_partition.cc @@ -843,7 +843,7 @@ bool ge::GraphPartitioner::HasSecondPath(size_t src, size_t dst, size_t upper_bo /// Avoid recursion since stack space might be limited. /// We instead keep a stack of nodes to visit. std::vector temp_stack; - std::unordered_set visited; + std::set visited; temp_stack.push_back(src); while (!temp_stack.empty()) { size_t cluster = temp_stack.back(); diff --git a/ge/graph/partition/graph_partition.h b/ge/graph/partition/graph_partition.h index 9c22d40c..f34c67e6 100644 --- a/ge/graph/partition/graph_partition.h +++ b/ge/graph/partition/graph_partition.h @@ -36,7 +36,7 @@ using PartitionMap = std::unordered_map; using NodetoNodeMap = std::unordered_map; using EnginetoGraphMap = std::unordered_map; using EdgeMap = std::set>; -using ClusterSet = std::unordered_set; +using ClusterSet = std::set; class Cluster { public: size_t index_; // corresponding to rank of node diff --git a/ge/graph/passes/constant_folding_pass.cc b/ge/graph/passes/constant_folding_pass.cc index 4db14fc3..8a0c6c3c 100644 --- a/ge/graph/passes/constant_folding_pass.cc +++ b/ge/graph/passes/constant_folding_pass.cc @@ -50,12 +50,12 @@ Status RunOpKernelWithCheck(NodePtr &node, return FoldingPass::RunOpKernel(node, inputs, outputs); } -const std::unordered_map> +const std::map> &ConstantFoldingPass::GetGeConstantFoldingPerfStatistic() const { return statistic_of_ge_constant_folding_; } -const std::unordered_map> +const std::map> &ConstantFoldingPass::GetOpConstantFoldingPerfStatistic() const { return statistic_of_op_constant_folding_; } diff --git a/ge/graph/passes/constant_folding_pass.h b/ge/graph/passes/constant_folding_pass.h index c977157e..703e6edd 100644 --- a/ge/graph/passes/constant_folding_pass.h +++ b/ge/graph/passes/constant_folding_pass.h @@ -26,11 +26,11 @@ namespace ge { class ConstantFoldingPass : public FoldingPass { public: Status Run(ge::NodePtr &node) override; - const std::unordered_map> &GetGeConstantFoldingPerfStatistic() const; - const std::unordered_map> &GetOpConstantFoldingPerfStatistic() const; + const std::map> &GetGeConstantFoldingPerfStatistic() const; + const std::map> &GetOpConstantFoldingPerfStatistic() const; private: - std::unordered_map> statistic_of_op_constant_folding_; - std::unordered_map> statistic_of_ge_constant_folding_; + std::map> statistic_of_op_constant_folding_; + std::map> statistic_of_ge_constant_folding_; }; } // namespace ge diff --git a/ge/graph/passes/hccl_continuous_memcpy_pass.h b/ge/graph/passes/hccl_continuous_memcpy_pass.h index 0a21c896..538e89e9 100644 --- a/ge/graph/passes/hccl_continuous_memcpy_pass.h +++ b/ge/graph/passes/hccl_continuous_memcpy_pass.h @@ -52,7 +52,7 @@ class HcclContinuousMemcpyPass : public GraphPass { bool IsDataNode(const std::string& node_type); - std::unordered_map node_num_map_; + std::map node_num_map_; }; } // namespace ge diff --git a/ge/graph/passes/hccl_memcpy_pass.h b/ge/graph/passes/hccl_memcpy_pass.h index feea82d9..7ab63c59 100755 --- a/ge/graph/passes/hccl_memcpy_pass.h +++ b/ge/graph/passes/hccl_memcpy_pass.h @@ -50,7 +50,7 @@ class HcclMemcpyPass : public GraphPass { bool IsDataNode(const std::string& node_type); - std::unordered_map node_num_map_; + std::map node_num_map_; }; } // namespace ge diff --git a/ge/graph/passes/switch_to_stream_switch_pass.h b/ge/graph/passes/switch_to_stream_switch_pass.h index 05628871..e82ec17f 100644 --- a/ge/graph/passes/switch_to_stream_switch_pass.h +++ b/ge/graph/passes/switch_to_stream_switch_pass.h @@ -235,7 +235,7 @@ class SwitchToStreamSwitchPass : public GraphPass { std::vector stream_switch_nodes_; std::unordered_map>>> cond_node_map_; std::unordered_map> switch_node_map_; - std::unordered_map node_num_map_; + std::map node_num_map_; }; } // namespace ge #endif // GE_GRAPH_PASSES_SWITCH_TO_STREAM_SWITCH_PASS_H_ diff --git a/ge/graph/preprocess/multi_batch_options.h b/ge/graph/preprocess/multi_batch_options.h index 9baf4f43..914b1943 100644 --- a/ge/graph/preprocess/multi_batch_options.h +++ b/ge/graph/preprocess/multi_batch_options.h @@ -93,7 +93,7 @@ Status StampDynamicType(const OpDescPtr &op_desc); /// @param [in] const string &data_name: cur data name. /// @return 0: true/false /// -bool CheckDynamicBatchShape(const vector &shape, const string &data_name); +GE_FUNC_VISIBILITY bool CheckDynamicBatchShape(const vector &shape, const string &data_name); /// /// @ingroup ge @@ -104,7 +104,7 @@ bool CheckDynamicBatchShape(const vector &shape, const string &data_nam /// @param [in] const std::string &input_format: format of input. /// @return 0: true/false /// -bool CheckDynamicImageSizeShape(const vector &shape, const string &data_name, +GE_FUNC_VISIBILITY bool CheckDynamicImageSizeShape(const vector &shape, const string &data_name, const std::string &input_format); } // namespace multibatch diff --git a/ge/host_cpu_engine/CMakeLists.txt b/ge/host_cpu_engine/CMakeLists.txt index cbd0bd8b..4b397a95 100644 --- a/ge/host_cpu_engine/CMakeLists.txt +++ b/ge/host_cpu_engine/CMakeLists.txt @@ -21,10 +21,12 @@ add_library(host_cpu_engine SHARED ${SRC_LIST} ${PROTO_HDRS}) target_compile_options(host_cpu_engine PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(host_cpu_engine PRIVATE google=ascend_private + FUNC_VISIBILITY ) target_include_directories(host_cpu_engine PRIVATE @@ -44,6 +46,10 @@ target_include_directories(host_cpu_engine PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(host_cpu_engine PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(host_cpu_engine PRIVATE $ -Wl,--no-as-needed @@ -60,11 +66,13 @@ add_library(atc_host_cpu_engine SHARED ${SRC_LIST} ${PROTO_HDRS}) target_compile_options(atc_host_cpu_engine PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(atc_host_cpu_engine PRIVATE COMPILE_OMG_PACKAGE google=ascend_private + FUNC_VISIBILITY ) target_include_directories(atc_host_cpu_engine PRIVATE @@ -84,6 +92,10 @@ target_include_directories(atc_host_cpu_engine PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(atc_host_cpu_engine PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(atc_host_cpu_engine PRIVATE $ -Wl,--no-as-needed @@ -105,10 +117,12 @@ add_library(host_cpu_opskernel_builder SHARED ${CPU_OPS_KERNEL_LIST}) target_compile_options(host_cpu_opskernel_builder PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(host_cpu_opskernel_builder PRIVATE google=ascend_private + FUNC_VISIBILITY ) target_include_directories(host_cpu_opskernel_builder PRIVATE @@ -128,6 +142,10 @@ target_include_directories(host_cpu_opskernel_builder PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(host_cpu_opskernel_builder PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(host_cpu_opskernel_builder PRIVATE $ -Wl,--no-as-needed @@ -145,10 +163,12 @@ add_library(atc_host_cpu_opskernel_builder SHARED ${CPU_OPS_KERNEL_LIST}) target_compile_options(atc_host_cpu_opskernel_builder PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(atc_host_cpu_opskernel_builder PRIVATE google=ascend_private + FUNC_VISIBILITY ) target_include_directories(atc_host_cpu_opskernel_builder PRIVATE @@ -168,6 +188,10 @@ target_include_directories(atc_host_cpu_opskernel_builder PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(atc_host_cpu_opskernel_builder PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(atc_host_cpu_opskernel_builder PRIVATE $ -Wl,--no-as-needed @@ -190,11 +214,13 @@ add_library(host_cpu_opskernel_builder_static STATIC ${CPU_OPS_KERNEL_LIST}) target_compile_options(host_cpu_opskernel_builder_static PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(host_cpu_opskernel_builder_static PRIVATE google=ascend_private LOG_CPP + FUNC_VISIBILITY ) target_include_directories(host_cpu_opskernel_builder_static PRIVATE diff --git a/ge/host_cpu_engine/engine/host_cpu_engine.h b/ge/host_cpu_engine/engine/host_cpu_engine.h index c8d5608f..c29df00c 100644 --- a/ge/host_cpu_engine/engine/host_cpu_engine.h +++ b/ge/host_cpu_engine/engine/host_cpu_engine.h @@ -17,6 +17,20 @@ #ifndef GE_HOST_CPU_ENGINE_ENGINE_HOST_CPU_ENGINE_H_ #define GE_HOST_CPU_ENGINE_ENGINE_HOST_CPU_ENGINE_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include #include @@ -32,7 +46,7 @@ namespace host_cpu { * host cpu engine. * Used for the ops which executes on host. */ -class HostCpuEngine { +class GE_FUNC_VISIBILITY HostCpuEngine { public: /** * get HostCpuEngine instance. @@ -87,25 +101,25 @@ extern "C" { * When Ge start, GE will invoke this interface * @return The status whether initialize successfully */ -ge::Status Initialize(const map &options); +GE_FUNC_VISIBILITY ge::Status Initialize(const map &options); /** * After the initialize, GE will invoke this interface to get the Ops kernel Store * @param ops_kernel_map The host cpu's ops kernel info */ -void GetOpsKernelInfoStores(std::map &ops_kernel_map); +GE_FUNC_VISIBILITY void GetOpsKernelInfoStores(std::map &ops_kernel_map); /** * After the initialize, GE will invoke this interface to get the Graph Optimizer * @param graph_optimizers The host cpu's Graph Optimizer objs */ -void GetGraphOptimizerObjs(std::map &graph_optimizers); +GE_FUNC_VISIBILITY void GetGraphOptimizerObjs(std::map &graph_optimizers); /** * When the graph finished, GE will invoke this interface * @return The status whether initialize successfully */ -ge::Status Finalize(); +GE_FUNC_VISIBILITY ge::Status Finalize(); } #endif // GE_HOST_CPU_ENGINE_ENGINE_HOST_CPU_ENGINE_H_ diff --git a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.h b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.h index 82375b9f..066d943c 100644 --- a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.h +++ b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.h @@ -17,11 +17,25 @@ #ifndef GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_BUILDER_H_ #define GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_BUILDER_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include "common/opskernel/ops_kernel_builder.h" namespace ge { namespace host_cpu { -class HostCpuOpsKernelBuilder : public OpsKernelBuilder { +class GE_FUNC_VISIBILITY HostCpuOpsKernelBuilder : public OpsKernelBuilder { public: Status Initialize(const map &options) override; diff --git a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_info.h b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_info.h index f7539f8e..e3667d61 100644 --- a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_info.h +++ b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_info.h @@ -17,6 +17,20 @@ #ifndef GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_INFO_H_ #define GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_INFO_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include #include @@ -25,7 +39,7 @@ namespace ge { namespace host_cpu { -class HostCpuOpsKernelInfoStore : public OpsKernelInfoStore { +class GE_FUNC_VISIBILITY HostCpuOpsKernelInfoStore : public OpsKernelInfoStore { public: HostCpuOpsKernelInfoStore() {} ~HostCpuOpsKernelInfoStore() override = default; diff --git a/ge/host_cpu_engine/ops_kernel_store/op/host_op.h b/ge/host_cpu_engine/ops_kernel_store/op/host_op.h index 0f560485..023eb957 100644 --- a/ge/host_cpu_engine/ops_kernel_store/op/host_op.h +++ b/ge/host_cpu_engine/ops_kernel_store/op/host_op.h @@ -21,7 +21,7 @@ namespace ge { namespace host_cpu { -class HostOp : public Op { +class GE_FUNC_VISIBILITY HostOp : public Op { public: HostOp(const Node &node, RunContext &run_context) : Op(node, run_context) {} ~HostOp() override = default; diff --git a/ge/host_cpu_engine/ops_kernel_store/op/op.h b/ge/host_cpu_engine/ops_kernel_store/op/op.h index c094f080..b4c8b33e 100644 --- a/ge/host_cpu_engine/ops_kernel_store/op/op.h +++ b/ge/host_cpu_engine/ops_kernel_store/op/op.h @@ -29,7 +29,7 @@ namespace host_cpu { /** * The base class for all op. */ -class Op { +class GE_FUNC_VISIBILITY Op { public: Op(const Node &node, RunContext &run_context) : run_context_(run_context), node_(node) {} virtual ~Op() = default; diff --git a/ge/host_cpu_engine/ops_kernel_store/op/op_factory.h b/ge/host_cpu_engine/ops_kernel_store/op/op_factory.h index 3a235ffd..73174860 100644 --- a/ge/host_cpu_engine/ops_kernel_store/op/op_factory.h +++ b/ge/host_cpu_engine/ops_kernel_store/op/op_factory.h @@ -32,7 +32,7 @@ using OP_CREATOR_FUNC = std::function(const Node &, RunConte /** * manage all the op, support create op. */ -class OpFactory { +class GE_FUNC_VISIBILITY OpFactory { public: static OpFactory &Instance(); @@ -70,7 +70,7 @@ class OpFactory { std::vector all_ops_; }; -class OpRegistrar { +class GE_FUNC_VISIBILITY OpRegistrar { public: OpRegistrar(const std::string &type, const OP_CREATOR_FUNC &func) { OpFactory::Instance().RegisterCreator(type, func); diff --git a/ge/hybrid/node_executor/ge_local/ge_local_node_executor.cc b/ge/hybrid/node_executor/ge_local/ge_local_node_executor.cc index 50890d6a..d7d0f547 100755 --- a/ge/hybrid/node_executor/ge_local/ge_local_node_executor.cc +++ b/ge/hybrid/node_executor/ge_local/ge_local_node_executor.cc @@ -27,7 +27,7 @@ namespace ge { namespace hybrid { REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::GE_LOCAL, GeLocalNodeExecutor); -const std::unordered_map> +const std::map> RefInputTask::out_ref_input_index_ = {{DATA, {}}, {AIPPDATA, {}}, {RESHAPE, {}}, @@ -36,7 +36,7 @@ const std::unordered_map> {BROADCASTGRADIENTARGS, {}} }; -const std::unordered_set DependInputShapeTask::depend_input_shape_ops_ = {SHAPE, SHAPEN, RANK, SIZE}; +const std::set DependInputShapeTask::depend_input_shape_ops_ = {SHAPE, SHAPEN, RANK, SIZE}; Status RefInputTask::UpdateArgs(TaskContext &) { // no need update args diff --git a/ge/hybrid/node_executor/ge_local/ge_local_node_executor.h b/ge/hybrid/node_executor/ge_local/ge_local_node_executor.h index 9de8d0f9..c8d64d09 100644 --- a/ge/hybrid/node_executor/ge_local/ge_local_node_executor.h +++ b/ge/hybrid/node_executor/ge_local/ge_local_node_executor.h @@ -46,7 +46,7 @@ class RefInputTask : public NodeTask { // key is op type, value is output ref input index, // e.g. {1,0} means out[0] ref input[1], out[1] ref input[0], if vector is empty, it means ref input one by one - static const std::unordered_map> out_ref_input_index_; + static const std::map> out_ref_input_index_; }; class DependInputShapeTask : public NodeTask { @@ -65,7 +65,7 @@ class DependInputShapeTask : public NodeTask { const NodePtr node_; // ops depend input shape - static const std::unordered_set depend_input_shape_ops_; + static const std::set depend_input_shape_ops_; }; class ConstantNodeTask : public NodeTask { diff --git a/ge/init/gelib.h b/ge/init/gelib.h index e52b8dd6..885ae867 100644 --- a/ge/init/gelib.h +++ b/ge/init/gelib.h @@ -31,7 +31,7 @@ using std::map; using std::vector; namespace ge { -class GELib { +class GE_FUNC_VISIBILITY GELib { public: GELib() = default; ~GELib() = default; diff --git a/ge/ir_build/atc_ir_common.cc b/ge/ir_build/atc_ir_common.cc index 5b82f8f2..42a78dde 100755 --- a/ge/ir_build/atc_ir_common.cc +++ b/ge/ir_build/atc_ir_common.cc @@ -77,7 +77,7 @@ Status CheckInputFormat(const string &input_format) { return ge::SUCCESS; } -bool CheckDynamicBatchSizeInputShapeValid(unordered_map> shape_map, +bool CheckDynamicBatchSizeInputShapeValid(map> shape_map, std::string &dynamic_batch_size) { int32_t size = 0; for (auto iter = shape_map.begin(); iter != shape_map.end(); ++iter) { @@ -119,7 +119,7 @@ bool CheckDynamicBatchSizeInputShapeValid(unordered_map> return true; } -bool CheckDynamicImagesizeInputShapeValid(unordered_map> shape_map, +bool CheckDynamicImagesizeInputShapeValid(map> shape_map, const std::string input_format, std::string &dynamic_image_size) { if (!input_format.empty() && !ge::TypeUtils::IsFormatValid(input_format.c_str())) { GELOGE(ge::PARAM_INVALID, "user input format [%s] is not found!", input_format.c_str()); @@ -177,7 +177,7 @@ bool CheckDynamicImagesizeInputShapeValid(unordered_map> return true; } -bool CheckDynamicDimsInputShapeValid(const unordered_map> &shape_map, +bool CheckDynamicDimsInputShapeValid(const map> &shape_map, string input_format, string &dynamic_dims) { if (input_format != "ND") { ErrorManager::GetInstance().ATCReportErrMessage( @@ -272,7 +272,7 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i return ge::SUCCESS; } - unordered_map> shape_map; + map> shape_map; vector>> user_shape_map; is_dynamic_input = true; if (input_shape.empty()) { @@ -310,7 +310,7 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i return ge::SUCCESS; } -bool ParseInputShape(const string &input_shape, unordered_map> &shape_map, +bool ParseInputShape(const string &input_shape, map> &shape_map, vector>> &user_shape_map, bool is_dynamic_input) { vector shape_vec = StringUtils::Split(input_shape, ';'); const int DEFAULT_SHAPE_PAIR_SIZE = 2; diff --git a/ge/ir_build/atc_ir_common.h b/ge/ir_build/atc_ir_common.h index 2580a206..2ad4efa8 100644 --- a/ge/ir_build/atc_ir_common.h +++ b/ge/ir_build/atc_ir_common.h @@ -46,13 +46,13 @@ static std::map input_format_str_to_geformat = static const std::string kEnableCompressWeightTrue = "1"; static const std::string kEnableCompressWeightFalse = "0"; -bool CheckDynamicBatchSizeInputShapeValid(unordered_map> shape_map, +bool CheckDynamicBatchSizeInputShapeValid(map> shape_map, std::string &dynamic_batch_size); -bool CheckDynamicImagesizeInputShapeValid(unordered_map> shape_map, +bool CheckDynamicImagesizeInputShapeValid(map> shape_map, const std::string input_format, std::string &dynamic_image_size); -bool CheckDynamicDimsInputShapeValid(const std::unordered_map> &shape_map, +bool CheckDynamicDimsInputShapeValid(const std::map> &shape_map, std::string input_format, std::string &dynamic_dims); bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims); @@ -61,7 +61,7 @@ Status CheckDynamicInputParamValid(std::string &dynamic_batch_size, std::string std::string &dynamic_dims, const std::string input_shape, const std::string input_format, bool &is_dynamic_input); -bool ParseInputShape(const std::string &input_shape, std::unordered_map> &shape_map, +bool ParseInputShape(const std::string &input_shape, std::map> &shape_map, std::vector>> &user_shape_map, bool is_dynamic_input = false); Status CheckOutputTypeParamValid(const std::string output_type); diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index 3d00ff7f..9197d52f 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -268,7 +268,7 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { if (options_.find(kInputShape) == options_.end()) { return GRAPH_SUCCESS; } - unordered_map> shape_map; + map> shape_map; vector>> user_shape_map; GE_CHK_BOOL_EXEC(ParseInputShape(options_[kInputShape], shape_map, user_shape_map, true), return GRAPH_PARAM_INVALID, "parse input shape failed!"); diff --git a/ge/offline/CMakeLists.txt b/ge/offline/CMakeLists.txt index 3f8d43dc..0079576a 100644 --- a/ge/offline/CMakeLists.txt +++ b/ge/offline/CMakeLists.txt @@ -23,6 +23,7 @@ target_compile_options(atc_atc.bin PRIVATE -O2 -Wno-deprecated-declarations -fno-common + -fvisibility=hidden ) target_compile_definitions(atc_atc.bin PRIVATE @@ -30,6 +31,7 @@ target_compile_definitions(atc_atc.bin PRIVATE COMPILE_OMG_PACKAGE google=ascend_private LOG_CPP + FUNC_VISIBILITY ) target_include_directories(atc_atc.bin PRIVATE @@ -58,6 +60,10 @@ target_include_directories(atc_atc.bin PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain ) +target_link_options(atc_atc.bin PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(atc_atc.bin PRIVATE $ ascend_protobuf @@ -90,6 +96,7 @@ target_compile_options(fwk_atc.bin PRIVATE -O2 -Wno-deprecated-declarations -fno-common + -fvisibility=hidden ) target_compile_definitions(fwk_atc.bin PRIVATE @@ -97,6 +104,7 @@ target_compile_definitions(fwk_atc.bin PRIVATE COMPILE_OMG_PACKAGE google=ascend_private LOG_CPP + FUNC_VISIBILITY ) target_include_directories(fwk_atc.bin PRIVATE @@ -125,6 +133,10 @@ target_include_directories(fwk_atc.bin PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain ) +target_link_options(fwk_atc.bin PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(fwk_atc.bin PRIVATE $ ascend_protobuf diff --git a/ge/opskernel_manager/ops_kernel_builder_manager.h b/ge/opskernel_manager/ops_kernel_builder_manager.h index 7a95ddfa..8e1dec28 100644 --- a/ge/opskernel_manager/ops_kernel_builder_manager.h +++ b/ge/opskernel_manager/ops_kernel_builder_manager.h @@ -23,7 +23,7 @@ namespace ge { using OpsKernelBuilderPtr = std::shared_ptr; -class OpsKernelBuilderManager { +class GE_FUNC_VISIBILITY OpsKernelBuilderManager { public: ~OpsKernelBuilderManager(); diff --git a/ge/opskernel_manager/ops_kernel_manager.h b/ge/opskernel_manager/ops_kernel_manager.h index b34c483e..19d703e3 100644 --- a/ge/opskernel_manager/ops_kernel_manager.h +++ b/ge/opskernel_manager/ops_kernel_manager.h @@ -41,7 +41,7 @@ using std::vector; namespace ge { using OpsKernelInfoStorePtr = std::shared_ptr; -class OpsKernelManager { +class GE_FUNC_VISIBILITY OpsKernelManager { public: friend class GELib; diff --git a/ge/plugin/engine/CMakeLists.txt b/ge/plugin/engine/CMakeLists.txt index f6353231..e5736b51 100644 --- a/ge/plugin/engine/CMakeLists.txt +++ b/ge/plugin/engine/CMakeLists.txt @@ -9,11 +9,13 @@ add_library(engine SHARED ${SRC_LIST}) target_compile_options(engine PRIVATE -Werror -fno-common + -fvisibility=hidden ) target_compile_definitions(engine PRIVATE REUSE_MEMORY=1 PROTOBUF_INLINE_NOT_IN_HEADERS=0 + FUNC_VISIBILITY ) target_include_directories(engine PRIVATE @@ -32,6 +34,10 @@ target_include_directories(engine PRIVATE ${GE_CODE_DIR}/third_party/fwkacllib/inc ) +target_link_options(engine PRIVATE + -Wl,-Bsymbolic +) + target_link_libraries(engine PRIVATE $ -Wl,--no-as-needed diff --git a/ge/plugin/engine/dnnengines.h b/ge/plugin/engine/dnnengines.h index 4a2a9df5..0633c104 100644 --- a/ge/plugin/engine/dnnengines.h +++ b/ge/plugin/engine/dnnengines.h @@ -25,7 +25,7 @@ #include "plugin/engine/engine_manage.h" namespace ge { -class AICoreDNNEngine : public DNNEngine { +class GE_FUNC_VISIBILITY AICoreDNNEngine : public DNNEngine { public: AICoreDNNEngine() = default; explicit AICoreDNNEngine(const std::string &engine_name); @@ -40,7 +40,7 @@ class AICoreDNNEngine : public DNNEngine { DNNEngineAttribute engine_attribute_; }; -class VectorCoreDNNEngine : public DNNEngine { +class GE_FUNC_VISIBILITY VectorCoreDNNEngine : public DNNEngine { public: VectorCoreDNNEngine() = default; explicit VectorCoreDNNEngine(const std::string &engine_name); @@ -56,7 +56,7 @@ class VectorCoreDNNEngine : public DNNEngine { }; -class AICpuDNNEngine : public DNNEngine { +class GE_FUNC_VISIBILITY AICpuDNNEngine : public DNNEngine { public: AICpuDNNEngine() = default; explicit AICpuDNNEngine(const std::string &engine_name); @@ -71,7 +71,7 @@ class AICpuDNNEngine : public DNNEngine { DNNEngineAttribute engine_attribute_; }; -class AICpuTFDNNEngine : public DNNEngine { +class GE_FUNC_VISIBILITY AICpuTFDNNEngine : public DNNEngine { public: AICpuTFDNNEngine() = default; explicit AICpuTFDNNEngine(const std::string &engine_name); @@ -86,7 +86,7 @@ class AICpuTFDNNEngine : public DNNEngine { DNNEngineAttribute engine_attribute_; }; -class GeLocalDNNEngine : public DNNEngine { +class GE_FUNC_VISIBILITY GeLocalDNNEngine : public DNNEngine { public: GeLocalDNNEngine() = default; explicit GeLocalDNNEngine(const std::string &engine_name); @@ -101,7 +101,7 @@ class GeLocalDNNEngine : public DNNEngine { DNNEngineAttribute engine_attribute_; }; -class HostCpuDNNEngine : public DNNEngine { +class GE_FUNC_VISIBILITY HostCpuDNNEngine : public DNNEngine { public: HostCpuDNNEngine() = default; explicit HostCpuDNNEngine(const std::string &engine_name); @@ -116,7 +116,7 @@ private: DNNEngineAttribute engine_attribute_; }; -class RtsDNNEngine : public DNNEngine { +class GE_FUNC_VISIBILITY RtsDNNEngine : public DNNEngine { public: RtsDNNEngine() = default; explicit RtsDNNEngine(const std::string &engine_name); @@ -131,7 +131,7 @@ class RtsDNNEngine : public DNNEngine { DNNEngineAttribute engine_attribute_; }; -class HcclDNNEngine : public DNNEngine { +class GE_FUNC_VISIBILITY HcclDNNEngine : public DNNEngine { public: HcclDNNEngine() = default; explicit HcclDNNEngine(const std::string &engine_name); diff --git a/ge/plugin/engine/engine_manage.h b/ge/plugin/engine/engine_manage.h index 5203ad3a..7eb88805 100644 --- a/ge/plugin/engine/engine_manage.h +++ b/ge/plugin/engine/engine_manage.h @@ -17,6 +17,20 @@ #ifndef GE_PLUGIN_ENGINE_ENGINE_MANAGE_H_ #define GE_PLUGIN_ENGINE_ENGINE_MANAGE_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include #include @@ -26,7 +40,7 @@ namespace ge { using DNNEnginePtr = std::shared_ptr; -class EngineManager { +class GE_FUNC_VISIBILITY EngineManager { public: static Status RegisterEngine(const std::string &engine_name, DNNEnginePtr engine_ptr); static DNNEnginePtr GetEngine(const std::string &engine_name); @@ -34,7 +48,7 @@ class EngineManager { }; extern "C" { -void GetDNNEngineObjs(std::map &engines); +GE_FUNC_VISIBILITY void GetDNNEngineObjs(std::map &engines); } } // namespace ge #endif // GE_PLUGIN_ENGINE_ENGINE_MANAGE_H_ diff --git a/ge/session/omg.cc b/ge/session/omg.cc index 47073fc0..368b4bec 100755 --- a/ge/session/omg.cc +++ b/ge/session/omg.cc @@ -606,7 +606,7 @@ Status InitDomiOmgContext(const string &input_shape, const string &input_format, } // Analyze the input shape paramete - unordered_map> &shape_map = domi::GetContext().input_dims; + map> &shape_map = domi::GetContext().input_dims; if (!ge::ParseInputShape(input_shape, domi::GetContext().input_dims, domi::GetContext().user_input_dims, is_dynamic_input) || @@ -689,7 +689,7 @@ Status ParseOutNodes(const string &out_nodes) { /// static Status CheckOpNameMap(const ComputeGraphPtr &graph, const std::string &op_conf) { GE_CHECK_NOTNULL(graph); - unordered_map graphNodeTypes; + map graphNodeTypes; for (const NodePtr &node : graph->GetAllNodes()) { auto op_desc = node->GetOpDesc(); if (op_desc == nullptr) { diff --git a/ge/stub/gen_stubapi.py b/ge/stub/gen_stubapi.py index 1476d505..f20d23a8 100644 --- a/ge/stub/gen_stubapi.py +++ b/ge/stub/gen_stubapi.py @@ -16,7 +16,7 @@ logging.basicConfig(stream=sys.stdout, format='[%(asctime)s] [%(lineno)s] %(leve """ this attr is used for symbol table visible """ -GE_ATTR = 'GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY' +GE_ATTR = 'GE_FUNC_VISIBILITY' """ generate stub func body by return type diff --git a/inc/external/ge/ge_api.h b/inc/external/ge/ge_api.h index 9c26ebf8..cd4ca323 100644 --- a/inc/external/ge/ge_api.h +++ b/inc/external/ge/ge_api.h @@ -34,15 +34,15 @@ typedef uint32_t (*pCallBackFunc)(uint32_t graph_id, const std::map &)) -Status GEInitialize(const std::map &options); +ATTRIBUTED_DEPRECATED(GE_FUNC_VISIBILITY Status GEInitialize(const std::map &)) +GE_FUNC_VISIBILITY Status GEInitialize(const std::map &options); -Status GEInitialize(const std::map &options); +GE_FUNC_VISIBILITY Status GEInitialize(const std::map &options); // Finalize GE, release all resources -Status GEFinalize(); +GE_FUNC_VISIBILITY Status GEFinalize(); -class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session { +class GE_FUNC_VISIBILITY Session { public: ATTRIBUTED_DEPRECATED(Session(const std::map &)) explicit Session(const std::map &options); diff --git a/inc/external/ge/ge_api_error_codes.h b/inc/external/ge/ge_api_error_codes.h index e77f817c..274a9784 100644 --- a/inc/external/ge/ge_api_error_codes.h +++ b/inc/external/ge/ge_api_error_codes.h @@ -28,7 +28,7 @@ namespace ge { #define ATTRIBUTED_DEPRECATED(replacement) __declspec(deprecated("Please use " #replacement " instead.")) #endif -class StatusFactory { +class GE_FUNC_VISIBILITY StatusFactory { public: static StatusFactory *Instance() { static StatusFactory instance; @@ -70,7 +70,7 @@ class StatusFactory { std::map err_desc_; }; -class ErrorNoRegisterar { +class GE_FUNC_VISIBILITY 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); } diff --git a/inc/external/ge/ge_error_codes.h b/inc/external/ge/ge_error_codes.h index 041fc7ae..b477a18c 100644 --- a/inc/external/ge/ge_error_codes.h +++ b/inc/external/ge/ge_error_codes.h @@ -17,6 +17,20 @@ #ifndef INC_EXTERNAL_GE_GE_ERROR_CODES_H_ #define INC_EXTERNAL_GE_GE_ERROR_CODES_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #ifdef __cplusplus diff --git a/inc/external/ge/ge_ir_build.h b/inc/external/ge/ge_ir_build.h index afaf42ac..889e2bea 100644 --- a/inc/external/ge/ge_ir_build.h +++ b/inc/external/ge/ge_ir_build.h @@ -17,6 +17,20 @@ #ifndef INC_EXTERNAL_GE_IR_BUILD_H_ #define INC_EXTERNAL_GE_IR_BUILD_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include #include @@ -44,17 +58,17 @@ 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); +ATTRIBUTED_DEPRECATED(GE_FUNC_VISIBILITY graphStatus aclgrphBuildInitialize(std::map &)) +GE_FUNC_VISIBILITY graphStatus aclgrphBuildInitialize(std::map global_options); -graphStatus aclgrphBuildInitialize(std::map &global_options); +GE_FUNC_VISIBILITY graphStatus aclgrphBuildInitialize(std::map &global_options); /** * @ingroup AscendCL * @brief build model.Notice the model is stored in buffer * */ -void aclgrphBuildFinalize(); +GE_FUNC_VISIBILITY void aclgrphBuildFinalize(); /** * @ingroup AscendCL @@ -66,12 +80,12 @@ void aclgrphBuildFinalize(); * @retval GRAPH_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ATTRIBUTED_DEPRECATED(graphStatus aclgrphBuildModel(const ge::Graph &, const std::map &, +ATTRIBUTED_DEPRECATED(GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &, const std::map &, ModelBufferData &)) -graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, +GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, ModelBufferData &model); -graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, +GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, ModelBufferData &model); /** @@ -83,10 +97,10 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &inputs, +GE_FUNC_VISIBILITY graphStatus aclgrphGenerateForOp(const AscendString &op_type, const std::vector &inputs, const std::vector &outputs, Graph &graph); }; // namespace ge diff --git a/inc/framework/common/debug/ge_log.h b/inc/framework/common/debug/ge_log.h index 07cd1664..c1359a20 100644 --- a/inc/framework/common/debug/ge_log.h +++ b/inc/framework/common/debug/ge_log.h @@ -37,7 +37,7 @@ extern "C" { // trace status of log enum TraceStatus { TRACE_INIT = 0, TRACE_RUNNING, TRACE_WAITING, TRACE_STOP }; -class GeLog { +class GE_FUNC_VISIBILITY GeLog { public: static uint64_t GetTid() { #ifdef __GNUC__ diff --git a/inc/framework/common/debug/log.h b/inc/framework/common/debug/log.h index 31281cd6..58cb3693 100644 --- a/inc/framework/common/debug/log.h +++ b/inc/framework/common/debug/log.h @@ -278,7 +278,7 @@ } while (0) template -std::string FmtToStr(const T &t) { +GE_FUNC_VISIBILITY std::string FmtToStr(const T &t) { std::string fmt; std::stringstream st; st << "[" << t << "]"; diff --git a/inc/framework/common/fmk_error_codes.h b/inc/framework/common/fmk_error_codes.h index 358fca04..e910e346 100644 --- a/inc/framework/common/fmk_error_codes.h +++ b/inc/framework/common/fmk_error_codes.h @@ -17,6 +17,20 @@ #ifndef INC_FRAMEWORK_COMMON_FMK_ERROR_CODES_H_ #define INC_FRAMEWORK_COMMON_FMK_ERROR_CODES_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include @@ -38,7 +52,7 @@ const int MODID_OME = 2; // OME module ID const int MODID_CALIBRATION = 3; // Calibration module ID namespace domi { -class StatusFactory { +class GE_FUNC_VISIBILITY StatusFactory { public: static StatusFactory *Instance(); @@ -54,7 +68,7 @@ class StatusFactory { std::map err_desc_; }; -class ErrorNoRegisterar { +class GE_FUNC_VISIBILITY ErrorNoRegisterar { public: ErrorNoRegisterar(uint32_t err, const std::string &desc) { StatusFactory::Instance()->RegisterErrorNo(err, desc); } ~ErrorNoRegisterar() {} diff --git a/inc/framework/common/ge_format_util.h b/inc/framework/common/ge_format_util.h index 9b1d7786..dfceefb8 100644 --- a/inc/framework/common/ge_format_util.h +++ b/inc/framework/common/ge_format_util.h @@ -23,7 +23,7 @@ #include "graph/tensor.h" namespace ge { -class GeFormatUtil { +class GE_FUNC_VISIBILITY GeFormatUtil { public: /// /// @name TransShape diff --git a/inc/framework/common/ge_types.h b/inc/framework/common/ge_types.h index 9ca77f1c..ec5adcba 100644 --- a/inc/framework/common/ge_types.h +++ b/inc/framework/common/ge_types.h @@ -215,7 +215,7 @@ struct ModelInfo { }; // Asynchronous callback interface, implemented by the caller -class ModelListener { +class GE_FUNC_VISIBILITY ModelListener { public: virtual ~ModelListener() {} /// diff --git a/inc/framework/common/gflags_util.h b/inc/framework/common/gflags_util.h index 94d66ffb..6e9ea41b 100644 --- a/inc/framework/common/gflags_util.h +++ b/inc/framework/common/gflags_util.h @@ -17,11 +17,25 @@ #ifndef INC_FRAMEWORK_COMMON_GFLAGS_UTIL_H_ #define INC_FRAMEWORK_COMMON_GFLAGS_UTIL_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include namespace ge { -class GflagsUtils { +class GE_FUNC_VISIBILITY GflagsUtils { public: static bool IsSetCommandTrue(const char *name) { std::string out; diff --git a/inc/framework/common/helper/model_helper.h b/inc/framework/common/helper/model_helper.h index 4a169dda..e25d5d6f 100644 --- a/inc/framework/common/helper/model_helper.h +++ b/inc/framework/common/helper/model_helper.h @@ -28,7 +28,7 @@ #include "model/ge_root_model.h" namespace ge { -class ModelHelper { +class GE_FUNC_VISIBILITY ModelHelper { public: ModelHelper() = default; ~ModelHelper(); diff --git a/inc/framework/common/helper/om_file_helper.h b/inc/framework/common/helper/om_file_helper.h index 98ad55d7..34509b39 100644 --- a/inc/framework/common/helper/om_file_helper.h +++ b/inc/framework/common/helper/om_file_helper.h @@ -51,7 +51,7 @@ struct SaveParam { std::string model_name; }; -class OmFileLoadHelper { +class GE_FUNC_VISIBILITY OmFileLoadHelper { public: Status Init(const ge::ModelData &model); @@ -77,7 +77,7 @@ class OmFileLoadHelper { bool is_inited_{false}; }; -class OmFileSaveHelper { +class GE_FUNC_VISIBILITY OmFileSaveHelper { public: ModelFileHeader &GetModelFileHeader() { return model_header_; } diff --git a/inc/framework/common/l2_cache_optimize.h b/inc/framework/common/l2_cache_optimize.h index c65f67b3..fdb1c8b5 100644 --- a/inc/framework/common/l2_cache_optimize.h +++ b/inc/framework/common/l2_cache_optimize.h @@ -69,7 +69,7 @@ struct RCMemoryBlock { }; // L2Cache optimizer -class L2CacheOptimize { +class GE_FUNC_VISIBILITY L2CacheOptimize { public: explicit L2CacheOptimize(ge::ComputeGraphPtr &graph); ~L2CacheOptimize(); diff --git a/inc/framework/common/op/attr_value_util.h b/inc/framework/common/op/attr_value_util.h index e3803b78..28d48c1d 100644 --- a/inc/framework/common/op/attr_value_util.h +++ b/inc/framework/common/op/attr_value_util.h @@ -17,6 +17,20 @@ #ifndef INC_FRAMEWORK_COMMON_OP_ATTR_VALUE_UTIL_H_ #define INC_FRAMEWORK_COMMON_OP_ATTR_VALUE_UTIL_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include #include @@ -34,127 +48,127 @@ namespace ge { using AttrDefMap = ::google::protobuf::Map<::std::string, ::domi::AttrDef>; using AttrDefPair = ::google::protobuf::MapPair; -void AddOpAttr(const std::string &key, AttrDef &attr, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, AttrDef &attr, OpDef *opdef); // DEFINE_ADD_ATTR_VALUE -void AddOpAttr(const std::string &key, const std::string &value, AttrDefMap *attrs); -void AddOpAttr(const std::string &key, const char *value, AttrDefMap *attrs); -void AddOpAttr(const char *key, const char *value, AttrDefMap *attrs); -void AddOpAttr(const std::string &key, const uint32_t value, AttrDefMap *attrs); -void AddOpAttr(const std::string &key, const int32_t value, AttrDefMap *attrs); -void AddOpAttr(const std::string &key, const int64_t value, AttrDefMap *attrs); -void AddOpAttr(const std::string &key, const float value, AttrDefMap *attrs); -void AddOpAttr(const std::string &key, const double value, AttrDefMap *attrs); -void AddOpAttr(const std::string &key, const bool value, AttrDefMap *attrs); - -void AddOpAttr(const std::string &key, const AttrDef_ListValue &value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const std::string &value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const char *value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttr(const char *key, const char *value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const uint32_t value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const int32_t value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const int64_t value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const float value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const double value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const bool value, AttrDefMap *attrs); + +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const AttrDef_ListValue &value, AttrDefMap *attrs); // DEFINE_ADD_ATTR_VALUE -void AddOpAttr(const std::string &key, const std::string &value, OpDef *opdef); -void AddOpAttr(const std::string &key, const char *value, OpDef *opdef); -void AddOpAttr(const char *key, const char *value, OpDef *opdef); -void AddOpAttr(const std::string &key, const uint32_t value, OpDef *opdef); -void AddOpAttr(const std::string &key, const int32_t value, OpDef *opdef); -void AddOpAttr(const std::string &key, const int64_t value, OpDef *opdef); -void AddOpAttr(const std::string &key, const float value, OpDef *opdef); -void AddOpAttr(const std::string &key, const double value, OpDef *opdef); -void AddOpAttr(const std::string &key, const bool value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const std::string &value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const char *value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const char *key, const char *value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const uint32_t value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const int32_t value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const int64_t value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const float value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const double value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const bool value, OpDef *opdef); -void AddOpAttr(const std::string &key, const AttrDef_ListValue &value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttr(const std::string &key, const AttrDef_ListValue &value, OpDef *opdef); -void AddOpBytesAttr(const std::string &key, const void *value, size_t size, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpBytesAttr(const std::string &key, const void *value, size_t size, OpDef *opdef); // DEFINE_ADD_ATTR_VALUE_LIST -void AddOpAttrList(const std::string &key, const double value, AttrDefMap *attrs); -void AddOpAttrList(const std::string &key, const float value, AttrDefMap *attrs); -void AddOpAttrList(const std::string &key, const uint32_t value, AttrDefMap *attrs); -void AddOpAttrList(const std::string &key, const int32_t value, AttrDefMap *attrs); -void AddOpAttrList(const std::string &key, const std::string value, AttrDefMap *attrs); -void AddOpAttrList(const std::string &key, const double value, OpDef *opdef); -void AddOpAttrList(const std::string &key, const float value, OpDef *opdef); -void AddOpAttrList(const std::string &key, const uint32_t value, OpDef *opdef); -void AddOpAttrList(const std::string &key, const int32_t value, OpDef *opdef); -void AddOpAttrList(const std::string &key, const bool value, OpDef *opdef); -void AddOpAttrList(const std::string &key, const int64_t value, OpDef *opdef); - -void AddOpAttrList(const std::string &key, const std::string &value, OpDef *opdef); - -bool GetOpAttr(const std::string &key, std::string *value, const OpDef *opdef); -bool GetOpAttr(const std::string &key, int32_t *value, const OpDef *opdef); -bool GetOpAttr(const std::string &key, int64_t *value, const OpDef *opdef); -bool GetOpAttr(const std::string &key, uint32_t *value, const OpDef *opdef); -bool GetOpAttr(const std::string &key, float *value, const OpDef *opdef); -bool GetOpAttr(const std::string &key, double *value, const OpDef *opdef); -bool GetOpAttr(const std::string &key, bool *value, const OpDef *opdef); -bool GetOpAttr(const std::string &key, AttrDef_ListValue *value, const OpDef *opdef); - -uint32_t GetOpAttrListSize(const std::string &key, std::string value, const OpDef *opdef); -uint32_t GetOpAttrListSize(const std::string &key, int32_t value, const OpDef *opdef); -uint32_t GetOpAttrListSize(const std::string &key, int64_t value, const OpDef *opdef); -uint32_t GetOpAttrListSize(const std::string &key, uint32_t value, const OpDef *opdef); -uint32_t GetOpAttrListSize(const std::string &key, float value, const OpDef *opdef); -uint32_t GetOpAttrListSize(const std::string &key, double value, const OpDef *opdef); -uint32_t GetOpAttrListSize(const std::string &key, bool value, const OpDef *opdef); - -bool GetBytesAttr(const std::string &key, std::string *value, const OpDef *opdef); -bool GetBytesAttr(const std::string &key, std::string *value, const ModelDef *model_def); - -void AddModelAttr(const std::string &key, const std::string &value, ModelDef *model_def); -void AddModelAttr(const std::string &key, const char *value, ModelDef *model_def); -void AddModelAttr(const char *key, const char *value, ModelDef *model_def); -void AddModelAttr(const std::string &key, const uint32_t value, ModelDef *model_def); -void AddModelAttr(const std::string &key, const int32_t value, ModelDef *model_def); -void AddModelAttr(const std::string &key, const int64_t value, ModelDef *model_def); -void AddModelAttr(const std::string &key, const float value, ModelDef *model_def); -void AddModelAttr(const std::string &key, const double value, ModelDef *model_def); -void AddModelAttr(const std::string &key, const bool value, ModelDef *model_def); -void AddModelAttr(const std::string &key, const void *value, size_t size, ModelDef *model_def); -void AddModelAttr(const std::string &key, const AttrDef_ListValue &value, ModelDef *model_def); - -void AddModelAttrList(const std::string &key, const double value, ModelDef *model_def); -void AddModelAttrList(const std::string &key, const float value, ModelDef *model_def); -void AddModelAttrList(const std::string &key, const uint32_t value, ModelDef *model_def); -void AddModelAttrList(const std::string &key, const int32_t value, ModelDef *model_def); -void AddModelAttrList(const std::string &key, const std::string &value, ModelDef *model_def); - -bool GetModelAttr(const std::string &key, std::string *value, const ModelDef *model_def); -bool GetModelAttr(const std::string &key, int32_t *value, const ModelDef *model_def); -bool GetModelAttr(const std::string &key, int64_t *value, const ModelDef *model_def); -bool GetModelAttr(const std::string &key, uint32_t *value, const ModelDef *model_def); -bool GetModelAttr(const std::string &key, float *value, const ModelDef *model_def); -bool GetModelAttr(const std::string &key, double *value, const ModelDef *model_def); -bool GetModelAttr(const std::string &key, bool *value, const ModelDef *model_def); -bool GetModelAttr(const std::string &key, AttrDef_ListValue *value, const ModelDef *model_def); - -bool HasOpAttr(const OpDef *opdef, const std::string &attr_name); - -void SetAttrDef(const std::string &value, AttrDef *out); -void SetAttrDef(const char *value, AttrDef *out); -void SetAttrDef(const uint32_t value, AttrDef *out); -void SetAttrDef(const int32_t value, AttrDef *out); -void SetAttrDef(const float value, AttrDef *out); -void SetAttrDef(const double value, AttrDef *out); -void SetAttrDef(const bool value, AttrDef *out); -void SetAttrList(const std::string &value, AttrDef *out); -void SetAttrList(const bool value, AttrDef *out); -void SetAttrList(const float value, AttrDef *out); -void SetAttrList(const double value, AttrDef *out); -void SetAttrList(const uint32_t value, AttrDef *out); - -bool GetAttrDefValue(const std::string &key, std::string *value, const AttrDefMap &attr); -bool GetAttrDefValue(const std::string &key, int32_t *value, const AttrDefMap &attr); -bool GetAttrDefValue(const std::string &key, int64_t *value, const AttrDefMap &attr); -bool GetAttrDefValue(const std::string &key, uint32_t *value, const AttrDefMap &attr); -bool GetAttrDefValue(const std::string &key, float *value, const AttrDefMap &attr); -bool GetAttrDefValue(const std::string &key, double *value, const AttrDefMap &attr); -bool GetAttrDefValue(const std::string &key, bool *value, const AttrDefMap &attr); -bool GetAttrDefValue(const std::string &key, AttrDef_ListValue *value, const AttrDefMap &attr); -bool GetAttrDefValue(const std::string &key, NamedAttrs *&value, AttrDefMap *attr); -bool GetAttrDefValue(const std::string &key, const NamedAttrs *&value, const AttrDefMap &attr); - -bool GetAttrDefListValue(const std::string &key, int idx, int32_t *value, const AttrDefMap &attr); -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); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const double value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const float value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const uint32_t value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const int32_t value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const std::string value, AttrDefMap *attrs); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const double value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const float value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const uint32_t value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const int32_t value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const bool value, OpDef *opdef); +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const int64_t value, OpDef *opdef); + +GE_FUNC_VISIBILITY void AddOpAttrList(const std::string &key, const std::string &value, OpDef *opdef); + +GE_FUNC_VISIBILITY bool GetOpAttr(const std::string &key, std::string *value, const OpDef *opdef); +GE_FUNC_VISIBILITY bool GetOpAttr(const std::string &key, int32_t *value, const OpDef *opdef); +GE_FUNC_VISIBILITY bool GetOpAttr(const std::string &key, int64_t *value, const OpDef *opdef); +GE_FUNC_VISIBILITY bool GetOpAttr(const std::string &key, uint32_t *value, const OpDef *opdef); +GE_FUNC_VISIBILITY bool GetOpAttr(const std::string &key, float *value, const OpDef *opdef); +GE_FUNC_VISIBILITY bool GetOpAttr(const std::string &key, double *value, const OpDef *opdef); +GE_FUNC_VISIBILITY bool GetOpAttr(const std::string &key, bool *value, const OpDef *opdef); +GE_FUNC_VISIBILITY bool GetOpAttr(const std::string &key, AttrDef_ListValue *value, const OpDef *opdef); + +GE_FUNC_VISIBILITY uint32_t GetOpAttrListSize(const std::string &key, std::string value, const OpDef *opdef); +GE_FUNC_VISIBILITY uint32_t GetOpAttrListSize(const std::string &key, int32_t value, const OpDef *opdef); +GE_FUNC_VISIBILITY uint32_t GetOpAttrListSize(const std::string &key, int64_t value, const OpDef *opdef); +GE_FUNC_VISIBILITY uint32_t GetOpAttrListSize(const std::string &key, uint32_t value, const OpDef *opdef); +GE_FUNC_VISIBILITY uint32_t GetOpAttrListSize(const std::string &key, float value, const OpDef *opdef); +GE_FUNC_VISIBILITY uint32_t GetOpAttrListSize(const std::string &key, double value, const OpDef *opdef); +GE_FUNC_VISIBILITY uint32_t GetOpAttrListSize(const std::string &key, bool value, const OpDef *opdef); + +GE_FUNC_VISIBILITY bool GetBytesAttr(const std::string &key, std::string *value, const OpDef *opdef); +GE_FUNC_VISIBILITY bool GetBytesAttr(const std::string &key, std::string *value, const ModelDef *model_def); + +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const std::string &value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const char *value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const char *key, const char *value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const uint32_t value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const int32_t value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const int64_t value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const float value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const double value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const bool value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const void *value, size_t size, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttr(const std::string &key, const AttrDef_ListValue &value, ModelDef *model_def); + +GE_FUNC_VISIBILITY void AddModelAttrList(const std::string &key, const double value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttrList(const std::string &key, const float value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttrList(const std::string &key, const uint32_t value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttrList(const std::string &key, const int32_t value, ModelDef *model_def); +GE_FUNC_VISIBILITY void AddModelAttrList(const std::string &key, const std::string &value, ModelDef *model_def); + +GE_FUNC_VISIBILITY bool GetModelAttr(const std::string &key, std::string *value, const ModelDef *model_def); +GE_FUNC_VISIBILITY bool GetModelAttr(const std::string &key, int32_t *value, const ModelDef *model_def); +GE_FUNC_VISIBILITY bool GetModelAttr(const std::string &key, int64_t *value, const ModelDef *model_def); +GE_FUNC_VISIBILITY bool GetModelAttr(const std::string &key, uint32_t *value, const ModelDef *model_def); +GE_FUNC_VISIBILITY bool GetModelAttr(const std::string &key, float *value, const ModelDef *model_def); +GE_FUNC_VISIBILITY bool GetModelAttr(const std::string &key, double *value, const ModelDef *model_def); +GE_FUNC_VISIBILITY bool GetModelAttr(const std::string &key, bool *value, const ModelDef *model_def); +GE_FUNC_VISIBILITY bool GetModelAttr(const std::string &key, AttrDef_ListValue *value, const ModelDef *model_def); + +GE_FUNC_VISIBILITY bool HasOpAttr(const OpDef *opdef, const std::string &attr_name); + +GE_FUNC_VISIBILITY void SetAttrDef(const std::string &value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrDef(const char *value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrDef(const uint32_t value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrDef(const int32_t value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrDef(const float value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrDef(const double value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrDef(const bool value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrList(const std::string &value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrList(const bool value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrList(const float value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrList(const double value, AttrDef *out); +GE_FUNC_VISIBILITY void SetAttrList(const uint32_t value, AttrDef *out); + +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, std::string *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, int32_t *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, int64_t *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, uint32_t *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, float *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, double *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, bool *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, AttrDef_ListValue *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, NamedAttrs *&value, AttrDefMap *attr); +GE_FUNC_VISIBILITY bool GetAttrDefValue(const std::string &key, const NamedAttrs *&value, const AttrDefMap &attr); + +GE_FUNC_VISIBILITY bool GetAttrDefListValue(const std::string &key, int idx, int32_t *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefListValue(const std::string &key, int idx, uint32_t *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefListValue(const std::string &key, int idx, float *value, const AttrDefMap &attr); +GE_FUNC_VISIBILITY bool GetAttrDefListValue(const std::string &key, int idx, double *value, const AttrDefMap &attr); } #endif // INC_FRAMEWORK_COMMON_OP_ATTR_VALUE_UTIL_H_ diff --git a/inc/framework/common/op/ge_op_utils.h b/inc/framework/common/op/ge_op_utils.h index aa50c8a1..89529520 100644 --- a/inc/framework/common/op/ge_op_utils.h +++ b/inc/framework/common/op/ge_op_utils.h @@ -34,36 +34,36 @@ namespace ge { using domi::Status; // Add Sub Mul -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t ADD_INPUT_NUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t SUB_INPUT_NUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t MUL_INPUT_NUM; +GE_FUNC_VISIBILITY extern const uint32_t ADD_INPUT_NUM; +GE_FUNC_VISIBILITY extern const uint32_t SUB_INPUT_NUM; +GE_FUNC_VISIBILITY extern const uint32_t MUL_INPUT_NUM; // Permute -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const int32_t PERMUTE_ORDER_NUM; +GE_FUNC_VISIBILITY extern const int32_t PERMUTE_ORDER_NUM; // Ssd PriroBox -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const double SSD_PRIORBOX_ASPECT_RATIO_VALUE; +GE_FUNC_VISIBILITY extern const double SSD_PRIORBOX_ASPECT_RATIO_VALUE; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t STRIDEDSLICE_INPUT_NUM; +GE_FUNC_VISIBILITY extern const uint32_t STRIDEDSLICE_INPUT_NUM; // Switch -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t SWITCH_INPUT_NUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t SWITCH_OUTPUT_NUM; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t SWITCH_FALSE_OUTPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t SWITCH_TRUE_OUTPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t SWITCH_DATA_INPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t SWITCH_PRED_INPUT; +GE_FUNC_VISIBILITY extern const uint32_t SWITCH_INPUT_NUM; +GE_FUNC_VISIBILITY extern const uint32_t SWITCH_OUTPUT_NUM; +GE_FUNC_VISIBILITY extern const uint32_t SWITCH_FALSE_OUTPUT; +GE_FUNC_VISIBILITY extern const uint32_t SWITCH_TRUE_OUTPUT; +GE_FUNC_VISIBILITY extern const uint32_t SWITCH_DATA_INPUT; +GE_FUNC_VISIBILITY extern const uint32_t SWITCH_PRED_INPUT; // FunctionOp -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t IF_COND_INPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t FOR_START_INPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t FOR_LIMIT_INPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t FOR_DELTA_INPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t FOR_DATA_INPUT; +GE_FUNC_VISIBILITY extern const uint32_t IF_COND_INPUT; +GE_FUNC_VISIBILITY extern const uint32_t FOR_START_INPUT; +GE_FUNC_VISIBILITY extern const uint32_t FOR_LIMIT_INPUT; +GE_FUNC_VISIBILITY extern const uint32_t FOR_DELTA_INPUT; +GE_FUNC_VISIBILITY extern const uint32_t FOR_DATA_INPUT; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const int NORMAL_TENSOR_SIZE; +GE_FUNC_VISIBILITY extern const int NORMAL_TENSOR_SIZE; -class OpUtils { +class GE_FUNC_VISIBILITY OpUtils { public: /// /// @ingroup domi_ome diff --git a/inc/framework/common/op_types.h b/inc/framework/common/op_types.h index 4555d5c3..fa41c1b6 100644 --- a/inc/framework/common/op_types.h +++ b/inc/framework/common/op_types.h @@ -21,7 +21,7 @@ #include namespace ge { -class OpTypeContainer { +class GE_FUNC_VISIBILITY OpTypeContainer { public: static OpTypeContainer *Instance() { static OpTypeContainer instance; @@ -43,7 +43,7 @@ class OpTypeContainer { std::set op_type_list_; }; -class OpTypeRegistrar { +class GE_FUNC_VISIBILITY OpTypeRegistrar { public: explicit OpTypeRegistrar(const std::string &op_type) { OpTypeContainer::Instance()->Register(op_type); } ~OpTypeRegistrar() {} diff --git a/inc/framework/common/profiling/ge_profiling.h b/inc/framework/common/profiling/ge_profiling.h index 83699754..7017aca3 100644 --- a/inc/framework/common/profiling/ge_profiling.h +++ b/inc/framework/common/profiling/ge_profiling.h @@ -38,9 +38,9 @@ struct ProfCommandHandleData { 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); +GE_FUNC_VISIBILITY ge::Status RegProfCtrlCallback(MsprofCtrlCallback func); +GE_FUNC_VISIBILITY ge::Status RegProfSetDeviceCallback(MsprofSetDeviceCallback func); +GE_FUNC_VISIBILITY ge::Status RegProfReporterCallback(MsprofReporterCallback func); +GE_FUNC_VISIBILITY ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t len); #endif // INC_FRAMEWORK_COMMON_GE_PROFILING_H_ diff --git a/inc/framework/common/profiling/ge_runner_profiling.h b/inc/framework/common/profiling/ge_runner_profiling.h index d2eff767..011797a3 100644 --- a/inc/framework/common/profiling/ge_runner_profiling.h +++ b/inc/framework/common/profiling/ge_runner_profiling.h @@ -19,6 +19,6 @@ #include "profiling/ge_profiling.h" -bool IsInitialize(); +GE_FUNC_VISIBILITY bool IsInitialize(); #endif // INC_FRAMEWORK_COMMON_GE_RUNNER_PROFILING_H_ diff --git a/inc/framework/common/scope_guard.h b/inc/framework/common/scope_guard.h index 001a0e75..62ae4b6d 100644 --- a/inc/framework/common/scope_guard.h +++ b/inc/framework/common/scope_guard.h @@ -29,7 +29,7 @@ #define GE_DISMISS_GUARD(var) make_guard_##var.Dismiss() namespace ge { -class ScopeGuard { +class GE_FUNC_VISIBILITY ScopeGuard { public: // Noncopyable ScopeGuard(ScopeGuard const &) = delete; diff --git a/inc/framework/common/string_util.h b/inc/framework/common/string_util.h index de19807c..f0368363 100644 --- a/inc/framework/common/string_util.h +++ b/inc/framework/common/string_util.h @@ -17,6 +17,20 @@ #ifndef INC_FRAMEWORK_COMMON_STRING_UTIL_H_ #define INC_FRAMEWORK_COMMON_STRING_UTIL_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #include @@ -27,7 +41,7 @@ #include namespace ge { -class StringUtils { +class GE_FUNC_VISIBILITY StringUtils { public: static std::string &Ltrim(std::string &s) { #if __cplusplus >= 201103L diff --git a/inc/framework/common/util.h b/inc/framework/common/util.h index 42ab3868..525cf3ea 100644 --- a/inc/framework/common/util.h +++ b/inc/framework/common/util.h @@ -237,7 +237,7 @@ const int32_t DOMI_MAX_PATH_LEN = 256; /// @return true success /// @return false fail /// -bool ReadProtoFromBinaryFile(const char *file, Message *proto); +GE_FUNC_VISIBILITY bool ReadProtoFromBinaryFile(const char *file, Message *proto); /// /// @ingroup domi_common @@ -248,7 +248,7 @@ bool ReadProtoFromBinaryFile(const char *file, Message *proto); /// @return true success /// @return false fail /// -bool ReadProtoFromArray(const void *data, int size, Message *proto); +GE_FUNC_VISIBILITY bool ReadProtoFromArray(const void *data, int size, Message *proto); /// /// @ingroup domi_proto @@ -258,9 +258,9 @@ bool ReadProtoFromArray(const void *data, int size, Message *proto); /// @return true success /// @return false fail /// -bool ReadProtoFromText(const char *file, google::protobuf::Message *message); +GE_FUNC_VISIBILITY bool ReadProtoFromText(const char *file, google::protobuf::Message *message); -bool ReadProtoFromMem(const char *data, int size, google::protobuf::Message *message); +GE_FUNC_VISIBILITY bool ReadProtoFromMem(const char *data, int size, google::protobuf::Message *message); /// /// @ingroup: domi_common @@ -268,7 +268,7 @@ bool ReadProtoFromMem(const char *data, int size, google::protobuf::Message *mes /// @param [in] input_file: path of file /// @return long: File length. If the file length fails to be obtained, the value -1 is returned. /// -extern long GetFileLength(const std::string &input_file); +GE_FUNC_VISIBILITY extern long GetFileLength(const std::string &input_file); /// /// @ingroup domi_common @@ -279,9 +279,9 @@ extern long GetFileLength(const std::string &input_file); /// @return false fail /// @return true success /// -bool ReadBytesFromBinaryFile(const char *file_name, char **buffer, int &length); +GE_FUNC_VISIBILITY bool ReadBytesFromBinaryFile(const char *file_name, char **buffer, int &length); -bool ReadBytesFromBinaryFile(const char *file_name, std::vector &buffer); +GE_FUNC_VISIBILITY bool ReadBytesFromBinaryFile(const char *file_name, std::vector &buffer); /// /// @ingroup domi_common @@ -290,14 +290,14 @@ bool ReadBytesFromBinaryFile(const char *file_name, std::vector &buffer); /// @return 0 success /// @return -1 fail /// -extern int CreateDirectory(const std::string &directory_path); +GE_FUNC_VISIBILITY extern int CreateDirectory(const std::string &directory_path); /// /// @ingroup domi_common /// @brief Obtains the current time string. /// @return Time character string in the format : %Y%m%d%H%M%S, eg: 20171011083555 /// -std::string CurrentTimeInStr(); +GE_FUNC_VISIBILITY std::string CurrentTimeInStr(); /// /// @ingroup domi_common @@ -306,7 +306,7 @@ std::string CurrentTimeInStr(); /// @return string /// template -std::string ToString(std::vector &v) { +GE_FUNC_VISIBILITY std::string ToString(std::vector &v) { std::stringstream ss; ss << "["; for (T x : v) { @@ -326,7 +326,7 @@ std::string ToString(std::vector &v) { /// @return string /// template -std::string ToString(const google::protobuf::RepeatedField &rpd_field) { +GE_FUNC_VISIBILITY std::string ToString(const google::protobuf::RepeatedField &rpd_field) { std::stringstream ss; ss << "["; for (T x : rpd_field) { @@ -345,7 +345,7 @@ std::string ToString(const google::protobuf::RepeatedField &rpd_field) { /// @return Timestamp, in microseconds (US) /// /// -uint64_t GetCurrentTimestamp(); +GE_FUNC_VISIBILITY uint64_t GetCurrentTimestamp(); /// /// @ingroup domi_common @@ -353,7 +353,7 @@ uint64_t GetCurrentTimestamp(); /// @return Timestamp, in seconds (US) /// /// -uint32_t GetCurrentSecondTimestap(); +GE_FUNC_VISIBILITY uint32_t GetCurrentSecondTimestap(); /// /// @ingroup domi_common @@ -362,7 +362,7 @@ uint32_t GetCurrentSecondTimestap(); /// @param [in] b /// @return false: true: The result is within the normal int64 range. /// -bool CheckInt64MulOverflow(int64_t a, int64_t b); +GE_FUNC_VISIBILITY bool CheckInt64MulOverflow(int64_t a, int64_t b); /// /// @ingroup domi_common @@ -370,7 +370,7 @@ bool CheckInt64MulOverflow(int64_t a, int64_t b); /// @param [in] path of input file /// @param [out] Absolute path of a file. If the absolute path cannot be obtained, an empty string is returned /// -std::string RealPath(const char *path); +GE_FUNC_VISIBILITY std::string RealPath(const char *path); /// /// @ingroup domi_common @@ -381,7 +381,7 @@ std::string RealPath(const char *path); /// @param [in] file_path path of input file /// @param [out] result /// -bool CheckInputPathValid(const std::string &file_path, const std::string &atc_param = ""); +GE_FUNC_VISIBILITY bool CheckInputPathValid(const std::string &file_path, const std::string &atc_param = ""); /// /// @ingroup domi_common @@ -389,7 +389,7 @@ bool CheckInputPathValid(const std::string &file_path, const std::string &atc_pa /// @param [in] file_path path of output file /// @param [out] result /// -bool CheckOutputPathValid(const std::string &file_path, const std::string &atc_param = ""); +GE_FUNC_VISIBILITY bool CheckOutputPathValid(const std::string &file_path, const std::string &atc_param = ""); /// /// @ingroup domi_common @@ -397,7 +397,7 @@ bool CheckOutputPathValid(const std::string &file_path, const std::string &atc_p /// @param [in] filePath file path /// @param [out] result /// -bool ValidateStr(const std::string &filePath, const std::string &mode); +GE_FUNC_VISIBILITY bool ValidateStr(const std::string &filePath, const std::string &mode); /// /// @ingroup domi_common @@ -405,7 +405,7 @@ bool ValidateStr(const std::string &filePath, const std::string &mode); /// @param [in] file_path file path /// @param [out] result /// -bool IsValidFile(const char *file_path); +GE_FUNC_VISIBILITY bool IsValidFile(const char *file_path); /// /// @ingroup domi_common @@ -415,7 +415,7 @@ bool IsValidFile(const char *file_path); /// @return 0 success /// @return -1 fail /// -Status CheckPath(const char *path, size_t length); +GE_FUNC_VISIBILITY Status CheckPath(const char *path, size_t length); } // namespace ge #endif // INC_FRAMEWORK_COMMON_UTIL_H_ diff --git a/inc/framework/engine/dnnengine.h b/inc/framework/engine/dnnengine.h index 1bcf5e07..8a0f3b65 100644 --- a/inc/framework/engine/dnnengine.h +++ b/inc/framework/engine/dnnengine.h @@ -45,7 +45,7 @@ struct DNNEngineAttribute { Format engine_output_format; }; -class DNNEngine { +class GE_FUNC_VISIBILITY DNNEngine { public: virtual ~DNNEngine() = default; virtual Status Initialize(const std::map &options) = 0; diff --git a/inc/framework/executor/ge_executor.h b/inc/framework/executor/ge_executor.h index 3136e172..c546f63d 100644 --- a/inc/framework/executor/ge_executor.h +++ b/inc/framework/executor/ge_executor.h @@ -46,7 +46,7 @@ struct RunModelData { std::vector dynamic_dims; // Dynamic dims scene, set dynamic dims, not supported by default:empty }; -class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { +class GE_FUNC_VISIBILITY GeExecutor { public: GeExecutor(); ~GeExecutor() = default; diff --git a/inc/framework/generator/ge_generator.h b/inc/framework/generator/ge_generator.h index e0904965..2d7d007b 100644 --- a/inc/framework/generator/ge_generator.h +++ b/inc/framework/generator/ge_generator.h @@ -31,7 +31,7 @@ #include "omg/omg_inner_types.h" namespace ge { -class GeGenerator { +class GE_FUNC_VISIBILITY GeGenerator { public: static GeGenerator &GetInstance() { static GeGenerator Instance; diff --git a/inc/framework/generator/generator_api.h b/inc/framework/generator/generator_api.h index 71c6832e..d44edd0c 100644 --- a/inc/framework/generator/generator_api.h +++ b/inc/framework/generator/generator_api.h @@ -17,6 +17,20 @@ #ifndef INC_FRAMEWORK_GENERATOR_GENERATOR_API_H_ #define INC_FRAMEWORK_GENERATOR_GENERATOR_API_H_ +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + #include #ifdef __cplusplus @@ -40,7 +54,7 @@ typedef void *OpTensor_t; /// @param [in] om_file: file name for the om to save. /// @return 0 for success / others for fail /// -extern Status_t OpTaskGernerator(const char *op_type, const OpTensor_t *in_tensor, int in_num, +GE_FUNC_VISIBILITY extern Status_t OpTaskGernerator(const char *op_type, const OpTensor_t *in_tensor, int in_num, const OpTensor_t *out_tensor, int out_num, const OpAttr_t attr, const char *om_file); /// @@ -52,7 +66,7 @@ extern Status_t OpTaskGernerator(const char *op_type, const OpTensor_t *in_tenso /// @param [in] num: number of shape. /// @return OpTensor_t for success / nullptr for failure /// -extern OpTensor_t OpTensorCreate(int format, int datatype, const int64_t *shape, int num); +GE_FUNC_VISIBILITY extern OpTensor_t OpTensorCreate(int format, int datatype, const int64_t *shape, int num); /// /// @ingroup ge @@ -61,7 +75,7 @@ extern OpTensor_t OpTensorCreate(int format, int datatype, const int64_t *shape, /// @param [out] none /// @return 0 for success / others for failure. /// -extern Status_t OpTensorDestroy(OpTensor_t tensor); +GE_FUNC_VISIBILITY extern Status_t OpTensorDestroy(OpTensor_t tensor); /// /// @ingroup ge @@ -70,7 +84,7 @@ extern Status_t OpTensorDestroy(OpTensor_t tensor); /// @param [out] none /// @return OpAttr_t for success / nullptr for failure. /// -extern OpAttr_t OpAttrCreate(); +GE_FUNC_VISIBILITY extern OpAttr_t OpAttrCreate(); /// /// @ingroup ge @@ -79,7 +93,7 @@ extern OpAttr_t OpAttrCreate(); /// @param [out] none /// @return 0 for success / others for failure. /// -extern Status_t OpAttrDestroy(OpAttr_t attr); +GE_FUNC_VISIBILITY extern Status_t OpAttrDestroy(OpAttr_t attr); /// /// @ingroup ge @@ -89,7 +103,7 @@ extern Status_t OpAttrDestroy(OpAttr_t attr); /// @param [in] value: attributed value. /// @return 0 for success / others for failure. /// -extern Status_t SetAttrBool(OpAttr_t attr, const char *name, bool value); +GE_FUNC_VISIBILITY extern Status_t SetAttrBool(OpAttr_t attr, const char *name, bool value); /// /// @ingroup ge @@ -99,7 +113,7 @@ extern Status_t SetAttrBool(OpAttr_t attr, const char *name, bool value); /// @param [in] value: attribute value. /// @return 0 for success / others for failure. /// -extern Status_t SetAttrInt(OpAttr_t attr, const char *name, int64_t value); +GE_FUNC_VISIBILITY extern Status_t SetAttrInt(OpAttr_t attr, const char *name, int64_t value); /// /// @ingroup ge @@ -109,7 +123,7 @@ extern Status_t SetAttrInt(OpAttr_t attr, const char *name, int64_t value); /// @param [in] value: attribute value. /// @return 0 for success / others for failure. /// -extern Status_t SetAttrFloat(OpAttr_t attr, const char *name, float value); +GE_FUNC_VISIBILITY extern Status_t SetAttrFloat(OpAttr_t attr, const char *name, float value); /// /// @ingroup ge @@ -119,7 +133,7 @@ extern Status_t SetAttrFloat(OpAttr_t attr, const char *name, float value); /// @param [in] value: attribute value (can`t be nullptr, end with '\0'). /// @return 0 for success / others for failure. /// -extern Status_t SetAttrString(OpAttr_t attr, const char *name, const char *value); +GE_FUNC_VISIBILITY extern Status_t SetAttrString(OpAttr_t attr, const char *name, const char *value); /// /// @ingroup ge @@ -130,7 +144,7 @@ extern Status_t SetAttrString(OpAttr_t attr, const char *name, const char *value /// @param [in] num: number of value array. /// @return 0 for success / others for failure. /// -extern Status_t SetAttrBoolList(OpAttr_t attr, const char *name, const bool *value, int num); +GE_FUNC_VISIBILITY extern Status_t SetAttrBoolList(OpAttr_t attr, const char *name, const bool *value, int num); /// /// @ingroup ge @@ -141,7 +155,7 @@ extern Status_t SetAttrBoolList(OpAttr_t attr, const char *name, const bool *val /// @param [in] num: number of value array. /// @return 0 for success / others for failure. /// -extern Status_t SetAttrIntList(OpAttr_t attr, const char *name, const int64_t *value, int num); +GE_FUNC_VISIBILITY extern Status_t SetAttrIntList(OpAttr_t attr, const char *name, const int64_t *value, int num); /// /// @ingroup ge @@ -152,7 +166,7 @@ extern Status_t SetAttrIntList(OpAttr_t attr, const char *name, const int64_t *v /// @param [in] num: number of value array. /// @return 0 for success / others for failure. /// -extern Status_t SetAttrFloatList(OpAttr_t attr, const char *name, const float *value, int num); +GE_FUNC_VISIBILITY extern Status_t SetAttrFloatList(OpAttr_t attr, const char *name, const float *value, int num); /// /// @ingroup ge @@ -163,7 +177,7 @@ extern Status_t SetAttrFloatList(OpAttr_t attr, const char *name, const float *v /// @param [in] num: number of value array. /// @return 0 for success / others for failure. /// -extern Status_t SetAttrStringList(OpAttr_t attr, const char *name, const char **value, int num); +GE_FUNC_VISIBILITY extern Status_t SetAttrStringList(OpAttr_t attr, const char *name, const char **value, int num); #ifdef __cplusplus } diff --git a/inc/framework/memory/memory_api.h b/inc/framework/memory/memory_api.h index d8b06125..34e596a2 100644 --- a/inc/framework/memory/memory_api.h +++ b/inc/framework/memory/memory_api.h @@ -46,26 +46,26 @@ struct TensorInfo { /// \param size [in] rdma pool memory size to be allocated. /// \param mem_type [in] memory type for rdma pool. /// \return Status result of function -Status InitRdmaPool(size_t size, rtMemType_t mem_type = RT_MEMORY_HBM); +GE_FUNC_VISIBILITY Status InitRdmaPool(size_t size, rtMemType_t mem_type = RT_MEMORY_HBM); /// /// \param var_info [in] host variable addr infos. /// \param mem_type [in] memory type for rdma pool. /// \return Status result of function -Status RdmaRemoteRegister(const std::vector &var_info, rtMemType_t mem_type = RT_MEMORY_HBM); +GE_FUNC_VISIBILITY 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); +GE_FUNC_VISIBILITY 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. /// \param var_size [out] var_size memory_size of host variable. /// \return Status result of function -Status GetVarBaseAddrAndSize(const std::string &var_name, uint64_t &base_addr, uint64_t &var_size); +GE_FUNC_VISIBILITY Status GetVarBaseAddrAndSize(const std::string &var_name, uint64_t &base_addr, uint64_t &var_size); } // namespace ge #endif // INC_FRAMEWORK_MEMORY_MEMORY_API_H_ diff --git a/inc/framework/memory/memory_assigner.h b/inc/framework/memory/memory_assigner.h index 4552fa7c..f5837b3a 100644 --- a/inc/framework/memory/memory_assigner.h +++ b/inc/framework/memory/memory_assigner.h @@ -24,7 +24,7 @@ namespace ge { const int64_t MEM_ALIGN_SIZE = 512; -class MemoryAssigner { +class GE_FUNC_VISIBILITY MemoryAssigner { public: explicit MemoryAssigner(ge::ComputeGraphPtr compute_graph) : compute_graph_(std::move(compute_graph)) {} virtual ~MemoryAssigner() = default; diff --git a/inc/framework/omg/omg.h b/inc/framework/omg/omg.h index 62332b8d..eb25f919 100644 --- a/inc/framework/omg/omg.h +++ b/inc/framework/omg/omg.h @@ -43,7 +43,7 @@ namespace ge { * @brief init omg context * @return void */ -Status InitDomiOmgContext(const string &input_shape, const string &input_format, const string &net_format, +GE_FUNC_VISIBILITY Status InitDomiOmgContext(const string &input_shape, const string &input_format, const string &net_format, bool is_dynamic_input); /** @@ -61,7 +61,7 @@ Status InitDomiOmgContext(const string &input_shape, const string &input_format, * @param [in] atc_params multiply atc params * @return Status result code */ -Status ParseGraph(ge::Graph &graph, const std::map &atc_params, const char *model_file, +GE_FUNC_VISIBILITY Status ParseGraph(ge::Graph &graph, const std::map &atc_params, const char *model_file, const char *weights_file, domi::FrameworkType type, const char *op_conf = nullptr, const char *target = nullptr, RunMode run_mode = GEN_OM_MODEL, bool is_dynamic_input = false); @@ -73,9 +73,9 @@ Status ParseGraph(ge::Graph &graph, const std::map &atc_params, * @param [key] encrypted key * @return Status result code */ -Status ConvertOm(const char *model_file, const char *json_file, bool is_covert_to_json); +GE_FUNC_VISIBILITY Status ConvertOm(const char *model_file, const char *json_file, bool is_covert_to_json); -Status ConvertPbtxtToJson(const char *model_file, const char *json_file); +GE_FUNC_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const char *json_file); /** * @ingroup domi_omg * @brief convert the model file in protobuf format into a JSON file. @@ -85,26 +85,26 @@ Status ConvertPbtxtToJson(const char *model_file, const char *json_file); * @param [key] encrypted key * @return Status result code */ -Status ConvertFwkModelToJson(domi::FrameworkType framework, const char *model_file, const char *json_file); +GE_FUNC_VISIBILITY Status ConvertFwkModelToJson(domi::FrameworkType framework, const char *model_file, const char *json_file); -void GetGroupName(ge::proto::ModelDef &model); +GE_FUNC_VISIBILITY void GetGroupName(ge::proto::ModelDef &model); -void FindParserSo(const string &path, vector &fileList, string &caffe_parser_path); +GE_FUNC_VISIBILITY void FindParserSo(const string &path, vector &fileList, string &caffe_parser_path); -Status DumpInfershapeJson(const ge::Graph &graph, const char *json_file); +GE_FUNC_VISIBILITY 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); +GE_FUNC_VISIBILITY Status SetOutputNodeInfo(ge::Graph &graph, const std::string &output_type, const std::string &output_format); -Status GetOutputLeaf(ge::NodePtr node, std::vector> &output_nodes_info); +GE_FUNC_VISIBILITY Status GetOutputLeaf(ge::NodePtr node, std::vector> &output_nodes_info); -void GetOutputNodesNameAndIndex(std::vector> &output_nodes_info, +GE_FUNC_VISIBILITY void GetOutputNodesNameAndIndex(std::vector> &output_nodes_info, std::vector &output_nodes_name); -void UpdateOmgCtxWithParserCtx(); +GE_FUNC_VISIBILITY void UpdateOmgCtxWithParserCtx(); -void UpdateParserCtxWithOmgCtx(); +GE_FUNC_VISIBILITY void UpdateParserCtxWithOmgCtx(); -void PrintModelInfo(ge::proto::ModelDef *model_def); +GE_FUNC_VISIBILITY void PrintModelInfo(ge::proto::ModelDef *model_def); } // namespace ge namespace domi { @@ -113,7 +113,7 @@ namespace domi { * @brief get omg context * @return reference of OmgContext */ -ge::OmgContext &GetContext(); +GE_FUNC_VISIBILITY ge::OmgContext &GetContext(); } // namespace domi #endif // INC_FRAMEWORK_OMG_OMG_H_ diff --git a/inc/framework/omg/omg_inner_types.h b/inc/framework/omg/omg_inner_types.h index 1049b6b5..54c9ab4a 100644 --- a/inc/framework/omg/omg_inner_types.h +++ b/inc/framework/omg/omg_inner_types.h @@ -83,7 +83,7 @@ struct OmgContext { // user-designate input dims std::vector>> user_input_dims; // global input dims - std::unordered_map> input_dims; + std::map> input_dims; // resolve the mapping between operators with the same name and corresponding network. format e.g. // Detectionoutput:SsdDetectiontOutput @@ -132,7 +132,7 @@ namespace domi { * @brief get OMG context * @return OmgContext context */ -ge::OmgContext &GetContext(); +GE_FUNC_VISIBILITY ge::OmgContext &GetContext(); struct TEBinInfo { // It is obsolete. It will be automatically obtained from the binfilename field of the JSON file later. diff --git a/inc/framework/omg/parser/model_parser.h b/inc/framework/omg/parser/model_parser.h index 9eda685d..8fae5556 100644 --- a/inc/framework/omg/parser/model_parser.h +++ b/inc/framework/omg/parser/model_parser.h @@ -37,7 +37,7 @@ using Status = domi::Status; namespace domi { using GetGraphCallback = std::function( const google::protobuf::Message *root_proto, const std::string &graph)>; -class ModelParser { +class GE_FUNC_VISIBILITY ModelParser { public: ModelParser() {} diff --git a/inc/framework/omg/parser/op_parser.h b/inc/framework/omg/parser/op_parser.h index 087bad32..70bec218 100644 --- a/inc/framework/omg/parser/op_parser.h +++ b/inc/framework/omg/parser/op_parser.h @@ -34,7 +34,7 @@ namespace ge { * @brief Used to analyze operator information * */ -class OpParser { +class GE_FUNC_VISIBILITY OpParser { public: /** * @ingroup domi_omg diff --git a/inc/framework/omg/parser/parser_api.h b/inc/framework/omg/parser/parser_api.h index 382bdfde..6c223665 100644 --- a/inc/framework/omg/parser/parser_api.h +++ b/inc/framework/omg/parser/parser_api.h @@ -24,8 +24,8 @@ namespace ge { // Initialize parser -Status ParserInitialize(const std::map& options); +GE_FUNC_VISIBILITY Status ParserInitialize(const std::map& options); // Finalize parser, release all resources -Status ParserFinalize(); +GE_FUNC_VISIBILITY Status ParserFinalize(); } // namespace ge #endif // INC_FRAMEWORK_OMG_PARSER_PARSER_API_H_ diff --git a/inc/framework/omg/parser/parser_factory.h b/inc/framework/omg/parser/parser_factory.h index 4845606f..9d6590c0 100644 --- a/inc/framework/omg/parser/parser_factory.h +++ b/inc/framework/omg/parser/parser_factory.h @@ -33,7 +33,7 @@ class ModelParser; typedef std::shared_ptr (*MODEL_PARSER_CREATOR_FUN)(void); // Create modelparser for different frameworks -class ModelParserFactory { +class GE_FUNC_VISIBILITY ModelParserFactory { public: static ModelParserFactory *Instance(); @@ -61,7 +61,7 @@ class ModelParserFactory { std::map creator_map_; }; // end class ModelParserFactory -class ModelParserRegisterar { +class GE_FUNC_VISIBILITY ModelParserRegisterar { public: ModelParserRegisterar(const domi::FrameworkType type, MODEL_PARSER_CREATOR_FUN fun) { ModelParserFactory::Instance()->RegisterCreator(type, fun); @@ -85,7 +85,7 @@ class ModelParserRegisterar { typedef std::shared_ptr (*WEIGHTS_PARSER_CREATOR_FUN)(void); // Create weightsparser for different frameworks -class WeightsParserFactory { +class GE_FUNC_VISIBILITY WeightsParserFactory { public: static WeightsParserFactory *Instance(); @@ -113,7 +113,7 @@ class WeightsParserFactory { std::map creator_map_; }; // end class WeightsParserFactory -class WeightsParserRegisterar { +class GE_FUNC_VISIBILITY WeightsParserRegisterar { public: WeightsParserRegisterar(const domi::FrameworkType type, WEIGHTS_PARSER_CREATOR_FUN fun) { WeightsParserFactory::Instance()->RegisterCreator(type, fun); diff --git a/inc/framework/omg/parser/parser_inner_ctx.h b/inc/framework/omg/parser/parser_inner_ctx.h index 5d91bd46..b23da53f 100644 --- a/inc/framework/omg/parser/parser_inner_ctx.h +++ b/inc/framework/omg/parser/parser_inner_ctx.h @@ -34,7 +34,7 @@ struct ParserContext { std::vector output_formats; // user-designate input dims std::vector>> user_input_dims; - std::unordered_map> input_dims; + std::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; @@ -68,7 +68,7 @@ struct ParserContext { std::string enable_scope_fusion_passes; }; -ParserContext &GetParserContext(); +GE_FUNC_VISIBILITY ParserContext &GetParserContext(); } // namespace ge #endif // INC_FRAMEWORK_OMG_PARSER_PARSER_INNER_CONTEXT_H_ diff --git a/inc/framework/omg/parser/weights_parser.h b/inc/framework/omg/parser/weights_parser.h index 1b5216b3..e4436044 100644 --- a/inc/framework/omg/parser/weights_parser.h +++ b/inc/framework/omg/parser/weights_parser.h @@ -34,7 +34,7 @@ namespace domi { * @brief Weight information resolver * */ -class WeightsParser { +class GE_FUNC_VISIBILITY WeightsParser { public: /** * @ingroup domi_omg diff --git a/inc/framework/omg/version.h b/inc/framework/omg/version.h index ac649d83..4facba0d 100644 --- a/inc/framework/omg/version.h +++ b/inc/framework/omg/version.h @@ -27,7 +27,7 @@ #include "framework/common/debug/ge_log.h" namespace ge { -class PlatformVersionManager { +class GE_FUNC_VISIBILITY PlatformVersionManager { public: PlatformVersionManager() = delete; ~PlatformVersionManager() = delete; diff --git a/metadef b/metadef index f937ecfc..848cf412 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit f937ecfc5e553ae17c437e2a195a3b3c730fc1a2 +Subproject commit 848cf412caa9b42ce4e75ab4d0a147ec97dc579b diff --git a/parser b/parser index 6989d1fc..756c64c5 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 6989d1fcc704b19e7b0c62660ca35d8839d201c0 +Subproject commit 756c64c59e451a955e81b59d957ad55f96c27d89