| @@ -72,7 +72,7 @@ bool LabelGotoTask::Distribute() { | |||
| return false; | |||
| } | |||
| rt_ret = rtLabelListCpy(reinterpret_cast<void**>(label_list.data()), label_list.size(), label_info_, label_info_size); | |||
| rt_ret = rtLabelListCpy(const_cast<void**>(label_list.data()), label_list.size(), label_info_, label_info_size); | |||
| if (rt_ret != RT_ERROR_NONE) { | |||
| GELOGE(RT_FAILED, "Call rt api failed, ret: %#x", rt_ret); | |||
| return false; | |||
| @@ -23,12 +23,12 @@ add_subdirectory(depends/hccl) | |||
| add_subdirectory(depends/profiler) | |||
| add_subdirectory(depends/error_manager) | |||
| add_subdirectory(depends/opt_info) | |||
| add_subdirectory(framework) | |||
| if (ENABLE_GE_COV OR ENABLE_GE_UT) | |||
| add_subdirectory(ut) | |||
| endif() | |||
| if (ENABLE_GE_ST) | |||
| add_subdirectory(framework) | |||
| add_subdirectory(st) | |||
| endif() | |||
| @@ -227,7 +227,7 @@ INT32 mmAccess2(const CHAR *pathName, INT32 mode) | |||
| if (ret != EN_OK) { | |||
| return EN_ERROR; | |||
| } | |||
| return 0; | |||
| return EN_OK; | |||
| } | |||
| INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone) | |||
| @@ -364,6 +364,10 @@ CHAR *mmDlerror() | |||
| INT32 mmDladdr(VOID *addr, mmDlInfo *info) | |||
| { | |||
| int ret = dladdr(addr, (Dl_info *)info); | |||
| if(ret!= -1){ | |||
| return 0; | |||
| } | |||
| return -1; | |||
| } | |||
| @@ -78,8 +78,9 @@ file(GLOB_RECURSE GE_SUB_ENGINE_SRCS CONFIGURE_DEPENDS | |||
| list(REMOVE_ITEM GE_SRCS ${LOCAL_ENGINE_SRC} ${HOST_ENGINE_SRC} ${NN_ENGINE_SRC} ${OFFLINE_SRC}) | |||
| list(APPEND GE_SRCS ${GE_SUB_ENGINE_SRCS}) | |||
| list(APPEND INCLUDE_DIRECTORIES | |||
| "${CMAKE_CURRENT_SOURCE_DIR}" | |||
| add_library(graphengine_inc INTERFACE) | |||
| target_include_directories(graphengine_inc INTERFACE | |||
| "${GE_CODE_DIR}" | |||
| "${GE_CODE_DIR}/inc" | |||
| "${GE_CODE_DIR}/metadef/inc" | |||
| @@ -114,8 +115,8 @@ list(APPEND INCLUDE_DIRECTORIES | |||
| list(APPEND STUB_LIBS | |||
| c_sec | |||
| slog_stub | |||
| cce_ge_stub | |||
| runtime_stub | |||
| mmpa_stub | |||
| profiler_stub | |||
| hccl_stub | |||
| opt_feature_stub | |||
| @@ -126,12 +127,7 @@ list(APPEND STUB_LIBS | |||
| # ---- Target : metadef graph ---- | |||
| add_library(metadef_graph SHARED ${METADEF_SRCS} ${PROTO_SRCS}) | |||
| target_include_directories(metadef_graph | |||
| PUBLIC | |||
| "${INCLUDE_DIRECTORIES}" | |||
| ) | |||
| add_library(metadef_graph STATIC ${METADEF_SRCS} ${PROTO_SRCS}) | |||
| target_compile_definitions(metadef_graph PRIVATE | |||
| google=ascend_private | |||
| @@ -144,8 +140,8 @@ target_compile_options(metadef_graph PRIVATE | |||
| ) | |||
| target_link_libraries(metadef_graph PUBLIC | |||
| $<BUILD_INTERFACE:intf_pub> ${STUB_LIBS} | |||
| mmpa -L${GE_CODE_DIR}/third_party/prebuild/x86_64 -lrt -ldl -lpthread -lgcov | |||
| $<BUILD_INTERFACE:intf_pub> ${STUB_LIBS} graphengine_inc | |||
| -lrt -ldl -lgcov | |||
| ) | |||
| set_target_properties(metadef_graph PROPERTIES CXX_STANDARD 11) | |||
| @@ -156,7 +152,6 @@ add_library(ge_local_engine SHARED ${LOCAL_ENGINE_SRC}) | |||
| target_include_directories(ge_local_engine | |||
| PUBLIC | |||
| "${INCLUDE_DIRECTORIES}" | |||
| "${GE_CODE_DIR}/ge/ge_local_engine" | |||
| ) | |||
| @@ -170,7 +165,7 @@ target_compile_options(ge_local_engine PRIVATE | |||
| ) | |||
| target_link_libraries(ge_local_engine PUBLIC | |||
| $<BUILD_INTERFACE:intf_pub> ${STUB_LIBS} | |||
| $<BUILD_INTERFACE:intf_pub> ${STUB_LIBS} graphengine_inc | |||
| -lrt -ldl -lpthread -lgcov | |||
| ) | |||
| @@ -183,7 +178,6 @@ add_library(nnengine SHARED ${NN_ENGINE_SRC}) | |||
| target_include_directories(nnengine | |||
| PUBLIC | |||
| "${INCLUDE_DIRECTORIES}" | |||
| "${GE_CODE_DIR}/ge/plugin/engine" | |||
| ) | |||
| @@ -197,7 +191,7 @@ target_compile_options(nnengine PRIVATE | |||
| ) | |||
| target_link_libraries(nnengine PUBLIC | |||
| $<BUILD_INTERFACE:intf_pub> ${STUB_LIBS} -lrt -ldl -lpthread -lgcov | |||
| $<BUILD_INTERFACE:intf_pub> ${STUB_LIBS} graphengine_inc -lrt -ldl -lpthread -lgcov | |||
| ) | |||
| set_target_properties(nnengine PROPERTIES CXX_STANDARD 11) | |||
| @@ -227,7 +221,6 @@ add_library(graphengine STATIC ${PARSER_SRCS} ${GE_SRCS}) | |||
| target_include_directories(graphengine | |||
| PUBLIC | |||
| "${INCLUDE_DIRECTORIES}" | |||
| "${GE_CODE_DIR}/ge/host_cpu_engine" | |||
| ) | |||
| @@ -243,7 +236,7 @@ target_compile_options(graphengine PRIVATE | |||
| target_link_libraries(graphengine PUBLIC | |||
| $<BUILD_INTERFACE:intf_pub> ${STUB_LIBS} | |||
| metadef_graph | |||
| metadef_graph graphengine_inc | |||
| -lrt -ldl -lpthread -lgcov | |||
| ) | |||
| @@ -16,30 +16,25 @@ | |||
| file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "*.cc" "*.CC" "*.cpp" "*.CPP" "*.c++") | |||
| # ---- Target : stub Host engine ---- | |||
| add_library(ge_with_env STATIC ${SOURCES}) | |||
| target_include_directories(ge_with_env | |||
| PUBLIC | |||
| include | |||
| ) | |||
| target_include_directories(ge_with_env | |||
| add_library(ge_running_env STATIC ${SOURCES}) | |||
| target_include_directories(ge_running_env | |||
| PRIVATE | |||
| ${CMAKE_CURRENT_SOURCE_DIR} | |||
| ) | |||
| target_compile_definitions(ge_with_env PRIVATE | |||
| target_compile_definitions(ge_running_env PRIVATE | |||
| google=ascend_private | |||
| FMK_SUPPORT_DUMP | |||
| ) | |||
| target_compile_options(ge_with_env PRIVATE | |||
| target_compile_options(ge_running_env PRIVATE | |||
| -g --coverage -fprofile-arcs -ftest-coverage | |||
| -Werror=format | |||
| ) | |||
| target_link_libraries(ge_with_env PUBLIC | |||
| $<BUILD_INTERFACE:intf_pub> ge_running_env_inc graphengine -lrt -ldl -lpthread -lgcov | |||
| target_link_libraries(ge_running_env PUBLIC | |||
| $<BUILD_INTERFACE:intf_pub> ge_running_env_inc graphengine_inc ${STUB_LIBS} | |||
| ) | |||
| set_target_properties(ge_with_env PROPERTIES CXX_STANDARD 17) | |||
| set_target_properties(ge_running_env PROPERTIES CXX_STANDARD 17) | |||
| @@ -26,7 +26,7 @@ target_compile_options(ge_running_env_test PRIVATE | |||
| ) | |||
| set_target_properties(ge_running_env_test PROPERTIES CXX_STANDARD 17) | |||
| target_link_libraries(ge_running_env_test PUBLIC gtest ge_with_env) | |||
| target_link_libraries(ge_running_env_test PUBLIC gtest ge_running_env graphengine) | |||
| include(CTest) | |||
| enable_testing() | |||
| @@ -41,10 +41,10 @@ TEST_F(GeRunningEvnFakerTest, test_reset_running_env_is_success) { | |||
| GeRunningEnvFaker ge_env; | |||
| ge_env.Reset(); | |||
| ASSERT_OPS_LIST_SIZE(0); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 1); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 1); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); | |||
| ASSERT_EQ(kernel_manager.GetOpsKernelInfo(SWITCH).size(), 1); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 0); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 0); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 0); | |||
| ASSERT_EQ(kernel_manager.GetOpsKernelInfo(SWITCH).size(), 0); | |||
| } | |||
| TEST_F(GeRunningEvnFakerTest, test_install_fake_op_success) { | |||
| @@ -83,10 +83,10 @@ TEST_F(GeRunningEvnFakerTest, test_install_engine_with_default_info_store) { | |||
| GeRunningEnvFaker ge_env; | |||
| ge_env.Install(FakeEngine("DNN_HCCL")); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 2); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 2); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); | |||
| ASSERT_EQ(kernel_manager.GetOpsKernelInfo(SWITCH).size(), 1); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 1); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 1); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 0); | |||
| ASSERT_EQ(kernel_manager.GetOpsKernelInfo(SWITCH).size(), 0); | |||
| } | |||
| TEST_F(GeRunningEvnFakerTest, test_install_engine_with_info_store_name) { | |||
| @@ -94,10 +94,10 @@ TEST_F(GeRunningEvnFakerTest, test_install_engine_with_info_store_name) { | |||
| ge_env.Install(FakeEngine("DNN_HCCL").KernelInfoStore("AiCoreLib2")) | |||
| .Install(FakeOp(SWITCH).InfoStoreAndBuilder("AiCoreLib2")); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 2); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 2); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); | |||
| ASSERT_EQ(kernel_manager.GetOpsKernelInfo(SWITCH).size(), 2); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 1); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 1); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 1); | |||
| ASSERT_EQ(kernel_manager.GetOpsKernelInfo(SWITCH).size(), 1); | |||
| } | |||
| TEST_F(GeRunningEvnFakerTest, test_install_custom_kernel_builder_success) { | |||
| @@ -115,9 +115,9 @@ TEST_F(GeRunningEvnFakerTest, test_install_custom_kernel_builder_success) { | |||
| auto ai_core_kernel = FakeEngine("DNN_HCCL").KernelBuilder(std::make_shared<FakeKernelBuilder>()); | |||
| ge_env.Reset().Install(ai_core_kernel); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 2); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 2); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 1); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 1); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 0); | |||
| } | |||
| TEST_F(GeRunningEvnFakerTest, test_install_custom_kernel_info_store_success) { | |||
| @@ -131,18 +131,18 @@ TEST_F(GeRunningEvnFakerTest, test_install_custom_kernel_info_store_success) { | |||
| auto ai_core_kernel = FakeEngine("DNN_HCCL").KernelInfoStore(std::make_shared<FakeKernelBuilder>("AiCoreLib2")); | |||
| ge_env.Reset().Install(ai_core_kernel); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 2); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 2); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(),1); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 1); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 0); | |||
| } | |||
| TEST_F(GeRunningEvnFakerTest, test_install_default_fake_engine_success) { | |||
| GeRunningEnvFaker ge_env; | |||
| ge_env.InstallDefault(); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 7); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 7); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 66); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 6); | |||
| ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 6); | |||
| ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 20); | |||
| } | |||
| FAKE_NS_END | |||
| @@ -8,7 +8,7 @@ target_include_directories(graph_engine_test | |||
| set_target_properties(graph_engine_test PROPERTIES CXX_STANDARD 17) | |||
| target_link_libraries(graph_engine_test PRIVATE gtest ge_graph_dsl ge_with_env) | |||
| target_link_libraries(graph_engine_test PUBLIC gtest ge_graph_dsl ge_running_env graphengine) | |||
| include(CTest) | |||
| enable_testing() | |||
| @@ -17,7 +17,7 @@ | |||
| #include <gtest/gtest.h> | |||
| #include "external/ge/ge_api.h" | |||
| #include "ge_graph_dsl/assert/check_utils.h" | |||
| #include "ge_running_env/include/ge_running_env/ge_running_env_faker.h" | |||
| #include "ge_running_env/ge_running_env_faker.h" | |||
| using namespace std; | |||
| using namespace ge; | |||
| @@ -17,28 +17,11 @@ project(ut_libgraph) | |||
| set(CMAKE_CXX_STANDARD 11) | |||
| set(PROTO_LIST | |||
| "${GE_CODE_DIR}/metadef/proto/om.proto" | |||
| "${GE_CODE_DIR}/metadef/proto/ge_ir.proto" | |||
| "${GE_CODE_DIR}/metadef/proto/onnx/ge_onnx.proto" | |||
| ) | |||
| protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) | |||
| # include directories | |||
| include_directories(${CMAKE_CURRENT_LIST_DIR}) | |||
| include_directories(${GE_CODE_DIR}) | |||
| include_directories(${GE_CODE_DIR}/metadef) | |||
| include_directories(${GE_CODE_DIR}/metadef/graph) | |||
| include_directories(${GE_CODE_DIR}/inc) | |||
| include_directories(${GE_CODE_DIR}/inc/external) | |||
| include_directories(${GE_CODE_DIR}/metadef/inc/external) | |||
| include_directories(${GE_CODE_DIR}/metadef/inc/external/graph) | |||
| include_directories(${GE_CODE_DIR}/metadef/inc) | |||
| include_directories(${GE_CODE_DIR}/metadef/inc/graph) | |||
| include_directories(${GE_CODE_DIR}/metadef/inc/common) | |||
| include_directories(${GE_CODE_DIR}/metadef/third_party) | |||
| include_directories(${GE_CODE_DIR}/metadef/third_party/transformer/inc) | |||
| include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) | |||
| include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) | |||
| include_directories(${CMAKE_BINARY_DIR}) | |||
| @@ -55,27 +38,14 @@ set(UT_FILES | |||
| "testcase/ge_graph/ge_tensor_unittest.cc" | |||
| "testcase/ge_graph/graph_builder_utils.cc" | |||
| "testcase/ge_graph/ge_reg_unittest.cc" | |||
| "testcase/ge_graph/ge_graph_dsl_check_test.cc" | |||
| "testcase/ge_graph/ge_format_refiner_unittest.cc" | |||
| "testcase/ge_graph/ge_opsproto_manager_unittest.cc" | |||
| "testcase/ge_graph/ge_operator_unittest.cc" | |||
| "testcase/ge_graph/ge_model_unittest.cc" | |||
| ) | |||
| FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH0 ${GE_CODE_DIR}/metadef/graph/*.cc) | |||
| FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH1 ${GE_CODE_DIR}/metadef/graph/*/*.cc) | |||
| FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH2 ${GE_CODE_DIR}/metadef/graph/*/*/*.cc) | |||
| AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/ops GRAPH_OPS_SRC_FILES) | |||
| AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/third_party/transformer/src TRANSFORMER_SRC_FILES) | |||
| add_executable(ut_libgraph ${UT_FILES} | |||
| ${GRAPH_SRC_FILES_DEPTH0} | |||
| ${GRAPH_SRC_FILES_DEPTH1} | |||
| ${GRAPH_SRC_FILES_DEPTH2} | |||
| ${GRAPH_OPS_SRC_FILES} | |||
| ${TRANSFORMER_SRC_FILES} | |||
| ${PROTO_SRCS} ${PROTO_HDRS} | |||
| ) | |||
| add_executable(ut_libgraph ${UT_FILES} ${GE_CODE_DIR}/ge/common/types.cc) | |||
| target_compile_options(ut_libgraph PRIVATE | |||
| -g --coverage -fprofile-arcs -ftest-coverage | |||
| @@ -85,16 +55,11 @@ target_compile_definitions(ut_libgraph PRIVATE | |||
| google=ascend_private | |||
| ) | |||
| target_link_libraries(ut_libgraph | |||
| set_target_properties(ut_libgraph PROPERTIES CXX_STANDARD 17) | |||
| target_link_libraries(ut_libgraph PUBLIC | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| gtest | |||
| gtest_main | |||
| slog_stub | |||
| ascend_protobuf | |||
| c_sec | |||
| error_manager_stub | |||
| mmpa_stub | |||
| -lrt | |||
| -ldl | |||
| -lgcov | |||
| ge_graph_dsl | |||
| ) | |||
| @@ -0,0 +1,23 @@ | |||
| #include "gtest/gtest.h" | |||
| #include "ge_graph_dsl/graph_dsl.h" | |||
| #include "graph/graph.h" | |||
| #include "graph/compute_graph.h" | |||
| USING_GE_NS | |||
| class GeGraphDslCheckTest : public testing::Test { | |||
| protected: | |||
| void SetUp() {} | |||
| void TearDown() {} | |||
| }; | |||
| TEST_F(GeGraphDslCheckTest, test_build_graph_from_optype_with_name) { | |||
| DEF_GRAPH(g1) { CHAIN(NODE("data1", "Data")->NODE("add", "Add")); }; | |||
| auto geGraph = ToGeGraph(g1); | |||
| auto computeGraph = ToComputeGraph(g1); | |||
| ASSERT_EQ(geGraph.GetAllNodes().size(), 2); | |||
| ASSERT_EQ(computeGraph->GetAllNodesSize(), 2); | |||
| } | |||
| @@ -1,23 +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. | |||
| */ | |||
| #include <gtest/gtest.h> | |||
| int main(int argc, char **argv) { | |||
| testing::InitGoogleTest(&argc, argv); | |||
| int ret = RUN_ALL_TESTS(); | |||
| return ret; | |||
| } | |||
| @@ -71,16 +71,6 @@ include_directories(${CMAKE_BINARY_DIR}/proto/ge) | |||
| include_directories(${CMAKE_BINARY_DIR}/proto/ge/proto) | |||
| #### GRAPH_SRC_FILES #### | |||
| FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH0 ${GE_CODE_DIR}/metadef/graph/*.cc) | |||
| FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH1 ${GE_CODE_DIR}/metadef/graph/*/*.cc) | |||
| FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH2 ${GE_CODE_DIR}/metadef/graph/*/*/*.cc) | |||
| AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/ops GRAPH_OPS_SRC_FILES) | |||
| AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/register GRAPH_REGISTER_SRC_FILES) | |||
| AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/third_party/transformer/src TRANSFORMER_SRC_FILES) | |||
| set(PARSER_SRC_FILES | |||
| "${GE_CODE_DIR}/parser/parser/common/op_map.cc" | |||
| "${GE_CODE_DIR}/parser/parser/common/pre_checker.cc" | |||
| @@ -650,6 +640,7 @@ set(MULTI_PARTS_TEST_FILES | |||
| "common/format_transfer_unittest.cc" | |||
| "common/format_transfer_transpose_unittest.cc" | |||
| "common/format_transfer_nchw_5d_unittest.cc" | |||
| "common/ge_graph_dsl_check_test.cc" | |||
| "common/format_transfer_nchw_fractalz_unittest.cc" | |||
| "common/format_transfer_hwcn_fractalz_unittest.cc" | |||
| "common/format_transfer_nhwc_fractalz_unittest.cc" | |||
| @@ -754,26 +745,18 @@ list(APPEND COMMON_SHARED_LIBRARIES | |||
| ) | |||
| # build graph | |||
| add_library(ge_ut_graph STATIC | |||
| ${GRAPH_SRC_FILES_DEPTH0} | |||
| ${GRAPH_SRC_FILES_DEPTH1} | |||
| ${GRAPH_SRC_FILES_DEPTH2} | |||
| ${GRAPH_OPS_SRC_FILES} | |||
| ${GRAPH_REGISTER_SRC_FILES} | |||
| ${TRANSFORMER_SRC_FILES} | |||
| ${PARSER_SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS} | |||
| ) | |||
| add_library(ge_ut_parser STATIC ${PARSER_SRC_FILES}) | |||
| target_compile_definitions(ge_ut_graph PRIVATE | |||
| target_compile_definitions(ge_ut_parser PRIVATE | |||
| google=ascend_private | |||
| FMK_SUPPORT_DUMP | |||
| ) | |||
| target_compile_options(ge_ut_graph PRIVATE | |||
| target_compile_options(ge_ut_parser PRIVATE | |||
| -g | |||
| ) | |||
| target_link_libraries(ge_ut_graph PRIVATE | |||
| target_link_libraries(ge_ut_parser PRIVATE | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| c_sec | |||
| ascend_protobuf | |||
| @@ -797,11 +780,13 @@ target_link_libraries(ge_ut_common PRIVATE | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| c_sec | |||
| ascend_protobuf | |||
| ge_ut_parser | |||
| json | |||
| ge_ut_graph | |||
| runtime_stub | |||
| ) | |||
| target_link_libraries(ge_ut_common PUBLIC ge_graph_dsl) | |||
| # build common format | |||
| add_library(ge_ut_common_format STATIC ${COMMON_FORMAT_SRC_FILES} ${PROTO_HDRS}) | |||
| @@ -957,11 +942,13 @@ target_compile_definitions(ut_libge_multiparts_utest PRIVATE | |||
| target_link_libraries(ut_libge_multiparts_utest | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| -Wl,--whole-archive | |||
| ge_davinci_model ge_build_common ge_prepare_common ge_execute_common ge_pass_common ge_ut_common_format ge_ut_common | |||
| ge_davinci_model ge_build_common ge_prepare_common ge_execute_common ge_pass_common ge_ut_common_format ge_running_env ge_ut_common | |||
| -Wl,--no-whole-archive | |||
| gtest gtest_main gmock gmock_main ${COMMON_SHARED_LIBRARIES} -lrt -ldl -lgcov | |||
| ) | |||
| set_target_properties(ut_libge_multiparts_utest PROPERTIES CXX_STANDARD 17) | |||
| # libge_others_utest | |||
| add_executable(ut_libge_others_utest | |||
| ${COMMON_TEST_FILES} | |||
| @@ -984,6 +971,8 @@ target_link_libraries(ut_libge_others_utest | |||
| gtest gtest_main gmock gmock_main ${COMMON_SHARED_LIBRARIES} -lrt -ldl -lgcov | |||
| ) | |||
| set_target_properties(ut_libge_others_utest PROPERTIES CXX_STANDARD 17) | |||
| # libge_kernel_utest | |||
| add_executable(ut_libge_kernel_utest | |||
| ${COMMON_TEST_FILES} | |||
| @@ -1004,6 +993,8 @@ target_link_libraries(ut_libge_kernel_utest | |||
| gtest gtest_main gmock gmock_main ${COMMON_SHARED_LIBRARIES} -lrt -ldl -lgcov | |||
| ) | |||
| set_target_properties(ut_libge_kernel_utest PROPERTIES CXX_STANDARD 17) | |||
| # libge_distinct_load_utest | |||
| add_executable(ut_libge_distinct_load_utest | |||
| ${COMMON_TEST_FILES} | |||
| @@ -0,0 +1,23 @@ | |||
| #include "gtest/gtest.h" | |||
| #include "ge_graph_dsl/graph_dsl.h" | |||
| #include "graph/graph.h" | |||
| #include "graph/compute_graph.h" | |||
| USING_GE_NS | |||
| class GeGraphDslCheckTest : public testing::Test { | |||
| protected: | |||
| void SetUp() {} | |||
| void TearDown() {} | |||
| }; | |||
| TEST_F(GeGraphDslCheckTest, test_build_graph_from_optype_with_name) { | |||
| DEF_GRAPH(g1) { CHAIN(NODE("data1", "Data")->NODE("add", "Add")); }; | |||
| auto geGraph = ToGeGraph(g1); | |||
| auto computeGraph = ToComputeGraph(g1); | |||
| ASSERT_EQ(geGraph.GetAllNodes().size(), 2); | |||
| ASSERT_EQ(computeGraph->GetAllNodesSize(), 2); | |||
| } | |||
| @@ -89,7 +89,9 @@ TEST_F(UtestExecutionEngine, ExecuteAsync_without_kernel_task) { | |||
| hybrid_model.root_graph_item_ = std::unique_ptr<GraphItem>(new(std::nothrow)GraphItem()); | |||
| execution_context.model = &hybrid_model; | |||
| execution_context.profiling_level = 1; | |||
| SubgraphContext subgraph_context(nullptr, &execution_context); | |||
| GraphItem graph_item; | |||
| SubgraphContext subgraph_context(&graph_item, &execution_context); | |||
| ASSERT_EQ(subgraph_context.Init(), SUCCESS); | |||
| auto node_state = subgraph_context.GetOrCreateNodeState(node_item.get()); | |||
| ASSERT_TRUE(node_state->GetTaskContext() != nullptr); | |||
| @@ -120,7 +122,9 @@ TEST_F(UtestExecutionEngine, ExecuteAsync_without_callback_and_kernel_task) { | |||
| HybridModel hybrid_model(ge_root_model); | |||
| hybrid_model.root_graph_item_ = std::unique_ptr<GraphItem>(new(std::nothrow)GraphItem()); | |||
| execution_context.model = &hybrid_model; | |||
| SubgraphContext subgraph_context(nullptr, &execution_context); | |||
| GraphItem graph_item; | |||
| SubgraphContext subgraph_context(&graph_item, &execution_context); | |||
| ASSERT_EQ(subgraph_context.Init(), SUCCESS); | |||
| auto node_state = subgraph_context.GetOrCreateNodeState(node_item.get()); | |||
| uint32_t task_id = 0; | |||
| @@ -172,7 +172,9 @@ TEST_F(UtestGeHybrid, task_update_tiling_info) { | |||
| node_item->output_start = 0; | |||
| GraphExecutionContext execution_context; | |||
| SubgraphContext subgraph_context(nullptr, &execution_context); | |||
| GraphItem graph_item; | |||
| SubgraphContext subgraph_context(&graph_item, &execution_context); | |||
| ASSERT_EQ(subgraph_context.Init(), SUCCESS); | |||
| auto node_state = subgraph_context.GetOrCreateNodeState(node_item.get()); | |||
| ASSERT_EQ(aicore_task->InitTilingInfo(*op_desc), SUCCESS); | |||
| ASSERT_EQ(aicore_task->UpdateTilingInfo(*node_state->GetTaskContext()), SUCCESS); | |||
| @@ -17,12 +17,15 @@ | |||
| #include <gtest/gtest.h> | |||
| #include "common/debug/log.h" | |||
| #include "ge_graph_dsl/assert/check_utils.h" | |||
| using namespace std; | |||
| using namespace ge; | |||
| int main(int argc, char **argv) { | |||
| // init the logging | |||
| testing::InitGoogleTest(&argc, argv); | |||
| CheckUtils::init(); | |||
| int ret = RUN_ALL_TESTS(); | |||
| printf("finish ge ut\n"); | |||