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/02/11 21:41:48 UTC
[GitHub] [incubator-tvm] alexgl-github opened a new pull request #4866:
Optimize x86 conv3d_ndhwc using data packing approach.
alexgl-github opened a new pull request #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866
Add tuneable conv3d_ndhwc schedule
Thanks for contributing to TVM! Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @ them in the pull request thread.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] alexgl-github commented on issue #4866: Optimize
x86 conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
alexgl-github commented on issue #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866#issuecomment-585502820
> Thank you for this work! It would be great if you can provide benchmarking data comparing tvm conv3d performance VS existing solution(tensorflow + mkldnn?) to see where current implementation stands.
@kevinthesun
Below is benchmark results for certain data/kernel combinations, run on 2 cpy Intel "ivybridge" vs TV 1.15 + mkldnn. X: <value> means speedup (or slowdown) of TVM model vs same TF model
TVM: 0.007 sec; X: 1.645; TF: 0.011 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(1, 3, 3, 1, 8)
TVM: 0.019 sec; X: 1.218; TF: 0.023 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(1, 7, 7, 1, 8)
TVM: 0.054 sec; X: 1.490; TF: 0.080 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(1, 3, 3, 8, 16)
TVM: 0.262 sec; X: 0.869; TF: 0.228 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(1, 7, 7, 8, 16)
TVM: 0.013 sec; X: 1.290; TF: 0.016 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(3, 3, 3, 1, 8)
TVM: 0.114 sec; X: 1.148; TF: 0.131 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(7, 7, 7, 1, 8)
TVM: 0.146 sec; X: 1.058; TF: 0.154 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(3, 3, 3, 8, 16)
TVM: 2.432 sec; X: 0.591; TF: 1.436 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(7, 7, 7, 8, 16)
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] kevinthesun commented on issue #4866: Optimize x86
conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
kevinthesun commented on issue #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866#issuecomment-585332792
Thank you for this work! It would be great if you can provide benchmarking data comparing tvm conv3d performance VS existing solution(tensorflow + mkldnn?) to see where current implementation stands.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] alexgl-github commented on issue #4866: Optimize
x86 conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
alexgl-github commented on issue #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866#issuecomment-584868090
@anijain2305 Please take a look
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] kevinthesun merged pull request #4866: Optimize x86
conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
kevinthesun merged pull request #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] kevinthesun commented on issue #4866: Optimize x86
conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
kevinthesun commented on issue #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866#issuecomment-585575763
Thanks @alexgl-github @anijain2305
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] alexgl-github edited a comment on issue #4866:
Optimize x86 conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
alexgl-github edited a comment on issue #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866#issuecomment-585502820
> Thank you for this work! It would be great if you can provide benchmarking data comparing tvm conv3d performance VS existing solution(tensorflow + mkldnn?) to see where current implementation stands.
@kevinthesun
Below is benchmark results for certain data/kernel combinations, run on 2 core Intel "ivybridge" vs TF 1.15 + mkldnn. X: <value> means speedup (or slowdown) of TVM model vs same TF model
TVM: 0.007 sec; X: 1.645; TF: 0.011 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(1, 3, 3, 1, 8)
TVM: 0.019 sec; X: 1.218; TF: 0.023 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(1, 7, 7, 1, 8)
TVM: 0.054 sec; X: 1.490; TF: 0.080 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(1, 3, 3, 8, 16)
TVM: 0.262 sec; X: 0.869; TF: 0.228 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(1, 7, 7, 8, 16)
TVM: 0.013 sec; X: 1.290; TF: 0.016 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(3, 3, 3, 1, 8)
TVM: 0.114 sec; X: 1.148; TF: 0.131 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(7, 7, 7, 1, 8)
TVM: 0.146 sec; X: 1.058; TF: 0.154 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(3, 3, 3, 8, 16)
TVM: 2.432 sec; X: 0.591; TF: 1.436 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(7, 7, 7, 8, 16)
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] alexgl-github edited a comment on issue #4866:
Optimize x86 conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
alexgl-github edited a comment on issue #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866#issuecomment-585502820
> Thank you for this work! It would be great if you can provide benchmarking data comparing tvm conv3d performance VS existing solution(tensorflow + mkldnn?) to see where current implementation stands.
@kevinthesun
Below is benchmark results for certain data/kernel combinations, run on 2 core Intel "ivybridge" vs TF 1.15 + mkldnn. X: value means speedup (or slowdown) of TVM model vs same TF model
TVM: 0.007 sec; X: 1.645; TF: 0.011 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(1, 3, 3, 1, 8)
TVM: 0.019 sec; X: 1.218; TF: 0.023 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(1, 7, 7, 1, 8)
TVM: 0.054 sec; X: 1.490; TF: 0.080 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(1, 3, 3, 8, 16)
TVM: 0.262 sec; X: 0.869; TF: 0.228 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(1, 7, 7, 8, 16)
TVM: 0.013 sec; X: 1.290; TF: 0.016 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(3, 3, 3, 1, 8)
TVM: 0.114 sec; X: 1.148; TF: 0.131 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(7, 7, 7, 1, 8)
TVM: 0.146 sec; X: 1.058; TF: 0.154 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(3, 3, 3, 8, 16)
TVM: 2.432 sec; X: 0.591; TF: 1.436 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(7, 7, 7, 8, 16)
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] anijain2305 commented on a change in pull request
#4866: Optimize x86 conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
anijain2305 commented on a change in pull request #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866#discussion_r378538482
##########
File path: topi/python/topi/x86/conv3d.py
##########
@@ -17,66 +17,359 @@
# pylint: disable=invalid-name, unused-variable, too-many-locals
# pylint: disable=unused-argument, redefined-builtin, no-else-return
"""Conv3D operators"""
+from collections import namedtuple
import tvm
-from .. import generic, tag
+from tvm import autotvm
+from tvm.autotvm.task.space import SplitEntity, OtherOptionEntity
+from .. import generic
from ..util import traverse_inline
+from ..nn.conv3d import conv3d, conv3d_ncdhw
+from ..nn.util import get_pad_tuple3d, infer_pad3d
+from ..nn.pad import pad
+from ..util import get_const_tuple, simplify, get_const_int
+from .util import get_fp32_len
-@generic.schedule_conv3d_ndhwc.register("cpu")
-def schedule_conv3d_ndhwc(outs):
- """TOPI schedule callback for conv3d
+Workload3D = namedtuple('Workload',
+ ['in_dtype', 'out_dtype', 'depth', 'height', 'width',
+ 'in_filter', 'groups', 'out_filter', 'dkernel',
+ 'hkernel', 'wkernel', 'dpad', 'hpad', 'wpad',
+ 'dstride', 'hstride', 'wstride'])
+
+@autotvm.register_topi_compute(conv3d, 'cpu', ['direct'])
+def _declaration_conv3d(cfg, data, kernel, strides, padding, dilation,
+ layout, out_dtype):
+ """3D convolution nchw forward operator.
Review comment:
nchw --> ncdhw, ndhwc
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] anijain2305 commented on a change in pull request
#4866: Optimize x86 conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
anijain2305 commented on a change in pull request #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866#discussion_r378488343
##########
File path: topi/python/topi/nn/util.py
##########
@@ -47,6 +47,36 @@ def infer_pad(data, data_pad):
wpad = (TW - IW) // 2
return get_const_int(hpad), get_const_int(wpad)
+def infer_pad3d(data, data_pad):
Review comment:
This needs extra argument specifying input data layout. Currently it assumes NDHWC
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] alexgl-github edited a comment on issue #4866:
Optimize x86 conv3d_ndhwc using data packing approach.
Posted by GitBox <gi...@apache.org>.
alexgl-github edited a comment on issue #4866: Optimize x86 conv3d_ndhwc using data packing approach.
URL: https://github.com/apache/incubator-tvm/pull/4866#issuecomment-585502820
> Thank you for this work! It would be great if you can provide benchmarking data comparing tvm conv3d performance VS existing solution(tensorflow + mkldnn?) to see where current implementation stands.
@kevinthesun
Below is benchmark results for certain data/kernel combinations, run on 2 core Intel "ivybridge" vs TV 1.15 + mkldnn. X: <value> means speedup (or slowdown) of TVM model vs same TF model
TVM: 0.007 sec; X: 1.645; TF: 0.011 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(1, 3, 3, 1, 8)
TVM: 0.019 sec; X: 1.218; TF: 0.023 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(1, 7, 7, 1, 8)
TVM: 0.054 sec; X: 1.490; TF: 0.080 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(1, 3, 3, 8, 16)
TVM: 0.262 sec; X: 0.869; TF: 0.228 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(1, 7, 7, 8, 16)
TVM: 0.013 sec; X: 1.290; TF: 0.016 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(3, 3, 3, 1, 8)
TVM: 0.114 sec; X: 1.148; TF: 0.131 sec; input_shape=(1, 16, 256, 256, 1) ; kernel_shape=(7, 7, 7, 1, 8)
TVM: 0.146 sec; X: 1.058; TF: 0.154 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(3, 3, 3, 8, 16)
TVM: 2.432 sec; X: 0.591; TF: 1.436 sec; input_shape=(1, 16, 256, 256, 8) ; kernel_shape=(7, 7, 7, 8, 16)
----------------------------------------------------------------
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
With regards,
Apache Git Services