[GitHub] [incubator-tvm] kevinthesun commented on issue #4866: Optimize x86 conv3d_ndhwc using data packing approach.

2020-02-12 Thread GitBox
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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] kevinthesun merged pull request #4866: Optimize x86 conv3d_ndhwc using data packing approach.

2020-02-12 Thread GitBox
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:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-tvm] branch master updated (70c6382 -> 8d94587)

2020-02-12 Thread kevinthesun
This is an automated email from the ASF dual-hosted git repository.

kevinthesun pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git.


from 70c6382  [FRONTEND][TFLITE] Add support for 
TFLite_Detection_PostProcess (#4543)
 add 8d94587  Optimize x86 conv3d_ndhwc  using data packing approach. 
(#4866)

No new revisions were added by this update.

Summary of changes:
 python/tvm/autotvm/task/relay_integration.py |   1 +
 python/tvm/autotvm/task/topi_integration.py  |  12 +
 topi/python/topi/nn/util.py  |  36 +++
 topi/python/topi/x86/conv3d.py   | 369 ---
 topi/tests/python/test_topi_conv3d_ndhwc.py  |   2 +-
 5 files changed, 381 insertions(+), 39 deletions(-)



[GitHub] [incubator-tvm] FrozenGene commented on a change in pull request #4790: Fast exponent

2020-02-12 Thread GitBox
FrozenGene commented on a change in pull request #4790: Fast exponent
URL: https://github.com/apache/incubator-tvm/pull/4790#discussion_r378637381
 
 

 ##
 File path: topi/python/topi/math.py
 ##
 @@ -449,3 +449,19 @@ def reinterpret(x, dtype):
 The result.
 """
 return cpp.reinterpret(x, dtype)
+
+
+def fast_exp(x):
+"""Take exponential of input x using fastexp implementation
 
 Review comment:
   fastexp -> fast_exp


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] FrozenGene commented on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
FrozenGene commented on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585527191
 
 
   > I did try just commenting out the assert and it seems to work. However, I 
then ran into a new problem... Because what you produce is ostensibly a 'c 
source' file (even if it's empty), all the external modules are also exported 
as c files. This results in having to do a proper compile when you try and 
merge all the modules together to produce a shared library. If one of your 
external modules happens to be a binary artifact that's 150MB (my case), this 
compile uses an incredible amount of RAM and takes a long time to complete. I 
didn't get this problem with your first solution as it used an LLVMModule (I 
think?) which results in the external modules becoming object files so all you 
need to do is link, not perform a full compilation.
   
   This is because our new `ModulePackImportsToLLVM` simplifies complication 
and generate object file directly, it is designed for large artifact like your 
case.
   
   > The reason that LLVMModule simplifies compilation is because it remembers 
the correct target triple. We can try to enhance the code by introducing an 
Empty LLVM module(with the correct target) when it is available(so that Q2 can 
be resolved) and fallback to the CSourceModule.
 cc @FrozenGene who created the mechanism for the binary exporting
   
   I agree we could create empty llvm module if we have llvm target support, 
then we could fallback to CSourceModule.  We could refer logic here:
   ```cpp
   runtime::Module build(const Map>& inputs,
 const Target& target_host,
 const BuildConfig& config)
 Target target_host_val = target_host;
 if (!target_host.defined()) {
   for (const auto& it : inputs) {
 if (it.first->device_type == kDLCPU) {
   target_host_val = it.first;
   break;
 }
   }
 }
   
 if (!target_host_val.defined()) {
   target_host_val = DefaultTargetHost(target_host_val);
 }
   
   ```
   Here, we have logic to detect and extract the correct target host. According 
to this, we could know whether we have LLVM (with correct target).


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] FrozenGene edited a comment on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
FrozenGene edited a comment on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585527191
 
 
   > I did try just commenting out the assert and it seems to work. However, I 
then ran into a new problem... Because what you produce is ostensibly a 'c 
source' file (even if it's empty), all the external modules are also exported 
as c files. This results in having to do a proper compile when you try and 
merge all the modules together to produce a shared library. If one of your 
external modules happens to be a binary artifact that's 150MB (my case), this 
compile uses an incredible amount of RAM and takes a long time to complete. I 
didn't get this problem with your first solution as it used an LLVMModule (I 
think?) which results in the external modules becoming object files so all you 
need to do is link, not perform a full compilation.
   
   This is because our new `ModulePackImportsToLLVM` simplifies compilation and 
generate object file directly, it is designed for large artifact like your case.
   
   > The reason that LLVMModule simplifies compilation is because it remembers 
the correct target triple. We can try to enhance the code by introducing an 
Empty LLVM module(with the correct target) when it is available(so that Q2 can 
be resolved) and fallback to the CSourceModule.
 cc @FrozenGene who created the mechanism for the binary exporting
   
   I agree we could create empty llvm module if we have llvm target support, 
then we could fallback to CSourceModule.  We could refer logic here:
   ```cpp
   runtime::Module build(const Map>& inputs,
 const Target& target_host,
 const BuildConfig& config)
 Target target_host_val = target_host;
 if (!target_host.defined()) {
   for (const auto& it : inputs) {
 if (it.first->device_type == kDLCPU) {
   target_host_val = it.first;
   break;
 }
   }
 }
   
 if (!target_host_val.defined()) {
   target_host_val = DefaultTargetHost(target_host_val);
 }
   
   ```
   Here, we have logic to detect and extract the correct target host. According 
to this, we could know whether we have LLVM (with correct target).


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] FrozenGene commented on issue #4543: [FRONTEND][TFLITE] Add support for TFLite_Detection_PostProcess

2020-02-12 Thread GitBox
FrozenGene commented on issue #4543: [FRONTEND][TFLITE] Add support for 
TFLite_Detection_PostProcess
URL: https://github.com/apache/incubator-tvm/pull/4543#issuecomment-585513267
 
 
   Thanks everyone , merged now


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] FrozenGene merged pull request #4543: [FRONTEND][TFLITE] Add support for TFLite_Detection_PostProcess

2020-02-12 Thread GitBox
FrozenGene merged pull request #4543: [FRONTEND][TFLITE] Add support for 
TFLite_Detection_PostProcess
URL: https://github.com/apache/incubator-tvm/pull/4543
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-tvm] branch master updated (51a265a -> 70c6382)

2020-02-12 Thread zhaowu
This is an automated email from the ASF dual-hosted git repository.

zhaowu pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git.


from 51a265a  [REFACTOR][PY][API-CHANGE] Establish tvm.target
 add 70c6382  [FRONTEND][TFLITE] Add support for 
