| 686 | } |
| 687 | |
| 688 | void TaskGraph::BuildCtrlRegstDescInSameChain() { |
| 689 | auto GenPhysicalChainId = [](TaskNode* node) { |
| 690 | // NOTE(chengcheng): different rank cannot use same chain id for bad ctrl link. |
| 691 | return (node->chain_id() << 31) | (node->machine_id()); |
| 692 | }; |
| 693 | HashMap<int64_t, TaskNode*> physical_chain_id2node; |
| 694 | // Note that ordered_task_nodes_'s topology order in seperation plan compile is not gerenteed, |
| 695 | // So add ctrl edge with ordered_task_nodes_ in seperation plan compile may case dead lock. |
| 696 | for (auto* node : ordered_task_nodes_) { |
| 697 | if (IsConnectToTickOp(node)) { continue; } |
| 698 | // NOTE(chengcheng): skip invalid chain id |
| 699 | if (!IsValidChainId(node->chain_id())) { continue; } |
| 700 | int64_t physical_chain_id = GenPhysicalChainId(node); |
| 701 | auto iter = physical_chain_id2node.find(physical_chain_id); |
| 702 | if (iter == physical_chain_id2node.end()) { |
| 703 | CHECK(physical_chain_id2node.emplace(physical_chain_id, node).second); |
| 704 | } else { |
| 705 | TaskNode* src_node = iter->second; |
| 706 | TaskNode* dst_node = node; |
| 707 | std::string ctrl_regst_name; |
| 708 | bool build_ctrl_edge = src_node->BuildCtrlRegstDescIfNeed(dst_node, &ctrl_regst_name); |
| 709 | if (build_ctrl_edge) { |
| 710 | CHECK(!ctrl_regst_name.empty()); |
| 711 | TaskEdge* edge = NewEdge(); |
| 712 | Connect<TaskNode>(src_node, edge, dst_node); |
| 713 | src_node->BindEdgeWithProducedRegst(edge, ctrl_regst_name); |
| 714 | } |
| 715 | iter->second = dst_node; |
| 716 | } |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | void TaskGraph::GetInplaceOpBlobArgList( |
| 721 | InplaceObasInfo* obas_info, const HashSet<TaskNode*>& dev_nodes, |
nothing calls this directly
no test coverage detected