Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoScheduler] Fix task scheduler restoring #6934

Merged
merged 2 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions python/tvm/auto_scheduler/task_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ def tune(self, tune_option, search_policy="default"):
)

# do a round robin first to warm up
for i in range(len(self.tasks)):
self._tune_task(i)
for idx in range(len(self.tasks)):
# skip warming up this task if it has been tuned before (restored from the log file)
if not self.task_cts[idx]:
self._tune_task(idx)
self.best_ct = self.ct
self.best_score = self.cur_score

Expand Down Expand Up @@ -473,4 +475,6 @@ def _restore_status(self, log_file, num_measures_per_round):
self.task_cts[i] = int(self.task_cts[i] / num_measures_per_round + 0.5)
self.task_costs_history[i].append(self.best_costs[i])

self.cur_score = self._compute_score(self.best_costs)

logger.info("TaskScheduler: Loaded %d measurement records from %s", total_ct + 1, log_file)
4 changes: 2 additions & 2 deletions tests/python/unittest/test_auto_scheduler_task_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_task_scheduler_round_robin():
for task in tasks:
counters[task.workload_key] = 0

for inp, res in auto_scheduler.load_records(log_file):
for inp, _ in auto_scheduler.load_records(log_file):
counters[inp.task.workload_key] += 1

for task in tasks:
Expand Down Expand Up @@ -121,7 +121,7 @@ def objective_func(costs):
for task in tasks:
counters[task.workload_key] = 0

for inp, res in auto_scheduler.load_records(log_file):
for inp, _ in auto_scheduler.load_records(log_file):
counters[inp.task.workload_key] += 1

assert counters[tasks[0].workload_key] == n_trials - 1
Expand Down