TFLite_Detection_PostProcess (#4543)

No new revisions were added by this update.

Summary of changes:
 python/tvm/relay/frontend/tflite.py  | 197 +++
 tests/python/frontend/tflite/test_forward.py |  48 +++
 2 files changed, 245 insertions(+)



[GitHub] [incubator-tvm] alexgl-github commented on issue #4790: Fast exponent

2020-02-12 Thread GitBox
alexgl-github commented on issue #4790: Fast exponent
URL: https://github.com/apache/incubator-tvm/pull/4790#issuecomment-585506768
 
 
   > Right. I think `fast_exp` fits better with current naming style.
   @anijain2305 
   I've changed fastexp to fast_exp


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] masahi commented on issue #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
masahi commented on issue #4497: [Relay] Add a PyTorch to Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#issuecomment-585505734
 
 
   I don't know what is the plan for updating topi, but that is out of scope 
for this PR anyway. I think it's fine to disable the mobilenet v2 test along 
with alexnet and vgg for now and move forward.
   
   @zhiics @kazum @FrozenGene please take another look and give approval if it 
is good to go.   


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:
us...@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.

2020-02-12 Thread GitBox
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:
us...@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.

2020-02-12 Thread GitBox
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:  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:
us...@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.

2020-02-12 Thread GitBox
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:  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:
us...@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.

2020-02-12 Thread GitBox
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:  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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] wpan11nv commented on issue #4867: [TOPI][CUDA] Enable vectorization on fp16 type

2020-02-12 Thread GitBox
wpan11nv commented on issue #4867: [TOPI][CUDA] Enable vectorization on fp16 
type
URL: https://github.com/apache/incubator-tvm/pull/4867#issuecomment-585497119
 
 
   Thanks all for the suggestions! Tests updated.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] zhiics commented on a change in pull request #4873: [Relay][FastMath] Relay pass to use fast exp/tanh

2020-02-12 Thread GitBox
zhiics commented on a change in pull request #4873: [Relay][FastMath] Relay 
pass to use fast exp/tanh
URL: https://github.com/apache/incubator-tvm/pull/4873#discussion_r378594559
 
 

 ##
 File path: src/relay/backend/build_module.cc
 ##
 @@ -307,6 +307,10 @@ class RelayBuildModule : public runtime::ModuleNode {
 }
 pass_seqs.push_back(transform::FoldConstant());
 
+// Fast math optimizations.
+pass_seqs.push_back(transform::FastMath());
+pass_seqs.push_back(transform::FoldConstant());
 
 Review comment:
   Yeah, then we probably want to move it after alteroplayout.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-tvm] branch master updated (79cfab0 -> 51a265a)

2020-02-12 Thread tqchen
This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git.


from 79cfab0  [JVM] Update the runtime PackedFunc for module
 add 51a265a  [REFACTOR][PY][API-CHANGE] Establish tvm.target

No new revisions were added by this update.

Summary of changes:
 docs/api/python/index.rst  |   2 +-
 docs/api/python/target.rst |   1 +
 python/tvm/__init__.py |   2 -
 python/tvm/_ffi/runtime_ctypes.py  |  35 +-
 python/tvm/autotvm/task/dispatcher.py  |   4 +-
 python/tvm/build_module.py |   5 +-
 python/tvm/contrib/clang.py|   9 +-
 python/tvm/contrib/rocm.py |  10 +-
 python/tvm/hybrid/calls.py |   4 +-
 python/tvm/hybrid/runtime.py   |   2 +-
 python/tvm/intrin.py   |   4 +-
 python/tvm/relay/backend/vm.py |   2 +-
 python/tvm/relay/build_module.py   |   2 +-
 python/tvm/relay/qnn/op/legalizations.py   |   4 +-
 python/tvm/relay/quantize/_calibrate.py|   4 +-
 python/tvm/relay/quantize/_partition.py|   6 +-
 python/tvm/target.py   | 559 -
 python/tvm/target/__init__.py  |  62 +++
 python/tvm/{ir => target}/_ffi_api.py  |   4 +-
 python/tvm/{ => target}/codegen.py |  46 +-
 python/tvm/{ => target}/datatype.py|  24 +-
 python/tvm/target/generic_func.py  | 271 ++
 python/tvm/target/target.py| 272 ++
 src/runtime/c_runtime_api.cc   |  14 +-
 src/target/codegen.cc  |   2 +-
 src/target/datatype/registry.cc|   9 +-
 src/target/generic_func.cc |  10 +-
 src/target/llvm/llvm_module.cc |  13 +-
 src/target/target.cc   |  10 +-
 src/tir/pass/lower_custom_datatypes.cc |  24 +-
 tests/cpp/build_module_test.cc |   6 +-
 tests/python/integration/test_dot.py   |   2 +-
 tests/python/relay/test_op_level2.py   |   4 +-
 tests/python/unittest/test_autotvm_common.py   |   2 +-
 tests/python/unittest/test_codegen_c_host.py   |   2 +-
 tests/python/unittest/test_codegen_device.py   |   8 +-
 tests/python/unittest/test_codegen_llvm.py |   8 +-
 tests/python/unittest/test_codegen_static_init.py  |   4 +-
 tests/python/unittest/test_codegen_vm_basic.py |   2 +-
 tests/python/unittest/test_codegen_x86.py  |   4 +-
 .../unittest/test_custom_datatypes_mybfloat16.py   |  18 +-
 tests/python/unittest/test_lang_target.py  |   2 +-
 tests/python/unittest/test_runtime_extension.py|   2 +-
 tests/python/unittest/test_runtime_module_load.py  |   2 +-
 topi/python/topi/arm_cpu/conv2d.py |   6 +-
 topi/python/topi/bifrost/conv2d.py |   2 +-
 topi/python/topi/bifrost/transforms.py |   2 +-
 topi/python/topi/cuda/batch_matmul.py  |   4 +-
 topi/python/topi/cuda/conv1d.py|   4 +-
 topi/python/topi/cuda/conv1d_transpose_ncw.py  |   2 +-
 topi/python/topi/cuda/conv2d.py|   6 +-
 topi/python/topi/cuda/conv2d_direct.py |   2 +-
 topi/python/topi/cuda/conv2d_transpose_nchw.py |   2 +-
 topi/python/topi/cuda/conv2d_winograd.py   |   6 +-
 topi/python/topi/cuda/conv3d.py|   6 +-
 topi/python/topi/cuda/conv3d_direct.py |   2 +-
 topi/python/topi/cuda/deformable_conv2d.py |   2 +-
 topi/python/topi/cuda/dense.py |   8 +-
 topi/python/topi/cuda/depthwise_conv2d.py  |   4 +-
 topi/python/topi/cuda/group_conv2d_nchw.py |   2 +-
 topi/python/topi/cuda/injective.py |   2 +-
 topi/python/topi/cuda/nms.py   |  18 +-
 topi/python/topi/cuda/nn.py|   2 +-
 topi/python/topi/cuda/pooling.py   |   4 +-
 topi/python/topi/cuda/rcnn/proposal.py |   6 +-
 topi/python/topi/cuda/reduction.py |   4 +-
 topi/python/topi/cuda/sort.py  |   4 +-
 topi/python/topi/cuda/ssd/multibox.py  |   6 +-
 topi/python/topi/cuda/vision.py|   2 +-
 topi/python/topi/generic/extern.py |   2 +-
 topi/python/topi/generic/injective.py  |   2 +-
 topi/python/topi/generic/nn.py |   6 +-
 topi/python/topi/generic/vision.py |   4 +-
 topi/python/topi/intel_graphics/conv2d.py  |   2 +-
 .../python/topi/intel_graphics/depthwise_conv2d.py |   4 +-
 topi/python/

