tqchen opened a new pull request #7919:
URL: https://github.com/apache/tvm/pull/7919


   Python execution environment handles the signal by caching
   the signal a state and invokes the handler when execution
   goes into the python interpreter.
   
   This model can cause problem when runnning a long running
   c++ function. As keyboard interrupt can only be caught in the end.
   
   Additionally, because python registered special signal handlers.
   Socket operations can return EINTR that needs to be explicitly
   retried when the interrupt is not a KeyboardInterrupt.
   
   This PR adds the following changes to resolve these problems.
   
   - Allow execution env(python) to register CheckSignals function
     to the TVM runtime.
   - Add runtime::EnvCheckSignals to check the signal error.
   - Add retry when EINTR is encountered in socket.
   - Register the python C API functions in cython mode.
   
   To testout the EnvCheckSignals, run the following code
   
   ```python
   import tvm.testing
   tvm.testing.run_check_signal(10)
   ```
   
   Note that the C API functions are only registered in cython FFI mode
   because ctypes have problems invoking these functions. This however
   won't affect the correctness, but will defer the interrupt handling
   to function return sites.
   
   Co-authored-by: Andrew Reusch <[email protected]>
   Co-authored-by: Robert Kimball <[email protected]>
   


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

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


Reply via email to