[GitHub] [incubator-tvm] areusch opened a new pull request #5648: µtvm debug improvements

2020-05-21 Thread GitBox


areusch opened a new pull request #5648:
URL: https://github.com/apache/incubator-tvm/pull/5648


   A couple of patches to improve the debugging experience for µTVM:
   1. Make UTVMDone noreturn, so that the device doesn't jump to arbitrary code 
locations after stopping the debugger. This was causing it to often execute 
from peripheral memory and HardFault.
   
   2. Make debug mode extendable using a PackedFunc. This allows scripts to 
accept a --debug parameter and allows them to be selective about which runs to 
debug.



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




[GitHub] [incubator-tvm] mei-ye commented on pull request #5645: [TARGET] add amd_gpu target

2020-05-21 Thread GitBox


mei-ye commented on pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#issuecomment-632488140


   yes, we don't need a new target key for autotvm log, but we will need 
opencl_vxx.log to combine logs for different devices, right? 



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




[GitHub] [incubator-tvm] tqchen commented on pull request #5645: [TARGET] add amd_gpu target

2020-05-21 Thread GitBox


tqchen commented on pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#issuecomment-632481759


   We don't need a new target key for autotvm and logs, see the case for mali 
https://github.com/uwsampl/tophub/blob/master/tophub/mali_v0.04.log The device 
is preserved throughout the tvm
   
   In terms of the future runtime data sharing between cpu and GPU. I think 
that it can be solved directly by extending the opencl or vulkan runtime to 
support the shared memory, likely the memory will become vulkan_shared, like 
the cpu_pinned memory in the CUDA.



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




[GitHub] [incubator-tvm] masahi commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


masahi commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632474529


   Thanks @mbrookhart @mbaret 



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