[GitHub] [incubator-tvm] tqchen merged pull request #4872: [REFACTOR][PY][API-CHANGE] Establish tvm.target

2020-02-12 Thread GitBox
tqchen merged pull request #4872: [REFACTOR][PY][API-CHANGE] Establish 
tvm.target
URL: https://github.com/apache/incubator-tvm/pull/4872
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] anijain2305 commented on issue #4790: Fast exponent

2020-02-12 Thread GitBox
anijain2305 commented on issue #4790: Fast exponent
URL: https://github.com/apache/incubator-tvm/pull/4790#issuecomment-585489041
 
 
   Right. I think `fast_exp` fits better with current naming style.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] anijain2305 commented on a change in pull request #4873: [Relay][FastMath] Relay pass to use fast exp/tanh

2020-02-12 Thread GitBox
anijain2305 commented on a change in pull request #4873: [Relay][FastMath] 
Relay pass to use fast exp/tanh
URL: https://github.com/apache/incubator-tvm/pull/4873#discussion_r378589877
 
 

 ##
 File path: src/relay/backend/build_module.cc
 ##
 @@ -307,6 +307,10 @@ class RelayBuildModule : public runtime::ModuleNode {
 }
 pass_seqs.push_back(transform::FoldConstant());
 
+// Fast math optimizations.
+pass_seqs.push_back(transform::FastMath());
+pass_seqs.push_back(transform::FoldConstant());
 
 Review comment:
   OR I can just move the FastMath before the previous FoldConstant.
   
   I don't think FastMath brings any new const in the graph. I just put it 
there because FastMath becomes the last pass before FuseOps, and we want the 
graph to be fully optimized.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen commented on issue #4790: Fast exponent

2020-02-12 Thread GitBox
tqchen commented on issue #4790: Fast exponent
URL: https://github.com/apache/incubator-tvm/pull/4790#issuecomment-585487279
 
 
   Overall looks OK, it would be great if we can decide a consistent naming 
convention. In this case, we can have  `fastexp` vs `fast_exp`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] anijain2305 commented on issue #4873: [Relay][FastMath] Relay pass to use fast exp/tanh

2020-02-12 Thread GitBox
anijain2305 commented on issue #4873: [Relay][FastMath] Relay pass to use fast 
exp/tanh
URL: https://github.com/apache/incubator-tvm/pull/4873#issuecomment-585487055
 
 
   Thanks @zhiics for quick review. I will incorporate your comments once the 
parent PR gets merged in.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] zhiics commented on a change in pull request #4873: [Relay][FastMath] Relay pass to use fast exp/tanh

2020-02-12 Thread GitBox
zhiics commented on a change in pull request #4873: [Relay][FastMath] Relay 
pass to use fast exp/tanh
URL: https://github.com/apache/incubator-tvm/pull/4873#discussion_r378587946
 
 

 ##
 File path: src/relay/pass/fast_math.cc
 ##
 @@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file fast_math.cc
+ * \brief Replaces non linear activation functions with their fast but 
appproximate counterparts.
 
 Review comment:
   s/appproximate/approximate


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] zhiics commented on a change in pull request #4873: [Relay][FastMath] Relay pass to use fast exp/tanh

2020-02-12 Thread GitBox
zhiics commented on a change in pull request #4873: [Relay][FastMath] Relay 
pass to use fast exp/tanh
URL: https://github.com/apache/incubator-tvm/pull/4873#discussion_r378588075
 
 

 ##
 File path: src/relay/pass/fast_math.cc
 ##
 @@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file fast_math.cc
+ * \brief Replaces non linear activation functions with their fast but 
appproximate counterparts.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "./pattern_util.h"
 
 Review comment:
   "pattern_util.h"


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] zhiics commented on a change in pull request #4873: [Relay][FastMath] Relay pass to use fast exp/tanh

2020-02-12 Thread GitBox
zhiics commented on a change in pull request #4873: [Relay][FastMath] Relay 
pass to use fast exp/tanh
URL: https://github.com/apache/incubator-tvm/pull/4873#discussion_r378587789
 
 

 ##
 File path: src/relay/backend/build_module.cc
 ##
 @@ -307,6 +307,10 @@ class RelayBuildModule : public runtime::ModuleNode {
 }
 pass_seqs.push_back(transform::FoldConstant());
 
+// Fast math optimizations.
+pass_seqs.push_back(transform::FastMath());
+pass_seqs.push_back(transform::FoldConstant());
 
 Review comment:
   We should create a SequentialPass instead of doing this back-to-back. For 
example, you can return `Sequential({FastMathPass, FoldConstant()}, 
"FastMath")` in fast_math.cc, where `FastMathPass = CreateFunctionPass()`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] anijain2305 commented on issue #4790: Fast exponent

2020-02-12 Thread GitBox
anijain2305 commented on issue #4790: Fast exponent
URL: https://github.com/apache/incubator-tvm/pull/4790#issuecomment-585485172
 
 
   @tqchen @FrozenGene Can you please check if the changes you requested are 
addressed?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] anijain2305 opened a new pull request #4873: [Relay][FastMath] Relay pass to use fast exp/tanh

2020-02-12 Thread GitBox
anijain2305 opened a new pull request #4873: [Relay][FastMath] Relay pass to 
use fast exp/tanh
URL: https://github.com/apache/incubator-tvm/pull/4873
 
 
   As Title, dependent on the following PR - 
https://github.com/apache/incubator-tvm/pull/4790
   
   @alexgl-github @zhiics @masahi 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] alexwong edited a comment on issue #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
