Browse Source

remove graph ut form ge

tags/v1.3.0
zhengyuanhua 3 years ago
parent
commit
d8ba1fb2c0
11 changed files with 26 additions and 154 deletions
  1. +6
    -6
      cmake/external_libs/protobuf_shared.cmake
  2. +4
    -6
      cmake/external_libs/protobuf_static.cmake
  3. +5
    -7
      cmake/external_libs/protoc.cmake
  4. +1
    -1
      metadef
  5. +1
    -1
      parser
  6. +0
    -112
      tests/ut/common/graph/testcase/ge_graph/ge_graph_anchor_unittest.cc
  7. +2
    -1
      tests/ut/common/graph/testcase/ge_graph/ge_model_serialize_unittest.cc
  8. +1
    -17
      tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc
  9. +1
    -0
      tests/ut/ge/CMakeLists.txt
  10. +3
    -2
      tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc
  11. +2
    -1
      tests/ut/ge/hybrid/ge_hybrid_unittest.cc

+ 6
- 6
cmake/external_libs/protobuf_shared.cmake View File

@@ -11,14 +11,14 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.") message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.")
endif() endif()
if (GE_PB_PKG) if (GE_PB_PKG)
set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.8.0.tar.gz")
set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.13.0.tar.gz")
else() else()
if (ENABLE_GITEE) if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz")
set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236")
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz")
set(MD5 "f4489cb88922ad9c58cbe3308d59cee5")
else() else()
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz")
set(MD5 "3d9e32700639618a4d2d342c99d4507a")
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz")
set(MD5 "1a6274bc4a65b55a6fa70e264d796490")
endif () endif ()
endif() endif()


@@ -58,7 +58,7 @@ target_include_directories(ascend_protobuf INTERFACE ${PROTOBUF_SHARED_PKG_DIR}/
set(INSTALL_BASE_DIR "") set(INSTALL_BASE_DIR "")
set(INSTALL_LIBRARY_DIR lib) set(INSTALL_LIBRARY_DIR lib)


install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so.3.8.0.0 OPTIONAL
install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so.3.13.0.0 OPTIONAL
DESTINATION ${INSTALL_LIBRARY_DIR}) DESTINATION ${INSTALL_LIBRARY_DIR})
install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so OPTIONAL install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so OPTIONAL
DESTINATION ${INSTALL_LIBRARY_DIR}) DESTINATION ${INSTALL_LIBRARY_DIR})


+ 4
- 6
cmake/external_libs/protobuf_static.cmake View File

@@ -16,11 +16,11 @@ if(GE_PB_PKG)
set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.8.0.tar.gz") set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.8.0.tar.gz")
else() else()
if (ENABLE_GITEE) if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz")
set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236")
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz")
set(MD5 "f4489cb88922ad9c58cbe3308d59cee5")
else() else()
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz")
set(MD5 "3d9e32700639618a4d2d342c99d4507a")
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz")
set(MD5 "1a6274bc4a65b55a6fa70e264d796490")
endif () endif ()
endif() endif()


