Browse Source

!1033 hide character

Merge pull request !1033 from shixingliang/development
tags/v1.2.0
计晨 Gitee 3 years ago
parent
commit
5b2d81f8cd
89 changed files with 636 additions and 335 deletions
  1. +14
    -0
      ge/CMakeLists.txt
  2. +12
    -1
      ge/common/CMakeLists.txt
  3. +9
    -9
      ge/common/helper/model_cache_helper.cc
  4. +3
    -3
      ge/common/helper/model_cache_helper.h
  5. +1
    -1
      ge/common/profiling/ge_profiling.cc
  6. +6
    -0
      ge/executor/CMakeLists.txt
  7. +26
    -0
      ge/ge_local_engine/CMakeLists.txt
  8. +19
    -5
      ge/ge_local_engine/engine/ge_local_engine.h
  9. +15
    -1
      ge/ge_local_engine/engine/host_cpu_engine.h
  10. +1
    -1
      ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.h
  11. +15
    -1
      ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.h
  12. +1
    -1
      ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.h
  13. +1
    -1
      ge/ge_local_engine/ops_kernel_store/op/no_op.h
  14. +1
    -1
      ge/ge_local_engine/ops_kernel_store/op/op.h
  15. +2
    -2
      ge/ge_local_engine/ops_kernel_store/op/op_factory.h
  16. +5
    -1
      ge/ge_runtime/CMakeLists.txt
  17. +1
    -1
      ge/graph/build/memory/block_mem_assigner.h
  18. +1
    -1
      ge/graph/build/task_generator.cc
  19. +1
    -1
      ge/graph/common/transop_util.h
  20. +2
    -2
      ge/graph/load/model_manager/ts_mem_mall.h
  21. +1
    -1
      ge/graph/manager/graph_manager.cc
  22. +2
    -2
      ge/graph/manager/graph_var_manager.h
  23. +1
    -1
      ge/graph/partition/graph_partition.cc
  24. +1
    -1
      ge/graph/partition/graph_partition.h
  25. +2
    -2
      ge/graph/passes/constant_folding_pass.cc
  26. +4
    -4
      ge/graph/passes/constant_folding_pass.h
  27. +1
    -1
      ge/graph/passes/hccl_continuous_memcpy_pass.h
  28. +1
    -1
      ge/graph/passes/hccl_memcpy_pass.h
  29. +1
    -1
      ge/graph/passes/switch_to_stream_switch_pass.h
  30. +2
    -2
      ge/graph/preprocess/multi_batch_options.h
  31. +26
    -0
      ge/host_cpu_engine/CMakeLists.txt
  32. +19
    -5
      ge/host_cpu_engine/engine/host_cpu_engine.h
  33. +15
    -1
      ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.h
  34. +15
    -1
      ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_info.h
  35. +1
    -1
      ge/host_cpu_engine/ops_kernel_store/op/host_op.h
  36. +1
    -1
      ge/host_cpu_engine/ops_kernel_store/op/op.h
  37. +2
    -2
      ge/host_cpu_engine/ops_kernel_store/op/op_factory.h
  38. +2
    -2
      ge/hybrid/node_executor/ge_local/ge_local_node_executor.cc
  39. +2
    -2
      ge/hybrid/node_executor/ge_local/ge_local_node_executor.h
  40. +1
    -1
      ge/init/gelib.h
  41. +5
    -5
      ge/ir_build/atc_ir_common.cc
  42. +4
    -4
      ge/ir_build/atc_ir_common.h
  43. +1
    -1
      ge/ir_build/ge_ir_build.cc
  44. +12
    -0
      ge/offline/CMakeLists.txt
  45. +1
    -1
      ge/opskernel_manager/ops_kernel_builder_manager.h
  46. +1
    -1
      ge/opskernel_manager/ops_kernel_manager.h
  47. +6
    -0
      ge/plugin/engine/CMakeLists.txt
  48. +8
    -8
      ge/plugin/engine/dnnengines.h
  49. +16
    -2
      ge/plugin/engine/engine_manage.h
  50. +2
    -2
      ge/session/omg.cc
  51. +1
    -1
      ge/stub/gen_stubapi.py
  52. +5
    -5
      inc/external/ge/ge_api.h
  53. +2
    -2
      inc/external/ge/ge_api_error_codes.h
  54. +14
    -0
      inc/external/ge/ge_error_codes.h
  55. +27
    -13
      inc/external/ge/ge_ir_build.h
  56. +1
    -1
      inc/framework/common/debug/ge_log.h
  57. +1
    -1
      inc/framework/common/debug/log.h
  58. +16
    -2
      inc/framework/common/fmk_error_codes.h
  59. +1
    -1
      inc/framework/common/ge_format_util.h
  60. +1
    -1
      inc/framework/common/ge_types.h
  61. +15
    -1
      inc/framework/common/gflags_util.h
  62. +1
    -1
      inc/framework/common/helper/model_helper.h
  63. +2
    -2
      inc/framework/common/helper/om_file_helper.h
  64. +1
    -1
      inc/framework/common/l2_cache_optimize.h
  65. +128
    -114
      inc/framework/common/op/attr_value_util.h
  66. +19
    -19
      inc/framework/common/op/ge_op_utils.h
  67. +2
    -2
      inc/framework/common/op_types.h
  68. +4
    -4
      inc/framework/common/profiling/ge_profiling.h
  69. +1
    -1
      inc/framework/common/profiling/ge_runner_profiling.h
  70. +1
    -1
      inc/framework/common/scope_guard.h
  71. +15
    -1
      inc/framework/common/string_util.h
  72. +20
    -20
      inc/framework/common/util.h
  73. +1
    -1
      inc/framework/engine/dnnengine.h
  74. +1
    -1
      inc/framework/executor/ge_executor.h
  75. +1
    -1
      inc/framework/generator/ge_generator.h
  76. +27
    -13
      inc/framework/generator/generator_api.h
  77. +4
    -4
      inc/framework/memory/memory_api.h
  78. +1
    -1
      inc/framework/memory/memory_assigner.h
  79. +15
    -15
      inc/framework/omg/omg.h
  80. +2
    -2
      inc/framework/omg/omg_inner_types.h
  81. +1
    -1
      inc/framework/omg/parser/model_parser.h
  82. +1
    -1
      inc/framework/omg/parser/op_parser.h
  83. +2
    -2
      inc/framework/omg/parser/parser_api.h
  84. +4
    -4
      inc/framework/omg/parser/parser_factory.h
  85. +2
    -2
      inc/framework/omg/parser/parser_inner_ctx.h
  86. +1
    -1
      inc/framework/omg/parser/weights_parser.h
  87. +1
    -1
      inc/framework/omg/version.h
  88. +1
    -1
      metadef
  89. +1
    -1
      parser