alexwong edited a comment on issue #4497: [Relay] Add a PyTorch to Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#issuecomment-585414848
 
 
   > Do you think you can fix the padding issue? I haven't looked into what is 
going on, we may need to update cuda topi schedule.
   > 
   > It is ok if you leave that to me, I can take a look in the follow up PR.
   
   I can try taking a look today but I don't have too much experience here and 
wouldn't want to block this going out if everything else seems okay.
   
   
https://github.com/zxy844288792/tvm/blob/00fd0c45ac6a6c880c1f2c21eb79ca86b4778ba2/python/tvm/relay/op/nn/util.py#L43,
 not sure if obvious but the error is from converting 2d padding to 4d padding 
here (ie: just returning padding here fixes the cuda error). 
   
   I spoke with @zxy844288792 and he agrees it is probably a schedule issue as 
#4787 PR changed the workloads and the tophub file (guessing where default 
tuned schedules are) are not updated yet (correct me if any of this seems off).


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] zhiics edited a comment on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
zhiics edited a comment on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585464161
 
 
   For Q2, a simpler way would be feeding the first argument of 
CSourceModuleCreate with ";" instead of empty string. But LLVM module should be 
faster for compilation. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] alexwong edited a comment on issue #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
alexwong edited a comment on issue #4497: [Relay] Add a PyTorch to Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#issuecomment-585414848
 
 
   > Do you think you can fix the padding issue? I haven't looked into what is 
going on, we may need to update cuda topi schedule.
   > 
   > It is ok if you leave that to me, I can take a look in the follow up PR.
   
   I can try taking a look today but I don't have too much experience here and 
wouldn't want to block this going out if everything else seems okay.
   
   
https://github.com/zxy844288792/tvm/blob/00fd0c45ac6a6c880c1f2c21eb79ca86b4778ba2/python/tvm/relay/op/nn/util.py#L43,
 not sure if obvious but the error is from converting 2d padding to 4d padding 
here (ie: just returning padding here fixes the cuda error). 
   
   I spoke with @zxy844288792 and he agrees it is probably a schedule issue as 
#4787 PR changed the workloads and the tophub file (guessing where default 
tuned schedules are) are not updated yet.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] zhiics edited a comment on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
zhiics edited a comment on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585464161
 
 
   For Q2, a simpler way would be feeding it with ";" instead of empty string. 
But LLVM module should be faster for compilation. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] zhiics commented on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
zhiics commented on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585464161
 
 
   For Q2, a simpler would be feeding it with ";" instead of empty string. But 
LLVM module should be faster for compilation. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen edited a comment on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
tqchen edited a comment on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585462552
 
 
   The reason that LLVMModule simplifies compilation is because it remembers 
the correct target triple. We can try to enhance the code by introducing an 
Empty LLVM module(with the correct target) when it is available(so that Q2 can 
be resolved) and fallback to the CSourceModule. 
   
   cc @FrozenGene who created the mechanism for the binary exporting
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen commented on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
tqchen commented on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585462552
 
 
   The reason that LLVMModule simplifies compilation is because it remembers 
the correct target triple. We can try to enhance the code by introducing an 
Empty LLVM module(with the correct target) when it is available(so that Q2 can 
be resolved) and fallback to the CSourceModule. 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] kumasento commented on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
kumasento commented on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585454809
 
 
   @mbarrett97 Thank you for your detailed explanation! I kind of understand 
what's going here.
   
   For Q1, I have updated the logic involving external module importing. It now 
always import external modules into `ret_.mod` since it is always there.
   
   For Q2, I'm afraid that I don't have a better idea for that. Maybe @tqchen 
@zhiics @FrozenGene can have an input on this? Thanks!


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] alexwong edited a comment on issue #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
alexwong edited a comment on issue #4497: [Relay] Add a PyTorch to Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#issuecomment-585414848
 
 
   > Do you think you can fix the padding issue? I haven't looked into what is 
going on, we may need to update cuda topi schedule.
   > 
   > It is ok if you leave that to me, I can take a look in the follow up PR.
   
   I can try taking a look today but I don't have too much experience here and 
wouldn't want to block this going out if everything else seems okay.
   
   
https://github.com/zxy844288792/tvm/blob/00fd0c45ac6a6c880c1f2c21eb79ca86b4778ba2/python/tvm/relay/op/nn/util.py#L43,
 not sure if obvious but the error is from converting 2d padding to 4d padding 
here (ie: just returning padding here fixes the cuda error). 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] alexwong edited a comment on issue #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
alexwong edited a comment on issue #4497: [Relay] Add a PyTorch to Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#issuecomment-585414848
 
 
   > Do you think you can fix the padding issue? I haven't looked into what is 
going on, we may need to update cuda topi schedule.
   > 
   > It is ok if you leave that to me, I can take a look in the follow up PR.
   
   I can try taking a look today but I don't have too much experience here and 
wouldn't want to block this going out if everything else seems okay.
   
   
https://github.com/zxy844288792/tvm/blob/00fd0c45ac6a6c880c1f2c21eb79ca86b4778ba2/python/tvm/relay/op/nn/util.py#L43,
 not sure if obvious but the error is from converting 2d padding to 4d padding 
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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] mbarrett97 commented on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
mbarrett97 commented on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585449674
 
 
   I should probably explain my 'test case' :) Apologies if you know this all 
already. I'm using the external codegen feature which is relatively new. 
Essentially it allows you to take parts of the Relay graph and run them through 
a non-TVM compiler. In some cases, we take the entire Relay graph and put it 
through one of these external compilers resulting in the case where there are 
no lowered TVM functions. What does get produced though is 'external' runtime 
modules which correspond to the outputs from these external compilers.
   
   You can see this happening in the BuildRelay function. We call 
'GetExternalModules' to get those modules that have been produced by external 
compilers. But to be able to compile these modules into a shared library, we 
need a 'host' TVM module. This host module then 'imports' in all the external 
modules, as you can see here:
   
https://github.com/apache/incubator-tvm/blob/a5661611472c8e92b20bbe4d074333b8183f2878/src/relay/backend/build_module.cc#L458
   
   However, if there is no host TVM module (which will happen when there are no 
lowered funcs), then you can't import the external modules into a host module 
and accordingly we fail to compile the result to a shared library. So this fix 
is very helpful by making sure that host module always gets created, even if 
it's empty, so we can always compile to a shared library.
   
   Now addressing your questions. For 1, yes I think we just remove this branch 
entirely and have it always import the external modules. For 2, I hit the 
assert when trying to call export_library on the 'lib' output of the build 
function. I believe SaveToFile is called when doing this export, in particular 
this line:
   
