You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/11/16 04:56:51 UTC

[GitHub] [tvm] yelite opened a new pull request, #13399: [MetaSchedule] Fix segfault in gradient based scheduler

yelite opened a new pull request, #13399:
URL: https://github.com/apache/tvm/pull/13399

   Gradient based scheduler would segfault if no candidates can be returned by the search strategy for some workload. It's expected that the scheduler continues to tune other workloads that have candidates.
   
   cc: @zxybazh @junrushao 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] zxybazh commented on a diff in pull request #13399: [MetaSchedule] Fix segfault in gradient based scheduler

Posted by GitBox <gi...@apache.org>.
zxybazh commented on code in PR #13399:
URL: https://github.com/apache/tvm/pull/13399#discussion_r1023535988


##########
tests/python/unittest/test_meta_schedule_task_scheduler.py:
##########
@@ -352,10 +353,85 @@ def test_meta_schedule_task_scheduler_multiple_gradient_based():
         )
 
 
+def test_meta_schedule_task_scheduler_gradient_based_with_null_search_strategy():
+    """
+    When search strategy of one task returns empty list of candidates,
+    the scheduler should continue working as normal for other tasks
+    """
+
+    @ms.derived_object
+    class NullSearchStrategy(ms.search_strategy.PySearchStrategy):
+        def __init__(self, n=0):
+            self.n = n
+
+        def _initialize_with_tune_context(self, context: "TuneContext") -> None:
+            pass
+
+        def pre_tuning(self, *args, **kwargs):
+            pass
+
+        def post_tuning(self):
+            pass
+
+        def generate_measure_candidates(self):
+            """
+            Returns empty list to indicate there is no result from search, while
+            the search isn't ended.
+            """
+            self.n += 1
+            if self.n <= 10:
+                return []
+            return None

Review Comment:
   To fix this you just need to add a check for whether task's runner future has been defined before doing `JoinRunningTask` when round robin rounds has been fullfilled.



##########
tests/python/unittest/test_meta_schedule_task_scheduler.py:
##########
@@ -352,10 +353,85 @@ def test_meta_schedule_task_scheduler_multiple_gradient_based():
         )
 
 
+def test_meta_schedule_task_scheduler_gradient_based_with_null_search_strategy():
+    """
+    When search strategy of one task returns empty list of candidates,
+    the scheduler should continue working as normal for other tasks
+    """
+
+    @ms.derived_object
+    class NullSearchStrategy(ms.search_strategy.PySearchStrategy):
+        def __init__(self, n=0):
+            self.n = n
+
+        def _initialize_with_tune_context(self, context: "TuneContext") -> None:
+            pass
+
+        def pre_tuning(self, *args, **kwargs):
+            pass
+
+        def post_tuning(self):
+            pass
+
+        def generate_measure_candidates(self):
+            """
+            Returns empty list to indicate there is no result from search, while
+            the search isn't ended.
+            """
+            self.n += 1
+            if self.n <= 10:
+                return []
+            return None

Review Comment:
   I noticed that the task scheduler will also fail when you return None directly here, can you please add that as a test case as well?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao merged pull request #13399: [MetaSchedule] Fix segfault in gradient based scheduler

Posted by GitBox <gi...@apache.org>.
junrushao merged PR #13399:
URL: https://github.com/apache/tvm/pull/13399


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] yelite commented on a diff in pull request #13399: [MetaSchedule] Fix segfault in gradient based scheduler

Posted by GitBox <gi...@apache.org>.
yelite commented on code in PR #13399:
URL: https://github.com/apache/tvm/pull/13399#discussion_r1024267757


##########
tests/python/unittest/test_meta_schedule_task_scheduler.py:
##########
@@ -352,10 +353,85 @@ def test_meta_schedule_task_scheduler_multiple_gradient_based():
         )
 
 
+def test_meta_schedule_task_scheduler_gradient_based_with_null_search_strategy():
+    """
+    When search strategy of one task returns empty list of candidates,
+    the scheduler should continue working as normal for other tasks
+    """
+
+    @ms.derived_object
+    class NullSearchStrategy(ms.search_strategy.PySearchStrategy):
+        def __init__(self, n=0):
+            self.n = n
+
+        def _initialize_with_tune_context(self, context: "TuneContext") -> None:
+            pass
+
+        def pre_tuning(self, *args, **kwargs):
+            pass
+
+        def post_tuning(self):
+            pass
+
+        def generate_measure_candidates(self):
+            """
+            Returns empty list to indicate there is no result from search, while
+            the search isn't ended.
+            """
+            self.n += 1
+            if self.n <= 10:
+                return []
+            return None

Review Comment:
   This is fixed now. I have also seen this when I tried to tune with 0 global trial limit. Thanks for hinting the way to fix this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tvm-bot commented on pull request #13399: [MetaSchedule] Fix segfault in gradient based scheduler

Posted by GitBox <gi...@apache.org>.
tvm-bot commented on PR #13399:
URL: https://github.com/apache/tvm/pull/13399#issuecomment-1316347917

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * cc @Hzfengsy, @elvin-n, @junrushao <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org