From 800e6beb5873e96acbc18e4b7bb156b3372eb0f3 Mon Sep 17 00:00:00 2001 From: Ruihang Lai Date: Fri, 3 Mar 2023 23:24:23 -0500 Subject: [PATCH] [HotFix][MetaSchedule] Turn off database shash check At this moment, the structural hash values of IR in TVM is platform dependent (e.g., the hash values of a String may differ on different platforms). In our recent practice, we found this an obstacle for us to apply one existing database on different platforms (say we tune an IRModule with MetaSchedule on Metal, and then apply the database on CUDA, etc.) To clear this obstacle, we decide to remove the shash value check. The purpose of that check is mainly to ensure safety, and thus turning it off will make no difference in terms of using MetaSchedule in most of the cases that we can imagine. Meanwhile, it is equally important that we need to make our structural hash platform independent. There are plans ongoing for this target. --- src/meta_schedule/database/json_database.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/meta_schedule/database/json_database.cc b/src/meta_schedule/database/json_database.cc index 10ff89a7ce18..3e08cec95de3 100644 --- a/src/meta_schedule/database/json_database.cc +++ b/src/meta_schedule/database/json_database.cc @@ -172,9 +172,13 @@ Database Database::JSONDatabase(String path_workload, String path_tuning_record, for (int i = 0; i < n_objs; ++i) { Workload workload = Workload::FromJSON(json_objs[i]); auto recalc_hash = n->GetModuleEquality().Hash(workload->mod); - CHECK_EQ(recalc_hash, workload->shash) - << "ValueError: Module hash changed. Given: " << workload->shash - << "; Recalculated: " << recalc_hash; + // Todo(tvm-team): re-enable the shash check when we get environment + // independent structural hash values. + if (recalc_hash != workload->shash) { + ObjectPtr wkl = make_object(*workload.get()); + wkl->shash = recalc_hash; + workload = Workload(wkl); + } n->workloads2idx_.emplace(workload, i); workloads.push_back(workload); }