https://github.com/apache/incubator-tvm/blob/79cfab00d1a5ae55b3324dae803d5e1389e12bbe/python/tvm/runtime/module.py#L302
   I did try just commenting out the assert and it seems to work. However, I 
then ran into a new problem... Because what you produce is ostensibly a 'c 
source' file (even if it's empty), all the external modules are also exported 
as c files. This results in having to do a proper compile when you try and 
merge all the modules together to produce a shared library. If one of your 
external modules happens to be a binary artifact that's 150MB (my case), this 
compile uses an incredible amount of RAM and takes a long time to complete. I 
didn't get this problem with your first solution as it used an LLVMModule (I 
think?) which results in the external modules becoming object files so all you 
need to do is link, not perform a full compilation.
   
   Sorry for the wall of text, if you have any further questions I'll happily 
answer them. I realise I may not have perfectly explained everything 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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] anijain2305 commented on issue #4790: Fast exponent

2020-02-12 Thread GitBox
anijain2305 commented on issue #4790: Fast exponent
URL: https://github.com/apache/incubator-tvm/pull/4790#issuecomment-585443948
 
 
   Can this get in? I will work on Relay changes.


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:
us...@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.

2020-02-12 Thread GitBox
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:
us...@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.

2020-02-12 Thread GitBox
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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] kumasento commented on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
kumasento commented on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585438528
 
 
   Hi @mbarrett97 
   
   Sorry I have got some questions for the case you've mentioned. 
   
   1. As you suggested, the assertion for `lowered_funcs.size()` in the branch 
assuming that external modules exist should be raised in the current 
implementation, but what is the expected behaviour when we actually use 
`CSourceModule` with an empty string? Should we simply remove this assertion 
since `ret_.mod` exists anyway and won't affect external module importing?
   2. This line of code:
   
   
https://github.com/apache/incubator-tvm/blob/a5661611472c8e92b20bbe4d074333b8183f2878/src/target/source/source_module.cc#L101
   
   is located in a `SaveToFile` function, which is not called frequently, and 
the single use case I've noticed:
   
   
https://github.com/apache/incubator-tvm/blob/fc1a1d83691f7229e25a37befdcd3ad9c3d430b3/tests/cpp/utvm_runtime_standalone_test.cc#L100
   
   only exists in test and doesn't trigger that assertsion since `fmt` is 
`"o"`. Even if `fmt` is `"cc"`, assuming no such assertion and the string is 
empty, there should not be any exception caused (at the code level, I'm not 
sure whether functionally it is expected). So do you think we could simply 
remove that empty string checker? 
   
   Thanks!


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen commented on issue #4872: [REFACTOR][PY][API-CHANGE] Establish tvm.target

2020-02-12 Thread GitBox
tqchen commented on issue #4872: [REFACTOR][PY][API-CHANGE] Establish tvm.target
URL: https://github.com/apache/incubator-tvm/pull/4872#issuecomment-585433502
 
 
   cc @ZihengJiang @icemelon9 @yzhliu @merrymercy @gussmith23 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen opened a new pull request #4872: [REFACTOR][PY][API-CHANGE] Establish tvm.target

2020-02-12 Thread GitBox
tqchen opened a new pull request #4872: [REFACTOR][PY][API-CHANGE] Establish 
tvm.target
URL: https://github.com/apache/incubator-tvm/pull/4872
 
 
   Move the related target modules into tvm.target.
   
   API change:
   - tvm.target.current_target -> tvm.target.Target.current
   - tvm.datatype -> tvm.target.datatype
   
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen merged pull request #4871: [JVM] Update the runtime PackedFunc for module

2020-02-12 Thread GitBox
tqchen merged pull request #4871: [JVM] Update the runtime PackedFunc for module
URL: https://github.com/apache/incubator-tvm/pull/4871
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-tvm] branch master updated (aaf62e4 -> 79cfab0)

2020-02-12 Thread tqchen
This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git.


from aaf62e4  Fix optimize
 add 79cfab0  [JVM] Update the runtime PackedFunc for module

No new revisions were added by this update.

Summary of changes:
 jvm/core/src/main/java/org/apache/tvm/Module.java | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)



[GitHub] [incubator-tvm] Laurawly commented on a change in pull request #4867: [TOPI][CUDA] Enable vectorization on fp16 type

2020-02-12 Thread GitBox
Laurawly commented on a change in pull request #4867: [TOPI][CUDA] Enable 
vectorization on fp16 type
URL: https://github.com/apache/incubator-tvm/pull/4867#discussion_r378516859
 
 

 ##
 File path: topi/tests/python/test_topi_tensor.py
 ##
 @@ -84,18 +84,41 @@ def check_device(device):
 for device in ["llvm"]:
 check_device(device)
 
+def verify_vectorization(n, m, dtype):
+def check_device(device):
+if not tvm.runtime.enabled(device):
+print("Skip because %s is not enabled" % device)
+return
+with tvm.target.create(device):
+ctx = tvm.context(device, 0)
+A = tvm.placeholder((n, m), name='A', dtype=dtype)
+B = tvm.compute((n, m), lambda i, j:
+ A[i, j] + tvm.const(1, A.dtype), name='B')
+S = topi.generic.schedule_elemwise(B)
+
+fun = tvm.build(S, [A, B], device)
+np_A = tvm.nd.empty((n, m), A.dtype, ctx).copyfrom(
+np.random.uniform(size=(n, m)))
+np_B = tvm.nd.empty((n, m), B.dtype, ctx)
+fun(np_A, np_B)
+tvm.testing.assert_allclose(np_B.asnumpy(), np_A.asnumpy() + 1, 
rtol=1e-5)
+
+for device in ["cuda"]:
+check_device(device)
+
+def test_vectorization():
+verify_vectorization(128, 128, "float16")
 
 Review comment:
   Same 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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] Laurawly commented on a change in pull request #4867: [TOPI][CUDA] Enable vectorization on fp16 type

2020-02-12 Thread GitBox
Laurawly commented on a change in pull request #4867: [TOPI][CUDA] Enable 
vectorization on fp16 type
URL: https://github.com/apache/incubator-tvm/pull/4867#discussion_r378516074
 
 

 ##
 File path: topi/tests/python/test_topi_relu.py
 ##
 @@ -87,12 +87,12 @@ def _prelu_numpy(x, W):
 tvm.testing.assert_allclose(b.asnumpy(), out_np, rtol=1e-5)
 
 def test_relu():
-verify_relu(10, 128)
+verify_relu(128, 128, "float32")
 
 Review comment:
   Can you keep a test case as before where `m`  and `n` have different values?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] alexwong commented on issue #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
