onnxruntime/include/onnxruntime/core
Christian Bourjau 6dd4e4801a
Allow custom operator functions to safely propagate errors through the C-API (#16479)
### Description
This PR implements a backward-compatible way to define custom operators
with fallible compute functions. The C++ API templated gained an
optional `Fallible` argument. Closes #14287

### Motivation and Context
#14287 contains more context. The gist is that the current C-API defines
compute operations of custom operators as functions returning `void`
rather than an `OrtStatusPtr`. Currently, errors are often propagated
across the C-ABI using C++ exceptions. That is very unsafe and undefined
behavior. Moreover, it is difficult for languages other than C++ to use
this approach even if they wanted to. A C-compliant sound and safe way
to propagate errors allows for non-C++ fallible custom operators.

### An example in action
https://github.com/cbourjau/ort-custom-op/pull/6/files is a
demonstration of how this PR can be used to write safe and fallible
custom operators in Rust.
2023-06-28 08:16:32 -07:00
..
common Run clang-format in CI (#15524) 2023-04-18 09:26:58 -07:00
eager Run clang-format in CI (#15524) 2023-04-18 09:26:58 -07:00
framework ExecutionProvider API refactor - move allocator from EP level to SessionState level and indexed by OrtDevice (#15833) 2023-06-19 17:44:45 -07:00
graph Support WebNN EP (#15698) 2023-05-08 21:25:10 -07:00
optimizer fix compilation error in no absl build (#15769) 2023-05-02 08:20:49 -07:00
platform Implement mutex-free spin lock for task queue (#14834) 2023-05-19 10:12:10 -07:00
providers CUDA graph support for TRT EP (#16081) 2023-06-21 09:36:45 -07:00
session Allow custom operator functions to safely propagate errors through the C-API (#16479) 2023-06-28 08:16:32 -07:00