[TIR] not estimating the flops when there is a default estimated flops as attr#14379
Merged
Lunderberg merged 4 commits intoapache:mainfrom Mar 24, 2023
Merged
[TIR] not estimating the flops when there is a default estimated flops as attr#14379Lunderberg merged 4 commits intoapache:mainfrom
Lunderberg merged 4 commits intoapache:mainfrom
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 |
Contributor
Author
|
@tvm-bot rerun |
Lunderberg
approved these changes
Mar 23, 2023
Contributor
Lunderberg
left a comment
There was a problem hiding this comment.
Looks good to me, just one change requested.
|
|
||
|
|
||
| @T.prim_func | ||
| def flops_override(a: T.Buffer(16, "float32"), b: T.Buffer(16, "float32")): |
Contributor
There was a problem hiding this comment.
Could we reduce this to a minimal PrimFunc as well? That way, it makes it clear to the reader that the test is validating the behavior of the attribute, and that the if/else/floormod aren't required for the test.
@T.prim_func
def func(A: T.Buffer(1)):
T.func_attr("estimated_flops": 32)
for i in T.serial(0, 16):
A[0] = A[0] + 1
Contributor
Author
There was a problem hiding this comment.
Sounds good Eric. Thanks for the suggestion. Fixed in the next commit.
Hzfengsy
approved these changes
Mar 24, 2023
Contributor
|
@tvm-bot rerun |
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.
FlopEstimator is run as part of the Meta Schedule as an estimate for which primfunc to spend time on; e.g. which primfunc to send more trials on. In a case that the for loop extent is an expression, it’s getting stuck on the calculation of the FLOPS.
This PR add a function annotation to the main primfunc and then have FlopEstimator check for this annotation before visiting the function. And if the annotation exists, just use the handcoded flops instead of trying to estimate.
@Lunderberg @csullivan