-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Relay][Pass] Add inline pass #4927
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
a01ef84 to
1418249
Compare
|
@zhiics can you rebase? |
|
@masahi Done. Thanks. |
|
@zhiics not sure if this is one of an intended use cases, but I think adding a test case for inlining a composite function would be a useful addition. (This is not a request but soft suggestion, feel free to ignore). |
|
@masahi We have annotated functions with external compilers, no difference with composite if we need to add it. I don’t think we need to add it in this pr |
|
Does this pass have any relation with |
|
@masahi inlineprimitives works on each function scope to inline the function lifted by anf. This pass handles functions at the global scope. |
masahi
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.
This is a cool use of the new call graph infra, LGTM.
* add inline pass * IsInline -> IsMarkedInlined * fix comment
* add inline pass * IsInline -> IsMarkedInlined * fix comment
This PR adds inlining pass to Relay. It can help external codegen where we may want to outline the sub-functions (subgraphs) to the module level to prevent the from being optimized by relay passes. These functions can then be inlined and offloaded to external codegen tools as discussed in #4864
This transformation is also important to the Relay VM as inlining may reduce the calling overhead. We currently only greedily inline the functions that are marked
inlinewhenever it is abled to be inlined. There is no profitability analysis available for now.This PR is dependent on the call graph PR #4922