+ 14
- 0
ge/CMakeLists.txt View File

@@ -694,11 +694,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
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-variable>
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-const-variable -Werror=format>
)
@@ -729,6 +731,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
$<BUILD_INTERFACE:intf_pub>
adump_server
@@ -763,11 +769,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
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-variable>
$<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-const-variable -Werror=format>
)
@@ -798,6 +806,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
$<BUILD_INTERFACE:intf_pub>
static_mmpa
@@ -859,6 +871,7 @@ target_compile_options(opensrc_ascendcl PRIVATE
-O2
-fvisibility=hidden
)

target_link_options(opensrc_ascendcl PRIVATE
-rdynamic
-Wl,--allow-multiple-definition
@@ -866,6 +879,7 @@ target_link_options(opensrc_ascendcl PRIVATE
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)

target_link_libraries(opensrc_ascendcl PRIVATE
-Wl,--whole-archive
ge_executor


+ 12
- 1
ge/common/CMakeLists.txt View File

@@ -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
$<BUILD_INTERFACE:intf_pub>
static_mmpa
@@ -132,6 +137,7 @@ target_compile_definitions(ge_common_static PRIVATE
$<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>: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
$<BUILD_INTERFACE:intf_pub>
ascend_protobuf_static


+ 9
- 9
ge/common/helper/model_cache_helper.cc View File

@@ -598,7 +598,7 @@ bool ModelCacheHelper::IsAllocatedGraphIdSameAsCache(Json &json) const {
return false;
}
// Compare allocated graph id info between json and VarManager
std::unordered_map<std::string, uint32_t> allocated_graph_id;
std::map<std::string, uint32_t> 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<std::string, uint32_t> changed_graph_id;
std::map<std::string, uint32_t> 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<std::pair<std::string, VarAddrMgr>> var_addr_mgr_vector;
std::unordered_set<uint64_t> var_offset_set;
std::set<uint64_t> 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<std::string, uint32_t> allocated_graph_id;
std::map<std::string, uint32_t> 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<std::string, uint32_t> changed_graph_id;
std::map<std::string, uint32_t> 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<std::pair<std::string, VarAddrMgr>> var_addr_mgr_vector;
std::unordered_set<uint64_t> var_offset_set;
std::set<uint64_t> 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<rtMemTyp

Status ModelCacheHelper::ParseVarAddrMgrMapFromJson(
const Json &json, std::vector<std::pair<std::string, VarAddrMgr>> &var_addr_mgr_vector,
std::unordered_set<uint64_t> &var_offset_set) {
std::set<uint64_t> &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<std::string, uint32_t> &changed_graph_id) {
std::map<std::string, uint32_t> &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<std::string, uint32_t> &allocated_graph_id) {
std::map<std::string, uint32_t> &allocated_graph_id) {
if (!(json.is_array() || json.is_null())) {
GELOGW("Input param json type should be null or array.");
return PARAM_INVALID;


+ 3
- 3
ge/common/helper/model_cache_helper.h View File

@@ -95,15 +95,15 @@ class ModelCacheHelper {
static Status ParseMemResourceFromJson(const Json &json, map<rtMemType_t, int64_t> &mem_resource);
static Status ParseVarAddrMgrMapFromJson(const Json &json,
std::vector<std::pair<std::string, VarAddrMgr>> &var_addr_mgr_vector,
std::unordered_set<uint64_t> &var_offset_set);
std::set<uint64_t> &var_offset_set);
static Status ParseCurVarTensorDescMapFromJson(
const Json &json, std::unordered_map<std::string, ge::GeTensorDesc> &cur_var_tensor_desc_map);
static Status ParseTransRoadsFromJson(const Json &json,
std::unordered_map<std::string, std::vector<TransNodeInfo>> &trans_roads);
static Status ParseChangedGraphIdFromJson(const Json &json,
std::unordered_map<std::string, uint32_t> &changed_graph_id);
std::map<std::string, uint32_t> &changed_graph_id);
static Status ParseAllocatedGraphIdFromJson(const Json &json,
std::unordered_map<std::string, uint32_t> &allocated_graph_id);
std::map<std::string, uint32_t> &allocated_graph_id);
static Status ParseBroadcastInfoFromJson(const Json &json,
std::unordered_map<std::string, VarBroadCastInfo> &var_broadcast_info);
static Status GetVarNameFromVarKey(const string &var_key, const GeTensorDesc &tensor_desc, string &var_name);


+ 1
- 1
ge/common/profiling/ge_profiling.cc View File

@@ -88,7 +88,7 @@ bool isProfConfigValid(const uint32_t *deviceid_list, uint32_t device_nums) {
return false;
}

std::unordered_set<uint32_t> record;
std::set<uint32_t> record;
for (size_t i = 0; i < device_nums; ++i) {
uint32_t dev_id = deviceid_list[i];
if (dev_id >= static_cast<uint32_t>(dev_count)) {


+ 6
- 0
ge/executor/CMakeLists.txt View File

@@ -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
$<BUILD_INTERFACE:intf_pub>
msprofiler


+ 26
- 0
ge/ge_local_engine/CMakeLists.txt View File

@@ -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
$<BUILD_INTERFACE:intf_pub>
-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
$<BUILD_INTERFACE:intf_pub>
-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
$<BUILD_INTERFACE:intf_pub>
-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
$<BUILD_INTERFACE:intf_pub>
-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


+ 19
- 5
ge/ge_local_engine/engine/ge_local_engine.h View File

@@ -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 <map>
#include <memory>
#include <string>
@@ -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<string, string> &options);
GE_FUNC_VISIBILITY ge::Status Initialize(const map<string, string> &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<std::string, OpsKernelInfoStorePtr> &ops_kernel_map);
GE_FUNC_VISIBILITY void GetOpsKernelInfoStores(std::map<std::string, OpsKernelInfoStorePtr> &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<std::string, GraphOptimizerPtr> &graph_optimizers);
GE_FUNC_VISIBILITY void GetGraphOptimizerObjs(std::map<std::string, GraphOptimizerPtr> &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_

+ 15
- 1
ge/ge_local_engine/engine/host_cpu_engine.h View File

@@ -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 <mutex>
#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;



+ 1
- 1
ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.h View File

@@ -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<std::string, std::string> &options) override;


+ 15
- 1
ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.h View File

@@ -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 <map>
#include <string>
#include <vector>
@@ -25,7 +39,7 @@

namespace ge {
namespace ge_local {
class GeLocalOpsKernelInfoStore : public OpsKernelInfoStore {
class GE_FUNC_VISIBILITY GeLocalOpsKernelInfoStore : public OpsKernelInfoStore {
public:
GeLocalOpsKernelInfoStore() = default;



+ 1
- 1
ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.h View File

@@ -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);



+ 1
- 1
ge/ge_local_engine/ops_kernel_store/op/no_op.h View File

@@ -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);



+ 1
- 1
ge/ge_local_engine/ops_kernel_store/op/op.h View File

@@ -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);



+ 2
- 2
ge/ge_local_engine/ops_kernel_store/op/op_factory.h View File

@@ -32,7 +32,7 @@ using OP_CREATOR_FUNC = std::function<std::shared_ptr<Op>(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<std::string> 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);


+ 5
- 1
ge/ge_runtime/CMakeLists.txt View File

@@ -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
$<BUILD_INTERFACE:intf_pub>
-Wl,--no-as-needed


+ 1
- 1
ge/graph/build/memory/block_mem_assigner.h View File

@@ -466,7 +466,7 @@ class BlockMemAssigner : public MemAssigner {

std::unordered_map<std::string, std::unordered_map<uint32_t, MemoryBlock *>> node_continuous_input_blocks_;

std::unordered_map<std::string, uint32_t> node_continuous_input_counts_;
std::map<std::string, uint32_t> node_continuous_input_counts_;

// reuse memory
vector<string> op_no_reuse_mem_vec_;


+ 1
- 1
ge/graph/build/task_generator.cc View File

@@ -211,7 +211,7 @@ Status TaskGenerator::SaveFusionNodes(map<int64_t, std::vector<NodePtr>> &fusion
// and it have no attr or group attr different
// which means bad case, return error
bool call_check = true;
std::unordered_set<int64_t> input_group_ids;
std::set<int64_t> 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()) {


+ 1
- 1
ge/graph/common/transop_util.h View File

@@ -44,7 +44,7 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY TransOpUtil {

static TransOpUtil &Instance();

typedef std::unordered_map<std::string, int> transop_index_op;
typedef std::map<std::string, int> transop_index_op;
transop_index_op transop_index_map_;
};
} // namespace ge


+ 2
- 2
ge/graph/load/model_manager/ts_mem_mall.h View File

@@ -100,8 +100,8 @@ class TsMemMall {

private:
std::mutex mem_mutex_;
std::unordered_map<int64_t, void *> mem_store_size_;
std::unordered_map<void *, int64_t> mem_store_addr_;
std::map<int64_t, void *> mem_store_size_;
std::map<void *, int64_t> mem_store_addr_;
rtMemType_t mem_type_;
};
} // namespace ge


+ 1
- 1
ge/graph/manager/graph_manager.cc View File

@@ -131,7 +131,7 @@ bool IsTailingOptimization() {
}

ge::Status CheckFpCeilingMode() {
static const std::unordered_set<std::string> kValidFpCeilingMode = {"0", "1", "2"};
static const std::set<std::string> kValidFpCeilingMode = {"0", "1", "2"};
string mode;
auto ret = ge::GetContext().GetOption("ge.fpCeilingMode", mode);
if (ret == ge::GRAPH_SUCCESS) {


+ 2
- 2
ge/graph/manager/graph_var_manager.h View File

@@ -170,8 +170,8 @@ class VarResource {
std::unordered_map<std::string, VarAddrMgr> var_addr_mgr_map_;
std::unordered_map<std::string, ge::GeTensorDesc> cur_var_tensor_desc_map_;
std::unordered_map<std::string, std::vector<TransNodeInfo>> var_to_trans_road_;
std::unordered_map<std::string, uint32_t> var_names_to_changed_graph_id_;
std::unordered_map<std::string, uint32_t> var_names_to_allocated_graph_id_;
std::map<std::string, uint32_t> var_names_to_changed_graph_id_;
std::map<std::string, uint32_t> var_names_to_allocated_graph_id_;
std::map<uint32_t, std::unordered_map<std::string, VarBroadCastInfo>> var_broad_cast_info_;
};



+ 1
- 1
ge/graph/partition/graph_partition.cc View File

@@ -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<size_t> temp_stack;
std::unordered_set<size_t> visited;
std::set<size_t> visited;
temp_stack.push_back(src);
while (!temp_stack.empty()) {
size_t cluster = temp_stack.back();


+ 1
- 1
ge/graph/partition/graph_partition.h View File

@@ -36,7 +36,7 @@ using PartitionMap = std::unordered_map<ComputeGraphPtr, std::string>;
using NodetoNodeMap = std::unordered_map<NodePtr, NodePtr>;
using EnginetoGraphMap = std::unordered_map<std::string, ComputeGraphPtr>;
using EdgeMap = std::set<std::pair<AnchorPtr, AnchorPtr>>;
using ClusterSet = std::unordered_set<size_t>;
using ClusterSet = std::set<size_t>;
class Cluster {
public:
size_t index_; // corresponding to rank of node


+ 2
- 2
ge/graph/passes/constant_folding_pass.cc View File

@@ -50,12 +50,12 @@ Status RunOpKernelWithCheck(NodePtr &node,
return FoldingPass::RunOpKernel(node, inputs, outputs);
}

const std::unordered_map<std::string, std::pair<std::uint64_t, uint64_t>>
const std::map<std::string, std::pair<std::uint64_t, uint64_t>>
&ConstantFoldingPass::GetGeConstantFoldingPerfStatistic() const {
return statistic_of_ge_constant_folding_;
}

const std::unordered_map<std::string, std::pair<std::uint64_t, uint64_t>>
const std::map<std::string, std::pair<std::uint64_t, uint64_t>>
&ConstantFoldingPass::GetOpConstantFoldingPerfStatistic() const {
return statistic_of_op_constant_folding_;
}


+ 4
- 4
ge/graph/passes/constant_folding_pass.h View File

@@ -26,11 +26,11 @@ namespace ge {
class ConstantFoldingPass : public FoldingPass {
public:
Status Run(ge::NodePtr &node) override;
const std::unordered_map<std::string, std::pair<std::uint64_t, uint64_t>> &GetGeConstantFoldingPerfStatistic() const;
const std::unordered_map<std::string, std::pair<std::uint64_t, uint64_t>> &GetOpConstantFoldingPerfStatistic() const;
const std::map<std::string, std::pair<std::uint64_t, uint64_t>> &GetGeConstantFoldingPerfStatistic() const;
const std::map<std::string, std::pair<std::uint64_t, uint64_t>> &GetOpConstantFoldingPerfStatistic() const;
private:
std::unordered_map<std::string, std::pair<std::uint64_t, uint64_t>> statistic_of_op_constant_folding_;
std::unordered_map<std::string, std::pair<std::uint64_t, uint64_t>> statistic_of_ge_constant_folding_;
std::map<std::string, std::pair<std::uint64_t, uint64_t>> statistic_of_op_constant_folding_;
std::map<std::string, std::pair<std::uint64_t, uint64_t>> statistic_of_ge_constant_folding_;
};
} // namespace ge



+ 1
- 1
ge/graph/passes/hccl_continuous_memcpy_pass.h View File

@@ -52,7 +52,7 @@ class HcclContinuousMemcpyPass : public GraphPass {

bool IsDataNode(const std::string& node_type);

std::unordered_map<std::string, uint32_t> node_num_map_;
std::map<std::string, uint32_t> node_num_map_;
};
} // namespace ge



+ 1
- 1
ge/graph/passes/hccl_memcpy_pass.h View File

@@ -50,7 +50,7 @@ class HcclMemcpyPass : public GraphPass {

bool IsDataNode(const std::string& node_type);

std::unordered_map<std::string, uint32_t> node_num_map_;
std::map<std::string, uint32_t> node_num_map_;
};
} // namespace ge



+ 1
- 1
ge/graph/passes/switch_to_stream_switch_pass.h View File

@@ -235,7 +235,7 @@ class SwitchToStreamSwitchPass : public GraphPass {
std::vector<NodePtr> stream_switch_nodes_;
std::unordered_map<OutDataAnchorPtr, std::map<int64_t, std::vector<std::list<NodePtr>>>> cond_node_map_;
std::unordered_map<NodePtr, std::set<std::string>> switch_node_map_;
std::unordered_map<std::string, uint32_t> node_num_map_;
std::map<std::string, uint32_t> node_num_map_;
};
} // namespace ge
#endif // GE_GRAPH_PASSES_SWITCH_TO_STREAM_SWITCH_PASS_H_

+ 2
- 2
ge/graph/preprocess/multi_batch_options.h View File

@@ -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<int64_t> &shape, const string &data_name);
GE_FUNC_VISIBILITY bool CheckDynamicBatchShape(const vector<int64_t> &shape, const string &data_name);

///
/// @ingroup ge
@@ -104,7 +104,7 @@ bool CheckDynamicBatchShape(const vector<int64_t> &shape, const string &data_nam
/// @param [in] const std::string &input_format: format of input.
/// @return 0: true/false
///
bool CheckDynamicImageSizeShape(const vector<int64_t> &shape, const string &data_name,
GE_FUNC_VISIBILITY bool CheckDynamicImageSizeShape(const vector<int64_t> &shape, const string &data_name,
const std::string &input_format);

} // namespace multibatch


+ 26
- 0
ge/host_cpu_engine/CMakeLists.txt View File

@@ -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
$<BUILD_INTERFACE:intf_pub>
-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
$<BUILD_INTERFACE:intf_pub>
-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
$<BUILD_INTERFACE:intf_pub>
-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
$<BUILD_INTERFACE:intf_pub>
-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


+ 19
- 5
ge/host_cpu_engine/engine/host_cpu_engine.h View File

@@ -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 <map>
#include <memory>
#include <string>
@@ -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<string, string> &options);
GE_FUNC_VISIBILITY ge::Status Initialize(const map<string, string> &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<std::string, OpsKernelInfoStorePtr> &ops_kernel_map);
GE_FUNC_VISIBILITY void GetOpsKernelInfoStores(std::map<std::string, OpsKernelInfoStorePtr> &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<std::string, GraphOptimizerPtr> &graph_optimizers);
GE_FUNC_VISIBILITY void GetGraphOptimizerObjs(std::map<std::string, GraphOptimizerPtr> &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_

+ 15
- 1
ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.h View File

@@ -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<std::string, std::string> &options) override;



+ 15
- 1
ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_info.h View File

@@ -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 <map>
#include <string>
#include <vector>
@@ -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;


+ 1
- 1
ge/host_cpu_engine/ops_kernel_store/op/host_op.h View File

@@ -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;


+ 1
- 1
ge/host_cpu_engine/ops_kernel_store/op/op.h View File

@@ -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;


+ 2
- 2
ge/host_cpu_engine/ops_kernel_store/op/op_factory.h View File

@@ -32,7 +32,7 @@ using OP_CREATOR_FUNC = std::function<std::shared_ptr<Op>(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<std::string> 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);


+ 2
- 2
ge/hybrid/node_executor/ge_local/ge_local_node_executor.cc View File

@@ -27,7 +27,7 @@ namespace ge {
namespace hybrid {
REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::GE_LOCAL, GeLocalNodeExecutor);

const std::unordered_map<std::string, std::vector<uint32_t>>
const std::map<std::string, std::vector<uint32_t>>
RefInputTask::out_ref_input_index_ = {{DATA, {}},
{AIPPDATA, {}},
{RESHAPE, {}},
@@ -36,7 +36,7 @@ const std::unordered_map<std::string, std::vector<uint32_t>>
{BROADCASTGRADIENTARGS, {}}
};

const std::unordered_set<std::string> DependInputShapeTask::depend_input_shape_ops_ = {SHAPE, SHAPEN, RANK, SIZE};
const std::set<std::string> DependInputShapeTask::depend_input_shape_ops_ = {SHAPE, SHAPEN, RANK, SIZE};

Status RefInputTask::UpdateArgs(TaskContext &) {
// no need update args


+ 2
- 2
ge/hybrid/node_executor/ge_local/ge_local_node_executor.h View File

@@ -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<std::string, std::vector<uint32_t>> out_ref_input_index_;
static const std::map<std::string, std::vector<uint32_t>> 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<std::string> depend_input_shape_ops_;
static const std::set<std::string> depend_input_shape_ops_;
};

class ConstantNodeTask : public NodeTask {


+ 1
- 1
ge/init/gelib.h View File

@@ -31,7 +31,7 @@ using std::map;
using std::vector;

namespace ge {
class GELib {
class GE_FUNC_VISIBILITY GELib {
public:
GELib() = default;
~GELib() = default;


+ 5
- 5
ge/ir_build/atc_ir_common.cc View File

@@ -77,7 +77,7 @@ Status CheckInputFormat(const string &input_format) {
return ge::SUCCESS;
}

bool CheckDynamicBatchSizeInputShapeValid(unordered_map<string, vector<int64_t>> shape_map,
bool CheckDynamicBatchSizeInputShapeValid(map<string, vector<int64_t>> 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<string, vector<int64_t>>
return true;
}

bool CheckDynamicImagesizeInputShapeValid(unordered_map<string, vector<int64_t>> shape_map,
bool CheckDynamicImagesizeInputShapeValid(map<string, vector<int64_t>> 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<string, vector<int64_t>>
return true;
}

bool CheckDynamicDimsInputShapeValid(const unordered_map<string, vector<int64_t>> &shape_map,
bool CheckDynamicDimsInputShapeValid(const map<string, vector<int64_t>> &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<string, vector<int64_t>> shape_map;
map<string, vector<int64_t>> shape_map;
vector<pair<string, vector<int64_t>>> 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<string, vector<int64_t>> &shape_map,
bool ParseInputShape(const string &input_shape, map<string, vector<int64_t>> &shape_map,
vector<pair<string, vector<int64_t>>> &user_shape_map, bool is_dynamic_input) {
vector<string> shape_vec = StringUtils::Split(input_shape, ';');
const int DEFAULT_SHAPE_PAIR_SIZE = 2;


+ 4
- 4
ge/ir_build/atc_ir_common.h View File

@@ -46,13 +46,13 @@ static std::map<std::string, domiTensorFormat_t> input_format_str_to_geformat =
static const std::string kEnableCompressWeightTrue = "1";
static const std::string kEnableCompressWeightFalse = "0";

bool CheckDynamicBatchSizeInputShapeValid(unordered_map<string, vector<int64_t>> shape_map,
bool CheckDynamicBatchSizeInputShapeValid(map<string, vector<int64_t>> shape_map,
std::string &dynamic_batch_size);

bool CheckDynamicImagesizeInputShapeValid(unordered_map<string, vector<int64_t>> shape_map,
bool CheckDynamicImagesizeInputShapeValid(map<string, vector<int64_t>> shape_map,
const std::string input_format, std::string &dynamic_image_size);

bool CheckDynamicDimsInputShapeValid(const std::unordered_map<std::string, std::vector<int64_t>> &shape_map,
bool CheckDynamicDimsInputShapeValid(const std::map<std::string, std::vector<int64_t>> &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<string, std::vector<int64_t>> &shape_map,
bool ParseInputShape(const std::string &input_shape, std::map<string, std::vector<int64_t>> &shape_map,
std::vector<std::pair<string, vector<int64_t>>> &user_shape_map, bool is_dynamic_input = false);

Status CheckOutputTypeParamValid(const std::string output_type);


+ 1
- 1
ge/ir_build/ge_ir_build.cc View File

@@ -268,7 +268,7 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) {
if (options_.find(kInputShape) == options_.end()) {
return GRAPH_SUCCESS;
}
unordered_map<string, vector<int64_t>> shape_map;
map<string, vector<int64_t>> shape_map;
vector<pair<string, vector<int64_t>>> user_shape_map;
GE_CHK_BOOL_EXEC(ParseInputShape(options_[kInputShape], shape_map, user_shape_map, true),
return GRAPH_PARAM_INVALID, "parse input shape failed!");


+ 12
- 0
ge/offline/CMakeLists.txt View File

@@ -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
$<BUILD_INTERFACE:intf_pub>
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
$<BUILD_INTERFACE:intf_pub>
ascend_protobuf


+ 1
- 1
ge/opskernel_manager/ops_kernel_builder_manager.h View File

@@ -23,7 +23,7 @@

namespace ge {
using OpsKernelBuilderPtr = std::shared_ptr<OpsKernelBuilder>;
class OpsKernelBuilderManager {
class GE_FUNC_VISIBILITY OpsKernelBuilderManager {
public:
~OpsKernelBuilderManager();



+ 1
- 1
ge/opskernel_manager/ops_kernel_manager.h View File

@@ -41,7 +41,7 @@ using std::vector;
namespace ge {
using OpsKernelInfoStorePtr = std::shared_ptr<OpsKernelInfoStore>;

class OpsKernelManager {
class GE_FUNC_VISIBILITY OpsKernelManager {
public:
friend class GELib;



+ 6
- 0
ge/plugin/engine/CMakeLists.txt View File

@@ -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
$<BUILD_INTERFACE:intf_pub>
-Wl,--no-as-needed


+ 8
- 8
ge/plugin/engine/dnnengines.h View File

@@ -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);


+ 16
- 2
ge/plugin/engine/engine_manage.h View File

@@ -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 <map>
#include <memory>
#include <string>
@@ -26,7 +40,7 @@

namespace ge {
using DNNEnginePtr = std::shared_ptr<DNNEngine>;
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<std::string, DNNEnginePtr> &engines);
GE_FUNC_VISIBILITY void GetDNNEngineObjs(std::map<std::string, DNNEnginePtr> &engines);
}
} // namespace ge
#endif // GE_PLUGIN_ENGINE_ENGINE_MANAGE_H_

+ 2
- 2
ge/session/omg.cc View File

@@ -606,7 +606,7 @@ Status InitDomiOmgContext(const string &input_shape, const string &input_format,
}

// Analyze the input shape paramete
unordered_map<string, vector<int64_t>> &shape_map = domi::GetContext().input_dims;
map<string, vector<int64_t>> &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<string, string> graphNodeTypes;
map<string, string> graphNodeTypes;
for (const NodePtr &node : graph->GetAllNodes()) {
auto op_desc = node->GetOpDesc();
if (op_desc == nullptr) {


+ 1
- 1
ge/stub/gen_stubapi.py View File

@@ -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


+ 5
- 5
inc/external/ge/ge_api.h View File

@@ -34,15 +34,15 @@ typedef uint32_t (*pCallBackFunc)(uint32_t graph_id, const std::map<AscendString
}

// Initialize GE
ATTRIBUTED_DEPRECATED(Status GEInitialize(const std::map<AscendString, AscendString> &))
Status GEInitialize(const std::map<std::string, std::string> &options);
ATTRIBUTED_DEPRECATED(GE_FUNC_VISIBILITY Status GEInitialize(const std::map<AscendString, AscendString> &))
GE_FUNC_VISIBILITY Status GEInitialize(const std::map<std::string, std::string> &options);

Status GEInitialize(const std::map<AscendString, AscendString> &options);
GE_FUNC_VISIBILITY Status GEInitialize(const std::map<AscendString, AscendString> &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<AscendString, AscendString> &))
explicit Session(const std::map<std::string, std::string> &options);


+ 2
- 2
inc/external/ge/ge_api_error_codes.h View File

@@ -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<uint32_t, std::string> 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); }


+ 14
- 0
inc/external/ge/ge_error_codes.h View File

@@ -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 <stddef.h>

#ifdef __cplusplus


+ 27
- 13
inc/external/ge/ge_ir_build.h View File

@@ -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 <string>
#include <map>
#include <memory>
@@ -44,17 +58,17 @@ struct ModelBufferData {
* @retval GRAPH_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
ATTRIBUTED_DEPRECATED(graphStatus aclgrphBuildInitialize(std::map<AscendString, AscendString> &))
graphStatus aclgrphBuildInitialize(std::map<std::string, std::string> global_options);
ATTRIBUTED_DEPRECATED(GE_FUNC_VISIBILITY graphStatus aclgrphBuildInitialize(std::map<AscendString, AscendString> &))
GE_FUNC_VISIBILITY graphStatus aclgrphBuildInitialize(std::map<std::string, std::string> global_options);

graphStatus aclgrphBuildInitialize(std::map<AscendString, AscendString> &global_options);
GE_FUNC_VISIBILITY graphStatus aclgrphBuildInitialize(std::map<AscendString, AscendString> &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<AscendString, AscendString> &,
ATTRIBUTED_DEPRECATED(GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &, const std::map<AscendString, AscendString> &,
ModelBufferData &))
graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<std::string, std::string> &build_options,
GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<std::string, std::string> &build_options,
ModelBufferData &model);

graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<AscendString, AscendString> &build_options,
GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<AscendString, AscendString> &build_options,
ModelBufferData &model);

/**
@@ -83,10 +97,10 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<AscendStrin
* @retval GRAPH_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
ATTRIBUTED_DEPRECATED(graphStatus aclgrphSaveModel(const char *, const ModelBufferData &))
graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &model);
ATTRIBUTED_DEPRECATED(GE_FUNC_VISIBILITY graphStatus aclgrphSaveModel(const char *, const ModelBufferData &))
GE_FUNC_VISIBILITY graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &model);

graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &model);
GE_FUNC_VISIBILITY graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &model);

/**
* @ingroup AscendCL
@@ -98,7 +112,7 @@ graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &mod
* @retval GRAPH_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
graphStatus aclgrphGetIRVersion(int *major_version, int *minor_version, int *patch_version);
GE_FUNC_VISIBILITY graphStatus aclgrphGetIRVersion(int *major_version, int *minor_version, int *patch_version);

/**
* @ingroup AscendCL
@@ -110,7 +124,7 @@ graphStatus aclgrphGetIRVersion(int *major_version, int *minor_version, int *pat
* @retval GRAPH_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const size_t len);
GE_FUNC_VISIBILITY graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const size_t len);

/**
* @ingroup AscendCL
@@ -123,7 +137,7 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz
* @retval GRAPH_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
graphStatus aclgrphGenerateForOp(const AscendString &op_type, const std::vector<TensorDesc> &inputs,
GE_FUNC_VISIBILITY graphStatus aclgrphGenerateForOp(const AscendString &op_type, const std::vector<TensorDesc> &inputs,
const std::vector<TensorDesc> &outputs, Graph &graph);

}; // namespace ge


+ 1
- 1
inc/framework/common/debug/ge_log.h View File

@@ -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__


+ 1
- 1
inc/framework/common/debug/log.h View File

@@ -278,7 +278,7 @@
} while (0)

template <typename T>
std::string FmtToStr(const T &t) {
GE_FUNC_VISIBILITY std::string FmtToStr(const T &t) {
std::string fmt;
std::stringstream st;
st << "[" << t << "]";


+ 16
- 2
inc/framework/common/fmk_error_codes.h View File

@@ -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 <map>
#include <string>

@@ -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<uint32_t, std::string> err_desc_;
};

class ErrorNoRegisterar {
class GE_FUNC_VISIBILITY ErrorNoRegisterar {
public:
ErrorNoRegisterar(uint32_t err, const std::string &desc) { StatusFactory::Instance()->RegisterErrorNo(err, desc); }
~ErrorNoRegisterar() {}


+ 1
- 1
inc/framework/common/ge_format_util.h View File

@@ -23,7 +23,7 @@
#include "graph/tensor.h"

namespace ge {
class GeFormatUtil {
class GE_FUNC_VISIBILITY GeFormatUtil {
public:
///
/// @name TransShape


+ 1
- 1
inc/framework/common/ge_types.h View File

@@ -215,7 +215,7 @@ struct ModelInfo {
};

// Asynchronous callback interface, implemented by the caller
class ModelListener {
class GE_FUNC_VISIBILITY ModelListener {
public:
virtual ~ModelListener() {}
///


+ 15
- 1
inc/framework/common/gflags_util.h View File

@@ -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 <gflags/gflags.h>
#include <string>

namespace ge {
class GflagsUtils {
class GE_FUNC_VISIBILITY GflagsUtils {
public:
static bool IsSetCommandTrue(const char *name) {
std::string out;


+ 1
- 1
inc/framework/common/helper/model_helper.h View File

@@ -28,7 +28,7 @@
#include "model/ge_root_model.h"

namespace ge {
class ModelHelper {
class GE_FUNC_VISIBILITY ModelHelper {
public:
ModelHelper() = default;
~ModelHelper();


+ 2
- 2
inc/framework/common/helper/om_file_helper.h View File

@@ -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_; }



+ 1
- 1
inc/framework/common/l2_cache_optimize.h View File

@@ -69,7 +69,7 @@ struct RCMemoryBlock {
};

// L2Cache optimizer
class L2CacheOptimize {
class GE_FUNC_VISIBILITY L2CacheOptimize {
public:
explicit L2CacheOptimize(ge::ComputeGraphPtr &graph);
~L2CacheOptimize();


+ 128
- 114
inc/framework/common/op/attr_value_util.h View File

@@ -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 <google/protobuf/map.h>
#include <unordered_map>
#include <string>
@@ -34,127 +48,127 @@ namespace ge {
using AttrDefMap = ::google::protobuf::Map<::std::string, ::domi::AttrDef>;
using AttrDefPair = ::google::protobuf::MapPair<std::string, domi::AttrDef>;

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_

+ 19
- 19
inc/framework/common/op/ge_op_utils.h View File

@@ -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


+ 2
- 2
inc/framework/common/op_types.h View File

@@ -21,7 +21,7 @@
#include <string>

namespace ge {
class OpTypeContainer {
class GE_FUNC_VISIBILITY OpTypeContainer {
public:
static OpTypeContainer *Instance() {
static OpTypeContainer instance;
@@ -43,7 +43,7 @@ class OpTypeContainer {
std::set<std::string> op_type_list_;
};

class OpTypeRegistrar {
class GE_FUNC_VISIBILITY OpTypeRegistrar {
public:
explicit OpTypeRegistrar(const std::string &op_type) { OpTypeContainer::Instance()->Register(op_type); }
~OpTypeRegistrar() {}


+ 4
- 4
inc/framework/common/profiling/ge_profiling.h View File

@@ -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_

+ 1
- 1
inc/framework/common/profiling/ge_runner_profiling.h View File

@@ -19,6 +19,6 @@

#include "profiling/ge_profiling.h"

bool IsInitialize();
GE_FUNC_VISIBILITY bool IsInitialize();

#endif // INC_FRAMEWORK_COMMON_GE_RUNNER_PROFILING_H_

+ 1
- 1
inc/framework/common/scope_guard.h View File

@@ -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;


+ 15
- 1
inc/framework/common/string_util.h View File

@@ -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 <cctype>
#include <securec.h>

@@ -27,7 +41,7 @@
#include <vector>

namespace ge {
class StringUtils {
class GE_FUNC_VISIBILITY StringUtils {
public:
static std::string &Ltrim(std::string &s) {
#if __cplusplus >= 201103L


+ 20
- 20
inc/framework/common/util.h View File

@@ -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<char> &buffer);
GE_FUNC_VISIBILITY bool ReadBytesFromBinaryFile(const char *file_name, std::vector<char> &buffer);

///
/// @ingroup domi_common
@@ -290,14 +290,14 @@ bool ReadBytesFromBinaryFile(const char *file_name, std::vector<char> &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 <typename T>
std::string ToString(std::vector<T> &v) {
GE_FUNC_VISIBILITY std::string ToString(std::vector<T> &v) {
std::stringstream ss;
ss << "[";
for (T x : v) {
@@ -326,7 +326,7 @@ std::string ToString(std::vector<T> &v) {
/// @return string
///
template <typename T>
std::string ToString(const google::protobuf::RepeatedField<T> &rpd_field) {
GE_FUNC_VISIBILITY std::string ToString(const google::protobuf::RepeatedField<T> &rpd_field) {
std::stringstream ss;
ss << "[";
for (T x : rpd_field) {
@@ -345,7 +345,7 @@ std::string ToString(const google::protobuf::RepeatedField<T> &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_

+ 1
- 1
inc/framework/engine/dnnengine.h View File

@@ -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<std::string, std::string> &options) = 0;


+ 1
- 1
inc/framework/executor/ge_executor.h View File

@@ -46,7 +46,7 @@ struct RunModelData {
std::vector<uint64_t> 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;


+ 1
- 1
inc/framework/generator/ge_generator.h View File

@@ -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;


+ 27
- 13
inc/framework/generator/generator_api.h View File

@@ -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 <stdint.h>

#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
}


+ 4
- 4
inc/framework/memory/memory_api.h View File

@@ -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<HostVarInfo> &var_info, rtMemType_t mem_type = RT_MEMORY_HBM);
GE_FUNC_VISIBILITY Status RdmaRemoteRegister(const std::vector<HostVarInfo> &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_

+ 1
- 1
inc/framework/memory/memory_assigner.h View File

@@ -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;


+ 15
- 15
inc/framework/omg/omg.h View File

@@ -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<string, string> &atc_params, const char *model_file,
GE_FUNC_VISIBILITY Status ParseGraph(ge::Graph &graph, const std::map<string, string> &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<string, string> &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<string> &fileList, string &caffe_parser_path);
GE_FUNC_VISIBILITY void FindParserSo(const string &path, vector<string> &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<std::pair<ge::NodePtr, int32_t>> &output_nodes_info);
GE_FUNC_VISIBILITY Status GetOutputLeaf(ge::NodePtr node, std::vector<std::pair<ge::NodePtr, int32_t>> &output_nodes_info);

void GetOutputNodesNameAndIndex(std::vector<std::pair<ge::NodePtr, int32_t>> &output_nodes_info,
GE_FUNC_VISIBILITY void GetOutputNodesNameAndIndex(std::vector<std::pair<ge::NodePtr, int32_t>> &output_nodes_info,
std::vector<std::string> &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_

+ 2
- 2
inc/framework/omg/omg_inner_types.h View File

@@ -83,7 +83,7 @@ struct OmgContext {
// user-designate input dims
std::vector<std::pair<std::string, std::vector<int64_t>>> user_input_dims;
// global input dims
std::unordered_map<std::string, std::vector<int64_t>> input_dims;
std::map<std::string, std::vector<int64_t>> 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.


+ 1
- 1
inc/framework/omg/parser/model_parser.h View File

@@ -37,7 +37,7 @@ using Status = domi::Status;
namespace domi {
using GetGraphCallback = std::function<std::unique_ptr<google::protobuf::Message>(
const google::protobuf::Message *root_proto, const std::string &graph)>;
class ModelParser {
class GE_FUNC_VISIBILITY ModelParser {
public:
ModelParser() {}



+ 1
- 1
inc/framework/omg/parser/op_parser.h View File

@@ -34,7 +34,7 @@ namespace ge {
* @brief Used to analyze operator information
*
*/
class OpParser {
class GE_FUNC_VISIBILITY OpParser {
public:
/**
* @ingroup domi_omg


+ 2
- 2
inc/framework/omg/parser/parser_api.h View File

@@ -24,8 +24,8 @@

namespace ge {
// Initialize parser
Status ParserInitialize(const std::map<std::string, std::string>& options);
GE_FUNC_VISIBILITY Status ParserInitialize(const std::map<std::string, std::string>& options);
// Finalize parser, release all resources
Status ParserFinalize();
GE_FUNC_VISIBILITY Status ParserFinalize();
} // namespace ge
#endif // INC_FRAMEWORK_OMG_PARSER_PARSER_API_H_

+ 4
- 4
inc/framework/omg/parser/parser_factory.h View File

@@ -33,7 +33,7 @@ class ModelParser;
typedef std::shared_ptr<ModelParser> (*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<domi::FrameworkType, MODEL_PARSER_CREATOR_FUN> 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<WeightsParser> (*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<domi::FrameworkType, WEIGHTS_PARSER_CREATOR_FUN> 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);


+ 2
- 2
inc/framework/omg/parser/parser_inner_ctx.h View File

@@ -34,7 +34,7 @@ struct ParserContext {
std::vector<domiTensorFormat_t> output_formats;
// user-designate input dims
std::vector<std::pair<std::string, std::vector<int64_t>>> user_input_dims;
std::unordered_map<std::string, std::vector<int64_t>> input_dims;
std::map<std::string, std::vector<int64_t>> input_dims;
// resolve the mapping between operators with the same name and corresponding network. format e.g.
// Detectionoutput:SsdDetectiontOutput
std::map<std::string, std::string> 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_

+ 1
- 1
inc/framework/omg/parser/weights_parser.h View File

@@ -34,7 +34,7 @@ namespace domi {
* @brief Weight information resolver
*
*/
class WeightsParser {
class GE_FUNC_VISIBILITY WeightsParser {
public:
/**
* @ingroup domi_omg


+ 1
- 1
inc/framework/omg/version.h View File

@@ -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;


+ 1
- 1
metadef

@@ -1 +1 @@
Subproject commit f937ecfc5e553ae17c437e2a195a3b3c730fc1a2
Subproject commit 848cf412caa9b42ce4e75ab4d0a147ec97dc579b

+ 1
- 1
parser

@@ -1 +1 @@
Subproject commit 6989d1fcc704b19e7b0c62660ca35d8839d201c0
Subproject commit 756c64c59e451a955e81b59d957ad55f96c27d89

Loading…
Cancel
Save