| 24 | |
| 25 | namespace { |
| 26 | void MarkComputeGraph(const Graph* g, std::vector<bool>& is_var_relate) { |
| 27 | // Get the starting node of the coloring algorithm |
| 28 | std::queue<const Node*> q; |
| 29 | for (Node* n : g->op_nodes()) { |
| 30 | if (n->IsVariable() || n->IsKvVarHandle() |
| 31 | || n->IsControlFlow() |
| 32 | || n->type_string() == "VarHandleOp") { |
| 33 | q.emplace(n); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // mark compute graph node |
| 38 | while (!q.empty()) { |
| 39 | const Node* node = q.front(); |
| 40 | q.pop(); |
| 41 | is_var_relate[node->id()] = true; |
| 42 | for (auto e : node->out_edges()) { |
| 43 | if (!is_var_relate[e->dst()->id()]) { |
| 44 | q.emplace(e->dst()); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void DealWithNode(Graph* g, Node* n, |
| 51 | const std::vector<bool>& is_var_relate, |
no test coverage detected