@@ -29,8 +29,6 @@ set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
set(PROTOBUF_STATIC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf_static) set(PROTOBUF_STATIC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf_static)
ExternalProject_Add(protobuf_static_build ExternalProject_Add(protobuf_static_build
URL ${REQ_URL} URL ${REQ_URL}
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
#SOURCE_DIR ${METADEF_DIR}/../../third_party/protobuf/src/protobuf-3.8.0
TLS_VERIFY OFF TLS_VERIFY OFF
CONFIGURE_COMMAND ${CMAKE_COMMAND} CONFIGURE_COMMAND ${CMAKE_COMMAND}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}


+ 5
- 7
cmake/external_libs/protoc.cmake View File

@@ -13,14 +13,14 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
endif() endif()


if(GE_PB_PKG) if(GE_PB_PKG)
set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.8.0.tar.gz")
set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.13.0.tar.gz")
else() else()
if (ENABLE_GITEE) if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz")
set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236")
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz")
set(MD5 "f4489cb88922ad9c58cbe3308d59cee5")
else() else()
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz")
set(MD5 "3d9e32700639618a4d2d342c99d4507a")
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz")
set(MD5 "1a6274bc4a65b55a6fa70e264d796490")
endif () endif ()
endif() endif()


@@ -28,8 +28,6 @@ set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fst
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
ExternalProject_Add(protoc_build ExternalProject_Add(protoc_build
URL ${REQ_URL} URL ${REQ_URL}
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
#SOURCE_DIR ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0
TLS_VERIFY OFF TLS_VERIFY OFF
CONFIGURE_COMMAND ${CMAKE_COMMAND} -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/protoc <SOURCE_DIR>/cmake CONFIGURE_COMMAND ${CMAKE_COMMAND} -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/protoc <SOURCE_DIR>/cmake
BUILD_COMMAND $(MAKE) BUILD_COMMAND $(MAKE)


+ 1
- 1
metadef

@@ -1 +1 @@
Subproject commit b27915cd37919430a61953f8998b7acce4a60177
Subproject commit c6030152c6dc05515115765babb5d64fde649df4

+ 1
- 1
parser

@@ -1 +1 @@
Subproject commit e75eda62de2b51a0bded5481ca81eb8fc7bf376e
Subproject commit 155d3262ba17f800094abb58b6a809b041cf0a74

+ 0
- 112
tests/ut/common/graph/testcase/ge_graph/ge_graph_anchor_unittest.cc View File

@@ -272,115 +272,3 @@ TEST_F(UtestGeAnchor, graph_utils_test) {
EXPECT_EQ(GraphUtils::RemoveEdge(conv_node->GetOutDataAnchor(0), bn_node->GetInControlAnchor()), GRAPH_SUCCESS); EXPECT_EQ(GraphUtils::RemoveEdge(conv_node->GetOutDataAnchor(0), bn_node->GetInControlAnchor()), GRAPH_SUCCESS);
EXPECT_EQ(GraphUtils::RemoveEdge(conv_node->GetOutDataAnchor(0), bn_node->GetInControlAnchor()), GRAPH_FAILED); EXPECT_EQ(GraphUtils::RemoveEdge(conv_node->GetOutDataAnchor(0), bn_node->GetInControlAnchor()), GRAPH_FAILED);
} }

TEST_F(UtestGeAnchor, data_anchor_replace_peer) {
ComputeGraphPtr graph_ptr = std::make_shared<ComputeGraph>("graph");
OpDescPtr in_op_ptr = std::make_shared<OpDesc>("in_op_1", "float");
in_op_ptr->AddInputDesc("x1", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddInputDesc("x2", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddInputDesc("x3", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddOutputDesc("y1", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddOutputDesc("y2", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddOutputDesc("y3", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
NodePtr node1 = graph_ptr->AddNode(in_op_ptr);
NodePtr node2 = graph_ptr->AddNode(in_op_ptr);
NodePtr node3 = graph_ptr->AddNode(in_op_ptr);

OutDataAnchorPtr out_data_anchor = node1->GetOutDataAnchor(1);
InDataAnchorPtr in_data_anchor = node2->GetInDataAnchor(1);
EXPECT_EQ(out_data_anchor != nullptr, true);
EXPECT_EQ(in_data_anchor != nullptr, true);
EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(0)), GRAPH_SUCCESS);
EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(1)), GRAPH_SUCCESS);
EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(2)), GRAPH_SUCCESS);

size_t out_idx = 0;
for (; out_idx < out_data_anchor->peer_anchors_.size(); out_idx++) {
if (out_data_anchor->peer_anchors_[out_idx].lock() == in_data_anchor) {
break;
}
}
EXPECT_EQ(out_idx, 1);

size_t in_idx = 0;
for (; in_idx < in_data_anchor->peer_anchors_.size(); in_idx++) {
if (in_data_anchor->peer_anchors_[in_idx].lock() == out_data_anchor) {
break;
}
}
EXPECT_EQ(in_idx, 0);

out_data_anchor->ReplacePeer(in_data_anchor, node3->GetInDataAnchor(1), node3->GetOutDataAnchor(1));

size_t out_idx1 = 0;
for (; out_idx1 < out_data_anchor->peer_anchors_.size(); out_idx1++) {
if (out_data_anchor->peer_anchors_[out_idx1].lock() == node3->GetInDataAnchor(1)) {
break;
}
}
EXPECT_EQ(out_idx1, out_idx);

size_t in_idx1 = 0;
for (; in_idx1 < in_data_anchor->peer_anchors_.size(); in_idx1++) {
if (in_data_anchor->peer_anchors_[in_idx1].lock() == node3->GetOutDataAnchor(1)) {
break;
}
}
EXPECT_EQ(in_idx1, in_idx);
}

TEST_F(UtestGeAnchor, graph_utils_insert_node) {
ComputeGraphPtr graph_ptr = std::make_shared<ComputeGraph>("graph");
OpDescPtr in_op_ptr = std::make_shared<OpDesc>("in_op_1", "float");
in_op_ptr->AddInputDesc("x1", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddInputDesc("x2", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddInputDesc("x3", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddOutputDesc("y1", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddOutputDesc("y2", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
in_op_ptr->AddOutputDesc("y3", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW));
NodePtr node1 = graph_ptr->AddNode(in_op_ptr);
NodePtr node2 = graph_ptr->AddNode(in_op_ptr);
NodePtr node3 = graph_ptr->AddNode(in_op_ptr);

OutDataAnchorPtr out_data_anchor = node1->GetOutDataAnchor(1);
InDataAnchorPtr in_data_anchor = node2->GetInDataAnchor(1);
EXPECT_EQ(out_data_anchor != nullptr, true);
EXPECT_EQ(in_data_anchor != nullptr, true);
EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(0)), GRAPH_SUCCESS);
EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(1)), GRAPH_SUCCESS);
EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(2)), GRAPH_SUCCESS);

size_t out_idx = 0;
for (; out_idx < out_data_anchor->peer_anchors_.size(); out_idx++) {
if (out_data_anchor->peer_anchors_[out_idx].lock() == in_data_anchor) {
break;
}
}
EXPECT_EQ(out_idx, 1);

size_t in_idx = 0;
for (; in_idx < in_data_anchor->peer_anchors_.size(); in_idx++) {
if (in_data_anchor->peer_anchors_[in_idx].lock() == out_data_anchor) {
break;
}
}
EXPECT_EQ(in_idx, 0);

GraphUtils::InsertNodeBetweenDataAnchors(out_data_anchor, in_data_anchor, node3);

size_t out_idx1 = 0;
for (; out_idx1 < out_data_anchor->peer_anchors_.size(); out_idx1++) {
if (out_data_anchor->peer_anchors_[out_idx1].lock() == node3->GetInDataAnchor(0)) {
break;
}
}
EXPECT_EQ(out_idx1, out_idx);

size_t in_idx1 = 0;
for (; in_idx1 < in_data_anchor->peer_anchors_.size(); in_idx1++) {
if (in_data_anchor->peer_anchors_[in_idx1].lock() == node3->GetOutDataAnchor(0)) {
break;
}
}
EXPECT_EQ(in_idx1, in_idx);
}

