Skip to content

Commit 67264f6

Browse files
lucylqfacebook-github-bot
authored andcommitted
Remove buck2 from selective build readme
Summary: However, keep the description / documentation inside test_selective_build.sh for internal users. Differential Revision: D58706163
1 parent 7028a71 commit 67264f6

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

examples/selective_build/README.md

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Selective Build Examples
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. 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. We provide APIs for both CMake build and buck2 build. This example will demonstrate the CMake build. To use the buck2 API, check `test_selective_build.sh` in the current directory. You can find more information on how to use buck2 macros in [wiki](../../docs/source/kernel-library-selective_build.md).
33

44
## How to run
55

@@ -9,29 +9,15 @@ Run:
99

1010
```bash
1111
cd executorch
12-
bash examples/selective_build/test_selective_build.sh [cmake|buck2]
12+
bash examples/selective_build/test_selective_build.sh cmake
1313
```
1414

15-
## BUCK2 examples
16-
17-
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-
2915
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 from a list of ops.
18+
3. `SELECT_OPS_YAML`: Only select from a yaml file.
3319

3420
Other configs:
35-
- `MAX_KERNEL_NUM=N`
21+
- `MAX_KERNEL_NUM=N`: Only allocate memory for N operators.
3622

3723
We have one more API incoming: only select from an exported model file (.pte).

examples/selective_build/test_selective_build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ set -e
1515
# shellcheck source=/dev/null
1616
source "$(dirname "${BASH_SOURCE[0]}")/../../.ci/scripts/utils.sh"
1717

18+
19+
# BUCK2 examples; test internally in fbcode/xplat
20+
# 1. `--config executorch.select_ops=all`: select all ops from the dependency kernel libraries, register all of them into ExecuTorch runtime.
21+
# 2. `--config executorch.select_ops=list`: Only select ops from `ops` kwarg in `et_operator_library` macro.
22+
# 3. `--config executorch.select_ops=yaml`: Only select from a yaml file from `ops_schema_yaml_target` kwarg in `et_operator_library` macro
23+
# 4. `--config executorch.select_ops=dict`: Only select ops from `ops_dict` kwarg in `et_operator_library` macro. Add `dtype_selective_build = True` to executorch_generated_lib to only select dtypes specified in the dictionary.
24+
25+
# Other configs:
26+
# - `--config executorch.max_kernel_num=N`: Only allocate memory for the required number of operators. Users can retrieve N from `selected_operators.yaml`.
27+
1828
test_buck2_select_all_ops() {
1929
echo "Exporting MobilenetV3"
2030
${PYTHON_EXECUTABLE} -m examples.portable.scripts.export --model_name="mv3"
@@ -69,6 +79,7 @@ test_buck2_select_ops_from_yaml() {
6979
rm "./custom_ops_1.pte"
7080
}
7181

82+
# CMake examples; test in OSS. Check the README for more information.
7283
test_cmake_select_all_ops() {
7384
echo "Exporting MobilenetV3"
7485
${PYTHON_EXECUTABLE} -m examples.portable.scripts.export --model_name="mv3"

0 commit comments

Comments
 (0)