-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[REFACTOR][BOYC] Non recursive partitioning #5493
Conversation
@mbrookhart please take a look for the mixed mutator pattern. BTW, we will still need to refactor the infertype pass as it is the most frequently used pass. @comaniac @masahi @mbaret @manupa-arm @trevor-m please take a look. |
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 were trying rewriter but it is not applicable to this pass due to https://github.com/apache/incubator-tvm/pull/5493/files#diff-8d2cdf6314f73e4b32892679ad4dc44aR280, which traverses other nodes out of order. As a result, the current solution seems the most suitable.
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.
Use of the iterative traversals looks great. Since you originally authored the class, I'll believe you about the necessary mutators.
Why so much auto-formatting noise? As a larger conversation, we might want to build a style checker into CI that enforces a particular auto-format implementaiton...
Ah I think that's because I manually ran clang-format for the file. We should definitely build style checker in CI. |
bool found_start_{false}; | ||
bool found_end_{false}; | ||
/*! \brief Map from each region output expr node to its output index and TupleGetItem node. */ | ||
std::unordered_map<Expr, std::pair<int, TupleGetItem>, ObjectHash, ObjectEqual> out_expr_indices; |
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.
Since both arguments of TupleGetItem
(func_call
and the index) are in this struct, this TupleGetItem
seems redundant to me. Also see my comment at L282.
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 this TupleGetItem
is intended to be cached, please come up with a better name than out_expr_indices
, since it is not just indices.
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.
Rename to region_func_out
and only cache the function output expressions (Call or TupleGetItem).
3a6f409
to
00be9a9
Compare
00be9a9
to
26404c1
Compare
@masahi thanks for valuable suggestions. We've refactored |
Thanks @zhiics @comaniac @mbrookhart @manupa-arm |
* non recursive partitioning * refactor maps * rebase upstream * refactor shared output * address comments Co-authored-by: Cody Yu <[email protected]>
* non recursive partitioning * refactor maps * rebase upstream * refactor shared output * address comments Co-authored-by: Cody Yu <[email protected]>
* non recursive partitioning * refactor maps * rebase upstream * refactor shared output * address comments Co-authored-by: Cody Yu <[email protected]>
* non recursive partitioning * refactor maps * rebase upstream * refactor shared output * address comments Co-authored-by: Cody Yu <[email protected]>
This PR refactors the partitioning pass by using non-recursive mutator. It also removes the unnecessary mutators as we only need to look at begin/end annotations which are definitely wrapped in call nodes. In addition, a metadata struct is used to maintain the intermediate data needed for partitioning.