| @@ -41,6 +41,7 @@ if (ENABLE_OPEN_SRC) | |||
| message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated") | |||
| endif() | |||
| set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH}) | |||
| set(STATIC_ACL_LIB ${GE_LIB_PATH}) | |||
| find_module(slog libslog.so ${GE_LIB_PATH}) | |||
| find_module(mmpa libmmpa.so ${GE_LIB_PATH}) | |||
| find_module(msprof libmsprof.so ${GE_LIB_PATH}) | |||
| @@ -53,7 +54,7 @@ if (ENABLE_OPEN_SRC) | |||
| find_module(ascend_hal_stub libascend_hal.so ${GE_LIB_PATH}) | |||
| find_module(error_manager_static liberror_manager.a ${GE_LIB_PATH}) | |||
| find_module(msprofiler libmsprofiler.a ${GE_LIB_PATH}) | |||
| find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) | |||
| #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) | |||
| else() | |||
| if(DEFINED ENV{ASCEND_CUSTOM_PATH}) | |||
| set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH}) | |||
| @@ -66,6 +67,7 @@ if (ENABLE_OPEN_SRC) | |||
| set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64) | |||
| set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64) | |||
| set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/lib64) | |||
| set(STATIC_ACL_LIB ${ASCEND_ACL_DIR}) | |||
| find_module(slog libslog.so ${ASCEND_ATC_DIR}) | |||
| find_module(mmpa libmmpa.so ${ASCEND_ATC_DIR}) | |||
| if(PLATFORM STREQUAL "train") | |||
| @@ -88,15 +90,19 @@ if (ENABLE_OPEN_SRC) | |||
| find_module(error_manager liberror_manager.so ${ASCEND_ATC_DIR}) | |||
| find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) | |||
| find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR}) | |||
| find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) | |||
| if(NOT PRODUCT STREQUAL "flr3") | |||
| #find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) | |||
| if(PRODUCT STREQUAL "flr3") | |||
| find_module(msprof libmsprof.so ${ASCEND_DRIVER_SHARE_DIR}) | |||
| elseif(PRODUCT STREQUAL "flr1") | |||
| find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver) | |||
| find_module(msprof libmsprof.so ${ASCEND_DRIVER_COMMON_DIR}) | |||
| elseif(PRODUCT STREQUAL "flr2") | |||
| # flr2 ascend_hal_stub limsprof ? | |||
| else() | |||
| find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}) | |||
| find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR}) | |||
| else() | |||
| find_module(msprof libmsprof.so ${ASCEND_DRIVER_SHARE_DIR}) | |||
| endif() | |||
| elseif(PLATFORM STREQUAL "all") | |||
| #mdc没有 dc在driver目录 | |||
| find_module(msprof libmsprof.so ${ASCEND_DRIVER_COMMON_DIR}) | |||
| find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR}) | |||
| find_module(adump_server libadump_server.a ${ASCEND_ACL_DIR}) | |||
| @@ -106,9 +112,8 @@ if (ENABLE_OPEN_SRC) | |||
| find_module(error_manager liberror_manager.so ${ASCEND_ATC_DIR}) | |||
| find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) | |||
| find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR}) | |||
| #mdc没有 dc在driver/lib64/driver | |||
| find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver) | |||
| find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) | |||
| #find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) | |||
| else() | |||
| message(FATAL_ERROR "PLATFORM param is invalid, should be train or inference, build terminated") | |||
| endif() | |||
| @@ -95,6 +95,9 @@ checkopts() | |||
| } | |||
| checkopts "$@" | |||
| git submodule update --init metadef | |||
| git submodule update --init parser | |||
| mk_dir() { | |||
| local create_dir="$1" # the target to make | |||
| @@ -134,7 +137,7 @@ build_graphengine() | |||
| echo "execute command: cmake ${CMAKE_ARGS} .. failed." | |||
| return 1 | |||
| fi | |||
| COMMON_TARGET="ge_common engine fmk_parser parser_common _caffe_parser fmk_onnx_parser graph register " | |||
| COMMON_TARGET="ge_common engine fmk_parser parser_common _caffe_parser fmk_onnx_parser graph register engine_conf.json optimizer_priority.pbtxt " | |||
| TARGET=${COMMON_TARGET} | |||
| if [ "x${PLATFORM}" = "xtrain" ] | |||
| then | |||
| @@ -211,14 +214,80 @@ generate_package() | |||
| cd "${BASEPATH}" | |||
| GRAPHENGINE_LIB_PATH="lib" | |||
| ACL_PATH="acllib/lib64" | |||
| FWK_PATH="fwkacllib/lib64" | |||
| ATC_PATH="atc/lib64" | |||
| ATC_BIN_PATH="atc/bin" | |||
| NNENGINE_PATH="plugin/nnengine/ge_config" | |||
| OPSKERNEL_PATH="plugin/opskernel" | |||
| ATC_LIB=("libc_sec.so" "libge_common.so" "libge_compiler.so" "libgraph.so" "libregister.so") | |||
| FWK_LIB=("libge_common.so" "libge_runner.so" "libgraph.so" "libregister.so") | |||
| PLUGIN_OPSKERNEL=("libge_local_engine.so" "libge_local_opskernel_builder.so" "libhost_cpu_engine.so" "libhost_cpu_opskernel_builder.so" "optimizer_priority.pbtxt") | |||
| PARSER_LIB=("lib_caffe_parser.so" "libfmk_onnx_parser.so" "libfmk_parser.so" "libparser_common.so") | |||
| rm -rf ${OUTPUT_PATH:?}/${FWK_PATH}/ | |||
| rm -rf ${OUTPUT_PATH:?}/${ACL_PATH}/ | |||
| rm -rf ${OUTPUT_PATH:?}/${ATC_PATH}/ | |||
| rm -rf ${OUTPUT_PATH:?}/${ATC_BIN_PATH}/ | |||
| mk_dir "${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH}" | |||
| mk_dir "${OUTPUT_PATH}/${FWK_PATH}/${OPSKERNEL_PATH}" | |||
| mk_dir "${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH}" | |||
| mk_dir "${OUTPUT_PATH}/${ATC_PATH}/${OPSKERNEL_PATH}" | |||
| mk_dir "${OUTPUT_PATH}/${ACL_PATH}" | |||
| mk_dir "${OUTPUT_PATH}/${ATC_BIN_PATH}" | |||
| cd "${OUTPUT_PATH}" | |||
| find ./ -name graphengine_lib.tar -exec rm {} \; | |||
| find ./bin -name atc -exec cp {} "${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH}" \; | |||
| cp ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH}/engine_conf.json ${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH} | |||
| cp ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH}/engine_conf.json ${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH} | |||
| find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name libengine.so -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH}/../ \; | |||
| find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name libengine.so -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH}/../ \; | |||
| MAX_DEPTH=1 | |||
| if [ "x${PLATFORM}" = "xall" ] || [ "x${PLATFORM}" = "xinference" ] | |||
| then | |||
| MAX_DEPTH=2 | |||
| fi | |||
| for lib in "${PLUGIN_OPSKERNEL[@]}"; | |||
| do | |||
| find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth ${MAX_DEPTH} -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH}/${OPSKERNEL_PATH} \; | |||
| find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth ${MAX_DEPTH} -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH}/${OPSKERNEL_PATH} \; | |||
| done | |||
| for lib in "${PARSER_LIB[@]}"; | |||
| do | |||
| find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH} \; | |||
| find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH} \; | |||
| done | |||
| for lib in "${FWK_LIB[@]}"; | |||
| do | |||
| find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH} \; | |||
| done | |||
| for lib in "${ATC_LIB[@]}"; | |||
| do | |||
| find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH} \; | |||
| done | |||
| find ./bin -name atc -exec cp {} "${OUTPUT_PATH}/${ATC_BIN_PATH}" \; | |||
| find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "libascendcl.so" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \; | |||
| tar -cf graphengine_lib.tar "${GRAPHENGINE_LIB_PATH}" | |||
| if [ "x${PLATFORM}" = "xtrain" ] | |||
| then | |||
| tar -cf graphengine_lib.tar fwkacllib | |||
| elif [ "x${PLATFORM}" = "xinference" ] | |||
| then | |||
| tar -cf graphengine_lib.tar acllib atc | |||
| elif [ "x${PLATFORM}" = "xall" ] | |||
| then | |||
| tar -cf graphengine_lib.tar fwkacllib acllib atc | |||
| fi | |||
| } | |||
| if [[ "X$ENABLE_GE_UT" = "Xoff" ]]; then | |||
| @@ -88,6 +88,7 @@ set(TRAIN_SRC_LIST | |||
| "graph/load/new_model_manager/model_utils.cc" | |||
| "graph/load/new_model_manager/aipp_utils.cc" | |||
| "graph/load/new_model_manager/task_info/end_graph_task_info.cc" | |||
| "graph/load/new_model_manager/task_info/model_exit_task_info.cc" | |||
| "graph/load/new_model_manager/task_info/event_record_task_info.cc" | |||
| "graph/load/new_model_manager/task_info/event_wait_task_info.cc" | |||
| "graph/load/new_model_manager/task_info/fusion_start_task_info.cc" | |||
| @@ -137,6 +138,7 @@ set(TRAIN_SRC_LIST | |||
| "graph/passes/atomic_addr_clean_pass.cc" | |||
| "graph/passes/mark_same_addr_pass.cc" | |||
| "graph/passes/mark_graph_unknown_status_pass.cc" | |||
| "graph/passes/mark_agnostic_pass.cc" | |||
| "graph/partition/dynamic_shape_partition.cc" | |||
| "graph/partition/stage_partition.cc" | |||
| "graph/passes/base_pass.cc" | |||
| @@ -489,6 +491,7 @@ set(INFER_SRC_LIST | |||
| "graph/passes/atomic_addr_clean_pass.cc" | |||
| "graph/passes/mark_same_addr_pass.cc" | |||
| "graph/passes/mark_graph_unknown_status_pass.cc" | |||
| "graph/passes/mark_agnostic_pass.cc" | |||
| "graph/common/omg_util.cc" | |||
| "graph/common/bcast.cc" | |||
| "graph/common/local_context.cc" | |||
| @@ -623,6 +626,7 @@ set(INFER_SRC_LIST | |||
| "graph/load/new_model_manager/task_info/stream_switch_task_info.cc" | |||
| "graph/load/new_model_manager/task_info/stream_switchn_task_info.cc" | |||
| "graph/load/new_model_manager/task_info/end_graph_task_info.cc" | |||
| "graph/load/new_model_manager/task_info/model_exit_task_info.cc" | |||
| "graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc" | |||
| "graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc" | |||
| "single_op/task/op_task.cc" | |||
| @@ -688,7 +692,7 @@ target_include_directories(ge_compiler PRIVATE | |||
| ${GE_CODE_DIR}/../inc/external | |||
| ${GE_CODE_DIR}/../inc/cce | |||
| ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external | |||
| #### blue zone | |||
| #### blue zone #### | |||
| ${ASCEND_DIR}/driver/include | |||
| ${ASCEND_DIR}/fwkacllib/include | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| @@ -717,10 +721,24 @@ target_link_libraries(ge_compiler | |||
| ############ libascendcl.so ############ | |||
| file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") | |||
| add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) | |||
| set(DUMMY_OBJ $<TARGET_OBJECTS:dummy_obj>) | |||
| #add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) | |||
| #set(DUMMY_OBJ $<TARGET_OBJECTS:dummy_obj>) | |||
| file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object) | |||
| add_library(opensrc_ascendcl SHARED ${DUMMY_OBJ}) | |||
| if(EXISTS ${STATIC_ACL_LIB}/libascendcl.a) | |||
| execute_process( | |||
| COMMAND ar x ${STATIC_ACL_LIB}/libascendcl.a | |||
| WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object | |||
| ) | |||
| file(GLOB OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object/*.o) | |||
| else() | |||
| set(OBJECT_LIST ${CMAKE_BINARY_DIR}/dummy.c) | |||
| endif() | |||
| add_library(opensrc_ascendcl SHARED | |||
| ${OBJECT_LIST} | |||
| ) | |||
| target_compile_options(opensrc_ascendcl PRIVATE | |||
| -O2 | |||
| -fvisibility=hidden | |||
| @@ -735,7 +753,6 @@ target_link_options(opensrc_ascendcl PRIVATE | |||
| target_link_libraries(opensrc_ascendcl PRIVATE | |||
| -Wl,--whole-archive | |||
| ge_executor | |||
| ascendcl_static | |||
| ge_common_static | |||
| graph_static | |||
| protobuf_static | |||
| @@ -879,7 +896,7 @@ add_custom_command( | |||
| set(INSTALL_BASE_DIR "") | |||
| set(INSTALL_LIBRARY_DIR lib) | |||
| install(TARGETS ge_runner ge_compiler OPTIONAL | |||
| install(TARGETS ge_runner ge_compiler opensrc_ascendcl OPTIONAL | |||
| LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | |||
| ) | |||
| @@ -45,6 +45,9 @@ message AippOpParams { | |||
| // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 | |||
| uint32 related_input_rank = 2; | |||
| // related_input_name is optional and the top name of data node which inserts aipp | |||
| string related_input_name = 6; | |||
| // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 | |||
| // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 | |||
| // 配置值 <= Data算子输出边的个数。 | |||
| @@ -45,6 +45,9 @@ message AippOpParams { | |||
| // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 | |||
| uint32 related_input_rank = 2; | |||
| // related_input_name is optional and the top name of data node which inserts aipp | |||
| string related_input_name = 6; | |||
| // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 | |||
| // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 | |||
| // 配置值 <= Data算子输出边的个数。 | |||
| @@ -398,6 +398,7 @@ REGISTER_OPTYPE_DEFINE(MEMCPYASYNC, "MemcpyAsync"); | |||
| REGISTER_OPTYPE_DEFINE(MEMCPYADDRASYNC, "MemcpyAddrAsync"); | |||
| REGISTER_OPTYPE_DEFINE(STREAMMERGE, "StreamMerge"); | |||
| REGISTER_OPTYPE_DEFINE(ENDGRAPH, "EndGraph"); | |||
| REGISTER_OPTYPE_DEFINE(MODELEXIT, "ModelExit"); | |||
| REGISTER_OPTYPE_DEFINE(SEND, "Send"); | |||
| REGISTER_OPTYPE_DEFINE(RECV, "Recv"); | |||
| REGISTER_OPTYPE_DEFINE(ENDOFSEQUENCE, "EndOfSequence"); | |||
| @@ -58,6 +58,7 @@ set(SRC_LIST | |||
| "../graph/load/new_model_manager/task_info/stream_switch_task_info.cc" | |||
| "../graph/load/new_model_manager/task_info/stream_switchn_task_info.cc" | |||
| "../graph/load/new_model_manager/task_info/end_graph_task_info.cc" | |||
| "../graph/load/new_model_manager/task_info/model_exit_task_info.cc" | |||
| "../graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc" | |||
| "../graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc" | |||
| "../opskernel_manager/ops_kernel_builder_manager.cc" | |||
| @@ -91,7 +92,6 @@ target_include_directories(ge_executor PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -100,7 +100,9 @@ target_include_directories(ge_executor PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| ${GE_CODE_DIR}/../inc/cce | |||
| ${GE_CODE_DIR}/../inc/cce | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(ge_executor PRIVATE | |||
| @@ -1058,6 +1058,14 @@ ge::Status GeExecutor::ExecuteAsync(DynamicSingleOp *executor, const vector<GeTe | |||
| } | |||
| Status GeExecutor::ReleaseSingleOpResource(void *stream) { | |||
| // get current context | |||
| rtContext_t rt_cur_ctx = nullptr; | |||
| auto rt_err = rtCtxGetCurrent(&rt_cur_ctx); | |||
| if (rt_err != RT_ERROR_NONE) { | |||
| GELOGE(RT_FAILED, "get current context failed, runtime result is %d", static_cast<int>(rt_err)); | |||
| return RT_FAILED; | |||
| } | |||
| ModelManager::GetInstance()->ClearAICPUSo(rt_cur_ctx); | |||
| return SingleOpManager::GetInstance().ReleaseResource(stream); | |||
| } | |||
| @@ -48,6 +48,7 @@ local_ge_executor_src_files := \ | |||
| ../graph/load/new_model_manager/task_info/stream_switch_task_info.cc \ | |||
| ../graph/load/new_model_manager/task_info/stream_switchn_task_info.cc \ | |||
| ../graph/load/new_model_manager/task_info/end_graph_task_info.cc \ | |||
| ../graph/load/new_model_manager/task_info/model_exit_task_info.cc \ | |||
| ../graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc \ | |||
| ../graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc \ | |||
| ../opskernel_manager/ops_kernel_builder_manager.cc \ | |||
| @@ -45,6 +45,9 @@ message AippOpParams { | |||
| // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 | |||
| uint32 related_input_rank = 2; | |||
| // related_input_name is optional and the top name of data node which inserts aipp | |||
| string related_input_name = 6; | |||
| // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 | |||
| // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 | |||
| // 配置值 <= Data算子输出边的个数。 | |||
| @@ -109,6 +109,7 @@ OMG_HOST_SRC_FILES := \ | |||
| graph/passes/atomic_addr_clean_pass.cc \ | |||
| graph/passes/mark_same_addr_pass.cc \ | |||
| graph/passes/mark_graph_unknown_status_pass.cc \ | |||
| graph/passes/mark_agnostic_pass.cc \ | |||
| graph/common/omg_util.cc \ | |||
| graph/common/bcast.cc \ | |||
| graph/common/local_context.cc \ | |||
| @@ -248,6 +249,7 @@ OME_HOST_SRC_FILES := \ | |||
| graph/load/new_model_manager/task_info/stream_switch_task_info.cc \ | |||
| graph/load/new_model_manager/task_info/stream_switchn_task_info.cc \ | |||
| graph/load/new_model_manager/task_info/end_graph_task_info.cc \ | |||
| graph/load/new_model_manager/task_info/model_exit_task_info.cc \ | |||
| graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc \ | |||
| graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc \ | |||
| single_op/task/op_task.cc \ | |||
| @@ -34,7 +34,6 @@ target_include_directories(ge_local_engine PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -43,6 +42,8 @@ target_include_directories(ge_local_engine PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(ge_local_engine PRIVATE | |||
| @@ -74,7 +75,6 @@ target_include_directories(atc_ge_local_engine PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -83,6 +83,8 @@ target_include_directories(atc_ge_local_engine PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(atc_ge_local_engine PRIVATE | |||
| @@ -115,7 +117,6 @@ target_include_directories(ge_local_opskernel_builder PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -124,6 +125,8 @@ target_include_directories(ge_local_opskernel_builder PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(ge_local_opskernel_builder PRIVATE | |||
| @@ -150,7 +153,6 @@ target_include_directories(atc_ge_local_opskernel_builder PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -159,6 +161,8 @@ target_include_directories(atc_ge_local_opskernel_builder PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(atc_ge_local_opskernel_builder PRIVATE | |||
| @@ -190,7 +194,6 @@ target_include_directories(ge_local_opskernel_builder_static PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -199,6 +202,8 @@ target_include_directories(ge_local_opskernel_builder_static PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(ge_local_opskernel_builder_static PRIVATE | |||
| @@ -61,6 +61,7 @@ LIBGE_LOCAL_SRC_FILES := \ | |||
| graph/load/new_model_manager/model_utils.cc \ | |||
| graph/load/new_model_manager/aipp_utils.cc \ | |||
| graph/load/new_model_manager/task_info/end_graph_task_info.cc \ | |||
| graph/load/new_model_manager/task_info/model_exit_task_info.cc \ | |||
| graph/load/new_model_manager/task_info/event_record_task_info.cc \ | |||
| graph/load/new_model_manager/task_info/event_wait_task_info.cc \ | |||
| graph/load/new_model_manager/task_info/fusion_start_task_info.cc \ | |||
| @@ -110,6 +111,7 @@ LIBGE_LOCAL_SRC_FILES := \ | |||
| graph/passes/atomic_addr_clean_pass.cc \ | |||
| graph/passes/mark_same_addr_pass.cc \ | |||
| graph/passes/mark_graph_unknown_status_pass.cc \ | |||
| graph/passes/mark_agnostic_pass.cc \ | |||
| graph/partition/dynamic_shape_partition.cc \ | |||
| graph/partition/stage_partition.cc \ | |||
| graph/passes/base_pass.cc \ | |||
| @@ -31,7 +31,8 @@ target_include_directories(ge_memory PRIVATE | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| @@ -866,12 +866,10 @@ MemoryBlock *BlockMemAssigner::ApplyMemory(size_t block_size, size_t real_size, | |||
| string ge_disable_reuse_mem_env = "0"; | |||
| (void)ge::GetContext().GetOption(OPTION_EXEC_DISABLE_REUSED_MEMORY, ge_disable_reuse_mem_env); | |||
| if (ge_disable_reuse_mem_env != "1") { | |||
| bool reuse_mem_flag = !((workspace_reuse_flag.size() > out_index) && !workspace_reuse_flag[out_index]); | |||
| bool reuse_mem_flag = (mem_type == kOutput) ? IsPreReuse(n, out_index) : | |||
| !((workspace_reuse_flag.size() > out_index) && !workspace_reuse_flag[out_index]); | |||
| is_reuse_memory = !node_op_desc->HasAttr(kL2FusionDynamicConvergeOp) && | |||
| !node_op_desc->HasAttr(kOpNoReuseMem) && | |||
| reuse_mem_flag && | |||
| is_op_reuse_mem && | |||
| (IsPreReuse(n, out_index)); | |||
| !node_op_desc->HasAttr(kOpNoReuseMem) && reuse_mem_flag && is_op_reuse_mem; | |||
| auto stream_id = node_op_desc->GetStreamId(); | |||
| if (is_reuse_memory && !continuous && !reusable_blocks_[memory_type].empty()) { | |||
| for (auto it = reusable_blocks_[memory_type][stream_id].begin(); | |||
| @@ -236,6 +236,7 @@ ModelManager::~ModelManager() { | |||
| std::lock_guard<std::mutex> lock(map_mutex_); | |||
| model_map_.clear(); | |||
| model_aicpu_kernel_.clear(); | |||
| cust_aicpu_so_.clear(); | |||
| GE_IF_BOOL_EXEC(device_count > 0, GE_CHK_RT(rtDeviceReset(0))); | |||
| } | |||
| @@ -399,7 +400,6 @@ Status ModelManager::Unload(uint32_t model_id) { | |||
| } | |||
| std::lock_guard<std::mutex> lock(exeception_infos_mutex_); | |||
| exception_infos_.clear(); | |||
| cust_aicpu_so_.clear(); | |||
| return SUCCESS; | |||
| } | |||
| @@ -1096,19 +1096,51 @@ Status ModelManager::CreateAicpuSession(uint64_t session_id) { | |||
| return SUCCESS; | |||
| } | |||
| Status ModelManager::LoadCustAicpuSo(const OpDescPtr op_desc, string so_name) { | |||
| Status ModelManager::LoadCustAicpuSo(const OpDescPtr op_desc, const string &so_name) { | |||
| GELOGI("LoadCustAicpuSo in, op name %s, so_name %s.", op_desc->GetName().c_str(), so_name.c_str()); | |||
| std::lock_guard<std::mutex> lock(cust_aicpu_mutex_); | |||
| auto it = cust_aicpu_so_.find(so_name); | |||
| // get current context | |||
| rtContext_t rt_cur_ctx = nullptr; | |||
| auto rt_err = rtCtxGetCurrent(&rt_cur_ctx); | |||
| if (rt_err != RT_ERROR_NONE) { | |||
| GELOGE(RT_FAILED, "get current context failed, runtime result is %d", static_cast<int>(rt_err)); | |||
| return RT_FAILED; | |||
| } | |||
| // use current context as resource key instead | |||
| uintptr_t resource_id = reinterpret_cast<uintptr_t>(rt_cur_ctx); | |||
| auto it = cust_aicpu_so_.find(resource_id); | |||
| if (it == cust_aicpu_so_.end()) { | |||
| GE_CHK_STATUS_RET(LaunchCustAicpuSo(op_desc, so_name), "LaunchCustAicpuSo failed. op name %s, so_name %s", | |||
| op_desc->GetName().c_str(), so_name.c_str()); | |||
| (void)cust_aicpu_so_.insert(so_name); | |||
| GELOGI("LaunchCustAicpuSo op name %s, so_name %s.", op_desc->GetName().c_str(), so_name.c_str()); | |||
| std::set<string> so_name_set; | |||
| so_name_set.insert(so_name); | |||
| cust_aicpu_so_[resource_id] = so_name_set; | |||
| GELOGI("LoadCustAicpuSo new aicpu so resource_id %lu.", resource_id); | |||
| return SUCCESS; | |||
| } | |||
| auto it_so_name = it->second.find(so_name); | |||
| if (it_so_name == it->second.end()) { | |||
| GE_CHK_STATUS_RET(LaunchCustAicpuSo(op_desc, so_name), "LaunchCustAicpuSo failed. op name %s, so_name %s", | |||
| op_desc->GetName().c_str(), so_name.c_str()); | |||
| it->second.insert(so_name); | |||
| GELOGI("LoadCustAicpuSo add aicpu so resource_id %lu.", resource_id); | |||
| } | |||
| return SUCCESS; | |||
| } | |||
| Status ModelManager::ClearAICPUSo(void *ctx) { | |||
| auto ctx_id = reinterpret_cast<uintptr_t>(ctx); | |||
| GELOGI("ClearAICPUSo in. resource id = 0x%lx", static_cast<uint64_t>(ctx_id)); | |||
| std::lock_guard<std::mutex> lock(cust_aicpu_mutex_); | |||
| auto it = cust_aicpu_so_.find(ctx_id); | |||
| if (it == cust_aicpu_so_.end()) { | |||
| return SUCCESS; | |||
| } | |||
| (void)cust_aicpu_so_.erase(it); | |||
| return SUCCESS; | |||
| } | |||
| Status ModelManager::LaunchCustAicpuSo(const OpDescPtr op_desc, string so_name) { | |||
| Status ModelManager::LaunchCustAicpuSo(const OpDescPtr op_desc, const string &so_name) { | |||
| CustAICPUKernelPtr aicpu_kernel = op_desc->TryGetExtAttr(OP_EXTATTR_CUSTAICPU_KERNEL, CustAICPUKernelPtr()); | |||
| if (aicpu_kernel == nullptr) { | |||
| GELOGE(INTERNAL_ERROR, "cust aicpu op %s can't find kernel!", op_desc->GetName().c_str()); | |||
| @@ -1140,6 +1172,7 @@ Status ModelManager::LaunchCustAicpuSo(const OpDescPtr op_desc, string so_name) | |||
| GE_CHK_RT(rtStreamCreate(&stream, 0)); | |||
| GE_CHK_RT(rtCpuKernelLaunch(nullptr, kLoadOpFromBuf, 1, args, args_size, nullptr, stream)); | |||
| GELOGI("LaunchCustAicpuSo so buf len %u, so name len %u.", aicpu_data_length, so_name.size()); | |||
| status = rtStreamSynchronize(stream); | |||
| if (status != RT_ERROR_NONE) { | |||
| GELOGE(RT_FAILED, "Call rt stream sync failed, status: 0x%x", status); | |||
| @@ -270,9 +270,9 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelManager { | |||
| ge::Status DestroyAicpuSessionForInfer(uint32_t model_id); | |||
| ge::Status LoadCustAicpuSo(const OpDescPtr op_desc, string so_name); | |||
| ge::Status LaunchCustAicpuSo(const OpDescPtr op_desc, string so_name); | |||
| ge::Status LoadCustAicpuSo(const OpDescPtr op_desc, const string &so_name); | |||
| ge::Status LaunchCustAicpuSo(const OpDescPtr op_desc, const string &so_name); | |||
| ge::Status ClearAICPUSo(void *ctx); | |||
| ge::Status GetOrigInputInfo(uint32_t model_id, uint32_t index, OriginInputInfo &orig_input_info); | |||
| @@ -340,7 +340,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelManager { | |||
| std::set<uint64_t> sess_ids_; | |||
| std::vector<rtExceptionInfo> exception_infos_; | |||
| std::mutex cust_aicpu_mutex_; | |||
| std::set<std::string> cust_aicpu_so_; | |||
| std::map<uintptr_t, std::set<std::string>> cust_aicpu_so_; | |||
| static DumpProperties dump_properties_; | |||
| }; | |||
| @@ -479,13 +479,15 @@ vector<void *> ModelUtils::GetWorkspaceDataAddrs(const RuntimeParam &model_param | |||
| ge::AttrUtils::GetListInt(op_desc, ATTR_NAME_WORKSPACE_TYPE_LIST, workspace_memory_type); | |||
| for (size_t i = 0; i < v_workspace_bytes.size(); ++i) { | |||
| // Temporary solution, the aicpu workspace of multiple images cannot be shared. | |||
| if (has_workspace_reuse && i < workspace_reuse_flag.size() && !workspace_reuse_flag[i]) { | |||
| if (has_workspace_reuse && i < workspace_reuse_flag.size() | |||
| && !workspace_reuse_flag[i] && !model_param.is_single_op) { | |||
| void *mem_addr = model_param.aicpu_mem_mall->Acquire(v_workspace_offset[i], v_workspace_bytes[i]); | |||
| v_workspace_data_addr.push_back(mem_addr); | |||
| GELOGI( | |||
| "[IMAS]GetWorkspaceDataAddrs graph_%u type[F] name[%s] aicpu workspace[%zu] offset[%ld] bytes[%ld] " | |||
| "memaddr[%p]", | |||
| model_param.graph_id, op_desc->GetName().c_str(), i, v_workspace_offset[i], v_workspace_bytes[i], mem_addr); | |||
| continue; | |||
| } else if (has_mem_type_workspace && workspace_memory_type[i] == RT_MEMORY_P2P_DDR) { | |||
| int64_t p2p_workspace_offset = v_workspace_offset[i]; | |||
| int64_t p2p_workspace_bytes = v_workspace_bytes[i]; | |||
| @@ -0,0 +1,54 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| #include "graph/load/new_model_manager/task_info/model_exit_task_info.h" | |||
| #include "common/properties_manager.h" | |||
| #include "framework/common/debug/ge_log.h" | |||
| #include "graph/load/new_model_manager/davinci_model.h" | |||
| namespace ge { | |||
| Status ModelExitTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *davinci_model) { | |||
| GELOGI("InitModelExitTaskInfo Init Start."); | |||
| if (davinci_model == nullptr) { | |||
| GELOGE(PARAM_INVALID, "davinci_model is null!"); | |||
| return PARAM_INVALID; | |||
| } | |||
| Status ret = SetStream(task_def.stream_id(), davinci_model->GetStreamList()); | |||
| if (ret != SUCCESS) { | |||
| GELOGE(ret, "SetStream fail, stream_id:%u", task_def.stream_id()); | |||
| return ret; | |||
| } | |||
| model_ = davinci_model->GetRtModelHandle(); | |||
| GELOGI("InitModelExitTaskInfo Init Success, model:%p, stream:%p", model_, stream_); | |||
| return SUCCESS; | |||
| } | |||
| Status ModelExitTaskInfo::Distribute() { | |||
| GELOGI("ModelExitTaskInfo Distribute Start."); | |||
| rtError_t rt_ret = rtModelExit(model_, stream_); | |||
| if (rt_ret != RT_ERROR_NONE) { | |||
| GELOGE(RT_FAILED, "Call rtModelExit failed, ret: 0x%x", rt_ret); | |||
| return RT_ERROR_TO_GE_STATUS(rt_ret); | |||
| } | |||
| GELOGI("ModelExitTaskInfo Distribute Success."); | |||
| return SUCCESS; | |||
| } | |||
| REGISTER_TASK_INFO(RT_MODEL_TASK_MODEL_EXIT, ModelExitTaskInfo); | |||
| } // namespace ge | |||
| @@ -0,0 +1,37 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| #ifndef GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_MODEL_EXIT_TASK_INFO_H_ | |||
| #define GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_MODEL_EXIT_TASK_INFO_H_ | |||
| #include "graph/load/new_model_manager/task_info/task_info.h" | |||
| namespace ge { | |||
| class ModelExitTaskInfo : public TaskInfo { | |||
| public: | |||
| ModelExitTaskInfo() {} | |||
| ~ModelExitTaskInfo() override { model_ = nullptr; } | |||
| Status Init(const domi::TaskDef &task_def, DavinciModel *davinci_model) override; | |||
| Status Distribute() override; | |||
| private: | |||
| rtModel_t model_{nullptr}; | |||
| }; | |||
| } // namespace ge | |||
| #endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_MODEL_EXIT_TASK_INFO_H_ | |||
| @@ -56,6 +56,7 @@ struct RuntimeParam { | |||
| uint32_t label_num = 0; | |||
| uint64_t session_id = 0; | |||
| uint32_t graph_id = 0; | |||
| bool is_single_op = false; | |||
| std::unique_ptr<TsMemMall> ts_mem_mall; | |||
| std::unique_ptr<TsMemMall> aicpu_mem_mall; | |||
| @@ -694,6 +694,7 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector<Ge | |||
| } | |||
| } | |||
| // BUILD_MODE_TUNING with BUILD_STEP_AFTER_MERGE no need PreRunOptimizeSubGraph. | |||
| bool run_optimize_subgraph = | |||
| !((options_.build_mode == BUILD_MODE_TUNING) && (options_.build_step == BUILD_STEP_AFTER_MERGE)); | |||
| @@ -84,6 +84,22 @@ Status FlowCtrlPass::Run(ComputeGraphPtr compute_graph) { | |||
| return graph_change ? SUCCESS : NOT_CHANGED; | |||
| } | |||
| bool FlowCtrlPass::CheckMultiDataSet(ComputeGraphPtr &compute_graph) { | |||
| int data_set_num = 0; | |||
| for (auto &node : compute_graph->GetDirectNode()) { | |||
| if (node == nullptr) { | |||
| continue; | |||
| } | |||
| string type; | |||
| bool is_found = AttrUtils::GetStr(node->GetOpDesc(), ATTR_NAME_FRAMEWORK_ORIGINAL_TYPE, type); | |||
| if (is_found && type == "IteratorV2") { | |||
| data_set_num++; | |||
| } | |||
| } | |||
| GELOGI("The ComputeGraph contain %d dataSet.", data_set_num); | |||
| return (data_set_num > 1) ? true : false; | |||
| } | |||
| NodePtr FlowCtrlPass::InsertOp(ComputeGraphPtr &compute_graph, const string &node_type, const string &node_name, | |||
| const std::vector<GeTensorDesc> &input_list, | |||
| const std::vector<GeTensorDesc> &output_list) { | |||
| @@ -310,12 +326,12 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||
| * loopCond | |||
| * | | |||
| * v | |||
| * switch --> Assign | |||
| * switch --> Assign --> active --> ModelExit | |||
| * ^ | |||
| * | | |||
| * loopReset | |||
| */ | |||
| // Insert Assign node | |||
| // Insert Assign node and ctrl edge | |||
| NodePtr assign_node = | |||
| InsertAssignOp(compute_graph, ASSIGN, NODE_NAME_FLOWCTRL_LOOP_ASSIGN, loop_cond_node, loop_reset_node); | |||
| if (assign_node == nullptr || switch_node == nullptr) { | |||
| @@ -325,13 +341,49 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||
| GE_CHK_STATUS_RET(SetStreamLabel(assign_node, switch_node->GetName()), "set stream label failed"); | |||
| // 3. Insert ctrl edges | |||
| graphStatus add_ret = GraphUtils::AddEdge(switch_node->GetOutControlAnchor(), assign_node->GetInControlAnchor()); | |||
| if (add_ret != GRAPH_SUCCESS) { | |||
| GELOGE(FAILED, "Add switch_node to assign_node ctrl edge failed, add_ret=%u.", add_ret); | |||
| return FAILED; | |||
| } | |||
| if (CheckMultiDataSet(compute_graph)) { | |||
| GELOGI("Multi dataSae exist, model_exit node is need."); | |||
| // 2. Insert active node and add ctrl edge | |||
| string active_name = switch_node->GetName() + "_StreamExitActive"; | |||
| NodePtr active_node = InsertOp(compute_graph, STREAMACTIVE, active_name, {}, {}); | |||
| if (active_node == nullptr) { | |||
| GELOGE(FAILED, "Insert stream active node:%s for IterCtrlTrueStream failed.", active_name.c_str()); | |||
| return FAILED; | |||
| } | |||
| GE_CHK_STATUS_RET(SetStreamLabel(active_node, switch_node->GetName()), "set stream label failed"); | |||
| GE_IF_BOOL_EXEC(!AttrUtils::SetBool(active_node->GetOpDesc(), ATTR_NAME_IS_LOOP_ACTIVE, true), | |||
| DOMI_LOGE("set ATTR_NAME_IS_LOOP_ACTIVE failed"); return FAILED); | |||
| string model_exit_name = switch_node->GetName() + "_ModelExit"; | |||
| GE_CHK_STATUS_RET(SetActiveLabelList(active_node, { model_exit_name }), "set active label list failed"); | |||
| add_ret = GraphUtils::AddEdge(assign_node->GetOutControlAnchor(), active_node->GetInControlAnchor()); | |||
| if (add_ret != GRAPH_SUCCESS) { | |||
| GELOGE(FAILED, "Add assign_node to active_node ctrl edge failed, add_ret=%u.", add_ret); | |||
| return FAILED; | |||
| } | |||
| // 3. Insert model exit node and add ctrl edge | |||
| NodePtr model_exit_node = InsertOp(compute_graph, MODELEXIT, model_exit_name, {}, {}); | |||
| if (model_exit_node == nullptr) { | |||
| GELOGE(FAILED, "Insert model_exit node:%s for IterCtrlTrueStream failed.", model_exit_name.c_str()); | |||
| return FAILED; | |||
| } | |||
| GE_CHK_STATUS_RET(SetStreamLabel(model_exit_node, model_exit_name), "set stream label failed"); | |||
| add_ret = GraphUtils::AddEdge(active_node->GetOutControlAnchor(), model_exit_node->GetInControlAnchor()); | |||
| if (add_ret != GRAPH_SUCCESS) { | |||
| GELOGE(FAILED, "Add active_node to model_exit_node ctrl edge failed, add_ret=%u.", add_ret); | |||
| return FAILED; | |||
| } | |||
| } | |||
| GELOGI("CreateIterCtrlFalseBranch success."); | |||
| return SUCCESS; | |||
| } | |||
| @@ -134,6 +134,14 @@ class FlowCtrlPass : public GraphPass { | |||
| /// Other: failed | |||
| /// | |||
| Status AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, NodePtr &loop_after_node); | |||
| /// | |||
| /// add special iterator ctrl nodes(small cycle). | |||
| /// @param compute_graph graph | |||
| /// @return true: two or more dataSet exist | |||
| /// false: only one dataSet exist | |||
| /// | |||
| bool CheckMultiDataSet(ComputeGraphPtr &compute_graph); | |||
| }; | |||
| } // namespace ge | |||
| @@ -15,20 +15,40 @@ | |||
| */ | |||
| #include "graph/passes/mark_agnostic_pass.h" | |||
| #include "utils/node_utils.h" | |||
| #include "graph/utils/node_utils.h" | |||
| namespace ge { | |||
| Status MarkAgnosticPass::Run(ComputeGraphPtr graph) { | |||
| for (const auto &node : graph->GetDirectNode()) { | |||
| auto node_type = NodeUtils::GetNodeType(*node); | |||
| if (node_type == SWITCH || node_type == REFSWITCH || node_type == SWITCHN) { | |||
| GELOGD("Mark format agnostic for switch ndoe %s", node->GetName().c_str()); | |||
| GELOGD("Mark format agnostic and continuous for switch node %s", node->GetName().c_str()); | |||
| const OpDescPtr op_desc = node->GetOpDesc(); | |||
| const GeTensorDescPtr op_tensor = op_desc->MutableInputDesc(0); | |||
| if (op_tensor == nullptr) { | |||
| GELOGD("Op: %s, Index:0,has no input", node->GetName().c_str()); | |||
| continue; | |||
| } | |||
| AttrUtils::SetInt(op_tensor, "_format_continuous", 1); | |||
| AttrUtils::SetInt(node->GetOpDesc(), "_format_agnostic", 1); | |||
| AttrUtils::SetListInt(node->GetOpDesc(), "_format_agnostic_except_input", std::vector<int64_t>({1})); | |||
| continue; | |||
| } | |||
| if (node_type == IDENTITY) { | |||
| GELOGD("Mark format agnostic for identity node %s", node->GetName().c_str()); | |||
| AttrUtils::SetInt(node->GetOpDesc(), "_format_agnostic", 1); | |||
| AttrUtils::SetListInt(node->GetOpDesc(), "_format_agnostic_except_input", std::vector<int64_t>({1})); | |||
| continue; | |||
| } | |||
| if (node_type == MERGE || node_type == REFMERGE) { | |||
| GELOGD("Mark format agnostic for merge node %s", node->GetName().c_str()); | |||
| GELOGD("Mark format agnostic and continuous for merge node %s", node->GetName().c_str()); | |||
| const OpDescPtr op_desc = node->GetOpDesc(); | |||
| const GeTensorDescPtr op_tensor = op_desc->MutableOutputDesc(0); | |||
| if (op_tensor == nullptr) { | |||
| GELOGD("Op: %s, Index:0,has no output", node->GetName().c_str()); | |||
| continue; | |||
| } | |||
| AttrUtils::SetInt(op_tensor, "_format_continuous", 1); | |||
| AttrUtils::SetInt(node->GetOpDesc(), "_format_agnostic", 1); | |||
| AttrUtils::SetListInt(node->GetOpDesc(), "_format_agnostic_except_output", std::vector<int64_t>({1})); | |||
| continue; | |||
| @@ -36,4 +56,4 @@ Status MarkAgnosticPass::Run(ComputeGraphPtr graph) { | |||
| } | |||
| return SUCCESS; | |||
| } | |||
| } | |||
| } // namespace ge | |||
| @@ -130,6 +130,14 @@ graphStatus TransOpWithoutReshapeFusionPass::GetSubGraphNodesInfo() { | |||
| sub_graph_has_reshape_node[i] = true; | |||
| break; | |||
| } | |||
| if (in_node->GetType() == TRANSPOSE || in_node->GetType() == TRANSPOSED) { | |||
| auto input_format = in_node->GetOpDesc()->GetInputDescPtr(0)->GetFormat(); | |||
| auto output_format = in_node->GetOpDesc()->GetOutputDescPtr(0)->GetFormat(); | |||
| if (input_format == output_format) { | |||
| sub_graph_has_reshape_node[i] = true; | |||
| break; | |||
| } | |||
| } | |||
| auto out_anchor = iter->first; | |||
| GE_CHECK_NOTNULL(out_anchor); | |||
| @@ -46,6 +46,15 @@ Status TransposeTransDataPass::Run(NodePtr &node) { | |||
| if (op_desc->GetType() != TRANSPOSED) { | |||
| return SUCCESS; | |||
| } | |||
| auto input_format = op_desc->GetInputDescPtr(0)->GetFormat(); | |||
| auto output_format = op_desc->GetOutputDescPtr(0)->GetFormat(); | |||
| if (input_format == output_format) { | |||
| GELOGW("Node %s input format is %s, output format is %s, should not happend. Ignore pass.", | |||
| op_desc->GetName().c_str(), | |||
| TypeUtils::FormatToSerialString(input_format).c_str(), | |||
| TypeUtils::FormatToSerialString(output_format).c_str()); | |||
| return SUCCESS; | |||
| } | |||
| if (CheckOneInAndOneOutDataAnchor(node) != SUCCESS) { | |||
| return FAILED; | |||
| } | |||
| @@ -92,6 +92,7 @@ | |||
| #include "graph/passes/unused_op_remove_pass.h" | |||
| #include "graph/passes/var_is_initialized_op_pass.h" | |||
| #include "graph/passes/variable_prepare_op_pass.h" | |||
| #include "graph/passes/mark_agnostic_pass.h" | |||
| #include "graph/preprocess/insert_op/util_insert_aipp_op.h" | |||
| #include "graph/types.h" | |||
| #include "graph/utils/tensor_utils.h" | |||
| @@ -1626,6 +1627,7 @@ Status GraphPrepare::PrepareOptimize() { | |||
| try { | |||
| (void)original_graph_passes.AddPass("PrepareOptimize::ShapeOperateOpRemovePass", new ShapeOperateOpRemovePass); | |||
| (void)original_graph_passes.AddPass("PrepareOptimize::ReplaceTransShapePass", new ReplaceTransShapePass); | |||
| (void)original_graph_passes.AddPass("PrepareOptimize::MarkAgnosticPass", new MarkAgnosticPass); | |||
| } catch (std::bad_alloc &e) { | |||
| GELOGE(INTERNAL_ERROR, "Add pass failed, bad memory allocation occurs."); | |||
| return INTERNAL_ERROR; | |||
| @@ -183,6 +183,11 @@ Status AippOp::InsertAippToGraph(ComputeGraphPtr &graph, std::string &aippConfig | |||
| GE_CHECK_NOTNULL(graph); | |||
| NodePtr target_input = nullptr; | |||
| std::vector<std::pair<OutDataAnchorPtr, InDataAnchorPtr>> target_edges; | |||
| if (this->ConvertRelatedInputNameToRank() != SUCCESS) { | |||
| GELOGE(FAILED, "AippOp: convert related input name to rank failed."); | |||
| return FAILED; | |||
| } | |||
| GE_CHK_STATUS_RET(this->GetTargetPosition(graph, target_input, target_edges), "Get data nodes position failed"); | |||
| std::map<OutDataAnchorPtr, NodePtr> out_anchors_to_aipp; | |||
| @@ -410,6 +415,38 @@ Status AippOp::GetStaticTargetNode(const ComputeGraphPtr &graph, NodePtr &data_n | |||
| return SUCCESS; | |||
| } | |||
| Status AippOp::ConvertRelatedInputNameToRank() { | |||
| GE_CHECK_NOTNULL(aipp_params_); | |||
| string related_input_name = aipp_params_->related_input_name(); | |||
| if(related_input_name.empty()) { | |||
| return SUCCESS; | |||
| } | |||
| std::vector<std::string> data_top_names = domi::GetContext().data_top_names; | |||
| GELOGI("Convert name to rank start: data size[%zu]", data_top_names.size()); | |||
| uint32_t index = 0; | |||
| bool convert_flag = false; | |||
| for (const auto &data_top_name : data_top_names) { | |||
| if (related_input_name == data_top_name) { | |||
| aipp_params_->set_related_input_rank(index); | |||
| convert_flag = true; | |||
| GELOGI("AippOp: rank: %u, top name: %s.", index, data_top_name.c_str()); | |||
| break; | |||
| } | |||
| index++; | |||
| } | |||
| if (!convert_flag) { | |||
| string error_msg = "Top name " + related_input_name + "convert rank failed, Please" | |||
| " ensure top name in aipp config is the top name of data node."; | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); | |||
| GELOGE(PARAM_INVALID, "Top name[%s] converts rank failed.", related_input_name.c_str()); | |||
| return PARAM_INVALID; | |||
| } | |||
| return SUCCESS; | |||
| } | |||
| Status AippOp::GetTargetPosition(ComputeGraphPtr graph, NodePtr &target_input, | |||
| std::vector<std::pair<OutDataAnchorPtr, InDataAnchorPtr>> &target_edges) { | |||
| @@ -82,6 +82,7 @@ class AippOp : public InsertOpBase { | |||
| Status AddNodeToGraph(const NodePtr &aipp_node, int64_t max_dynamic_aipp_size); | |||
| Status AddAippAttrbutes(const OpDescPtr &op_desc, const std::string &aipp_cfg_path, const uint32_t &index); | |||
| Status AddAttrToAippData(const OpDescPtr &aipp_data_op_desc); | |||
| Status ConvertRelatedInputNameToRank(); | |||
| domi::AippOpParams *aipp_params_ = nullptr; | |||
| ge::NodePtr aipp_node_ = nullptr; | |||
| @@ -34,6 +34,7 @@ | |||
| #include "graph/utils/op_desc_utils.h" | |||
| #include "graph/utils/tensor_utils.h" | |||
| #include "graph/utils/type_utils.h" | |||
| #include "util_insert_aipp_op.h" | |||
| using domi::AippOpParams; | |||
| @@ -115,22 +116,94 @@ void InsertNewOpUtil::ClearNewOps() { | |||
| } | |||
| } | |||
| Status InsertNewOpUtil::CheckPositionNotRepeat() { | |||
| Status InsertNewOpUtil::CheckInputNamePositionNotRepeat() { | |||
| for (int i = 0; i < insert_op_conf_->aipp_op_size(); i++) { | |||
| const domi::AippOpParams *item = insert_op_conf_->mutable_aipp_op(i); | |||
| GE_CHECK_NOTNULL(item); | |||
| for (int j = i + 1; j < insert_op_conf_->aipp_op_size(); j++) { | |||
| const domi::AippOpParams *another_item = insert_op_conf_->mutable_aipp_op(j); | |||
| GE_CHECK_NOTNULL(another_item); | |||
| if (another_item->related_input_name().empty()) { | |||
| string error_msg = "Can not both set related_input_name and related_input_rank!" | |||
| " Please ensure param is the same with the first aipp config(related_input_name)."; | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); | |||
| GELOGE(PARAM_INVALID, | |||
| "Can not both set related_input_rank and related_input_name!" | |||
| " Please ensure param is the same with the first aipp config(related_input_name)."); | |||
| return PARAM_INVALID; | |||
| } | |||
| if (item->related_input_name() == another_item->related_input_name()) { | |||
| string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_name" | |||
| " param is different in different aipp config."; | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); | |||
| GELOGE(PARAM_INVALID, | |||
| "Can not insert aipp op to the same postion! Please ensure related_input_rank param " | |||
| "is different in different aipp config."); | |||
| return PARAM_INVALID; | |||
| } | |||
| } | |||
| } | |||
| return SUCCESS; | |||
| } | |||
| Status InsertNewOpUtil::CheckInputRankPositionNoRepeat() { | |||
| for (int i = 0; i < insert_op_conf_->aipp_op_size(); i++) { | |||
| const domi::AippOpParams *item = insert_op_conf_->mutable_aipp_op(i); | |||
| GE_CHECK_NOTNULL(item); | |||
| for (int j = i + 1; j < insert_op_conf_->aipp_op_size(); j++) { | |||
| const domi::AippOpParams *another_item = insert_op_conf_->mutable_aipp_op(j); | |||
| GE_IF_BOOL_EXEC(item->related_input_rank() == another_item->related_input_rank(), | |||
| string errormsg = "Can not insert aipp to the same postion! Please ensure related_input_rank" | |||
| " param is different in different aipp config."; | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); | |||
| GELOGE(PARAM_INVALID, | |||
| "Can not insert aipp op to the same postion! Please ensure related_input_rank param " | |||
| "is different in different aipp config."); | |||
| return PARAM_INVALID;); | |||
| GE_CHECK_NOTNULL(another_item); | |||
| if (!another_item->related_input_name().empty()) { | |||
| string error_msg = "Can not both set related_input_rank and related_input_name!" | |||
| " Please ensure param is the same with the first aipp config(related_input_rank)."; | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); | |||
| GELOGE(PARAM_INVALID, | |||
| "Can not both set related_input_rank and related_input_name!" | |||
| " Please ensure param is the same with the first aipp config(related_input_rank)."); | |||
| return PARAM_INVALID; | |||
| } | |||
| if (item->related_input_rank() == another_item->related_input_rank()) { | |||
| string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_rank" | |||
| " param is different in different aipp config."; | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); | |||
| GELOGE(PARAM_INVALID, | |||
| "Can not insert aipp op to the same postion! Please ensure related_input_rank param " | |||
| "is different in different aipp config."); | |||
| return PARAM_INVALID; | |||
| } | |||
| } | |||
| } | |||
| return SUCCESS; | |||
| } | |||
| Status InsertNewOpUtil::CheckPositionNotRepeat() { | |||
| GE_CHECK_NOTNULL(insert_op_conf_); | |||
| if (insert_op_conf_->aipp_op_size() <= 1) { | |||
| GELOGI("Aipp op size[%d] less than 2, no need to check position repeat.", insert_op_conf_->aipp_op_size()); | |||
| return SUCCESS; | |||
| } | |||
| const domi::AippOpParams *item = insert_op_conf_->mutable_aipp_op(0); | |||
| GE_CHECK_NOTNULL(item); | |||
| string related_input_name = item->related_input_name(); | |||
| Status ret = FAILED; | |||
| if (related_input_name.empty()) { | |||
| ret = CheckInputRankPositionNoRepeat(); | |||
| } else { | |||
| ret = CheckInputNamePositionNotRepeat(); | |||
| } | |||
| if (ret != SUCCESS) { | |||
| GELOGE(FAILED, "Check position not repeat failed."); | |||
| return FAILED; | |||
| } | |||
| return SUCCESS; | |||
| } | |||
| @@ -51,6 +51,10 @@ class InsertNewOpUtil { | |||
| Status GetAippParams(const std::unique_ptr<domi::AippOpParams> &aippParams, const ge::NodePtr &aipp_node); | |||
| Status CheckInputNamePositionNotRepeat(); | |||
| Status CheckInputRankPositionNoRepeat(); | |||
| Status CheckGraph(const ge::ComputeGraphPtr &graph); | |||
| InsertNewOpUtil() = default; | |||
| @@ -28,7 +28,6 @@ target_include_directories(host_cpu_engine PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -36,6 +35,8 @@ target_include_directories(host_cpu_engine PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(host_cpu_engine PRIVATE | |||
| @@ -67,7 +68,6 @@ target_include_directories(atc_host_cpu_engine PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -75,6 +75,8 @@ target_include_directories(atc_host_cpu_engine PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(atc_host_cpu_engine PRIVATE | |||
| @@ -107,7 +109,6 @@ target_include_directories(host_cpu_opskernel_builder PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -115,6 +116,8 @@ target_include_directories(host_cpu_opskernel_builder PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(host_cpu_opskernel_builder PRIVATE | |||
| @@ -141,7 +144,6 @@ target_include_directories(atc_host_cpu_opskernel_builder PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -149,6 +151,8 @@ target_include_directories(atc_host_cpu_opskernel_builder PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(atc_host_cpu_opskernel_builder PRIVATE | |||
| @@ -180,7 +184,6 @@ target_include_directories(host_cpu_opskernel_builder_static PRIVATE | |||
| ${GE_CODE_DIR}/inc | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${METADEF_DIR}/inc/external/graph | |||
| @@ -188,6 +191,8 @@ target_include_directories(host_cpu_opskernel_builder_static PRIVATE | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(host_cpu_opskernel_builder_static PRIVATE | |||
| @@ -45,11 +45,12 @@ target_include_directories(atc PRIVATE | |||
| ${PARSER_DIR} | |||
| ${CMAKE_BINARY_DIR} | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| ${GE_CODE_DIR}/../inc/common | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | |||
| ) | |||
| target_link_libraries(atc PRIVATE | |||
| @@ -194,6 +194,11 @@ DEFINE_int32(op_debug_level, 0, "Optional; configure debug level of compiler. 0( | |||
| "1: open TBE compiler, export ccec file and TBE instruction mapping file; 2: open ccec compiler"); | |||
| DEFINE_string(enable_scope_fusion_passes, "", "Optional; validate the non-general scope fusion pass," | |||
| "multiple names can be set and separated by ','."); | |||
| DEFINE_string(debug_dir, "", "Optional; the path to save the intermediate files of operator compilation"); | |||
| DEFINE_string(op_compiler_cache_dir, "", "Optional; the path to cache operator compilation files"); | |||
| DEFINE_string(op_compiler_cache_mode, "", "Optional; choose the operator compiler cache mode"); | |||
| class GFlagUtils { | |||
| public: | |||
| @@ -999,6 +1004,9 @@ static void SetEnvForSingleOp(std::map<string, string> &options) { | |||
| options.emplace(ge::AUTO_TUNE_MODE, FLAGS_auto_tune_mode); | |||
| options.emplace(ge::GRAPH_MEMORY_MAX_SIZE, kGraphMemoryManagerMallocMaxSize); | |||
| options.emplace(ge::OP_DEBUG_LEVEL, to_string(FLAGS_op_debug_level)); | |||
| options.emplace(ge::DEBUG_DIR, FLAGS_debug_dir); | |||
| options.emplace(ge::OP_COMPILER_CACHE_DIR, FLAGS_op_compiler_cache_dir); | |||
| options.emplace(ge::OP_COMPILER_CACHE_MODE, FLAGS_op_compiler_cache_mode); | |||
| } | |||
| domi::Status GenerateSingleOp(const std::string& json_file_path) { | |||
| @@ -1131,6 +1139,12 @@ domi::Status GenerateOmModel() { | |||
| options.insert(std::pair<string, string>(string(ge::ENABLE_SINGLE_STREAM), FLAGS_enable_single_stream)); | |||
| options.insert(std::pair<string, string>(string(ge::DEBUG_DIR), FLAGS_debug_dir)); | |||
| options.insert(std::pair<string, string>(string(ge::OP_COMPILER_CACHE_DIR), FLAGS_op_compiler_cache_dir)); | |||
| options.insert(std::pair<string, string>(string(ge::OP_COMPILER_CACHE_MODE), FLAGS_op_compiler_cache_mode)); | |||
| SetDynamicInputSizeOptions(); | |||
| if (!FLAGS_save_original_model.empty()) { | |||
| @@ -45,6 +45,9 @@ message AippOpParams { | |||
| // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 | |||
| uint32 related_input_rank = 2; | |||
| // related_input_name is optional and the top name of data node which inserts aipp | |||
| string related_input_name = 6; | |||
| // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 | |||
| // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 | |||
| // 配置值 <= Data算子输出边的个数。 | |||
| @@ -226,10 +226,11 @@ bool SingleOpParser::Validate(const SingleOpDesc &op_desc) { | |||
| } | |||
| int index = 0; | |||
| for (auto &tensor_desc : op_desc.output_desc) { | |||
| for (auto &tensor_desc : op_desc.input_desc) { | |||
| if ((tensor_desc.type == DT_UNDEFINED && tensor_desc.format != FORMAT_RESERVED) || | |||
| (tensor_desc.type != DT_UNDEFINED && tensor_desc.format == FORMAT_RESERVED)){ | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "index"}, {"output", std::to_string(index)}); | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "type", "index"}, | |||
| {"intput", "datatype or format", std::to_string(index)}); | |||
| GELOGE(PARAM_INVALID, "Input's dataType or format is invalid when the index is %d", index); | |||
| return false; | |||
| } | |||
| @@ -239,13 +240,15 @@ bool SingleOpParser::Validate(const SingleOpDesc &op_desc) { | |||
| index = 0; | |||
| for (auto &tensor_desc : op_desc.output_desc) { | |||
| if (tensor_desc.type == DT_UNDEFINED) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "index"}, {"output", std::to_string(index)}); | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "type", "index"}, | |||
| {"output", "datatype", std::to_string(index)}); | |||
| GELOGE(PARAM_INVALID, "Output's dataType is invalid when the index is %d", index); | |||
| return false; | |||
| } | |||
| if (tensor_desc.format == FORMAT_RESERVED) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10028", {"input", "index"}, {"output", std::to_string(index)}); | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "type", "index"}, | |||
| {"output", "format", std::to_string(index)}); | |||
| GELOGE(PARAM_INVALID, "Output's format is invalid when the index is %d", index); | |||
| return false; | |||
| } | |||
| @@ -1 +1 @@ | |||
| optimizer:["aicpu_tf_optimizer","AIcoreEngine","VectorEngine","aicpu_ascend_optimizer","hccl_graph_optimizer", "hvd_graph_optimizer", "DNN_VM_RTS_GRAPH_OPTIMIZER_STORE"] | |||
| optimizer:["aicpu_tf_optimizer","aicpu_ascend_optimizer","AIcoreEngine","VectorEngine","hccl_graph_optimizer", "hvd_graph_optimizer", "DNN_VM_RTS_GRAPH_OPTIMIZER_STORE"] | |||
| @@ -21,13 +21,14 @@ target_include_directories(engine PRIVATE | |||
| ${GE_CODE_DIR}/inc/framework | |||
| ${GE_CODE_DIR}/inc/framework/common | |||
| ${GE_CODE_DIR}/inc/external | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ${METADEF_DIR}/inc | |||
| ${METADEF_DIR}/inc/external | |||
| ${CMAKE_BINARY_DIR} | |||
| ${CMAKE_BINARY_DIR}/proto/ge | |||
| #### yellow zone #### | |||
| ${GE_CODE_DIR}/../inc | |||
| #### blue zone #### | |||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
| ) | |||
| target_link_libraries(engine PRIVATE | |||
| @@ -45,6 +45,9 @@ message AippOpParams { | |||
| // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 | |||
| uint32 related_input_rank = 2; | |||
| // related_input_name is optional and the top name of data node which inserts aipp | |||
| string related_input_name = 6; | |||
| // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 | |||
| // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 | |||
| // 配置值 <= Data算子输出边的个数。 | |||
| @@ -1038,6 +1038,7 @@ void UpdateOmgCtxWithParserCtx() { | |||
| domi::GetContext().out_top_names = GetParserContext().out_top_names; | |||
| domi::GetContext().user_out_nodes_top_vec = GetParserContext().user_out_nodes_top_vec; | |||
| domi::GetContext().default_out_nodes = GetParserContext().default_out_nodes; | |||
| domi::GetContext().data_top_names = GetParserContext().data_top_names; | |||
| } | |||
| void UpdateParserCtxWithOmgCtx() { | |||
| @@ -1054,5 +1055,6 @@ void UpdateParserCtxWithOmgCtx() { | |||
| GetParserContext().input_nodes_format_map = domi::GetContext().input_nodes_format_map; | |||
| GetParserContext().out_top_names = domi::GetContext().out_top_names; | |||
| GetParserContext().user_out_nodes_top_vec = domi::GetContext().user_out_nodes_top_vec; | |||
| GetParserContext().data_top_names = domi::GetContext().data_top_names; | |||
| } | |||
| } // namespace ge | |||
| @@ -190,6 +190,7 @@ Status SingleOpModel::LoadAllNodes() { | |||
| } | |||
| ge_model->GetTBEKernelStore().LoadTBEKernelBinToOpDesc(op_desc); | |||
| ge_model->GetCustAICPUKernelStore().LoadCustAICPUKernelBinToOpDesc(op_desc); | |||
| } | |||
| return SUCCESS; | |||
| @@ -247,7 +248,7 @@ Status SingleOpModel::BuildTaskList(SingleOp &single_op) { | |||
| single_op.arg_table_.resize(single_op.input_sizes_.size() + single_op.output_sizes_.size()); | |||
| ParseArgTable(tbe_task, single_op); | |||
| single_op.tasks_.emplace_back(tbe_task); | |||
| } else if (kernel_type == cce::ccKernelType::AI_CPU) { | |||
| } else if (kernel_type == cce::ccKernelType::AI_CPU || kernel_type == cce::ccKernelType::CUST_AI_CPU) { | |||
| GELOGD("Building AICPU_CC task"); | |||
| OpTask *task = nullptr; | |||
| auto ret = BuildCpuKernelTask(task_def.kernel(), &task); | |||
| @@ -256,7 +257,7 @@ Status SingleOpModel::BuildTaskList(SingleOp &single_op) { | |||
| } | |||
| single_op.tasks_.emplace_back(task); | |||
| } else { | |||
| GELOGE(UNSUPPORTED, "Only TBE kernel and AI_CPU kernel are supported, but got %u", context.kernel_type()); | |||
| GELOGE(UNSUPPORTED, "Only TBE, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", context.kernel_type()); | |||
| return UNSUPPORTED; | |||
| } | |||
| } else if (task_type == RT_MODEL_TASK_KERNEL_EX) { | |||
| @@ -391,13 +392,13 @@ Status SingleOpModel::BuildModelTaskKernel(const TaskDef &task_def, DynamicSingl | |||
| TbeOpTask *tbe_task = nullptr; | |||
| GE_CHK_STATUS_RET_NOLOG(BuildKernelTask(task_def.kernel(), &tbe_task)); | |||
| single_op.op_task_.reset(tbe_task); | |||
| } else if (kernel_type == cce::ccKernelType::AI_CPU) { | |||
| } else if (kernel_type == cce::ccKernelType::AI_CPU || kernel_type == cce::ccKernelType::CUST_AI_CPU) { | |||
| GELOGD("Building AICPU_CC task"); | |||
| OpTask *task = nullptr; | |||
| GE_CHK_STATUS_RET_NOLOG(BuildCpuKernelTask(task_def.kernel(), &task)); | |||
| single_op.op_task_.reset(task); | |||
| } else { | |||
| GELOGE(UNSUPPORTED, "Only TBE kernel and AI_CPU kernel are supported, but got %u", context.kernel_type()); | |||
| GELOGE(UNSUPPORTED, "Only TBE, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", context.kernel_type()); | |||
| return UNSUPPORTED; | |||
| } | |||
| return SUCCESS; | |||
| @@ -15,6 +15,8 @@ | |||
| */ | |||
| #include "single_op/task/aicpu_kernel_task_builder.h" | |||
| #include "cce/taskdown_common.hpp" | |||
| #include "graph/load/new_model_manager/model_manager.h" | |||
| namespace ge { | |||
| AiCpuCCTaskBuilder::AiCpuCCTaskBuilder(const OpDescPtr &op_desc, const domi::KernelDef &kernel_def) | |||
| @@ -55,6 +57,14 @@ Status AiCpuCCTaskBuilder::BuildTask(AiCpuCCTask &task) { | |||
| task.SetkernelName(kernel_name); | |||
| task.op_desc_ = op_desc_; | |||
| const auto &context = kernel_def_.context(); | |||
| auto kernel_type = static_cast<cce::ccKernelType>(context.kernel_type()); | |||
| if (kernel_type == cce::ccKernelType::CUST_AI_CPU) { | |||
| task.is_custom_ = true; | |||
| task.dump_flag_ |= RT_KERNEL_CUSTOM_AICPU; | |||
| GE_CHK_STATUS_RET(ModelManager::GetInstance()->LoadCustAicpuSo(op_desc_, so_name), "launch cust aicpu so failed"); | |||
| } | |||
| task.num_inputs_ = op_desc_->GetInputsSize(); | |||
| task.num_outputs_ = op_desc_->GetOutputsSize(); | |||
| @@ -45,6 +45,7 @@ std::vector<std::vector<void *>> BuildTaskUtils::GetAddresses(const OpDescPtr &o | |||
| runtime_para.logic_var_base = kLogicVarBase; | |||
| runtime_para.var_base = kVarBase; | |||
| runtime_para.session_id = kSessionId; | |||
| runtime_para.is_single_op = true; | |||
| ret.emplace_back(ModelUtils::GetInputDataAddrs(runtime_para, op_desc)); | |||
| ret.emplace_back(ModelUtils::GetOutputDataAddrs(runtime_para, op_desc)); | |||
| @@ -280,8 +280,6 @@ Status AiCpuBaseTask::UpdateExtInfo(const std::vector<GeTensorDesc> &input_desc, | |||
| for (size_t j = 0; j < num_outputs_; ++j) { | |||
| GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateOutputShapeAndType(j, output_desc[j]), | |||
| "Output[%zu] UpdateOutputShapeAndType failed.", j); | |||
| // debug code | |||
| GELOGD("No input and output, no need update ext info."); | |||
| } | |||
| } | |||
| @@ -669,9 +667,10 @@ Status AiCpuCCTask::LaunchKernel(rtStream_t stream) { | |||
| kernel_name_.data()); | |||
| // sm_desc is nullptr, because l2 buffer does not support | |||
| auto *sm_desc = reinterpret_cast<rtSmDesc_t *>(sm_desc_); | |||
| auto ret = | |||
| rtCpuKernelLaunch(static_cast<const void *>(so_name_.data()), static_cast<const void *>(kernel_name_.data()), | |||
| block_dim_, args_.get(), static_cast<uint32_t>(arg_size_), sm_desc, stream); | |||
| auto ret = rtCpuKernelLaunchWithFlag(static_cast<const void *>(so_name_.data()), | |||
| static_cast<const void *>(kernel_name_.data()), | |||
| block_dim_, args_.get(), static_cast<uint32_t>(arg_size_), | |||
| sm_desc, stream, dump_flag_); | |||
| if (ret != RT_ERROR_NONE) { | |||
| GELOGE(RT_FAILED, "Invoke rtCpuKernelLaunch failed. ret = %d", ret); | |||
| return RT_FAILED; | |||
| @@ -234,6 +234,8 @@ private: | |||
| uint32_t block_dim_ = 1; | |||
| void *sm_desc_ = nullptr; | |||
| void *io_addr_ = nullptr; | |||
| bool is_custom_ = false; | |||
| uint32_t dump_flag_ = RT_KERNEL_DEFAULT; | |||
| }; | |||
| } // namespace ge | |||
| @@ -222,6 +222,18 @@ const char *const OPTION_GE_MAX_DUMP_OP_NUM = "ge.maxDumpOpNum"; | |||
| // Its value should be "0" or "1", default value is "1" | |||
| const char *const ENABLE_PRINT_OP_PASS = "ge.enablePrintOpPass"; | |||
| // Configure operator compilation path | |||
| // Its value should be file path, default value is "./" | |||
| const char *const DEBUG_DIR = "ge.debugDir"; | |||
| // Configure operator compiler cache path | |||
| // Its value should be file path, default value is "./" | |||
| const char *const OP_COMPILER_CACHE_DIR = "ge.op_compiler_cache_dir"; | |||
| // Configure operator compiler cache mode | |||
| // Its value should be "disable", "enable" or "force", default value is "disable" | |||
| const char *const OP_COMPILER_CACHE_MODE = "ge.op_compiler_cache_mode"; | |||
| // Configure whether to use single stream. | |||
| // Its value should be "true" or "false", default value is "false" | |||
| const char *const ENABLE_SINGLE_STREAM = "ge.enableSingleStream"; | |||
| @@ -238,10 +250,10 @@ enum GraphRunMode { PREDICTION = 0, TRAIN }; | |||
| // Input/Output tensor info | |||
| struct InputTensorInfo { | |||
| uint32_t data_type; // data type | |||
| std::vector<int64_t> dims; // shape description | |||
| void *data; // tensor data | |||
| int64_t length; // tensor length | |||
| uint32_t data_type; // data type | |||
| std::vector<int64_t> dims; // shape description | |||
| void *data; // tensor data | |||
| int64_t length; // tensor length | |||
| }; | |||
| struct OutputTensorInfo { | |||
| @@ -250,11 +262,8 @@ struct OutputTensorInfo { | |||
| std::unique_ptr<uint8_t[]> data; // tensor data | |||
| int64_t length; // tensor length | |||
| OutputTensorInfo() : data_type(0), dims({}), data(nullptr), length(0) {} | |||
| OutputTensorInfo(OutputTensorInfo &&out) : | |||
| data_type(out.data_type), | |||
| dims(out.dims), | |||
| data(std::move(out.data)), | |||
| length(out.length) {} | |||
| OutputTensorInfo(OutputTensorInfo &&out) | |||
| : data_type(out.data_type), dims(out.dims), data(std::move(out.data)), length(out.length) {} | |||
| OutputTensorInfo &operator=(OutputTensorInfo &&out) { | |||
| if (this != &out) { | |||
| @@ -273,67 +282,60 @@ using Status = uint32_t; | |||
| using RunAsyncCallback = std::function<void(Status, std::vector<ge::OutputTensorInfo> &)>; | |||
| // for ir build | |||
| namespace ir_option { | |||
| static const char *const INPUT_FORMAT = "input_format"; | |||
| static const char *const INPUT_SHAPE = "input_shape"; | |||
| static const char *const OP_NAME_MAP = "op_name_map"; | |||
| static const char *const DYNAMIC_BATCH_SIZE = kDynamicBatchSize; | |||
| static const char *const DYNAMIC_IMAGE_SIZE = kDynamicImageSize; | |||
| static const char *const DYNAMIC_DIMS = kDynamicDims; | |||
| static const char *const INSERT_OP_FILE = ge::INSERT_OP_FILE.c_str(); | |||
| static const char *const PRECISION_MODE = ge::PRECISION_MODE.c_str(); | |||
| static const char *const EXEC_DISABLE_REUSED_MEMORY = ge::OPTION_EXEC_DISABLE_REUSED_MEMORY; | |||
| static const char *const AUTO_TUNE_MODE = ge::AUTO_TUNE_MODE.c_str(); | |||
| static const char *const CORE_TYPE = ge::CORE_TYPE.c_str(); | |||
| static const char *const SOC_VERSION = ge::SOC_VERSION.c_str(); | |||
| static const char *const ENABLE_SINGLE_STREAM = ge::ENABLE_SINGLE_STREAM; | |||
| static const char *const AICORE_NUM = ge::AICORE_NUM.c_str(); | |||
| static const char *const FUSION_SWITCH_FILE = ge::FUSION_SWITCH_FILE.c_str(); | |||
| static const char *const ENABLE_SMALL_CHANNEL = ge::ENABLE_SMALL_CHANNEL.c_str(); | |||
| static const char *const OP_SELECT_IMPL_MODE = ge::OP_SELECT_IMPL_MODE.c_str(); | |||
| static const char *const OUTPUT_TYPE = ge::OUTPUT_DATATYPE.c_str(); | |||
| static const char *const BUFFER_OPTIMIZE = ge::BUFFER_OPTIMIZE.c_str(); | |||
| static const char *const ENABLE_COMPRESS_WEIGHT = ge::ENABLE_COMPRESS_WEIGHT.c_str(); | |||
| static const char *const COMPRESS_WEIGHT_CONF = "compress_weight_conf"; | |||
| static const char *const OUT_NODES = ge::OUTPUT_NODE_NAME.c_str(); | |||
| static const char *const INPUT_FP16_NODES = ge::INPUT_FP16_NODES.c_str(); | |||
| static const char *const LOG_LEVEL = "log"; | |||
| static const char *const OPTYPELIST_FOR_IMPLMODE = ge::OPTYPELIST_FOR_IMPLMODE.c_str(); | |||
| // for interface: aclgrphBuildModel | |||
| const std::set<std::string> ir_builder_suppported_options = { | |||
| INPUT_FORMAT, | |||
| INPUT_SHAPE, | |||
| OP_NAME_MAP, | |||
| DYNAMIC_BATCH_SIZE, | |||
| DYNAMIC_IMAGE_SIZE, | |||
| DYNAMIC_DIMS, | |||
| INSERT_OP_FILE, | |||
| PRECISION_MODE, | |||
| EXEC_DISABLE_REUSED_MEMORY, | |||
| AUTO_TUNE_MODE, | |||
| OUTPUT_TYPE, | |||
| OUT_NODES, | |||
| INPUT_FP16_NODES, | |||
| LOG_LEVEL | |||
| }; | |||
| // for interface: aclgrphBuildInitialize | |||
| const std::set<std::string> global_options = { | |||
| CORE_TYPE, | |||
| SOC_VERSION, | |||
| BUFFER_OPTIMIZE, | |||
| ENABLE_COMPRESS_WEIGHT, | |||
| COMPRESS_WEIGHT_CONF, | |||
| PRECISION_MODE, | |||
| EXEC_DISABLE_REUSED_MEMORY, | |||
| AUTO_TUNE_MODE, | |||
| ENABLE_SINGLE_STREAM, | |||
| AICORE_NUM, | |||
| FUSION_SWITCH_FILE, | |||
| ENABLE_SMALL_CHANNEL, | |||
| OP_SELECT_IMPL_MODE, | |||
| OPTYPELIST_FOR_IMPLMODE | |||
| }; | |||
| } | |||
| static const char *const INPUT_FORMAT = "input_format"; | |||
| static const char *const INPUT_SHAPE = "input_shape"; | |||
| static const char *const OP_NAME_MAP = "op_name_map"; | |||
| static const char *const DYNAMIC_BATCH_SIZE = kDynamicBatchSize; | |||
| static const char *const DYNAMIC_IMAGE_SIZE = kDynamicImageSize; | |||
| static const char *const DYNAMIC_DIMS = kDynamicDims; | |||
| static const char *const INSERT_OP_FILE = ge::INSERT_OP_FILE.c_str(); | |||
| static const char *const PRECISION_MODE = ge::PRECISION_MODE.c_str(); | |||
| static const char *const EXEC_DISABLE_REUSED_MEMORY = ge::OPTION_EXEC_DISABLE_REUSED_MEMORY; | |||
| static const char *const AUTO_TUNE_MODE = ge::AUTO_TUNE_MODE.c_str(); | |||
| static const char *const CORE_TYPE = ge::CORE_TYPE.c_str(); | |||
| static const char *const SOC_VERSION = ge::SOC_VERSION.c_str(); | |||
| static const char *const ENABLE_SINGLE_STREAM = ge::ENABLE_SINGLE_STREAM; | |||
| static const char *const AICORE_NUM = ge::AICORE_NUM.c_str(); | |||
| static const char *const FUSION_SWITCH_FILE = ge::FUSION_SWITCH_FILE.c_str(); | |||
| static const char *const ENABLE_SMALL_CHANNEL = ge::ENABLE_SMALL_CHANNEL.c_str(); | |||
| static const char *const OP_SELECT_IMPL_MODE = ge::OP_SELECT_IMPL_MODE.c_str(); | |||
| static const char *const OUTPUT_TYPE = ge::OUTPUT_DATATYPE.c_str(); | |||
| static const char *const BUFFER_OPTIMIZE = ge::BUFFER_OPTIMIZE.c_str(); | |||
| static const char *const ENABLE_COMPRESS_WEIGHT = ge::ENABLE_COMPRESS_WEIGHT.c_str(); | |||
| static const char *const COMPRESS_WEIGHT_CONF = "compress_weight_conf"; | |||
| static const char *const OUT_NODES = ge::OUTPUT_NODE_NAME.c_str(); | |||
| static const char *const INPUT_FP16_NODES = ge::INPUT_FP16_NODES.c_str(); | |||
| static const char *const LOG_LEVEL = "log"; | |||
| static const char *const OPTYPELIST_FOR_IMPLMODE = ge::OPTYPELIST_FOR_IMPLMODE.c_str(); | |||
| static const char *const DEBUG_DIR = ge::DEBUG_DIR; | |||
| static const char *const OP_COMPILER_CACHE_DIR = ge::OP_COMPILER_CACHE_DIR; | |||
| static const char *const OP_COMPILER_CACHE_MODE = ge::OP_COMPILER_CACHE_MODE; | |||
| // for interface: aclgrphBuildModel | |||
| const std::set<std::string> ir_builder_suppported_options = { | |||
| INPUT_FORMAT, INPUT_SHAPE, OP_NAME_MAP, | |||
| DYNAMIC_BATCH_SIZE, DYNAMIC_IMAGE_SIZE, DYNAMIC_DIMS, | |||
| INSERT_OP_FILE, PRECISION_MODE, EXEC_DISABLE_REUSED_MEMORY, | |||
| AUTO_TUNE_MODE, OUTPUT_TYPE, OUT_NODES, | |||
| INPUT_FP16_NODES, LOG_LEVEL}; | |||
| // for interface: aclgrphBuildInitialize | |||
| const std::set<std::string> global_options = {CORE_TYPE, | |||
| SOC_VERSION, | |||
| BUFFER_OPTIMIZE, | |||
| ENABLE_COMPRESS_WEIGHT, | |||
| COMPRESS_WEIGHT_CONF, | |||
| PRECISION_MODE, | |||
| EXEC_DISABLE_REUSED_MEMORY, | |||
| AUTO_TUNE_MODE, | |||
| ENABLE_SINGLE_STREAM, | |||
| AICORE_NUM, | |||
| FUSION_SWITCH_FILE, | |||
| ENABLE_SMALL_CHANNEL, | |||
| OP_SELECT_IMPL_MODE, | |||
| OPTYPELIST_FOR_IMPLMODE, | |||
| DEBUG_DIR, | |||
| OP_COMPILER_CACHE_DIR, | |||
| OP_COMPILER_CACHE_MODE}; | |||
| } // namespace ir_option | |||
| } // namespace ge | |||
| #endif // INC_EXTERNAL_GE_GE_API_TYPES_H_ | |||
| @@ -449,6 +449,7 @@ REGISTER_OPTYPE_DECLARE(MEMCPYASYNC, "MemcpyAsync"); | |||
| REGISTER_OPTYPE_DECLARE(MEMCPYADDRASYNC, "MemcpyAddrAsync"); | |||
| REGISTER_OPTYPE_DECLARE(STREAMMERGE, "StreamMerge"); | |||
| REGISTER_OPTYPE_DECLARE(ENDGRAPH, "EndGraph"); | |||
| REGISTER_OPTYPE_DECLARE(MODELEXIT, "ModelExit"); | |||
| REGISTER_OPTYPE_DECLARE(SEND, "Send"); | |||
| REGISTER_OPTYPE_DECLARE(RECV, "Recv"); | |||
| REGISTER_OPTYPE_DECLARE(ENDOFSEQUENCE, "EndOfSequence"); | |||
| @@ -100,6 +100,8 @@ struct OmgContext { | |||
| std::vector<std::string> net_out_nodes; | |||
| // net out nodes top names(only caffe has top) | |||
| std::vector<std::string> out_top_names; | |||
| // net data nodes top names(only caffe has top) | |||
| std::vector<std::string> data_top_names; | |||
| // preferential format used by the entire network | |||
| domiTensorFormat_t net_format = DOMI_TENSOR_RESERVED; | |||
| domi::FrameworkType type = domi::FRAMEWORK_RESERVED; | |||
| @@ -49,6 +49,8 @@ struct ParserContext { | |||
| std::vector<std::string> user_out_nodes_top_vec; | |||
| // net out nodes (where user_out_nodes or leaf nodes) | |||
| std::vector<std::string> net_out_nodes; | |||
| // net data nodes top names(only caffe has top) | |||
| std::vector<std::string> data_top_names; | |||
| // net out nodes top names(only caffe has top) | |||
| std::vector<std::string> out_top_names; | |||
| // Whether to use dynamic batch size or dynamic image size | |||
| @@ -57,9 +59,12 @@ struct ParserContext { | |||
| domi::domiTensorFormat_t format = domi::DOMI_TENSOR_ND; | |||
| domi::FrameworkType type = domi::FRAMEWORK_RESERVED; | |||
| RunMode run_mode = ONLY_PRE_CHECK; | |||
| std::string custom_proto_path; // save caffe custom proto path, used by caffe parse | |||
| std::string caffe_proto_path; // save caffe proto path, used by caffe parse | |||
| std::string enable_scope_fusion_passes; // name of the pass that needs to take effect | |||
| // save caffe custom proto path, used by caffe parse | |||
| std::string custom_proto_path; | |||
| // save caffe proto path, used by caffe parse | |||
| std::string caffe_proto_path; | |||
| // name of the pass that needs to take effect | |||
| std::string enable_scope_fusion_passes; | |||
| }; | |||
| ParserContext &GetParserContext(); | |||
| @@ -1 +1 @@ | |||
| Subproject commit 1cc55bcae09902b3d158993dd57bfbd1d3337066 | |||
| Subproject commit cc9de48a7779cf95cab90a23db608421a691fd12 | |||
| @@ -1 +1 @@ | |||
| Subproject commit db4e6070bb2cec01cead264a44ceae07e7f3048e | |||
| Subproject commit f86c751307835d85329260feb51b559d378b5710 | |||
| @@ -190,6 +190,7 @@ file(GLOB_RECURSE DISTINCT_GRAPH_LOAD_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR} | |||
| "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/stream_active_task_info.cc" | |||
| "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/stream_switch_task_info.cc" | |||
| "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/end_graph_task_info.cc" | |||
| "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/model_exit_task_info.cc" | |||
| "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc" | |||
| "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc" | |||
| "${GE_SOURCE_DIR}/src/ge/graph/load/output/output.cc" | |||
| @@ -17,10 +17,10 @@ | |||
| #ifndef _MMPA_API_H_ | |||
| #define _MMPA_API_H_ | |||
| #define LINUX 0 | |||
| #define WIN 1 | |||
| #define LINUX 0 | |||
| #define WIN 1 | |||
| #if(OS_TYPE == LINUX) | |||
| #if(OS_TYPE == LINUX) //lint !e553 | |||
| #ifndef _GNU_SOURCE | |||
| #define _GNU_SOURCE | |||
| @@ -75,6 +75,7 @@ | |||
| #include <sys/wait.h> | |||
| #include <sys/statvfs.h> | |||
| #include <sys/prctl.h> | |||
| #include <sys/inotify.h> | |||
| #include "securec.h" | |||
| @@ -84,7 +85,7 @@ | |||
| #endif | |||
| #if(OS_TYPE == WIN) | |||
| #if(OS_TYPE == WIN) //lint !e553 | |||
| #include <winsock2.h> | |||
| #include <winsock.h> | |||
| #include "Windows.h" | |||
| @@ -103,16 +104,19 @@ | |||
| #include <stdarg.h> | |||
| #include "shlwapi.h" | |||
| #include <direct.h> | |||
| #include "sub_inc/mmpa_typedef_win.h" | |||
| #include "sub_inc/mmpa_win.h" | |||
| #include <VersionHelpers.h> | |||
| #include <processthreadsapi.h> | |||
| #include <Wbemidl.h> | |||
| #include <iphlpapi.h> | |||
| #include <synchapi.h> | |||
| #include <sys/types.h> | |||
| #include <sys/stat.h> | |||
| #include "securec.h" | |||
| #include "sub_inc/mmpa_typedef_win.h" | |||
| #include "sub_inc/mmpa_win.h" | |||
| #pragma comment(lib, "ws2_32.lib") | |||
| #pragma comment(lib, "mswsock.lib") | |||
| #pragma comment(lib, "Kernel32.lib") | |||
| @@ -30,18 +30,26 @@ typedef pthread_t mmThread; | |||
| typedef pthread_mutex_t mmMutex_t; | |||
| typedef pthread_cond_t mmCond; | |||
| typedef pthread_mutex_t mmMutexFC; | |||
| typedef pthread_rwlock_t mmRWLock_t; | |||
| typedef signed int mmProcess; | |||
| typedef int mmPollHandle; | |||
| typedef int mmPipeHandle; | |||
| typedef int mmFileHandle; | |||
| typedef int mmComPletionKey; | |||
| typedef int mmCompletionHandle; | |||
| typedef int mmErrorMsg; | |||
| typedef int mmFd_t; | |||
| typedef VOID *mmExitCode; | |||
| typedef key_t mmKey_t; | |||
| typedef int mmMsgid; | |||
| typedef struct dirent mmDirent; | |||
| typedef struct shmid_ds mmshmId_ds; | |||
| typedef int (*mmFilter)(const mmDirent *entry); | |||
| typedef int (*mmSort)(const mmDirent **a, const mmDirent **b); | |||
| typedef size_t mmSize_t; | |||
| typedef off_t mmOfft_t; | |||
| typedef pid_t mmPid_t; | |||
| typedef VOID *(*userProcFunc)(VOID *pulArg); | |||
| @@ -50,6 +58,16 @@ typedef struct { | |||
| VOID *pulArg; // Callback function parameters | |||
| } mmUserBlock_t; | |||
| typedef struct { | |||
| const char *dli_fname; | |||
| void *dli_fbase; | |||
| const char *dli_sname; | |||
| void *dli_saddr; | |||
| size_t dli_size; /* ELF only */ | |||
| int dli_bind; /* ELF only */ | |||
| int dli_type; | |||
| } mmDlInfo; | |||
| typedef struct { | |||
| int wSecond; // Seconds. [0-60] (1 leap second) | |||
| int wMinute; // Minutes. [0-59] | |||
| @@ -73,6 +91,7 @@ typedef pthread_key_t mmThreadKey; | |||
| typedef int mmOverLap; | |||
| typedef ssize_t mmSsize_t; | |||
| typedef size_t mmSize; // size | |||
| typedef struct { | |||
| UINT32 createFlag; | |||
| @@ -201,6 +220,17 @@ typedef struct { | |||
| #define M_RDWR O_RDWR | |||
| #define M_CREAT O_CREAT | |||
| #define M_BINARY O_RDONLY | |||
| #define M_TRUNC O_TRUNC | |||
| #define M_IRWXU S_IRWXU | |||
| #define M_IN_CREATE IN_CREATE | |||
| #define M_IN_CLOSE_WRITE IN_CLOSE_WRITE | |||
| #define M_IN_IGNORED IN_IGNORED | |||
| #define M_OUT_CREATE IN_CREATE | |||
| #define M_OUT_CLOSE_WRITE IN_CLOSE_WRITE | |||
| #define M_OUT_IGNORED IN_IGNORED | |||
| #define M_OUT_ISDIR IN_ISDIR | |||
| #define M_IREAD S_IREAD | |||
| #define M_IRUSR S_IRUSR | |||
| @@ -236,13 +266,20 @@ typedef struct { | |||
| #define MMPA_OPTIONAL_ARGUMENT 2 | |||
| #define MMPA_MAX_PATH PATH_MAX | |||
| #define M_NAME_MAX MAX_FNAME | |||
| #define M_F_OK F_OK | |||
| #define M_R_OK R_OK | |||
| #define M_W_OK W_OK | |||
| #define MMPA_STDIN STDIN_FILENO | |||
| #define MMPA_STDOUT STDOUT_FILENO | |||
| #define MMPA_STDERR STDERR_FILENO | |||
| #define MMPA_RTLD_NOW RTLD_NOW | |||
| #define MMPA_RTLD_GLOBAL RTLD_GLOBAL | |||
| #define MMPA_RTLD_LAZY RTLD_LAZY | |||
| #define MMPA_RTLD_NODELETE RTLD_NODELETE | |||
| #define MMPA_DL_EXT_NAME ".so" | |||
| @@ -250,6 +287,7 @@ extern INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *funcBlock); | |||
| extern INT32 mmJoinTask(mmThread *threadHandle); | |||
| extern INT32 mmMutexInit(mmMutex_t *mutex); | |||
| extern INT32 mmMutexLock(mmMutex_t *mutex); | |||
| extern INT32 mmMutexTryLock(mmMutex_t *mutex); | |||
| extern INT32 mmMutexUnLock(mmMutex_t *mutex); | |||
| extern INT32 mmMutexDestroy(mmMutex_t *mutex); | |||
| extern INT32 mmCondInit(mmCond *cond); | |||
| @@ -257,6 +295,14 @@ extern INT32 mmCondLockInit(mmMutexFC *mutex); | |||
| extern INT32 mmCondLock(mmMutexFC *mutex); | |||
| extern INT32 mmCondUnLock(mmMutexFC *mutex); | |||
| extern INT32 mmCondLockDestroy(mmMutexFC *mutex); | |||
| extern INT32 mmRWLockInit(mmRWLock_t *rwLock); | |||
| extern INT32 mmRWLockRDLock(mmRWLock_t *rwLock); | |||
| extern INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); | |||
| extern INT32 mmRWLockWRLock(mmRWLock_t *rwLock); | |||
| extern INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); | |||
| extern INT32 mmRDLockUnLock(mmRWLock_t *rwLock); | |||
| extern INT32 mmWRLockUnLock(mmRWLock_t *rwLock); | |||
| extern INT32 mmRWLockDestroy(mmRWLock_t *rwLock); | |||
| extern INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); | |||
| extern INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); | |||
| extern INT32 mmCondNotify(mmCond *cond); | |||
| @@ -266,6 +312,7 @@ extern INT32 mmGetPid(); | |||
| extern INT32 mmGetTid(); | |||
| extern INT32 mmGetPidHandle(mmProcess *processHandle); | |||
| extern INT32 mmGetLocalTime(mmSystemTime_t *sysTime); | |||
| extern INT32 mmGetSystemTime(mmSystemTime_t *sysTime); | |||
| extern INT32 mmSemInit(mmSem_t *sem, UINT32 value); | |||
| extern INT32 mmSemWait(mmSem_t *sem); | |||
| @@ -273,7 +320,9 @@ extern INT32 mmSemPost(mmSem_t *sem); | |||
| extern INT32 mmSemDestroy(mmSem_t *sem); | |||
| extern INT32 mmOpen(const CHAR *pathName, INT32 flags); | |||
| extern INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); | |||
| extern FILE *mmPopen(CHAR *command, CHAR *type); | |||
| extern INT32 mmClose(INT32 fd); | |||
| extern INT32 mmPclose(FILE *stream); | |||
| extern mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); | |||
| extern mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); | |||
| extern mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); | |||
| @@ -284,9 +333,22 @@ extern INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLe | |||
| extern INT32 mmCloseSocket(mmSockHandle sockFd); | |||
| extern mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); | |||
| extern mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); | |||
| extern INT32 mmSocketSendTo(mmSockHandle sockFd, | |||
| VOID *sendMsg, | |||
| INT32 sendLen, | |||
| UINT32 sendFlag, | |||
| const mmSockAddr* addr, | |||
| INT32 tolen); | |||
| extern mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, | |||
| VOID *recvBuf, | |||
| mmSize recvLen, | |||
| UINT32 recvFlag, | |||
| mmSockAddr* addr, | |||
| mmSocklen_t *FromLen); | |||
| extern INT32 mmSAStartup(); | |||
| extern INT32 mmSACleanup(); | |||
| extern VOID *mmDlopen(const CHAR *fileName, INT32 mode); | |||
| extern INT32 mmDladdr(VOID *addr, mmDlInfo *info); | |||
| extern VOID *mmDlsym(VOID *handle, CHAR *funcName); | |||
| extern INT32 mmDlclose(VOID *handle); | |||
| extern CHAR *mmDlerror(); | |||
| @@ -294,6 +356,7 @@ extern INT32 mmCreateAndSetTimer(mmTimer *timerHandle, mmUserBlock_t *timerBlock | |||
| extern INT32 mmDeleteTimer(mmTimer timerHandle); | |||
| extern INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); | |||
| extern INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); | |||
| extern INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); | |||
| extern INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); | |||
| extern INT32 mmSleep(UINT32 milliSecond); | |||
| @@ -337,6 +400,7 @@ extern VOID mmCloseCompletionPort(mmCompletionHandle handle); | |||
| extern INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, mmCompletionHandle handleIOCP, pmmPollData polledData, | |||
| mmPollBack pollBack); | |||
| extern INT32 mmGetErrorCode(); | |||
| extern CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); | |||
| extern INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); | |||
| extern mmTimespec mmGetTickCount(); | |||
| extern INT32 mmGetRealPath(CHAR *path, CHAR *realPath); | |||
| @@ -382,6 +446,7 @@ extern INT32 mmTlsDelete(mmThreadKey key); | |||
| extern INT32 mmGetOsType(); | |||
| extern INT32 mmFsync(mmProcess fd); | |||
| extern INT32 mmFsync2(INT32 fd); | |||
| extern INT32 mmChdir(const CHAR *path); | |||
| extern INT32 mmUmask(INT32 pmode); | |||
| extern INT32 mmThreadKill(mmThread id); | |||
| @@ -439,6 +504,10 @@ extern INT32 mmCreateProcess(const CHAR *fileName, const mmArgvEnv *env, const c | |||
| extern INT32 mmCreateTaskWithThreadAttr(mmThread *threadHandle, const mmUserBlock_t *funcBlock, | |||
| const mmThreadAttr *threadAttr); | |||
| extern mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); | |||
| extern INT32 mmShmUnlink(const CHAR *name); | |||
| extern VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); | |||
| extern INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); | |||
| #define MMPA_DLL_API | |||
| #ifdef __cplusplus | |||
| @@ -79,6 +79,8 @@ typedef long LONG; | |||
| #define MMPA_THREAD_SCHED_OTHER SCHED_OTHER | |||
| #define MMPA_THREAD_MIN_STACK_SIZE PTHREAD_STACK_MIN | |||
| #define MM_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER | |||
| #define MMPA_MAX_NI 19 | |||
| #define MMPA_MIN_NI (-20) | |||
| @@ -86,6 +88,7 @@ typedef long LONG; | |||
| #define EN_ERR 1 | |||
| #define EN_ERROR (-1) | |||
| #define EN_INVALID_PARAM (-2) | |||
| #define EN_TIMEOUT (-3) | |||
| #ifdef __cplusplus | |||
| #if __cplusplus | |||
| @@ -1,4 +1,4 @@ | |||
| /** | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| @@ -35,6 +35,7 @@ extern "C" { | |||
| #define EN_ERR 1 | |||
| #define EN_ERROR (-1) | |||
| #define EN_INVALID_PARAM (-2) | |||
| #define EN_TIMEOUT (-3) | |||
| #define HANDLE_INVALID_VALUE (-1) | |||
| #define INVALID_SOCKET_HANDLE INVALID_SOCKET | |||
| @@ -60,6 +61,7 @@ extern "C" { | |||
| #define MMPA_MIDDLE_NI 5 | |||
| #define MMPA_LOW_NI (-5) | |||
| #define MMPA_MIN_NI (-20) | |||
| #define MMPA_MAX_FILE 128 | |||
| #define MMPA_MAX_THREAD_PIO 99 | |||
| #define MMPA_MIDDLE_THREAD_PIO 66 | |||
| @@ -71,6 +73,8 @@ extern "C" { | |||
| #define MMPA_THREAD_SCHED_OTHER 0 | |||
| #define MMPA_THREAD_MIN_STACK_SIZE 0 | |||
| #define MM_MUTEX_INITIALIZER NULL | |||
| #ifdef __cplusplus | |||
| #if __cplusplus | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| /** | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| @@ -43,8 +43,9 @@ typedef HANDLE mmThread; | |||
| typedef HANDLE mmProcess; | |||
| typedef HANDLE mmPollHandle; | |||
| typedef HANDLE mmPipeHandle; | |||
| typedef HANDLE mmFileHandle; | |||
| typedef HANDLE mmCompletionHandle; | |||
| typedef HANDLE mmFd_t; | |||
| typedef CRITICAL_SECTION mmMutexFC; | |||
| typedef CONDITION_VARIABLE mmCond; | |||
| @@ -59,15 +60,22 @@ typedef SYSTEMTIME mmSystemTime_t; | |||
| typedef HANDLE mmSem_t; | |||
| typedef SOCKET mmSockHandle; | |||
| typedef SRWLOCK mmRWLock_t; | |||
| typedef struct sockaddr mmSockAddr; | |||
| typedef int mmSocklen_t; | |||
| typedef int mmSemTimeout_t; | |||
| typedef long mmAtomicType; | |||
| typedef DWORD mmExitCode; | |||
| typedef DWORD mmErrorMsg; | |||
| typedef int mmKey_t; | |||
| typedef HANDLE mmMsgid; | |||
| typedef long int mmOfft_t; | |||
| typedef int mmPid_t; | |||
| typedef INT32 mmSsize_t; | |||
| typedef int mmSize; // size | |||
| typedef size_t mmSize_t; | |||
| typedef VOID mmshmId_ds; | |||
| typedef enum { | |||
| DT_DIR = FILE_ATTRIBUTE_DIRECTORY, | |||
| @@ -181,6 +189,16 @@ typedef struct { | |||
| ULONGLONG availSize; | |||
| } mmDiskSize; | |||
| typedef struct { | |||
| const char *dli_fname; | |||
| void *dli_fbase; | |||
| const char *dli_sname; | |||
| void *dli_saddr; | |||
| size_t dli_size; /* ELF only */ | |||
| int dli_bind; /* ELF only */ | |||
| int dli_type; | |||
| } mmDlInfo; | |||
| typedef struct { | |||
| char addr[MMPA_MACINFO_DEFAULT_SIZE]; // ex:aa-bb-cc-dd-ee-ff\0 | |||
| } mmMacInfo; | |||
| @@ -223,8 +241,10 @@ typedef VOID (*mmPf)(VOID); | |||
| #define M_RDONLY _O_RDONLY | |||
| #define M_WRONLY _O_WRONLY | |||
| #define M_RDWR _O_RDWR | |||
| #define M_IRWXU _O_RDWR | |||
| #define M_CREAT _O_CREAT | |||
| #define M_BINARY _O_BINARY | |||
| #define M_TRUNC _O_TRUNC | |||
| #define M_IREAD _S_IREAD | |||
| #define M_IRUSR _S_IREAD | |||
| @@ -232,6 +252,15 @@ typedef VOID (*mmPf)(VOID); | |||
| #define M_IWUSR _S_IWRITE | |||
| #define M_IXUSR 0 | |||
| #define M_IN_CREATE FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | |||
| #define M_IN_CLOSE_WRITE FILE_NOTIFY_CHANGE_LAST_WRITE | |||
| #define M_IN_IGNORED FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | |||
| #define M_OUT_CREATE 0x00000100 | |||
| #define M_OUT_CLOSE_WRITE 0x00000008 | |||
| #define M_OUT_IGNORED 0x00008000 | |||
| #define M_OUT_ISDIR 0x40000000 | |||
| #define M_MSG_CREAT 1 | |||
| #define M_MSG_EXCL 2 | |||
| #define M_MSG_NOWAIT 3 | |||
| @@ -251,6 +280,16 @@ typedef VOID (*mmPf)(VOID); | |||
| #define M_UMASK_GRPEXEC 0 | |||
| #define M_UMASK_OTHEXEC 0 | |||
| #define DT_UNKNOWN 0 | |||
| #define DT_FIFO 1 | |||
| #define DT_CHR 2 | |||
| #define DT_DIR 4 | |||
| #define DT_BLK 6 | |||
| #define DT_REG 8 | |||
| #define DT_LNK 10 | |||
| #define DT_SOCK 12 | |||
| #define DT_WHT 14 | |||
| #define mmConstructor(x) __declspec(allocate(".CRT$XCU")) mmPf con = x | |||
| #define mmDestructor(x) __declspec(allocate(".CRT$XPU")) mmPf de = x | |||
| @@ -269,13 +308,20 @@ typedef VOID (*mmPf)(VOID); | |||
| #define MMPA_EMSG "" | |||
| #define MMPA_MAX_PATH MAX_PATH | |||
| #define M_NAME_MAX _MAX_FNAME | |||
| #define M_F_OK 0 | |||
| #define M_W_OK 2 | |||
| #define M_R_OK 4 | |||
| #define MMPA_STDIN stdin | |||
| #define MMPA_STDOUT stdout | |||
| #define MMPA_STDERR stderr | |||
| #define MMPA_RTLD_NOW 0 | |||
| #define MMPA_RTLD_GLOBAL 0 | |||
| #define MMPA_RTLD_LAZY 0 | |||
| #define MMPA_RTLD_NODELETE 0 | |||
| #define MMPA_DL_EXT_NAME ".dll" | |||
| @@ -285,6 +331,7 @@ _declspec(dllexport) INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *f | |||
| _declspec(dllexport) INT32 mmJoinTask(mmThread *threadHandle); | |||
| _declspec(dllexport) INT32 mmMutexInit(mmMutex_t *mutex); | |||
| _declspec(dllexport) INT32 mmMutexLock(mmMutex_t *mutex); | |||
| _declspec(dllexport) INT32 mmMutexTryLock(mmMutex_t *mutex); | |||
| _declspec(dllexport) INT32 mmMutexUnLock(mmMutex_t *mutex); | |||
| _declspec(dllexport) INT32 mmMutexDestroy(mmMutex_t *mutex); | |||
| _declspec(dllexport) INT32 mmCondInit(mmCond *cond); | |||
| @@ -292,6 +339,14 @@ _declspec(dllexport) INT32 mmCondLockInit(mmMutexFC *mutex); | |||
| _declspec(dllexport) INT32 mmCondLock(mmMutexFC *mutex); | |||
| _declspec(dllexport) INT32 mmCondUnLock(mmMutexFC *mutex); | |||
| _declspec(dllexport) INT32 mmCondLockDestroy(mmMutexFC *mutex); | |||
| _declspec(dllexport) INT32 mmRWLockInit(mmRWLock_t *rwLock); | |||
| _declspec(dllexport) INT32 mmRWLockRDLock(mmRWLock_t *rwLock); | |||
| _declspec(dllexport) INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); | |||
| _declspec(dllexport) INT32 mmRWLockWRLock(mmRWLock_t *rwLock); | |||
| _declspec(dllexport) INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); | |||
| _declspec(dllexport) INT32 mmRDLockUnLock(mmRWLock_t *rwLock); | |||
| _declspec(dllexport) INT32 mmWRLockUnLock(mmRWLock_t *rwLock); | |||
| _declspec(dllexport) INT32 mmRWLockDestroy(mmRWLock_t *rwLock); | |||
| _declspec(dllexport) INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); | |||
| _declspec(dllexport) INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); | |||
| @@ -302,13 +357,16 @@ _declspec(dllexport) INT32 mmGetPid(VOID); | |||
| _declspec(dllexport) INT32 mmGetTid(VOID); | |||
| _declspec(dllexport) INT32 mmGetPidHandle(mmProcess *processHandle); | |||
| _declspec(dllexport) INT32 mmGetLocalTime(mmSystemTime_t *sysTime); | |||
| _declspec(dllexport) INT32 mmGetSystemTime(mmSystemTime_t *sysTime); | |||
| _declspec(dllexport) INT32 mmSemInit(mmSem_t *sem, UINT32 value); | |||
| _declspec(dllexport) INT32 mmSemWait(mmSem_t *sem); | |||
| _declspec(dllexport) INT32 mmSemPost(mmSem_t *sem); | |||
| _declspec(dllexport) INT32 mmSemDestroy(mmSem_t *sem); | |||
| _declspec(dllexport) INT32 mmOpen(const CHAR *pathName, INT32 flags); | |||
| _declspec(dllexport) INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); | |||
| _declspec(dllexport) FILE *mmPopen(CHAR *command, CHAR *type); | |||
| _declspec(dllexport) INT32 mmClose(INT32 fd); | |||
| _declspec(dllexport) INT32 mmPclose(FILE *stream); | |||
| _declspec(dllexport) mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); | |||
| _declspec(dllexport) mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); | |||
| _declspec(dllexport) mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); | |||
| @@ -319,9 +377,22 @@ _declspec(dllexport) INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSo | |||
| _declspec(dllexport) INT32 mmCloseSocket(mmSockHandle sockFd); | |||
| _declspec(dllexport) mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); | |||
| _declspec(dllexport) mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); | |||
| _declspec(dllexport) INT32 mmSocketSendTo(mmSockHandle sockFd, | |||
| VOID *sendMsg, | |||
| INT32 sendLen, | |||
| UINT32 sendFlag, | |||
| const mmSockAddr* addr, | |||
| INT32 tolen); | |||
| _declspec(dllexport) mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, | |||
| VOID *recvBuf, | |||
| mmSize recvLen, | |||
| UINT32 recvFlag, | |||
| mmSockAddr* addr, | |||
| mmSocklen_t *FromLen); | |||
| _declspec(dllexport) INT32 mmSAStartup(VOID); | |||
| _declspec(dllexport) INT32 mmSACleanup(VOID); | |||
| _declspec(dllexport) VOID *mmDlopen(const CHAR *fileName, INT mode); | |||
| _declspec(dllexport) INT32 mmDladdr(VOID *addr, mmDlInfo *info); | |||
| _declspec(dllexport) VOID *mmDlsym(VOID *handle, CHAR *fileName); | |||
| _declspec(dllexport) INT32 mmDlclose(VOID *handle); | |||
| _declspec(dllexport) CHAR *mmDlerror(VOID); | |||
| @@ -330,6 +401,7 @@ _declspec(dllexport) INT32 | |||
| _declspec(dllexport) INT32 mmDeleteTimer(mmTimer timerHandle); | |||
| _declspec(dllexport) INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); | |||
| _declspec(dllexport) INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); | |||
| _declspec(dllexport) INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); | |||
| _declspec(dllexport) INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); | |||
| _declspec(dllexport) INT32 mmSleep(UINT32 milliSecond); | |||
| _declspec(dllexport) INT32 mmCreateTaskWithAttr(mmThread *threadHandle, mmUserBlock_t *funcBlock); | |||
| @@ -371,6 +443,7 @@ _declspec(dllexport) INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, m | |||
| pmmPollData polledData, mmPollBack pollBack); | |||
| _declspec(dllexport) INT32 mmGetErrorCode(); | |||
| _declspec(dllexport) CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); | |||
| _declspec(dllexport) INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); | |||
| _declspec(dllexport) mmTimespec mmGetTickCount(); | |||
| _declspec(dllexport) INT32 mmGetRealPath(CHAR *path, CHAR *realPath); | |||
| @@ -407,7 +480,7 @@ _declspec(dllexport) INT32 mmTlsDelete(mmThreadKey key); | |||
| _declspec(dllexport) INT32 mmGetOsType(); | |||
| _declspec(dllexport) INT32 mmFsync(mmProcess fd); | |||
| _declspec(dllexport) INT32 mmFsync2(INT32 fd); | |||
| _declspec(dllexport) INT32 mmChdir(const CHAR *path); | |||
| _declspec(dllexport) INT32 mmUmask(INT32 pmode); | |||
| _declspec(dllexport) INT32 mmWaitPid(mmProcess pid, INT32 *status, INT32 options); | |||
| @@ -455,7 +528,10 @@ _declspec(dllexport) INT32 | |||
| _declspec(dllexport) INT32 | |||
| mmCreateTaskWithThreadAttr(mmThread *threadHandle, const mmUserBlock_t *funcBlock, const mmThreadAttr *threadAttr); | |||
| _declspec(dllexport) mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); | |||
| _declspec(dllexport) INT32 mmShmUnlink(const CHAR *name); | |||
| _declspec(dllexport) VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); | |||
| _declspec(dllexport) INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); | |||
| #ifdef __cplusplus | |||
| #if __cplusplus | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,77 +0,0 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| #ifndef OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_H_ | |||
| #define BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_H_ | |||
| #include "graph/operator_reg.h" | |||
| namespace ge { | |||
| /** | |||
| * @brief Performs max pooling on the input . \n | |||
| * @par Inputs: | |||
| * One input: | |||
| * x: An NC1HWC0 Tensor. Supported type:float16, float32, double, int8, int16, | |||
| * int32, int64, uint8, uint16, qint8 | |||
| * @par Attributes: | |||
| * @li ksize: A required list of int8, int16, int32, or int64 values, | |||
| * specifying the size of the window for each dimension of the input tensor. | |||
| * No default value. | |||
| * @li strides: A required list of int8, int16, int32, or int64 values, | |||
| * specifying the stride of the sliding window for each dimension of | |||
| * the input tensor. No default value. | |||
| * @li padding_mode: A required string. Defaults to "CALCULATED". | |||
| * @li pads:A required list of int8, int16, int32, or int64 values, | |||
| * a data to caculate when padding_mode is "SAME" and "CALCULATED". | |||
| * @li data_format: An optional string. Defaults to "NHWC" . | |||
| * @li global_pooling bool, Whether to use the global pooling. | |||
| * If global_pooling = true, kernel size and paddings will be ignored. | |||
| * Default False | |||
| * @li ceil_mode:global_pooling (bool) – (bool) Whether to use the global pooling. | |||
| * If global_pooling = true, kernel size and paddings will be ignored. | |||
| * Default False \n | |||
| * @par Outputs: | |||
| * y: A Tensor. Has the same type and format as input "x" . \n | |||
| * @attention Constraints: | |||
| * @li "ksize" is a list that has length 4: ksize[0] = 1 or ksize[3] = 1, | |||
| * ksize[1] * ksize[2] <= 255. | |||
| * @li "stride is a list that has length 4: strides[0] = 1 or strides[3] = 1, | |||
| * strides[1] <= 63, strides[0] >= 1, strides[2] <= 63, strides[2] >= 1. | |||
| * @li "padding" is "SAME" "VALID" or "CACULATE" . | |||
| * @par Third-party framework compatibility | |||
| * Compatible with the TensorFlow operator MaxPool. | |||
| */ | |||
| REG_OP(MaxPoolV3) | |||
| .INPUT(x,TensorType({DT_FLOAT16, DT_FLOAT32})) | |||
| .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT32})) | |||
| .REQUIRED_ATTR(ksize, ListInt) | |||
| .REQUIRED_ATTR(strides, ListInt) | |||
| .ATTR(padding_mode, String, "CALCULATED") | |||
| .ATTR(pads, ListInt, {0,0,0,0}) | |||
| .ATTR(data_format, String, "NCHW") | |||
| .ATTR(global_pooling,Bool,false) | |||
| .ATTR(ceil_mode, Bool, false) | |||
| .OP_END_FACTORY_REG(MaxPoolV3) | |||
| } // namespace ge | |||
| #endif // OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_H_ | |||
| @@ -1,80 +0,0 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| /*! | |||
| *\file max_pool_v3_grad.h | |||
| *\brief | |||
| */ | |||
| #ifndef OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_GRAD_H_ | |||
| #define OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_GRAD_H_ | |||
| #include "graph/operator_reg.h" | |||
| namespace ge { | |||
| /** | |||
| * @brief Computes gradients of the maxpooling function . \n | |||
| * @par Inputs: | |||
| * @li orig_input: A mutable NC1HWC0 tensor of type RealNumberType. | |||
| * @li orig_output: A mutable NC1HWC0 tensor of type RealNumberTypex. | |||
| * @li grad: A mutable NC1HWC0 tensor of type RealNumberType . \n | |||
| * @par Attributes: | |||
| * @li ksize: A required list of int8, int16, int32, or int64 values, | |||
| * specifying the size of the window for each dimension of the input tensor. | |||
| * No default value. | |||
| * @li strides: A required list of int8, int16, int32, or int64 values, | |||
| * specifying the stride of the sliding window for each dimension of | |||
| * the input tensor. No default value. | |||
| * @li padding_mode: A required string. Defaults to "CALCULATED". | |||
| * @li pads:A required list of int8, int16, int32, or int64 values, | |||
| * a data to caculate when padding_mode is "SAME" and "CALCULATED". | |||
| * @li data_format: An optional string. Defaults to "NHWC" . | |||
| * @li global_pooling bool, Whether to use the global pooling. | |||
| * If global_pooling = true, kernel size and paddings will be ignored. | |||
| * Default False | |||
| * @li ceil_mode:global_pooling (bool) – (bool) Whether to use the global pooling. | |||
| * If global_pooling = true, kernel size and paddings will be ignored. | |||
| * Default False \n | |||
| * @par Outputs: | |||
| * y: A mutable tensor. Has the same shape and type as "x1" . \n | |||
| * @attention Constraints: | |||
| * @li Computing gradients of global pooling is not supported, which means | |||
| * "ksize < x1". | |||
| * @li "ksize" is in the range [1, 255]. "strides" is in the range [1, 63] | |||
| * @par Third-party framework compatibility | |||
| * Compatible with the TensorFlow operator MaxPoolGrad. | |||
| */ | |||
| REG_OP(MaxPoolV3Grad) | |||
| .INPUT(orig_input, TensorType::RealNumberType()) | |||
| .INPUT(orig_output, TensorType::RealNumberType()) | |||
| .INPUT(grad, TensorType::RealNumberType()) | |||
| .OUTPUT(out_grad, TensorType::RealNumberType()) | |||
| .REQUIRED_ATTR(ksize, ListInt) | |||
| .REQUIRED_ATTR(strides, ListInt) | |||
| .ATTR(padding_mod, String, "CALCULATED") | |||
| .ATTR(pads, ListInt, {0, 0, 0, 0}) | |||
| .ATTR(data_format, String, "NCHW") | |||
| .ATTR(global_pooling, Bool, false) | |||
| .ATTR(ceil_mode, Bool, false) | |||
| .OP_END_FACTORY_REG(MaxPoolV3Grad) | |||
| } // namespace ge | |||
| #endif // OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_GRAD_H_ | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1190,6 +1190,108 @@ REG_OP(MaxPoolGradWithArgmaxV2) | |||
| .ATTR(dilation, ListInt, {1,1,1,1}) | |||
| .ATTR(ceil_mode, Bool, false) | |||
| .OP_END_FACTORY_REG(MaxPoolGradWithArgmaxV2) | |||
| } // namespace ge | |||
| #endif // OPS_BUILT_IN_OP_PROTO_INC_NN_POOLING_OPS_H_ | |||
| /** | |||
| * @brief Performs max pooling on the input . \n | |||
| * @par Inputs: | |||
| * One input: | |||
| * x: An NC1HWC0 Tensor. Supported type:float16, float32, double, int8, int16, | |||
| * int32, int64, uint8, uint16, qint8 | |||
| * @par Attributes: | |||
| * @li ksize: A required list of int8, int16, int32, or int64 values, | |||
| * specifying the size of the window for each dimension of the input tensor. | |||
| * No default value. | |||
| * @li strides: A required list of int8, int16, int32, or int64 values, | |||
| * specifying the stride of the sliding window for each dimension of | |||
| * the input tensor. No default value. | |||
| * @li padding_mode: A required string. Defaults to "CALCULATED". | |||
| * @li pads:A required list of int8, int16, int32, or int64 values, | |||
| * a data to caculate when padding_mode is "SAME" and "CALCULATED". | |||
| * @li data_format: An optional string. Defaults to "NHWC" . | |||
| * @li global_pooling bool, Whether to use the global pooling. | |||
| * If global_pooling = true, kernel size and paddings will be ignored. | |||
| * Default False | |||
| * @li ceil_mode:global_pooling (bool) – (bool) Whether to use the global pooling. | |||
| * If global_pooling = true, kernel size and paddings will be ignored. | |||
| * Default False \n | |||
| * @par Outputs: | |||
| * y: A Tensor. Has the same type and format as input "x" . \n | |||
| * @attention Constraints: | |||
| * @li "ksize" is a list that has length 4: ksize[0] = 1 or ksize[3] = 1, | |||
| * ksize[1] * ksize[2] <= 255. | |||
| * @li "stride is a list that has length 4: strides[0] = 1 or strides[3] = 1, | |||
| * strides[1] <= 63, strides[0] >= 1, strides[2] <= 63, strides[2] >= 1. | |||
| * @li "padding" is "SAME" "VALID" or "CACULATE" . | |||
| * @par Third-party framework compatibility | |||
| * Compatible with the TensorFlow operator MaxPool. | |||
| */ | |||
| REG_OP(MaxPoolV3) | |||
| .INPUT(x,TensorType({DT_FLOAT16, DT_FLOAT32})) | |||
| .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT32})) | |||
| .REQUIRED_ATTR(ksize, ListInt) | |||
| .REQUIRED_ATTR(strides, ListInt) | |||
| .ATTR(padding_mode, String, "CALCULATED") | |||
| .ATTR(pads, ListInt, {0,0,0,0}) | |||
| .ATTR(data_format, String, "NCHW") | |||
| .ATTR(global_pooling,Bool,false) | |||
| .ATTR(ceil_mode, Bool, false) | |||
| .OP_END_FACTORY_REG(MaxPoolV3) | |||
| /** | |||
| * @brief Computes gradients of the maxpooling function . \n | |||
| * @par Inputs: | |||
| * @li orig_input: A mutable NC1HWC0 tensor of type RealNumberType. | |||
| * @li orig_output: A mutable NC1HWC0 tensor of type RealNumberTypex. | |||
| * @li grad: A mutable NC1HWC0 tensor of type RealNumberType . \n | |||
| * @par Attributes: | |||
| * @li ksize: A required list of int8, int16, int32, or int64 values, | |||
| * specifying the size of the window for each dimension of the input tensor. | |||
| * No default value. | |||
| * @li strides: A required list of int8, int16, int32, or int64 values, | |||
| * specifying the stride of the sliding window for each dimension of | |||
| * the input tensor. No default value. | |||
| * @li padding_mode: A required string. Defaults to "CALCULATED". | |||
| * @li pads:A required list of int8, int16, int32, or int64 values, | |||
| * a data to caculate when padding_mode is "SAME" and "CALCULATED". | |||
| * @li data_format: An optional string. Defaults to "NHWC" . | |||
| * @li global_pooling bool, Whether to use the global pooling. | |||
| * If global_pooling = true, kernel size and paddings will be ignored. | |||
| * Default False | |||
| * @li ceil_mode:global_pooling (bool) – (bool) Whether to use the global pooling. | |||
| * If global_pooling = true, kernel size and paddings will be ignored. | |||
| * Default False \n | |||
| * @par Outputs: | |||
| * y: A mutable tensor. Has the same shape and type as "x1" . \n | |||
| * @attention Constraints: | |||
| * @li Computing gradients of global pooling is not supported, which means | |||
| * "ksize < x1". | |||
| * @li "ksize" is in the range [1, 255]. "strides" is in the range [1, 63] | |||
| * @par Third-party framework compatibility | |||
| * Compatible with the TensorFlow operator MaxPoolGrad. | |||
| */ | |||
| REG_OP(MaxPoolV3Grad) | |||
| .INPUT(orig_input, TensorType::RealNumberType()) | |||
| .INPUT(orig_output, TensorType::RealNumberType()) | |||
| .INPUT(grad, TensorType::RealNumberType()) | |||
| .OUTPUT(out_grad, TensorType::RealNumberType()) | |||
| .REQUIRED_ATTR(ksize, ListInt) | |||
| .REQUIRED_ATTR(strides, ListInt) | |||
| .ATTR(padding_mode, String, "CALCULATED") | |||
| .ATTR(pads, ListInt, {0, 0, 0, 0}) | |||
| .ATTR(data_format, String, "NCHW") | |||
| .ATTR(global_pooling, Bool, false) | |||
| .ATTR(ceil_mode, Bool, false) | |||
| .OP_END_FACTORY_REG(MaxPoolV3Grad) | |||
| } // namespace ge | |||
| #endif // OPS_BUILT_IN_OP_PROTO_INC_NN_POOLING_OPS_H | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -343,7 +343,7 @@ REG_OP(AscendPadding) | |||
| */ | |||
| REG_OP(EmbeddingRankId) | |||
| .INPUT(addr_table, TensorType({DT_UINT64})) | |||
| .INPUT(index, TensorType({DT_UINT32})) | |||
| .INPUT(index, TensorType({DT_INT64,DT_INT32,DT_UINT64})) | |||
| .OUTPUT(rank_id, TensorType({DT_UINT64})) | |||
| .ATTR(row_memory, Int, 320) | |||
| .ATTR(mode, String, "mod") | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
| * Copyright 2019 Huawei Technologies Co., Ltd | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||