-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DRAFT][compiler] Introduce EliminateDeadSubgraphPass #13628
base: master
Are you sure you want to change the base?
[DRAFT][compiler] Introduce EliminateDeadSubgraphPass #13628
Conversation
This pr introduces EliminateDeadSubgraphPass for removing dead subgraph. ONE-DCO-1.0-Signed-off-by: Artem Balyshev <[email protected]>
6d834f3
to
765fad1
Compare
@@ -515,7 +515,7 @@ int entry(int argc, char **argv) | |||
luci::change_outputs(graph, new_outputs); | |||
} | |||
|
|||
// call luci optimizations for module | |||
// call luci optimizations for module before optimizations for graph |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this comment changed to "before..." ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to emphasize that after graph optimization there will be another optimization of the entire module. If it only makes it more confusing, I can remove this comment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment can give misunderstanding that one "MUST..."
if not "MUST", please restore as before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
auto *while_node = dynamic_cast<luci::CircleWhile *>(circle_node); | ||
assert(while_node != nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use loco::must_cast
for this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
auto *if_node = dynamic_cast<luci::CircleIf *>(circle_node); | ||
assert(if_node != nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q) why use size_t(body_graph_index)
? this will always be 4
plz use static_cast<size_t>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Q) why separate EliminateDeadSubgraphPass to another draft? |
In order to separate these two new optimizations. The current draft is completely independent of the previous one) |
But the FuseGeluPass will only work correctly with this pass, or there will be needless subgraphs. |
No, we need to get rid of dead graphs, as this greatly inflates the binary size of the model. |
This pr introduces EliminateDeadSubgraphPass for removing dead subgraph.
for issues: #12263 and for #13365
from draft: #13602
ONE-DCO-1.0-Signed-off-by: Artem Balyshev [email protected]