You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/11/11 18:33:45 UTC

[GitHub] [incubator-tvm] tkonolige commented on a change in pull request #6874: [Diagnostics][WIP] Enable AnnotateSpans by default, add environment variable for controlling top-level.

tkonolige commented on a change in pull request #6874:
URL: https://github.com/apache/incubator-tvm/pull/6874#discussion_r521558057



##########
File path: python/tvm/__init__.py
##########
@@ -67,16 +67,33 @@
 # Contrib initializers
 from .contrib import rocm as _rocm, nvcc as _nvcc, sdaccel as _sdaccel
 
+def _should_print_backtrace():
+    in_pytest = "PYTEST_CURRENT_TEST" in os.environ
+    tvm_backtrace = os.environ.get("TVM_BACKTRACE", "0")
+
+    try:
+        tvm_backtrace = bool(int(tvm_backtrace))
+    except ValueError:
+        raise ValueError(
+            "invalid value for TVM_BACKTRACE `{tvm_backtrace}`, please set to 0 or 1.")

Review comment:
       ```suggestion
               f"invalid value for TVM_BACKTRACE `{tvm_backtrace}`, please set to 0 or 1.")
   ```

##########
File path: src/parser/parser.cc
##########
@@ -605,30 +605,42 @@ class Parser {
     return ast;
   }
 
+  struct MetaRef {

Review comment:
       Are changes in this file relevant?

##########
File path: python/tvm/__init__.py
##########
@@ -67,16 +67,33 @@
 # Contrib initializers
 from .contrib import rocm as _rocm, nvcc as _nvcc, sdaccel as _sdaccel
 
+def _should_print_backtrace():
+    in_pytest = "PYTEST_CURRENT_TEST" in os.environ
+    tvm_backtrace = os.environ.get("TVM_BACKTRACE", "0")
+
+    try:
+        tvm_backtrace = bool(int(tvm_backtrace))
+    except ValueError:
+        raise ValueError(
+            "invalid value for TVM_BACKTRACE `{tvm_backtrace}`, please set to 0 or 1.")
+
+    return in_pytest or tvm_backtrace
 
 def tvm_wrap_excepthook(exception_hook):
     """Wrap given excepthook with TVM additional work."""
 
     def wrapper(exctype, value, trbk):
         """Clean subprocesses when TVM is interrupted."""
         in_pytest = "PYTEST_CURRENT_TEST" in os.environ
+        tvm_backtrace = os.environ.get("TVM_BACKTRACE", "0")

Review comment:
       I think you want to delete these lines




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

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