Skip to content

Commit 63b68c9

Browse files
pytorchbotlucylq
andauthored
Remove buck2 from selective build readme (#4003) (#4172)
Summary: Pull Request resolved: #4003 However, keep the description / documentation inside test_selective_build.sh for internal users. Reviewed By: Gasoonjia Differential Revision: D58706163 fbshipit-source-id: 5aae1419d87c5cdf08f91c0a1e73ef5788b018cd (cherry picked from commit a33936b) Co-authored-by: Lucy Qiu <[email protected]>
1 parent 211590e commit 63b68c9

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-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. This example will demonstrate the CMake build.
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 operators from a list.
18+
3. `SELECT_OPS_YAML`: Only select operators 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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ 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
21+
# kernel libraries, register all of them into ExecuTorch runtime.
22+
# 2. `--config executorch.select_ops=list`: Only select ops from `ops` kwarg
23+
# in `et_operator_library` macro.
24+
# 3. `--config executorch.select_ops=yaml`: Only select from a yaml file from
25+
# `ops_schema_yaml_target` kwarg in `et_operator_library` macro
26+
# 4. `--config executorch.select_ops=dict`: Only select ops from `ops_dict`
27+
# kwarg in `et_operator_library` macro. Add `dtype_selective_build = True`
28+
# to executorch_generated_lib to select dtypes specified in the dictionary.
29+
30+
# Other configs:
31+
# - `--config executorch.max_kernel_num=N`: Only allocate memory for the
32+
# required number of operators. Users can retrieve N from `selected_operators.yaml`.
33+
1834
test_buck2_select_all_ops() {
1935
echo "Exporting MobilenetV3"
2036
${PYTHON_EXECUTABLE} -m examples.portable.scripts.export --model_name="mv3"
@@ -69,6 +85,7 @@ test_buck2_select_ops_from_yaml() {
6985
rm "./custom_ops_1.pte"
7086
}
7187

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

0 commit comments

Comments
 (0)