You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2020/09/02 19:17:28 UTC

[incubator-tvm] branch master updated: [RELAY] Fix the FoldConstant Regression for VTA (#6377)

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 693c0de  [RELAY] Fix the FoldConstant Regression for VTA (#6377)
693c0de is described below

commit 693c0dede1404aa240374c81e2ea9d7490417642
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Wed Sep 2 12:17:14 2020 -0700

    [RELAY] Fix the FoldConstant Regression for VTA (#6377)
    
    * [RELAY] Fix the FoldConstant Regression for VTA
    
    * [CI] Fix error guard that was missed in VTA.
    
    This PR fixes an error guard during the documentation build step.
    
    - Temporary disables VTA frontend tutorial due to
      the regression of deploy_detection
---
 src/relay/transforms/fold_constant.cc              | 26 +++++++++-------------
 tests/scripts/task_python_docs.sh                  |  3 ++-
 .../frontend/{ => legacy}/deploy_detection.py      |  0
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/relay/transforms/fold_constant.cc b/src/relay/transforms/fold_constant.cc
index 0ecbfea..7273c28 100644
--- a/src/relay/transforms/fold_constant.cc
+++ b/src/relay/transforms/fold_constant.cc
@@ -177,20 +177,6 @@ class ConstantFolder : public ExprMutator {
   const Op& cast_op_;
   const Op& ndarray_size_op_;
 
-  // Create an interpreter.
-  FInterpreter GetInterpreter(const IRModule& mod) {
-    using tvm::transform::PassContext;
-    DLContext ctx;
-    ctx.device_type = kDLCPU;
-    ctx.device_id = 0;
-    Target target = Target::Create("llvm");
-    // use a fresh build context
-    // in case we are already in a build context.
-    With<PassContext> fresh_build_ctx(PassContext::Create());
-
-    return CreateInterpreter(mod, ctx, target);
-  }
-
   // Convert value to expression.
   Expr ObjectToExpr(const ObjectRef& value) {
     if (value->IsInstance<runtime::NDArray::ContainerType>()) {
@@ -230,7 +216,17 @@ class ConstantFolder : public ExprMutator {
     auto entry_func = Downcast<Function>(mod->Lookup("main"));
     expr = expr.as<FunctionNode>() == nullptr ? entry_func->body : entry_func;
 
-    FInterpreter executor = GetInterpreter(mod);
+    using tvm::transform::PassContext;
+    DLContext ctx;
+    ctx.device_type = kDLCPU;
+    ctx.device_id = 0;
+    Target target = Target::Create("llvm");
+    // use a fresh build context
+    // in case we are already in a build context.
+    // needed for both execution and creation(due to JIT)
+    With<PassContext> fresh_build_ctx(PassContext::Create());
+
+    FInterpreter executor = CreateInterpreter(mod, ctx, target);
     return ObjectToExpr(executor(expr));
   }
 
diff --git a/tests/scripts/task_python_docs.sh b/tests/scripts/task_python_docs.sh
index c239abb..29166c6 100755
--- a/tests/scripts/task_python_docs.sh
+++ b/tests/scripts/task_python_docs.sh
@@ -18,6 +18,7 @@
 
 set -e
 set -u
+set -o pipefail
 
 source tests/scripts/setup-pytest-env.sh
 
@@ -48,7 +49,7 @@ make cython3
 
 cd docs
 PYTHONPATH=`pwd`/../python make html |& tee /tmp/$$.log.txt
-if grep -E "failed to execute" < /tmp/$$.log.txt; then
+if grep -E "failed to execute|Segmentation fault" < /tmp/$$.log.txt; then
     echo "Some of sphinx-gallery item example failed to execute."
     exit 1
 fi
diff --git a/vta/tutorials/frontend/deploy_detection.py b/vta/tutorials/frontend/legacy/deploy_detection.py
similarity index 100%
rename from vta/tutorials/frontend/deploy_detection.py
rename to vta/tutorials/frontend/legacy/deploy_detection.py