[incubator-tvm] branch master updated: upstream (#6436)

2020-09-11 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

jroesch 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 9b0e37a  upstream (#6436)
9b0e37a is described below

commit 9b0e37a42de0f4cb0efcaa907bfa54d61f1c3faf
Author: 雾雨魔理沙 
AuthorDate: Fri Sep 11 17:00:50 2020 -0700

upstream (#6436)
---
 src/relay/transforms/fold_constant.cc | 16 
 1 file changed, 16 insertions(+)

diff --git a/src/relay/transforms/fold_constant.cc 
b/src/relay/transforms/fold_constant.cc
index 0a1f173..a3f2f69 100644
--- a/src/relay/transforms/fold_constant.cc
+++ b/src/relay/transforms/fold_constant.cc
@@ -105,7 +105,23 @@ class ConstantFolder : public ExprMutator {
 }
   }
 
+  bool inside_primitive = false;
+  Expr VisitExpr_(const FunctionNode* op) final {
+if (op->HasNonzeroAttr(attr::kPrimitive)) {
+  CHECK_EQ(inside_primitive, false);
+  inside_primitive = true;
+  auto ret = ExprMutator::VisitExpr_(op);
+  inside_primitive = false;
+  return ret;
+} else {
+  return ExprMutator::VisitExpr_(op);
+}
+  }
+
   Expr VisitExpr_(const CallNode* call) final {
+if (inside_primitive) {
+  return GetRef(call);
+}
 static auto op_stateful = Op::GetAttrMap("TOpIsStateful");
 
 std::unordered_set skip_list{"zeros_like", "ones_like", 
"full_like", "full"};



[incubator-tvm] branch ci-docker-staging updated (b8f37ee -> 39c1f56)

2020-09-11 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

jroesch pushed a change to branch ci-docker-staging
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git.


from b8f37ee  [BYOC][JSON] Support input nodes with multiple entries (#6368)
 add 4fc320a  [Relay] support i64 indices (#6143)
 add 9a42cb6  add missing dependency (#6375)
 add 6ed242e  [Relay] Enhance relay.split(), allow splitted dim to be 
dynamic (#6289)
 add bbcecc9  acquire gil while finalizing PackedFunc (#6378)
 add c0cbc11  [Torch] Support logsumexp, clean up unnecessary infer_shape 
usage (#6374)
 add dd9282f  [RUNTIME][CRT] use macro to replace hardcode number (#6365)
 add 693c0de  [RELAY] Fix the FoldConstant Regression for VTA (#6377)
 add b235e59  [TESTS] Refactor tests to run on either the GPU or CPU. 
(#6331)
 add 19de625  Make docs build again when not everything is enabled (#6386)
 add 6770d28  [Frontend][TensorFlow] Improve TensorFlow control flow nodes 
ordering (#6387)
 add 237b4c1  [TFLite] Support for 'SAME' Padding option for TRANSPOSE_CONV 
operator of TFLite. (#6381)
 add 12d66d4  [DOCS] Fix the docker binary cache location (#6390)
 add 1224d56  [RELAY][VM] Enable heterogeneous execution for Relay VM 
(#6337)
 add 5262765  [Bugfix][Printer] Avoid adding annotation twice for 
ConstantNode (#6364)
 add 17d39fb  [Relay] Fix Type Arguments not Attached (#6385)
 add af69e1c  [CI][Contrib] Add Vitis-AI docker installation (#6342)
 add a2db689  [METAL] Use CFBridgeRetain for retaining the allocated 
resource (#6393)
 add 86fa81c  [RELAY][DYN] Dynamic UpSampling3D Op (#6353)
 add 8508ec3  [Relay/topi] Support scalar inputs in where op (#6383)
 add e382b16  Remove unintentional pytest dependency. Fix #6398 (#6399)
 add 73d9e01  Add safe up/downcasting to the Rust object system (#6384)
 add 3451ccb  [VTA][Xilinx] Update to Vivado 2020.1 and Pynq 2.5 (#6402)
 add 9aa69e2  [TARGET] Add layout_transform, clip and expand_dims in onnx 
converter (#6366)
 add 3004285  [Fix] fix compilation error when setting USE_RELAY_DEBUG 
(#6380)
 add 4b48d89  iadd conv2d_transpose alter layout (#6358)
 add 656b4c5  reshape with non constant shape argument (#6411)
 add 7f7df05  [ONNX] Add Clip importer to handle when min/max are provided 
as inputs. (#6251)
 add d08eb9a  [TESTING] Fix the error when running tests with default 
targets (#6394)
 add 9f2a90b  bugfix: "verify" call parameter name changed (#6382)
 add 6f8e875  [Torch] Miscellaneous fix, enable some VM GPU tests (#6418)
 add 14f0042  [TFLite] Implemented MATRIX_DIAG Operator for TFLite. (#6397)
 add 718a9a7  Remove comparison of unsigned expression < 0 warning (#6319)
 add eee413f  Dynamic Strided Slice (#6316)
 add 84fa626  [AutoTVM][Ansor] Enable random fill and CPU cache flush for 
AutoTVM and Ansor (#6391)
 add 82c1c73  [PASS][ConvertLayout] Fixes AttributeError during 
ConvertLayout to NHWC (#6419)
 add 8499d58  [Ansor][AutoTVM v2.0] Phase 2: Layout Rewrite in 
AutoScheduler (#6297)
 add 50adbfa  [RELAY][REFACTOR] Mix mode context analysis (#6403)
 add 502f79d  Switch Windows CI to build Release instead of Debug (#6427)
 add 97ab77e  [RELAY] Allow StructuralEqual/Hash via Var.vid (#6424)
 add 29cf2e0  Address issue #6415 using compiler-rt half-float function. 
(#6431)
 add fdef79d  hot fix (#6434)
 add 8705cea  [Relay, Torch] Fix stack op axis check, support torch::stack 
conversion for a static list  (#6433)
 add 3a4e61a  [METAL] set MTLBuffer purgeable state (#6376) (#6438)
 add b05aa96  [Rust] Improve the error reporting in build.rs files by using 
anyhow. (#6401)
 add 6b6661e  [Target] Tags, Composite Target, Unified Interface (#6369)
 add e6374dc  Fix broadcast shape (#6422)
 add b81bdee  [Relay] Add Defunctionalization Pass  (#6400)
 add aeef16d  [QNN][Relay] Fixed bug in quantized conv2d. (#6420)
 add ecba2f3  [Relay][Op] Fix Reshape Compute (#6396)
 add 355720e  CUDA: broaden path detection (#6444)
 add 1228111  [Relay][Topi][Op]Advanced indexing (#6388)
 add 01460e0  ROCm: use GcnArch for mcpu and ApiVersion to select code 
object version (#6447)
 add 2d6f471  Add black to lint docker image
 new 39c1f56  Update tag

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.


Summary of changes:
 .github/workflows/main.yml |  10 +-
 .gitignore |   3 +
 3rdparty/vta-hw|   2 +-
 CMakeLists.txt |   5 +
 Jenkinsfile|   3 +-
 apps/benchmark/gpu_imagenet_benc

[incubator-tvm] 01/01: Update tag

2020-09-11 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

jroesch pushed a commit to branch ci-docker-staging
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git

commit 39c1f5629419318dfb8fa9672fd779ea95d68045
Author: Jared Roesch 
AuthorDate: Fri Sep 11 11:43:50 2020 -0700

Update tag
---
 Jenkinsfile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 3ce5b60..aeac271 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -44,7 +44,8 @@
 //
 
 // NOTE: these lines are scanned by docker/dev_common.sh. Please update the 
regex as needed. -->
-ci_lint = "tlcpack/ci-lint:v0.61"
+// ci_lint = "tlcpack/ci-lint:v0.61"
+ci_lint = "tlcpack/ci-lint:v0.62.d31cc37f8568-t0"
 ci_gpu = "tlcpack/ci-gpu:v0.64"
 ci_cpu = "tlcpack/ci-cpu:v0.65"
 ci_wasm = "tlcpack/ci-wasm:v0.60"



[incubator-tvm] branch master updated (e382b16 -> 73d9e01)

2020-09-04 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from e382b16  Remove unintentional pytest dependency. Fix #6398 (#6399)
 add 73d9e01  Add safe up/downcasting to the Rust object system (#6384)

No new revisions were added by this update.

Summary of changes:
 rust/tvm-macros/src/object.rs| 119 +--
 rust/tvm-macros/src/util.rs  |  18 ++
 rust/tvm-rt/src/array.rs |   7 +--
 rust/tvm-rt/src/map.rs   |   9 +--
 rust/tvm-rt/src/object/mod.rs| 110 +---
 rust/tvm-rt/src/object/object_ptr.rs |  62 --
 rust/tvm-rt/src/string.rs|  25 +++-
 rust/tvm/src/ir/mod.rs   |   2 +-
 rust/tvm/src/ir/relay/mod.rs |   2 +-
 rust/tvm/src/ir/tir.rs   |  14 +
 10 files changed, 178 insertions(+), 190 deletions(-)



[incubator-tvm] branch master updated (4c9a391 -> c899b3c)

2020-08-28 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 4c9a391  quanitze operation expanded to take const argument (#6127)
 add c899b3c  Improve Rust bindings: Map, Array, String, various IR nodes 
(#6339)

No new revisions were added by this update.

Summary of changes:
 rust/tvm-macros/src/object.rs  |   6 +-
 rust/tvm-rt/src/array.rs   |  45 +++-
 rust/tvm-rt/src/function.rs|   2 +-
 rust/tvm-rt/src/lib.rs |   1 +
 rust/tvm-rt/src/map.rs | 264 +
 rust/tvm-rt/src/object/mod.rs  |   4 +
 rust/tvm-rt/src/object/object_ptr.rs   |   4 +-
 rust/tvm-rt/src/string.rs  | 118 ++---
 rust/tvm-sys/src/datatype.rs   |   3 +-
 rust/tvm-sys/src/packed_func.rs|  31 +++
 .../bytearray_test.go => rust/tvm/src/ir/arith.rs  |  46 ++--
 rust/tvm/src/ir/mod.rs |  40 +++-
 rust/tvm/src/ir/relay/mod.rs   |  10 +-
 rust/tvm/src/ir/tir.rs |  93 
 rust/tvm/src/transform.rs  |  32 ++-
 15 files changed, 619 insertions(+), 80 deletions(-)
 create mode 100644 rust/tvm-rt/src/map.rs
 copy golang/src/bytearray_test.go => rust/tvm/src/ir/arith.rs (52%)
 create mode 100644 rust/tvm/src/ir/tir.rs



[incubator-tvm] branch master updated: [Relay][Training] Make AutoDiff thread through global function. (#6336)

2020-08-27 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

jroesch 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 e35b7fc  [Relay][Training] Make AutoDiff thread through global 
function. (#6336)
e35b7fc is described below

commit e35b7fc4bcdcfe008c5dfea60c2297b93dbff99e
Author: 雾雨魔理沙 
AuthorDate: Thu Aug 27 11:32:40 2020 -0700

[Relay][Training] Make AutoDiff thread through global function. (#6336)

* save

* lint

* lint

* fix warning

* fix test

* save
---
 src/printer/doc.cc   |   2 +-
 src/relay/transforms/gradient.cc | 106 ---
 tests/python/relay/test_pass_gradient.py |  41 +++-
 3 files changed, 124 insertions(+), 25 deletions(-)

diff --git a/src/printer/doc.cc b/src/printer/doc.cc
index d487e3e..ab1eddb 100644
--- a/src/printer/doc.cc
+++ b/src/printer/doc.cc
@@ -129,7 +129,7 @@ Doc Doc::Indent(int indent, Doc doc) {
 }
 
 Doc Doc::StrLiteral(const std::string& value, std::string quote) {
-  // TODO(M.K.): add escape.
+  // TODO(@M.K.): add escape.
   Doc doc;
   return doc << quote << value << quote;
 }
diff --git a/src/relay/transforms/gradient.cc b/src/relay/transforms/gradient.cc
index 7894c34..9c47254 100644
--- a/src/relay/transforms/gradient.cc
+++ b/src/relay/transforms/gradient.cc
@@ -72,7 +72,7 @@ Type WithGradientType(const Type&);
 Expr FirstOrderGradient(const Expr& e, const Optional& mod);
 
 Type WithGradientType(const Type& t) {
-  // TODO(M.K.): stricter checking
+  // TODO(@M.K.): stricter checking
   auto ty = t.as();
   CHECK(ty) << "input should be a function";
   return FuncType(ty->arg_types, TupleType({ty->ret_type, 
TupleType(ty->arg_types)}), {}, {});
@@ -85,7 +85,7 @@ Expr DeGlobal(const Optional& mod, const Expr& e) {
   if (mod.defined() && x) {
 BaseFunc base_func = mod.value()->Lookup(GetRef(x));
 if (auto* n = base_func.as()) {
-  return n->body;
+  return GetRef(n);
 } else {
   return e;
 }
@@ -338,11 +338,22 @@ Expr FirstOrderGradient(const Expr& re, const 
Optional& mod) {
 
 
TVM_REGISTER_GLOBAL("relay._transform.first_order_gradient").set_body_typed(FirstOrderGradient);
 
+Type bpt = RelayRefType(FuncType({}, TupleType(Array()), {}, {}));
+
 struct ReverseADType : TypeMutator {
   Type VisitType_(const TensorTypeNode* ttn) final {
 Type t = GetRef(ttn);
 return TupleType({t, RelayRefType(t)});
   }
+
+  Type VisitType_(const FuncTypeNode* ftn) final {
+std::vector arg_types;
+for (const auto& t : ftn->arg_types) {
+  arg_types.push_back(VisitType(t));
+}
+arg_types.push_back(bpt);
+return FuncType(arg_types, ftn->ret_type, ftn->type_params, 
ftn->type_constraints);
+  }
 };
 
 Type ReverseType(const Type& t) { return ReverseADType()(t); }
@@ -438,12 +449,18 @@ Expr BPEmpty() {
 
 struct ReverseAD : ExprMutator {
   using ADVarMap = std::unordered_map;
-
+  using ADGlobalVarMap = std::unordered_map;
+  Optional mod;
+  // TODO(@M.K.) refactor AD to always use mod.
   Var bp;
   std::shared_ptr ad_vars;
+  std::shared_ptr ad_gvars;
   const OpAttrMap rev_map = 
Op::GetAttrMap("FPrimalGradient");
 
-  explicit ReverseAD(const Var& bp, std::shared_ptr ad_vars) : 
bp(bp), ad_vars(ad_vars) {}
+  explicit ReverseAD(const Optional& mod, const Var& bp,
+ const std::shared_ptr& ad_vars,
+ const std::shared_ptr& ad_gvars)
+  : mod(mod), bp(bp), ad_vars(ad_vars), ad_gvars(ad_gvars) {}
 
   Expr VisitExpr_(const OpNode* op) final {
 LOG(FATAL) << "op should only be inside call";
@@ -481,9 +498,8 @@ struct ReverseAD : ExprMutator {
   Expr nbp = Function({}, LetList::With([&](LetList* ll) {
 // we need a new ReverseAD visitor to avoid 
clobbering the bp local var
 auto dup_bp = ll->Push(BPEmpty());
-ReverseAD dup_diff(dup_bp, ad_vars);
-auto dup_ad = 
ll->Push(dup_diff.VisitExpr(DeDup(x)));
-
+auto dup_ad =
+ll->Push(ReverseAD(mod, dup_bp, ad_vars, 
ad_gvars)(DeDup(x)));
 TransferGrads(call->checked_type(), ret, dup_ad, 
ll);
 ll->Push(Call(RefRead(dup_bp), {}));
 return Call(bpv, {});
@@ -518,22 +534,29 @@ struct ReverseAD : ExprMutator {
 orig_var->checked_type_ = call->checked_type();
 auto ret = ll->Push(GetRev(call->checked_type(), orig_var, ll));
 auto bpv = ll->Push(RefRead(bp));
- 

[incubator-tvm] branch master updated (942c90b -> 4910c8c)

2020-08-26 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 942c90b  [DYN][RELAY] Resize support for NCHW-convertible layouts 
(#6293)
 add 4910c8c  [MSVC] Make able to compile with MSVC (#6341)

No new revisions were added by this update.

Summary of changes:
 src/target/llvm/codegen_hexagon.cc | 2 +-
 src/te/autodiff/ad_simplify.cc | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)



[incubator-tvm] branch master updated (617949d -> 942c90b)

2020-08-26 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 617949d  Use auto-tuner to improve conv2d_gemm performance (#6117)
 add 942c90b  [DYN][RELAY] Resize support for NCHW-convertible layouts 
(#6293)

No new revisions were added by this update.

Summary of changes:
 python/tvm/relay/op/dyn/image/_image.py | 34 ++---
 1 file changed, 14 insertions(+), 20 deletions(-)



[incubator-tvm] branch master updated (751982e -> 1a26a2e)

2020-08-25 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 751982e  [FIX][VM] Fix relay vm optimize (#6322)
 add 1a26a2e  [Relay] Make check stricter by using Feature. Fixed multiple 
bugs. (#6326)

No new revisions were added by this update.

Summary of changes:
 include/tvm/relay/feature.h|  34 +++
 include/tvm/relay/transform.h  |   9 ++
 python/tvm/relay/prelude.py|  16 +--
 python/tvm/relay/transform/transform.py|  17 +++-
 src/relay/analysis/feature.cc  |  51 +-
 src/relay/transforms/gradient.cc   |  55 ---
 src/relay/transforms/lazy_gradient_init.cc | 107 -
 src/relay/transforms/partial_eval.cc   |   5 +-
 src/relay/transforms/pass_util.h   |   3 +-
 src/relay/transforms/to_a_normal_form.cc   |  62 ++--
 src/relay/transforms/to_cps.cc |   3 +
 tests/python/relay/test_analysis_feature.py|   2 -
 tests/python/relay/test_op_grad_level10.py |  14 ++-
 tests/python/relay/test_pass_gradient.py   |  24 -
 tests/python/relay/test_pass_lazy_gradient_init.py |  18 
 tests/python/relay/test_pass_merge_composite.py|  16 +--
 tests/python/relay/test_pass_partial_eval.py   |  25 +
 17 files changed, 291 insertions(+), 170 deletions(-)



[incubator-tvm] branch master updated (4b2c01a -> 37912a1)

2020-08-14 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 4b2c01a  [Parser] Add support for parsing the any dimension.  (#6277)
 add 37912a1  [TESTS] Decrease test times by introducing testing model 
(#6235)

No new revisions were added by this update.

Summary of changes:
 python/tvm/relay/testing/__init__.py   |   1 +
 python/tvm/relay/testing/init.py   |  10 ++
 python/tvm/relay/testing/synthetic.py  | 120 +
 tests/micro/test_runtime_micro_on_arm.py   |   1 -
 .../relay/test_analysis_extract_fused_functions.py |   4 +-
 tests/python/relay/test_change_batch.py|  10 +-
 tests/python/relay/test_pass_auto_quantize.py  |  13 +--
 tests/python/relay/test_vm.py  |   2 +-
 tests/python/relay/test_vm_serialization.py|   9 +-
 .../unittest/test_autotvm_graph_tuner_utils.py |   4 +-
 tests/python/unittest/test_runtime_micro.py|   1 -
 .../test_runtime_module_based_interface.py |  61 ++-
 .../python/unittest/test_runtime_module_export.py  |  30 +++---
 tests/python/unittest/test_target_codegen_blob.py  |  16 +--
 14 files changed, 209 insertions(+), 73 deletions(-)
 create mode 100644 python/tvm/relay/testing/synthetic.py



[incubator-tvm] branch master updated (75b8318 -> fa2213f)

2020-08-11 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 75b8318  [Ansor][AutoTVM v2.0] Phase 2: Basic CPU Sketch Search Policy 
(#6184)
 add fa2213f  [Parser] Parser 2.0 part 2  (#6162)

No new revisions were added by this update.

Summary of changes:
 .gitignore  |4 -
 CMakeLists.txt  |3 -
 cmake/modules/ANTLR.cmake   |   40 -
 cmake/util/FindANTLR.cmake  |   65 -
 docker/Dockerfile.ci_cpu|3 -
 docker/Dockerfile.ci_gpu|3 -
 docker/Dockerfile.ci_wasm   |3 -
 docker/install/ubuntu_install_antlr.sh  |   25 -
 docker/install/ubuntu_install_python_package.sh |2 +-
 docs/README.txt |4 +-
 docs/install/from_source.rst|7 -
 include/tvm/ir/attrs.h  |3 +-
 include/tvm/ir/span.h   |   19 +-
 include/tvm/parser/parser.h |2 +-
 include/tvm/parser/source_map.h |  110 +
 include/tvm/relay/adt.h |3 +-
 include/tvm/relay/expr.h|   40 +-
 include/tvm/relay/expr_functor.h|1 +
 include/tvm/relay/function.h|3 +-
 python/setup.py |3 +-
 python/tvm/error.py |7 +
 python/tvm/ir/base.py   |4 +-
 python/tvm/parser/__init__.py   |2 +-
 python/tvm/relay/__init__.py|6 +-
 python/tvm/relay/_parser.py |  771 -
 python/tvm/relay/expr.py|2 +-
 python/tvm/relay/grammar/.gitignore |1 -
 python/tvm/relay/grammar/Relay.g4   |  199 --
 python/tvm/relay/grammar/__init__.py|   16 -
 python/tvm/relay/grammar/py3/.gitattributes |3 -
 python/tvm/relay/grammar/py3/RelayLexer.py  |  256 --
 python/tvm/relay/grammar/py3/RelayParser.py | 3732 ---
 python/tvm/relay/grammar/py3/RelayVisitor.py|  343 ---
 python/tvm/relay/grammar/py3/__init__.py|   16 -
 python/tvm/relay/parser.py  |   30 -
 python/tvm/relay/std/core.rly   |3 +-
 python/tvm/relay/std/gradient.rly   |3 +-
 python/tvm/relay/std/prelude.rly|6 +-
 src/ir/module.cc|6 +-
 src/ir/span.cc  |   26 +-
 src/parser/diagnostic.h |  179 +-
 src/parser/meta_ref.cc  |  100 +
 src/parser/meta_ref.h   |   85 +
 src/parser/op_table.h   |   20 +-
 src/parser/parser.cc|  832 +++--
 src/parser/source_map.cc|  113 +
 src/parser/token.h  |  349 ++-
 src/parser/tokenizer.h  |  306 +-
 src/printer/relay_text_printer.cc   |7 +-
 src/printer/text_printer.cc |   16 +-
 src/printer/text_printer.h  |   18 +-
 src/relay/ir/adt.cc |3 +-
 src/relay/ir/expr.cc|   30 +-
 src/relay/ir/expr_functor.cc|   62 +-
 src/relay/ir/function.cc|3 +-
 src/relay/transforms/type_infer.cc  |   16 +-
 src/runtime/graph/graph_runtime.h   |1 +
 tests/lint/rat-excludes |5 -
 tests/python/relay/test_ir_nodes.py |   12 +-
 tests/python/relay/test_ir_parser.py|  320 +-
 tests/python/relay/test_ir_parser2.py   |  891 --
 tests/python/relay/test_ir_text_printer.py  |   75 +-
 tests/python/relay/test_op_level10.py   |8 +-
 tests/python/relay/test_pass_eta_expand.py  |   24 +-
 tests/python/relay/test_pass_unmatched_cases.py |4 +-
 65 files changed, 1902 insertions(+), 7352 deletions(-)
 delete mode 100644 cmake/modules/ANTLR.cmake
 delete mode 100644 cmake/util/FindANTLR.cmake
 delete mode 100755 docker/install/ubuntu_install_antlr.sh
 create mode 100644 include/tvm/parser/source_map.h
 delete mode 100644 python/tvm/relay/_parser.py
 delete mode 100644 python/tvm/relay/grammar/.gitignore
 delete mode 100644 python/tvm/relay/grammar/Relay.g4
 delete mode 100644 python/tvm/relay/grammar/__init__.py
 delete mode 100644 python/tvm/relay/grammar/py3/.gitattributes
 delete mode 100644 python/tvm/relay/grammar/py3/RelayLexer.py
 delete mode 100644 python/tvm/relay/grammar/py3/RelayParser.py
 delete mode 100644 python/tvm/relay/grammar/py3/RelayVisitor.py
 delete mode 100644 python/tvm

[incubator-tvm] branch master updated (6dbc344 -> 0a1c4c2)

2020-07-23 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 6dbc344  [RELAY][Fix] i64 indices (#5235)
 add 0a1c4c2  [Rust] Some rust cleanups (#6116)

No new revisions were added by this update.

Summary of changes:
 rust/tvm-graph-rt/Cargo.toml|  5 ++-
 rust/tvm-graph-rt/src/array.rs  | 20 +-
 rust/tvm-graph-rt/src/errors.rs | 37 ++
 rust/tvm-graph-rt/src/graph.rs  | 51 ++---
 rust/tvm-graph-rt/src/module/dso.rs |  2 +-
 rust/tvm-graph-rt/src/threading.rs  |  2 +-
 rust/tvm-graph-rt/src/workspace.rs  | 13 ---
 rust/tvm-graph-rt/tests/test_wasm32/src/main.rs |  4 +-
 rust/tvm-macros/Cargo.toml  |  2 +-
 rust/tvm-rt/src/object/object_ptr.rs| 33 +++-
 rust/tvm-sys/Cargo.toml |  2 +-
 11 files changed, 98 insertions(+), 73 deletions(-)



[incubator-tvm] branch master updated (5046ff2 -> 06d7565)

2020-07-23 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 5046ff2  [DOCS][REFACTOR] Organize Design and Architectures (#6097)
 add 06d7565  [Rust] Clean up conversions between TVM and Rust functions 
(#6114)

No new revisions were added by this update.

Summary of changes:
 rust/tvm-macros/src/external.rs |   2 +-
 rust/tvm-rt/README.md   |   2 +-
 rust/tvm-rt/src/function.rs |  42 ++---
 rust/tvm-rt/src/lib.rs  |   1 -
 rust/tvm-rt/src/to_boxed_fn.rs  | 138 ---
 rust/tvm-rt/src/to_function.rs  | 200 +---
 6 files changed, 94 insertions(+), 291 deletions(-)
 delete mode 100644 rust/tvm-rt/src/to_boxed_fn.rs



[incubator-tvm] branch master updated: [REFACTOR][RELAY] Move invoke_tvm_op and shape_func to vm dialect (#5958)

2020-07-10 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

jroesch 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 ba04c6a  [REFACTOR][RELAY] Move invoke_tvm_op and shape_func to vm 
dialect (#5958)
ba04c6a is described below

commit ba04c6a393371d539ea8ee417520c7909521a370
Author: Zhi <5145158+zhi...@users.noreply.github.com>
AuthorDate: Fri Jul 10 11:03:23 2020 -0700

[REFACTOR][RELAY] Move invoke_tvm_op and shape_func to vm dialect (#5958)

* [REFACTOR][RELAY] Move invoke_tvm_op and shape_func to vm dialect

* address comments
---
 include/tvm/relay/attrs/memory.h   |  13 ---
 include/tvm/relay/attrs/vm.h   |  47 +++
 python/tvm/relay/op/__init__.py|   2 +-
 python/tvm/relay/op/memory/memory.py   |  40 -
 python/tvm/relay/op/vm/__init__.py |   2 +-
 python/tvm/relay/op/vm/vm.py   |  48 +++
 python/tvm/relay/transform/memory_alloc.py |   4 +-
 src/relay/backend/vm/compiler.cc   |   4 +-
 src/relay/op/memory/memory.cc  | 124 
 src/relay/op/vm/vm.cc  | 127 +
 src/relay/transforms/fold_constant.cc  |   4 +-
 11 files changed, 230 insertions(+), 185 deletions(-)

diff --git a/include/tvm/relay/attrs/memory.h b/include/tvm/relay/attrs/memory.h
index 7429c39..b737103 100644
--- a/include/tvm/relay/attrs/memory.h
+++ b/include/tvm/relay/attrs/memory.h
@@ -74,19 +74,6 @@ struct AllocTensorAttrs : public 
tvm::AttrsNode {
   }
 };
 
-/*!
- * \brief Options for the shape function operator.
- */
-struct ShapeFuncAttrs : public tvm::AttrsNode {
-  Array is_input;
-
-  TVM_DECLARE_ATTRS(ShapeFuncAttrs, "relay.attrs.ShapeFuncAttrs") {
-TVM_ATTR_FIELD(is_input).describe(
-"A bool indicating whether the shape function should"
-"expect shape or input in each position.");
-  }
-};
-
 }  // namespace relay
 }  // namespace tvm
 #endif  // TVM_RELAY_ATTRS_MEMORY_H_
diff --git a/include/tvm/relay/attrs/vm.h b/include/tvm/relay/attrs/vm.h
new file mode 100644
index 000..9144f47
--- /dev/null
+++ b/include/tvm/relay/attrs/vm.h
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file tvm/relay/attrs/vm.h
+ * \brief Attributes for Relay vm operators.
+ */
+#ifndef TVM_RELAY_ATTRS_VM_H_
+#define TVM_RELAY_ATTRS_VM_H_
+
+#include 
+
+namespace tvm {
+namespace relay {
+
+/*!
+ * \brief Options for the shape function operator.
+ */
+struct ShapeFuncAttrs : public tvm::AttrsNode {
+  Array is_input;
+
+  TVM_DECLARE_ATTRS(ShapeFuncAttrs, "relay.attrs.ShapeFuncAttrs") {
+TVM_ATTR_FIELD(is_input).describe(
+"A bool indicating whether the shape function should"
+"expect shape or input in each position.");
+  }
+};
+
+}  // namespace relay
+}  // namespace tvm
+#endif  // TVM_RELAY_ATTRS_VM_H_
diff --git a/python/tvm/relay/op/__init__.py b/python/tvm/relay/op/__init__.py
index a45d466..011042b 100644
--- a/python/tvm/relay/op/__init__.py
+++ b/python/tvm/relay/op/__init__.py
@@ -27,7 +27,7 @@ from .reduce import *
 from .tensor import *
 from .transform import *
 from .algorithm import *
-from .vm import *
+from . import vm
 from . import nn
 from . import annotation
 from . import memory
diff --git a/python/tvm/relay/op/memory/memory.py 
b/python/tvm/relay/op/memory/memory.py
index 4092545..b426a0e 100644
--- a/python/tvm/relay/op/memory/memory.py
+++ b/python/tvm/relay/op/memory/memory.py
@@ -19,27 +19,6 @@
 from __future__ import absolute_import as _abs
 from . import _make
 
-def invoke_tvm_op(func, inputs, outputs):
-"""Call a primitive function with the TVM operator calling convention.
-
-Parameters
---
-func : tvm.relay.Expr
-The input expr.
-
-inputs : tvm.relay.Expr
-A tuple of the inputs to pass to the TVM function.
-
-outputs : tvm.relay.Expr
-A tuple of the outputs to pass to the TVM fu

[incubator-tvm] branch master updated (ef9bf7d -> aa84ee2)

2020-06-23 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from ef9bf7d  Fix the python intrin rule (#5895)
 add aa84ee2  Rust Refactor Stage 4: Rewrite Rust graph runtime to use new 
APIs (#5830)

No new revisions were added by this update.

Summary of changes:
 rust/Cargo.toml|  5 ++
 rust/runtime/src/graph.rs  |  1 +
 rust/{runtime => tvm-graph-rt}/Cargo.toml  | 13 ++--
 rust/{runtime => tvm-graph-rt}/src/allocator.rs|  0
 rust/{runtime => tvm-graph-rt}/src/array.rs| 70 +-
 rust/{runtime => tvm-graph-rt}/src/errors.rs   |  2 +
 rust/{runtime => tvm-graph-rt}/src/graph.rs| 60 +--
 rust/{runtime => tvm-graph-rt}/src/lib.rs  | 23 ++-
 rust/{runtime => tvm-graph-rt}/src/module/dso.rs   |  4 +-
 rust/{runtime => tvm-graph-rt}/src/module/mod.rs   | 12 ++--
 .../{runtime => tvm-graph-rt}/src/module/syslib.rs |  4 +-
 rust/{runtime => tvm-graph-rt}/src/threading.rs|  2 +-
 rust/{runtime => tvm-graph-rt}/src/workspace.rs|  2 +-
 rust/{runtime => tvm-graph-rt}/tests/.gitignore|  0
 .../{runtime => tvm-graph-rt}/tests/build_model.py |  0
 .../tests/test_graph_serde.rs  |  0
 .../tests/test_nn/Cargo.toml   |  4 +-
 .../tests/test_nn/build.rs |  0
 .../tests/test_nn/src/build_test_graph.py  |  0
 .../tests/test_nn/src/main.rs  |  0
 .../tests/test_tvm_basic/Cargo.toml|  4 +-
 .../tests/test_tvm_basic/build.rs  |  0
 .../tests/test_tvm_basic/src/build_test_lib.py |  0
 .../tests/test_tvm_basic/src/main.rs   |  0
 .../tests/test_tvm_dso/Cargo.toml  |  4 +-
 .../tests/test_tvm_dso/build.rs|  0
 .../tests/test_tvm_dso/src/build_test_lib.py   |  0
 .../tests/test_tvm_dso/src/main.rs |  0
 .../tests/test_wasm32/.cargo/config|  0
 .../tests/test_wasm32/Cargo.toml   |  4 +-
 .../tests/test_wasm32/build.rs |  0
 .../tests/test_wasm32/src/build_test_lib.py|  0
 .../tests/test_wasm32/src/main.rs  |  0
 rust/tvm-sys/build.rs  |  1 +
 rust/tvm-sys/src/array.rs  |  1 +
 rust/tvm-sys/src/datatype.rs   | 14 -
 tests/lint/check_file_type.py  |  1 +
 37 files changed, 110 insertions(+), 121 deletions(-)
 copy rust/{runtime => tvm-graph-rt}/Cargo.toml (83%)
 copy rust/{runtime => tvm-graph-rt}/src/allocator.rs (100%)
 copy rust/{runtime => tvm-graph-rt}/src/array.rs (86%)
 copy rust/{runtime => tvm-graph-rt}/src/errors.rs (98%)
 copy rust/{runtime => tvm-graph-rt}/src/graph.rs (93%)
 copy rust/{runtime => tvm-graph-rt}/src/lib.rs (84%)
 copy rust/{runtime => tvm-graph-rt}/src/module/dso.rs (96%)
 copy rust/{runtime => tvm-graph-rt}/src/module/mod.rs (85%)
 copy rust/{runtime => tvm-graph-rt}/src/module/syslib.rs (95%)
 copy rust/{runtime => tvm-graph-rt}/src/threading.rs (99%)
 copy rust/{runtime => tvm-graph-rt}/src/workspace.rs (99%)
 copy rust/{runtime => tvm-graph-rt}/tests/.gitignore (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/build_model.py (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_graph_serde.rs (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_nn/Cargo.toml (94%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_nn/build.rs (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_nn/src/build_test_graph.py 
(100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_nn/src/main.rs (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_tvm_basic/Cargo.toml (93%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_tvm_basic/build.rs (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_tvm_basic/src/build_test_lib.py 
(100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_tvm_basic/src/main.rs (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_tvm_dso/Cargo.toml (93%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_tvm_dso/build.rs (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_tvm_dso/src/build_test_lib.py 
(100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_tvm_dso/src/main.rs (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_wasm32/.cargo/config (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_wasm32/Cargo.toml (94%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_wasm32/build.rs (100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_wasm32/src/build_test_lib.py 
(100%)
 copy rust/{runtime => tvm-graph-rt}/tests/test_wasm32/src/main.rs (100%)



[incubator-tvm] branch egg created (now d8c80c3)

2020-06-18 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


  at d8c80c3   `tvm` crate stage 3 of Rust refactor  (#5769)

No new revisions were added by this update.



[incubator-tvm] branch master updated: `tvm` crate stage 3 of Rust refactor (#5769)

2020-06-18 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

jroesch 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 d8c80c3   `tvm` crate stage 3 of Rust refactor  (#5769)
d8c80c3 is described below

commit d8c80c382f02052b07da1235190a5b6c7acea994
Author: Jared Roesch 
AuthorDate: Thu Jun 18 11:33:25 2020 -0700

 `tvm` crate stage 3 of Rust refactor  (#5769)

* Adapt to new macro

* Add tvm crate

* Fix out of tree pass with new bindings

* Super slick API working

* Add examples

* Delay egg example and add ASF headers

* Move array.rs around

* Remove outdated tests will restore in CI PR

* Fix some memory issues

* Fix ref counting issue

* Formatting and cleanup

* Remove out-of-tree for now

* Remove out-of-tree
---
 rust/Cargo.toml|   4 +-
 rust/runtime/tests/test_wasm32/Cargo.toml  |   4 +
 rust/runtime/tests/test_wasm32/build.rs|  14 +-
 rust/tvm-macros/src/external.rs|   6 +-
 rust/tvm-macros/src/object.rs  |  31 ++-
 rust/tvm-rt/src/array.rs   |  79 ++
 rust/tvm-rt/src/errors.rs  |   2 +
 rust/tvm-rt/src/function.rs|  20 +-
 rust/tvm-rt/src/lib.rs |   4 +-
 rust/tvm-rt/src/ndarray.rs |  22 +-
 rust/tvm-rt/src/object/mod.rs  |  53 ++--
 rust/tvm-rt/src/object/object_ptr.rs   | 101 ++--
 rust/tvm-rt/src/string.rs  |  42 +--
 rust/tvm-rt/src/to_function.rs |  56 ++--
 rust/tvm-sys/src/lib.rs|  12 +
 rust/tvm/.gitignore|   7 +
 .../test_wasm32/Cargo.toml => tvm/.travis.yml} |  14 +-
 rust/{runtime/tests/test_wasm32 => tvm}/Cargo.toml |  27 +-
 rust/tvm/README.md | 235 +
 rust/tvm/src/ir/mod.rs |  50 
 rust/tvm/src/ir/relay/mod.rs   | 282 +
 rust/tvm/src/lib.rs|  47 
 rust/tvm/src/runtime/mod.rs|  20 ++
 rust/tvm/src/transform.rs  |  93 +++
 src/printer/relay_text_printer.cc  |   2 -
 25 files changed, 1075 insertions(+), 152 deletions(-)

diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 6849c03..d9bb3ab 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -29,5 +29,7 @@ members = [
"frontend/tests/callback",
"frontend/examples/resnet",
"tvm-sys",
-   "tvm-rt"
+   "tvm-macros",
+   "tvm-rt",
+   "tvm",
 ]
diff --git a/rust/runtime/tests/test_wasm32/Cargo.toml 
b/rust/runtime/tests/test_wasm32/Cargo.toml
index 1d3373a..eeead45 100644
--- a/rust/runtime/tests/test_wasm32/Cargo.toml
+++ b/rust/runtime/tests/test_wasm32/Cargo.toml
@@ -20,7 +20,11 @@ name = "test-wasm32"
 version = "0.0.0"
 license = "Apache-2.0"
 authors = ["TVM Contributors"]
+edition = "2018"
 
 [dependencies]
 ndarray="0.12"
 tvm-runtime = { path = "../../" }
+
+[build-dependencies]
+anyhow = "^1.0"
diff --git a/rust/runtime/tests/test_wasm32/build.rs 
b/rust/runtime/tests/test_wasm32/build.rs
index 8b72be2..5c816c3 100644
--- a/rust/runtime/tests/test_wasm32/build.rs
+++ b/rust/runtime/tests/test_wasm32/build.rs
@@ -19,12 +19,14 @@
 
 use std::{path::PathBuf, process::Command};
 
-fn main() {
+use anyhow::{Context, Result};
+
+fn main() -> Result<()> {
 let mut out_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
 out_dir.push("lib");
 
 if !out_dir.is_dir() {
-std::fs::create_dir(_dir).unwrap();
+std::fs::create_dir(_dir).context("failed to create directory for 
WASM outputs")?;
 }
 
 let obj_file = out_dir.join("test.o");
@@ -36,7 +38,8 @@ fn main() {
 ))
 .arg(_dir)
 .output()
-.expect("Failed to execute command");
+.context("failed to execute Python script for generating TVM library")?;
+
 assert!(
 obj_file.exists(),
 "Could not build tvm lib: {}",
@@ -49,12 +52,14 @@ fn main() {
 );
 
 let ar = option_env!("LLVM_AR").unwrap_or("llvm-ar-8");
+
 let output = Command::new(ar)
 .arg("rcs")
 .arg(_file)
 .arg(_file)
 .output()
-.expect("Failed to execute command");
+.context("failed to run LLVM_AR command")?;
+
 assert!(
 lib_file.exis

[incubator-tvm] branch rust-tvm updated (caa6904 -> 43325ab)

2020-06-10 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


 discard caa6904  All tests pass
 discard 0c55c39  Finish removing anyhow and work with new external! macro
 discard 62b6d1ba Convert external macro to procmacro
 discard fc6fac2  Reworking errors and proc macros
 discard a44a379  Refactor anyhow out of the rt layer
 discard 4cf2dbc  Add tvm crate
 discard 9fc0d4a  Add tvm-rt crate
 add 95b3ad9  [PatternLang] Add ConstantPattern (#5689)
 add 2599c2c  [PYTORCH]Minor bug fixes (#5683)
 add 05b1b23  [Relay] Fix dataflow_pattern.rewrite() hang if Match in IR 
(#5680)
 add 3698d5d  [RELAY] Fix segfault in pretty print when ObjectRef is null 
(#5681)
 add ddf7190  [REFACTOR][RELAY] move fallback_device to config (#5690)
 add 3ee2270  @zhiics -> PPMC (#5692)
 add 06bf8b0  [COMMUNITY] @masahi -> PPMC (#5691)
 add a9ce2f7  Support more dtypes for TVMDSOOp (#5694)
 add ff10e6c  [ONNX]LpPool Support added (#5696)
 add 1ae7162  In memory_plan, check if value is not None, instead of just 
checking value as boolean. (#5700)
 add 2cd5117  [PatternLang]Conditionally Embedding Constants in Partitioned 
Functions (#5693)
 add 879158a  [ONNX] Skip ADD inside Gemm op when vector is zero (#5697)
 add 910edef  [BYOC] Support Tuple Output in C/DNNL Codegen (#5701)
 add c55ed37  [REFACTOR][RELAY] Replace build_config with PassContext 
(#5698)
 add 55aefc2  [PYTORCH]floor_divide support for squeezenet (#5702)
 add 12cfe4a  [AutoTVM][TOPI] Fix bifrost spatial packing conv2d auto tune 
(#5684)
 add b0959d4  [Arith] ExtendedEuclidean merge impl to int_operator (#5625)
 add f280883  fix typo: anchor windoes should be anchor windows (#5706)
 add afc239a  [REFACTOR][PY] relay.op.Op -> tvm.ir.Op (#5705)
 add 43162d6  [PatternLang] Simplify Pattern API Implementations (#5703)
 add 663a5ab  [PYTORCH]ReplicationPad support added (#5708)
 add f272e06  Remove deprecated opengl files (#5711)
 add 13277a5  Remove opengl runtime and cmake (#5712)
 add 3d06063  [BUGFIX][CRT] Fix Compilation Error in CRT (#5713)
 add 062a244  Rename tvm_dso_op to libtvm_dso_op (#5714)
 add 4347b41  [Object] Unify StrMapNode and MapNode (#5687)
 add c1f3b2f  [MXNET]Softmin, trunc op support added (#5715)
 add 927510a  Avoid downloading when TOPHUB_LOCATION is NONE (#5720)
 add 9151a51  [Object][FFI] Introduce runtime::String::CanConvertFrom 
(#5718)
 add 64ac555  [Object] Restore the StrMap behavior in JSON/SHash/SEqual 
(#5719)
 add 36aa895  Fix generating types like float44 and float88 (#5722)
 add 3d61dc8  [ONNX]ReduceL1, ReduceL2, ReduceSumSquare, ReduceLogSum ops 
added (#5721)
 add 43dcbc6  [TENSORFLOW]StatefulPartitionedCall/PartitionedCall Ops 
support added  (#5617)
 add a642089  [AutoTVM, Relay] Clear compile engine after task extraction 
(#5724)
 add 8935990  Fix runtime::String backward compatibility in JSON (#5725)
 add 490510d  codegen llvm: move nvptx-specific intrinsic handling into 
codegen_nvptx (#5726)
 add c2e248f  [TOPI,RELAY][TFLITE] Sparse to dense operator (#5447)
 add 34c95a8  [Frontend][TFLite] Add parser support for shape and range 
(#5329)
 add 8a98782  [REFACTOR] Separate ArgTypeCode from DLDataTypeCode (#5730)
 add fbc2b87  [ONNX]MaxRoiPool, Mod & Xor op support added (#5729)
 add e1b1171  ROCm: Add warp shuffles and enable reductions (#5727)
 add fee5d54  Change 'delete's in Relay VM Instruction dtor to 'delete[]'s 
(#5735)
 add 24597f0  Fix reshape usage in ARM Winograd (#5732)
 add 592711e  [TEST] Fix flaky 
topi/tests/python/test_topi_pooling.py:test_adaptive_pool (#5736)
 add de54754  Fix the values for test_fmod since it fails way too often 
otherwise (#5723)
 add 2ec7caa  fix small bug about dense_grad (#5695)
 add a643eb7  [REFACTOR][ARITH] Remove legacy compute_expr.h (#5738)
 add aa23e72  Add some docs on downstream consistency (#5742)
 add 7053546  sequential cpp test (#5745)
 add 6ae439c  [REFACTOR][TE][TIR] Call::Halide => ProducerLoad, DSL/TIR 
decouple. (#5743)
 add 2e1ef8e  Don't add cast for TF batch norm when type isn't changing 
(#5731)
 add 0ea9969  [ARITH][BACKPORT-0.6] fix a min/max simplify bug (#5749)
 add aa80857  [TOPI][Relay][OP] support dynamic NMS(Non Maximum 
Suppression), symbolic begin, end, and strides for strided_slice (#4312)
 add 9f79199  Add Scatter to Topi/Relay/ONNX via hybrid script (#5619)
 add e0e03a1  [Minor][Test] Clean WASM environment before build (#5759)
 add 54641ec  [Bugfix] Fix reshape (#5739)
 add 10bff27  [REFACTOR][TIR] Provide->ProducerStore, 
Realize->ProducerRealize. (#5750)
 add 60cfb79  [Rust] Second stage of Rust Refactor (#5527)
 new fcdfffa  Adapt to new macro
 new 43325ab  Add tvm crate

[incubator-tvm] 02/02: Add tvm crate

2020-06-10 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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

commit 43325abcdf9b1aa8d405a9769aa43dc12f66112d
Author: Jared Roesch 
AuthorDate: Wed Jun 10 02:30:10 2020 -0700

Add tvm crate
---
 rust/tvm/.gitignore  |   7 +
 rust/tvm/.travis.yml |  22 +++
 rust/tvm/Cargo.toml  |  45 +
 rust/tvm/README.md   | 235 +++
 rust/tvm/examples/resnet/Cargo.toml  |  29 
 rust/tvm/examples/resnet/README.md   |  45 +
 rust/tvm/examples/resnet/build.rs|  42 +
 rust/tvm/examples/resnet/src/build_resnet.py | 134 +++
 rust/tvm/examples/resnet/src/main.rs | 160 ++
 rust/tvm/src/ir/array.rs |  74 +
 rust/tvm/src/ir/mod.rs   |  17 ++
 rust/tvm/src/ir/relay/mod.rs | 232 ++
 rust/tvm/src/lib.rs  |  47 ++
 rust/tvm/src/runtime/mod.rs  |   1 +
 rust/tvm/src/transform.rs|  42 +
 rust/tvm/tests/basics/.gitignore |   7 +
 rust/tvm/tests/basics/Cargo.toml |  32 
 rust/tvm/tests/basics/build.rs   |  46 ++
 rust/tvm/tests/basics/src/main.rs|  55 +++
 rust/tvm/tests/basics/src/tvm_add.py |  50 ++
 rust/tvm/tests/callback/Cargo.toml   |  26 +++
 rust/tvm/tests/callback/src/bin/array.rs |  72 
 rust/tvm/tests/callback/src/bin/error.rs |  56 +++
 rust/tvm/tests/callback/src/bin/float.rs |  50 ++
 rust/tvm/tests/callback/src/bin/int.rs   |  49 ++
 rust/tvm/tests/callback/src/bin/string.rs|  54 ++
 rust/tvm/tests/test_ir.rs|  37 +
 27 files changed, 1666 insertions(+)

diff --git a/rust/tvm/.gitignore b/rust/tvm/.gitignore
new file mode 100644
index 000..2430329
--- /dev/null
+++ b/rust/tvm/.gitignore
@@ -0,0 +1,7 @@
+target
+**/*.rs.bk
+Cargo.lock
+/tests/basics/add_*
+/examples/resnet/deploy_*
+/examples/resnet/*.png
+/examples/resnet/synset.*
diff --git a/rust/tvm/.travis.yml b/rust/tvm/.travis.yml
new file mode 100644
index 000..e963b7c
--- /dev/null
+++ b/rust/tvm/.travis.yml
@@ -0,0 +1,22 @@
+# 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.
+
+language: rust
+rust:
+  - nightly
+matrix:
+  fast_finish: true
diff --git a/rust/tvm/Cargo.toml b/rust/tvm/Cargo.toml
new file mode 100644
index 000..ebfb5e6
--- /dev/null
+++ b/rust/tvm/Cargo.toml
@@ -0,0 +1,45 @@
+# 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.
+
+[package]
+name = "tvm"
+version = "0.1.0"
+license = "Apache-2.0"
+description = "Rust frontend support for TVM"
+repository = "https://github.com/apache/incubator-tvm;
+homepage = "https://github.com/apache/incubator-tvm;
+readme = "README.md"
+keywords = ["rust", "tvm"]
+categories = ["api-bindings", "science"]
+authors = ["TVM Contributors"]
+edition = "2018"
+
+[dependencies]
+thiserror = "^1.0"
+anyhow = "^1.0"
+lazy_static = "1.1"
+ndarray = "0.12"
+num-traits = "0.2"
+tvm-rt = { version = "0.1", path = &

[incubator-tvm] 01/02: Adapt to new macro

2020-06-10 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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

commit fcdfffa2adfce22244ed19d3234060d7f4968147
Author: Jared Roesch 
AuthorDate: Wed Jun 10 02:29:39 2020 -0700

Adapt to new macro
---
 rust/Cargo.toml   | 4 +++-
 rust/runtime/tests/test_wasm32/Cargo.toml | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 6849c03..c0d0bb8 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -29,5 +29,7 @@ members = [
"frontend/tests/callback",
"frontend/examples/resnet",
"tvm-sys",
-   "tvm-rt"
+   "tvm-macros",
+   "tvm-rt",
+   "tvm"
 ]
diff --git a/rust/runtime/tests/test_wasm32/Cargo.toml 
b/rust/runtime/tests/test_wasm32/Cargo.toml
index 1d3373a..51f15ff 100644
--- a/rust/runtime/tests/test_wasm32/Cargo.toml
+++ b/rust/runtime/tests/test_wasm32/Cargo.toml
@@ -22,5 +22,6 @@ license = "Apache-2.0"
 authors = ["TVM Contributors"]
 
 [dependencies]
+anyhow = "*"
 ndarray="0.12"
 tvm-runtime = { path = "../../" }



[incubator-tvm] branch master updated: [Rust] Second stage of Rust Refactor (#5527)

2020-06-10 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

jroesch 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 60cfb79  [Rust] Second stage of Rust Refactor (#5527)
60cfb79 is described below

commit 60cfb79ce79eb47e4cebc04321fee7f67bfd404b
Author: Jared Roesch 
AuthorDate: Wed Jun 10 02:07:19 2020 -0700

[Rust] Second stage of Rust Refactor (#5527)

* Add tvm-rt crate

* Backport changes from frontend branch

* Format

* Add ASF headers

* Address self-code review

* Replace with helper

* Fix lint

* Fix

* Clean up repro debugging

* WIP

* Remove global resgistry to fix one memory issue

* Fix

* Format

* Format

* Update rust/tvm-rt/README.md

Co-authored-by: Jason Knight 

* Format

* Duplicate TVM macros

* Split macros

* Restore old macro for old crates

* Repair macros

* Fix format

* Format

Co-authored-by: Jason Knight 
---
 include/tvm/ir/expr.h  |   2 +
 include/tvm/runtime/c_runtime_api.h|  19 +
 include/tvm/runtime/container.h|  17 +-
 python/tvm/runtime/object_generic.py   |   2 +-
 rust/Cargo.toml|   3 +-
 rust/macros/Cargo.toml |   6 +-
 rust/runtime/Cargo.toml|   2 +-
 rust/runtime/src/lib.rs|   1 +
 rust/{macros => tvm-macros}/Cargo.toml |   4 +-
 rust/tvm-macros/src/external.rs| 160 
 rust/tvm-macros/src/import_module.rs   | 133 +++
 .../src/errors.rs => tvm-macros/src/lib.rs}|  37 +-
 rust/tvm-macros/src/object.rs  | 163 
 .../src/errors.rs => tvm-macros/src/util.rs}   |  32 +-
 rust/tvm-rt/.gitignore |   7 +
 rust/{runtime => tvm-rt}/Cargo.toml|  34 +-
 rust/tvm-rt/README.md  |  60 +++
 rust/tvm-rt/src/context.rs |  97 +
 rust/tvm-rt/src/errors.rs  |  78 
 rust/tvm-rt/src/function.rs| 303 ++
 rust/tvm-rt/src/lib.rs | 130 ++
 rust/tvm-rt/src/module.rs  | 129 ++
 rust/tvm-rt/src/ndarray.rs | 438 +
 rust/tvm-rt/src/object/mod.rs  | 117 ++
 rust/tvm-rt/src/object/object_ptr.rs   | 353 +
 rust/tvm-rt/src/string.rs  |  92 +
 rust/tvm-rt/src/to_boxed_fn.rs | 227 +++
 rust/tvm-rt/src/to_function.rs | 307 +++
 rust/tvm-rt/src/value.rs   | 161 
 rust/tvm-sys/src/byte_array.rs |  36 ++
 rust/tvm-sys/src/datatype.rs   |  10 +
 rust/tvm-sys/src/errors.rs |   2 +-
 rust/tvm-sys/src/lib.rs|   9 +-
 src/ir/expr.cc |   7 +
 src/printer/relay_text_printer.cc  |   7 +
 src/relay/transforms/to_cps.cc |   2 +-
 src/runtime/object.cc  |  13 +
 src/runtime/object_internal.h  |   9 +
 38 files changed, 3131 insertions(+), 78 deletions(-)

diff --git a/include/tvm/ir/expr.h b/include/tvm/ir/expr.h
index 6797f16..b2ce50d 100644
--- a/include/tvm/ir/expr.h
+++ b/include/tvm/ir/expr.h
@@ -37,6 +37,8 @@
 
 namespace tvm {
 
+using tvm::runtime::String;
+
 /*!
  * \brief Base type of all the expressions.
  * \sa Expr
diff --git a/include/tvm/runtime/c_runtime_api.h 
b/include/tvm/runtime/c_runtime_api.h
index bf24f99..213c705 100644
--- a/include/tvm/runtime/c_runtime_api.h
+++ b/include/tvm/runtime/c_runtime_api.h
@@ -515,6 +515,15 @@ TVM_DLL int TVMObjectGetTypeIndex(TVMObjectHandle obj, 
unsigned* out_tindex);
 TVM_DLL int TVMObjectTypeKey2Index(const char* type_key, unsigned* out_tindex);
 
 /*!
+ * \brief Increase the reference count of an object.
+ *
+ * \param obj The object handle.
+ * \note Internally we increase the reference counter of the object.
+ * \return 0 when success, -1 when failure happens
+ */
+TVM_DLL int TVMObjectRetain(TVMObjectHandle obj);
+
+/*!
  * \brief Free the object.
  *
  * \param obj The object handle.
@@ -564,6 +573,16 @@ TVM_DLL int TVMDeviceCopyDataFromTo(const void* from, 
size_t from_offset, void*
 TVMContext ctx_to, DLDataType type_hint,
 TVMStreamHandle stream);
 
+/*!
+ * \brief Check that an object is derived from another

[incubator-tvm] 02/04: Convert external macro to procmacro

2020-06-08 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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

commit 62b6d1bac749e53d40fd55b496feec486079
Author: Jared Roesch 
AuthorDate: Mon Jun 8 13:42:32 2020 -0700

Convert external macro to procmacro
---
 rust/macros/src/external.rs| 163 +
 rust/macros/src/lib.rs |   1 +
 rust/macros/src/object.rs  |  58 +++
 rust/macros/src/util.rs|  11 +++
 rust/tvm-rt/Cargo.toml |   1 -
 rust/tvm-rt/src/context.rs |   5 +-
 rust/tvm-rt/src/errors.rs  |   2 +
 rust/tvm-rt/src/function.rs|  11 +--
 rust/tvm-rt/src/lib.rs |   2 +
 rust/tvm-rt/src/module.rs  |  29 
 rust/tvm-rt/src/object/mod.rs  |  14 ++--
 rust/tvm-rt/src/string.rs  |   5 +-
 rust/tvm-rt/src/to_boxed_fn.rs |  36 -
 13 files changed, 255 insertions(+), 83 deletions(-)

diff --git a/rust/macros/src/external.rs b/rust/macros/src/external.rs
new file mode 100644
index 000..989cc6a
--- /dev/null
+++ b/rust/macros/src/external.rs
@@ -0,0 +1,163 @@
+/*
+ * 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.
+ */
+use std::env;
+use quote::quote;
+use proc_macro2::Span;
+use syn::parse::{Parse, ParseStream, Result};
+
+use syn::{Ident, Meta, FnArg, Generics, TraitItemMethod, Lit, NestedMeta, 
Type, ReturnType, Pat};
+
+struct External {
+tvm_name: String,
+ident: Ident,
+generics: Generics,
+inputs: Vec,
+ret_type: ReturnType,
+}
+
+impl Parse for External {
+fn parse(input: ParseStream) -> Result {
+let method: TraitItemMethod = input.parse()?;
+assert_eq!(method.attrs.len(), 1);
+let sig = method.sig;
+let tvm_name = method.attrs[0].parse_meta()?;
+let tvm_name = match tvm_name {
+Meta::List(meta_list) => {
+let name = meta_list.path.get_ident()
+.expect("name");
+assert_eq!(name.to_string(), "name".to_string());
+match meta_list.nested.first() {
+Some(NestedMeta::Lit(Lit::Str(lit))) => lit.value(),
+_ => panic!(),
+}
+}
+_ => panic!()
+};
+assert_eq!(method.default, None);
+assert!(method.semi_token != None);
+let ident = sig.ident;
+let generics = sig.generics;
+let inputs = sig.inputs.iter().map(|param| param.clone()).collect();
+let ret_type = sig.output;
+
+Ok(External {
+tvm_name,
+ident,
+generics,
+inputs,
+ret_type,
+})
+}
+}
+
+struct ExternalInput {
+externs: Vec,
+}
+
+impl Parse for ExternalInput {
+fn parse(input: ParseStream) -> Result {
+let mut externs: Vec = Vec::new();
+
+loop {
+if input.is_empty() { break; }
+externs.push(input.parse()?);
+}
+
+Ok(ExternalInput { externs })
+}
+}
+
+ pub fn macro_impl(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+let ext_input = syn::parse_macro_input!(input as ExternalInput);
+
+let tvm_rt_crate = if env::var("CARGO_PKG_NAME").unwrap() == "tvm-rt" {
+quote!( crate )
+} else {
+quote!( tvm_rt )
+};
+
+let err_type = quote! { #tvm_rt_crate::Error };
+
+let mut items = Vec::new();
+
+for external in _input.externs {
+let name = 
+let global_name = format!("global_{}", external.ident);
+let global_name = Ident::new(_name, Span::call_site());
+let ext_name = _name;
+
+let ty_params: Vec =
+external.generics.params.iter().map(|ty_param|
+match ty_param {
+syn::GenericParam::Type(param) => param.clone(),
+_ => panic!()
+}).collect();
+
+let args = 
+
+let (args, tys): (Vec, Vec) =
+args.iter().map(|arg| {
+match arg {
+FnArg::Typed(pat_ty

[incubator-tvm] branch rust-tvm updated (a44a379 -> caa6904)

2020-06-08 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from a44a379  Refactor anyhow out of the rt layer
 new fc6fac2  Reworking errors and proc macros
 new 62b6d1ba Convert external macro to procmacro
 new 0c55c39  Finish removing anyhow and work with new external! macro
 new caa6904  All tests pass

The 4 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.


Summary of changes:
 rust/macros/src/external.rs  | 163 +++
 rust/macros/src/lib.rs   |   8 ++
 rust/macros/src/object.rs|  58 ++---
 rust/macros/src/util.rs  |  11 +++
 rust/tvm-rt/Cargo.toml   |   4 +-
 rust/tvm-rt/src/context.rs   |  17 ++--
 rust/tvm-rt/src/errors.rs|  21 +++--
 rust/tvm-rt/src/function.rs  |  64 +-
 rust/tvm-rt/src/lib.rs   |   8 +-
 rust/tvm-rt/src/module.rs|  31 ---
 rust/tvm-rt/src/ndarray.rs   |  25 +++---
 rust/tvm-rt/src/object/mod.rs|  14 +--
 rust/tvm-rt/src/object/object_ptr.rs |   2 +-
 rust/tvm-rt/src/string.rs|   5 +-
 rust/tvm-rt/src/to_boxed_fn.rs   |  21 ++---
 rust/tvm-rt/src/to_function.rs   |  30 +++
 rust/tvm-rt/src/value.rs |   6 +-
 rust/tvm/src/ir/array.rs |   5 +-
 rust/tvm/src/lib.rs  |   9 +-
 19 files changed, 334 insertions(+), 168 deletions(-)
 create mode 100644 rust/macros/src/external.rs
 create mode 100644 rust/macros/src/util.rs



[incubator-tvm] 01/04: Reworking errors and proc macros

2020-06-08 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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

commit fc6fac254d02f91dae146c81c618cd17f8bf9d3c
Author: Jared Roesch 
AuthorDate: Sat Jun 6 21:54:58 2020 -0700

Reworking errors and proc macros
---
 rust/macros/src/lib.rs   |  7 +
 rust/tvm-rt/src/errors.rs|  5 +++-
 rust/tvm-rt/src/function.rs  | 53 ++--
 rust/tvm-rt/src/ndarray.rs   | 23 ++--
 rust/tvm-rt/src/object/mod.rs|  2 +-
 rust/tvm-rt/src/object/object_ptr.rs |  2 +-
 rust/tvm-rt/src/to_function.rs   |  2 +-
 rust/tvm-rt/src/value.rs |  6 +---
 rust/tvm/src/ir/array.rs |  5 ++--
 rust/tvm/src/lib.rs  |  9 ++
 10 files changed, 48 insertions(+), 66 deletions(-)

diff --git a/rust/macros/src/lib.rs b/rust/macros/src/lib.rs
index e9ddc25..d0ac1ca 100644
--- a/rust/macros/src/lib.rs
+++ b/rust/macros/src/lib.rs
@@ -18,6 +18,8 @@
  */
 
 use proc_macro::TokenStream;
+
+mod external;
 mod import_module;
 mod object;
 
@@ -31,3 +33,8 @@ pub fn macro_impl(input: TokenStream) -> TokenStream {
 // let input = proc_macro2::TokenStream::from(input);
 TokenStream::from(object::macro_impl(input))
 }
+
+#[proc_macro]
+pub fn external(input: TokenStream) -> TokenStream {
+external::macro_impl(input)
+}
diff --git a/rust/tvm-rt/src/errors.rs b/rust/tvm-rt/src/errors.rs
index 41e873f..f081258 100644
--- a/rust/tvm-rt/src/errors.rs
+++ b/rust/tvm-rt/src/errors.rs
@@ -48,7 +48,10 @@ pub enum NDArrayError {
 #[error("a shape error occurred in the Rust ndarray library")]
 ShapeError(#[from] ndarray::ShapeError),
 #[error("Expected type `{expected}` but found `{actual}`")]
-DataTypeMismatch { expected: DataType, actual: DataType }
+DataTypeMismatch {
+expected: DataType,
+actual: DataType,
+},
 }
 
 #[derive(Debug, Error)]
diff --git a/rust/tvm-rt/src/function.rs b/rust/tvm-rt/src/function.rs
index 17f5f6e..b0122ff 100644
--- a/rust/tvm-rt/src/function.rs
+++ b/rust/tvm-rt/src/function.rs
@@ -25,6 +25,9 @@
 //!
 //! See the tests and examples repository for more examples.
 
+use anyhow::Result;
+use lazy_static::lazy_static;
+use std::convert::TryFrom;
 use std::{
 collections::BTreeMap,
 ffi::{CStr, CString},
@@ -33,9 +36,6 @@ use std::{
 ptr, slice, str,
 sync::Mutex,
 };
-use std::convert::{TryFrom};
-use anyhow::Result;
-use lazy_static::lazy_static;
 
 pub use tvm_sys::{ffi, ArgValue, RetValue};
 
@@ -194,7 +194,10 @@ impl TryFrom for Function {
 fn try_from(ret_value: RetValue) -> Result {
 match ret_value {
 RetValue::FuncHandle(handle) => Ok(Function::new(handle)),
-_ => Err(Error::downcast(format!("{:?}", ret_value), 
"FunctionHandle"))
+_ => Err(Error::downcast(
+format!("{:?}", ret_value),
+"FunctionHandle",
+)),
 }
 }
 }
@@ -211,7 +214,10 @@ impl<'a> TryFrom> for Function {
 fn try_from(arg_value: ArgValue<'a>) -> Result {
 match arg_value {
 ArgValue::FuncHandle(handle) => Ok(Function::new(handle)),
-_ => Err(Error::downcast(format!("{:?}", arg_value), 
"FunctionHandle")),
+_ => Err(Error::downcast(
+format!("{:?}", arg_value),
+"FunctionHandle",
+)),
 }
 }
 }
@@ -222,7 +228,10 @@ impl<'a> TryFrom<<'a>> for Function {
 fn try_from(arg_value: <'a>) -> Result {
 match arg_value {
 ArgValue::FuncHandle(handle) => Ok(Function::new(*handle)),
-_ => Err(Error::downcast(format!("{:?}", arg_value), 
"FunctionHandle")),
+_ => Err(Error::downcast(
+format!("{:?}", arg_value),
+"FunctionHandle",
+)),
 }
 }
 }
@@ -286,38 +295,6 @@ where
 Ok(())
 }
 
-#[macro_export]
-macro_rules! external_func_impl {
-($name:ident , $($ty_param:tt)* , ( $($arg:ident : $ty:ty),* ), 
$ret_type:ty, $ext_name:literal) => {
-::paste::item! {
-#[allow(non_upper_case_globals)]
-static []: ::once_cell::sync::Lazy<&'static 
$crate::Function> =
-::once_cell::sync::Lazy::new(|| {
-$crate::Function::get($ext_name)
-.expect(concat!("unable to load external function", 
stringify!($ext_name), "from TVM registry."))
-});
-}
-
-pub fn $name<$($ty_param),*>($($arg : $ty),*) -> 
anyhow::Result<$ret_type> w,* {
-let func_ref: &$crate::Function = ::past

[incubator-tvm] 03/04: Finish removing anyhow and work with new external! macro

2020-06-08 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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

commit 0c55c39477979c75f2bf3e2e9974d90fde74fa26
Author: Jared Roesch 
AuthorDate: Mon Jun 8 13:56:28 2020 -0700

Finish removing anyhow and work with new external! macro
---
 rust/tvm-rt/src/context.rs | 12 
 rust/tvm-rt/src/errors.rs  | 14 --
 rust/tvm-rt/src/function.rs| 12 ++--
 rust/tvm-rt/src/module.rs  | 10 +-
 rust/tvm-rt/src/ndarray.rs |  2 +-
 rust/tvm-rt/src/to_boxed_fn.rs | 29 -
 rust/tvm-rt/src/to_function.rs | 30 +++---
 7 files changed, 59 insertions(+), 50 deletions(-)

diff --git a/rust/tvm-rt/src/context.rs b/rust/tvm-rt/src/context.rs
index 0c01d91..b1bdab5 100644
--- a/rust/tvm-rt/src/context.rs
+++ b/rust/tvm-rt/src/context.rs
@@ -1,13 +1,17 @@
-pub use tvm_sys::context::*;
-use tvm_sys::ffi;
 
 use std::os::raw::c_void;
 use std::ptr;
 
+use crate::errors::Error;
+
+use tvm_sys::ffi;
+
+pub use tvm_sys::context::*;
+
 trait ContextExt {
 /// Checks whether the context exists or not.
 fn exist() -> bool;
-fn sync() -> anyhow::Result<()>;
+fn sync() -> Result<(), Error>;
 fn max_threads_per_block() -> isize;
 fn warp_size() -> isize;
 fn max_shared_memory_per_block() -> isize;
@@ -44,7 +48,7 @@ impl ContextExt for Context {
 }
 
 /// Synchronize the context stream.
-fn sync() -> anyhow::Result<()> {
+fn sync() -> Result<(), Error> {
 check_call!(ffi::TVMSynchronize(
 self.device_type as i32,
 self.device_id as i32,
diff --git a/rust/tvm-rt/src/errors.rs b/rust/tvm-rt/src/errors.rs
index 414484d..197c875 100644
--- a/rust/tvm-rt/src/errors.rs
+++ b/rust/tvm-rt/src/errors.rs
@@ -21,12 +21,6 @@ use crate::DataType;
 use thiserror::Error;
 
 #[derive(Debug, Error)]
-#[error("Handle `{name}` is null.")]
-pub struct NullHandleError {
-pub name: String,
-}
-
-#[derive(Debug, Error)]
 #[error("Function was not set in `function::Builder`")]
 pub struct FunctionNotFoundError;
 
@@ -62,6 +56,14 @@ pub enum Error {
 Null,
 #[error("failed to load module due to invalid path {0}")]
 ModuleLoadPath(String),
+#[error("failed to convert String into CString due to embedded nul 
character")]
+ToCString(#[from] std::ffi::NulError),
+#[error("failed to convert CString into String")]
+FromCString(#[from] std::ffi::IntoStringError),
+#[error("Handle `{0}` is null.")]
+NullHandle(String),
+#[error("{0}")]
+NDArray(#[from] NDArrayError),
 }
 
 impl Error {
diff --git a/rust/tvm-rt/src/function.rs b/rust/tvm-rt/src/function.rs
index 4b34bc1..cca918a 100644
--- a/rust/tvm-rt/src/function.rs
+++ b/rust/tvm-rt/src/function.rs
@@ -138,7 +138,7 @@ impl Function {
 }
 
 /// Calls the function that created from `Builder`.
-pub fn invoke<'a>(, arg_buf: Vec>) -> Result {
+pub fn invoke<'a>(, arg_buf: Vec>) -> Result {
 let num_args = arg_buf.len();
 let (mut values, mut type_codes): (Vec, 
Vec) =
 arg_buf.iter().map(|arg| arg.to_tvm_value()).unzip();
@@ -192,7 +192,7 @@ impl From for RetValue {
 impl TryFrom for Function {
 type Error = Error;
 
-fn try_from(ret_value: RetValue) -> Result {
+fn try_from(ret_value: RetValue) -> Result {
 match ret_value {
 RetValue::FuncHandle(handle) => Ok(Function::new(handle)),
 _ => Err(Error::downcast(
@@ -212,7 +212,7 @@ impl<'a> From for ArgValue<'a> {
 impl<'a> TryFrom> for Function {
 type Error = Error;
 
-fn try_from(arg_value: ArgValue<'a>) -> Result {
+fn try_from(arg_value: ArgValue<'a>) -> Result {
 match arg_value {
 ArgValue::FuncHandle(handle) => Ok(Function::new(handle)),
 _ => Err(Error::downcast(
@@ -226,7 +226,7 @@ impl<'a> TryFrom> for Function {
 impl<'a> TryFrom<<'a>> for Function {
 type Error = Error;
 
-fn try_from(arg_value: <'a>) -> Result {
+fn try_from(arg_value: <'a>) -> Result {
 match arg_value {
 ArgValue::FuncHandle(handle) => Ok(Function::new(*handle)),
 _ => Err(Error::downcast(
@@ -264,7 +264,7 @@ impl<'a> TryFrom<<'a>> for Function {
 /// let ret = boxed_fn(10, 20, 30).unwrap();
 /// assert_eq!(ret, 60);
 /// ```
-pub fn register>(f: F, name: S) -> Result<(), Error>
+pub fn register>(f: F, name: S) -> Result<()>
 where
 F: ToFunction,
 F: Typed,
@@ -275,7 +275,7 @@ where
 /// Register a function with explicit control over whether to override an 
existing registration o

[incubator-tvm] 04/04: All tests pass

2020-06-08 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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

commit caa6904a4d070abf1f957a51c23ba7d553e364be
Author: Jared Roesch 
AuthorDate: Mon Jun 8 14:01:09 2020 -0700

All tests pass
---
 rust/tvm-rt/Cargo.toml  | 3 +++
 rust/tvm-rt/src/function.rs | 6 +++---
 rust/tvm-rt/src/lib.rs  | 6 +++---
 rust/tvm-rt/src/ndarray.rs  | 6 +++---
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/rust/tvm-rt/Cargo.toml b/rust/tvm-rt/Cargo.toml
index b234da1..00e225f 100644
--- a/rust/tvm-rt/Cargo.toml
+++ b/rust/tvm-rt/Cargo.toml
@@ -39,5 +39,8 @@ paste = "0.1"
 mashup = "0.1"
 once_cell = "^1.3.1"
 
+[dev-dependencies]
+anyhow = "^1.0"
+
 [features]
 blas = ["ndarray/blas"]
diff --git a/rust/tvm-rt/src/function.rs b/rust/tvm-rt/src/function.rs
index cca918a..ef659b7 100644
--- a/rust/tvm-rt/src/function.rs
+++ b/rust/tvm-rt/src/function.rs
@@ -251,8 +251,7 @@ impl<'a> TryFrom<<'a>> for Function {
 ///
 /// ```
 /// # use tvm_rt::{ArgValue, RetValue};
-/// # use tvm_rt::function::{Function, register};
-/// # use anyhow::{Result};
+/// # use tvm_rt::function::{Function, Result, register};
 ///
 /// fn sum(x: i64, y: i64, z: i64) -> i64 {
 /// x + y + z
@@ -317,6 +316,7 @@ mod tests {
 #[test]
 fn register_and_call_closure0() {
 use crate::function;
+use function::Result;
 
 fn constfn() -> i64 {
 return 10;
@@ -324,7 +324,7 @@ mod tests {
 
 function::register_override(constfn, "constfn".to_owned(), 
true).unwrap();
 let func = Function::get("constfn").unwrap();
-let func = func.to_boxed_fn:: Result>();
+let func = func.to_boxed_fn:: Result>();
 let ret = func().unwrap();
 assert_eq!(ret, 10);
 }
diff --git a/rust/tvm-rt/src/lib.rs b/rust/tvm-rt/src/lib.rs
index 70a8efd..e21b5b7 100644
--- a/rust/tvm-rt/src/lib.rs
+++ b/rust/tvm-rt/src/lib.rs
@@ -115,8 +115,8 @@ mod tests {
 
 #[test]
 fn set_error() {
-let err = errors::EmptyArrayError;
-set_last_error(());
-assert_eq!(get_last_error().trim(), 
errors::EmptyArrayError.to_string());
+let err = errors::NDArrayError::EmptyArray;
+set_last_error();
+assert_eq!(get_last_error().trim(), 
errors::NDArrayError::EmptyArray.to_string());
 }
 }
diff --git a/rust/tvm-rt/src/ndarray.rs b/rust/tvm-rt/src/ndarray.rs
index 9a17502..6e1dcbf 100644
--- a/rust/tvm-rt/src/ndarray.rs
+++ b/rust/tvm-rt/src/ndarray.rs
@@ -190,7 +190,7 @@ impl NDArray {
 /// assert_eq!(ndarray.to_vec::().unwrap(), data);
 /// ```
 pub fn to_vec() -> Result, NDArrayError> {
-if self.shape().is_some() {
+if !self.shape().is_some() {
 return Err(NDArrayError::EmptyArray);
 }
 let earr = NDArray::empty(
@@ -308,7 +308,7 @@ macro_rules! impl_from_ndarray_rustndarray {
 type Error = NDArrayError;
 
 fn try_from(nd: ) -> Result, Self::Error> {
-if nd.shape().is_some() {
+if !nd.shape().is_some() {
 return Err(NDArrayError::MissingShape);
 }
 assert_eq!(nd.dtype(), DataType::from_str($type_name)?, "Type 
mismatch");
@@ -323,7 +323,7 @@ macro_rules! impl_from_ndarray_rustndarray {
 type Error = NDArrayError;
 
 fn try_from(nd:  NDArray) -> Result, 
Self::Error> {
-if nd.shape().is_some() {
+if !nd.shape().is_some() {
 return Err(NDArrayError::MissingShape);
 };
 assert_eq!(nd.dtype(), DataType::from_str($type_name)?, "Type 
mismatch");



[incubator-tvm] branch rust-tvm created (now a44a379)

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

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


  at a44a379  Refactor anyhow out of the rt layer

This branch includes the following new commits:

 new 4cf2dbc  Add tvm crate
 new a44a379  Refactor anyhow out of the rt layer

The 2 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.




[incubator-tvm] 01/02: Add tvm crate

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

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

commit 4cf2dbcf9b058e4d10f332a3fe0385d9387929fc
Author: Jared Roesch 
AuthorDate: Thu May 28 02:08:14 2020 -0700

Add tvm crate
---
 rust/tvm/.gitignore  |   7 +
 rust/tvm/.travis.yml |  22 +++
 rust/tvm/Cargo.toml  |  45 +
 rust/tvm/README.md   | 235 +++
 rust/tvm/examples/resnet/Cargo.toml  |  29 
 rust/tvm/examples/resnet/README.md   |  45 +
 rust/tvm/examples/resnet/build.rs|  42 +
 rust/tvm/examples/resnet/src/build_resnet.py | 134 +++
 rust/tvm/examples/resnet/src/main.rs | 160 ++
 rust/tvm/src/ir/array.rs |  70 
 rust/tvm/src/ir/mod.rs   |  17 ++
 rust/tvm/src/ir/relay/mod.rs | 232 ++
 rust/tvm/src/lib.rs  |  60 +++
 rust/tvm/src/runtime/mod.rs  |   1 +
 rust/tvm/src/transform.rs|  41 +
 rust/tvm/tests/basics/.gitignore |   7 +
 rust/tvm/tests/basics/Cargo.toml |  32 
 rust/tvm/tests/basics/build.rs   |  46 ++
 rust/tvm/tests/basics/src/main.rs|  55 +++
 rust/tvm/tests/basics/src/tvm_add.py |  50 ++
 rust/tvm/tests/callback/Cargo.toml   |  26 +++
 rust/tvm/tests/callback/src/bin/array.rs |  72 
 rust/tvm/tests/callback/src/bin/error.rs |  56 +++
 rust/tvm/tests/callback/src/bin/float.rs |  50 ++
 rust/tvm/tests/callback/src/bin/int.rs   |  49 ++
 rust/tvm/tests/callback/src/bin/string.rs|  54 ++
 rust/tvm/tests/test_ir.rs|  37 +
 27 files changed, 1674 insertions(+)

diff --git a/rust/tvm/.gitignore b/rust/tvm/.gitignore
new file mode 100644
index 000..2430329
--- /dev/null
+++ b/rust/tvm/.gitignore
@@ -0,0 +1,7 @@
+target
+**/*.rs.bk
+Cargo.lock
+/tests/basics/add_*
+/examples/resnet/deploy_*
+/examples/resnet/*.png
+/examples/resnet/synset.*
diff --git a/rust/tvm/.travis.yml b/rust/tvm/.travis.yml
new file mode 100644
index 000..e963b7c
--- /dev/null
+++ b/rust/tvm/.travis.yml
@@ -0,0 +1,22 @@
+# 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.
+
+language: rust
+rust:
+  - nightly
+matrix:
+  fast_finish: true
diff --git a/rust/tvm/Cargo.toml b/rust/tvm/Cargo.toml
new file mode 100644
index 000..4cbb619
--- /dev/null
+++ b/rust/tvm/Cargo.toml
@@ -0,0 +1,45 @@
+# 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.
+
+[package]
+name = "tvm"
+version = "0.1.0"
+license = "Apache-2.0"
+description = "Rust frontend support for TVM"
+repository = "https://github.com/apache/incubator-tvm;
+homepage = "https://github.com/apache/incubator-tvm;
+readme = "README.md"
+keywords = ["rust", "tvm"]
+categories = ["api-bindings", "science"]
+authors = ["TVM Contributors"]
+edition = "2018"
+
+[dependencies]
+thiserror = "^1.0"
+anyhow = "^1.0"
+lazy_static = "1.1"
+ndarray = "0.12"
+num-traits = "0.2"
+tvm-rt = { version = "0.1", path = &qu

[incubator-tvm] 02/02: Refactor anyhow out of the rt layer

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

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

commit a44a379bb3b3f4fab505dce3520eeb97f230ac23
Author: Jared Roesch 
AuthorDate: Sat May 30 01:07:46 2020 -0700

Refactor anyhow out of the rt layer
---
 rust/Cargo.toml  |  3 +-
 rust/macros/src/object.rs|  8 ++---
 rust/tvm-rt/src/errors.rs| 36 
 rust/tvm-rt/src/function.rs  | 66 +---
 rust/tvm-rt/src/lib.rs   |  5 +--
 rust/tvm-rt/src/ndarray.rs   | 66 +++-
 rust/tvm-rt/src/object/mod.rs| 17 --
 rust/tvm-rt/src/object/object_ptr.rs | 30 +---
 rust/tvm-rt/src/to_function.rs   | 37 ++--
 rust/tvm-rt/src/value.rs |  5 ++-
 rust/tvm/src/ir/array.rs | 55 +-
 rust/tvm/src/lib.rs  | 10 +-
 rust/tvm/src/transform.rs|  2 +-
 13 files changed, 211 insertions(+), 129 deletions(-)

diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 6d3481b..e107104 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -29,5 +29,6 @@ members = [
"frontend/tests/callback",
"frontend/examples/resnet",
 "tvm-sys",
-   "tvm-rt"
+   "tvm-rt",
+   "tvm",
 ]
diff --git a/rust/macros/src/object.rs b/rust/macros/src/object.rs
index 96a86dd..670d326 100644
--- a/rust/macros/src/object.rs
+++ b/rust/macros/src/object.rs
@@ -89,12 +89,12 @@ pub fn macro_impl(input: proc_macro::TokenStream) -> 
TokenStream {
 }
 
 impl std::convert::TryFrom for #ref_id {
-type Error = ::anyhow::Error;
+type Error = tvm_rt::Error;
 
 fn try_from(ret_val: tvm_rt::RetValue) -> Result<#ref_id, 
Self::Error> {
 use std::convert::TryInto;
 let oref: ObjectRef = ret_val.try_into()?;
-let ptr = oref.0.ok_or(anyhow::anyhow!("null ptr"))?;
+let ptr = oref.0.ok_or(tvm_rt::Error::Null)?;
 let ptr = ptr.downcast::<#payload_id>()?;
 Ok(#ref_id(Some(ptr)))
 }
@@ -122,7 +122,7 @@ pub fn macro_impl(input: proc_macro::TokenStream) -> 
TokenStream {
 }
 
 impl<'a> std::convert::TryFrom> for #ref_id {
-type Error = anyhow::Error;
+type Error = tvm_rt::Error;
 
 fn try_from(arg_value: tvm_rt::ArgValue<'a>) -> Result<#ref_id, 
Self::Error> {
 use std::convert::TryInto;
@@ -132,7 +132,7 @@ pub fn macro_impl(input: proc_macro::TokenStream) -> 
TokenStream {
 }
 
 impl<'a> std::convert::TryFrom<_rt::ArgValue<'a>> for #ref_id {
-type Error = anyhow::Error;
+type Error = tvm_rt::Error;
 
 fn try_from(arg_value: _rt::ArgValue<'a>) -> Result<#ref_id, 
Self::Error> {
 use std::convert::TryInto;
diff --git a/rust/tvm-rt/src/errors.rs b/rust/tvm-rt/src/errors.rs
index 77dbba7..41e873f 100644
--- a/rust/tvm-rt/src/errors.rs
+++ b/rust/tvm-rt/src/errors.rs
@@ -17,13 +17,10 @@
  * under the License.
  */
 
+use crate::DataType;
 use thiserror::Error;
 
 #[derive(Debug, Error)]
-#[error("Cannot convert from an empty array.")]
-pub struct EmptyArrayError;
-
-#[derive(Debug, Error)]
 #[error("Handle `{name}` is null.")]
 pub struct NullHandleError {
 pub name: String,
@@ -41,5 +38,32 @@ pub struct TypeMismatchError {
 }
 
 #[derive(Debug, Error)]
-#[error("Missing NDArray shape.")]
-pub struct MissingShapeError;
+pub enum NDArrayError {
+#[error("Missing NDArray shape.")]
+MissingShape,
+#[error("Cannot convert from an empty array.")]
+EmptyArray,
+#[error("Invalid datatype when attempting to convert ndarray.")]
+InvalidDatatype(#[from] tvm_sys::datatype::ParseDataTypeError),
+#[error("a shape error occurred in the Rust ndarray library")]
+ShapeError(#[from] ndarray::ShapeError),
+#[error("Expected type `{expected}` but found `{actual}`")]
+DataTypeMismatch { expected: DataType, actual: DataType }
+}
+
+#[derive(Debug, Error)]
+pub enum Error {
+#[error("{0}")]
+Downcast(#[from] tvm_sys::errors::ValueDowncastError),
+#[error("raw pointer passed across boundary was null")]
+Null,
+}
+
+impl Error {
+pub fn downcast(actual_type: String, expected_type: &'static str) -> Error 
{
+Self::Downcast(tvm_sys::errors::ValueDowncastError {
+actual_type,
+expected_type,
+})
+}
+}
diff --git a/rust/tvm-rt/src/function.rs b/rust/tvm-rt/src/function.rs
index 2a5

[incubator-tvm] branch master updated: [TIR][REFACTOR] std::string -> String Migration in TIR nodes (#5596)

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

jroesch 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 a072da0  [TIR][REFACTOR] std::string -> String Migration in TIR nodes 
(#5596)
a072da0 is described below

commit a072da0588c542757d2815832b7f010f530b2428
Author: Neo Chien 
AuthorDate: Thu May 28 16:56:06 2020 +0800

[TIR][REFACTOR] std::string -> String Migration in TIR nodes (#5596)

* [TIR][REFACTOR] std::string -> String Migration for Var node and SizeVar 
Node

* update json_compact.py
---
 include/tvm/tir/stmt.h  |  2 +-
 include/tvm/tir/var.h   | 12 ++--
 python/tvm/ir/json_compact.py   |  4 ++--
 src/printer/tir_text_printer.cc |  2 +-
 src/tir/ir/data_layout.cc   |  6 +++---
 src/tir/ir/expr.cc  | 15 +++
 6 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/include/tvm/tir/stmt.h b/include/tvm/tir/stmt.h
index e1fef55..bbc37fe 100644
--- a/include/tvm/tir/stmt.h
+++ b/include/tvm/tir/stmt.h
@@ -20,7 +20,7 @@
  * \file tvm/tir/stmt.h
  * \brief TIR statements.
  */
-// Acknowledgement: Mnay low-level stmts originate from Halide.
+// Acknowledgement: Many low-level stmts originate from Halide.
 #ifndef TVM_TIR_STMT_H_
 #define TVM_TIR_STMT_H_
 
diff --git a/include/tvm/tir/var.h b/include/tvm/tir/var.h
index a89c665..4db462d 100644
--- a/include/tvm/tir/var.h
+++ b/include/tvm/tir/var.h
@@ -50,7 +50,7 @@ class VarNode : public PrimExprNode {
* \brief The hint to the variable name.
* \note Each variable is uniquely identified by its address.
*/
-  std::string name_hint;
+  String name_hint;
   /*!
* \brief type annotaion of the variable.
*
@@ -92,19 +92,19 @@ class Var : public PrimExpr {
* \param name_hint variable name
* \param dtype data type
*/
-  TVM_DLL explicit Var(std::string name_hint = "v", DataType dtype = 
DataType::Int(32));
+  TVM_DLL explicit Var(String name_hint = "v", DataType dtype = 
DataType::Int(32));
   /*!
* \brief Constructor which provides a more detailed type annotation.
* \param name_hint variable name.
* \param type_annotation The type annotation.
*/
-  TVM_DLL explicit Var(std::string name_hint, Type type_annotation);
+  TVM_DLL explicit Var(String name_hint, Type type_annotation);
   /*!
* \brief Make a new copy of var with same type, append suffix
* \param suffix The suffix to be appended.
* \return the new Var copy
*/
-  TVM_DLL Var copy_with_suffix(const std::string& suffix) const;
+  TVM_DLL Var copy_with_suffix(const String& suffix) const;
   /*!
* \brief Get pointer to the internal value.
* \return the corresponding Variable.
@@ -138,7 +138,7 @@ class SizeVar : public Var {
* \param name_hint variable name
* \param t data type
*/
-  TVM_DLL explicit SizeVar(std::string name_hint = "s", DataType t = 
DataType::Int(32));
+  TVM_DLL explicit SizeVar(String name_hint = "s", DataType t = 
DataType::Int(32));
   /*!
* \brief Get pointer to the internal value.
* \return the corresponding Variable.
@@ -178,7 +178,7 @@ enum IterVarType : int {
   /*!
* \brief The IterVar itself is a thread-index
*  of a fixed thread launching group.
-   *  Note that this is already assumed to be paralellized.
+   *  Note that this is already assumed to be parallelized.
*
*  Disallow: split/fuse/vectorize/parallel
*/
diff --git a/python/tvm/ir/json_compact.py b/python/tvm/ir/json_compact.py
index 2abfd81..9d90685 100644
--- a/python/tvm/ir/json_compact.py
+++ b/python/tvm/ir/json_compact.py
@@ -130,8 +130,8 @@ def create_updater_06_to_07():
 "relay.ModulePass": _rename("transform.ModulePass"),
 "relay.Sequential": _rename("transform.Sequential"),
 # TIR
-"Variable": _update_tir_var("tir.Var"),
-"SizeVar": _update_tir_var("tir.SizeVar"),
+"Variable": [_update_tir_var("tir.Var"), _update_from_std_str("name")],
+"SizeVar": [_update_tir_var("tir.SizeVar"), 
_update_from_std_str("name")],
 }
 return create_updater(node_map, "0.6", "0.7")
 
diff --git a/src/printer/tir_text_printer.cc b/src/printer/tir_text_printer.cc
index 0bcc148..4d22cbb 100644
--- a/src/printer/tir_text_printer.cc
+++ b/src/printer/tir_text_printer.cc
@@ -567,7 +567,7 @@ Doc TIRTextPrinter::AllocVar(const Var& var) {
   if (it != memo_var_.end()) {
 return it->second;
   }
-  std::string name = var->name_hint;
+  std::string name = var->name_hint.operator std::string();
   if (name.length() == 0 || !std::isalpha(name[0])) {
 name = "v" + name;
   }
diff --gi

[incubator-tvm] branch master updated: [RUNTIME] Resolve constexpr issue in debug mode. (#5651)

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

jroesch 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 896557d  [RUNTIME] Resolve constexpr issue in debug mode. (#5651)
896557d is described below

commit 896557d935999391dcc8bda001fb67d79e2f9ef8
Author: Tianqi Chen 
AuthorDate: Fri May 22 13:36:43 2020 -0700

[RUNTIME] Resolve constexpr issue in debug mode. (#5651)

static constexpr is a bit weird before c++17.
They are not inlined by default and does not have symbols after compilation.
It usually isn't a problem when they are inlined(in c++17 they are inlined 
by default).
But will create compilation error when passed to functions that take 
(const)references.
This PR fixes the problem so that we can compile on debugmode.
---
 include/tvm/runtime/container.h | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/tvm/runtime/container.h b/include/tvm/runtime/container.h
index a52e997..1569c67 100644
--- a/include/tvm/runtime/container.h
+++ b/include/tvm/runtime/container.h
@@ -491,10 +491,10 @@ class ArrayNode : public Object, public 
InplaceArrayBase {
   int64_t capacity_;
 
   /*! \brief Initial size of ArrayNode */
-  static const constexpr int64_t kInitSize = 4;
+  static constexpr int64_t kInitSize = 4;
 
   /*! \brief Expansion factor of the Array */
-  static const constexpr int64_t kIncFactor = 2;
+  static constexpr int64_t kIncFactor = 2;
 
   // CRTP parent class
   friend InplaceArrayBase;
@@ -929,7 +929,9 @@ class Array : public ObjectRef {
   ArrayNode* CopyOnWrite(int64_t reserve_extra) {
 ArrayNode* p = GetArrayNode();
 if (p == nullptr) {
-  return SwitchContainer(std::max(ArrayNode::kInitSize, reserve_extra));
+  // necessary to get around the constexpr address issue before c++17
+  const int64_t kInitSize = ArrayNode::kInitSize;
+  return SwitchContainer(std::max(kInitSize, reserve_extra));
 }
 if (p->capacity_ >= p->size_ + reserve_extra) {
   return CopyOnWrite();



[incubator-tvm] branch master updated (3be9576 -> 09792ec)

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

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


from 3be9576  [BYOC] Remove kCompiler attr from external functions (#5615)
 add 09792ec  [Relay]Improve Shape Func handling for Tuple inputs (#5467)

No new revisions were added by this update.

Summary of changes:
 src/relay/backend/compile_engine.cc |  7 ++
 src/relay/op/memory/memory.cc   | 13 ++-
 tests/python/relay/test_any.py  | 44 +
 3 files changed, 63 insertions(+), 1 deletion(-)



[incubator-tvm] branch master updated: [Rust] Add first stage of updating and rewriting Rust bindings. (#5526)

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

jroesch 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 aded92d  [Rust] Add first stage of updating and rewriting Rust 
bindings. (#5526)
aded92d is described below

commit aded92d3ba2d3a097425774d0890d07a9350e1bc
Author: Jared Roesch 
AuthorDate: Fri May 8 16:53:47 2020 -0700

[Rust] Add first stage of updating and rewriting Rust bindings. (#5526)

* Add tvm-sys

* Use as_mut_ptr

* Address CR feedback

* Update rust/tvm-sys/src/datatype.rs

Co-authored-by: Nick Hynes 

* Final CR comments

* Fix find and replace error in frontend

Co-authored-by: Nick Hynes 
---
 rust/.rustfmt.toml  |   1 +
 rust/Cargo.toml |   3 +-
 rust/{ => tvm-sys}/Cargo.toml   |  32 ++--
 rust/tvm-sys/build.rs   |  61 +++
 rust/tvm-sys/src/array.rs   |  62 +++
 rust/tvm-sys/src/byte_array.rs  |  87 +
 rust/tvm-sys/src/context.rs | 284 ++
 rust/tvm-sys/src/datatype.rs| 187 
 rust/tvm-sys/src/errors.rs  |  46 +
 rust/tvm-sys/src/lib.rs |  54 ++
 rust/tvm-sys/src/packed_func.rs | 380 
 rust/tvm-sys/src/value.rs   |  95 ++
 12 files changed, 1277 insertions(+), 15 deletions(-)

diff --git a/rust/.rustfmt.toml b/rust/.rustfmt.toml
index 3c51bb3..5a1f1d2 100644
--- a/rust/.rustfmt.toml
+++ b/rust/.rustfmt.toml
@@ -29,3 +29,4 @@ merge_derives = true
 use_try_shorthand = false
 use_field_init_shorthand = false
 force_explicit_abi = true
+
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index f08f861..b4a159c 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -27,5 +27,6 @@ members = [
"frontend",
"frontend/tests/basics",
"frontend/tests/callback",
-   "frontend/examples/resnet"
+   "frontend/examples/resnet",
+"tvm-sys"
 ]
diff --git a/rust/Cargo.toml b/rust/tvm-sys/Cargo.toml
similarity index 74%
copy from rust/Cargo.toml
copy to rust/tvm-sys/Cargo.toml
index f08f861..fe4d0bf 100644
--- a/rust/Cargo.toml
+++ b/rust/tvm-sys/Cargo.toml
@@ -15,17 +15,21 @@
 # specific language governing permissions and limitations
 # under the License.
 
-[workspace]
-members = [
-   "common",
-   "macros",
-   "runtime",
-   "runtime/tests/test_tvm_basic",
-   "runtime/tests/test_tvm_dso",
-   "runtime/tests/test_wasm32",
-   "runtime/tests/test_nn",
-   "frontend",
-   "frontend/tests/basics",
-   "frontend/tests/callback",
-   "frontend/examples/resnet"
-]
+[package]
+name = "tvm-sys"
+version = "0.1.0"
+authors = ["TVM Contributors"]
+license = "Apache-2.0"
+edition = "2018"
+
+[features]
+bindings = []
+
+[dependencies]
+thiserror = "^1.0"
+anyhow = "^1.0"
+ndarray = "0.12"
+enumn = "^0.1"
+
+[build-dependencies]
+bindgen = "0.51"
diff --git a/rust/tvm-sys/build.rs b/rust/tvm-sys/build.rs
new file mode 100644
index 000..85e16be
--- /dev/null
+++ b/rust/tvm-sys/build.rs
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+extern crate bindgen;
+
+use std::path::PathBuf;
+
+use std::env;
+
+fn main() {
+let tvm_home = option_env!("TVM_HOME").map(str::to_string).unwrap_or({
+let crate_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
+.canonicalize()
+.unwrap();
+crate_dir
+.parent()
+.unwrap()
+.parent()
+.unwrap()
+.to_str()
+.unwrap()
+.to_string()
+});
+
+if cfg!(feature = "bindings") {
+println!("cargo:rerun-if-env-changed=TVM_HOME");
+println!("cargo:r

[incubator-tvm] branch master updated (b4ee81d -> 19f322d)

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

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


from b4ee81d  [RPC][BUGFIX] Fix remote device sync (#5538)
 add 19f322d  [Refactor][std::string --> String] IRModule is updated with 
String (#5523)

No new revisions were added by this update.

Summary of changes:
 include/tvm/ir/module.h   | 34 +-
 src/ir/module.cc  | 34 +-
 src/printer/relay_text_printer.cc | 16 +++-
 3 files changed, 45 insertions(+), 39 deletions(-)



[incubator-tvm] 01/01: Add tvm-rt

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

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

commit d8d3147e304bdf5336acf22fb7616a9e59c2ad71
Author: Jared Roesch 
AuthorDate: Wed May 6 02:22:08 2020 -0700

Add tvm-rt
---
 include/tvm/ir/expr.h  |   5 +-
 python/tvm/runtime/object_generic.py   |   2 +-
 rust/macros/Cargo.toml |   4 +-
 rust/macros/src/{lib.rs => import_module.rs}   |  12 +-
 rust/macros/src/lib.rs | 124 +-
 rust/macros/src/object.rs  | 171 
 rust/tvm-rt/.gitignore |   7 +
 rust/{macros/Cargo.toml => tvm-rt/.travis.yml} |  24 +-
 rust/{macros => tvm-rt}/Cargo.toml |  30 +-
 rust/tvm-rt/README.md  | 235 +++
 rust/{macros => tvm-rt/examples/resnet}/Cargo.toml |  23 +-
 rust/tvm-rt/examples/resnet/README.md  |  45 +++
 rust/tvm-rt/examples/resnet/build.rs   |  42 ++
 rust/tvm-rt/examples/resnet/src/build_resnet.py| 134 +++
 rust/tvm-rt/examples/resnet/src/main.rs| 160 
 rust/tvm-rt/src/context.rs |  76 
 rust/tvm-rt/src/errors.rs  |  45 +++
 rust/tvm-rt/src/function.rs| 340 
 rust/tvm-rt/src/lib.rs | 124 ++
 rust/tvm-rt/src/module.rs  | 130 +++
 rust/tvm-rt/src/ndarray.rs | 431 +
 rust/tvm-rt/src/object/mod.rs  |  99 +
 rust/tvm-rt/src/object/object_ptr.rs   | 283 ++
 rust/tvm-rt/src/string.rs  |  72 
 rust/tvm-rt/src/to_boxed_fn.rs | 222 +++
 rust/tvm-rt/src/to_function.rs | 377 ++
 rust/tvm-rt/src/value.rs   | 166 
 rust/tvm-rt/tests/test_ir.rs   |  36 ++
 src/ir/expr.cc |  11 +-
 src/printer/relay_text_printer.cc  |  15 +-
 src/relay/transforms/to_cps.cc |   2 +-
 src/runtime/object.cc  |  14 +
 src/runtime/object_internal.h  |   9 +
 33 files changed, 3294 insertions(+), 176 deletions(-)

diff --git a/include/tvm/ir/expr.h b/include/tvm/ir/expr.h
index fba35a9..82689bd 100644
--- a/include/tvm/ir/expr.h
+++ b/include/tvm/ir/expr.h
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -36,6 +37,8 @@
 
 namespace tvm {
 
+using tvm::runtime::String;
+
 /*!
  * \brief Base type of all the expressions.
  * \sa Expr
@@ -189,7 +192,7 @@ class GlobalVar;
 class GlobalVarNode : public RelayExprNode {
  public:
   /*! \brief The name of the variable, this only acts as a hint. */
-  std::string name_hint;
+  String name_hint;
 
   void VisitAttrs(AttrVisitor* v) {
 v->Visit("name_hint", _hint);
diff --git a/python/tvm/runtime/object_generic.py 
b/python/tvm/runtime/object_generic.py
index cc21450..8f559ae 100644
--- a/python/tvm/runtime/object_generic.py
+++ b/python/tvm/runtime/object_generic.py
@@ -38,7 +38,7 @@ ObjectTypes = (ObjectBase, NDArrayBase, Module, 
ObjectRValueRef, PyNativeObject)
 
 
 def convert_to_object(value):
-"""Convert a python value to corresponding object type.
+"""Convert a Python value to corresponding object type.
 
 Parameters
 --
diff --git a/rust/macros/Cargo.toml b/rust/macros/Cargo.toml
index 784b35e..7abc9ae 100644
--- a/rust/macros/Cargo.toml
+++ b/rust/macros/Cargo.toml
@@ -32,5 +32,5 @@ proc-macro = true
 [dependencies]
 goblin = "0.0.24"
 proc-macro2 = "^1.0"
-quote = "1.0"
-syn = "1.0"
+quote = "^1.0"
+syn = { version = "1.0.17", features = ["full", "extra-traits"] }
diff --git a/rust/macros/src/lib.rs b/rust/macros/src/import_module.rs
similarity index 92%
copy from rust/macros/src/lib.rs
copy to rust/macros/src/import_module.rs
index 9f28c74..6b059ae 100644
--- a/rust/macros/src/lib.rs
+++ b/rust/macros/src/import_module.rs
@@ -16,9 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-extern crate proc_macro;
-
 use quote::quote;
 use std::{fs::File, io::Read};
 use syn::parse::{Parse, ParseStream, Result};
@@ -37,8 +34,7 @@ impl Parse for ImportModule {
 }
 }
 
-#[proc_macro]
-pub fn import_module(input: proc_macro::TokenStream) -> 
proc_macro::TokenStream {
+pub fn macro_impl(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
 let import_module_args = syn::parse_macro_input!(input as ImportModule);
 
 let man

[incubator-tvm] branch rust-tvm-rt created (now d8d3147)

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

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


  at d8d3147  Add tvm-rt

This branch includes the following new commits:

 new d8d3147  Add tvm-rt

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.




[incubator-tvm] branch rust-tvm-sys updated (5662f8e -> dd2bcd0)

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

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


 discard 5662f8e  Add tvm-sys
 add 12e737f  Make "none" DataType explicit (#5491)
 add 3f33b25  [Hexagon] Change "scalar" and "stack" in IDL from "inrout" to 
"in" (#5487)
 add 967d731  [MXNET]broadcast and logical op support (#5461)
 add 9c1e74c  [REFACTOR][BOYC] Non recursive partitioning (#5493)
 add 360027d  Link necessary libraries when building runtime for Android 
(#5496)
 add 8599f7c  [TFLite] Model importer to be compatible with tflite 2.1.0 
(#5497)
 add c7a16d8  [Rust] Fixes for wasm32 target (#5489)
 add 6347406  [uTVM] Reset target and wait for runtime initialization on 
connect. (#5499)
 add 0abf581  bump tophub rocm version (#5504)
 add 6bbab4c  Fix Canonical Simplifier (#5505)
 add 7e88030  [RUST][RUNTIME] Fix workspace (#5503)
 add 95e06b3  [REFACTOR][RPC][PROCOTOL-CHANGE] Modularize the RPC infra 
(#5484)
 add 70a5902  [RPC] Call sync in remote cpu to gpu copies (#5512)
 add 32a094c  [QNN] Support CallNode inputs in qnn.concatenate (#5360)
 add 4c9724d  [RPC][BUGFIX][BACKPORT-0.6] Fix bug in rpc ring buffer shrink 
(#5516)
 add 7cbc0ca  [PATCH] [ring_buffer.h] Improve commentary for RingBuffer 
(#5518)
 add 16cb571  [TFLITE]Nit: Function names made consitent (#5515)
 add 7eb2451  fix prelu importer and add tests: (#5521)
 add dd2bcd0  Add tvm-sys

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5662f8e)
\
 N -- N -- N   refs/heads/rust-tvm-sys (dd2bcd0)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .gitignore |3 +-
 3rdparty/dmlc-core |2 +-
 CMakeLists.txt |   26 +-
 apps/cpp_rpc/rpc_server.cc |   20 +-
 apps/cpp_rpc/rpc_tracker_client.h  |2 +-
 cmake/modules/Hexagon.cmake|6 +-
 golang/sample/gen_mobilenet_lib.py |8 +-
 include/tvm/runtime/c_runtime_api.h|   48 +
 include/tvm/runtime/data_type.h|   20 +-
 include/tvm/runtime/device_api.h   |   10 +-
 .../java/org/apache/tvm/contrib/GraphRuntime.java  |   53 +-
 .../src/main/java/org/apache/tvm/rpc/Client.java   |2 +-
 .../java/org/apache/tvm/rpc/NativeServerLoop.java  |2 +-
 .../main/java/org/apache/tvm/rpc/RPCSession.java   |4 +-
 python/tvm/_ffi/_ctypes/packed_func.py |8 +-
 python/tvm/_ffi/_cython/packed_func.pxi|8 +-
 python/tvm/_ffi/base.py|1 -
 python/tvm/autotvm/tophub.py   |2 +-
 python/tvm/contrib/cc.py   |   10 +-
 python/tvm/contrib/graph_runtime.py|9 +-
 python/tvm/error.py|5 +
 python/tvm/relay/frontend/mxnet.py |   37 +-
 python/tvm/relay/frontend/onnx.py  |7 +-
 python/tvm/relay/frontend/tflite.py|   38 +-
 python/tvm/relay/qnn/op/qnn.py |   13 +-
 python/tvm/rpc/__init__.py |4 +-
 python/tvm/{ir => rpc}/_ffi_api.py |4 +-
 python/tvm/rpc/base.py |7 -
 python/tvm/rpc/client.py   |  108 +-
 python/tvm/rpc/minrpc.py   |   86 ++
 python/tvm/rpc/proxy.py|3 +-
 python/tvm/rpc/server.py   |7 +-
 python/tvm/runtime/module.py   |6 +-
 rust/Cargo.toml|1 +
 rust/common/build.rs   |1 +
 rust/common/src/array.rs   |1 +
 rust/common/src/lib.rs |9 +-
 rust/runtime/src/array.rs  |1 +
 rust/runtime/src/graph.rs  |   13 +-
 rust/runtime/src/module/mod.rs |   12 +-
 rust/runtime/src/threading.rs  |9 +-
 rust/runtime/src/workspace.rs  |   10 +-
 rust/runtim

[incubator-tvm] branch rust-tvm-sys updated (79131d5 -> 5662f8e)

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

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


 discard 79131d5  Add the tvm-sys crate as the lowest level bindings.
 add 5662f8e  Add tvm-sys

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (79131d5)
\
 N -- N -- N   refs/heads/rust-tvm-sys (5662f8e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 include/tvm/ir/expr.h  |   5 +-
 include/tvm/node/container.h   |   2 +-
 include/tvm/node/reflection.h  |   2 +-
 include/tvm/relay/base.h   |   2 +-
 include/tvm/relay/expr.h   |   4 +-
 include/tvm/runtime/c_runtime_api.h|  11 -
 include/tvm/runtime/container.h|  16 -
 include/tvm/runtime/object.h   |   2 +-
 python/tvm/runtime/object_generic.py   |   2 +-
 rust/Cargo.toml|  19 +-
 rust/{tvm-sys => common}/Cargo.toml|   5 +-
 rust/common/build.rs   |  58 +++
 rust/{tvm-sys => common}/src/array.rs  |  85 
 rust/{tvm-sys => common}/src/errors.rs |  13 +-
 rust/{tvm-sys => common}/src/lib.rs|  26 +-
 rust/{tvm-sys => common}/src/packed_func.rs| 111 +++--
 rust/common/src/value.rs   | 231 +++
 rust/{tvm => frontend}/.gitignore  |   0
 rust/{tvm => frontend}/.travis.yml |   0
 rust/{tvm => frontend}/Cargo.toml  |  12 +-
 rust/{tvm => frontend}/README.md   |   0
 .../examples/resnet/Cargo.toml |   0
 rust/{tvm => frontend}/examples/resnet/README.md   |   0
 rust/{tvm => frontend}/examples/resnet/build.rs|   0
 .../examples/resnet/src/build_resnet.py|   0
 rust/{tvm => frontend}/examples/resnet/src/main.rs |   0
 rust/frontend/src/context.rs   | 330 +++
 rust/{tvm-rt => frontend}/src/errors.rs|  22 +-
 rust/frontend/src/function.rs  | 462 +
 rust/{tvm-rt => frontend}/src/lib.rs   |  32 +-
 rust/{tvm-rt => frontend}/src/module.rs|  45 +-
 rust/{tvm-rt => frontend}/src/ndarray.rs   |  90 ++--
 rust/frontend/src/value.rs | 166 
 rust/{tvm => frontend}/tests/basics/.gitignore |   0
 rust/{tvm => frontend}/tests/basics/Cargo.toml |   2 +-
 rust/{tvm => frontend}/tests/basics/build.rs   |   0
 rust/{tvm => frontend}/tests/basics/src/main.rs|   0
 rust/{tvm => frontend}/tests/basics/src/tvm_add.py |   0
 rust/{tvm => frontend}/tests/callback/Cargo.toml   |   2 +-
 .../tests/callback/src/bin/array.rs|   0
 .../tests/callback/src/bin/error.rs|   0
 .../tests/callback/src/bin/float.rs|   0
 .../tests/callback/src/bin/int.rs  |   0
 .../tests/callback/src/bin/string.rs   |   0
 rust/graph-runtime/.travis.yml |  22 -
 rust/macros/Cargo.toml |   4 +-
 rust/macros/src/import_module.rs   | 133 --
 rust/macros/src/lib.rs | 124 +-
 rust/macros/src/object.rs  | 171 
 rust/out-of-tree/Cargo.toml|  16 -
 rust/out-of-tree/import_pass.py|  41 --
 rust/out-of-tree/src/lib.rs|  60 ---
 rust/{tvm-rt => runtime}/.travis.yml   |   0
 rust/{graph-runtime => runtime}/Cargo.toml |   8 +-
 rust/{graph-runtime => runtime}/src/allocator.rs   |   0
 rust/{graph-runtime => runtime}/src/array.rs   |   4 +-
 rust/{graph-runtime => runtime}/src/errors.rs  |   0
 rust/{graph-runtime => runtime}/src/graph.rs   |   6 +-
 rust/{graph-runtime => runtime}/src/lib.rs |   5 +-
 rust/{graph-runtime => runtime}/src/module/dso.rs  |   4 +-
 rust/{graph-runtime => runtime}/src/module/mod.rs  |   4 +-
 .../src/module/syslib.rs   |   2 +-
 rust/{graph-runtime => runtime}/src/

[incubator-tvm] branch rust-tvm-sys updated (79131d5 -> 5662f8e)

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

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


 discard 79131d5  Add the tvm-sys crate as the lowest level bindings.
 add 5662f8e  Add tvm-sys

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (79131d5)
\
 N -- N -- N   refs/heads/rust-tvm-sys (5662f8e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 include/tvm/ir/expr.h  |   5 +-
 include/tvm/node/container.h   |   2 +-
 include/tvm/node/reflection.h  |   2 +-
 include/tvm/relay/base.h   |   2 +-
 include/tvm/relay/expr.h   |   4 +-
 include/tvm/runtime/c_runtime_api.h|  11 -
 include/tvm/runtime/container.h|  16 -
 include/tvm/runtime/object.h   |   2 +-
 python/tvm/runtime/object_generic.py   |   2 +-
 rust/Cargo.toml|  19 +-
 rust/{tvm-sys => common}/Cargo.toml|   5 +-
 rust/common/build.rs   |  58 +++
 rust/{tvm-sys => common}/src/array.rs  |  85 
 rust/{tvm-sys => common}/src/errors.rs |  13 +-
 rust/{tvm-sys => common}/src/lib.rs|  26 +-
 rust/{tvm-sys => common}/src/packed_func.rs| 111 +++--
 rust/common/src/value.rs   | 231 +++
 rust/{tvm => frontend}/.gitignore  |   0
 rust/{tvm => frontend}/.travis.yml |   0
 rust/{tvm => frontend}/Cargo.toml  |  12 +-
 rust/{tvm => frontend}/README.md   |   0
 .../examples/resnet/Cargo.toml |   0
 rust/{tvm => frontend}/examples/resnet/README.md   |   0
 rust/{tvm => frontend}/examples/resnet/build.rs|   0
 .../examples/resnet/src/build_resnet.py|   0
 rust/{tvm => frontend}/examples/resnet/src/main.rs |   0
 rust/frontend/src/context.rs   | 330 +++
 rust/{tvm-rt => frontend}/src/errors.rs|  22 +-
 rust/frontend/src/function.rs  | 462 +
 rust/{tvm-rt => frontend}/src/lib.rs   |  32 +-
 rust/{tvm-rt => frontend}/src/module.rs|  45 +-
 rust/{tvm-rt => frontend}/src/ndarray.rs   |  90 ++--
 rust/frontend/src/value.rs | 166 
 rust/{tvm => frontend}/tests/basics/.gitignore |   0
 rust/{tvm => frontend}/tests/basics/Cargo.toml |   2 +-
 rust/{tvm => frontend}/tests/basics/build.rs   |   0
 rust/{tvm => frontend}/tests/basics/src/main.rs|   0
 rust/{tvm => frontend}/tests/basics/src/tvm_add.py |   0
 rust/{tvm => frontend}/tests/callback/Cargo.toml   |   2 +-
 .../tests/callback/src/bin/array.rs|   0
 .../tests/callback/src/bin/error.rs|   0
 .../tests/callback/src/bin/float.rs|   0
 .../tests/callback/src/bin/int.rs  |   0
 .../tests/callback/src/bin/string.rs   |   0
 rust/graph-runtime/.travis.yml |  22 -
 rust/macros/Cargo.toml |   4 +-
 rust/macros/src/import_module.rs   | 133 --
 rust/macros/src/lib.rs | 124 +-
 rust/macros/src/object.rs  | 171 
 rust/out-of-tree/Cargo.toml|  16 -
 rust/out-of-tree/import_pass.py|  41 --
 rust/out-of-tree/src/lib.rs|  60 ---
 rust/{tvm-rt => runtime}/.travis.yml   |   0
 rust/{graph-runtime => runtime}/Cargo.toml |   8 +-
 rust/{graph-runtime => runtime}/src/allocator.rs   |   0
 rust/{graph-runtime => runtime}/src/array.rs   |   4 +-
 rust/{graph-runtime => runtime}/src/errors.rs  |   0
 rust/{graph-runtime => runtime}/src/graph.rs   |   6 +-
 rust/{graph-runtime => runtime}/src/lib.rs |   5 +-
 rust/{graph-runtime => runtime}/src/module/dso.rs  |   4 +-
 rust/{graph-runtime => runtime}/src/module/mod.rs  |   4 +-
 .../src/module/syslib.rs   |   2 +-
 rust/{graph-runtime => runtime}/src/

[incubator-tvm] branch rust-tvm-sys updated (84e7d53 -> 79131d5)

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

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


omit 84e7d53  Tests are passing
omit 6e7ef97  New function interface
omit 8ca7efd  Repair tests for tvm-sys
omit 719b805  Format for Max
omit 40a3adb  Hack hack
omit f4a940e  Almost there ...
omit 7fedb66  ToFunction not working
omit a4c6de2  Unify different context types and add ToFunction instances
omit e605234  Work on converting tvm-rt, split to_function into its own file
omit 77a6473  Clean up organization of tvm-sys
omit d74fb91  WIP
omit 37ce767  Add function and get out of tree pass working
omit 35be34b  WIP
omit 6a15349  WIP
omit 2177ffa  Almost got out of tree pass working
omit e38d2f7  Useful v1 of Macro
omit cb093c8  Object derive Macro v1
omit eea1f0f  Finish array support and add call node
omit 82377ba  Almost got arrays working
omit baf91bf  Remove diff tool generated files
omit f8b5f3c  Now with failing array test
omit b866880  Reorganize
omit 8c8bb4b  Runtime crate builds
omit 7701399  Reorganize to new structure
omit ebeb899  Add runtime copy
omit 06b1590  Move frontend
omit f4f4f50  Move runtime to graph-runtime
omit 1283829  Move tvm-common to tvm-sys
omit 2d8a2be  Convert to thiserror and anyhow
omit 62efbe2  WIP
omit 2ab6141  Add a couple more Relay IR nodes
omit c991575  Refactor the Rust libraries.
 add 79131d5  Add the tvm-sys crate as the lowest level bindings.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (84e7d53)
\
 N -- N -- N   refs/heads/rust-tvm-sys (79131d5)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:



[incubator-tvm] branch rust-tvm-sys created (now 84e7d53)

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

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


  at 84e7d53  Tests are passing

No new revisions were added by this update.



[incubator-tvm] branch master updated (9687307 -> 3cc4971)

2020-04-24 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 9687307  Corrected TVM autotuning on GPU (#5432)
 add 3cc4971  [RUNTIME][OBJECT] Introduce static slots for common objects. 
(#5423)

No new revisions were added by this update.

Summary of changes:
 include/tvm/ir/expr.h   |  7 ++--
 include/tvm/ir/function.h   |  1 +
 include/tvm/ir/tensor_type.h|  1 +
 include/tvm/ir/type.h   |  2 ++
 include/tvm/relay/expr.h|  1 +
 include/tvm/runtime/container.h |  6 ++--
 include/tvm/runtime/ndarray.h   |  4 +--
 include/tvm/runtime/object.h| 43 ++---
 include/tvm/runtime/packed_func.h   |  2 ++
 include/tvm/runtime/vm.h|  4 +--
 include/tvm/tir/stmt.h  |  1 +
 include/tvm/tir/var.h   |  1 +
 python/tvm/relay/quantize/quantize.py   |  2 +-
 python/tvm/runtime/container.py |  2 +-
 python/tvm/runtime/ndarray.py   |  2 +-
 src/arith/canonical_simplify.cc |  1 +
 src/runtime/module.cc   |  2 ++
 src/runtime/object.cc   | 34 ---
 src/target/codegen.cc   |  1 +
 src/target/opt/build_cuda_on.cc |  2 +-
 src/target/source/codegen_opencl.cc |  2 +-
 src/target/source/codegen_opengl.cc |  2 +-
 src/target/spirv/build_vulkan.cc|  2 +-
 src/target/stackvm/codegen_stackvm.cc   |  2 +-
 tests/cpp/build_module_test.cc  |  8 ++---
 tests/cpp/object_protocol_test.cc   |  1 +
 tests/cpp/relay_build_module_test.cc| 14 
 tests/cpp/utvm_runtime_standalone_test.cc   |  8 ++---
 tests/python/unittest/test_te_schedule_graph.py |  6 ++--
 29 files changed, 113 insertions(+), 51 deletions(-)



[incubator-tvm] branch master updated (e6dd8e1 -> 667e24f)

2020-03-24 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from e6dd8e1  [Relay] GradientCell Relay Pass (#5039)
 add 667e24f  [CI] Update rust docker (#5141)

No new revisions were added by this update.

Summary of changes:
 Jenkinsfile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)



[incubator-tvm] branch master updated (a6de507 -> e6dd8e1)

2020-03-24 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from a6de507  Change Rust version to stable in Docker (#5138)
 add e6dd8e1  [Relay] GradientCell Relay Pass (#5039)

No new revisions were added by this update.

Summary of changes:
 include/tvm/ir/module.h|   8 +
 include/tvm/relay/transform.h  |  14 +
 .../tvm/relay/std/gradient.rly |  48 ++-
 python/tvm/relay/transform/transform.py|  13 +
 src/ir/module.cc   |  12 +
 src/relay/transforms/lazy_gradient_init.cc | 317 +
 tests/python/relay/test_ir_parser.py   |   5 +-
 tests/python/relay/test_pass_lazy_gradient_init.py | 395 +
 8 files changed, 794 insertions(+), 18 deletions(-)
 copy tests/cpp/simple_passes_test.cc => python/tvm/relay/std/gradient.rly (50%)
 create mode 100644 src/relay/transforms/lazy_gradient_init.cc
 create mode 100644 tests/python/relay/test_pass_lazy_gradient_init.py



[incubator-tvm] 01/01: Fix up the final pieces

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

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

commit 5939ce700ca24f10dab71fa0d0c5fab19fd2be4f
Author: Jared Roesch 
AuthorDate: Sat Mar 21 22:30:29 2020 -0700

Fix up the final pieces
---
 rust/Cargo.toml   |   1 -
 rust/frontend/tests/callback/Cargo.toml   |   1 +
 rust/frontend/tests/callback/src/bin/error.rs |   5 +-
 rust/macros/Cargo.toml|   9 +-
 rust/macros/src/lib.rs| 123 --
 rust/macros_raw/Cargo.toml|  36 ---
 rust/macros_raw/src/lib.rs| 141 --
 rust/runtime/tests/test_nn/build.rs   |   3 +-
 rust/runtime/tests/test_tvm_basic/build.rs|  16 ++-
 rust/runtime/tests/test_tvm_basic/src/main.rs |   2 +-
 10 files changed, 141 insertions(+), 196 deletions(-)

diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 190a6eb..8467f6a 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -19,7 +19,6 @@
 members = [
"common",
"macros",
-   "macros_raw",
"runtime",
"runtime/tests/test_tvm_basic",
"runtime/tests/test_tvm_dso",
diff --git a/rust/frontend/tests/callback/Cargo.toml 
b/rust/frontend/tests/callback/Cargo.toml
index a452572..dfe80cc 100644
--- a/rust/frontend/tests/callback/Cargo.toml
+++ b/rust/frontend/tests/callback/Cargo.toml
@@ -19,6 +19,7 @@
 name = "callback"
 version = "0.0.0"
 authors = ["TVM Contributors"]
+edition = "2018"
 
 [dependencies]
 ndarray = "0.12"
diff --git a/rust/frontend/tests/callback/src/bin/error.rs 
b/rust/frontend/tests/callback/src/bin/error.rs
index 29bfd9a..c9f9a6f 100644
--- a/rust/frontend/tests/callback/src/bin/error.rs
+++ b/rust/frontend/tests/callback/src/bin/error.rs
@@ -19,10 +19,7 @@
 
 use std::panic;
 
-#[macro_use]
-extern crate tvm_frontend as tvm;
-
-use tvm::{errors::Error, *};
+use tvm_frontend::{errors::Error, *};
 
 fn main() {
 register_global_func! {
diff --git a/rust/macros/Cargo.toml b/rust/macros/Cargo.toml
index ff4f7d8..784b35e 100644
--- a/rust/macros/Cargo.toml
+++ b/rust/macros/Cargo.toml
@@ -19,13 +19,18 @@
 name = "tvm-macros"
 version = "0.1.1"
 license = "Apache-2.0"
-description = "Proc macros used by the TVM crates."
+description = "Procedural macros of the TVM crate."
 repository = "https://github.com/apache/incubator-tvm;
 readme = "README.md"
 keywords = ["tvm"]
 authors = ["TVM Contributors"]
 edition = "2018"
 
+[lib]
+proc-macro = true
 
 [dependencies]
-tvm-macros-raw = { path = "../macros_raw" }
+goblin = "0.0.24"
+proc-macro2 = "^1.0"
+quote = "1.0"
+syn = "1.0"
diff --git a/rust/macros/src/lib.rs b/rust/macros/src/lib.rs
index efd85d0..d1d86b6 100644
--- a/rust/macros/src/lib.rs
+++ b/rust/macros/src/lib.rs
@@ -17,12 +17,123 @@
  * under the License.
  */
 
-#[macro_use]
-extern crate tvm_macros_raw;
+extern crate proc_macro;
 
-#[macro_export]
-macro_rules! import_module {
-($module_path:literal) => {
-$crate::import_module_raw!(file!(), $module_path);
+use std::{fs::File, io::Read};
+use syn::parse::{Parse, ParseStream, Result};
+use syn::{LitStr};
+use quote::quote;
+
+use std::path::PathBuf;
+
+struct ImportModule {
+importing_file: LitStr,
+}
+
+impl Parse for ImportModule {
+fn parse(input: ParseStream) -> Result {
+let importing_file: LitStr = input.parse()?;
+Ok(ImportModule {
+importing_file,
+})
+}
+}
+
+#[proc_macro]
+pub fn import_module(input: proc_macro::TokenStream) -> 
proc_macro::TokenStream {
+let import_module_args = syn::parse_macro_input!(input as ImportModule);
+
+let manifest = std::env::var("CARGO_MANIFEST_DIR")
+.expect("variable should always be set by Cargo.");
+
+let mut path = PathBuf::new();
+path.push(manifest);
+path = path.join(import_module_args.importing_file.value());
+
+let mut fd = File::open()
+.unwrap_or_else(|_| panic!("Unable to find TVM object file at `{}`", 
path.display()));
+let mut buffer = Vec::new();
+fd.read_to_end( buffer).unwrap();
+
+let fn_names = match goblin::Object::parse().unwrap() {
+goblin::Object::Elf(elf) => elf
+.syms
+.iter()
+.filter_map(|s| {
+if s.st_type() == 0 || 
goblin::elf::sym::type_to_str(s.st_type()) == "FILE" {
+return None;
+}
+match elf.strtab.get(s.st_name) {
+Some(Ok(name)) if name != "" => {
+  

[incubator-tvm] branch rust-stablize created (now 5939ce7)

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

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


  at 5939ce7  Fix up the final pieces

This branch includes the following new commits:

 new 5939ce7  Fix up the final pieces

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.




[incubator-tvm] branch master updated (545f6ea -> b422f6a)

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

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


from 545f6ea  [Fix] remove unnecessary spliting in the cached chunk (#4935)
 add b422f6a  [WIP] Fixing an Infinite Loop case in UnmatchedChecker. 
(#4881)

No new revisions were added by this update.

Summary of changes:
 src/relay/pass/match_exhaustion.cc  | 34 +++--
 tests/python/relay/test_pass_unmatched_cases.py | 25 ++
 2 files changed, 34 insertions(+), 25 deletions(-)



[incubator-tvm] branch master updated (f9b46c4 -> 3e7bd70)

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

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


from f9b46c4  [REFACTOR][PY] tvm._ffi (#4813)
 add 3e7bd70  allow customize mkldnn library location (#4814)

No new revisions were added by this update.

Summary of changes:
 cmake/config.cmake   |  2 +-
 cmake/modules/contrib/BLAS.cmake | 28 +++-
 2 files changed, 24 insertions(+), 6 deletions(-)



[incubator-tvm] branch master updated (1b8522e -> 6798ba8)

2020-01-29 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from 1b8522e  [AUTOTVM] Fix a bug in generating the search space (#4779)
 add 6798ba8  Make sure to visit the arguments of inlined functions (#4783)

No new revisions were added by this update.

Summary of changes:
 src/relay/backend/vm/inline_primitives.cc | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)



[incubator-tvm] branch pass_callback_via_cx created (now 00ec7f9)

2020-01-27 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


  at 00ec7f9  [Build] Explicitly link to cublasLt if it exists (#4776)

No new revisions were added by this update.



[incubator-tvm] branch pass_callback_via_cx updated: Implement pass tracing API

2020-01-27 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/pass_callback_via_cx by this 
push:
 new 1f38493  Implement pass tracing API
1f38493 is described below

commit 1f3849378884be54c16efcd23c78f168c5c99ecd
Author: Jared Roesch 
AuthorDate: Mon Jan 27 16:35:45 2020 -0800

Implement pass tracing API
---
 include/tvm/ir/transform.h  | 19 +++
 python/tvm/relay/transform.py   | 13 +
 src/ir/transform.cc |  8 
 src/relay/ir/transform.cc   |  3 ++-
 tests/python/relay/test_pass_manager.py | 30 ++
 5 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/include/tvm/ir/transform.h b/include/tvm/ir/transform.h
index c606b34..03aba40 100644
--- a/include/tvm/ir/transform.h
+++ b/include/tvm/ir/transform.h
@@ -65,6 +65,14 @@
 namespace tvm {
 namespace transform {
 
+// Forward declare for TraceFunc.
+class PassInfo;
+
+/*! \brief A callback for tracing passes, useful for debugging and logging.
+ *
+ */
+using TraceFunc = runtime::TypedPackedFunc;
+
 /*!
  * \brief PassContextNode contains the information that a pass can rely on,
  * such as analysis results.
@@ -88,6 +96,8 @@ class PassContextNode : public Object {
   /*! \brief The list of disabled passes. */
   Array disabled_pass;
 
+  TraceFunc trace_func;
+
   PassContextNode() = default;
 
   void VisitAttrs(AttrVisitor* v) {
@@ -101,6 +111,7 @@ class PassContextNode : public Object {
   TVM_DECLARE_FINAL_OBJECT_INFO(PassContextNode, Object);
 };
 
+
 /*!
  * \brief PassContext that is used to configure the pass behavior.
  *
@@ -146,6 +157,14 @@ class PassContext : public ObjectRef {
*/
   TVM_DLL static PassContext Current();
 
+  /*!
+   * \brief Apply the tracing functions of the context to the module, with the 
info.
+   * \param module The IRModule to trace.
+   * \param info The pass information.
+   * \param is_before Indicated whether the tracing is before or after a pass.
+   */
+  TVM_DLL void Trace(const IRModule& module, const PassInfo& info, bool 
is_before) const;
+
   // accessor.
   using ContainerType = PassContextNode;
   class Internal;
diff --git a/python/tvm/relay/transform.py b/python/tvm/relay/transform.py
index c4fbde6..26b20e0 100644
--- a/python/tvm/relay/transform.py
+++ b/python/tvm/relay/transform.py
@@ -78,7 +78,8 @@ class PassContext(RelayNode):
  opt_level=2,
  fallback_device=_nd.cpu(),
  required_pass=None,
- disabled_pass=None):
+ disabled_pass=None,
+ trace=None):
 if isinstance(fallback_device, str):
 fallback_device = _nd.context(fallback_device).device_type
 elif isinstance(fallback_device, TVMContext):
@@ -99,7 +100,7 @@ class PassContext(RelayNode):
 
 self.__init_handle_by_constructor__(_transform.PassContext, opt_level,
 fallback_device, required,
-disabled)
+disabled, trace)
 
 def __enter__(self):
 _transform.EnterPassContext(self)
@@ -117,7 +118,8 @@ class PassContext(RelayNode):
 def build_config(opt_level=2,
  fallback_device=_nd.cpu(),
  required_pass=None,
- disabled_pass=None):
+ disabled_pass=None,
+ trace=None):
 """Configure the build behavior by setting config variables.
 
 Parameters
@@ -151,13 +153,16 @@ def build_config(opt_level=2,
 disabled_pass: set of str, optional
 Optimization passes to be disabled during optimization.
 
+trace: Callable[[IRModule, PassInfo, bool], None]
+A tracing function for debugging or introspection.
+
 Returns
 ---
 pass_context: PassContext
 The pass context for optimizations.
 """
 return PassContext(opt_level, fallback_device, required_pass,
-   disabled_pass)
+   disabled_pass, trace)
 
 
 @register_relay_node
diff --git a/src/ir/transform.cc b/src/ir/transform.cc
index 1da010c..d14a5b4 100644
--- a/src/ir/transform.cc
+++ b/src/ir/transform.cc
@@ -84,6 +84,10 @@ PassContext PassContext::Create() {
   return PassContext(make_object());
 }
 
+void PassContext::Trace(const IRModule& module, const PassInfo& info, bool 
is_before) const {
+this->operator->()->trace_func(module, info, is_before);
+}
+
 class ModulePass;
 
 /*!
@@ -231,8 +235,10 @@ IRModule ModulePassNode::operator()(const IRModule& mod,
  << " with opt level: "
  << pass_info->opt_level;
   CHECK(mod.defined());
+  pas

[incubator-tvm] branch master updated (f71a10c -> de919cb)

2020-01-27 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from f71a10c  properly extract error type from windows error message (#4780)
 add de919cb  [Relay][Frontend][ONNX] Broadcast condition, x, and y for 
Where op (#4774)

No new revisions were added by this update.

Summary of changes:
 python/tvm/relay/frontend/onnx.py  | 29 -
 tests/python/frontend/onnx/test_forward.py | 16 
 2 files changed, 40 insertions(+), 5 deletions(-)



[incubator-tvm] branch master updated (dcf7fbf -> 86092de)

2020-01-10 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from dcf7fbf  [Relay][TOPI]Fix meaning of conv2d_transpose output_padding 
parameter (#4318)
 add 86092de  [REFACTOR] Replace TensorObj and TensorValue with NDArray 
(#4643)

No new revisions were added by this update.

Summary of changes:
 docs/api/python/dev.rst|  13 +-
 docs/dev/codebase_walkthrough.rst  |   8 +-
 include/tvm/relay/interpreter.h| 105 ---
 include/tvm/runtime/vm.h   |  19 --
 python/tvm/__init__.py |   4 +-
 python/tvm/_ffi/_ctypes/function.py|  13 +-
 python/tvm/_ffi/_ctypes/object.py  |  10 +-
 python/tvm/_ffi/_cython/function.pxi   |  11 +-
 python/tvm/_ffi/_cython/object.pxi |   8 +-
 python/tvm/_ffi/function.py|   2 +-
 python/tvm/_ffi/node.py|  89 --
 python/tvm/_ffi/object.py  |  66 ++-
 .../_ffi/{node_generic.py => object_generic.py}|  30 ++--
 python/tvm/api.py  |  19 +-
 python/tvm/arith.py|  16 +-
 python/tvm/attrs.py|   6 +-
 python/tvm/build_module.py |  18 +-
 python/tvm/container.py|  28 +--
 python/tvm/expr.py |  86 +-
 python/tvm/ir_builder.py   |   6 +-
 python/tvm/{node.py => object.py}  |   4 +-
 python/tvm/relay/_module.pyi   |   4 +-
 python/tvm/relay/adt.py|   4 +-
 python/tvm/relay/backend/compile_engine.py |  10 +-
 python/tvm/relay/backend/interpreter.py|  62 ++-
 python/tvm/relay/backend/vm.py |  12 +-
 python/tvm/relay/backend/vmobj.py  |  45 +
 python/tvm/relay/base.py   |   9 +-
 python/tvm/relay/expr.pyi  |   4 +-
 python/tvm/relay/quantize/quantize.py  |   4 +-
 python/tvm/relay/testing/py_converter.py   |  19 +-
 python/tvm/relay/transform.pyi |   8 +-
 python/tvm/relay/ty.pyi|   4 +-
 python/tvm/schedule.py |  40 ++---
 python/tvm/stmt.py |  32 ++--
 python/tvm/target.py   |  12 +-
 python/tvm/tensor.py   |  43 ++---
 python/tvm/tensor_intrin.py|   6 +-
 src/relay/backend/interpreter.cc   | 191 ++---
 src/relay/backend/vm/compiler.cc   |   2 +-
 src/relay/pass/fold_constant.cc|  26 +--
 src/relay/pass/partial_eval.cc |  13 +-
 src/runtime/vm/executable.cc   |  15 +-
 src/runtime/vm/object.cc   |  20 ---
 src/runtime/vm/vm.cc   |  50 ++
 .../frontend/tensorflow/test_control_flow.py   |   3 +-
 tests/python/frontend/tensorflow/test_forward.py   |   4 +-
 tests/python/relay/test_adt.py |   4 +-
 tests/python/relay/test_backend_interpreter.py |  37 ++--
 tests/python/relay/test_py_converter.py|   9 +-
 tests/python/relay/test_vm.py  |   2 +-
 tests/python/relay/test_vm_object.py   |  18 +-
 .../unittest/test_pass_inject_double_buffer.py |   4 +-
 tests/python/unittest/test_pass_inject_vthread.py  |   8 +-
 tests/python/unittest/test_pass_storage_flatten.py |   4 +-
 55 files changed, 508 insertions(+), 781 deletions(-)
 delete mode 100644 python/tvm/_ffi/node.py
 rename python/tvm/_ffi/{node_generic.py => object_generic.py} (82%)
 rename python/tvm/{node.py => object.py} (93%)



[incubator-tvm] branch master updated (da23619 -> 3f6b3db)

2019-11-15 Thread jroesch
This is an automated email from the ASF dual-hosted git repository.

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


from da23619  Add check to ensure input file was successfully opened in 
NNVM deploy code demo (#4315)
 add 3f6b3db  [COMMUNITY] Add DISCLAIMER, KEYS for ASF release (#4345)

No new revisions were added by this update.

Summary of changes:
 DISCLAIMER| 12 +++
 KEYS  | 74 +++
 NOTICE|  7 +++-
 tests/lint/check_file_type.py |  2 ++
 4 files changed, 94 insertions(+), 1 deletion(-)
 create mode 100644 DISCLAIMER
 create mode 100644 KEYS