alexwong commented on issue #4497: [Relay] Add a PyTorch to Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#issuecomment-585414848
 
 
   > Do you think you can fix the padding issue? I haven't looked into what is 
going on, we may need to update cuda topi schedule.
   > 
   > It is ok if you leave that to me, I can take a look in the follow up PR.
   
   I can try taking a look today but I don't have too much experience here and 
wouldn't want to block this going out if everything else seems okay.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] masahi commented on issue #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
masahi commented on issue #4497: [Relay] Add a PyTorch to Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#issuecomment-585410718
 
 
   Do you think you can fix the padding issue? I haven't looked into what is 
going on, we may need to update cuda topi schedule.
   
   It is ok if you leave that to me, I can take a look in the follow up PR. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] vinx13 commented on a change in pull request #4867: [TOPI][CUDA] Enable vectorization on fp16 type

2020-02-12 Thread GitBox
vinx13 commented on a change in pull request #4867: [TOPI][CUDA] Enable 
vectorization on fp16 type
URL: https://github.com/apache/incubator-tvm/pull/4867#discussion_r378503237
 
 

 ##
 File path: topi/tests/python/test_topi_tensor.py
 ##
 @@ -84,18 +84,41 @@ def check_device(device):
 for device in ["llvm"]:
 check_device(device)
 
+def verify_vectorization(n, m, dtype):
+def check_device(device):
+if not tvm.runtime.enabled(device):
+print("Skip because %s is not enabled" % device)
+return
+with tvm.target.create(device):
 
 Review comment:
   add a check whether fp16 is supported here and also `verify_relu`
   
https://github.com/apache/incubator-tvm/blob/aaf62e47e64d592be770e915a7aa59d41eddb729/topi/tests/python/test_topi_transform.py#L57-L59


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen commented on issue #4867: [TOPI][CUDA] Enable vectorization on fp16 type

2020-02-12 Thread GitBox
tqchen commented on issue #4867: [TOPI][CUDA] Enable vectorization on fp16 type
URL: https://github.com/apache/incubator-tvm/pull/4867#issuecomment-585395086
 
 
   @vinx13 @Laurawly please help to review the PR


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] alexwong commented on issue #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
alexwong commented on issue #4497: [Relay] Add a PyTorch to Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#issuecomment-585393595
 
 
   > @alexwong Reverting the commit #4787 fixed the mobilenet issue for me.
   
   Yes, that does seem to be the issue. Commenting out the call to 
get_pad_tuple2d 
(https://github.com/apache/incubator-tvm/blob/master/python/tvm/relay/op/nn/nn.py#L206)
 and passing padding directly fixes it. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] paddyhoran commented on issue #2885: [SGX] Use Fortanix EDP

2020-02-12 Thread GitBox
paddyhoran commented on issue #2885: [SGX] Use Fortanix EDP
URL: https://github.com/apache/incubator-tvm/pull/2885#issuecomment-585389205
 
 
   I just thought about this yesterday.  I'm not sure I have time to contribute 
much but development on Rust can't continue without this getting merged as it's 
such a large PR.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen opened a new pull request #4871: [JVM] Update the runtime PackedFunc for module

2020-02-12 Thread GitBox
tqchen opened a new pull request #4871: [JVM] Update the runtime PackedFunc for 
module
URL: https://github.com/apache/incubator-tvm/pull/4871
 
 
   for changes in https://github.com/apache/incubator-tvm/pull/4837/
   
   cc @yzhliu @kparzysz-quic 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen commented on issue #4837: [REFACTOR][PY][API-Change] Polish tvm.runtime, tvm.runtime.module API update

2020-02-12 Thread GitBox
tqchen commented on issue #4837: [REFACTOR][PY][API-Change] Polish tvm.runtime, 
tvm.runtime.module API update
URL: https://github.com/apache/incubator-tvm/pull/4837#issuecomment-585373355
 
 
   @kparzysz-quic Thanks for the catch, here is a patch 
https://github.com/apache/incubator-tvm/pull/4871


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] comaniac commented on issue #4870: [AutoTVM] Support range in index based tuners

2020-02-12 Thread GitBox
comaniac commented on issue #4870: [AutoTVM] Support range in index based tuners
URL: https://github.com/apache/incubator-tvm/pull/4870#issuecomment-585357287
 
 
   @merrymercy could you help to review this PR? Thanks!


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] alexwong commented on issue #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
alexwong commented on issue #4497: [Relay] Add a PyTorch to Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#issuecomment-585355953
 
 
   > hmm it's weird. After I reboot my machine, alexnet and vgg test both 
passed on cuda. Do you have accuracy issues with alexnet and vgg locally? 
@alexwong
   > 
   > UPDATE: It seems results of alexnet and vgg test in test_forward.py are 
randomly passing or failing. Using the same TVM install, my test script 
`torchvision_test.py` always passes. I compare the two IRs but the diff is only 
in input name.
   
   On my local machine which doesn't have CUDA, it passes but when using CUDA 
(through the CI container), it has accuracy problems on some inputs (haven't 
spent too much time looking at the issue). 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] wpan11nv commented on issue #4867: [TOPI][CUDA] Enable vectorization on fp16 type

2020-02-12 Thread GitBox
wpan11nv commented on issue #4867: [TOPI][CUDA] Enable vectorization on fp16 
type
URL: https://github.com/apache/incubator-tvm/pull/4867#issuecomment-585355592
 
 
   Kindly ping. Thanks!


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] alexwong commented on a change in pull request #4497: [Relay] Add a PyTorch to Relay Parser

2020-02-12 Thread GitBox
alexwong commented on a change in pull request #4497: [Relay] Add a PyTorch to 
Relay Parser
URL: https://github.com/apache/incubator-tvm/pull/4497#discussion_r378438728
 
 

 ##
 File path: tests/python/frontend/pytorch/test_forward.py
 ##
 @@ -0,0 +1,766 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=import-self, invalid-name, unused-argument
