[MetaSchedule] Allow skipping exact NDArray rewrite in RemoveWeightLayoutRewriteBlock#13052
Merged
vinx13 merged 3 commits intoapache:mainfrom Oct 12, 2022
Merged
Conversation
Collaborator
|
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 |
vinx13
approved these changes
Oct 12, 2022
xinetzone
pushed a commit
to daobook/tvm
that referenced
this pull request
Nov 25, 2022
…youtRewriteBlock (apache#13052) * Allow skipping exact NDArray rewrite in RemoveWeightLayoutRewriteBlock * add doc * add test
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.
I found that, using MS evo search +
RewriteLayout+link-params=True, where the latter combination is supported by #12991 and #12949, is currently broken for the following reasons:IndexMap::MapNDArrayis slowIndexMap::MapNDArrayis called more than thousands of times during evo search per iteration, by the following call sequence:AssembleCandidatestvm/src/meta_schedule/search_strategy/evolutionary_search.cc
Lines 206 to 209 in 6780c9f
->
ArgInfo::FromEntryFuntvm/src/meta_schedule/arg_info.cc
Lines 104 to 107 in 111169c
->
RemoveWeightLayoutRewriteBlocktvm/src/tir/transforms/remove_weight_layout_rewrite_block.cc
Lines 163 to 167 in 189338c
->
MapNDArraySo what happens right now is that evo search +
link-params=Truewould make tuning appear hanged, while it is busy doing thousands ofMapNDArrayinAssembleCandidates.My proposed workaround for this problem is based on the observation that, when
RemoveWeightLayoutRewriteBlockis called byFromEntryFunduring evo search, the actual content of NDArray before and after rewrite does not matter. So we don't have to useMapNDArrayduring tuning.To enable skipping such "exact" NDArray rewrite, I'm introducing a flag to
RemoveWeightLayoutRewriteBlock. The exact rewrite byMapNDArrayis only required when the pass is called from TECompiler during the final compilation.