You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "farshidsp (via GitHub)" <gi...@apache.org> on 2023/03/23 16:23:25 UTC

[GitHub] [tvm] farshidsp opened a new pull request, #14379: [TIR] not estimating the flops when there is a default estimated flops as attr

farshidsp opened a new pull request, #14379:
URL: https://github.com/apache/tvm/pull/14379

   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. An if the annotation exists, just use the handcoded flops instead of trying to estimate.
   
   @Lunderberg  @csullivan 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] Lunderberg commented on a diff in pull request #14379: [TIR] not estimating the flops when there is a default estimated flops as attr

Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on code in PR #14379:
URL: https://github.com/apache/tvm/pull/14379#discussion_r1146704620


##########
tests/python/unittest/test_tir_analysis_estimate_tir_flops.py:
##########
@@ -77,5 +77,39 @@ def test_flops_with_if():
     assert flops == 16
 
 
+@T.prim_func
+def flops_with_forloop_as_expression(A: T.Buffer(1)):
+    for i in T.serial(0, 16):
+        for k in T.serial(0, i):
+            A[0] = A[0] + 1
+
+
+@T.prim_func
+def flops_override(a: T.Buffer(16, "float32"), b: T.Buffer(16, "float32")):

Review 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.
   
   ```python
   @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
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tvm-bot commented on pull request #14379: [TIR] not estimating the flops when there is a default estimated flops as attr

Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #14379:
URL: https://github.com/apache/tvm/pull/14379#issuecomment-1481497970

   <!---bot-comment-->
   
   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](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] Lunderberg commented on pull request #14379: [TIR] not estimating the flops when there is a default estimated flops as attr

Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on PR #14379:
URL: https://github.com/apache/tvm/pull/14379#issuecomment-1482766241

   @tvm-bot rerun


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] farshidsp commented on a diff in pull request #14379: [TIR] not estimating the flops when there is a default estimated flops as attr

Posted by "farshidsp (via GitHub)" <gi...@apache.org>.
farshidsp commented on code in PR #14379:
URL: https://github.com/apache/tvm/pull/14379#discussion_r1146847384


##########
tests/python/unittest/test_tir_analysis_estimate_tir_flops.py:
##########
@@ -77,5 +77,39 @@ def test_flops_with_if():
     assert flops == 16
 
 
+@T.prim_func
+def flops_with_forloop_as_expression(A: T.Buffer(1)):
+    for i in T.serial(0, 16):
+        for k in T.serial(0, i):
+            A[0] = A[0] + 1
+
+
+@T.prim_func
+def flops_override(a: T.Buffer(16, "float32"), b: T.Buffer(16, "float32")):

Review Comment:
   Sounds good Eric. Thanks for the suggestion. Fixed in the next commit. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] farshidsp commented on pull request #14379: [TIR] not estimating the flops when there is a default estimated flops as attr

Posted by "farshidsp (via GitHub)" <gi...@apache.org>.
farshidsp commented on PR #14379:
URL: https://github.com/apache/tvm/pull/14379#issuecomment-1481503902

   @tvm-bot rerun


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] Lunderberg merged pull request #14379: [TIR] not estimating the flops when there is a default estimated flops as attr

Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg merged PR #14379:
URL: https://github.com/apache/tvm/pull/14379


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org