AndrewZhaoLuo commented on code in PR #11094:
URL: https://github.com/apache/tvm/pull/11094#discussion_r855708206


##########
python/tvm/contrib/popen_pool.py:
##########
@@ -133,7 +139,11 @@ def kill(self):
                 self._proc.kill()
             except OSError:
                 pass
+
+            # Join the child process to avoid zombie processes
+            self.join(timeout=1.0)

Review Comment:
   is this needed? since when we remove reference to _proc python will probably 
call wait()



##########
python/tvm/contrib/popen_pool.py:
##########
@@ -92,12 +92,18 @@ class PopenWorker:
 
     initargs: Tuple[object]
         A tuple of args for the initializer
+
+    maximum_uses: int or None
+        The maximum number of times a process can be used before being recycled

Review Comment:
   Hmm, should there be more warning about what "recycling" means? 
   
   Like what if someone has a very stateful function and moving things to init 
state is undesirable.



##########
python/tvm/contrib/popen_pool.py:
##########
@@ -92,12 +92,18 @@ class PopenWorker:
 
     initargs: Tuple[object]
         A tuple of args for the initializer
+
+    maximum_uses: int or None
+        The maximum number of times a process can be used before being recycled

Review Comment:
   nit: indicate what none means in representation throughout file



##########
python/tvm/contrib/popen_pool.py:
##########
@@ -213,12 +223,19 @@ def send(self, fn, args=(), kwargs=None, timeout=None):
         # pylint: disable=import-outside-toplevel
         import cloudpickle
 
+        if self._proc is not None and self._maximum_uses and 
self._remaining_uses == 0:

Review Comment:
   we can move this block below lines 248-250 and remove self._proc check. It 
will also immediately free resources after last remaining use instead of 
needing additional send call.
   
   



-- 
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