-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[BugFix][Ansor] Fixing Ansor Gradient Bug #16739
Conversation
Cc @comaniac , @merrymercy , @vinx13 , @jcf94 |
This change looks a bit hacky and unsafe as you override the cost before calculating the gradients and recover it back afterwards. Intuitively if a task has no schedules, should we just mark it as a dead task and never consider it in the rest of the process? |
3a0ea0e
to
7b1a19c
Compare
for task_idx in range(len(self.tasks)): | ||
if(self.best_costs[task_idx] == 1e10): | ||
self.dead_tasks.add(task_idx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for task_idx in range(len(self.tasks)): | |
if(self.best_costs[task_idx] == 1e10): | |
self.dead_tasks.add(task_idx) | |
for task_idx, cost in enumerate(self.best_costs): | |
if cost == 1e10: | |
self.dead_tasks.add(task_idx) |
@@ -358,6 +358,12 @@ def tune( | |||
self.best_ct = self.ct | |||
self.best_score = self.cur_score | |||
|
|||
# put task without schedule on warm up to dead state | |||
if self.strategy == "gradient": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this logic applies to all strategies instead of just gradient, so this condition may not be necessary. Could you help confirm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bc003bf
to
c472a87
Compare
c472a87
to
6c1c39a
Compare
@tvm-bot rerun |
Thanks @thaisacs |
* Fixing ansor gradient bug * Changing to dead_task * Applying reviews
When Ansor does not find a schedule for a task in warm up, Ansor gradient gets stuck in this task, because there is no optimized schedule for this task. Hence, Ansor does not optimize any task.
Behavior before correction
Behavior after correction