-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FFI] Propagate Python errors across FFI boundaries (#15596)
* [Runtime] Re-organize BacktraceFullCallback Prior to this commit, the `BacktraceFullCallback` function returned zero for frames that should be excluded from the stack trace, even if they were the `"TVMFuncCall"` that should terminate the stack trace. This commit re-organized `BacktraceFullCallback`, moving the terminating checks to occur prior to the suppression checks, and adding comments to indicate why each suppression is present. * [FFI] Propagate Python errors across FFI boundaries Prior to this commit, if a Python script passes a callback to a C++ function, and that callback raises an exception, the original exception cannot be caught in the outer python script. As a result, interactive debugging, such as done with `pdb` or `ipdb`, could only inspect stack frames outside the first Python to C++ FFI call. This commit updates the FFI API to propagate the Python exception through an FFI boundary. As a result, all Python frames in the stack trace can be inspected. * Updated unit tests that depended on exception coercion. Previously, Python exceptions were coerced to `tvm.error.TVMError` if no corresponding error type had been registered with `tvm._ffi.register_error`. With the pass-through of Python exceptions, this coercion no longer applies. Unit tests that relied on this coercion needed to be updated as a result. --------- Co-authored-by: Chris Sullivan <csullivan@octoml.ai>
- Loading branch information
1 parent
666bd14
commit d5a4f66
Showing
16 changed files
with
653 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.