You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by xi...@apache.org on 2022/06/29 06:33:57 UTC

[tvm] branch main updated: [MetaSchedule] Improve Error Message in JSON Database (#11940)

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

xiyou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 9ea681f618 [MetaSchedule] Improve Error Message in JSON Database (#11940)
9ea681f618 is described below

commit 9ea681f618d3f580659f3a7fae54b5691da55384
Author: Junru Shao <ju...@gmail.com>
AuthorDate: Tue Jun 28 23:33:52 2022 -0700

    [MetaSchedule] Improve Error Message in JSON Database (#11940)
---
 src/meta_schedule/database/json_database.cc | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/meta_schedule/database/json_database.cc b/src/meta_schedule/database/json_database.cc
index 9bb7ee1027..23ecb121f4 100644
--- a/src/meta_schedule/database/json_database.cc
+++ b/src/meta_schedule/database/json_database.cc
@@ -194,14 +194,19 @@ Database Database::JSONDatabase(String path_workload, String path_tuning_record,
     support::parallel_for_dynamic(
         0, json_objs.size(), num_threads, [&](int thread_id, int task_id) {
           const ObjectRef& json_obj = json_objs[task_id];
+          Workload workload{nullptr};
           try {
             const ArrayNode* arr = json_obj.as<ArrayNode>();
             ICHECK_EQ(arr->size(), 2);
-            records[task_id] = TuningRecord::FromJSON(arr->at(1),  //
-                                                      workloads[Downcast<Integer>(arr->at(0))]);
+            workload = workloads[Downcast<Integer>(arr->at(0))];
+            records[task_id] = TuningRecord::FromJSON(arr->at(1), workload);
           } catch (std::runtime_error& e) {
-            LOG(FATAL) << "ValueError: Unable to parse the JSON object: " << json_obj
-                       << "\nThe error is: " << e.what();
+            LOG(FATAL) << "ValueError: Unable to parse TuningRecord, on line " << (task_id + 1)
+                       << " of file " << path_tuning_record << ". The workload is:\n"
+                       << (workload.defined() ? tir::AsTVMScript(workload) : "(null)")
+                       << "\nThe JSONObject of TuningRecrod is:\n"
+                       << json_obj << "\nThe error message is:\n"
+                       << e.what();
           }
         });
     for (const TuningRecord& record : records) {