From fc748110910c7bda20386da578d418b2e59774e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Dec 2020 10:36:41 +0800 Subject: [PATCH 1/5] Custom pass register. --- ge/graph/manager/graph_manager.cc | 15 +++++++++++++++ ge/graph/manager/graph_manager.h | 1 + metadef | 2 +- parser | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index beb7cd42..46aeaebc 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -101,6 +101,7 @@ #include "graph/common/local_context.h" #include "graph/common/omg_util.h" #include "common/formats/utils/formats_trans_utils.h" +#include "external/register/register_pass.h" namespace { const char *const kSummary = "Summary"; @@ -765,10 +766,24 @@ Status GraphManager::SetRtContext(rtContext_t rt_context, rtCtxMode_t mode, uint return SUCCESS; } +Status GraphManager::RunCustomPass(const GraphNodePtr &graph_node) { + ConstGraphPtr const_graph = graph->node->GetGraph(); + auto comp_graph = GraphUtils::GetComputeGraph(*const_graph); + GE_DUMP(compute_graph, "RunCustomPassBegin"); + + GE_TIMESTAMP_START(RunCustomPass); + GraphPtr graph = std::const_pointer_cast(const_graph); + GE_CHK_STATUS_RET(CustomPassHelper::Instance()->Run(graph), "Graph[%s] run custom pass fail.", + comp_graph->GetName().c_str()); + GE_TIMESTAMP_END(RunCustomPass, "GraphBuilder::RunCustomPass"); + return SUCCESS; +} + Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector &inputs, GeRootModelPtr &ge_root_model, uint64_t session_id) { GE_CHECK_NOTNULL(graph_node); GE_CHECK_NOTNULL(graph_node->GetGraph()); + GE_CHK_STATUS_RET_NOLOG(RunCustomPass(graph_node)); auto compute_graph = GraphUtils::GetComputeGraph(*graph_node->GetGraph()); GE_CHECK_NOTNULL(compute_graph); compute_graph->SetSessionID(session_id); diff --git a/ge/graph/manager/graph_manager.h b/ge/graph/manager/graph_manager.h index d2887c4c..32de7eac 100644 --- a/ge/graph/manager/graph_manager.h +++ b/ge/graph/manager/graph_manager.h @@ -226,6 +226,7 @@ class GraphManager { void ParseInputsDimsForData(const std::vector &input_tensor); Status ParseInputsDimsForGetNexNosinkAndData(const vector &dynamic_nodes, const std::vector &input_tensor); + Status RunCustomPass(const GraphNodePtr &graph_node); Status PreRun(const GraphNodePtr &graph_node, const std::vector &inputs, GeRootModelPtr &ge_root_model, uint64_t session_id = INVALID_SESSION_ID); diff --git a/metadef b/metadef index 11c6cf29..37a90f0d 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 11c6cf2921b6a385616a3ebc601b4431b55b07db +Subproject commit 37a90f0dfd797306e99ec32a688be32a9ad835a4 diff --git a/parser b/parser index 99437c39..5b93b050 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 99437c39d26624a14060307366a96b79b1d439c3 +Subproject commit 5b93b050dd7ca5b77c3001a790031d877fa10956 From 0566c6dc3f91e72425d405ae45e55cfd1bc5fb46 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Dec 2020 10:52:24 +0800 Subject: [PATCH 2/5] Custom pass register. --- ge/graph/manager/graph_manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 46aeaebc..c102ec2e 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -769,7 +769,7 @@ Status GraphManager::SetRtContext(rtContext_t rt_context, rtCtxMode_t mode, uint Status GraphManager::RunCustomPass(const GraphNodePtr &graph_node) { ConstGraphPtr const_graph = graph->node->GetGraph(); auto comp_graph = GraphUtils::GetComputeGraph(*const_graph); - GE_DUMP(compute_graph, "RunCustomPassBegin"); + GE_DUMP(comp_graph, "RunCustomPassBegin"); GE_TIMESTAMP_START(RunCustomPass); GraphPtr graph = std::const_pointer_cast(const_graph); From b706aa1da3044d6fb2c02951b190e70f1683433d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Dec 2020 11:00:04 +0800 Subject: [PATCH 3/5] Custom pass register. --- ge/graph/manager/graph_manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index c102ec2e..706908af 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -767,7 +767,7 @@ Status GraphManager::SetRtContext(rtContext_t rt_context, rtCtxMode_t mode, uint } Status GraphManager::RunCustomPass(const GraphNodePtr &graph_node) { - ConstGraphPtr const_graph = graph->node->GetGraph(); + ConstGraphPtr const_graph = graph_node->GetGraph(); auto comp_graph = GraphUtils::GetComputeGraph(*const_graph); GE_DUMP(comp_graph, "RunCustomPassBegin"); From af230762e14c1cdfa31e7c691115e6e51bc9ec83 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Dec 2020 11:17:24 +0800 Subject: [PATCH 4/5] Custom pass register. --- tests/ut/ge/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 1f6c6837..dcf389c0 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -121,6 +121,7 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/metadef/graph/opsproto/opsproto_manager.cc" "${GE_CODE_DIR}/metadef/ops/op_imp.cpp" "${GE_CODE_DIR}/metadef/register/register.cpp" + "${GE_CODE_DIR}/metadef/register/register_pass.cpp" "${GE_CODE_DIR}/metadef/register/op_kernel_registry.cpp" "${GE_CODE_DIR}/metadef/register/auto_mapping_util.cpp" "${GE_CODE_DIR}/metadef/register/tensor_assign.cpp" From f175fed5884e55fbdd321dd59ab6e1cf834d05eb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Dec 2020 18:01:47 +0800 Subject: [PATCH 5/5] Custom pass register. --- ge/graph/manager/graph_manager.cc | 4 ++-- metadef | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 706908af..84572d45 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -101,7 +101,7 @@ #include "graph/common/local_context.h" #include "graph/common/omg_util.h" #include "common/formats/utils/formats_trans_utils.h" -#include "external/register/register_pass.h" +#include "register/custom_pass_helper.h" namespace { const char *const kSummary = "Summary"; @@ -773,7 +773,7 @@ Status GraphManager::RunCustomPass(const GraphNodePtr &graph_node) { GE_TIMESTAMP_START(RunCustomPass); GraphPtr graph = std::const_pointer_cast(const_graph); - GE_CHK_STATUS_RET(CustomPassHelper::Instance()->Run(graph), "Graph[%s] run custom pass fail.", + GE_CHK_STATUS_RET(CustomPassHelper::Instance().Run(graph), "Graph[%s] run custom pass fail.", comp_graph->GetName().c_str()); GE_TIMESTAMP_END(RunCustomPass, "GraphBuilder::RunCustomPass"); return SUCCESS; diff --git a/metadef b/metadef index 37a90f0d..44bcbb5e 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 37a90f0dfd797306e99ec32a688be32a9ad835a4 +Subproject commit 44bcbb5ea25ada1a5393aa4c7f554d40b6859b18