From 5d9f4fd2fc02162e1de025047427fe36635779ae Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Nov 2020 11:40:01 +0800 Subject: [PATCH] Move label maker to stage2. --- ge/graph/build/label_allocator.cc | 10 +- ge/graph/build/label_allocator.h | 2 +- ge/graph/build/logical_stream_allocator.cc | 6 +- ge/graph/build/model_builder.cc | 23 +--- ge/graph/label/label_maker.cc | 151 +++++++-------------- ge/graph/label/label_maker.h | 5 +- ge/graph/manager/graph_manager.cc | 26 +++- ge/graph/passes/memcpy_addr_async_pass.cc | 23 +++- 8 files changed, 108 insertions(+), 138 deletions(-) diff --git a/ge/graph/build/label_allocator.cc b/ge/graph/build/label_allocator.cc index 0f3eff16..fad7d0c2 100644 --- a/ge/graph/build/label_allocator.cc +++ b/ge/graph/build/label_allocator.cc @@ -26,12 +26,17 @@ namespace ge { LabelAllocator::LabelAllocator(const ComputeGraphPtr &graph) : compute_graph_(graph) {} -Status LabelAllocator::AssignFunctionalLabels(uint32_t &label_index) { +Status LabelAllocator::AssignFunctionalLabels() { if (compute_graph_ == nullptr) { GELOGE(INTERNAL_ERROR, "ComputeGraph not set, Assign labels failed."); return INTERNAL_ERROR; } + if (compute_graph_->GetGraphUnknownFlag()) { + GELOGD("Graph[%s] is unknown graph, skip label allocator.", compute_graph_->GetName().c_str()); + return SUCCESS; + } + // Add label task for sub graph. GELOGI("AssignFunctionalLabels start: %s.", compute_graph_->GetName().c_str()); std::set functional_nodes; @@ -42,7 +47,7 @@ Status LabelAllocator::AssignFunctionalLabels(uint32_t &label_index) { } // Add label for functional op. - label_index = 0; + uint32_t label_index = 0; for (auto node : functional_nodes) { LabelMakerPtr maker = LabelMakerFactory::Instance().Create(node->GetType(), compute_graph_, node); if (maker == nullptr) { @@ -56,6 +61,7 @@ Status LabelAllocator::AssignFunctionalLabels(uint32_t &label_index) { } } + (void)AttrUtils::SetInt(*compute_graph_, ATTR_MODEL_LABEL_NUM, label_index); GELOGI("AssignFunctionalLabels success."); return SUCCESS; } diff --git a/ge/graph/build/label_allocator.h b/ge/graph/build/label_allocator.h index 7c7b2f00..7e2943e8 100644 --- a/ge/graph/build/label_allocator.h +++ b/ge/graph/build/label_allocator.h @@ -28,7 +28,7 @@ class LabelAllocator { explicit LabelAllocator(const ComputeGraphPtr &graph); ~LabelAllocator() = default; - Status AssignFunctionalLabels(uint32_t &label_index); + Status AssignFunctionalLabels(); private: bool CollectFunctionalNode(ComputeGraphPtr &graph, std::set &functional_nodes); diff --git a/ge/graph/build/logical_stream_allocator.cc b/ge/graph/build/logical_stream_allocator.cc index 81b2f182..5c8bc46c 100644 --- a/ge/graph/build/logical_stream_allocator.cc +++ b/ge/graph/build/logical_stream_allocator.cc @@ -348,7 +348,11 @@ Status NodeStreamUpdatePass::Run(ComputeGraphPtr graph, const vectorsubgraph_info.GetSubGraph(); for (NodePtr &node : compute_graph->GetDirectNode()) { GE_CHECK_NOTNULL(node->GetOpDesc()); - if (IsEngineSkip(*subgraph) && node->GetInNodes().empty()) { + if (node->GetOpDesc()->HasAttr(ATTR_NAME_RTS_LABEL_NODE)) { + node->GetOpDesc()->SetStreamId(context.default_stream); + GELOGD("Node %s of type %s in subgraph %s is assigned parent stream %ld (engine: %s).", node->GetName().c_str(), + node->GetType().c_str(), subgraph->name.c_str(), context.default_stream, engine_name.c_str()); + } else if (IsEngineSkip(*subgraph) && node->GetInNodes().empty()) { GELOGD("Node %s of type %s in subgraph %s doesn't need to assign a stream (engine: %s).", node->GetName().c_str(), node->GetType().c_str(), subgraph->name.c_str(), engine_name.c_str()); } else { diff --git a/ge/graph/build/model_builder.cc b/ge/graph/build/model_builder.cc index 593be7bb..56a5b4dc 100755 --- a/ge/graph/build/model_builder.cc +++ b/ge/graph/build/model_builder.cc @@ -23,7 +23,6 @@ #include "graph/anchor.h" #include "graph/attr_value.h" #include "graph/buffer.h" -#include "graph/build/label_allocator.h" #include "graph/build/stream_allocator.h" #include "graph/common/omg_util.h" #include "graph/common/ge_call_wrapper.h" @@ -42,7 +41,6 @@ #include "graph/utils/op_desc_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" -#include "graph/passes/memcpy_addr_async_pass.h" #include "init/gelib.h" #include "memory/memory_assigner.h" #include "omg/version.h" @@ -692,25 +690,8 @@ Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { GE_TIMESTAMP_END(AssignLogicalStreams, "GraphBuilder::AssignLogicalStreams"); // Assign functional op labels. - GE_TIMESTAMP_START(AssignFunctionalLabels); - LabelAllocator label_allocator(compute_graph_); - GE_CHK_STATUS_RET(label_allocator.AssignFunctionalLabels(label_num_), "Assign label failed."); - GE_TIMESTAMP_END(AssignFunctionalLabels, "ModelBuilder::AssignFunctionalLabels"); - - // Add memcpy_addr_async node. - rtFeatureType_t feature_type = FEATURE_TYPE_MEMCPY; - int32_t feature_info = MEMCPY_INFO_SUPPORT_ZEROCOPY; - int64_t value = 0; - rtError_t rt_ret = rtGetRtCapability(feature_type, feature_info, &value); - if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtGetRtCapability failed."); - return RT_FAILED; - } else { - GE_TIMESTAMP_START(AddMemcpyAddrAsyncNode); - MemcpyAddrAsyncPass memcpy_addr; - GE_CHK_STATUS_RET(memcpy_addr.Run(compute_graph_), "Add memcpy_addr_async node failed."); - GE_TIMESTAMP_END(AddMemcpyAddrAsyncNode, "MemcpyAddrAsyncPass::Run."); - } + label_num_ = 0; + (void)AttrUtils::GetInt(*compute_graph_, ATTR_MODEL_LABEL_NUM, label_num_); GE_TIMESTAMP_START(AssignMemory); MemoryAssigner mem_assigner(compute_graph_); diff --git a/ge/graph/label/label_maker.cc b/ge/graph/label/label_maker.cc index 3f643fb2..0e1e571c 100644 --- a/ge/graph/label/label_maker.cc +++ b/ge/graph/label/label_maker.cc @@ -23,75 +23,65 @@ #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" -namespace { -const int64_t kInvalidStreamId = -1; -} // namespace - namespace ge { /** * @ingroup ge - * @brief Set stream id for head node. + * @brief Link node to graph head. * @param [in] graph: graph for add node. - * @param [in] op_desc: OpDesc for set logical stream id. + * @param [in] node: Node add to graph head. * @return: void */ -void LabelMaker::SetStreamIdEnter(const ComputeGraphPtr &graph, const OpDescPtr &op_desc) { - int64_t stream_id = kInvalidStreamId; - const auto &node_list = graph->GetDirectNode(); - for (size_t i = 0; i < node_list.size(); ++i) { - const auto &node = node_list.at(i); - GE_CHECK_NOTNULL_EXEC(node, continue); +void LabelMaker::LinkToGraphHead(const ComputeGraphPtr &graph, const NodePtr &node) { + static const std::set non_calc_types = { DATA, CONSTANT, CONSTANTOP, VARIABLE }; + for (auto &n : graph->GetDirectNode()) { + if (non_calc_types.count(n->GetType()) > 0) { + continue; + } - stream_id = node->GetOpDesc()->GetStreamId(); - if (stream_id != kInvalidStreamId) { - break; + const auto nodes = n->GetInDataNodes(); + if (nodes.empty()) { + continue; } - } - GELOGI("SetStreamId: Node %s assign stream is %ld.", op_desc->GetName().c_str(), stream_id); - op_desc->SetStreamId(stream_id); -} + bool is_head_node = true; + for (auto &in_node : nodes) { + if (non_calc_types.count(in_node->GetType()) == 0) { + is_head_node = false; + break; + } + } -/** - * @ingroup ge - * @brief Set stream id for tail node. - * @param [in] graph: graph for add node. - * @param [in] op_desc: OpDesc for set logical stream id. - * @return: void - */ -void LabelMaker::SetStreamIdLeave(const ComputeGraphPtr &graph, const OpDescPtr &op_desc) { - int64_t stream_id = kInvalidStreamId; - const auto &node_list = graph->GetDirectNode(); - for (size_t i = node_list.size(); i > 0; --i) { - const auto &node = node_list.at(i - 1); // i from list size, need shift 1. - GE_CHECK_NOTNULL_EXEC(node, continue); + if (!is_head_node) { + continue; + } - stream_id = node->GetOpDesc()->GetStreamId(); - if (stream_id != kInvalidStreamId) { - break; + if (GraphUtils::AddEdge(node->GetOutControlAnchor(), n->GetInControlAnchor()) != SUCCESS) { + GELOGE(INTERNAL_ERROR, "Add ctrl edge from %s to %s failed.", node->GetName().c_str(), n->GetName().c_str()); } } - - GELOGI("SetStreamId: Node %s assign stream is %ld.", op_desc->GetName().c_str(), stream_id); - op_desc->SetStreamId(stream_id); } /** * @ingroup ge - * @brief Set stream id for parent node. + * @brief Link node to graph tail. * @param [in] graph: graph for add node. - * @param [in] op_desc: OpDesc for set logical stream id. + * @param [in] node: Node add to graph tail. * @return: void */ -void LabelMaker::SetStreamIdOwner(const ComputeGraphPtr &graph, const OpDescPtr &op_desc) { - int64_t stream_id = kInvalidStreamId; - const auto &node = graph->GetParentNode(); - if (node != nullptr) { - stream_id = node->GetOpDesc()->GetStreamId(); - } +void LabelMaker::LinkToGraphTail(const ComputeGraphPtr &graph, const NodePtr &node) { + auto tail = graph->FindFirstNodeMatchType(NETOUTPUT); + while (tail != nullptr) { + auto nodes = tail->GetOutControlNodes(); + if (!nodes.empty()) { + tail = nodes.at(0); + continue; + } - GELOGI("SetStreamId: Node %s assign stream is %ld.", op_desc->GetName().c_str(), stream_id); - op_desc->SetStreamId(stream_id); + if (GraphUtils::AddEdge(tail->GetOutControlAnchor(), node->GetInControlAnchor()) != SUCCESS) { + GELOGE(INTERNAL_ERROR, "Add ctrl edge from %s to %s failed.", tail->GetName().c_str(), node->GetName().c_str()); + } + return; + } } /** @@ -112,7 +102,7 @@ NodePtr LabelMaker::AddStreamActive(const ComputeGraphPtr &graph, const std::str OpDescPtr op_desc = MakeShared(name, STREAMACTIVE); GE_CHECK_NOTNULL_EXEC(op_desc, return nullptr); - SetStreamIdOwner(graph, op_desc); + (void)AttrUtils::SetBool(op_desc, ATTR_NAME_RTS_LABEL_NODE, true); GELOGI("StreamActive: Create node %s.", op_desc->GetName().c_str()); vector active_streams; @@ -122,6 +112,7 @@ NodePtr LabelMaker::AddStreamActive(const ComputeGraphPtr &graph, const std::str NodePtr stream_active = graph->AddNodeFront(op_desc); GE_CHECK_NOTNULL_EXEC(stream_active, return nullptr); + LinkToGraphHead(graph, stream_active); return stream_active; } @@ -146,7 +137,7 @@ NodePtr LabelMaker::AddLabelSetEnter(const ComputeGraphPtr &graph, const std::st OpDescPtr op_desc = MakeShared(name, LABELSET); GE_CHECK_NOTNULL_EXEC(op_desc, return nullptr); - SetStreamIdOwner(graph, op_desc); + (void)AttrUtils::SetBool(op_desc, ATTR_NAME_RTS_LABEL_NODE, true); GELOGI("LabelSet: Create node %s.", op_desc->GetName().c_str()); (void)AttrUtils::SetInt(op_desc, ATTR_NAME_LABEL_SWITCH_INDEX, index); @@ -173,19 +164,9 @@ NodePtr LabelMaker::AddLabelSetEnter(const ComputeGraphPtr &graph, const std::st NodePtr LabelMaker::AddLabelSetLeave(const ComputeGraphPtr &graph, const std::string &name, uint32_t index) { GE_CHECK_NOTNULL_EXEC(graph, return nullptr); - const auto &node_list = graph->GetDirectNode(); - auto it = node_list.end(); - if (it == node_list.begin()) { - GELOGE(INTERNAL_ERROR, "LabelSet: Graph %s node is empty.", graph->GetName().c_str()); - return nullptr; - } - --it; - const NodePtr &node = *it; - GE_CHECK_NOTNULL_EXEC(node, return nullptr); - OpDescPtr op_desc = MakeShared(name, LABELSET); GE_CHECK_NOTNULL_EXEC(op_desc, return nullptr); - SetStreamIdOwner(graph, op_desc); + (void)AttrUtils::SetBool(op_desc, ATTR_NAME_RTS_LABEL_NODE, true); GELOGI("LabelSet: Create node %s.", op_desc->GetName().c_str()); (void)AttrUtils::SetInt(op_desc, ATTR_NAME_LABEL_SWITCH_INDEX, index); @@ -194,11 +175,7 @@ NodePtr LabelMaker::AddLabelSetLeave(const ComputeGraphPtr &graph, const std::st GE_CHECK_NOTNULL_EXEC(label_set, return nullptr); // Link control edge to graph tail. - if (GraphUtils::AddEdge(node->GetOutControlAnchor(), label_set->GetInControlAnchor()) != SUCCESS) { - GELOGE(INTERNAL_ERROR, "LabelSet: Add ctrl edge to %s failed.", node->GetName().c_str()); - return nullptr; - } - + LinkToGraphTail(graph, label_set); return label_set; } @@ -222,7 +199,7 @@ NodePtr LabelMaker::AddLabelGotoEnter(const ComputeGraphPtr &graph, const std::s OpDescPtr op_desc = MakeShared(name, LABELGOTOEX); GE_CHECK_NOTNULL_EXEC(op_desc, return nullptr); - SetStreamIdOwner(graph, op_desc); + (void)AttrUtils::SetBool(op_desc, ATTR_NAME_RTS_LABEL_NODE, true); GELOGI("LabelGoto: Create node %s.", op_desc->GetName().c_str()); (void)AttrUtils::SetInt(op_desc, ATTR_NAME_LABEL_SWITCH_INDEX, index); @@ -246,32 +223,17 @@ NodePtr LabelMaker::AddLabelGotoEnter(const ComputeGraphPtr &graph, const std::s NodePtr LabelMaker::AddLabelGotoLeave(const ComputeGraphPtr &graph, const std::string &name, uint32_t index) { GE_CHECK_NOTNULL_EXEC(graph, return nullptr); - const auto &node_list = graph->GetDirectNode(); - auto it = node_list.end(); - if (it == node_list.begin()) { - GELOGE(INTERNAL_ERROR, "LabelGoto: Graph %s node is empty.", graph->GetName().c_str()); - return nullptr; - } - --it; - const NodePtr &node = *it; - GE_CHECK_NOTNULL_EXEC(node, return nullptr); - OpDescPtr op_desc = MakeShared(name, LABELGOTOEX); GE_CHECK_NOTNULL_EXEC(op_desc, return nullptr); - SetStreamIdLeave(graph, op_desc); + (void)AttrUtils::SetBool(op_desc, ATTR_NAME_RTS_LABEL_NODE, true); GELOGI("LabelGoto: Create node %s.", op_desc->GetName().c_str()); (void)AttrUtils::SetInt(op_desc, ATTR_NAME_LABEL_SWITCH_INDEX, index); NodePtr label_goto = graph->AddNode(op_desc); GE_CHECK_NOTNULL_EXEC(label_goto, return nullptr); - SetStreamIdOwner(graph, op_desc); // Link control edge to graph tail. - if (GraphUtils::AddEdge(node->GetOutControlAnchor(), label_goto->GetInControlAnchor()) != SUCCESS) { - GELOGE(INTERNAL_ERROR, "LabelGoto: Add ctrl edge to %s failed.", node->GetName().c_str()); - return nullptr; - } - + LinkToGraphTail(graph, label_goto); return label_goto; } @@ -297,7 +259,7 @@ NodePtr LabelMaker::AddLabelSwitchEnter(const ComputeGraphPtr &graph, const std: OpDescPtr op_desc = MakeShared(name, LABELSWITCHBYINDEX); GE_CHECK_NOTNULL_EXEC(op_desc, return nullptr); - SetStreamIdOwner(graph, op_desc); + (void)AttrUtils::SetBool(op_desc, ATTR_NAME_RTS_LABEL_NODE, true); GELOGI("LabelSwitchByIndex: Create node %s.", op_desc->GetName().c_str()); if (op_desc->AddInputDesc(desc) != GRAPH_SUCCESS) { @@ -332,19 +294,9 @@ NodePtr LabelMaker::AddLabelSwitchLeave(const ComputeGraphPtr &graph, const std: const std::vector &labels) { GE_CHECK_NOTNULL_EXEC(graph, return nullptr); - const auto &node_list = graph->GetDirectNode(); - auto it = node_list.end(); - if (it == node_list.begin()) { - GELOGE(INTERNAL_ERROR, "LabelSwitchByIndex: Graph %s node is empty.", graph->GetName().c_str()); - return nullptr; - } - --it; - const NodePtr &node = *it; - GE_CHECK_NOTNULL_EXEC(node, return nullptr); - OpDescPtr op_desc = MakeShared(name, LABELSWITCHBYINDEX); GE_CHECK_NOTNULL_EXEC(op_desc, return nullptr); - SetStreamIdOwner(graph, op_desc); + (void)AttrUtils::SetBool(op_desc, ATTR_NAME_RTS_LABEL_NODE, true); GELOGI("LabelSwitchByIndex: Create node %s.", op_desc->GetName().c_str()); if (op_desc->AddInputDesc(desc) != GRAPH_SUCCESS) { @@ -361,11 +313,7 @@ NodePtr LabelMaker::AddLabelSwitchLeave(const ComputeGraphPtr &graph, const std: GE_CHECK_NOTNULL_EXEC(label_switch, return nullptr); // Link control edge to graph tail. - if (GraphUtils::AddEdge(node->GetOutControlAnchor(), label_switch->GetInControlAnchor()) != SUCCESS) { - GELOGE(INTERNAL_ERROR, "LabelSwitchByIndex: Add ctrl edge to %s failed.", node->GetName().c_str()); - return nullptr; - } - + LinkToGraphTail(graph, label_switch); return label_switch; } @@ -385,7 +333,6 @@ NodePtr LabelMaker::AddLabelSwitchIndex(const ComputeGraphPtr &graph, const std: OpDescPtr op_desc = MakeShared(name, DATA); GE_CHECK_NOTNULL_EXEC(op_desc, return nullptr); - op_desc->SetStreamId(kInvalidStreamId); GELOGI("Data: Create node %s.", op_desc->GetName().c_str()); if (op_desc->AddInputDesc(desc) != GRAPH_SUCCESS) { diff --git a/ge/graph/label/label_maker.h b/ge/graph/label/label_maker.h index 847c7904..424aae5f 100644 --- a/ge/graph/label/label_maker.h +++ b/ge/graph/label/label_maker.h @@ -60,9 +60,8 @@ class LabelMaker { ComputeGraphPtr parent_graph_; private: - void SetStreamIdEnter(const ComputeGraphPtr &graph, const OpDescPtr &op_desc); - void SetStreamIdLeave(const ComputeGraphPtr &graph, const OpDescPtr &op_desc); - void SetStreamIdOwner(const ComputeGraphPtr &graph, const OpDescPtr &op_desc); + void LinkToGraphHead(const ComputeGraphPtr &graph, const NodePtr &node); + void LinkToGraphTail(const ComputeGraphPtr &graph, const NodePtr &node); }; } // namespace ge #endif // GE_GRAPH_PASSES_LABEL_MAKER_H_ diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 4737955d..e9491bf3 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -100,6 +100,8 @@ #include "graph/passes/subgraph_const_migration_pass.h" #include "graph/passes/unused_args_clean_pass.h" #include "graph/passes/global_step_insert_pass.h" +#include "graph/passes/memcpy_addr_async_pass.h" +#include "graph/build/label_allocator.h" #include "graph/utils/tensor_adapter.h" #include "graph/utils/type_utils.h" #include "graph/graph_util.h" @@ -634,6 +636,13 @@ Status GraphManager::PreRunAfterOptimizeSubGraph(const GraphNodePtr &graph_node, GM_RUN_AND_DUMP_PERF("OptimizeGraphBeforeBuildForRts", GetCompilerStages(graph_node->GetGraphId()).optimizer.OptimizeGraphBeforeBuildForRts, compute_graph); + + Status ret = compute_graph->TopologicalSorting(); + if (ret != SUCCESS) { + GELOGE(ret, "Graph topological sort failed, ret:%d.", ret); + return ret; + } + GM_RUN_AND_DUMP_PERF("Build", Build, graph_node, compute_graph, ge_root_model, session_id); GELOGI("PreRun:PreRunAfterOptimizeSubGraph success."); return SUCCESS; @@ -2186,6 +2195,18 @@ Status GraphManager::OptimizeStage2(ge::ComputeGraphPtr &compute_graph) { return ret; } + // Assign functional op labels. + GE_TIMESTAMP_START(AssignFunctionalLabels); + LabelAllocator label_allocator(compute_graph); + GE_CHK_STATUS_RET(label_allocator.AssignFunctionalLabels(), "Assign label failed."); + GE_TIMESTAMP_END(AssignFunctionalLabels, "ModelBuilder::AssignFunctionalLabels"); + + // Add memcpy addr asynchronous node. + GE_TIMESTAMP_START(AddMemcpyAddrAsyncNode); + MemcpyAddrAsyncPass memcpy_addr; + GE_CHK_STATUS_RET(memcpy_addr.Run(compute_graph), "Add memcpy_addr_async node failed."); + GE_TIMESTAMP_END(AddMemcpyAddrAsyncNode, "MemcpyAddrAsyncPass::Run."); + // After while sub graph handle, mark all node rw type auto result = GetCompilerStages(compute_graph->GetGraphID()).optimizer.HandleMemoryRWConflict(compute_graph); if (result != SUCCESS) { @@ -2196,11 +2217,6 @@ Status GraphManager::OptimizeStage2(ge::ComputeGraphPtr &compute_graph) { ChangeConstTypeWhenTraining(compute_graph); - ret = compute_graph->TopologicalSorting(); - if (ret != SUCCESS) { - GELOGE(ret, "Graph topological sort failed, ret:%d.", ret); - return ret; - } GELOGI("End optimize after merge sub graph."); return SUCCESS; } diff --git a/ge/graph/passes/memcpy_addr_async_pass.cc b/ge/graph/passes/memcpy_addr_async_pass.cc index 3ede39a7..a9e3f4c4 100755 --- a/ge/graph/passes/memcpy_addr_async_pass.cc +++ b/ge/graph/passes/memcpy_addr_async_pass.cc @@ -25,6 +25,14 @@ namespace ge { Status MemcpyAddrAsyncPass::Run(ComputeGraphPtr graph) { GE_CHECK_NOTNULL(graph); + + int64_t value = 0; + rtError_t rt_ret = rtGetRtCapability(FEATURE_TYPE_MEMCPY, MEMCPY_INFO_SUPPORT_ZEROCOPY, &value); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "rtGetRtCapability failed, error=0x%x.", rt_ret); + return RT_FAILED; + } + for (auto &node : graph->GetAllNodes()) { auto op_desc = node->GetOpDesc(); GE_IF_BOOL_EXEC(op_desc == nullptr, continue); @@ -210,9 +218,18 @@ NodePtr MemcpyAddrAsyncPass::CreateMemcpyAddrAsyncNode(const ComputeGraphPtr &gr return nullptr; } - int64_t stream_id = out_of_user_data->GetOpDesc()->GetStreamId(); - op_desc->SetStreamId(stream_id); - GELOGI("SetStreamId: Node %s assign stream is %ld.", op_desc->GetName().c_str(), stream_id); + string stream_label; + if (AttrUtils::GetStr(out_of_user_data->GetOpDesc(), ATTR_NAME_STREAM_LABEL, stream_label)) { + (void)AttrUtils::SetStr(op_desc, ATTR_NAME_STREAM_LABEL, stream_label); + GELOGD("Node %s set stream label: %s", op_desc->GetName().c_str(), stream_label.c_str()); + } + + bool rts_label_node = false; + if (AttrUtils::GetBool(out_of_user_data->GetOpDesc(), ATTR_NAME_RTS_LABEL_NODE, rts_label_node)) { + (void)AttrUtils::SetBool(op_desc, ATTR_NAME_RTS_LABEL_NODE, rts_label_node); + GELOGD("Node %s set rts label node attribute", op_desc->GetName().c_str()); + } + bool labeled_input = false; (void)ge::AttrUtils::GetBool(out_of_user_data->GetOpDesc(), ATTR_NAME_NODE_CONNECT_INPUT, labeled_input); if (labeled_input) {