You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/02/25 18:16:28 UTC
[GitHub] [incubator-tvm] soiferj opened a new pull request #4939:
[Relay][Pass] Make MergeComposite generated function params ordered
alphabetically
soiferj opened a new pull request #4939: [Relay][Pass] Make MergeComposite generated function params ordered alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939
This change makes the order of the params to `MergeComposite`'s generated function alphabetical. This is to make for consistent param ordering across multiple patterns which have the same logic, but param ordering may come out different.
cc @comaniac @zhiics @mbaret
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] comaniac commented on issue #4939: [Relay][Pass]
Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
comaniac commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591017348
In my opinion, we should try to simplify the task of Relay passes. If we let the merge composite pass deal with all such issues without changing any Relay frontend, this pass would be hard to maintain and unreliable. If complexity is a concern, I would suggest adding an optional flag such as `sorted=False` to `FreeVars`.
cc @zhiics
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] soiferj edited a comment on issue #4939:
[Relay][Pass] Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
soiferj edited a comment on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591064120
I definitely agree that we'll want that eventually. However, improved pattern matching won't change the relatively random order in which we get composite function arguments, right?
I totally agree with you that I don't want to muddy this code up - this is really just a quality of life improvement. I can close this PR and work around it if we all agree it's not worthwhile.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] zhiics commented on issue #4939: [Relay][Pass] Sort
MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
zhiics commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591169900
@comaniac This sounds like a good proposal and it will not block @soiferj
@soiferj thoughts?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] soiferj commented on issue #4939: [Relay][Pass]
Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
soiferj commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591008923
Sorry, I don't quite understand - where do you think the change should be made? The main issue here is the `FreeVars()` returns free vars in an arbitrary order.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] soiferj edited a comment on issue #4939:
[Relay][Pass] Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
soiferj edited a comment on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591014458
Got it, I see what you're saying. I'm still not convinced that we want to generalize sorting free vars though. It seems like extra complexity that only `MergeComposite` will care about. Do you think it would be useful anywhere else?
cc @tqchen who may have you some thoughts here
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] zhiics commented on issue #4939: [Relay][Pass] Sort
MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
zhiics commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591052375
Yeah, my point is that we probably want to think a bit to make patter matcher a little stronger or have a better mechanism to generate patterns, other than bringing more and more boilerplate code to this pass. How do you think?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] soiferj commented on issue #4939: [Relay][Pass]
Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
soiferj commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591014458
Got it, I see what you're saying. I'm still not convinced that we want to generalize sorting free vars though. It seems like extra complexity that only `MergeComposite` will care about. Do you think it would be useful anywhere else?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] soiferj commented on issue #4939: [Relay][Pass]
Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
soiferj commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591170273
@comaniac @zhiics that's a great idea. I'll keep these fixes locally for now. Thanks a lot for helping!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] zhiics commented on issue #4939: [Relay][Pass] Sort
MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
zhiics commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591032603
IMHO, this might seem like a workaround, but I think it doesn't really solve the ordering problem of pattern matching because we can still have different orders for the args if they are not vars. For example, `add(add(a, b), sub(c,d))` is equivalent to `add(sub(c,d), add(a, b))`, but we cannot match it without providing the exactly needed pattern. The mismatch in var is just one of the simplified version for us.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] zhiics commented on issue #4939: [Relay][Pass] Sort
MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
zhiics commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591146998
@comaniac @tqchen @mbaret What do you think?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] soiferj commented on issue #4939: [Relay][Pass]
Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
soiferj commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591064120
I definitely agree that we'll want that eventually. However, improved pattern matching won't change the relatively random order in which we get composite function arguments, right?
I totally agree with you that I don't want to muddy this code up - this is really just a quality of life improvement.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] soiferj edited a comment on issue #4939:
[Relay][Pass] Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
soiferj edited a comment on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591008923
Sorry, I don't quite understand - where do you think the change should be made? The main issue here is the `FreeVars()` returns free vars in an arbitrary order.
I think I see what you're saying - I am a little worried about changing `relay.Function`, since it could potentially impact lots of tests. What do you think?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] zhiics edited a comment on issue #4939:
[Relay][Pass] Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
zhiics edited a comment on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591032603
IMHO, this might seem like a workaround, but I think it doesn't really solve the ordering problem of pattern matching because we can still have different orders for the args if they are not vars. For example, `add(add(a, b), sub(c,d))` is equivalent to `add(sub(c,d), add(a, b))`, but we cannot match it without providing the exactly needed pattern. The mismatch in var is just one of the simplified cases for us.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] soiferj closed pull request #4939: [Relay][Pass]
Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
soiferj closed pull request #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] comaniac commented on issue #4939: [Relay][Pass]
Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
comaniac commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591159545
IMHO, since both @soiferj and @zhiics made great points from different perspective, I have another proposal. It's possible that @soiferj may encounter other issues while working on transformer models, so how about you try to fix them locally first like this PR (or an even better way is implementing all of them in a preprocessing pass/module), document down all the features you have implemented to support transformers and file an RFC. In that case, we all have a clear picture about what we need to have, and can focus on the implementation related discussion.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] comaniac edited a comment on issue #4939:
[Relay][Pass] Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
comaniac edited a comment on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591013575
The example I just made may not be the best. If your issue is only caused by `FreeVars()`, then maybe adding a line to sort free vars before return is the simplest solution: https://github.com/apache/incubator-tvm/blob/master/src/relay/pass/util.cc#L84
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] comaniac commented on issue #4939: [Relay][Pass]
Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
comaniac commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591013575
The example I just made may not be the best. If your issue is only caused by `FreeVars()`, then maybe add a line to sort free vars before return is the simplest solution: https://github.com/apache/incubator-tvm/blob/master/src/relay/pass/util.cc#L84
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] soiferj commented on issue #4939: [Relay][Pass]
Sort MergeComposite generated function params alphabetically
Posted by GitBox <gi...@apache.org>.
soiferj commented on issue #4939: [Relay][Pass] Sort MergeComposite generated function params alphabetically
URL: https://github.com/apache/incubator-tvm/pull/4939#issuecomment-591040506
Thanks, @zhiics. This fix is not intended to solve the ordering of pattern matching, but rather to solve the ordering of function generation in external codegen. When free vars are ordered differently, different functions will be generated, even when they should be exactly the same.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services