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

comaniac 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 86122d1  [FIX,AUTOTVM] Print warning when all autotvm tasks fail with 
errors (#6612)
86122d1 is described below

commit 86122d125d9fc8d08003bf6a3fffeeca490dc634
Author: Tristan Konolige <[email protected]>
AuthorDate: Mon Oct 5 16:50:25 2020 -0700

    [FIX,AUTOTVM] Print warning when all autotvm tasks fail with errors (#6612)
    
    * [FIX,AUTOTVM] Print warning when all autotvm tasks fail with errors.
    
    * formatting
    
    * write errors to tempfile
    
    * wording
    
    * wording
    
    * don't duplicate errors
    
    * Ensure we have a string for an error
---
 python/tvm/autotvm/tuner/tuner.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/python/tvm/autotvm/tuner/tuner.py 
b/python/tvm/autotvm/tuner/tuner.py
index 9864ba0..b769d34 100644
--- a/python/tvm/autotvm/tuner/tuner.py
+++ b/python/tvm/autotvm/tuner/tuner.py
@@ -17,6 +17,7 @@
 # pylint: disable=unused-argument, no-self-use, invalid-name
 """Base class of tuner"""
 import logging
+import tempfile
 
 import numpy as np
 
@@ -121,6 +122,7 @@ class Tuner(object):
 
         GLOBAL_SCOPE.in_tuning = True
         i = error_ct = 0
+        errors = []
         while i < n_trial:
             if not self.has_next():
                 break
@@ -139,6 +141,11 @@ class Tuner(object):
                 else:
                     flops = 0
                     error_ct += 1
+                    error = res.costs[0]
+                    if isinstance(error, str):
+                        errors.append(error)
+                    else:
+                        errors.append(str(error))
 
                 if flops > self.best_flops:
                     self.best_flops = flops
@@ -174,6 +181,16 @@ class Tuner(object):
             else:
                 logger.setLevel(old_level)
 
+        if error_ct == i:
+            _, f = tempfile.mkstemp(prefix="tvm_tuning_errors_", 
suffix=".log", text=True)
+            with open(f, "w") as file:
+                file.write("\n".join(errors))
+            logging.warning(
+                "Could not find any valid schedule for task %s. "
+                "A file containing the errors has been written to %s.",
+                self.task,
+                f,
+            )
         GLOBAL_SCOPE.in_tuning = False
         del measure_batch
 

Reply via email to