+ 2
- 1
tests/ut/common/graph/testcase/ge_graph/ge_model_serialize_unittest.cc View File

@@ -30,6 +30,7 @@
#include "graph/model_serialize.h" #include "graph/model_serialize.h"


#include "graph/detail/model_serialize_imp.h" #include "graph/detail/model_serialize_imp.h"
#include "graph/node_impl.h"
#include "graph/ge_attr_value.h" #include "graph/ge_attr_value.h"
#include "graph/utils/graph_utils.h" #include "graph/utils/graph_utils.h"
#include "graph/utils/tensor_utils.h" #include "graph/utils/tensor_utils.h"
@@ -1062,7 +1063,7 @@ TEST(UtestGeModelSerialize, test_model_serialize_imp_invalid_param) {


auto graph = std::make_shared<ComputeGraph>("test_graph"); auto graph = std::make_shared<ComputeGraph>("test_graph");
auto node = graph->AddNode(std::make_shared<OpDesc>()); auto node = graph->AddNode(std::make_shared<OpDesc>());
node->op_ = nullptr;
node->impl_->op_ = nullptr;
ge::proto::ModelDef model_def; ge::proto::ModelDef model_def;
Model model; Model model;
model.SetGraph(GraphUtils::CreateGraphFromComputeGraph(graph)); model.SetGraph(GraphUtils::CreateGraphFromComputeGraph(graph));


+ 1
- 17
tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc View File

@@ -25,6 +25,7 @@
#include "graph/ge_attr_value.h" #include "graph/ge_attr_value.h"
#include "graph/tensor.h" #include "graph/tensor.h"
#include "graph/utils/tensor_utils.h" #include "graph/utils/tensor_utils.h"
#include "graph/ge_tensor_impl.h"
#undef private #undef private
#undef protected #undef protected


@@ -196,23 +197,6 @@ TEST_F(UtestGeTensor, test_shape_copy_move) {
EXPECT_EQ(shape4.GetDimNum(), 3); EXPECT_EQ(shape4.GetDimNum(), 3);
} }


