-
Hi team, I am trying to build Executorch from source to get the minimal runtime library. The documentation states that the minimal runtime library size is around 50kB (The original statement in the official documentation (https://docs.pytorch.org/executorch/stable/runtime-overview.html) reads: "The core runtime library is less than 50kB when built without kernels or backends." ). However, when I built the project using the following command, I observed a significant size difference in the output libraries:
Here are the file sizes I found:
Since libexecutorch.a depends on libexecutorch_core.a, this seems to contradict the documentation. The source code is from main branch with the following commit info:
Thank you for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Regarding libexecutorch_core.a, libexecutorch.a should depend on libexecutorch_core.a. If you're seeing it the other way around, that would be unexpected. Here's the relevant line from CMake: Line 450 in 9053089 Here's how the runtime size is build for the size check in CI: https://github.com/pytorch/executorch/blob/main/test/build_size_test.sh. Setting -DEXECUTORCH_OPTIMIZE_SIZE=ON, disabling RTTI and exceptions, and disabling fatal level logging can potentially trim a little more size. @digantdesai @lucylq Do you have any other suggestions on reducing runtime size? |
Beta Was this translation helpful? Give feedback.
Hi @goka-wu, the 50K refers to the core executorch components (without operators). Size test builds libexecutorch.a and then links it to a minimal executor runner. The executor runner can't really run any models because no operators are linked, but gives an approximation of the core runtime size.
See the size test sources:
https://github.com/pytorch/executorch/blob/main/test/CMakeLists.txt#L46-L55
Seconding @GregoryComer's comment on build flags to trim size.