| 1049 | } |
| 1050 | |
| 1051 | Maybe<void> GlobalTaskGraph::Init() { |
| 1052 | OpGraph* op_graph = Singleton<OpGraph>::Get(); |
| 1053 | sub_tsk_gph_builder_ctx_.reset(new SubTskGphBuilderCtx(this)); |
| 1054 | boxing_logger_ = CreateBoxingLogger(); |
| 1055 | hierarchical_sub_tsk_gph_builder_.reset(new DispatchHierarchicalSubTskGphBuilder()); |
| 1056 | HashMap<const OpNode*, std::vector<CompTaskNode*>> op_node2sorted_comp_tasks; |
| 1057 | |
| 1058 | op_graph->ForEachNode([&](const OpNode* op_node) { |
| 1059 | std::vector<CompTaskNode*>* sorted_comp_tasks = &(op_node2sorted_comp_tasks[op_node]); |
| 1060 | GenSortedCompTaskNodes(op_node, sorted_comp_tasks); |
| 1061 | for (CompTaskNode* comp_task : *sorted_comp_tasks) { AddAllocatedNode(comp_task); } |
| 1062 | }); |
| 1063 | |
| 1064 | op_graph->ForEachEdge([&](const OpEdge* op_edge) { |
| 1065 | BldSubTskGphMthd method = GetMthdForBldSubTskGph(op_edge); |
| 1066 | (this->*method)(op_edge, op_node2sorted_comp_tasks.at(op_edge->src_node()), |
| 1067 | op_node2sorted_comp_tasks.at(op_edge->dst_node())); |
| 1068 | }); |
| 1069 | |
| 1070 | ForEachOpGraphNecessaryCtrlEdge(op_graph, [&](const OpNode* src, const OpNode* dst) { |
| 1071 | const auto& src_task_nodes = op_node2sorted_comp_tasks.at(src); |
| 1072 | const auto& dst_task_nodes = op_node2sorted_comp_tasks.at(dst); |
| 1073 | if (src->op().op_conf().has_src_subset_tick_conf()) { |
| 1074 | UNIMPLEMENTED(); |
| 1075 | } else if (dst->op().op_conf().has_dst_subset_tick_conf()) { |
| 1076 | UNIMPLEMENTED(); |
| 1077 | } else { |
| 1078 | ConnectCtrlEdges(src_task_nodes, dst_task_nodes); |
| 1079 | } |
| 1080 | }); |
| 1081 | |
| 1082 | if (Singleton<ResourceDesc, ForSession>::Get()->enable_debug_mode()) { ToDotWithAutoFilePath(); } |
| 1083 | return Maybe<void>::Ok(); |
| 1084 | } |
| 1085 | |
| 1086 | Maybe<void> BoxingTaskGraph::Init( |
| 1087 | const std::function<void(size_t, const std::function<void(size_t i)>&)>& ParallelRunLoop) { |
no test coverage detected