+"""Unit tests for various models and operators"""
+from time import time
+import os
+import sys
+from tempfile import TemporaryDirectory
+from scipy.stats import t as tdistr
+import numpy as np
+import torch
+from torch.nn import Module
+import tvm
+import torchvision
+
+from tvm import relay
+from tvm.contrib import graph_runtime
+from tvm.relay.testing.config import ctx_list
+
+sys.setrecursionlimit(1)
+
+def _vectorize(ten):
+return ten.reshape(-1)
+
+def atol(tru, est):
+def _atol_elt(tru, est):
+return abs(tru - est)
+tru = _vectorize(tru)
+est = _vectorize(est)
+return max([_atol_elt(x, y) for x, y in zip(tru, est)])
+
+def rtol(tru, est):
+def _rtol_elt(tru, est):
+return abs(tru - est) / min(abs(tru), abs(est))
+tru = _vectorize(tru)
+est = _vectorize(est)
+return max([_rtol_elt(x, y) for x, y in zip(tru, est)])
+
+def assert_shapes_match(tru, est):
+if tru.shape != est.shape:
+msg = "Output shapes {} and {} don't match"
+raise AssertionError(msg.format(tru.shape, est.shape))
+
+def load_torchvision(model_name):
+"""Given a model name, returns a Torchvision model in eval mode as well
+as an example input."""
+with torch.no_grad():
+if model_name.startswith("inception"):
+height = width = 299
+mean = [0.5, 0.5, 0.5]
+std = [0.5, 0.5, 0.5]
+else:
+height = width = 224
+mean = [0.485, 0.456, 0.406]
+std = [0.229, 0.224, 0.225]
+input_shape = [1, 3, height, width]
+input_data = torch.randn(input_shape).float()
+for channel in range(3):
+input_data[:, channel] -= mean[channel]
+input_data[:, channel] /= std[channel]
+model = getattr(torchvision.models, model_name)(pretrained=True)
+model = model.float().eval()
+return model, input_data
+
+def load_pretrainedmodels(model_name):
+"""Given a model name, returns a pretrainedmodels.pytorch model in eval
+mode as well as an example input."""
+import pretrainedmodels # 
https://github.com/Cadene/pretrained-models.pytorch
+model = getattr(pretrainedmodels, model_name)().float().eval()
+input_shape = [1, *model.input_size]
+input_data = torch.rand(input_shape).float() * 256
+for channel in range(3):
+input_data[:, channel] -= model.mean[channel]
+input_data[:, channel] /= model.std[channel]
+return model, input_data
+
+def load_model(model_name):
+"""Given a model name, returns a model as well as an example input."""
+if hasattr(torchvision.models, model_name):
+return load_torchvision(model_name)
+try:
+if hasattr(pretrainedmodels, model_name):
+return load_pretrainedmodels(model_name)
+except ModuleNotFoundError:
+raise ModuleNotFoundError("Please install pretrainedmodels.pytorch")
+raise RuntimeError("Model not supported")
+
+
+def confidence_interval(mean, stdev, count, alpha=.01):
+"""Returns the lower and upper bounds of the confidence interval of a 
random
+variable. Confidence is 1 - alpha (default confidence is 99%)."""
+stdval = tdistr.ppf(1 - alpha / 2, count - 1)
+lower, upper = mean + np.array([-1, 1]) * stdval * stdev / np.sqrt(count)
+return lower, upper
+
+def measure_latency(model, input_shapes, output_shapes, thresh, dryruns=40):
+"""Compute the latency of the given model"""
+latencies = []
+count = 0
+while True:
+if isinstance(model, torch.nn.Module):
+input_data = [torch.rand(shape).float() for shape in input_shapes]
+if torch.cuda.is_available():
+input_data = list(map(lambda x: x.cuda(), input_data))
+model = model.cuda()
+t_start = time()
+with torch.no_

[GitHub] [incubator-tvm] comaniac opened a new pull request #4870: [AutoTVM] Support range in index based tuners

2020-02-12 Thread GitBox
comaniac opened a new pull request #4870: [AutoTVM] Support range in index 
based tuners
URL: https://github.com/apache/incubator-tvm/pull/4870
 
 
   This PR includes the following changes in order to let grid search and 
random tuner accept an index range. This is beneficial for distributed tuning 
since we can easily separate a tuning space to chunks and distribute them to 
different machines.
   
   **Note**: This change will not affect any existing use cases of grid search 
tuner and random tuner.
   
   - Support `range_idx` optional argument when constructing `GridSearchTuner` 
and `RandomTuner` to let them only tune a part of the tuning space.
   
   - Refactor `GridSearchTuner` and `RandomTuner` to have a common base class 
called `IndexBaseTuner`. `IndexBaseTuner`  processs `range_idx` and unifies 
common fields such as `counter`.
   
   - Improve `RandomTuner` to generate non-repetitive random indices in 
constant time without increasing memory usage.
   
   - Unit tests.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] kparzysz-quic commented on issue #4837: [REFACTOR][PY][API-Change] Polish tvm.runtime, tvm.runtime.module API update

2020-02-12 Thread GitBox
kparzysz-quic commented on issue #4837: [REFACTOR][PY][API-Change] Polish 
tvm.runtime, tvm.runtime.module API update
URL: https://github.com/apache/incubator-tvm/pull/4837#issuecomment-585348595
 
 
   The file `jvm/core/src/main/java/org/apache/tvm/Module.java` still uses old 
names.  This broke the Java RPC app.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] kevinthesun commented on issue #4866: Optimize x86 conv3d_ndhwc using data packing approach.

2020-02-12 Thread GitBox
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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen commented on issue #2885: [SGX] Use Fortanix EDP

2020-02-12 Thread GitBox
tqchen commented on issue #2885: [SGX] Use Fortanix EDP
URL: https://github.com/apache/incubator-tvm/pull/2885#issuecomment-585305001
 
 
   ping @nhynes 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen commented on issue #4845: [DEV] TVM v0.7 Roadmap

2020-02-12 Thread GitBox
tqchen commented on issue #4845: [DEV] TVM v0.7 Roadmap
URL: https://github.com/apache/incubator-tvm/issues/4845#issuecomment-585290701
 
 
   @yangjunpro Perhaps it worth to start a new thread in the discuss forum to 
discuss MLIR related topics. We certainly would love some proposals about 
interpolation between MLIR and TVM.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] yangjunpro commented on issue #4845: [DEV] TVM v0.7 Roadmap

2020-02-12 Thread GitBox
yangjunpro commented on issue #4845: [DEV] TVM v0.7 Roadmap
URL: https://github.com/apache/incubator-tvm/issues/4845#issuecomment-585288898
 
 
   Is there any plan to integrate TVM as a dialect into MLIR? 
   So other components based on MLIR can leverage the capability of TVM, such 
as high performance codegen,  and fusion, etc. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] tqchen commented on issue #4543: [FRONTEND][TFLITE] Add support for TFLite_Detection_PostProcess

2020-02-12 Thread GitBox
tqchen commented on issue #4543: [FRONTEND][TFLITE] Add support for 
TFLite_Detection_PostProcess
URL: https://github.com/apache/incubator-tvm/pull/4543#issuecomment-585287746
 
 
   @FrozenGene please 
https://docs.tvm.ai/contribute/code_review.html#approve-and-request-changes-explicitly


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] zhiics commented on a change in pull request #4868: [doc][VM] Update the vm doc

