[VM] Move param bind to OptimizeModule#7451
Merged
masahi merged 3 commits intoapache:mainfrom Feb 13, 2021
Merged
Conversation
masahi
commented
Feb 12, 2021
Contributor
|
This makes a lot more sense to me, thanks Masa. |
jwfromm
approved these changes
Feb 12, 2021
icemelon
reviewed
Feb 12, 2021
Member
icemelon
left a comment
There was a problem hiding this comment.
LGTM.
Could you add a test case for this?
be0b48e to
81f61b7
Compare
Member
Author
|
@icemelon9 Added a test to verify that all params are bound in the output of |
Member
Author
|
@icemelon9 ready to merge |
icemelon
approved these changes
Feb 13, 2021
2847fbd to
db2530a
Compare
db2530a to
15385a4
Compare
Lokiiiiii
pushed a commit
to Lokiiiiii/tvm
that referenced
this pull request
Mar 2, 2021
* [VM] Move param bind to OptimizeModule * add test to verify the number of free vars after opt * remove const from OptimizeModule
trevor-m
pushed a commit
to neo-ai/tvm
that referenced
this pull request
Mar 2, 2021
* [VM] Move param bind to OptimizeModule * add test to verify the number of free vars after opt * remove const from OptimizeModule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In VM,
BindParamsByNameis run insideVMCompiler::Lower(...)beforeOptimizeModulegets called. So when we try to dump the optimized module like this:param binding doesn't happen, so the "optimized graph" has parameters as arguments. This means constant folding involving parameters cannot happen, so the optimized graph looks very different (e.g. there are many
layout_transform) from the output ofrelay.optimize, which does param binding whenrelay.optimizeis called.tvm/src/relay/backend/build_module.cc
Lines 255 to 263 in 384714b
This PR moves param binding in VM to
OptimizeModule, to be consistent with the graph codegen. NowVMCompiler.optimize(...)returns the graph with constants properly folded.please review @zhiics @jroesch @icemelon9