-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Constant propagation changes #16244
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
Constant propagation changes #16244
Conversation
| // remove extra outputs from the node | ||
| void removeExtraLoopOutputs(Node* node) { | ||
| auto loop_body = node->blocks().at(0); | ||
| auto loop_input_offset = 2; // offset of loop carried deps in input list |
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.
pool this and the other one into a static const
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.
I can change it - fwiw I was following the style of similar code that exists in dead_code_elimination & uses auto
| } | ||
| } | ||
|
|
||
| std::vector<Node*> findAllNodes(Block* block, Symbol kind) { |
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.
I don't think these are really necessary to add if it's just for the test, this functionality can be done per-case via the Python bindings for Graph and Node
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.
What do you mean per-case via the bindings for Graph and Node?
These will also be used in other tests, and have been a common pattern I've needed & couldn't easily express so I used expect files.
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.
If I don't add it as a method to Graph / Node then you can't chain method calls, so something like the following becomes difficult to write:
self.assertTrue(graph.findNode("prim::Loop").outputsSize() == 2)
facebook-github-bot
left a 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.
@eellison is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a 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.
@eellison is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
remove loop node that is guaranteed not to execute
remove extra loop outputs that are no longer needed
if we are inlining an if node, only run constant propagation on the block that will execute
remove the recurse argument since we only expose the Graph Constant Propagation and it's not used
This also includes a few extra hooks to python_ir that I think make it a little be easier to test graph conditions from python.