You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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. We provide APIs for both CMake build and buck2 build. This example will demonstrate both. You can find more information on how to use buck2 macros in [wiki](../../docs/source/kernel-library-selective_build.md).
2
+
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.
Check out `targets.bzl` for demo of 4 selective build APIs:
18
-
1.`--config executorch.select_ops=all`: Select all ops from the dependency kernel libraries, register all of them into ExecuTorch runtime.
19
-
2.`--config executorch.select_ops=list`: Only select ops from `ops` kwarg in `et_operator_library` macro.
20
-
3.`--config executorch.select_ops=yaml`: Only select from a yaml file from `ops_schema_yaml_target` kwarg in `et_operator_library` macro.
21
-
4.`--config executorch.select_ops=dict`: Only select ops with from `ops_dict` kwarg in `et_operator_library` macro. Optionally, add dtype information to each operator and add `dtype_selective_build = True` to only select those dtypes.
22
-
Eg. if the model only uses the float implementation of add, then only the float add will be registered. Note: setting `dtype_selective_build = True` is only available in xplat.
23
-
24
-
Other configs:
25
-
-`--config executorch.max_kernel_num=N`: Only allocate memory for the required number of operators. Take this result from `selected_operators.yaml`.
26
-
27
-
## CMake examples
28
-
29
15
Check out `CMakeLists.txt` for demo of 3 selective build APIs:
30
-
1.`SELECT_ALL_OPS`
31
-
2.`SELECT_OPS_LIST`
32
-
3.`SELECT_OPS_YAML`
16
+
1.`SELECT_ALL_OPS`: Select all ops from the dependency kernel libraries, register all of them into ExecuTorch runtime.
17
+
2.`SELECT_OPS_LIST`: Only select operators from a list.
18
+
3.`SELECT_OPS_YAML`: Only select operators from a yaml file.
33
19
34
20
Other configs:
35
-
-`MAX_KERNEL_NUM=N`
21
+
-`MAX_KERNEL_NUM=N`: Only allocate memory for N operators.
36
22
37
23
We have one more API incoming: only select from an exported model file (.pte).
0 commit comments