You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/01/16 00:46:50 UTC

[GitHub] [tvm] tkonolige opened a new pull request #7297: [FIX,AUTOTVM] Add flop counts to cublas

tkonolige opened a new pull request #7297:
URL: https://github.com/apache/tvm/pull/7297


   Fixes a bug when trying to autotune with cublas enabled. I've also added the op name to the error messages.
   
   @comaniac @merrymercy
   


----------------------------------------------------------------
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.

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



[GitHub] [tvm] comaniac commented on a change in pull request #7297: [FIX,AUTOTVM] Add flop counts to cublas

Posted by GitBox <gi...@apache.org>.
comaniac commented on a change in pull request #7297:
URL: https://github.com/apache/tvm/pull/7297#discussion_r560599941



##########
File path: python/tvm/topi/cuda/dense.py
##########
@@ -44,6 +44,8 @@ def dense_cublas(cfg, data, weight, bias=None, out_dtype=None):
     matmul = cublas.matmul(data, weight, False, True)
     if isinstance(batch, int):
         cfg.add_flop(batch * in_dim * out_dim * 2)
+    else:
+        cfg.add_flop(batch.value * in_dim * out_dim * 2)

Review comment:
       Ah it turns out that you may get Var in the case of dynamic shape. For other TOPI templates, many of them just ignore the flops when the shape is dynamic. You could do the same.




----------------------------------------------------------------
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.

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



[GitHub] [tvm] tkonolige commented on a change in pull request #7297: [FIX,AUTOTVM] Add flop counts to cublas

Posted by GitBox <gi...@apache.org>.
tkonolige commented on a change in pull request #7297:
URL: https://github.com/apache/tvm/pull/7297#discussion_r558726514



##########
File path: python/tvm/topi/cuda/dense.py
##########
@@ -44,6 +44,8 @@ def dense_cublas(cfg, data, weight, bias=None, out_dtype=None):
     matmul = cublas.matmul(data, weight, False, True)
     if isinstance(batch, int):
         cfg.add_flop(batch * in_dim * out_dim * 2)
+    else:
+        cfg.add_flop(batch.value * in_dim * out_dim * 2)

Review comment:
       I've added a check that it is int or IntImm, would any other types show up here?




----------------------------------------------------------------
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.

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



[GitHub] [tvm] comaniac commented on a change in pull request #7297: [FIX,AUTOTVM] Add flop counts to cublas

Posted by GitBox <gi...@apache.org>.
comaniac commented on a change in pull request #7297:
URL: https://github.com/apache/tvm/pull/7297#discussion_r558723487



##########
File path: python/tvm/topi/cuda/dense.py
##########
@@ -44,6 +44,8 @@ def dense_cublas(cfg, data, weight, bias=None, out_dtype=None):
     matmul = cublas.matmul(data, weight, False, True)
     if isinstance(batch, int):
         cfg.add_flop(batch * in_dim * out_dim * 2)
+    else:
+        cfg.add_flop(batch.value * in_dim * out_dim * 2)

Review comment:
       Should have an assertion to make sure batch is a TVM container type.

##########
File path: python/tvm/autotvm/task/task.py
##########
@@ -580,6 +580,7 @@ def traverse(ops):
                 pass
             else:
                 raise FlopCalculationError(
+                    f"{op.name} is not supported by autotvm"

Review comment:
       ```suggestion
                       f"{op.name} is not supported by autotvm. "
   ```




----------------------------------------------------------------
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.

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



[GitHub] [tvm] comaniac commented on pull request #7297: [FIX,AUTOTVM] Add flop counts to cublas

Posted by GitBox <gi...@apache.org>.
comaniac commented on pull request #7297:
URL: https://github.com/apache/tvm/pull/7297#issuecomment-765890787


   Thanks @tkonolige 


----------------------------------------------------------------
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.

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



[GitHub] [tvm] comaniac commented on a change in pull request #7297: [FIX,AUTOTVM] Add flop counts to cublas

Posted by GitBox <gi...@apache.org>.
comaniac commented on a change in pull request #7297:
URL: https://github.com/apache/tvm/pull/7297#discussion_r558761663



##########
File path: python/tvm/topi/cuda/dense.py
##########
@@ -44,6 +44,8 @@ def dense_cublas(cfg, data, weight, bias=None, out_dtype=None):
     matmul = cublas.matmul(data, weight, False, True)
     if isinstance(batch, int):
         cfg.add_flop(batch * in_dim * out_dim * 2)
+    else:
+        cfg.add_flop(batch.value * in_dim * out_dim * 2)

Review comment:
       I don't think so. Let's use the current version to make sure we could catch any exception.




----------------------------------------------------------------
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.

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



[GitHub] [tvm] comaniac merged pull request #7297: [FIX,AUTOTVM] Add flop counts to cublas

Posted by GitBox <gi...@apache.org>.
comaniac merged pull request #7297:
URL: https://github.com/apache/tvm/pull/7297


   


----------------------------------------------------------------
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.

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