This is an automated email from the ASF dual-hosted git repository.
comaniac 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 ffa9cfd0dd [BugFix][Ansor] Fixing Ansor Gradient Bug (#16739)
ffa9cfd0dd is described below
commit ffa9cfd0dd096000d356103c6c4df9cfd2e226e2
Author: Thais Camacho <[email protected]>
AuthorDate: Mon Apr 1 04:37:33 2024 -0300
[BugFix][Ansor] Fixing Ansor Gradient Bug (#16739)
* Fixing ansor gradient bug
* Changing to dead_task
* Applying reviews
---
python/tvm/auto_scheduler/task_scheduler.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/python/tvm/auto_scheduler/task_scheduler.py
b/python/tvm/auto_scheduler/task_scheduler.py
index 547e5a5833..58457daad0 100644
--- a/python/tvm/auto_scheduler/task_scheduler.py
+++ b/python/tvm/auto_scheduler/task_scheduler.py
@@ -358,6 +358,11 @@ class TaskScheduler:
self.best_ct = self.ct
self.best_score = self.cur_score
+ # put task without schedule on warm up to dead state
+ for task_idx, cost in enumerate(self.best_costs):
+ if cost == 1e10:
+ self.dead_tasks.add(task_idx)
+
# use the specific strategy to choose workload to tune
task_idx = -1
while self.ct < tune_option.num_measure_trials and
len(self.dead_tasks) < len(self.tasks):
@@ -367,6 +372,7 @@ class TaskScheduler:
task_idx = (task_idx + 1) % len(self.tasks)
elif self.strategy == "gradient":
gradients = []
+
for i in range(len(self.tasks)):
if i in self.dead_tasks:
gradients.append(0)