To optimize binary size of ExecuTorch runtime, selective build can be used. This folder contains examples to select only the operators needed for ExecuTorch build. This example will demonstrate the CMake build.
Prerequisite: finish the setting up wiki.
Run:
cd executorch
bash examples/selective_build/test_selective_build.sh cmake
Check out CMakeLists.txt
for demo of 3 selective build APIs:
SELECT_ALL_OPS
: Select all ops from the dependency kernel libraries, register all of them into ExecuTorch runtime.SELECT_OPS_LIST
: Only select operators from a list.SELECT_OPS_YAML
: Only select operators from a yaml file.
Other configs:
MAX_KERNEL_NUM=N
: Only allocate memory for N operators.
We have one more API incoming: only select from an exported model file (.pte).