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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to