[incubator-tvm] branch master updated: Add a check Callback to the Pattern Paritioner (#5646)

2020-05-21 Thread masahi
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 4bde554  Add a check Callback to the Pattern Paritioner (#5646)
4bde554 is described below

commit 4bde554109c1dce6044eaa10b62d4aad96352a9b
Author: Matthew Brookhart 
AuthorDate: Thu May 21 21:35:35 2020 -0700

Add a check Callback to the Pattern Paritioner (#5646)

* add a check callback to the paritioner

* fix doc string

* fix unit test spelling

* add a test with types
---
 include/tvm/relay/dataflow_matcher.h  |  7 ++-
 python/tvm/relay/dataflow_pattern/__init__.py | 16 ---
 src/relay/ir/dataflow_matcher.cc  | 17 ---
 tests/python/relay/test_dataflow_pattern.py   | 65 ---
 4 files changed, 87 insertions(+), 18 deletions(-)

diff --git a/include/tvm/relay/dataflow_matcher.h 
b/include/tvm/relay/dataflow_matcher.h
index 58aa640..517582b 100644
--- a/include/tvm/relay/dataflow_matcher.h
+++ b/include/tvm/relay/dataflow_matcher.h
@@ -27,6 +27,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -87,10 +88,14 @@ Expr RewritePatterns(Array callbacks, 
Expr expr);
  *
  * \param pattern The pattern to match
  * \param expr The expression to patition
+ * \param attrs A set of parameter names and values to apply to the 
partitioned function
+ * \param check A callback function for checking more complicated properties 
of the matched
+ * expressions, returns true if the match is accepted and false otherwise
  *
  * \return Return the paritioned Expr.
  */
-Expr PartitionPattern(DFPattern pattern, Expr expr);
+Expr PartitionPattern(DFPattern pattern, Expr expr, Map attrs,
+  PackedFunc check);
 
 }  // namespace relay
 }  // namespace tvm
diff --git a/python/tvm/relay/dataflow_pattern/__init__.py 
b/python/tvm/relay/dataflow_pattern/__init__.py
index 2582894..f8be3e2 100644
--- a/python/tvm/relay/dataflow_pattern/__init__.py
+++ b/python/tvm/relay/dataflow_pattern/__init__.py
@@ -109,7 +109,7 @@ class DFPattern(Node):
 """
 return match(self, expr)
 
-def partition(self, expr: Expr, attrs=None) -> Expr:
+def partition(self, expr: Expr, attrs=None, check=lambda x: True) -> Expr:
 """
 Parition the expression into functions defined by this pattern
 
@@ -119,13 +119,16 @@ class DFPattern(Node):
 The expression to match.
 attrs : Optional[Dict[str, Object]]
 A dictionary of Attribute name/values to add to the paritioned 
function
+check : Function
+A function to perform more complicated checks on the matched 
expression.
+Returns true if partitioning should proceed, false otherwise.
 
 Returns
 ---
 result : tvm.relay.Expr
 The Expression with matched subgraphs replaced by function calls 
to that subgraph
 """
-return partition(self, expr, attrs)
+return partition(self, expr, attrs, check)
 
 def dominates(self, parent, path=None):
 """
@@ -561,7 +564,7 @@ def rewrite(callbacks, expr: Expr) -> Expr:
 
 return ffi.rewrite(tmp, expr)
 
-def partition(pattern: DFPattern, expr: Expr, attrs=None) -> Expr:
+def partition(pattern: DFPattern, expr: Expr, attrs=None, check=lambda x: 
True) -> Expr:
 """
 Parition the expression into a series of functions that match the pattern
 
@@ -571,12 +574,15 @@ def partition(pattern: DFPattern, expr: Expr, attrs=None) 
-> Expr:
 The pattern to match
 expr : tvm.relay.Expr
 The expression to split into functions
-expr : Optional[Dict[str, Object]]
+attrs : Optional[Dict[str, Object]]
 A dict of attributes to apply to the partitioned function
+check : Function
+A function to perform more complicated checks on the matched 
expression.
+Returns true if partitioning should proceed, false otherwise.
 
 Returns
 ---
 result : tvm.relay.Expr
 The Expression with matched subgraphs replaced by function calls to 
that subgraph
 """
-return ffi.partition(pattern, expr, attrs)
+return ffi.partition(pattern, expr, attrs, check)
diff --git a/src/relay/ir/dataflow_matcher.cc b/src/relay/ir/dataflow_matcher.cc
index 4bb2b0b..980935c 100644
--- a/src/relay/ir/dataflow_matcher.cc
+++ b/src/relay/ir/dataflow_matcher.cc
@@ -693,11 +693,12 @@ 
TVM_REGISTER_GLOBAL("relay.dataflow_pattern.rewrite").set_body_typed(RewritePatt
 class PatternPartitioner : protected MixedModeMutator {
  public:
   Expr Partition(const DFPattern& pattern, const Expr& pre,
- const Map& attrs) {
+ const Map& attrs, PackedFunc check) {
 auto grouper = PatternGrouper();
 groups_ = grouper.GroupMatches(pattern, pre);
 gid_assignments_ = 

[GitHub] [incubator-tvm] masahi merged pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


masahi merged pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646


   



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




[GitHub] [incubator-tvm] Menooker commented on a change in pull request #5601: [TVM Core] Add bfloat16

2020-05-21 Thread GitBox


Menooker commented on a change in pull request #5601:
URL: https://github.com/apache/incubator-tvm/pull/5601#discussion_r429024767



##
File path: src/target/llvm/codegen_llvm.cc
##
@@ -555,12 +558,48 @@ void CodeGenLLVM::CreateSerialFor(llvm::Value* begin, 
llvm::Value* end, llvm::Va
   builder_->SetInsertPoint(for_end);
 }
 
+static llvm::Value* GetInt32VectorOrScalar(
+llvm::IRBuilder* 
builder, uint32_t v,
+int lanes) {
+  if (lanes == 1) {
+return builder->getInt32(v);
+  } else {
+std::vector consts;
+for (int i = 0; i < lanes; i++) {
+  consts.emplace_back(builder->getInt32(v));
+}
+return llvm::ConstantVector::get(consts);
+  }
+}
+
 // cast operatpr
 llvm::Value* CodeGenLLVM::CreateCast(DataType from, DataType to, llvm::Value* 
value) {
   llvm::Type* target = DTypeToLLVMType(to);
   if (value->getType() == target) return value;
   if (to.is_handle()) {
 return builder_->CreateBitCast(value, target);
+  } else if (to.is_float() && from.is_bfloat()) {
+CHECK_EQ(from.bits(), 16);

Review comment:
   and I think the way processing “custom data type” that you mentioned 
does not fit this pr well. Actually I have already notice this feature before I 
wrote this bf16 feature. But it needs function calls to do lowering, which is 
not friendly to the codegen backend to do auto vectorization and so on. Of 
course you can say we can implement this cast function as an intrinsic. Yes, 
but more complexity is brought. 
   
   I think letting bf16 dtype live until codegen is a good idea, it makes 
legalization, impl of casting easier





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




[GitHub] [incubator-tvm] Menooker commented on a change in pull request #5601: [TVM Core] Add bfloat16

2020-05-21 Thread GitBox


Menooker commented on a change in pull request #5601:
URL: https://github.com/apache/incubator-tvm/pull/5601#discussion_r429022665



##
File path: src/target/llvm/codegen_llvm.cc
##
@@ -555,12 +558,48 @@ void CodeGenLLVM::CreateSerialFor(llvm::Value* begin, 
llvm::Value* end, llvm::Va
   builder_->SetInsertPoint(for_end);
 }
 
+static llvm::Value* GetInt32VectorOrScalar(
+llvm::IRBuilder* 
builder, uint32_t v,
+int lanes) {
+  if (lanes == 1) {
+return builder->getInt32(v);
+  } else {
+std::vector consts;
+for (int i = 0; i < lanes; i++) {
+  consts.emplace_back(builder->getInt32(v));
+}
+return llvm::ConstantVector::get(consts);
+  }
+}
+
 // cast operatpr
 llvm::Value* CodeGenLLVM::CreateCast(DataType from, DataType to, llvm::Value* 
value) {
   llvm::Type* target = DTypeToLLVMType(to);
   if (value->getType() == target) return value;
   if (to.is_handle()) {
 return builder_->CreateBitCast(value, target);
+  } else if (to.is_float() && from.is_bfloat()) {
+CHECK_EQ(from.bits(), 16);

Review comment:
   Just 2 small questions.
   
   Did you mean totally eliminating bf16 dtype in legalization pass? This will 
bring much more complexity in the BF16Legalize pass, because we need to check 
every TIR node to replace bf16 with int16. In contrast, current impl only 
changes computation TIR nodes. And in the codegen, the bf16 generation is quite 
simple, just adding another ‘else if’ in casting node and tvm dtype to llvm 
type converter





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




[GitHub] [incubator-tvm] Menooker commented on a change in pull request #5601: [TVM Core] Add bfloat16

2020-05-21 Thread GitBox


Menooker commented on a change in pull request #5601:
URL: https://github.com/apache/incubator-tvm/pull/5601#discussion_r429019312



##
File path: include/tvm/runtime/c_runtime_api.h
##
@@ -114,6 +114,7 @@ typedef enum {
   kTVMNNVMLast = 20U,
   // The following section of code is used for non-reserved types.
   kTVMExtReserveEnd = 64U,
+  kTVMBFloat = 65U,

Review comment:
   ok I understand. will change that





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

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




[GitHub] [incubator-tvm] masahi commented on pull request #5640: [RELAY][BYOC] Preserve type information in Merge Composite

2020-05-21 Thread GitBox


masahi commented on pull request #5640:
URL: https://github.com/apache/incubator-tvm/pull/5640#issuecomment-632442374


   Thanks @mbaret @comaniac @zhiics 



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




[incubator-tvm] branch master updated: [RELAY][BYOC] Preserve type information in Merge Composite (#5640)

2020-05-21 Thread masahi
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 0884659  [RELAY][BYOC] Preserve type information in Merge Composite 
(#5640)
0884659 is described below

commit 0884659eb8c5fe51cc4cac9f2f8b6400f47fdee6
Author: mbaret <55580676+mba...@users.noreply.github.com>
AuthorDate: Fri May 22 03:24:23 2020 +0100

[RELAY][BYOC] Preserve type information in Merge Composite (#5640)

Keep the type information when extracting patterns
so that it can be used as part of 'check' functions.

Change-Id: I16cc70c3d013a794d2ceefb5bec815129c7b8825
---
 src/relay/transforms/merge_composite.cc | 13 ++--
 tests/python/relay/test_pass_merge_composite.py | 41 +
 2 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/src/relay/transforms/merge_composite.cc 
b/src/relay/transforms/merge_composite.cc
index 596e2a1..027e512 100644
--- a/src/relay/transforms/merge_composite.cc
+++ b/src/relay/transforms/merge_composite.cc
@@ -46,7 +46,8 @@ class MergeCompositeWrapper : public ExprMutator {
 if (var_map->find(pattern->name_hint()) == var_map->end()) {
   // if we haven't encountered this var yet, make a new free var and 
associate
   // it with the value at 'root'
-  auto free_var = Var(pattern->name_hint(), Type());
+  auto free_var = Var(pattern->name_hint(), root->checked_type());
+  free_var->checked_type_ = root->checked_type();
   var_map->Set(pattern->name_hint(), Array({free_var, root}));
   return std::move(free_var);
 } else {
@@ -147,7 +148,9 @@ class MergeCompositeWrapper : public ExprMutator {
   new_args.push_back(new_arg);
   i++;
 }
-return Call(root->op, new_args, root->attrs);
+Call new_call = Call(root->op, new_args, root->attrs);
+new_call->checked_type_ = root->checked_type();
+return std::move(new_call);
   }
 
   Expr VisitExpr_(const CallNode* cn) {
@@ -163,12 +166,15 @@ class MergeCompositeWrapper : public ExprMutator {
   auto new_e = this->Mutate(arg);
   new_args.push_back(new_e);
 }
-return Call(call->op, new_args, call->attrs);
+Call new_call = Call(call->op, new_args, call->attrs);
+new_call->checked_type_ = call->checked_type();
+return std::move(new_call);
   }
 }
 
 Expr expr = ExprMutator::VisitExpr_(cn);
 call = Downcast(expr);
+call->checked_type_ = cn->checked_type();
 if (!call->op->IsInstance()) return std::move(call);
 
 // only call patterns are supported
@@ -189,6 +195,7 @@ class MergeCompositeWrapper : public ExprMutator {
 args.push_back(args_map[free_var->name_hint()][1]);
   }
   auto new_call = Call(f, args);
+  new_call->checked_type_ = call->checked_type();
   return std::move(new_call);
 }
 return std::move(call);
diff --git a/tests/python/relay/test_pass_merge_composite.py 
b/tests/python/relay/test_pass_merge_composite.py
index 317bb42..3a79f6a 100644
--- a/tests/python/relay/test_pass_merge_composite.py
+++ b/tests/python/relay/test_pass_merge_composite.py
@@ -803,6 +803,46 @@ def test_diamond_not_merge():
 assert tvm.ir.structural_equal(result, expected, map_free_vars=True)
 
 
+def test_type_check():
+"""Test that we can query tensor types in the 'check' function."""
+def before():
+x = relay.var('x', shape=(1, 10, 10, 10))
+w = relay.var('w', shape=(10, 10, 3, 3))
+b = relay.var('b', shape=(8,))
+conv = relay.nn.conv2d(x,
+   w,
+   kernel_size=(3, 3),
+   kernel_layout="OIHW",
+   data_layout="NHWC")
+bias = relay.nn.bias_add(conv, b)
+relu = relay.nn.relu(bias)
+return relay.Function([x, w, b], relu)
+
+def _check_type_true(extract):
+conv = extract.args[0].args[0]
+typ = conv.checked_type
+return bool(typ.shape[0] == 1)
+
+def _check_type_false(extract):
+conv = extract.args[0].args[0]
+typ = conv.checked_type
+return bool(typ.shape[0] != 1)
+
+pattern_table_true = [
+("conv_bias_relu", make_conv_bias_relu_pattern(), _check_type_true)
+]
+pattern_table_false = [
+("conv_bias_relu", make_conv_bias_relu_pattern(), _check_type_false)
+]
+
+result = run_opt_pass(before(), 
relay.transform.MergeComposite(pattern_table_false))
+expected = run_opt_pass(before(), relay.transform.InferType())
+assert tvm.ir.structural_equal(result, expected, map_free_vars=True)
+
+result = run_opt_pass(before(), 
relay.transform.MergeComposite(pattern_table_true))
+assert result.body.op.attrs["Composite"] == "conv_bias_relu"
+
+
 if __name__ == "__main__":
 

[GitHub] [incubator-tvm] masahi merged pull request #5640: [RELAY][BYOC] Preserve type information in Merge Composite

2020-05-21 Thread GitBox


masahi merged pull request #5640:
URL: https://github.com/apache/incubator-tvm/pull/5640


   



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




[GitHub] [incubator-tvm] masahi removed a comment on pull request #5628: [Relay, Topi][OP] Correlation

2020-05-21 Thread GitBox


masahi removed a comment on pull request #5628:
URL: https://github.com/apache/incubator-tvm/pull/5628#issuecomment-632435544


   @vinx13 CI is complaining, not sure what's wrong



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




[GitHub] [incubator-tvm] masahi commented on pull request #5628: [Relay, Topi][OP] Correlation

2020-05-21 Thread GitBox


masahi commented on pull request #5628:
URL: https://github.com/apache/incubator-tvm/pull/5628#issuecomment-632435544


   @vinx13 CI is complaining, not sure what's wrong



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




[GitHub] [incubator-tvm] mei-ye commented on pull request #5645: [TARGET] add amd_gpu target

2020-05-21 Thread GitBox


mei-ye commented on pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#issuecomment-632434490


   Also, without a new target, we will need to merge logs for all APU models 
into opencl_v0.xx.log



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




[GitHub] [incubator-tvm] mei-ye commented on pull request #5645: [TARGET] add amd_gpu target

2020-05-21 Thread GitBox


mei-ye commented on pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#issuecomment-632434003


   Tianqi and Thierry,
   
   Thanks for our advise.  I can see your points,  especially the benefit of 
supporting both vulkan and opencl.  But I also have some concerns:
   1. We want to get rid of data movements between CPU and GPU.  Do we need a 
new runtime?  If yes, having a new target will be more convenient.
   2.  It looks like target-dependent condition checking codes are heavily 
relying on string match for target names.   Without adding a new target, we 
will need to check both target name and device_name.   Is device_name available 
throughout 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




[incubator-tvm] branch master updated (b4d4193 -> c365c2a)

2020-05-21 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 b4d4193  [Runtime] Introduce runtime::Array (#5585)
 add c365c2a  [CI] Add log check to the sphinx gallery docs (#5643)

No new revisions were added by this update.

Summary of changes:
 tests/scripts/task_python_docs.sh | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)



[GitHub] [incubator-tvm] tqchen merged pull request #5643: [CI] Add log check to the sphinx gallery docs

2020-05-21 Thread GitBox


tqchen merged pull request #5643:
URL: https://github.com/apache/incubator-tvm/pull/5643


   



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




[GitHub] [incubator-tvm] masahi commented on a change in pull request #5628: [Relay, Topi][OP] Correlation

2020-05-21 Thread GitBox


masahi commented on a change in pull request #5628:
URL: https://github.com/apache/incubator-tvm/pull/5628#discussion_r428994577



##
File path: topi/tests/python/test_topi_correlation.py
##
@@ -0,0 +1,93 @@
+# 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
+"""test of correlation operator in NCHW layout"""
+import numpy as np
+import tvm
+from tvm import te
+from tvm import autotvm
+import topi
+import topi.testing
+from tvm.contrib.pickle_memoize import memoize
+from topi.util import get_const_tuple
+
+from common import get_all_backend
+
+
+_correlation_implement = {
+"generic": (topi.nn.correlation_nchw, 
topi.generic.schedule_correlation_nchw),
+"cuda": (topi.cuda.correlation_nchw, topi.cuda.schedule_correlation_nchw),
+}
+
+
+def verify_correlation_nchw(data_shape, kernel_size, max_displacement, 
stride1, stride2, pad_size,
+is_multiply):
+print("Workload: (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d)" % 
(data_shape[0], data_shape[1], data_shape[2], data_shape[3],
+  kernel_size, 
max_displacement, stride1, stride2, pad_size,
+  is_multiply))
+
+A = te.placeholder(data_shape, name='data1')
+B = te.placeholder(data_shape, name='data2')
+dtype = A.dtype
+
+@memoize("topi.tests.test_topi_correlation_nchw.verify_correlation_nchw")
+def get_ref_data():
+a_np = np.random.uniform(size=data_shape).astype(dtype)
+b_np = np.random.uniform(size=data_shape).astype(dtype)
+c_np = topi.testing.correlation_nchw_python(a_np, b_np, kernel_size, 
max_displacement, stride1, stride2, pad_size, is_multiply)
+return a_np, b_np, c_np
+
+a_np, b_np, c_np = get_ref_data()
+
+def check_device(device):
+ctx = tvm.context(device, 0)
+if not ctx.exist:
+print("Skip because %s is not enabled" % device)
+return
+print("Running on target: %s" % device)
+fcompute, fschedule = topi.testing.dispatch(
+device, _correlation_implement)
+with tvm.target.create(device):
+C = fcompute(A, B, kernel_size, max_displacement, stride1, 
stride2, pad_size, is_multiply)
+s = fschedule([C])
+
+a = tvm.nd.array(a_np, ctx)
+b = tvm.nd.array(b_np, ctx)
+c = tvm.nd.empty(c_np.shape, dtype=dtype, ctx=ctx)
+
+func = tvm.build(s, [A, B, C], device)
+func(a, b, c)
+tvm.testing.assert_allclose(c.asnumpy(), c_np, rtol=1e-5)
+
+for device in ['llvm']:

Review comment:
   test on cuda? 





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




[GitHub] [incubator-tvm] comaniac commented on issue #5647: [PatternLang] pattern.partition doesn't include the last optional op.

2020-05-21 Thread GitBox


comaniac commented on issue #5647:
URL: https://github.com/apache/incubator-tvm/issues/5647#issuecomment-632406321


   Ah I see. Yeah then I totally agree that using pre-order traversal would be 
cleaner.



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




[GitHub] [incubator-tvm] comaniac edited a comment on issue #5647: [PatternLang] pattern.partition doesn't include the last optional op.

2020-05-21 Thread GitBox


comaniac edited a comment on issue #5647:
URL: https://github.com/apache/incubator-tvm/issues/5647#issuecomment-632403232


   I encountered the similar issue before when we were implementing 
`PartitionGraph` pass in BYOC. We then had a group merging mechanism as you 
mentioned.
   
   I didn't quite get the point of using preorder to solve this problem. Is 
this because the first/input nodes of a pattern are impossible to be optional?



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




[GitHub] [incubator-tvm] mbrookhart commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbrookhart commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632404762


   Yes! Using it as inspiration for future improvements, but there's nothing 
here that would block 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




[GitHub] [incubator-tvm] masahi commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


masahi commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632404018


   @mbrookhart @mbaret is @mbaret's PR #5640 ready to merge? 



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




[GitHub] [incubator-tvm] mbrookhart commented on issue #5647: [PatternLang] pattern.partition doesn't include the last optional op.

2020-05-21 Thread GitBox


mbrookhart commented on issue #5647:
URL: https://github.com/apache/incubator-tvm/issues/5647#issuecomment-632403556


   It's because the matching is pre-order: you start with the final node of the 
pattern, check to see if that matches the expresssion. If it does, you compare 
the pattern's inputs to the expr's inputs recursively.



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




[GitHub] [incubator-tvm] comaniac commented on issue #5647: [PatternLang] pattern.partition doesn't include the last optional op.

2020-05-21 Thread GitBox


comaniac commented on issue #5647:
URL: https://github.com/apache/incubator-tvm/issues/5647#issuecomment-632403232


   I encountered the similar issue before when we were implementing 
`PartitionGraph` pass in BYOC. We then had a group merging mechanism as you 
mentioned.
   
   I think I didn't quite get the point of using preorder to solve this 
problem. Is this because the first/input nodes of a pattern are impossible to 
be optional?



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




[GitHub] [incubator-tvm] mbrookhart commented on issue #5647: [PatternLang] pattern.partition doesn't include the last optional op.

2020-05-21 Thread GitBox


mbrookhart commented on issue #5647:
URL: https://github.com/apache/incubator-tvm/issues/5647#issuecomment-632398831


   Okay, I see the problem. I'm doing a post order traversal of the expression 
to find subgraphs to partition. That means it comes to the bias-add first, that 
matches the pattern, so it marks that subgraph as part of a fusion. Then it 
gets to the relu, ALSO matches it to the pattern, but can't fuse the nodes  
because they're already in another subgraph.
   
   I either need to allow growing fusion groups, which seems a little sketchy, 
or do a preorder traversal. I think pre-order traversal will be cleaner.



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




[GitHub] [incubator-tvm] mbaret commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbaret commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632398727


   I'll be honest and say the reason I didn't use structural equal for the 
second check was because I didn't want to write out the partitioned Relay 
expression :) I figured for that particular test I just want to know whether or 
not the check worked, there are plenty of tests to check the validity of 
partitioning above.
   
   I'm not entirely sure how structural_equal interacts with types, it's not a 
pass I've looked into in much detail.  



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




[incubator-tvm] branch master updated (b3d13d1 -> b4d4193)

2020-05-21 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 b3d13d1  [CI] Allow CI_PYTEST_ADD_OPTIONS to be unbound. (#5644)
 add b4d4193  [Runtime] Introduce runtime::Array (#5585)

No new revisions were added by this update.

Summary of changes:
 3rdparty/dmlc-core   |   2 +-
 include/tvm/node/container.h | 286 +
 include/tvm/relay/attrs/transform.h  |   2 +-
 include/tvm/runtime/container.h  | 774 ++-
 include/tvm/runtime/object.h |   2 +
 python/tvm/ir/container.py   |   2 +-
 src/ir/expr.cc   |   4 +-
 src/node/container.cc|  38 +-
 src/node/serialization.cc|  48 +-
 src/printer/relay_text_printer.cc|   2 +-
 src/printer/tir_text_printer.cc  |   4 +-
 src/relay/op/tensor/transform.cc |   6 +-
 src/relay/transforms/infer_layout_util.h |   4 +-
 src/te/schedule/schedule_dataflow_rewrite.cc |  37 +-
 src/te/schedule/schedule_lang.cc |  61 +-
 src/tir/transforms/storage_access.cc |   4 +-
 tests/cpp/container_test.cc  | 100 +++
 tests/python/relay/test_backend_graph_runtime.py |   2 +-
 18 files changed, 990 insertions(+), 388 deletions(-)



[GitHub] [incubator-tvm] tqchen merged pull request #5585: [Runtime] Introduce runtime::Array

2020-05-21 Thread GitBox


tqchen merged pull request #5585:
URL: https://github.com/apache/incubator-tvm/pull/5585


   



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




[GitHub] [incubator-tvm] tqchen commented on pull request #5585: [Runtime] Introduce runtime::Array

2020-05-21 Thread GitBox


tqchen commented on pull request #5585:
URL: https://github.com/apache/incubator-tvm/pull/5585#issuecomment-632396036


   Thanks @junrushao1994 ! Thanks @jwfromm @zhiics !



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




[GitHub] [incubator-tvm] mbrookhart commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbrookhart commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632395155


   @mbaret I'm noticing you don't use structural_equal in your tests after 
partitioning. I'm having issues with that pass when I introduce types. Does it 
not work for types?



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




[GitHub] [incubator-tvm] jwfromm commented on pull request #5585: [Runtime] Introduce runtime::Array

2020-05-21 Thread GitBox


jwfromm commented on pull request #5585:
URL: https://github.com/apache/incubator-tvm/pull/5585#issuecomment-632393603


   LGTM, great work @junrushao1994!



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




[GitHub] [incubator-tvm] mbrookhart commented on issue #5647: [PatternLang] pattern.partition doesn't include the last optional op.

2020-05-21 Thread GitBox


mbrookhart commented on issue #5647:
URL: https://github.com/apache/incubator-tvm/issues/5647#issuecomment-632392608


   Ooh, fascinating, where did I screw up? :) Will debug, 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




[incubator-tvm] branch master updated (fd052ba -> b3d13d1)

2020-05-21 Thread moreau
This is an automated email from the ASF dual-hosted git repository.

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


from fd052ba  Remove unnecessary print (#5642)
 add b3d13d1  [CI] Allow CI_PYTEST_ADD_OPTIONS to be unbound. (#5644)

No new revisions were added by this update.

Summary of changes:
 tests/scripts/setup-pytest-env.sh | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)



[incubator-tvm] branch master updated (fd052ba -> b3d13d1)

2020-05-21 Thread moreau
This is an automated email from the ASF dual-hosted git repository.

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


from fd052ba  Remove unnecessary print (#5642)
 add b3d13d1  [CI] Allow CI_PYTEST_ADD_OPTIONS to be unbound. (#5644)

No new revisions were added by this update.

Summary of changes:
 tests/scripts/setup-pytest-env.sh | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)



[GitHub] [incubator-tvm] tmoreau89 commented on pull request #5645: [TARGET] add amd_gpu target

2020-05-21 Thread GitBox


tmoreau89 commented on pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#issuecomment-632388639


   @mei-ye great to see this contribution on getting support for the AMD APU! 
@tqchen 's comments are correct, ideally we would want to use `vulkan 
-device=apu` target with perhaps the optional `-model=gfx900` flag to specify 
the opencl or vulkan backend (it might help with opencl).



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




[GitHub] [incubator-tvm] comaniac opened a new issue #5647: [PatternLang] pattern.partition doesn't include the last optional ops.

2020-05-21 Thread GitBox


comaniac opened a new issue #5647:
URL: https://github.com/apache/incubator-tvm/issues/5647


   In the unit test of pattern language, the pattern `conv2d -> 
optional(bias_add) -> relu` can match `conv2d -> bias_add -> relu`, and the 
partitioned function does include 3 ops.
   
   On the other hand, I tried to modify the pattern to `conv2d -> bias_add -> 
optional(relu)` and found the following issue:
   
   1. Graph: `conv2d->bias_add`.
   
   * Match: True
   * Partition: Correct.
   
   2. Graph: `conv2d->bias_add->relu`:
   
   * Match: True
   * Partition: The function only includes 2 ops (`conv2d` and `bias_add`) 
without `relu`.
   
   Accordingly, I guess the last `optional` might be ignored during the 
matching process. After all, the last optional is useless for `match` 
operation, but we need to include it for partition.
   
   ```python
   import tvm
   from tvm import relay
   from tvm.relay.dataflow_pattern import *
   
   def test_match_option():
   x = relay.var('x')
   w = relay.var('w')
   b = relay.var('b')
   
   conv2d = is_op('nn.conv2d')(wildcard(), wildcard())
   bias = conv2d.optional(lambda x: is_op('nn.bias_add')(x, wildcard()))
   pattern1 = is_op('nn.relu')(bias)
   
   conv2d = is_op('nn.conv2d')(wildcard(), wildcard())
   bias = is_op('nn.bias_add')(conv2d, wildcard())
   pattern2 = bias.optional(lambda x: is_op('nn.relu')(x))
   
   conv2d = relay.op.nn.conv2d(x, w)
   bias_add = relay.op.nn.bias_add(conv2d, b)
   relu = relay.op.nn.relu(bias_add)
   
   assert pattern1.match(relu)
   print(pattern1.partition(relu))
   
   assert pattern2.match(relu)
   print(pattern2.partition(relu))
   
   test_match_option()
   ```
   cc @mbrookhart 



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




[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5645: [TARGET] add amd_gpu target

2020-05-21 Thread GitBox


tqchen commented on a change in pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#discussion_r428958538



##
File path: python/tvm/rpc/client.py
##
@@ -194,6 +194,10 @@ def webgpu(self, dev_id=0):
 """Construct WebGPU device."""
 return self.context(15, dev_id)
 
+def amd_gpu(self, dev_id=0):

Review comment:
   we can directly use vulkan so it is not necessary





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




[GitHub] [incubator-tvm] tqchen commented on pull request #5628: [Relay, Topi][OP] Correlation

2020-05-21 Thread GitBox


tqchen commented on pull request #5628:
URL: https://github.com/apache/incubator-tvm/pull/5628#issuecomment-632388320


   Will leave the management to @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




[GitHub] [incubator-tvm] tmoreau89 merged pull request #5644: [CI] Allow CI_PYTEST_ADD_OPTIONS to be unbound.

2020-05-21 Thread GitBox


tmoreau89 merged pull request #5644:
URL: https://github.com/apache/incubator-tvm/pull/5644


   



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




[GitHub] [incubator-tvm] tqchen edited a comment on pull request #5645: [TARGET] add amd_gpu target

2020-05-21 Thread GitBox


tqchen edited a comment on pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#issuecomment-632385679







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




[GitHub] [incubator-tvm] tqchen edited a comment on pull request #5645: [TARGET] add amd_gpu target

2020-05-21 Thread GitBox


tqchen edited a comment on pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#issuecomment-632385679


   Thanks @mei-ye . My understanding is that this is for AMD integrated cards. 
Given that the programming model is still vulkan, we might want to discuss how 
to distinguish it from the rocm part. Perhaps an alternative way is to directly 
use `vulkan -model=v1000`, so that we can still have model specific 
optimizations(like the case of mali in ARM) while not introduce a new target 
key.
   
   See example in 
https://github.com/apache/incubator-tvm/blob/master/python/tvm/target/target.py#L155



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




[GitHub] [incubator-tvm] tqchen commented on pull request #5645: add amd_gpu target

2020-05-21 Thread GitBox


tqchen commented on pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#issuecomment-632385679


   Thanks @mei-ye . My understanding is that this is for AMD integrated cards. 
Given that the programming model is still vulkan, we might want to discuss how 
to distinguish it from the rocm part. Perhaps an alternative way is to directly 
use `vulkan -model=v1000`, so that we can still have model specific 
optimizations(like the case of mali in ARM) while not introduce a new target 
key.



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




[GitHub] [incubator-tvm] mbaret commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbaret commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632383842


   We should have a test case to investigate this. Calling type infer after the 
partitioning pass probably deals with most of the issues that could arise.



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




[GitHub] [incubator-tvm] mbrookhart commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbrookhart commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632384100


   I'll write something based on the test case in your 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




[GitHub] [incubator-tvm] comaniac commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


comaniac commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632382263


   There is only one issue that we need to think of about the type propagation. 
The reason merge composite (and some other BYOC passes) needs to manually 
propagate type is that later processed nodes may need to check the type of its 
arguments (such as the check example in this PR). Since the argument node may 
be the CallNode that we created for the partitioned function, we need to set up 
the type to make the check function work.
   
   On the other hand, I am thinking that if we make sure all argument accesses 
are based on the `pre` node instead of `post` node, then manual type 
propagation may not be an 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




[GitHub] [incubator-tvm] mbrookhart commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbrookhart commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632379884


   @mbaret Okay, took a look at the type system. 
   
   I'm actually passing you the original expression to check, not the 
partitioned version, so i don't think it will be a problem.
   
   That being said, I am not propagating type information through partitioning, 
in part because I'm not sure at what stage of the compiler passes it will be 
used, and it would fail if someone tries to run this before type inference.
   
   I am, however, I'm running InferTypes as part of the matcher for 
TypePatterns, so maybe I should just add the requirement that the inputs need 
to have well formed types and the pass will run InferTypes by default.
   
   Thoughts?



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




[GitHub] [incubator-tvm] mbaret commented on a change in pull request #5634: [CODEGEN][CONTRIB] CoreML codegen

2020-05-21 Thread GitBox


mbaret commented on a change in pull request #5634:
URL: https://github.com/apache/incubator-tvm/pull/5634#discussion_r428948712



##
File path: python/tvm/contrib/coreml.py
##
@@ -0,0 +1,230 @@
+# 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=invalid-name, unused-argument, import-outside-toplevel
+"""Utility to compile CoreML models"""
+
+import os
+import shutil
+
+import tvm._ffi
+from ..relay.expr_functor import ExprVisitor
+from ..relay.expr import Constant
+from . import xcode, coreml_runtime
+
+def _convert_add(builder, name, inputs, outputs, args, attrs):
+builder.add_elementwise(
+name=name,
+input_names=inputs,
+output_name=outputs[0],
+mode='ADD'
+)
+
+def _convert_multiply(builder, name, inputs, outputs, args, attrs):
+builder.add_elementwise(
+name=name,
+input_names=inputs,
+output_name=outputs[0],
+mode='MULTIPLY'
+)
+
+def _convert_clip(builder, name, inputs, outputs, args, attrs):
+builder.add_clip(
+name=name,
+input_name=inputs[0],
+output_name=outputs[0],
+min_value=attrs.a_min,
+max_value=attrs.a_max
+)
+
+def _convert_batch_flatten(builder, name, inputs, outputs, args, attrs):
+builder.add_flatten_to_2d(
+name=name,
+input_name=inputs[0],
+output_name=outputs[0]
+)
+
+def _convert_softmax(builder, name, inputs, outputs, args, attrs):
+builder.add_softmax_nd(
+name=name,
+input_name=inputs[0],
+output_name=outputs[0],
+axis=int(attrs['axis'])
+)
+
+def _convert_conv2d(builder, name, inputs, outputs, args, attrs):
+assert isinstance(args[1], Constant)
+assert attrs['kernel_layout'] in ['HWIO', 'OIHW']

Review comment:
   These sort of asserts might be a natural fit for a 'check' function in 
the graph annotator, so unsupported variants aren't offloaded in the first 
place.

##
File path: apps/ios_rpc/tests/ios_rpc_mobilenet.py
##
@@ -0,0 +1,201 @@
+# 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.
+
+import tvm
+from tvm import rpc, relay
+from tvm.contrib.download import download_testdata
+from tvm.relay.expr_functor import ExprMutator
+from tvm.relay import transform
+from tvm.relay.op.annotation import compiler_begin, compiler_end
+from tvm.relay.quantize.quantize import prerequisite_optimize
+from tvm.contrib import util, xcode, graph_runtime, coreml_runtime
+from tvm.contrib import coreml as _coreml
+
+import os
+import re
+import sys
+import numpy as np
+from mxnet import gluon
+from PIL import Image
+import coremltools
+
+# Set to be address of tvm proxy.
+proxy_host = os.environ["TVM_IOS_RPC_PROXY_HOST"]
+# Set your desination via env variable.
+# Should in format "platform=iOS,id="
+destination = os.environ["TVM_IOS_RPC_DESTINATION"]
+
+if not re.match(r"^platform=.*,id=.*$", destination):
+print("Bad format: {}".format(destination))
+print("Example of expected string: 
platform=iOS,id=1234567890abcabcabcabc1234567890abcabcab")
+sys.exit(1)
+
+proxy_port = 9090
+key = "iphone"
+
+# Change target configuration, this is setting for iphone6s
+#arch = "x86_64"
+#sdk = "iphonesimulator"
+arch = "arm64"
+sdk = "iphoneos"
+target_host = "llvm -target=%s-apple-darwin" % arch
+
+# override metal compiler to compile to iphone
+@tvm.register_func("tvm_callback_metal_compile")
+def compile_metal(src):
+return xcode.compile_metal(src, 

[GitHub] [incubator-tvm] mbaret commented on a change in pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbaret commented on a change in pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#discussion_r428945990



##
File path: include/tvm/relay/dataflow_matcher.h
##
@@ -90,7 +91,8 @@ Expr RewritePatterns(Array callbacks, Expr 
expr);
  *
  * \return Return the paritioned Expr.
  */
-Expr PartitionPattern(DFPattern pattern, Expr expr);

Review comment:
   That is surprising, alright no worries then.





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




[GitHub] [incubator-tvm] mbrookhart commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbrookhart commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632374429


   @mbaret Let me take a look at that 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




[GitHub] [incubator-tvm] mbaret commented on a change in pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbaret commented on a change in pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#discussion_r428945626



##
File path: src/relay/ir/dataflow_matcher.cc
##
@@ -728,16 +729,17 @@ class PatternPartitioner : protected MixedModeMutator {
   Map attrs_;
   std::vector groups_;
   std::unordered_map gid_assignments_;
+  PackedFunc check_;
 };
 
-Expr PartitionPattern(DFPattern pattern, Expr expr, Map attrs) {
-  return PatternPartitioner().Partition(pattern, expr, attrs);
+Expr PartitionPattern(DFPattern pattern, Expr expr, Map attrs,
+  PackedFunc check) {
+  return PatternPartitioner().Partition(pattern, expr, attrs, check);
 }
 
 TVM_REGISTER_GLOBAL("relay.dataflow_pattern.partition")
-.set_body_typed([](DFPattern pattern, Expr expr, Map attrs) {
-  return PartitionPattern(pattern, expr, attrs);
-});
+.set_body_typed([](DFPattern pattern, Expr expr, Map attrs,
+   PackedFunc check) { return PartitionPattern(pattern, 
expr, attrs, check); });

Review comment:
   Ah, fair enough. In clang-format we trust.





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




[GitHub] [incubator-tvm] mbrookhart commented on a change in pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbrookhart commented on a change in pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#discussion_r428945054



##
File path: tests/python/relay/test_dataflow_pattern.py
##
@@ -959,4 +984,5 @@ def test_parition_double_batchnorm():
 test_quadruple_partition_dominator()
 test_parition_batchnorm()
 test_parition_double_batchnorm()
+test_parition_check()

Review comment:
   Ooo, I should fix a few of those, thanks for noticing!





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




[GitHub] [incubator-tvm] mbrookhart commented on a change in pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbrookhart commented on a change in pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#discussion_r428944946



##
File path: src/relay/ir/dataflow_matcher.cc
##
@@ -728,16 +729,17 @@ class PatternPartitioner : protected MixedModeMutator {
   Map attrs_;
   std::vector groups_;
   std::unordered_map gid_assignments_;
+  PackedFunc check_;
 };
 
-Expr PartitionPattern(DFPattern pattern, Expr expr, Map attrs) {
-  return PatternPartitioner().Partition(pattern, expr, attrs);
+Expr PartitionPattern(DFPattern pattern, Expr expr, Map attrs,
+  PackedFunc check) {
+  return PatternPartitioner().Partition(pattern, expr, attrs, check);
 }
 
 TVM_REGISTER_GLOBAL("relay.dataflow_pattern.partition")
-.set_body_typed([](DFPattern pattern, Expr expr, Map attrs) {
-  return PartitionPattern(pattern, expr, attrs);
-});
+.set_body_typed([](DFPattern pattern, Expr expr, Map attrs,
+   PackedFunc check) { return PartitionPattern(pattern, 
expr, attrs, check); });

Review comment:
   Tianqi added clang-format-10 to the lint checker, this is the output of 
that version of clang-format.





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




[GitHub] [incubator-tvm] mbrookhart commented on a change in pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbrookhart commented on a change in pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#discussion_r428944740



##
File path: include/tvm/relay/dataflow_matcher.h
##
@@ -90,7 +91,8 @@ Expr RewritePatterns(Array callbacks, Expr 
expr);
  *
  * \return Return the paritioned Expr.
  */
-Expr PartitionPattern(DFPattern pattern, Expr expr);

Review comment:
   Yes, missed it in the last PR yesterday :(. Kind of surprised I didn't 
get a compiler warning.





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




[GitHub] [incubator-tvm] comaniac commented on pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


comaniac commented on pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#issuecomment-632372347


   > LGTM. I saw that you've fixed the debug print so I'll close #5642.
   
   Ah TQ just merged that one so please rebase to the master lol



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




[incubator-tvm] branch master updated (d090b8e -> fd052ba)

2020-05-21 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 d090b8e  [PYTORCH]Padding support (#5638)
 add fd052ba  Remove unnecessary print (#5642)

No new revisions were added by this update.

Summary of changes:
 src/relay/ir/dataflow_matcher.cc | 1 -
 1 file changed, 1 deletion(-)



[GitHub] [incubator-tvm] tqchen merged pull request #5642: [PatternLang] Remove unnecessary print

2020-05-21 Thread GitBox


tqchen merged pull request #5642:
URL: https://github.com/apache/incubator-tvm/pull/5642


   



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




[GitHub] [incubator-tvm] mbaret commented on a change in pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbaret commented on a change in pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646#discussion_r428940644



##
File path: include/tvm/relay/dataflow_matcher.h
##
@@ -90,7 +91,8 @@ Expr RewritePatterns(Array callbacks, Expr 
expr);
  *
  * \return Return the paritioned Expr.
  */
-Expr PartitionPattern(DFPattern pattern, Expr expr);

Review comment:
   The history's a bit confusing here, did the last version not have an 
attrs argument?

##
File path: src/relay/ir/dataflow_matcher.cc
##
@@ -728,16 +729,17 @@ class PatternPartitioner : protected MixedModeMutator {
   Map attrs_;
   std::vector groups_;
   std::unordered_map gid_assignments_;
+  PackedFunc check_;
 };
 
-Expr PartitionPattern(DFPattern pattern, Expr expr, Map attrs) {
-  return PatternPartitioner().Partition(pattern, expr, attrs);
+Expr PartitionPattern(DFPattern pattern, Expr expr, Map attrs,
+  PackedFunc check) {
+  return PatternPartitioner().Partition(pattern, expr, attrs, check);
 }
 
 TVM_REGISTER_GLOBAL("relay.dataflow_pattern.partition")
-.set_body_typed([](DFPattern pattern, Expr expr, Map attrs) {
-  return PartitionPattern(pattern, expr, attrs);
-});
+.set_body_typed([](DFPattern pattern, Expr expr, Map attrs,
+   PackedFunc check) { return PartitionPattern(pattern, 
expr, attrs, check); });

Review comment:
   Probably keep the original formatting here? Not sure what the style 
convention is though but it definitely reads more clearly.

##
File path: tests/python/relay/test_dataflow_pattern.py
##
@@ -959,4 +984,5 @@ def test_parition_double_batchnorm():
 test_quadruple_partition_dominator()
 test_parition_batchnorm()
 test_parition_double_batchnorm()
+test_parition_check()

Review comment:
   test_partition





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




[GitHub] [incubator-tvm] mbrookhart opened a new pull request #5646: Add a check Callback to the Pattern Paritioner

2020-05-21 Thread GitBox


mbrookhart opened a new pull request #5646:
URL: https://github.com/apache/incubator-tvm/pull/5646


   cc @comaniac @mbaret @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




[GitHub] [incubator-tvm] mei-ye commented on pull request #5645: add amd_gpu target

2020-05-21 Thread GitBox


mei-ye commented on pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645#issuecomment-632351348


   @tqchen 



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




[GitHub] [incubator-tvm] mei-ye opened a new pull request #5645: add amd_gpu target

2020-05-21 Thread GitBox


mei-ye opened a new pull request #5645:
URL: https://github.com/apache/incubator-tvm/pull/5645


   Thanks for contributing to TVM!   Please refer to guideline 
https://tvm.apache.org/docs/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 target uses vulkan runtime.   Once this change is pushed into upstream, 
a log will be added to tophub. This change contains minimum target-specific 
codes.



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




[incubator-tvm] branch master updated: [PYTORCH]Padding support (#5638)

2020-05-21 Thread masahi
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new d090b8e  [PYTORCH]Padding support (#5638)
d090b8e is described below

commit d090b8e20e827906fff80c0484ddbe34169a5100
Author: Samuel 
AuthorDate: Fri May 22 02:14:17 2020 +0530

[PYTORCH]Padding support (#5638)
---
 python/tvm/relay/frontend/pytorch.py  | 27 +--
 tests/python/frontend/pytorch/test_forward.py | 49 +++
 2 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/python/tvm/relay/frontend/pytorch.py 
b/python/tvm/relay/frontend/pytorch.py
index 28703da..cc7cd48 100644
--- a/python/tvm/relay/frontend/pytorch.py
+++ b/python/tvm/relay/frontend/pytorch.py
@@ -1342,10 +1342,31 @@ def _none():
 def _pad():
 def _impl(inputs, input_types):
 data = inputs[0]
-padding = inputs[1]
-pad_width = list(zip(padding, padding))
+if isinstance(inputs[1], list):
+pad_list = inputs[1]
+else:
+pad_list = list(_infer_shape(inputs[1]))
+
+# initialize paddings based on input len
+pad_len = len(_infer_shape(data)) * 2
+paddings = [0] * pad_len
+
+if len(pad_list) >= 2:
+paddings[-1] = pad_list[1]
+paddings[-2] = pad_list[0]
+if len(pad_list) >= 4:
+paddings[-3] = pad_list[3]
+paddings[-4] = pad_list[2]
+if len(pad_list) >= 6:
+paddings[-5] = pad_list[5]
+paddings[-6] = pad_list[4]
+
+# group into tuple of 2 ints
+paddings = [paddings[i:i + 2] for i in range(0, len(paddings), 2)]
+
 pad_value = inputs[2]
-return _op.nn.pad(data, pad_width, pad_value)
+
+return _op.nn.pad(data, paddings, pad_value)
 return _impl
 
 
diff --git a/tests/python/frontend/pytorch/test_forward.py 
b/tests/python/frontend/pytorch/test_forward.py
index f1543f0..85928bf 100644
--- a/tests/python/frontend/pytorch/test_forward.py
+++ b/tests/python/frontend/pytorch/test_forward.py
@@ -1020,6 +1020,50 @@ def test_adaptive_pool3d():
 verify_model(torch.nn.AdaptiveMaxPool3d((7, 8, 9)).eval(), inp)
 
 
+def test_forward_functional_pad():
+torch.set_grad_enabled(False)
+pad = (0, 0)
+class Pad1(Module):
+def forward(self, *args):
+return torch.nn.functional.pad(args[0], pad, "constant", 0)
+
+input_data = torch.rand((3, 3, 4, 2))
+pad = (1, 1)
+verify_model(Pad1().float().eval(), input_data=input_data)
+
+pad = (1, 1, 2, 2)
+verify_model(Pad1().float().eval(), input_data=input_data)
+
+pad = (0, 1, 2, 1, 3, 3)
+verify_model(Pad1().float().eval(), input_data=input_data)
+
+
+def test_forward_zero_pad2d():
+inp = torch.rand((1, 1, 3, 3))
+verify_model(torch.nn.ZeroPad2d(2).eval(), inp)
+verify_model(torch.nn.ZeroPad2d((1, 1, 2, 0)).eval(), inp)
+
+
+def test_forward_constant_pad1d():
+inp = torch.rand((1, 2, 4))
+verify_model(torch.nn.ConstantPad2d(2, 3.5).eval(), inp)
+
+inp = torch.rand((1, 2, 3))
+verify_model(torch.nn.ConstantPad2d((3, 1), 3.5).eval(), inp)
+
+
+def test_forward_constant_pad2d():
+inp = torch.rand((1, 2, 2, 2))
+verify_model(torch.nn.ConstantPad2d(2, 3.5).eval(), inp)
+verify_model(torch.nn.ConstantPad2d((3, 0, 2, 1), 3.5).eval(), inp)
+
+
+def test_forward_constant_pad3d():
+inp = torch.rand((1, 3, 2, 2, 2))
+verify_model(torch.nn.ConstantPad3d(3, 3.5).eval(), inp)
+verify_model(torch.nn.ConstantPad3d((3, 4, 5, 6, 0, 1), 3.5).eval(), inp)
+
+
 def test_forward_reflection_pad2d():
 inp = torch.rand((1, 1, 3, 3))
 verify_model(torch.nn.ReflectionPad2d(2).eval(), inp)
@@ -2200,6 +2244,11 @@ if __name__ == "__main__":
 test_upsample()
 test_forward_upsample3d()
 test_to()
+test_forward_functional_pad()
+test_forward_zero_pad2d()
+test_forward_constant_pad1d()
+test_forward_constant_pad2d()
+test_forward_constant_pad3d()
 test_forward_reflection_pad2d()
 test_adaptive_pool3d()
 test_conv3d()



[GitHub] [incubator-tvm] masahi commented on pull request #5638: [PYTORCH]Padding op support

2020-05-21 Thread GitBox


masahi commented on pull request #5638:
URL: https://github.com/apache/incubator-tvm/pull/5638#issuecomment-632335563


   Thanks @siju-samuel 



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




[GitHub] [incubator-tvm] masahi merged pull request #5638: [PYTORCH]Padding op support

2020-05-21 Thread GitBox


masahi merged pull request #5638:
URL: https://github.com/apache/incubator-tvm/pull/5638


   



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




[GitHub] [incubator-tvm] masahi commented on pull request #5640: [RELAY][BYOC] Preserve type information in Merge Composite

2020-05-21 Thread GitBox


masahi commented on pull request #5640:
URL: https://github.com/apache/incubator-tvm/pull/5640#issuecomment-632328954


   @mbaret please run the CI again, this time it should work.



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




[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5052: [TARGET] ONNX codegen

2020-05-21 Thread GitBox


tqchen commented on a change in pull request #5052:
URL: https://github.com/apache/incubator-tvm/pull/5052#discussion_r428869077



##
File path: python/tvm/contrib/codegen_onnx.py
##
@@ -0,0 +1,752 @@
+# 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
+#

Review comment:
   tvm/contrib/target/onnx.py





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




[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5634: [CODEGEN][CONTRIB] CoreML codegen

2020-05-21 Thread GitBox


tqchen commented on a change in pull request #5634:
URL: https://github.com/apache/incubator-tvm/pull/5634#discussion_r428869165



##
File path: python/tvm/contrib/coreml.py
##
@@ -0,0 +1,230 @@
+# 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=invalid-name, unused-argument, import-outside-toplevel
+"""Utility to compile CoreML models"""
+
+import os
+import shutil
+
+import tvm._ffi
+from ..relay.expr_functor import ExprVisitor
+from ..relay.expr import Constant
+from . import xcode, coreml_runtime
+

Review comment:
   move to tvm/contrib/target/coreml.py





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




[GitHub] [incubator-tvm] tqchen commented on pull request #5052: [TARGET] ONNX codegen

2020-05-21 Thread GitBox


tqchen commented on pull request #5052:
URL: https://github.com/apache/incubator-tvm/pull/5052#issuecomment-632301482


   @kazum @FrozenGene please see if you are interested in managing this 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




[GitHub] [incubator-tvm] tqchen closed issue #5632: [RUNTIME][VULKAN] Seg fault in WorkspacePool's destructor

2020-05-21 Thread GitBox


tqchen closed issue #5632:
URL: https://github.com/apache/incubator-tvm/issues/5632


   



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




[incubator-tvm] branch master updated: [RUNTIME][VULKAN] Seg fault in WorkspacePool's destructor (#5632) (#5636)

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

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


The following commit(s) were added to refs/heads/master by this push:
 new bc4d5a3  [RUNTIME][VULKAN] Seg fault in WorkspacePool's destructor 
(#5632) (#5636)
bc4d5a3 is described below

commit bc4d5a33812fc11a183c677d14eda4078b48e358
Author: Yi Wang 
AuthorDate: Thu May 21 12:07:54 2020 -0700

[RUNTIME][VULKAN] Seg fault in WorkspacePool's destructor (#5632) (#5636)

* [RUNTIME][VULKAN] Seg fault in WorkspacePool's destructor (#5632)
* fixed this issue by changing WorkspacePool's destruction order

* make line < 100 charactors long
---
 src/runtime/vulkan/vulkan.cc | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/runtime/vulkan/vulkan.cc b/src/runtime/vulkan/vulkan.cc
index 207a86a..ef4b9b0 100644
--- a/src/runtime/vulkan/vulkan.cc
+++ b/src/runtime/vulkan/vulkan.cc
@@ -56,6 +56,8 @@ class VulkanThreadEntry {
 // the instance and device get destroyed.
 // The destruction need to be manually called
 // to ensure the destruction order.
+
+pool.reset();
 streams_.clear();
 for (const auto& kv : staging_buffers_) {
   if (!kv.second) {
@@ -75,7 +77,7 @@ class VulkanThreadEntry {
   }
 
   TVMContext ctx;
-  WorkspacePool pool;
+  std::unique_ptr pool;
   VulkanStream* Stream(size_t device_id);
   VulkanStagingBuffer* StagingBuffer(int device_id, size_t size);
 
@@ -331,11 +333,11 @@ class VulkanDeviceAPI final : public DeviceAPI {
   }
 
   void* AllocWorkspace(TVMContext ctx, size_t size, DLDataType type_hint) 
final {
-return VulkanThreadEntry::ThreadLocal()->pool.AllocWorkspace(ctx, size);
+return VulkanThreadEntry::ThreadLocal()->pool->AllocWorkspace(ctx, size);
   }
 
   void FreeWorkspace(TVMContext ctx, void* data) final {
-VulkanThreadEntry::ThreadLocal()->pool.FreeWorkspace(ctx, data);
+VulkanThreadEntry::ThreadLocal()->pool->FreeWorkspace(ctx, data);
   }
 
   static const std::shared_ptr& Global() {
@@ -999,7 +1001,8 @@ VulkanStagingBuffer* VulkanThreadEntry::StagingBuffer(int 
device_id, size_t size
 }
 
 VulkanThreadEntry::VulkanThreadEntry()
-: pool(static_cast(kDLVulkan), VulkanDeviceAPI::Global()) {
+: 
pool(std::make_unique(static_cast(kDLVulkan),
+   VulkanDeviceAPI::Global())) {
   ctx.device_id = 0;
   ctx.device_type = static_cast(kDLVulkan);
 }



[GitHub] [incubator-tvm] tqchen merged pull request #5636: [RUNTIME][VULKAN] Seg fault in WorkspacePool's destructor (#5632)

2020-05-21 Thread GitBox


tqchen merged pull request #5636:
URL: https://github.com/apache/incubator-tvm/pull/5636


   



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




[GitHub] [incubator-tvm] vinx13 commented on a change in pull request #5628: [Relay, Topi][OP] Correlation

2020-05-21 Thread GitBox


vinx13 commented on a change in pull request #5628:
URL: https://github.com/apache/incubator-tvm/pull/5628#discussion_r428829546



##
File path: include/tvm/relay/attrs/nn.h
##
@@ -1203,6 +1203,36 @@ struct SubPixelAttrs : public 
tvm::AttrsNode {
   }
 };  // struct SubPixelAttrs
 
+/*! \brief Attributes used in correlation operators */
+struct CorrelationAttrs : public tvm::AttrsNode {
+  int kernel_size;
+  int max_displacement;
+  int stride1;
+  int stride2;
+  Array padding;

Review comment:
   I'm using the helper function `void GetPaddingHeightWidth(const 
Array& padding, IndexExpr* pad_h,
 IndexExpr* pad_w)'` which is also used by 
convolution. What about keeping `Array` so that we can migrate to 
`Array` at once in the future?





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




[GitHub] [incubator-tvm] tqchen commented on pull request #5644: [CI] Allow CI_PYTEST_ADD_OPTIONS to be unbound.

2020-05-21 Thread GitBox


tqchen commented on pull request #5644:
URL: https://github.com/apache/incubator-tvm/pull/5644#issuecomment-632253033


   cc @u99127 @roastduck 



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




[GitHub] [incubator-tvm] tqchen opened a new pull request #5644: [CI] Allow CI_PYTEST_ADD_OPTIONS to be unbound.

2020-05-21 Thread GitBox


tqchen opened a new pull request #5644:
URL: https://github.com/apache/incubator-tvm/pull/5644


   This patch allows the test script to execute normally when 
CI_PYTEST_ADD_OPTIONS is not available.
   



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




[GitHub] [incubator-tvm] tqchen commented on pull request #5641: [DOCS] Fix the QNN TFLite tutorial build

2020-05-21 Thread GitBox


tqchen commented on pull request #5641:
URL: https://github.com/apache/incubator-tvm/pull/5641#issuecomment-632251248


   CI enhancement in https://github.com/apache/incubator-tvm/pull/5643



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




[GitHub] [incubator-tvm] tqchen commented on pull request #5643: [CI] Add log check to the sphinx gallery docs

2020-05-21 Thread GitBox


tqchen commented on pull request #5643:
URL: https://github.com/apache/incubator-tvm/pull/5643#issuecomment-632251086


   cc @masahi @tmoreau89 @ZihengJiang  



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




[GitHub] [incubator-tvm] tqchen opened a new pull request #5643: [CI] Add log check to the sphinx gallery docs

2020-05-21 Thread GitBox


tqchen opened a new pull request #5643:
URL: https://github.com/apache/incubator-tvm/pull/5643


   This PR add log check to sphinx gallery tutorials to prevent
   the case when sphinx failed to capture the error in tutorials.
   
   
   



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




[GitHub] [incubator-tvm] comaniac opened a new pull request #5642: [PatternLang] Remove unnecessary print

2020-05-21 Thread GitBox


comaniac opened a new pull request #5642:
URL: https://github.com/apache/incubator-tvm/pull/5642


   cc @mbrookhart 



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




[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5628: [Relay, Topi][OP] Correlation

2020-05-21 Thread GitBox


tqchen commented on a change in pull request #5628:
URL: https://github.com/apache/incubator-tvm/pull/5628#discussion_r428811151



##
File path: include/tvm/relay/attrs/nn.h
##
@@ -1203,6 +1203,36 @@ struct SubPixelAttrs : public 
tvm::AttrsNode {
   }
 };  // struct SubPixelAttrs
 
+/*! \brief Attributes used in correlation operators */
+struct CorrelationAttrs : public tvm::AttrsNode {
+  int kernel_size;
+  int max_displacement;
+  int stride1;
+  int stride2;
+  Array padding;

Review comment:
   Sorry somehow the github does not display `<>` correctly, 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




[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5628: [Relay, Topi][OP] Correlation

2020-05-21 Thread GitBox


tqchen commented on a change in pull request #5628:
URL: https://github.com/apache/incubator-tvm/pull/5628#discussion_r428345304



##
File path: include/tvm/relay/attrs/nn.h
##
@@ -1203,6 +1203,36 @@ struct SubPixelAttrs : public 
tvm::AttrsNode {
   }
 };  // struct SubPixelAttrs
 
+/*! \brief Attributes used in correlation operators */
+struct CorrelationAttrs : public tvm::AttrsNode {
+  int kernel_size;
+  int max_displacement;
+  int stride1;
+  int stride2;
+  Array padding;

Review comment:
   Should we change it to `Array `?





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




[incubator-tvm] branch master updated (cafb498 -> 1c355d3)

2020-05-21 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 cafb498  Extend AttrPattern to support CallNode and FunctionNode 
attributes (#5637)
 add 1c355d3  [DOCS] Fix the QNN TFLite tutorial build (#5641)

No new revisions were added by this update.

Summary of changes:
 Jenkinsfile  | 2 +-
 tutorials/frontend/deploy_prequantized_tflite.py | 9 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)



[GitHub] [incubator-tvm] tqchen merged pull request #5641: [DOCS] Fix the QNN TFLite tutorial build

2020-05-21 Thread GitBox


tqchen merged pull request #5641:
URL: https://github.com/apache/incubator-tvm/pull/5641


   



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




[GitHub] [incubator-tvm] kevinthesun commented on pull request #5459: [Relay][Op]Support symbolic TopK, Ones, Zeros and Full

2020-05-21 Thread GitBox


kevinthesun commented on pull request #5459:
URL: https://github.com/apache/incubator-tvm/pull/5459#issuecomment-632234198


   @yongwww @icemelon9 PTAL



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




[GitHub] [incubator-tvm] tqchen commented on pull request #5601: [TVM Core] Add bfloat16

2020-05-21 Thread GitBox


tqchen commented on pull request #5601:
URL: https://github.com/apache/incubator-tvm/pull/5601#issuecomment-632164851


   Given that this is a new feature that will affect quite some people, please 
open a new RFC thread in the discuss forum to describe the motivation and the 
high level design. Thank you!



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




[GitHub] [incubator-tvm] tqchen edited a comment on pull request #5641: [DOCS] Fix the QNN TFLite tutorial build

2020-05-21 Thread GitBox


tqchen edited a comment on pull request #5641:
URL: https://github.com/apache/incubator-tvm/pull/5641#issuecomment-632137071


   cc @masahi @siju-samuel @tmoreau89 @ZihengJiang @junrushao1994 



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




[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5601: [TVM Core] Add bfloat16

2020-05-21 Thread GitBox


tqchen commented on a change in pull request #5601:
URL: https://github.com/apache/incubator-tvm/pull/5601#discussion_r428730836



##
File path: src/target/llvm/codegen_llvm.cc
##
@@ -555,12 +558,48 @@ void CodeGenLLVM::CreateSerialFor(llvm::Value* begin, 
llvm::Value* end, llvm::Va
   builder_->SetInsertPoint(for_end);
 }
 
+static llvm::Value* GetInt32VectorOrScalar(
+llvm::IRBuilder* 
builder, uint32_t v,
+int lanes) {
+  if (lanes == 1) {
+return builder->getInt32(v);
+  } else {
+std::vector consts;
+for (int i = 0; i < lanes; i++) {
+  consts.emplace_back(builder->getInt32(v));
+}
+return llvm::ConstantVector::get(consts);
+  }
+}
+
 // cast operatpr
 llvm::Value* CodeGenLLVM::CreateCast(DataType from, DataType to, llvm::Value* 
value) {
   llvm::Type* target = DTypeToLLVMType(to);
   if (value->getType() == target) return value;
   if (to.is_handle()) {
 return builder_->CreateBitCast(value, target);
+  } else if (to.is_float() && from.is_bfloat()) {
+CHECK_EQ(from.bits(), 16);

Review comment:
   Then we should legalize the cast as well in the TIR to introduce the 
actual impl of the cast funtions in TIR, please also refer to 
https://tvm.apache.org/2020/05/20/bring-your-own-datatypes for releated 
implemenetation





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




[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5601: [TVM Core] Add bfloat16

2020-05-21 Thread GitBox


tqchen commented on a change in pull request #5601:
URL: https://github.com/apache/incubator-tvm/pull/5601#discussion_r428730836



##
File path: src/target/llvm/codegen_llvm.cc
##
@@ -555,12 +558,48 @@ void CodeGenLLVM::CreateSerialFor(llvm::Value* begin, 
llvm::Value* end, llvm::Va
   builder_->SetInsertPoint(for_end);
 }
 
+static llvm::Value* GetInt32VectorOrScalar(
+llvm::IRBuilder* 
builder, uint32_t v,
+int lanes) {
+  if (lanes == 1) {
+return builder->getInt32(v);
+  } else {
+std::vector consts;
+for (int i = 0; i < lanes; i++) {
+  consts.emplace_back(builder->getInt32(v));
+}
+return llvm::ConstantVector::get(consts);
+  }
+}
+
 // cast operatpr
 llvm::Value* CodeGenLLVM::CreateCast(DataType from, DataType to, llvm::Value* 
value) {
   llvm::Type* target = DTypeToLLVMType(to);
   if (value->getType() == target) return value;
   if (to.is_handle()) {
 return builder_->CreateBitCast(value, target);
+  } else if (to.is_float() && from.is_bfloat()) {
+CHECK_EQ(from.bits(), 16);

Review comment:
   Then we should legalize the cast as well in the TIR to introduce 
additional cast funtions, please also refer to 
https://tvm.apache.org/2020/05/20/bring-your-own-datatypes for releated 
implemenetation





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




[GitHub] [incubator-tvm] tqchen commented on a change in pull request #5601: [TVM Core] Add bfloat16

2020-05-21 Thread GitBox


tqchen commented on a change in pull request #5601:
URL: https://github.com/apache/incubator-tvm/pull/5601#discussion_r428729913



##
File path: include/tvm/runtime/c_runtime_api.h
##
@@ -114,6 +114,7 @@ typedef enum {
   kTVMNNVMLast = 20U,
   // The following section of code is used for non-reserved types.
   kTVMExtReserveEnd = 64U,
+  kTVMBFloat = 65U,

Review comment:
   I don't think you will `kTVMBFloat` to support this feature. The 
kDLBFloat flag in the runtime::DataType should be sufficient for NDArray 
contents(because the type code in the NDArray contents diverges from the TVM 
type code above the OpaqueHandle).

##
File path: include/tvm/runtime/c_runtime_api.h
##
@@ -114,6 +114,7 @@ typedef enum {
   kTVMNNVMLast = 20U,
   // The following section of code is used for non-reserved types.
   kTVMExtReserveEnd = 64U,
+  kTVMBFloat = 65U,

Review comment:
   I don't think you will `kTVMBFloat` to support this feature. The 
kDLBFloat flag in the runtime::DataType should be sufficient for NDArray 
contents(because the runtime::DataType's type code in the NDArray contents 
diverges from the TVM type code above the OpaqueHandle).

##
File path: include/tvm/runtime/c_runtime_api.h
##
@@ -114,6 +114,7 @@ typedef enum {
   kTVMNNVMLast = 20U,
   // The following section of code is used for non-reserved types.
   kTVMExtReserveEnd = 64U,
+  kTVMBFloat = 65U,

Review comment:
   I don't think you will `kTVMBFloat` to support this feature. The 
DataType::kDLBFloat flag in the runtime::DataType should be sufficient for 
NDArray contents(because the runtime::DataType's type code in the NDArray 
contents diverges from the TVM type code above the OpaqueHandle).





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




[GitHub] [incubator-tvm] tqchen commented on pull request #5640: [RELAY][BYOC] Preserve type information in Merge Composite

2020-05-21 Thread GitBox


tqchen commented on pull request #5640:
URL: https://github.com/apache/incubator-tvm/pull/5640#issuecomment-632150545


   https://github.com/apache/incubator-tvm/pull/5641



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




[GitHub] [incubator-tvm] mbaret commented on pull request #5640: [RELAY][BYOC] Preserve type information in Merge Composite

2020-05-21 Thread GitBox


mbaret commented on pull request #5640:
URL: https://github.com/apache/incubator-tvm/pull/5640#issuecomment-632142666


   cc @comaniac @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




[GitHub] [incubator-tvm] mbaret commented on pull request #5640: [RELAY][BYOC] Preserve type information in Merge Composite

2020-05-21 Thread GitBox


mbaret commented on pull request #5640:
URL: https://github.com/apache/incubator-tvm/pull/5640#issuecomment-632142998


   Not sure I understand why the tests have failed, looks tflite related.



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




[GitHub] [incubator-tvm] tqchen commented on pull request #5641: [DOCS] Fix the QNN TFLite tutorial built

2020-05-21 Thread GitBox


tqchen commented on pull request #5641:
URL: https://github.com/apache/incubator-tvm/pull/5641#issuecomment-632141494


   We can reproduce using the CI binary version here 
https://github.com/apache/incubator-tvm/blob/master/Jenkinsfile#L47



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




[GitHub] [incubator-tvm] siju-samuel commented on pull request #5641: [DOCS] Fix the QNN TFLite tutorial built

2020-05-21 Thread GitBox


siju-samuel commented on pull request #5641:
URL: https://github.com/apache/incubator-tvm/pull/5641#issuecomment-632141029


   Thanks @tqchen.
   Our CI is running with tf 2.1 version, right? 
   Anything need to updated for spinhx as well after upgrading tf version?



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




[GitHub] [incubator-tvm] tqchen commented on pull request #5595: [TUTORIAL]TFLite QNN Tutorial

2020-05-21 Thread GitBox


tqchen commented on pull request #5595:
URL: https://github.com/apache/incubator-tvm/pull/5595#issuecomment-632138449


   FYI, this PR has a problem that was not catched by the CI(due to another 
problem in sphinx gallery), see 
https://github.com/apache/incubator-tvm/pull/5641.
   
   We will enhance the CI checker, but please also make sure also to run the 
tutorial in the ci env :)



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




[GitHub] [incubator-tvm] tqchen opened a new pull request #5641: [DOCS] Fix the QNN TFLite tutorial built

2020-05-21 Thread GitBox


tqchen opened a new pull request #5641:
URL: https://github.com/apache/incubator-tvm/pull/5641


   Slipped through in https://github.com/apache/incubator-tvm/pull/5595.
   
   Partly was due to flaws in sphinx gallery'e error reporting  mechanism, will 
open a new PR to enhance the that part later.



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




[GitHub] [incubator-tvm] tqchen commented on pull request #5641: [DOCS] Fix the QNN TFLite tutorial built

2020-05-21 Thread GitBox


tqchen commented on pull request #5641:
URL: https://github.com/apache/incubator-tvm/pull/5641#issuecomment-632137071


   cc @masahi @siju-samuel @tmoreau89 @ZihengJiang 



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




[incubator-tvm] 01/01: Revert "[TUTORIAL]TFLite QNN Tutorial (#5595)"

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

tqchen pushed a commit to branch revert-5595-tutorial_tflite
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git

commit e7b24ca3c983f198fa566ed4dd4e894029db0d3c
Author: Tianqi Chen 
AuthorDate: Thu May 21 07:50:49 2020 -0700

Revert "[TUTORIAL]TFLite QNN Tutorial (#5595)"

This reverts commit 019da5dae15d2bd13536673ab689203c799629f0.
---
 tutorials/frontend/deploy_prequantized_tflite.py | 251 ---
 1 file changed, 251 deletions(-)

diff --git a/tutorials/frontend/deploy_prequantized_tflite.py 
b/tutorials/frontend/deploy_prequantized_tflite.py
deleted file mode 100644
index f6c4544..000
--- a/tutorials/frontend/deploy_prequantized_tflite.py
+++ /dev/null
@@ -1,251 +0,0 @@
-# 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.
-"""
-Deploy a Framework-prequantized Model with TVM - Part 3 (TFLite)
-
-**Author**: `Siju Samuel `_
-Welcome to part 3 of the Deploy Framework-Prequantized Model with TVM tutorial.
-In this part, we will start with a Quantized TFLite graph and then compile and 
execute it via TVM.
-
-
-For more details on quantizing the model using TFLite, readers are encouraged 
to
-go through `Converting Quantized Models
-`_.
-
-The TFLite models can be downloaded from this `link
-`_.
-
-To get started, Tensorflow and TFLite package needs to be installed as 
prerequisite.
-
-.. code-block:: bash
-
-# install tensorflow and tflite
-pip install tensorflow==2.1.0
-pip install tflite==2.1.0
-
-Now please check if TFLite package is installed successfully, ``python -c 
"import tflite"``
-
-"""
-
-###
-# Necessary imports
-# -
-import os
-
-import numpy as np
-import tflite
-
-import tvm
-from tvm import relay
-
-
-##
-# Download pretrained Quantized TFLite model
-# --
-
-# Download mobilenet V2 TFLite model provided by Google
-from tvm.contrib.download import download_testdata
-
-model_url = "https://storage.googleapis.com/download.tensorflow.org/models/; \
- "tflite_11_05_08/mobilenet_v2_1.0_224_quant.tgz"
-
-# Download model tar file and extract it to get mobilenet_v2_1.0_224.tflite
-model_path = download_testdata(model_url, "mobilenet_v2_1.0_224_quant.tgz",
-   module=['tf', 'official'])
-model_dir = os.path.dirname(model_path)
-
-
-##
-# Utils for downloading and extracting zip files
-# --
-def extract(path):
-import tarfile
-if path.endswith("tgz") or path.endswith("gz"):
-dir_path = os.path.dirname(path)
-tar = tarfile.open(path)
-tar.extractall(path=dir_path)
-tar.close()
-else:
-raise RuntimeError('Could not decompress the file: ' + path)
-
-extract(model_path)
-
-
-##
-# Load a test image
-# -
-
-###
-# Get a real image for e2e testing
-# 
-def get_real_image(im_height, im_width):
-from PIL import Image
-repo_base = 
'https://github.com/dmlc/web-data/raw/master/tensorflow/models/InceptionV1/'
-img_name = 'elephant-299.jpg'
-image_url = os.path.join(repo_base, img_name)
-img_path = download_testdata(image_url, img_name, module='data')
-image = Image.open(img_path).resize((im_height, im_width))
-x = np.array(image).astype('uint8')
-data = np.reshape(x, (1, im_height, im_width, 3))
-return data
-
-data = get_real_image(224, 224)
-
-##
-# Load a tflite model
-# ---
-
-##
-# 

[incubator-tvm] branch revert-5595-tutorial_tflite created (now e7b24ca)

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

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


  at e7b24ca  Revert "[TUTORIAL]TFLite QNN Tutorial (#5595)"

This branch includes the following new commits:

 new e7b24ca  Revert "[TUTORIAL]TFLite QNN Tutorial (#5595)"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[GitHub] [incubator-tvm] dhruvaray commented on pull request #5329: [Frontend][TFLite] Add parser support for shape and range

2020-05-21 Thread GitBox


dhruvaray commented on pull request #5329:
URL: https://github.com/apache/incubator-tvm/pull/5329#issuecomment-632091871


   @siju-samuel : Range returns dynamic tensors and graph does not support 
that...



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

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




[GitHub] [incubator-tvm] mbaret opened a new pull request #5640: [RELAY][BYOC] Preserve type information in Merge Composite

2020-05-21 Thread GitBox


mbaret opened a new pull request #5640:
URL: https://github.com/apache/incubator-tvm/pull/5640


   Keep the type information when extracting patterns so that it can be used as 
part of 'check' functions. The is needed for cases where a pattern may only be 
supported if tensors are of certain shapes/sizes.



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




  1   2   >