TEST_F(UtestGeTensor, test_tensor_desc_invalid_null) {
GeTensorDesc tensor_desc(nullptr, nullptr);
EXPECT_EQ(tensor_desc.GetDataType(), DT_UNDEFINED);
EXPECT_EQ(tensor_desc.GetFormat(), FORMAT_RESERVED);
EXPECT_EQ(tensor_desc.MutableShape().shape_def_.GetProtoMsg(), nullptr);

GeTensorDesc tensor_desc2;
EXPECT_EQ(tensor_desc2.GetDataType(), DT_FLOAT);
EXPECT_EQ(tensor_desc2.GetFormat(), FORMAT_ND);

tensor_desc2.SetDataType(DT_DUAL_SUB_INT8);
EXPECT_EQ(tensor_desc2.GetDataType(), DT_DUAL_SUB_INT8);

TensorUtils::SetWeightSize(tensor_desc, 100);
EXPECT_EQ(TensorUtils::GetWeightSize(tensor_desc), 0);
}

TEST_F(UtestGeTensor, test_tensor_invalid_null) { TEST_F(UtestGeTensor, test_tensor_invalid_null) {
ProtoMsgOwner msg_owner; ProtoMsgOwner msg_owner;
GeTensor tensor(msg_owner, nullptr); GeTensor tensor(msg_owner, nullptr);


+ 1
- 0
tests/ut/ge/CMakeLists.txt View File

@@ -121,6 +121,7 @@ set(GRAPH_SRC_FILES
"${GE_CODE_DIR}/metadef/register/op_tiling.cpp" "${GE_CODE_DIR}/metadef/register/op_tiling.cpp"
"${GE_CODE_DIR}/metadef/graph/utils/tuning_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/tuning_utils.cc"
"${GE_CODE_DIR}/metadef/register/op_tiling_registry.cpp" "${GE_CODE_DIR}/metadef/register/op_tiling_registry.cpp"
"${GE_CODE_DIR}/metadef/register/op_tiling_registry_impl.cpp"
) )


set(PARSER_SRC_FILES set(PARSER_SRC_FILES


+ 3
- 2
tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc View File

@@ -20,6 +20,7 @@
#define protected public #define protected public
#include "graph/partition/dynamic_shape_partition.h" #include "graph/partition/dynamic_shape_partition.h"
#include "compute_graph.h" #include "compute_graph.h"
#include "graph/compute_graph_impl.h"
#include "inc/framework/common/types.h" #include "inc/framework/common/types.h"
#include "utils/graph_utils.h" #include "utils/graph_utils.h"
#include "graph/debug/ge_attr_define.h" #include "graph/debug/ge_attr_define.h"
@@ -111,9 +112,9 @@ TEST_F(UtestDynamicShapePartition, merge_control_flow_group) {
(void)AttrUtils::SetBool(merge->GetOpDesc(), ATTR_NAME_FORCE_UNKNOWN_SHAPE, true); (void)AttrUtils::SetBool(merge->GetOpDesc(), ATTR_NAME_FORCE_UNKNOWN_SHAPE, true);
(void)AttrUtils::SetInt(merge->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, 3); (void)AttrUtils::SetInt(merge->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, 3);


EXPECT_EQ(graph->sub_graph_.size(), 0);
EXPECT_EQ(graph->impl_->sub_graph_.size(), 0);
DynamicShapePartitioner partitioner(graph); DynamicShapePartitioner partitioner(graph);
EXPECT_EQ(partitioner.Partition(), SUCCESS); EXPECT_EQ(partitioner.Partition(), SUCCESS);
EXPECT_EQ(graph->sub_graph_.size(), 1);
EXPECT_EQ(graph->impl_->sub_graph_.size(), 1);
} }
} // namespace ge } // namespace ge

+ 2
- 1
tests/ut/ge/hybrid/ge_hybrid_unittest.cc View File

@@ -40,6 +40,7 @@
#include "graph/types.h" #include "graph/types.h"
#include "graph/utils/tensor_utils.h" #include "graph/utils/tensor_utils.h"
#include "graph/testcase/ge_graph/graph_builder_utils.h" #include "graph/testcase/ge_graph/graph_builder_utils.h"
#include "graph/op_desc_impl.h"
#undef private #undef private
#undef protected #undef protected


@@ -736,7 +737,7 @@ TEST_F(UtestGeHybrid, TestParseDependencies) {
std::vector<std::string> deps; std::vector<std::string> deps;
deps.push_back("Data"); deps.push_back("Data");
auto op_desc = netoutput->GetOpDesc(); auto op_desc = netoutput->GetOpDesc();
op_desc->input_name_idx_["Data"] = 0;
op_desc->impl_->input_name_idx_["Data"] = 0;
auto data_desc = data->GetOpDesc(); auto data_desc = data->GetOpDesc();
auto tensor = std::make_shared<GeTensor>(); auto tensor = std::make_shared<GeTensor>();
auto tensor_desc = data_desc->MutableInputDesc(0); auto tensor_desc = data_desc->MutableInputDesc(0);


Loading…
Cancel
Save