-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[JIT] API for finding a common ancestor block for a pair of nodes #28864
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
Conversation
[ghstack-poisoned]
…f nodes" Differential Revision: [D18219786](https://our.internmc.facebook.com/intern/diff/D18219786) [ghstack-poisoned]
suo
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.
Can we add some tests for this functionality? The IR Parser should make it not terrible
| } | ||
|
|
||
| private: | ||
| Block* findCommonAncestorBlockWith(Node* n); |
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.
There are also a number of places where we do stuff like this, it could be nice to clean them up by using this API. Topological moves come to mind
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.
And…DCE? maybe? I don't remember
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.
This function could be refactored to using this API:
Line 1176 in 4bfe2f0
| if (this->owningBlock() == n->owningBlock()) { |
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.
Hmm, I tried using this API for that isBeforeOrAfter but isBeforeOrAfter requires having pointers to the ancestors Nodes that reside in the common ancestor block
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.
Sorry i meant to say isBeforeOrAfter could be refactored using this function. but actually i take it back
…f nodes" Differential Revision: [D18219786](https://our.internmc.facebook.com/intern/diff/D18219786) [ghstack-poisoned]
…f nodes" Differential Revision: [D18219786](https://our.internmc.facebook.com/intern/diff/D18219786) [ghstack-poisoned]
…f nodes" Differential Revision: [D18219786](https://our.internmc.facebook.com/intern/diff/D18219786) [ghstack-poisoned]
eellison
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.
Looks good, a few comments / nits
| ASSERT_EQ(name_to_value.size(), 4); | ||
|
|
||
| /* clang-format off */ | ||
| int ref_blocks_from_graph[4][4] = { |
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.
Encoding expected results like this works, another alternative is to include your previous algorithm in this test file and check against that.
| } | ||
|
|
||
| private: | ||
| Block* findCommonAncestorBlockWith(Node* n); |
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.
This function could be refactored to using this API:
Line 1176 in 4bfe2f0
| if (this->owningBlock() == n->owningBlock()) { |
…f nodes" Differential Revision: [D18219786](https://our.internmc.facebook.com/intern/diff/D18219786) [ghstack-poisoned]
|
@jamesr66a merged this pull request in 0f4b226. |
Stack from ghstack:
Differential Revision: D18219786