2020-02-12 Thread GitBox
zhiics commented on a change in pull request #4868: [doc][VM] Update the vm doc
URL: https://github.com/apache/incubator-tvm/pull/4868#discussion_r378356522
 
 

 ##
 File path: docs/dev/virtual_machine.rst
 ##
 @@ -284,40 +297,76 @@ Dispatch Loop
 ~
 A critical piece of a VM is the dispatch loop. The dispatch loop usually 
dominates the execution time of a
 virtual machine, but we have experimentally found this not to be the case for 
Relay. We have just implemented
-a simple `switch`/`goto` dispatch loop which dispatches based on instruction 
op code.
+a simple ``switch``/``goto`` dispatch loop which dispatches based on 
instruction op code.
 
-This loop is implemented by `VirtualMachine::Run()`.
+This loop is implemented by ``VirtualMachine::Run()``.
 
 VM Compiler
 ~~~
 
 An important part of this infrastructure is a compiler from Relay's full IR 
into a sequence of bytecode.
-The VM compiler transforms a `tvm::relay::Module` into a 
`tvm::relay::vm::VirtualMachine`. The virtual
-machine contains a set of compiled functions, the compiled functions are 
contained in `tvm::relay::vm::Function`. The functions contain metadata about 
the the function as well as its compiled bytecode. For full definitions of the 
data structures see `vm.h`.
+The VM compiler transforms a ``tvm::relay::Module`` into a 
``tvm::relay::vm::Executable``. The executable
+contains a set of compiled functions, the compiled functions are contained in 
``tvm::relay::vm::Function``. The functions contain metadata about the the 
function as well as its compiled bytecode. The emitted executable object then 
can be loaded and run by a ``tvm::relay::vm::VirtualMachine`` object. For full 
definitions of the data structures, please see `include/tvm/runtime/vm.h`_.
 
 Optimizations
 ~
 
-There are quite a few optimizations required by the VM compiler.
-
-We have implemented them in the old pass style, but plan to port them to
-the new pass manager (#2546) before merging.
+There are quite a few optimizations required by the VM compiler. Each of them
+is implemented as a pass which is managed by the Relay pass manager.
 
 Optimizations marked with `TODO` are not implemented yet.
 
 - A-Normal Form
-- Lambda Lift (see `src/relay/vm/lambda_lift.cc`)
-- Inline Primitives (see `src/relay/vm/inline_primitives.cc`)
-- Inliner (see `src/relay/pass/inliner.cc`)
-- Constant Pool Layout (see `src/relay/backend/vm/compiler.cc`)
-- ADT Tag Allocation (see `src/relay/backend/vm/compiler.cc`)
+- Lambda Lift (see `src/relay/vm/lambda_lift.cc`_)
+- Inline Primitives (see `src/relay/vm/inline_primitives.cc`_)
+- Constant Pool Layout (see `src/relay/backend/vm/compiler.cc`_)
+- ADT Tag Allocation (see `src/relay/backend/vm/compiler.cc`_)
 
 Review comment:
   Yeah, it was from the old version. We need to remove it.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-tvm] branch master updated (a566161 -> aaf62e4)

2020-02-12 Thread tqchen
This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git.


from a566161  [REFACTOR][PY][API-CHANGE] establish tvm.ir, migrate 
corresponding files (#4862)
 add 176ffe5  [DOCS][PY] Sphinx docs about tvm.ir
 add aaf62e4  Fix optimize

No new revisions were added by this update.

Summary of changes:
 docs/api/python/index.rst | 9 +++--
 docs/api/python/{container.rst => ir.rst} | 9 +
 docs/api/python/runtime.rst   | 2 +-
 docs/conf.py  | 3 +++
 python/tvm/ir/__init__.py | 4 ++--
 python/tvm/ir/module.py   | 6 +++---
 python/tvm/relay/build_module.py  | 2 +-
 7 files changed, 18 insertions(+), 17 deletions(-)
 rename docs/api/python/{container.rst => ir.rst} (91%)



[GitHub] [incubator-tvm] tqchen merged pull request #4869: [DOCS][PY] Add docs for tvm.ir

2020-02-12 Thread GitBox
tqchen merged pull request #4869: [DOCS][PY] Add docs for tvm.ir
URL: https://github.com/apache/incubator-tvm/pull/4869
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] kumasento commented on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
kumasento commented on issue #4847: Return empty CSourceModule when no 
lowered_funcs exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585243629
 
 
   @mbarrett97 Thanks, I just noticed that the base of my PR is not the latest 
commit. I will update it soon.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] u99127 commented on issue #4543: [FRONTEND][TFLITE] Add support for TFLite_Detection_PostProcess

2020-02-12 Thread GitBox
u99127 commented on issue #4543: [FRONTEND][TFLITE] Add support for 
TFLite_Detection_PostProcess
URL: https://github.com/apache/incubator-tvm/pull/4543#issuecomment-585199370
 
 
   All changes have been done ? Anything left to merge this in  ? 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] kumasento commented on issue #4847: Use dummy func when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
kumasento commented on issue #4847: Use dummy func when no lowered_funcs exists 
in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585197212
 
 
   > I don't think the empty CSourceModule method works. There's a check in 
source_module.cc that fails when you try and create one with an empty string.
   
   Hi @mbarrett97 thanks for your comment. Currently I haven't met such an 
issue while testing. Would you mind letting me know which assertion you were 
referring to?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] mbarrett97 commented on issue #4847: Use dummy func when no lowered_funcs exists in Relay mod

2020-02-12 Thread GitBox
mbarrett97 commented on issue #4847: Use dummy func when no lowered_funcs 
exists in Relay mod
URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585180105
 
 
   I don't think the empty CSourceModule method works. There's a check in 
source_module.cc that fails when you try and create one with an empty string.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] masahi edited a comment on issue #4816: [TFLite] Using real image for QNN testing.

2020-02-12 Thread GitBox
masahi edited a comment on issue #4816: [TFLite] Using real image for QNN 
testing.
URL: https://github.com/apache/incubator-tvm/pull/4816#issuecomment-585153972
 
 
   What happen if the zero point is a vector, as in per channel quantization? 
What should the pad value be? 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-tvm] masahi commented on issue #4816: [TFLite] Using real image for QNN testing.

2020-02-12 Thread GitBox
masahi commented on issue #4816: [TFLite] Using real image for QNN testing.
URL: https://github.com/apache/incubator-tvm/pull/4816#issuecomment-585153972
 
 
   What happen if the zero point is a vector, as in per channel quantuzation? 
What should the pad value be? 


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:
us...@infra.apache.org


With regards,
Apache Git Services