From e2d700b0fb25710260e40e62a5ca1d87b4cfd310 Mon Sep 17 00:00:00 2001 From: Yuanjing Shi Date: Fri, 22 Apr 2022 00:41:10 -0700 Subject: [PATCH 1/5] add task name during printing table info --- python/tvm/auto_scheduler/task_scheduler.py | 31 +++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/python/tvm/auto_scheduler/task_scheduler.py b/python/tvm/auto_scheduler/task_scheduler.py index baa0bb365fe6..03615beeb9e7 100644 --- a/python/tvm/auto_scheduler/task_scheduler.py +++ b/python/tvm/auto_scheduler/task_scheduler.py @@ -577,8 +577,12 @@ def pre_tune(self, task_scheduler, task_id): return _ffi_api.PrintTitle("Task Scheduler") - print("| ID | Latency (ms) | Speed (GFLOPS) | Trials |") - print("-------------------------------------------------") + print( + "| ID | Task Name | Latency (ms) | Speed (GFLOPS) | Trials |" + ) + print( + "-----------------------------------------------------------------------------------------------------------------" + ) # content for i in range(len(task_scheduler.tasks)): @@ -588,6 +592,7 @@ def pre_tune(self, task_scheduler, task_id): if task_scheduler.best_costs[i] < 1e9 else "-" ) + task_name = task_scheduler.task[i].desc speed_str = ( "%.2f" % (task_scheduler.tasks[i].compute_dag.flop_ct / task_scheduler.best_costs[i] / 1e9) @@ -595,8 +600,13 @@ def pre_tune(self, task_scheduler, task_id): else "-" ) trials_str = "%d" % (task_scheduler.task_cts[i] * task_scheduler.num_measures_per_round) - print("| %4s | %12s | % 14s | %6s |" % (id_str, latency_str, speed_str, trials_str)) - print("-------------------------------------------------") + print( + "| %4s | %40s | %12s | % 14s | %6s |" + % (id_str, task_name, latency_str, speed_str, trials_str) + ) + print( + "-----------------------------------------------------------------------------------------------------------------" + ) # overall info if all(cost < 1e9 for cost in task_scheduler.best_costs): @@ -605,12 +615,7 @@ def pre_tune(self, task_scheduler, task_id): total_latency_str = "-" print( "Estimated total latency: %s ms\tTrials: %d\tUsed time : %.0f s\tNext ID: %d\t" - % ( - total_latency_str, - task_scheduler.ct, - time.time() - task_scheduler.tic, - task_id, - ) + % (total_latency_str, task_scheduler.ct, time.time() - task_scheduler.tic, task_id,) ) @@ -638,10 +643,6 @@ def post_tune(self, task_scheduler, task_id): with open(self.log_file, "a") as filep: filep.write( "ElapsedTime(s)\t%.0f\tEstimatedLatency(ms)\t%s\tTrials\t%d\n" - % ( - time.time() - task_scheduler.tic, - total_latency_str, - task_scheduler.ct, - ) + % (time.time() - task_scheduler.tic, total_latency_str, task_scheduler.ct,) ) filep.flush() From 10b2e9c8ba49da479e9af8c7f2924274547a16c7 Mon Sep 17 00:00:00 2001 From: Yuanjing Shi Date: Fri, 22 Apr 2022 12:02:21 -0700 Subject: [PATCH 2/5] address comments and fix lint --- python/tvm/auto_scheduler/task_scheduler.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/python/tvm/auto_scheduler/task_scheduler.py b/python/tvm/auto_scheduler/task_scheduler.py index 03615beeb9e7..79d0c1881313 100644 --- a/python/tvm/auto_scheduler/task_scheduler.py +++ b/python/tvm/auto_scheduler/task_scheduler.py @@ -578,7 +578,7 @@ def pre_tune(self, task_scheduler, task_id): _ffi_api.PrintTitle("Task Scheduler") print( - "| ID | Task Name | Latency (ms) | Speed (GFLOPS) | Trials |" + "| ID | Task Description | Latency (ms) | Speed (GFLOPS) | Trials |" ) print( "-----------------------------------------------------------------------------------------------------------------" @@ -615,7 +615,12 @@ def pre_tune(self, task_scheduler, task_id): total_latency_str = "-" print( "Estimated total latency: %s ms\tTrials: %d\tUsed time : %.0f s\tNext ID: %d\t" - % (total_latency_str, task_scheduler.ct, time.time() - task_scheduler.tic, task_id,) + % ( + total_latency_str, + task_scheduler.ct, + time.time() - task_scheduler.tic, + task_id, + ) ) @@ -643,6 +648,10 @@ def post_tune(self, task_scheduler, task_id): with open(self.log_file, "a") as filep: filep.write( "ElapsedTime(s)\t%.0f\tEstimatedLatency(ms)\t%s\tTrials\t%d\n" - % (time.time() - task_scheduler.tic, total_latency_str, task_scheduler.ct,) + % ( + time.time() - task_scheduler.tic, + total_latency_str, + task_scheduler.ct, + ) ) filep.flush() From 1c86fdae6868bd6f7b7dc1b6d136e3f09cce53cb Mon Sep 17 00:00:00 2001 From: Yuanjing Shi Date: Fri, 22 Apr 2022 12:46:49 -0700 Subject: [PATCH 3/5] better look --- python/tvm/auto_scheduler/task_scheduler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tvm/auto_scheduler/task_scheduler.py b/python/tvm/auto_scheduler/task_scheduler.py index 79d0c1881313..e1908fb65107 100644 --- a/python/tvm/auto_scheduler/task_scheduler.py +++ b/python/tvm/auto_scheduler/task_scheduler.py @@ -592,7 +592,7 @@ def pre_tune(self, task_scheduler, task_id): if task_scheduler.best_costs[i] < 1e9 else "-" ) - task_name = task_scheduler.task[i].desc + task_name = task_scheduler.tasks[i].desc speed_str = ( "%.2f" % (task_scheduler.tasks[i].compute_dag.flop_ct / task_scheduler.best_costs[i] / 1e9) @@ -601,7 +601,7 @@ def pre_tune(self, task_scheduler, task_id): ) trials_str = "%d" % (task_scheduler.task_cts[i] * task_scheduler.num_measures_per_round) print( - "| %4s | %40s | %12s | % 14s | %6s |" + "| %4s | %61s | %12s | % 14s | %6s |" % (id_str, task_name, latency_str, speed_str, trials_str) ) print( From 3cb327c75b25984063b46a2d46a369dc8b320caf Mon Sep 17 00:00:00 2001 From: Yuanjing Shi Date: Fri, 22 Apr 2022 12:59:22 -0700 Subject: [PATCH 4/5] fix linting --- python/tvm/auto_scheduler/task_scheduler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/tvm/auto_scheduler/task_scheduler.py b/python/tvm/auto_scheduler/task_scheduler.py index e1908fb65107..3eeb3494aba0 100644 --- a/python/tvm/auto_scheduler/task_scheduler.py +++ b/python/tvm/auto_scheduler/task_scheduler.py @@ -578,10 +578,13 @@ def pre_tune(self, task_scheduler, task_id): _ffi_api.PrintTitle("Task Scheduler") print( - "| ID | Task Description | Latency (ms) | Speed (GFLOPS) | Trials |" + "| ID " + "| Task Description " + "| Latency (ms) | Speed (GFLOPS) | Trials |" ) print( - "-----------------------------------------------------------------------------------------------------------------" + "-----------------------------------------------------------------" + "------------------------------------------------" ) # content From 7a27aaec5038353422454de934a7f776a1c9e885 Mon Sep 17 00:00:00 2001 From: Yuanjing Shi Date: Fri, 22 Apr 2022 13:11:01 -0700 Subject: [PATCH 5/5] fix linting again --- python/tvm/auto_scheduler/task_scheduler.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/tvm/auto_scheduler/task_scheduler.py b/python/tvm/auto_scheduler/task_scheduler.py index 3eeb3494aba0..762c50735960 100644 --- a/python/tvm/auto_scheduler/task_scheduler.py +++ b/python/tvm/auto_scheduler/task_scheduler.py @@ -583,8 +583,8 @@ def pre_tune(self, task_scheduler, task_id): "| Latency (ms) | Speed (GFLOPS) | Trials |" ) print( - "-----------------------------------------------------------------" - "------------------------------------------------" + "----------------------------------------------------------------" + "-------------------------------------------------" ) # content @@ -595,7 +595,7 @@ def pre_tune(self, task_scheduler, task_id): if task_scheduler.best_costs[i] < 1e9 else "-" ) - task_name = task_scheduler.tasks[i].desc + task_desc = task_scheduler.tasks[i].desc speed_str = ( "%.2f" % (task_scheduler.tasks[i].compute_dag.flop_ct / task_scheduler.best_costs[i] / 1e9) @@ -605,10 +605,11 @@ def pre_tune(self, task_scheduler, task_id): trials_str = "%d" % (task_scheduler.task_cts[i] * task_scheduler.num_measures_per_round) print( "| %4s | %61s | %12s | % 14s | %6s |" - % (id_str, task_name, latency_str, speed_str, trials_str) + % (id_str, task_desc, latency_str, speed_str, trials_str) ) print( - "-----------------------------------------------------------------------------------------------------------------" + "----------------------------------------------------------------" + "-------------------------------------------------" ) # overall info