-
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
[Relay][TIR] Add utility to lower Relay func to TIR prim func #13606
Conversation
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.
Generated by tvm-bot |
603f914
to
351cc08
Compare
351cc08
to
2d2f703
Compare
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.
Awesome, I love it. One small suggestion if you agree.
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.
Awesome and very useful improvement! Thanks.
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 great!
👋 Hello @masahi / @csullivan / @echuraev / @junrushao, Whilst I appreciate this is useful with the use-case demonstrated, I believe it might've needed a bit more time for others to formulate a review as it was up for less than 24 hours before merge? One of my concerns is that this seems to be creating new public interfaces to the internals of the TECompiler which in the past we've attempted to remove:
This change means we have to maintain an interface which generates a single
Implies we wanted it in |
@Mousius The new function simply composes the existing interface to the TECompiler, What I wanted to add is a simple interface that converts one Relay primitive function to the corresponding TIR prim func. Then I realized that
This is just a convention of MetaSchedule, storing an IRModule with one prim func as a task. I didn't change any behavior about task extraction in this PR. What we want is a |
I find this equally concerning, given this is also exposing more of the internals of the TE Compiler rather than having clear boundaries within the codebase.
Exposing it python and as part of the public API means others can access it, which means that we have to support it as a way of using the compiler rather than as an aspect of meta-scheduler. This is similar to the previous methods that we were unable to deprecate in #13606.
I don't think |
…#13606) * introduce LowerToPrimFunc to lower Relay func to TIR prim func * add doc * expose to python * adding test * another minor doc update * Verify that the input is a primitive function
…#13606) * introduce LowerToPrimFunc to lower Relay func to TIR prim func * add doc * expose to python * adding test * another minor doc update * Verify that the input is a primitive function
This is very useful for creating a TensorIR program that is otherwise hard to so via manual TVMScript or te compute +
create_prim_func
.A good example is a TensorIR program having
AllocateConst
, since it is not possible to create such modules with embedded constants via TVMScript parsing.AllocateConst
has been the source of many issues and I've sent many fixes for them, but it has always been difficult to create test cases for such issues. But if we start from Relay, we can easily create such modules by lowering Relay func to TIR withlink-params = True
.This also makes it possible to, say, author a complicated module in PyTorch and directly lower it to TensorIR.
As an example of its use, I added a regression test for the issue described in #13605.
@Hzfengsy @junrushao @csullivan