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 2020/12/23 14:26:35 UTC

[GitHub] [tvm] merrymercy commented on a change in pull request #7146: [CUDA]batch_matmul tensorcore schedule

merrymercy commented on a change in pull request #7146:
URL: https://github.com/apache/tvm/pull/7146#discussion_r547983792



##########
File path: python/tvm/relay/op/strategy/cuda.py
##########
@@ -657,6 +657,20 @@ def batch_matmul_strategy_cuda(attrs, inputs, out_type, target):
             name="batch_matmul_cublas.cuda",
             plevel=15,
         )
+    if target.kind.name == "cuda" and nvcc.have_tensorcore(tvm.gpu(0).compute_version):
+        x, y = inputs
+        B, M, K = get_const_tuple(x.shape)
+        B, N, K = get_const_tuple(y.shape)
+        # "The shape of (M, K, N) must be multiple of (16, 16, 16) or (32, 16, 8) or (8, 16, 32) for now"
+        if ((M % 8 == 0 and K % 16 == 0 and N % 32 == 0) or \
+                (M % 16 == 0 and K % 16 == 0 and N % 16 == 0) or \
+                (M % 32 == 0 and K % 16 == 0 and N % 8 == 0)):

Review comment:
       I think it is a bug in the dense_tensorcore. We should not follow that.

##########
File path: python/tvm/relay/op/strategy/cuda.py
##########
@@ -657,6 +657,20 @@ def batch_matmul_strategy_cuda(attrs, inputs, out_type, target):
             name="batch_matmul_cublas.cuda",
             plevel=15,
         )
+    if target.kind.name == "cuda" and nvcc.have_tensorcore(tvm.gpu(0).compute_version):
+        x, y = inputs
+        B, M, K = get_const_tuple(x.shape)
+        B, N, K = get_const_tuple(y.shape)
+        # "The shape of (M, K, N) must be multiple of (16, 16, 16) or (32, 16, 8) or (8, 16, 32) for now"
+        if ((M % 8 == 0 and K % 16 == 0 and N % 32 == 0) or \
+                (M % 16 == 0 and K % 16 == 0 and N % 16 == 0) or \
+                (M % 32 == 0 and K % 16 == 0 and N % 8 == 0)):

Review comment:
       I think it is a bug in `dense_tensorcore`. We should not follow that.




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