Replies: 5 comments 6 replies
-
@dbort do you have thoughts on this one? Also @malfet as CMake expert for PyTorch broadly? I think I would trend toward 2a as well |
Beta Was this translation helpful? Give feedback.
-
To the best of my knowledge it'll just lead to memory leaks, but totally legit and probably explained in the standard, as it's similar to pass C++ function that throws as a callback to C functions and catching the exception in C++. But mixing rtti and nortti is bad |
Beta Was this translation helpful? Give feedback.
-
#7746 is up and implements (2a). |
Beta Was this translation helpful? Give feedback.
-
Okay, let's imagine that I'm an embedded engineer who wants to use ExecuTorch for my AI application. And there's some size/memory restrictions. How should I go about, from a user's perspective? It looks like depending on the model, I can use ExecuTorch or not. For example, if the model happens to use an op that is used as part of the PyTorch code sharing repo, I won't be able to use ExecuTorch? How do they know about this in the first place and how do they fix this? I imagine that I will compile with appropriate flags, and it will complain? Which is fine. But how do I go about fixing it? It sounds like we're actually changing core requirements of ExecuTorch in this PR |
Beta Was this translation helpful? Give feedback.
-
I guess from embedded user friendliness point of view 2(b) is what I like. And, I think we should continue running CI for no-except, no-rtti flavor for non-embedded use as well, just so we don't regress from where we are today. |
Beta Was this translation helpful? Give feedback.
-
The problem
The current setup in our build system is to disable exceptions and RTTI in all release builds. As I work on sharing code with PyTorch (mostly outside of ExecuTorch core, as in #7041, so we don't need to support embedded systems), that will become untenable: PyTorch code might throw. (I plan to accommodate this by adding a boundary converting exceptions in non-portable kernels into failure codes (pytorch/pytorch#144341), so that the core runtime can remain exception-agnostic.) However, we also want to support embedded systems use cases where size is critical.
Background
Options going forward
EXECUTORCH_BUILD_FOO
option that results in a PyTorch dependency must change the global build flags to re-enable exceptions and RTTI, probably via a CMake macro or function that both adds the dependency and fixes the global build flags.a) CMAKE_CXX_FLAGS (or, equivalently, the CXXFLAGS environment variable)
b) an "embedded mode" CMake option we create that sets
-fno-exceptions -fno-rtti
. (I considered having it imply size optimization, but that is the job ofCMAKE_BUILD_MODE=MinSizeRel
.)Personally:
Beta Was this translation helpful? Give feedback.
All reactions