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/09/30 17:48:48 UTC

[GitHub] [incubator-tvm] comaniac commented on a change in pull request #6598: [RELAY][OP] Dynamic conv2d for cuda

comaniac commented on a change in pull request #6598:
URL: https://github.com/apache/incubator-tvm/pull/6598#discussion_r497687803



##########
File path: python/tvm/topi/cuda/conv2d_nhwc_winograd.py
##########
@@ -330,7 +339,7 @@ def nhwc_winograd_cuda(
     H = (H + pt + pb - KH) // HSTR + 1
     W = (W + pl + pr - KW) // WSTR + 1
     nH, nW = (H + m - 1) // m, (W + m - 1) // m
-    P = N * nH * nW
+    P = N * nH * nW if isinstance(N, int) else nH * nW

Review comment:
       ```suggestion
       P = nH * nW * N if isinstance(N, int) else 1
   ```

##########
File path: python/tvm/topi/cuda/conv2d_winograd.py
##########
@@ -73,7 +82,8 @@ def winograd_cuda(cfg, data, kernel, strides, padding, dilation, out_dtype, pre_
     H = (H + pt + pb - KH) // HSTR + 1
     W = (W + pl + pr - KW) // WSTR + 1
     nH, nW = (H + m - 1) // m, (W + m - 1) // m
-    P = N * nH * nW
+
+    P = N * nH * nW if isinstance(N, int) else nH * nW

Review comment:
       ```suggestion
       P = nH * nW * N if isinstance(N, int) else 1
   ```

##########
File path: python/tvm/topi/cuda/conv2d_nhwc_winograd.py
##########
@@ -432,7 +441,8 @@ def nhwc_winograd_cuda(
         name="output",
         tag="conv2d_nhwc_winograd",
     )
-    cfg.add_flop(2 * N * CO * H * W * CI * KH * KW)
+    if isinstance(N, int):
+        cfg.add_flop(2 * N * CO * H * W * CI * KH * KW)

Review comment:
       It's okay in terms of the functionality, but the output message would be weird. Since the AutoTVM progress bar shows throughput instead of latency, users will always see 0 GFLOPS during the tuning process (https://github.com/apache/incubator-tvm/blob/master/python/tvm/autotvm/tuner/callback.py#L159).
   
   Maybe we can still have the FLOPS with N=1 and pop a message saying we are tuning the kernel with N=1 but it can be used by the kernel with any batch size?




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