From 6339a3ba6cf670cdba10836f21c8594bd3c2e7a9 Mon Sep 17 00:00:00 2001 From: t00456437 Date: Thu, 26 Nov 2020 23:13:47 +0800 Subject: [PATCH] ge ut 3 --- tests/CMakeLists.txt | 1 + tests/depends/cce/CMakeLists.txt | 10 +++ tests/depends/error_manager/CMakeLists.txt | 34 ++++++++ .../error_manager/src/error_manager_stub.cc | 85 +++++++++++++++++++ tests/depends/mmpa/src/mmpa_stub.cc | 30 +++++++ tests/depends/omg/CMakeLists.txt | 5 ++ tests/ut/ge/CMakeLists.txt | 41 ++++++--- .../logical_stream_allocator_unittest.cc | 46 ++++++---- .../ge/graph/build/mem_assigner_unittest.cc | 5 +- .../ut/ge/graph/passes/base_pass_unittest.cc | 2 +- .../ge/graph/passes/pass_manager_unittest.cc | 8 +- .../ut/ge/graph/passes/prune_pass_unittest.cc | 10 +-- .../graph/passes/switch_op_pass_unittest.cc | 2 - ...ed_and_isolated_op_remove_pass_unittest.cc | 14 +-- .../graph/passes/variable_op_pass_unittest.cc | 1 - 15 files changed, 247 insertions(+), 47 deletions(-) create mode 100644 tests/depends/error_manager/CMakeLists.txt create mode 100644 tests/depends/error_manager/src/error_manager_stub.cc diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 53529082..abea9fdc 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -22,6 +22,7 @@ add_subdirectory(depends/runtime) add_subdirectory(depends/omg) add_subdirectory(depends/hccl) add_subdirectory(depends/profiler) +add_subdirectory(depends/error_manager) if (ENABLE_GE_COV OR ENABLE_GE_UT) add_subdirectory(ut) diff --git a/tests/depends/cce/CMakeLists.txt b/tests/depends/cce/CMakeLists.txt index cd47114b..85e69e6d 100644 --- a/tests/depends/cce/CMakeLists.txt +++ b/tests/depends/cce/CMakeLists.txt @@ -68,6 +68,11 @@ set(SRCS "${GE_CODE_DIR}/metadef/graph/opsproto/opsproto_manager.cc" ) add_library(cce_ge_stub SHARED src/cce_stub.cc ${PROTO_SRCS} ${PROTO_HDRS}) + +target_compile_definitions(cce_ge_stub PRIVATE + google=ascend_private +) + target_link_libraries(cce_ge_stub $ -Wl,--no-as-needed @@ -77,6 +82,11 @@ target_link_libraries(cce_ge_stub ) add_library(cce_stub SHARED ${SRCS} ${PROTO_SRCS} ${PROTO_HDRS}) + +target_compile_definitions(cce_stub PRIVATE + google=ascend_private +) + target_link_libraries(cce_stub PRIVATE $ -Wl,--no-as-needed diff --git a/tests/depends/error_manager/CMakeLists.txt b/tests/depends/error_manager/CMakeLists.txt new file mode 100644 index 00000000..43180e66 --- /dev/null +++ b/tests/depends/error_manager/CMakeLists.txt @@ -0,0 +1,34 @@ +# 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. +# ============================================================================ + +#cmake_minimum_required(VERSION 2.8) + +project(STUB_ERROR_MANAGER) + +file(GLOB_RECURSE SRCS RELATIVE ${CMAKE_CURRENT_LIST_DIR} + "src/error_manager_stub.cc" +) + +include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) +include_directories(${GE_CODE_DIR}/inc) +include_directories(${GE_CODE_DIR}/inc/external) +include_directories(${GE_CODE_DIR}/metadef/inc) +include_directories(${GE_CODE_DIR}/inc/framework) +include_directories(${GE_CODE_DIR}/metadef/inc/external) + +add_library(error_manager_stub SHARED ${SRCS}) +target_link_libraries(error_manager_stub PRIVATE + $ +) diff --git a/tests/depends/error_manager/src/error_manager_stub.cc b/tests/depends/error_manager/src/error_manager_stub.cc new file mode 100644 index 00000000..4f6b6b3d --- /dev/null +++ b/tests/depends/error_manager/src/error_manager_stub.cc @@ -0,0 +1,85 @@ +/** + * 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 "common/util/error_manager/error_manager.h" + + ErrorManager &ErrorManager::GetInstance() { + static ErrorManager instance; + return instance; + } + + /// + /// @brief init + /// @param [in] path: current so path + /// @return int 0(success) -1(fail) + /// + int ErrorManager::Init(std::string path) { return 0; } + + /// + /// @brief Report error message + /// @param [in] error_code: error code + /// @param [in] args_map: parameter map + /// @return int 0(success) -1(fail) + /// + int ErrorManager::ReportErrMessage(std::string error_code, const std::map &args_map) { + return 0; + } + + /// + /// @brief output error message + /// @param [in] handle: print handle + /// @return int 0(success) -1(fail) + /// + int ErrorManager::OutputErrMessage(int handle) { return 0; } + + /// + /// @brief output message + /// @param [in] handle: print handle + /// @return int 0(success) -1(fail) + /// + int ErrorManager::OutputMessage(int handle) { return 0; } + + /// + /// @brief Report error message + /// @param [in] key: vector parameter key + /// @param [in] value: vector parameter value + /// + void ErrorManager::ATCReportErrMessage(std::string error_code, const std::vector &key, + const std::vector &value) { + } + + /// + /// @brief report graph compile failed message such as error code and op_name in mstune case + /// @param [in] msg: failed message map, key is error code, value is op_name + /// @return int 0(success) -1(fail) + /// + int ErrorManager::ReportMstuneCompileFailedMsg(const std::map &msg) { return 0; } + + /// + /// @brief save graph compile failed message from thread local map to global map + /// @param [in] graph_name: graph name + /// + void ErrorManager::SaveMstuneCompileFailedMsg(const std::string &graph_name) {} + + /// + /// @brief get graph compile failed message in mstune case + /// @param [in] graph_name: graph name + /// @param [out] msg_map: failed message map, key is error code, value is op_name list + /// @return int 0(success) -1(fail) + /// + int ErrorManager::GetMstuneCompileFailedMsg(const std::string &graph_name, std::map> &msg_map) { return 0; } + + diff --git a/tests/depends/mmpa/src/mmpa_stub.cc b/tests/depends/mmpa/src/mmpa_stub.cc index 76d32cad..00193e1c 100644 --- a/tests/depends/mmpa/src/mmpa_stub.cc +++ b/tests/depends/mmpa/src/mmpa_stub.cc @@ -217,3 +217,33 @@ INT32 mmScandir(const CHAR *path, mmDirent ***entryList, mmFilter filterFunc, m VOID mmScandirFree(mmDirent **entryList, INT32 count) { } + +INT32 mmAccess2(const CHAR *pathName, INT32 mode) +{ + return 0; +} + +INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone) +{ + return 0; +} + +INT32 mmRealPath(const CHAR *path, CHAR *realPath, INT32 realPathLen) +{ + return 0; +} + +INT32 mmGetErrorCode() +{ + return 0; +} + +INT32 mmIsDir(const CHAR *fileName) +{ + return 0; +} + +INT32 mmGetEnv(const CHAR *name, CHAR *value, UINT32 len) +{ + return 0; +} diff --git a/tests/depends/omg/CMakeLists.txt b/tests/depends/omg/CMakeLists.txt index c107242c..50ce91b4 100644 --- a/tests/depends/omg/CMakeLists.txt +++ b/tests/depends/omg/CMakeLists.txt @@ -44,6 +44,11 @@ set(SRCS ) add_library(omg_stub SHARED ${SRCS} ${PROTO_SRCS} ${PROTO_HDRS}) + +target_compile_definitions(omg_stub PRIVATE + google=ascend_private +) + target_link_libraries(omg_stub PRIVATE $ -Wl,--no-as-needed diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 54e40a60..1fc4b09b 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -21,6 +21,7 @@ set(PROTO_LIST "${GE_CODE_DIR}/metadef/proto/om.proto" "${GE_CODE_DIR}/metadef/proto/ge_ir.proto" "${GE_CODE_DIR}/metadef/proto/ge_api.proto" + "${GE_CODE_DIR}/metadef/proto/insert_op.proto" "${GE_CODE_DIR}/metadef/proto/fwk_adapter.proto" "${GE_CODE_DIR}/metadef/proto/op_mapping_info.proto" "${GE_CODE_DIR}/metadef/proto/optimizer_priority.proto" @@ -42,6 +43,7 @@ include_directories(${GE_CODE_DIR}) include_directories(${GE_CODE_DIR}/inc) include_directories(${GE_CODE_DIR}/metadef/inc) include_directories(${GE_CODE_DIR}/ge) +include_directories(${GE_CODE_DIR}/ge/inc) include_directories(${GE_CODE_DIR}/metadef) include_directories(${GE_CODE_DIR}/metadef/graph) include_directories(${GE_CODE_DIR}/inc/external) @@ -86,18 +88,24 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/metadef/graph/buffer.cc" "${GE_CODE_DIR}/metadef/graph/compute_graph.cc" "${GE_CODE_DIR}/metadef/graph/graph.cc" + "${GE_CODE_DIR}/metadef/graph/gnode.cc" + "${GE_CODE_DIR}/metadef/graph/ascend_string.cc" "${GE_CODE_DIR}/metadef/graph/inference_context.cc" "${GE_CODE_DIR}/metadef/graph/shape_refiner.cc" "${GE_CODE_DIR}/metadef/graph/model.cc" "${GE_CODE_DIR}/metadef/graph/model_serialize.cc" "${GE_CODE_DIR}/metadef/graph/node.cc" + "${GE_CODE_DIR}/metadef/graph/runtime_inference_context.cc" "${GE_CODE_DIR}/metadef/graph/op_desc.cc" + "${GE_CODE_DIR}/metadef/third_party/transformer/src/transfer_shape_according_to_format.cpp" + "${GE_CODE_DIR}/metadef/third_party/transformer/src/axis_util.cpp" "${GE_CODE_DIR}/metadef/graph/operator.cc" "${GE_CODE_DIR}/metadef/graph/operator_factory.cc" "${GE_CODE_DIR}/metadef/graph/operator_factory_impl.cc" #"${GE_CODE_DIR}/metadef/graph/operator_reg.cc" #"${GE_CODE_DIR}/metadef/graph/range_vistor.cc" "${GE_CODE_DIR}/metadef/graph/ge_tensor.cc" + "${GE_CODE_DIR}/metadef/graph/ref_relation.cc" "${GE_CODE_DIR}/metadef/graph/tensor.cc" "${GE_CODE_DIR}/metadef/graph/detail/attributes_holder.cc" "${GE_CODE_DIR}/metadef/graph/utils/anchor_utils.cc" @@ -107,6 +115,7 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/metadef/graph/utils/op_desc_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/tensor_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/type_utils.cc" + "${GE_CODE_DIR}/metadef/graph/utils/transformer_utils.cc" "${GE_CODE_DIR}/metadef/graph/debug/graph_debug.cc" "${GE_CODE_DIR}/metadef/graph/opsproto/opsproto_manager.cc" "${GE_CODE_DIR}/metadef/ops/op_imp.cpp" @@ -115,6 +124,7 @@ set(COMMON_SRC_FILES #"${GE_CODE_DIR}/tests/depends/cce/src/op_kernel_registry.cpp" "${GE_CODE_DIR}/metadef/register/auto_mapping_util.cpp" "${GE_CODE_DIR}/metadef/register/tensor_assign.cpp" + "${GE_CODE_DIR}/metadef/register/register_format_transfer.cc" "${GE_CODE_DIR}/metadef/graph/format_refiner.cc" ) @@ -245,6 +255,7 @@ set(GRAPH_BUILD_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" "${GE_CODE_DIR}/ge/common/model_parser/base.cc" "${GE_CODE_DIR}/ge/graph/build/run_context.cc" + "${GE_CODE_DIR}/ge/graph/common/local_context.cc" #"${GE_CODE_DIR}/ge/graph/build/optimize_stream_graph.cc" ) @@ -509,6 +520,7 @@ list(APPEND COMMON_SHARED_LIBRARIES profiler_stub mmpa_stub hccl_stub + error_manager_stub ) # build common add_library(ge_ut_common STATIC ${COMMON_SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS}) @@ -518,6 +530,7 @@ target_compile_definitions(ge_ut_common PRIVATE ) target_link_libraries(ge_ut_common PRIVATE + $ c_sec ascend_protobuf json @@ -538,6 +551,7 @@ target_compile_definitions(ge_prepare_common PRIVATE ) target_link_libraries(ge_prepare_common PRIVATE + $ c_sec ascend_protobuf json @@ -551,6 +565,7 @@ target_compile_definitions(ge_optimize_common PRIVATE ) target_link_libraries(ge_optimize_common PRIVATE + $ ascend_protobuf c_sec json @@ -564,6 +579,7 @@ target_compile_definitions(ge_partition_common PRIVATE ) target_link_libraries(ge_partition_common PRIVATE + $ ascend_protobuf c_sec json @@ -577,6 +593,7 @@ target_compile_definitions(ge_load_common PRIVATE ) target_link_libraries(ge_load_common PRIVATE + $ c_sec ascend_protobuf json @@ -590,6 +607,7 @@ target_compile_definitions(ge_execute_common PRIVATE ) target_link_libraries(ge_execute_common PRIVATE + $ c_sec json ascend_protobuf @@ -603,6 +621,7 @@ target_compile_definitions(ge_build_common PRIVATE ) target_link_libraries(ge_build_common PRIVATE + $ c_sec ascend_protobuf json @@ -616,6 +635,7 @@ target_compile_definitions(ge_pass_common PRIVATE ) target_link_libraries(ge_pass_common PRIVATE + $ ascend_protobuf c_sec json @@ -629,6 +649,7 @@ target_compile_definitions(ge_single_op PRIVATE ) target_link_libraries(ge_single_op PRIVATE + $ ascend_protobuf json c_sec @@ -648,11 +669,9 @@ target_compile_definitions(ut_libge_multiparts_utest PRIVATE ) target_link_libraries(ut_libge_multiparts_utest - ge_build_common ge_load_common ge_build_common ge_execute_common ge_optimize_common ge_partition_common ge_pass_common - ge_prepare_common ge_single_op ge_ut_common - gtest gtest_main ascend_protobuf -lrt -ldl + $ + ge_build_common ge_load_common ge_build_common ge_execute_common ge_optimize_common ge_partition_common ge_pass_common ge_prepare_common ge_single_op ge_ut_common gtest gtest_main ascend_protobuf ${COMMON_SHARED_LIBRARIES} json -lrt -ldl ) -target_link_libraries(ut_libge_multiparts_utest ${COMMON_SHARED_LIBRARIES} ascend_protobuf json) # libge_others_utest add_executable(ut_libge_others_utest @@ -663,10 +682,9 @@ add_executable(ut_libge_others_utest ${OTHERS_TEST_FILES} ) target_link_libraries(ut_libge_others_utest - ge_execute_common ge_load_common ge_pass_common ge_ut_common - gtest gtest_main ascend_protobuf -lrt -ldl + $ + ge_execute_common ge_load_common ge_pass_common ge_ut_common gtest gtest_main ascend_protobuf ${COMMON_SHARED_LIBRARIES} -lrt -ldl ) -target_link_libraries(ut_libge_others_utest ${COMMON_SHARED_LIBRARIES} ascend_protobuf) # libge_kernel_utest add_executable(ut_libge_kernel_utest @@ -676,10 +694,9 @@ add_executable(ut_libge_kernel_utest ${KERNEL_SRC_FILES} ) target_link_libraries(ut_libge_kernel_utest - ge_pass_common ge_ut_common ge_load_common - gtest gtest_main ascend_protobuf -lrt -ldl + $ + ge_pass_common ge_ut_common ge_load_common gtest gtest_main ascend_protobuf ${COMMON_SHARED_LIBRARIES} -lrt -ldl ) -target_link_libraries(ut_libge_kernel_utest ${COMMON_SHARED_LIBRARIES} ascend_protobuf) # libge_distinct_load_utest add_executable(ut_libge_distinct_load_utest @@ -689,7 +706,9 @@ add_executable(ut_libge_distinct_load_utest ${SINGLE_OP_TEST_FILES} ${PROFILING_MNG_TEST_FILES} ) -target_link_libraries(ut_libge_distinct_load_utest ${COMMON_SHARED_LIBRARIES} +target_link_libraries(ut_libge_distinct_load_utest + ${COMMON_SHARED_LIBRARIES} + $ ge_execute_common ge_ut_common ge_ut_common_format ge_pass_common ge_load_common ge_single_op ge_prepare_common ge_optimize_common ge_build_common ge_partition_common diff --git a/tests/ut/ge/graph/build/logical_stream_allocator_unittest.cc b/tests/ut/ge/graph/build/logical_stream_allocator_unittest.cc index 086b1495..68416409 100644 --- a/tests/ut/ge/graph/build/logical_stream_allocator_unittest.cc +++ b/tests/ut/ge/graph/build/logical_stream_allocator_unittest.cc @@ -189,18 +189,20 @@ class UtestLogicalStreamAllocator : public testing::Test { bool ExpectStreamEq(SubGraphInfoPtr subgraph, int64_t expect) { return GetStream(subgraph) == expect; } bool ExpectStreamNe(SubGraphInfoPtr subgraph, int64_t expect) { return GetStream(subgraph) != expect; } - Status AssignLogicalStreams(vector subgraphs, vector &confs, + Status AssignLogicalStreams(Graph2SubGraphInfoList &subgraph_map, vector &confs, std::map &max_parallel_num, ComputeGraphPtr &whole_graph) { SchedulerConf scheduler_conf; if (confs.empty()) { - for (const auto &subgraph : subgraphs) { - EngineConfPtr conf = make_shared(); - conf->id = subgraph->GetEngineName(); - if (conf->id == "ge_local") { - conf->skip_assign_stream = true; - conf->attach = true; - } - scheduler_conf.cal_engines[conf->id] = conf; + for (const auto &subgraph_pair : subgraph_map) { + for (const auto &sub_graph : subgraph_pair.second) { + EngineConfPtr conf = make_shared(); + conf->id = sub_graph->GetEngineName(); + if (conf->id == "ge_local") { + conf->skip_assign_stream = true; + conf->attach = true; + } + scheduler_conf.cal_engines[conf->id] = conf; + } } } else { for (auto &conf : confs) { @@ -217,11 +219,21 @@ class UtestLogicalStreamAllocator : public testing::Test { scheduler_confs["scheduler"] = scheduler_conf; LogicalStreamAllocator allocator(scheduler_confs, max_parallel_num); int64_t stream_num = 0; - return allocator.Assign(whole_graph, subgraphs, stream_num); + return allocator.Assign(whole_graph, subgraph_map, stream_num); } - Status AssignLogicalStreams(vector subgraphs, std::map &max_parallel_num, - vector &confs) { + Status AssignLogicalStreams(vector subgraphs, + vector &confs, + std::map &max_parallel_num, + ComputeGraphPtr &whole_graph) { + Graph2SubGraphInfoList subgraph_map; + subgraph_map[whole_graph] = subgraphs; + return AssignLogicalStreams(subgraph_map, confs, max_parallel_num, whole_graph); + } + + Status AssignLogicalStreams(vector subgraphs, + vector& confs, + std::map &max_parallel_num) { ComputeGraphPtr whole_graph = make_shared("whole_graph"); return AssignLogicalStreams(subgraphs, confs, max_parallel_num, whole_graph); } @@ -229,12 +241,12 @@ class UtestLogicalStreamAllocator : public testing::Test { Status AssignLogicalStreams(vector subgraphs, vector confs = vector()) { std::map max_parallel_num; - return AssignLogicalStreams(subgraphs, max_parallel_num, confs); + return AssignLogicalStreams(subgraphs, confs, max_parallel_num); } Status AssignLogicalStreams(vector subgraphs, std::map &max_parallel_num) { vector confs; - return AssignLogicalStreams(subgraphs, max_parallel_num, confs); + return AssignLogicalStreams(subgraphs, confs, max_parallel_num); } /// typical case @@ -295,7 +307,7 @@ class UtestLogicalStreamAllocator : public testing::Test { Status status = AssignLogicalStreams({const1, const2, get_next, genmask1, genmask2, domask, subgraph4, subgraph5, subgraph6, allreduce1, allreduce2, apply1, apply2}, - max_parallel_num, confs); + confs, max_parallel_num); EXPECT_EQ(status, ge::SUCCESS); EXPECT_EQ(GetStream(get_next), 0); @@ -652,7 +664,7 @@ TEST_F(UtestLogicalStreamAllocator, test_independent) { vector confs = {conf1, conf2}; Status status = - AssignLogicalStreams({subgraph1, subgraph2, subgraph3, subgraph4, subgraph5}, max_parallel_num, confs); + AssignLogicalStreams({subgraph1, subgraph2, subgraph3, subgraph4, subgraph5}, confs, max_parallel_num); EXPECT_EQ(status, ge::SUCCESS); EXPECT_EQ(GetStream(subgraph1), 0); EXPECT_EQ(GetStream(subgraph2), 0); @@ -695,7 +707,7 @@ TEST_F(UtestLogicalStreamAllocator, test_independent_switch_label) { vector confs = {conf1, conf2, conf3}; Status status = - AssignLogicalStreams({subgraph1, subgraph2, subgraph3, subgraph4, subgraph5}, max_parallel_num, confs); + AssignLogicalStreams({subgraph1, subgraph2, subgraph3, subgraph4, subgraph5},confs, max_parallel_num); EXPECT_EQ(status, ge::SUCCESS); EXPECT_EQ(GetStream(subgraph1), 4); EXPECT_EQ(GetStream(subgraph2), 0); diff --git a/tests/ut/ge/graph/build/mem_assigner_unittest.cc b/tests/ut/ge/graph/build/mem_assigner_unittest.cc index 1e326b01..1035d00d 100644 --- a/tests/ut/ge/graph/build/mem_assigner_unittest.cc +++ b/tests/ut/ge/graph/build/mem_assigner_unittest.cc @@ -177,7 +177,10 @@ class MockBlockMemAssigner : public BlockMemAssigner { TEST_F(UtestMemoryAssignerTest, Mock_block_mem_assigner_failed) { ge::ComputeGraphPtr graph = make_shared(""); make_graph(graph); - MockBlockMemAssigner mock_assigner(graph); + std::map anchor_to_symbol; + std::map> symbol_to_anchors; + EXPECT_EQ(GraphUtils::GetRefMapping(graph, symbol_to_anchors, anchor_to_symbol), GRAPH_SUCCESS); + MockBlockMemAssigner mock_assigner(graph, anchor_to_symbol, symbol_to_anchors); EXPECT_EQ(mock_assigner.Assign(), FAILED); } diff --git a/tests/ut/ge/graph/passes/base_pass_unittest.cc b/tests/ut/ge/graph/passes/base_pass_unittest.cc index 858c36dd..9431779a 100644 --- a/tests/ut/ge/graph/passes/base_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/base_pass_unittest.cc @@ -49,7 +49,7 @@ class UtestTestPass : public BaseNodePass { for (const auto &node_name : iter->second) { auto del_node = node->GetOwnerComputeGraph()->FindNode(node_name); GraphUtils::IsolateNode(del_node, {0}); - AddNodeDeleted(del_node.get()); + AddNodeDeleted(del_node); } } iter = names_to_add_repass_.find(node->GetName()); diff --git a/tests/ut/ge/graph/passes/pass_manager_unittest.cc b/tests/ut/ge/graph/passes/pass_manager_unittest.cc index 0763a61b..2eb6053c 100644 --- a/tests/ut/ge/graph/passes/pass_manager_unittest.cc +++ b/tests/ut/ge/graph/passes/pass_manager_unittest.cc @@ -72,7 +72,7 @@ ComputeGraphPtr CreatePadGraph() { TEST_F(UtestGraphPassesPassManagerPass, all_pass_success) { PassManager manager; - manager.AddPass(new SuccessGraphPass); + manager.AddPass("", new SuccessGraphPass); EXPECT_EQ(manager.GraphPasses().size(), 1); ComputeGraphPtr graph = CreatePadGraph(); @@ -83,7 +83,7 @@ TEST_F(UtestGraphPassesPassManagerPass, all_pass_success) { TEST_F(UtestGraphPassesPassManagerPass, graph_pass_success) { ComputeGraphPtr graph = CreatePadGraph(); SuccessGraphPass pass; - vector passes = {&pass}; + std::vector> passes; Status status = PassManager::Run(graph, passes); EXPECT_EQ(SUCCESS, status); } @@ -91,7 +91,7 @@ TEST_F(UtestGraphPassesPassManagerPass, graph_pass_success) { TEST_F(UtestGraphPassesPassManagerPass, graph_pass_not_changed) { ComputeGraphPtr graph = CreatePadGraph(); NotChangedGraphPass pass; - vector passes = {&pass}; + std::vector> passes; Status status = PassManager::Run(graph, passes); EXPECT_EQ(NOT_CHANGED, status); } @@ -99,7 +99,7 @@ TEST_F(UtestGraphPassesPassManagerPass, graph_pass_not_changed) { TEST_F(UtestGraphPassesPassManagerPass, graph_pass_error) { ComputeGraphPtr graph = CreatePadGraph(); ErrorGraphPass pass; - vector passes = {&pass}; + std::vector> passes; Status status = PassManager::Run(graph, passes); EXPECT_EQ(FAILED, status); } diff --git a/tests/ut/ge/graph/passes/prune_pass_unittest.cc b/tests/ut/ge/graph/passes/prune_pass_unittest.cc index f29b67da..8bae0ac8 100644 --- a/tests/ut/ge/graph/passes/prune_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/prune_pass_unittest.cc @@ -67,7 +67,7 @@ TEST_F(UtestGraphPassesPrunePass, no_net_out_put_node) { uint64_t size_ori = graph->GetDirectNode().size(); PrunePass prune_pass; - vector passes = {&prune_pass}; + std::vector> passes = { {"prune_pass", &prune_pass} }; Status status = PassManager::Run(graph, passes); EXPECT_EQ(ge::SUCCESS, status); @@ -109,7 +109,7 @@ TEST_F(UtestGraphPassesPrunePass, has_net_out_put_node_with_only_one_path) { uint64_t size_ori = graph->GetDirectNode().size(); PrunePass prune_pass; - vector passes = {&prune_pass}; + std::vector> passes = { {"prune_pass", &prune_pass} }; Status status = PassManager::Run(graph, passes); uint64_t size = graph->GetDirectNode().size(); @@ -250,7 +250,7 @@ TEST_F(UtestGraphPassesPrunePass, has_net_out_put_node_with_multi_path) { uint64_t size_ori = graph->GetDirectNode().size(); PrunePass prune_pass; - vector passes = {&prune_pass}; + std::vector> passes = { {"prune_pass", &prune_pass} }; Status status = PassManager::Run(graph, passes); uint64_t size_after_proc = graph->GetDirectNode().size(); @@ -323,7 +323,7 @@ TEST_F(UtestGraphPassesPrunePass, multi_net_out_put_node_with_circle_net) { uint64_t size_ori = graph->GetDirectNode().size(); PrunePass prune_pass; - vector passes = {&prune_pass}; + std::vector> passes = { {"prune_pass", &prune_pass} }; Status status = PassManager::Run(graph, passes); EXPECT_EQ(ge::SUCCESS, status); uint64_t size_after_proc = graph->GetDirectNode().size(); @@ -464,7 +464,7 @@ TEST_F(UtestGraphPassesPrunePass, has_net_out_put_node_with_two_isolate_data_nod uint64_t size_ori = graph->GetDirectNode().size(); PrunePass prune_pass; - vector passes = {&prune_pass}; + std::vector> passes = { {"prune_pass", &prune_pass} }; Status status = PassManager::Run(graph, passes); uint64_t size = graph->GetDirectNode().size(); diff --git a/tests/ut/ge/graph/passes/switch_op_pass_unittest.cc b/tests/ut/ge/graph/passes/switch_op_pass_unittest.cc index 26b1be81..2e2c2983 100644 --- a/tests/ut/ge/graph/passes/switch_op_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/switch_op_pass_unittest.cc @@ -19,7 +19,6 @@ #include "omg/omg_inner_types.h" #define protected public #define private public -#include "graph/passes/switch_op_pass.h" #include "common/debug/log.h" #include "common/debug/memory_dumper.h" @@ -27,7 +26,6 @@ #include "common/types.h" #include "graph/debug/ge_attr_define.h" #include "graph/graph.h" -#include "graph/passes/control_op_attr_pass.h" #include "inc/pass_manager.h" #undef protected #undef private diff --git a/tests/ut/ge/graph/passes/unused_and_isolated_op_remove_pass_unittest.cc b/tests/ut/ge/graph/passes/unused_and_isolated_op_remove_pass_unittest.cc index 13b4e76c..6148c0f0 100644 --- a/tests/ut/ge/graph/passes/unused_and_isolated_op_remove_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/unused_and_isolated_op_remove_pass_unittest.cc @@ -54,9 +54,11 @@ TEST_F(UtestGraphPassesUnusedAndIsolatedOpRemovePass, transpose_and_reshape) { GraphUtils::AddEdge(data_node->GetOutDataAnchor(0), transpose_node->GetInDataAnchor(0)); GraphUtils::AddEdge(transpose_node->GetOutDataAnchor(0), reshape_node->GetInDataAnchor(0)); - ge::UnusedOpRemovePass unused_pass(FMK_TYPE_T); + ge::UnusedOpRemovePass unused_pass(TENSORFLOW); ge::IsolatedOpRemovePass isolate_pass; - vector passes = {&unused_pass, &isolate_pass}; + std::vector> passes; + passes.emplace_back("", &isolate_pass); + passes.emplace_back("", &unused_pass); Status status = PassManager::Run(graph, passes); EXPECT_EQ(SUCCESS, status); NodePtr found_node = graph->FindNode("transpose1"); @@ -73,9 +75,11 @@ TEST_F(UtestGraphPassesUnusedAndIsolatedOpRemovePass, transpose_and_squeeze) { GraphUtils::AddEdge(data_node->GetOutDataAnchor(0), transpose_node->GetInDataAnchor(0)); GraphUtils::AddEdge(transpose_node->GetOutDataAnchor(0), squeeze_node->GetInDataAnchor(0)); - ge::UnusedOpRemovePass unused_pass(FMK_TYPE_T); + ge::UnusedOpRemovePass unused_pass(TENSORFLOW); ge::IsolatedOpRemovePass isolate_pass; - vector passes = {&unused_pass, &isolate_pass}; + std::vector> passes; + passes.emplace_back("", &isolate_pass); + passes.emplace_back("", &unused_pass); Status status = PassManager::Run(graph, passes); EXPECT_EQ(SUCCESS, status); NodePtr found_node = graph->FindNode("transpose1"); @@ -100,7 +104,7 @@ TEST_F(UtestGraphPassesUnusedAndIsolatedOpRemovePass, transpose_and_conv) { NodePtr conv2_node = AddNode(graph, "conv2", CONVOLUTION); GraphUtils::AddEdge(conv_node->GetOutDataAnchor(0), conv2_node->GetInDataAnchor(0)); - ge::UnusedOpRemovePass unused_pass(FMK_TYPE_T); + ge::UnusedOpRemovePass unused_pass(TENSORFLOW); ge::IsolatedOpRemovePass isolate_pass; vector passes = {&unused_pass, &isolate_pass}; Status status = PassManager::Run(graph, passes); diff --git a/tests/ut/ge/graph/passes/variable_op_pass_unittest.cc b/tests/ut/ge/graph/passes/variable_op_pass_unittest.cc index 7bc32a6f..8058279f 100644 --- a/tests/ut/ge/graph/passes/variable_op_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/variable_op_pass_unittest.cc @@ -39,7 +39,6 @@ #include "graph/manager/graph_var_manager.h" #include "graph_builder_utils.h" #include "cce/dnn_struct_base.hpp" -#include "common/formats/format_transfers/format_transfer.h" #include "common/formats/format_transfers/format_transfer_nchw_nc1hwc0.h" #include "common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.h" #include "common/formats/format_transfers/datatype_transfer.h"