diff --git a/CMakeLists.txt b/CMakeLists.txt index 58883a0f9c91207df1c0071b3681e76731129488..3fe880587377d2ec4a586d46be3c6b1d06b21d18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ if(ENABLE_OPEN_SRC) ${ASCEND_3RD_LIB_PATH}/symengine/lib/cmake/symengine ${ASCEND_3RD_LIB_PATH}/boost/lib/cmake/Boost-1.87.0 ${ASCEND_INSTALL_PATH} + ${ASCEND_INSTALL_PATH}/pkg_inc ${CMAKE_CURRENT_LIST_DIR}/third_party/inc ${CANN_GE_DIR}/inc/framework/executor_c ${ASCEND_OPENSDK_DIR}/cmake @@ -336,6 +337,7 @@ target_include_directories(ascendcl PRIVATE $<$:${ASCEND_INSTALL_PATH}/include/experiment/ascend_hal> $<$:${ASCEND_INSTALL_PATH}/include/experiment/msprof> $<$:${ASCEND_INSTALL_PATH}/include/experiment/slog> + $<$:${ASCEND_INSTALL_PATH}/include/experiment/runtime/runtime/rts> $<$:${METADEF_DIR}/inc> $<$:${CANN_GE_DIR}/inc> $<$:${CANN_GE_DIR}/inc/graph_metadef> diff --git a/cmake/modules/Findadump.cmake b/cmake/modules/Findadump.cmake index 1dcb6fa95f36e1f14f0ec93f04a2c377211dbc0f..bbccb63eee79f7d464001f2ee97044fd2642fc0b 100644 --- a/cmake/modules/Findadump.cmake +++ b/cmake/modules/Findadump.cmake @@ -43,16 +43,16 @@ unset(_cmake_targets_defined) unset(_cmake_targets_not_defined) unset(_cmake_expected_targets) -find_path(_INCLUDE_DIR - NAMES experiment/adump/external/adump_api.h - NO_CMAKE_SYSTEM_PATH - NO_CMAKE_FIND_ROOT_PATH) +find_path(_PKG_INC_DIR + NAMES adump/adump_pub.h + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_FIND_ROOT_PATH) find_library(adump_server_STATIC_LIBRARY - NAMES libadump_server.a - PATH_SUFFIXES lib64 - NO_CMAKE_SYSTEM_PATH - NO_CMAKE_FIND_ROOT_PATH) + NAMES libadump_server.a + PATH_SUFFIXES lib64 + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_FIND_ROOT_PATH) find_library(adcore_STATIC_LIBRARY NAMES libadcore.a @@ -71,17 +71,17 @@ find_package_handle_standard_args(adump FOUND_VAR adump_FOUND REQUIRED_VARS - _INCLUDE_DIR + _PKG_INC_DIR adump_server_STATIC_LIBRARY adcore_STATIC_LIBRARY ascend_dump_SHARED_LIBRARY ) if(adump_FOUND) - set(adump_INCLUDE_DIR "${_INCLUDE_DIR}/experiment") + set(adump_PKG_INC_DIR "${_PKG_INC_DIR}") include(CMakePrintHelpers) message(STATUS "Variables in adump module:") - cmake_print_variables(adump_INCLUDE_DIR) + cmake_print_variables(adump_PKG_INC_DIR) cmake_print_variables(adump_server_STATIC_LIBRARY) cmake_print_variables(adcore_STATIC_LIBRARY) cmake_print_variables(ascend_dump_SHARED_LIBRARY) @@ -94,7 +94,7 @@ if(adump_FOUND) add_library(adump_headers INTERFACE IMPORTED) set_target_properties(adump_headers PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${adump_INCLUDE_DIR};${adump_INCLUDE_DIR}/adump;${adump_INCLUDE_DIR}/adump/external" + INTERFACE_INCLUDE_DIRECTORIES "${adump_PKG_INC_DIR}/adump" ) add_library(adcore STATIC IMPORTED) @@ -126,4 +126,4 @@ if(adump_FOUND) endif() # Cleanup temporary variables. -set(_INCLUDE_DIR) +set(_PKG_INC_DIR) diff --git a/cmake/modules/Findmsprof.cmake b/cmake/modules/Findmsprof.cmake index 84d0cc052f7ae066ae2ff48399343692ff62f130..a044f158baa78bad8d96ef66bfc29c8af5c1f918 100644 --- a/cmake/modules/Findmsprof.cmake +++ b/cmake/modules/Findmsprof.cmake @@ -44,7 +44,7 @@ unset(_cmake_targets_not_defined) unset(_cmake_expected_targets) find_path(_INCLUDE_DIR - NAMES experiment/msprof/toolchain/prof_api.h + NAMES prof/aprof_pub.h NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) @@ -71,7 +71,7 @@ find_package_handle_standard_args(msprof ) if(msprof_FOUND) - set(msprof_INCLUDE_DIR "${_INCLUDE_DIR}/experiment") + set(msprof_INCLUDE_DIR "${_INCLUDE_DIR}") include(CMakePrintHelpers) message(STATUS "Variables in msprof module:") cmake_print_variables(msprof_INCLUDE_DIR) @@ -92,7 +92,7 @@ if(msprof_FOUND) add_library(msprof_headers INTERFACE IMPORTED) set_target_properties(msprof_headers PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${msprof_INCLUDE_DIR};${msprof_INCLUDE_DIR}/msprof;${msprof_INCLUDE_DIR}/msprof/toolchain" + INTERFACE_INCLUDE_DIRECTORIES "${msprof_INCLUDE_DIR}/prof;${msprof_INCLUDE_DIR}/experiment;${msprof_INCLUDE_DIR}/experiment/msprof;${msprof_INCLUDE_DIR}/experiment/msprof/toolchain" ) include(CMakePrintHelpers) diff --git a/cmake/modules/Findopcompiler.cmake b/cmake/modules/Findopcompiler.cmake index 4eefb439eb01bbf5ad082bb8b0589f962a7fa452..8b8c7d814bb02bb26e86fa3863c505a72566e462 100644 --- a/cmake/modules/Findopcompiler.cmake +++ b/cmake/modules/Findopcompiler.cmake @@ -73,7 +73,7 @@ if(opcompiler_FOUND) add_library(te_fusion SHARED IMPORTED) set_target_properties(te_fusion PROPERTIES INTERFACE_LINK_LIBRARIES "opcompiler_headers" - IMPORTED_LINK_DEPENDENT_LIBRARIES "graph;register;slog;c_sec;error_manager;cann_kb" + IMPORTED_LINK_DEPENDENT_LIBRARIES "graph;register;slog;c_sec;error_manager" IMPORTED_LOCATION "${te_fusion_SHARED_LIBRARY}" ) diff --git a/cmake/modules/Findslog.cmake b/cmake/modules/Findslog.cmake index cf1ca521d145b9350e36ae0f95791abdadcf99d9..d23d684a201260bedfd3005008ce281ae2d426e5 100644 --- a/cmake/modules/Findslog.cmake +++ b/cmake/modules/Findslog.cmake @@ -15,7 +15,7 @@ endif() set(_cmake_targets_defined "") set(_cmake_targets_not_defined "") set(_cmake_expected_targets "") -foreach(_cmake_expected_target IN ITEMS slog alog slog_headers) +foreach(_cmake_expected_target IN ITEMS slog alog old_slog_headers) list(APPEND _cmake_expected_targets "${_cmake_expected_target}") if(TARGET "${_cmake_expected_target}") list(APPEND _cmake_targets_defined "${_cmake_expected_target}") @@ -81,19 +81,19 @@ if(slog_FOUND) add_library(slog SHARED IMPORTED) set_target_properties(slog PROPERTIES INTERFACE_COMPILE_DEFINITIONS "LOG_CPP;PROCESS_LOG" - INTERFACE_LINK_LIBRARIES "slog_headers" + INTERFACE_LINK_LIBRARIES "old_slog_headers" IMPORTED_LOCATION "${slog_SHARED_LIBRARY}" ) add_library(alog SHARED IMPORTED) set_target_properties(alog PROPERTIES INTERFACE_COMPILE_DEFINITIONS "LOG_CPP;PROCESS_LOG" - INTERFACE_LINK_LIBRARIES "slog_headers" + INTERFACE_LINK_LIBRARIES "old_slog_headers" IMPORTED_LOCATION "${alog_SHARED_LIBRARY}" ) - add_library(slog_headers INTERFACE IMPORTED) - set_target_properties(slog_headers PROPERTIES + add_library(old_slog_headers INTERFACE IMPORTED) + set_target_properties(old_slog_headers PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${slog_INCLUDE_DIR};${slog_INCLUDE_DIR}/slog;${slog_INCLUDE_DIR}/slog/toolchain" ) @@ -104,7 +104,7 @@ if(slog_FOUND) cmake_print_properties(TARGETS alog PROPERTIES INTERFACE_COMPILE_DEFINITIONS INTERFACE_LINK_LIBRARIES IMPORTED_LOCATION ) - cmake_print_properties(TARGETS slog_headers + cmake_print_properties(TARGETS old_slog_headers PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ) endif() diff --git a/cmake/modules/Findunified_dlog.cmake b/cmake/modules/Findunified_dlog.cmake index 4d19cff11f8f8a43ce07e43cc4b8b0154799a81d..260d511e41b1857c93552d961913fda0d76b8292 100644 --- a/cmake/modules/Findunified_dlog.cmake +++ b/cmake/modules/Findunified_dlog.cmake @@ -15,7 +15,7 @@ endif() set(_cmake_targets_defined "") set(_cmake_targets_not_defined "") set(_cmake_expected_targets "") -foreach(_cmake_expected_target IN ITEMS unified_dlog unified_dlog_headers) +foreach(_cmake_expected_target IN ITEMS unified_dlog slog_headers) list(APPEND _cmake_expected_targets "${_cmake_expected_target}") if(TARGET "${_cmake_expected_target}") list(APPEND _cmake_targets_defined "${_cmake_expected_target}") @@ -43,8 +43,9 @@ unset(_cmake_targets_defined) unset(_cmake_targets_not_defined) unset(_cmake_expected_targets) -find_path(_INCLUDE_DIR - NAMES base/dlog_pub.h +find_path(_INCLUDE_DIR_DLOG_PUB + NAMES dlog_pub.h + PATH_SUFFIXES pkg_inc/base NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) @@ -59,12 +60,12 @@ find_package_handle_standard_args(unified_dlog FOUND_VAR unified_dlog_FOUND REQUIRED_VARS - _INCLUDE_DIR + _INCLUDE_DIR_DLOG_PUB unified_dlog_SHARED_LIBRARY ) if(unified_dlog_FOUND) - set(unified_dlog_INCLUDE_DIR "${_INCLUDE_DIR}") + set(unified_dlog_INCLUDE_DIR "${_INCLUDE_DIR_DLOG_PUB}") include(CMakePrintHelpers) message(STATUS "Variables in unified_dlog module:") cmake_print_variables(unified_dlog_INCLUDE_DIR) @@ -72,12 +73,12 @@ if(unified_dlog_FOUND) add_library(unified_dlog SHARED IMPORTED) set_target_properties(unified_dlog PROPERTIES - INTERFACE_LINK_LIBRARIES "unified_dlog_headers" + INTERFACE_LINK_LIBRARIES "slog_headers" IMPORTED_LOCATION "${unified_dlog_SHARED_LIBRARY}" ) - add_library(unified_dlog_headers INTERFACE IMPORTED) - set_target_properties(unified_dlog_headers PROPERTIES + add_library(slog_headers INTERFACE IMPORTED) + set_target_properties(slog_headers PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${unified_dlog_INCLUDE_DIR}" ) @@ -85,10 +86,10 @@ if(unified_dlog_FOUND) cmake_print_properties(TARGETS unified_dlog PROPERTIES INTERFACE_LINK_LIBRARIES IMPORTED_LOCATION ) - cmake_print_properties(TARGETS unified_dlog_headers + cmake_print_properties(TARGETS slog_headers PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ) endif() # Cleanup temporary variables. -set(_INCLUDE_DIR) \ No newline at end of file +set(_INCLUDE_DIR_DLOG_PUB) \ No newline at end of file diff --git a/common/acl.cpp b/common/acl.cpp index a1eff44f27d0045ab6b382a98ce86ad40df95a84..ec5261ed5b5256329d3c91c7e0ffeb9395f3e15c 100755 --- a/common/acl.cpp +++ b/common/acl.cpp @@ -28,6 +28,9 @@ #include "utils/hash_utils.h" #include "runtime/acl_rt_impl_base.h" #include "runtime/init_callback_manager.h" +#include "runtime/rts/rts_device.h" +#include "runtime/rts/rts_stars.h" +#include "runtime/event.h" namespace { bool aclFinalizeFlag = false; @@ -174,6 +177,27 @@ aclError HandleErrorManagerConfig(const char_t *const configPath, error_message: return ACL_SUCCESS; } +aclError HandleEventModeConfig(const char_t *const configPath) { + ACL_LOG_INFO("Start to execute HandleEventModeConfig, configPath:[%s].", configPath); + std::string strConfig; + uint8_t event_mode = 0; + bool found = false; + + auto ret = acl::JsonParser::GetEventModeFromFile(configPath, event_mode, found); + if (ret != ACL_SUCCESS) { + ACL_LOG_ERROR("Can not parse event mode config from file[%s], errorCode = %d", configPath, ret); + return ret; + } + if (!found) { + ACL_LOG_INFO("Event mode config is not found in file[%s].", configPath); + return ACL_SUCCESS; + } + ACL_LOG_INFO("event mode is set [%d].", event_mode); + ACL_REQUIRES_CALL_RTS_OK(rtEventWorkModeSet(event_mode), rtEventWorkModeSet); + ACL_LOG_INFO("Successfully handled event mode config."); + return ACL_SUCCESS; +} + aclError HandleDefaultDeviceAndStackSize(const char_t *const configPath) { size_t stackSize = 0; bool stackSizeExist = false; @@ -315,6 +339,12 @@ aclError aclInit(const char *configPath) return ret; } ACL_LOG_INFO("set HandleDefaultDeviceAndStackSize success in aclInit"); + + ret = acl::HandleEventModeConfig(configPath); + if (ret != ACL_SUCCESS) { + ACL_LOG_INNER_ERROR("[Process][EventMode]process HandleEventModeConfig failed, ret=%d", ret); + return ret; + } } const auto profRet = MsprofRegisterCallback(ASCENDCL, &acl::AclProfCtrlHandle); if (profRet != 0) { diff --git a/common/common_inner.h b/common/common_inner.h index 91ec1629cdbb18297b6b0e2739487d124aa8922f..ecb72338b6bb6b11eae1b40a5c9e23a8b9117fa7 100755 --- a/common/common_inner.h +++ b/common/common_inner.h @@ -42,6 +42,8 @@ namespace acl { int32_t UpdateOpSystemRunCfg(void *cfgAddr, uint32_t cfgLen); + aclError HandleEventModeConfig(const char_t *const configPath); + aclError HandleDefaultDeviceAndStackSize(const char_t *const configPath); aclError GetAlignedAndPaddingSize(const size_t size, const bool isPadding, size_t &alignedSize); diff --git a/common/json_parser.cpp b/common/json_parser.cpp index 61b0b756fd5d93eb18de5ce99afddc4a73269687..29f0b93ceabde9984b5cce76fab121c6cbba3102 100755 --- a/common/json_parser.cpp +++ b/common/json_parser.cpp @@ -295,6 +295,46 @@ namespace acl { return ACL_SUCCESS; } + aclError JsonParser::GetEventModeFromFile(const char_t *const fileName, uint8_t &event_mode, bool &found) + { + nlohmann::json js; + std::string eventModeStr; + aclError ret = acl::JsonParser::ParseJsonFromFile(fileName, js); + if (ret != ACL_SUCCESS) { + ACL_LOG_INNER_ERROR("[Parse][JsonFromFile]parse json from file[%s] failed, errorCode = %d", fileName, ret); + return ret; + } + const std::string ACL_GRAPH_CONFIG_NAME = "acl_graph"; + const std::string ACL_EVENT_MODE_CONFIG_NAME = "event_mode"; + + if (!JsonParser::ContainKey(js, ACL_GRAPH_CONFIG_NAME)) { + ACL_LOG_INFO("No acl_graph in json file!"); + return ACL_SUCCESS; + } + const nlohmann::json &jsAclGraphConfig = JsonParser::GetCfgJsonByKey(js, ACL_GRAPH_CONFIG_NAME); + if (!JsonParser::ContainKey(jsAclGraphConfig, ACL_EVENT_MODE_CONFIG_NAME)) { + ACL_LOG_INFO("No event_mode under acl_graph in json file!"); + return ACL_SUCCESS; + } + eventModeStr = JsonParser::GetCfgStrByKey(jsAclGraphConfig, ACL_EVENT_MODE_CONFIG_NAME); + + // 校验 event_mode 是否为合法整数,只允许 0 或 1 + std::regex reg("0|1"); + if (!std::regex_match(eventModeStr, reg)) { + ACL_LOG_ERROR("event_mode value [%s] in json is not a valid integer.", eventModeStr.c_str()); + const char_t *argList[] = {"param", "value", "reason"}; + const char_t *argVal[] = {"event_mode", eventModeStr.c_str(), "only support [0,1]"}; + acl::AclErrorLogManager::ReportInputErrorWithChar(acl::INVALID_PARAM_MSG, + argList, argVal, 3U); + return ACL_ERROR_INVALID_PARAM; + } + + event_mode = static_cast(std::strtol(eventModeStr.c_str(), nullptr, DECIMAL)); + found = true; + ACL_LOG_INFO("Successfully parse event_mode: %d, event_mode_str: %s", event_mode, eventModeStr.c_str()); + return ACL_SUCCESS; + } + aclError JsonParser::GetStackSize(const char_t *const fileName, size_t &aicoreStackSize, bool &exist) { ACL_LOG_DEBUG("start to execute GetStackSize."); diff --git a/common/json_parser.h b/common/json_parser.h index fc93717ee2888d3a104aa9b1d8a0736b0d61115c..0ecd069a9b9213bd7315bcad997803bab0277b48 100755 --- a/common/json_parser.h +++ b/common/json_parser.h @@ -25,6 +25,7 @@ namespace acl { static aclError GetAttrConfigFromFile( const char_t *const fileName, std::map &cannInfoMap); static aclError GetDefaultDeviceIdFromFile(const char_t *const fileName, int32_t& devId); + static aclError GetEventModeFromFile(const char_t *const fileName, uint8_t &event_mode, bool &found); static aclError GetStackSize(const char_t *const fileName, size_t &aicoreStackSize, bool &exist); static aclError ParseJson(const char_t *const buffer, nlohmann::json &js); static aclError GetConfigStrFromFile(const char_t *const fileName, std::string &configBuffer); diff --git a/tests/depends/acl_stub.h b/tests/depends/acl_stub.h index cf3139dbef4e54a6451fa27ce098a60b732512b3..a26773152a0e106f61024f79c974ea3f06ff5e5d 100755 --- a/tests/depends/acl_stub.h +++ b/tests/depends/acl_stub.h @@ -26,7 +26,7 @@ #include "graph/tensor.h" #include "common/helper/om_file_helper.h" #include "platform/platform_info.h" -#include "base/err_msg.h" +#include "base/err_mgr.h" #include "tdt/tdt_host_interface.h" #include "runtime/dev.h" @@ -421,6 +421,7 @@ public: virtual rtError_t rtMemQueueReset(int32_t devId, uint32_t qid); virtual rtError_t rtSetDefaultDeviceId(int32_t deviceId); virtual rtError_t rtDeviceSetLimit(int32_t devId, rtLimitType_t type, uint32_t val); + virtual rtError_t rtEventWorkModeSet(uint8_t event_mode); virtual rtError_t rtRegStreamStateCallback(const char *regName, rtStreamStateCallback callback); virtual rtError_t rtCtxGetCurrentDefaultStream(rtStream_t* stm); virtual rtError_t rtCmoAsync(void *srcAddrPtr, size_t srcLen, rtCmoOpCode_t cmpType, rtStream_t stm); @@ -746,6 +747,7 @@ public: MOCK_METHOD1(rtSetDevice, rtError_t(int32_t device)); MOCK_METHOD1(rtSetDefaultDeviceId, rtError_t(int32_t device)); MOCK_METHOD3(rtDeviceSetLimit, rtError_t(int32_t devId, rtLimitType_t type, uint32_t val)); + MOCK_METHOD1(rtEventWorkModeSet, rtError_t(uint8_t event_mode)); MOCK_METHOD1(rtDeviceReset, rtError_t(int32_t device)); MOCK_METHOD1(rtDeviceResetForce, rtError_t(int32_t device)); MOCK_METHOD1(rtSetDeviceWithoutTsd, rtError_t(int32_t device)); diff --git a/tests/depends/dvpp/CMakeLists.txt b/tests/depends/dvpp/CMakeLists.txt index ea79c573fd35e2f6b495a3a5f902a274f049e64a..13443f5a6c0b474ebe2ba95b1f8014bf7785e1e2 100755 --- a/tests/depends/dvpp/CMakeLists.txt +++ b/tests/depends/dvpp/CMakeLists.txt @@ -40,6 +40,9 @@ include_directories(${CANN_GE_DIR}/inc) include_directories(${ASCEND_INSTALL_PATH}/include/experiment/adump/external) include_directories(${BASE_DIR}/third_party/inc/dvpp/inc/dvpp) include_directories(${ASCEND_INSTALL_PATH}/include/acl/dvpp) +include_directories(${ASCEND_INSTALL_PATH}/include/prof) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc/base) add_library(himpi_stub SHARED ${SRC_FILES}) diff --git a/tests/depends/ge/CMakeLists.txt b/tests/depends/ge/CMakeLists.txt index 553c866d852ac61a70ed7fa0aaa4844a4730f54a..d3f9ac4223480206b22feee55a3f3cc7c5098676 100755 --- a/tests/depends/ge/CMakeLists.txt +++ b/tests/depends/ge/CMakeLists.txt @@ -27,6 +27,8 @@ include_directories(${ASCEND_OPENSDK_DIR}/include/runtime/runtime) include_directories(${ASCEND_INSTALL_PATH}/include/experiment/slog) include_directories(${ASCEND_INSTALL_PATH}/include/experiment/msprof) include_directories(${ASCEND_INSTALL_PATH}/include/prof) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc/base) include_directories(${BASE_DIR}/third_party/inc) include_directories(${CANN_GE_DIR}/inc) include_directories(${CANN_GE_DIR}/inc/graph_metadef) diff --git a/tests/depends/ge/src/ge_stub.cpp b/tests/depends/ge/src/ge_stub.cpp index aee26e7bc8f3a3f7e8eb322ceac7c55c1d78a909..1b010229aaf29c4198e731086bc0411b86b31074 100755 --- a/tests/depends/ge/src/ge_stub.cpp +++ b/tests/depends/ge/src/ge_stub.cpp @@ -55,7 +55,7 @@ #include "acl_stub.h" #include "framework/runtime/subscriber/global_profiler.h" #include "platform/platform_info.h" -#include "base/err_msg.h" +#include "base/err_mgr.h" #include "nlohmann/json.hpp" using namespace ge; diff --git a/tests/depends/jpeg/CMakeLists.txt b/tests/depends/jpeg/CMakeLists.txt index 8346731244268e623113c55fc8ec560a5ff0818e..4383c09d6b9db2c2e6e634003b2d2ae5fae48327 100644 --- a/tests/depends/jpeg/CMakeLists.txt +++ b/tests/depends/jpeg/CMakeLists.txt @@ -41,6 +41,9 @@ include_directories(${CMAKE_BINARY_DIR}/proto/acl/) include_directories(${ASCEND_INSTALL_PATH}/include/experiment/adump/external) include_directories(${BASE_DIR}/third_party/inc/dvpp/inc/dvpp) include_directories(${ASCEND_INSTALL_PATH}/include/acl/dvpp) +include_directories(${ASCEND_INSTALL_PATH}/include/prof) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc/base) add_library(jpeg_stub SHARED ${SRC_FILES}) diff --git a/tests/depends/mmpa/CMakeLists.txt b/tests/depends/mmpa/CMakeLists.txt index 1b6c58d3e6054a29b3c92cc0858629bb0dcf9f99..29581092b444e79071724ce39e5aa47e02194db6 100755 --- a/tests/depends/mmpa/CMakeLists.txt +++ b/tests/depends/mmpa/CMakeLists.txt @@ -41,6 +41,8 @@ include_directories(${BASE_DIR}/tests/depends/) include_directories(${ASCEND_INSTALL_PATH}/include/experiment/adump/external) include_directories(${BASE_DIR}/third_party/inc/dvpp/inc/dvpp) include_directories(${ASCEND_INSTALL_PATH}/include/acl/dvpp) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc/base) add_library(mmpa_stub SHARED ${SRC_FILES}) diff --git a/tests/depends/profiling/CMakeLists.txt b/tests/depends/profiling/CMakeLists.txt index 83087876819b2e34fa7d4ea612fde93f3279c938..b24a355f16c1a1174bcc48b11e6e707eb82cdfed 100755 --- a/tests/depends/profiling/CMakeLists.txt +++ b/tests/depends/profiling/CMakeLists.txt @@ -26,6 +26,8 @@ include_directories(${ASCEND_OPENSDK_DIR}/include/runtime/runtime) include_directories(${ASCEND_INSTALL_PATH}/include/experiment/slog) include_directories(${ASCEND_INSTALL_PATH}/include/experiment/msprof) include_directories(${ASCEND_INSTALL_PATH}/include/prof) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc/base) include_directories(${BASE_DIR}/inc/external) include_directories(${BASE_DIR}/third_party/inc) include_directories(${BASE_DIR}/third_party/inc/runtime/external) diff --git a/tests/depends/runtime/CMakeLists.txt b/tests/depends/runtime/CMakeLists.txt index e611572fbc49eb01b04a4f88904447387214423e..4fc2e852c2f9cd54f4d400bd5ffbc754001852b2 100755 --- a/tests/depends/runtime/CMakeLists.txt +++ b/tests/depends/runtime/CMakeLists.txt @@ -41,6 +41,9 @@ include_directories(${ASCEND_INSTALL_PATH}/include/experiment/adump/external) include_directories(${BASE_DIR}/tests/depends/) include_directories(${BASE_DIR}/third_party/inc/dvpp/inc/dvpp) include_directories(${ASCEND_INSTALL_PATH}/include/acl/dvpp) +include_directories(${ASCEND_INSTALL_PATH}/include/prof) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc/base) add_library(runtime_stub SHARED ${SRC_FILES}) diff --git a/tests/depends/runtime/src/runtime_stub.cpp b/tests/depends/runtime/src/runtime_stub.cpp index ce28625bf30bb3ae96caa9dfbf9ccb5b9dc9a258..59f8fa8b08a3087adc5636d816aef484ac1fa132 100755 --- a/tests/depends/runtime/src/runtime_stub.cpp +++ b/tests/depends/runtime/src/runtime_stub.cpp @@ -984,6 +984,12 @@ rtError_t aclStub::rtDeviceSetLimit(int32_t devId, rtLimitType_t type, uint32_t return RT_ERROR_NONE; } +rtError_t aclStub::rtEventWorkModeSet(uint8_t event_mode) +{ + (void)event_mode; + return RT_ERROR_NONE; +} + rtError_t aclStub::rtRegStreamStateCallback(const char *regName, rtStreamStateCallback callback) { (void)regName; @@ -2688,6 +2694,11 @@ rtError_t rtDeviceSetLimit(int32_t devId, rtLimitType_t type, uint32_t val) return MockFunctionTest::aclStubInstance().rtDeviceSetLimit(devId, type, val); } +rtError_t rtEventWorkModeSet(uint8_t event_mode) +{ + return MockFunctionTest::aclStubInstance().rtEventWorkModeSet(event_mode); +} + rtError_t rtRegStreamStateCallback(const char *regName, rtStreamStateCallback callback) { return MockFunctionTest::aclStubInstance().rtRegStreamStateCallback(regName, callback); diff --git a/tests/depends/slog/CMakeLists.txt b/tests/depends/slog/CMakeLists.txt index a9a5d77a363940a5d0504057ad87706823870e50..b144eaa6d516891b09cfea076c39ce922448295a 100755 --- a/tests/depends/slog/CMakeLists.txt +++ b/tests/depends/slog/CMakeLists.txt @@ -40,6 +40,8 @@ include_directories(${CANN_GE_DIR}/inc/graph_metadef/graph/utils) include_directories(${ASCEND_INSTALL_PATH}/include/experiment/adump/external) include_directories(${BASE_DIR}/third_party/inc/dvpp/inc/dvpp) include_directories(${ASCEND_INSTALL_PATH}/include/acl/dvpp) +include_directories(${ASCEND_INSTALL_PATH}/include/prof) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc) include_directories(${ASCEND_INSTALL_PATH}/pkg_inc/base) add_library(slog_stub SHARED ${SRC_FILES}) diff --git a/tests/depends/tdt/CMakeLists.txt b/tests/depends/tdt/CMakeLists.txt index 4dbe83c6b897e6fb6f28a013e5dc824a01b37f11..fb37e40759d8fe00c4bf7b885115350131919c22 100755 --- a/tests/depends/tdt/CMakeLists.txt +++ b/tests/depends/tdt/CMakeLists.txt @@ -40,6 +40,9 @@ include_directories(${ASCEND_INSTALL_PATH}/include/experiment/adump/external) include_directories(${BASE_DIR}/tests/depends/) include_directories(${BASE_DIR}/third_party/inc/dvpp/inc/dvpp) include_directories(${ASCEND_INSTALL_PATH}/include/acl/dvpp) +include_directories(${ASCEND_INSTALL_PATH}/include/prof) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc/base) add_library(tdt_stub SHARED ${SRC_FILES}) diff --git a/tests/depends/toolchain/CMakeLists.txt b/tests/depends/toolchain/CMakeLists.txt index fe106894c79e05b3ea0afe45ef52441102a7453c..0964a111c9a8f2c1c696273db0ef8447b8b12be4 100755 --- a/tests/depends/toolchain/CMakeLists.txt +++ b/tests/depends/toolchain/CMakeLists.txt @@ -42,6 +42,8 @@ include_directories(${ASCEND_INSTALL_PATH}/include/experiment/adump/external) include_directories(${BASE_DIR}/third_party/inc/dvpp/inc/dvpp) include_directories(${ASCEND_INSTALL_PATH}/include/acl/dvpp) include_directories(${ASCEND_INSTALL_PATH}/include/experiment/awatchdog) +include_directories(${ASCEND_INSTALL_PATH}/include/prof) +include_directories(${ASCEND_INSTALL_PATH}/pkg_inc) include_directories(${ASCEND_INSTALL_PATH}/pkg_inc/base) add_library(toolchain_stub SHARED ${SRC_FILES}) diff --git a/tests/ut/acl/json/testEventMode/testEventMode_01.json b/tests/ut/acl/json/testEventMode/testEventMode_01.json new file mode 100755 index 0000000000000000000000000000000000000000..beba4cbee4817001f299f1e2bc328f1fc5db2c25 --- /dev/null +++ b/tests/ut/acl/json/testEventMode/testEventMode_01.json @@ -0,0 +1,5 @@ +{ + "acl_graph":{ + "event_mode":"0" + } +} \ No newline at end of file diff --git a/tests/ut/acl/json/testEventMode/testEventMode_02.json b/tests/ut/acl/json/testEventMode/testEventMode_02.json new file mode 100755 index 0000000000000000000000000000000000000000..872f3bd4adf7d9be27596fa0ffa75d4ccc632049 --- /dev/null +++ b/tests/ut/acl/json/testEventMode/testEventMode_02.json @@ -0,0 +1,5 @@ +{ + "acl_graph":{ + "event_mode":"1" + } +} \ No newline at end of file diff --git a/tests/ut/acl/json/testEventMode/testEventMode_03.json b/tests/ut/acl/json/testEventMode/testEventMode_03.json new file mode 100755 index 0000000000000000000000000000000000000000..78cc852d990c82d939de50fb2329c36a70ed7f34 --- /dev/null +++ b/tests/ut/acl/json/testEventMode/testEventMode_03.json @@ -0,0 +1,4 @@ +{ + "acl_graph":{ + "event_mode":"0" + } diff --git a/tests/ut/acl/json/testEventMode/testEventMode_04.json b/tests/ut/acl/json/testEventMode/testEventMode_04.json new file mode 100755 index 0000000000000000000000000000000000000000..a9e8e80b9ff2817dee93d319dc7c2d8a9ccdfaf0 --- /dev/null +++ b/tests/ut/acl/json/testEventMode/testEventMode_04.json @@ -0,0 +1,5 @@ +{ + "acl_graph1":{ + "event_mode":"0" + } +} \ No newline at end of file diff --git a/tests/ut/acl/json/testEventMode/testEventMode_05.json b/tests/ut/acl/json/testEventMode/testEventMode_05.json new file mode 100755 index 0000000000000000000000000000000000000000..88cd882a17734e30a10b05e7004b3ae88f2dbc3c --- /dev/null +++ b/tests/ut/acl/json/testEventMode/testEventMode_05.json @@ -0,0 +1,5 @@ +{ + "acl_graph":{ + "event_mode1":"0" + } +} \ No newline at end of file diff --git a/tests/ut/acl/json/testEventMode/testEventMode_06.json b/tests/ut/acl/json/testEventMode/testEventMode_06.json new file mode 100755 index 0000000000000000000000000000000000000000..413644a10002889736ddfc876246bd69aae84636 --- /dev/null +++ b/tests/ut/acl/json/testEventMode/testEventMode_06.json @@ -0,0 +1,5 @@ +{ + "acl_graph":{ + "event_mode":"2" + } +} \ No newline at end of file diff --git a/tests/ut/acl/testcase/acl_common_unittest.cpp b/tests/ut/acl/testcase/acl_common_unittest.cpp index e8af1d33340d927eae4490cb8e8b614593b5b31e..32a3158d331a9f040ab83624f128fda1ceb8c353 100755 --- a/tests/ut/acl/testcase/acl_common_unittest.cpp +++ b/tests/ut/acl/testcase/acl_common_unittest.cpp @@ -25,7 +25,7 @@ #include "utils/hash_utils.h" #include "framework/executor/ge_executor.h" -#include "base/err_msg.h" +#include "base/err_mgr.h" #define protected public #define private public @@ -189,6 +189,45 @@ TEST_F(UTEST_ACL_Common, SetDefaultDeviceTest) EXPECT_EQ(ret, ACL_ERROR_RT_STREAM_NO_CB_REG); } +TEST_F(UTEST_ACL_Common, SetEventModeTest) +{ + EXPECT_CALL(MockFunctionTest::aclStubInstance(), rtSetDefaultDeviceId(_)) + .WillRepeatedly(Return(ACL_SUCCESS)); + aclError ret = aclInit(ACL_BASE_DIR "/tests/ut/acl/json/testEventMode/testEventMode_01.json"); + EXPECT_EQ(ret, ACL_SUCCESS); + ret = aclFinalize(); + EXPECT_EQ(ret, ACL_SUCCESS); + resetAclJsonHash(); + + ret = aclInit(ACL_BASE_DIR "/tests/ut/acl/json/testEventMode/testEventMode_02.json"); + EXPECT_EQ(ret, ACL_SUCCESS); + ret = aclFinalize(); + EXPECT_EQ(ret, ACL_SUCCESS); + resetAclJsonHash(); + + ret = aclInit(ACL_BASE_DIR "/tests/ut/acl/json/testEventMode/testEventMode_03.json"); // 格式错误 + EXPECT_EQ(ret, ACL_ERROR_PARSE_FILE); + + ret = aclInit(ACL_BASE_DIR "/tests/ut/acl/json/testEventMode/testEventMode_04.json"); // 不包含acl_graph + EXPECT_EQ(ret, ACL_SUCCESS); + ret = aclFinalize(); + EXPECT_EQ(ret, ACL_SUCCESS); + resetAclJsonHash(); + + ret = aclInit(ACL_BASE_DIR "/tests/ut/acl/json/testEventMode/testEventMode_05.json"); // 不包含event_mode + EXPECT_EQ(ret, ACL_SUCCESS); + ret = aclFinalize(); + EXPECT_EQ(ret, ACL_SUCCESS); + resetAclJsonHash(); + + ret = aclInit(ACL_BASE_DIR "/tests/ut/acl/json/testEventMode/testEventMode_06.json"); // event_mode参数非法 + EXPECT_EQ(ret, ACL_ERROR_INVALID_PARAM); + resetAclJsonHash(); + + ret = HandleEventModeConfig("testEventMode_not_exist.json"); + EXPECT_EQ(ret, ACL_ERROR_INVALID_FILE); +} + TEST_F(UTEST_ACL_Common, SetStackSize) { // stack size 32k diff --git a/third_party/cann-graph-engine b/third_party/cann-graph-engine index f15250ed4eae9ce6bb910556b293e57c65077757..c6091b70e00fe01fb797a248c88f7dfe37662b87 160000 --- a/third_party/cann-graph-engine +++ b/third_party/cann-graph-engine @@ -1 +1 @@ -Subproject commit f15250ed4eae9ce6bb910556b293e57c65077757 +Subproject commit c6091b70e00fe01fb797a248c88f7dfe37662b87