tqchen edited a comment on pull request #7919:
URL: https://github.com/apache/tvm/pull/7919#issuecomment-830676898


   @areusch I pushed an alternative implementation that can preserve the python 
exception types.  I started  with this one but then decided to go with the 
approach because most exceptions are indeed KeyboardInterrupt. After the 
discussion I agree it can be more important to preserve the exception type.
   
   This implementation does that. The approach is similar to pybind's approach 
of handling the exception. When error happens a special exception is thrown, 
and the error is not cleared but propagated into the FFI layer through a 
specific return code.
   
   The only limitation here is that the stacktrace will only start from the 
FFI(the C++ traces are not tracked), but it is fine as the signal handling 
itself is also already async.
   
   I have also considered your proposal of having a SignalChecking function in 
the FFI layer and started with that impl before sending the PR. My conclusion 
so far there are only limited set that it is  cleaner to bring the API directly 
in the runtime. As the implementation hides behind a common API (registerCAPI) 
that won't change, we can consider refactor later. But given the processing 
code is usually short, it does not hurt to put them close to the implementation 
site either.


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