[BugFix][Ansor] Fixing Ansor Gradient Bug#16739
Merged
comaniac merged 3 commits intoapache:mainfrom Apr 1, 2024
Merged
Conversation
Contributor
|
Cc @comaniac , @merrymercy , @vinx13 , @jcf94 |
Contributor
|
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
comaniac
reviewed
Mar 29, 2024
Comment on lines
363
to
365
| for task_idx in range(len(self.tasks)): | ||
| if(self.best_costs[task_idx] == 1e10): | ||
| self.dead_tasks.add(task_idx) |
Contributor
There was a problem hiding this comment.
Suggested change
| 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) |
| self.best_score = self.cur_score | ||
|
|
||
| # put task without schedule on warm up to dead state | ||
| if self.strategy == "gradient": |
Contributor
There was a problem hiding this comment.
I feel this logic applies to all strategies instead of just gradient, so this condition may not be necessary. Could you help confirm?
bc003bf to
c472a87
Compare
Contributor
c472a87 to
6c1c39a
Compare
Contributor
|
@tvm-bot rerun |
Contributor
|
Thanks @thaisacs |
thaisacs
added a commit
to thaisacs/tvm
that referenced
this pull request
Apr 3, 2024
* Fixing ansor gradient bug * Changing to dead_task * Applying reviews
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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