Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Balyshev committed Aug 12, 2024
1 parent 765fad1 commit 3856bf4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion compiler/circle2circle/src/Circle2Circle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ int entry(int argc, char **argv)
luci::change_outputs(graph, new_outputs);
}

// call luci optimizations for module before optimizations for graph
// call luci optimizations for module
optimizer.optimize(module.get());

for (size_t idx = 0; idx < module->size(); ++idx)
Expand Down
17 changes: 7 additions & 10 deletions compiler/luci/pass/src/EliminateDeadSubgraphPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,37 +49,34 @@ void checkGraph(loco::Graph *current_graph, std::deque<size_t> &reachable_graphs
// TODO: check all nodes which can be used to reach different subgraph
for (auto &node : active_nodes)
{
auto *circle_node = dynamic_cast<luci::CircleNode *>(node);
assert(circle_node != nullptr);
auto *circle_node = loco::must_cast<luci::CircleNode *>(node);

switch (circle_node->opcode())
{
case CircleOpcode::WHILE:
{
auto *while_node = dynamic_cast<luci::CircleWhile *>(circle_node);
assert(while_node != nullptr);
auto *while_node = loco::must_cast<luci::CircleWhile *>(circle_node);
// Get body and cond graph indexes
int32_t body_graph_index = while_node->body_branch();
int32_t cond_graph_index = while_node->cond_branch();
assert(body_graph_index >= 0);
assert(cond_graph_index >= 0);
// Add indexes into queue
reachable_graphs_indexes_q.push_back(size_t(body_graph_index));
reachable_graphs_indexes_q.push_back(size_t(cond_graph_index));
reachable_graphs_indexes_q.push_back(static_cast<size_t>(body_graph_index));
reachable_graphs_indexes_q.push_back(static_cast<size_t>(cond_graph_index));
}
break;
case CircleOpcode::IF:
{
auto *if_node = dynamic_cast<luci::CircleIf *>(circle_node);
assert(if_node != nullptr);
auto *if_node = loco::must_cast<luci::CircleIf *>(circle_node);
// Get then and else graph indexes
int32_t else_index = if_node->else_branch();
int32_t then_index = if_node->then_branch();
assert(else_index >= 0);
assert(then_index >= 0);
// Add indexes into queue
reachable_graphs_indexes_q.push_back(size_t(else_index));
reachable_graphs_indexes_q.push_back(size_t(then_index));
reachable_graphs_indexes_q.push_back(static_cast<size_t>(else_index));
reachable_graphs_indexes_q.push_back(static_cast<size_t>(then_index));
}
break;
default:
Expand Down

0 comments on commit 3856bf4

Please sign in to comment.