Skip to content

Commit 3bb664f

Browse files
committed
Updating doc to better reflect new changes to gen_selected_ops
1 parent 060fc14 commit 3bb664f

File tree

1 file changed

+13
-41
lines changed

1 file changed

+13
-41
lines changed

docs/source/kernel-library-selective-build.md

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -74,48 +74,20 @@ Beyond pruning the binary to remove unused operators, the binary size can furhte
7474

7575
## Example Walkthrough
7676

77-
In [CMakeLists.txt](https://github.com/pytorch/executorch/blob/main/examples/selective_build/CMakeLists.txt#L89-L123) we have the following logic:
78-
79-
```cmake
80-
set(_kernel_lib)
81-
82-
if(SELECT_ALL_OPS)
83-
gen_selected_ops("" "" "${SELECT_ALL_OPS}" "" "")
84-
elseif(SELECT_OPS_LIST)
85-
gen_selected_ops("" "${SELECT_OPS_LIST}" "" "" "")
86-
elseif(SELECT_OPS_YAML)
87-
set(_custom_ops_yaml ${EXECUTORCH_ROOT}/examples/portable/custom_ops/custom_ops.yaml)
88-
gen_selected_ops("${_custom_ops_yaml}" "" "")
89-
elseif(SELECT_OPS_MODEL)
90-
set(_model_path $(realpath model.pte))
91-
if(DTYPE_SELECTIVE_BUILD)
92-
gen_selected_ops("" "" "" "${_model_path}" "ON")
93-
else
94-
gen_selected_ops("" "" "" "${_model_path}" "")
95-
endif()
96-
endif()
97-
```
98-
Then when calling CMake, we can do:
99-
100-
```
101-
cmake -D… -DSELECT_OPS_LIST="aten::add.out,aten::mm.out"
102-
```
77+
In [CMakeLists.txt](https://github.com/BujSet/executorch/blob/main/examples/selective_build/CMakeLists.txt#L48-L72), we have the following cmake config options:
10378

104-
Or
105-
106-
```
107-
cmake -D… -DSELECT_OPS_YAML=ON
108-
```
79+
1. `EXECUTORCH_SELECT_OPS_YAML`
80+
2. `EXECUTORCH_SELECT_OPS_LIST`
81+
3. `EXECUTORCH_SELECT_ALL_OPS`
82+
4. `EXECUTORCH_SELECT_OPS_FROM_MODEL`
83+
5. `EXECUTORCH_DTYPE_SELECTIVE_BUILD`
10984

110-
Or
85+
These options allow a user to tailor the cmake build process to utilize the different APIs, and results in different invocations on the `gen_selected_ops` [function](https://github.com/BujSet/executorch/blob/main/examples/selective_build/CMakeLists.txt#L110-L123). The following table describes some examples of how the invocation changes when these configs are set:
11186

87+
| Example cmake Call | Resultant `gen_selected_ops` Invocation |
88+
| :----: | :---:|
89+
|<code><br> cmake -D… -DSELECT_OPS_LIST="aten::add.out,aten::mm.out" <br></code> | <code><br> gen_selected_ops("" "${SELECT_OPS_LIST}" "" "" "") <br></code> |
90+
|<code><br> cmake -D… -DSELECT_OPS_YAML=ON <br></code> | <code><br> set(_custom_ops_yaml ${EXECUTORCH_ROOT}/examples/portable/custom_ops/custom_ops.yaml) <br> gen_selected_ops("${_custom_ops_yaml}" "" "") <br></code> |
91+
|<code><br> cmake -D… -DEXECUTORCH_SELECT_OPS_FROM_MODEL="model.pte.out" <br></code> | <code><br> gen_selected_ops("" "" "" "${_model_path}" "") <br></code> |
92+
|<code><br> cmake -D… -DEXECUTORCH_SELECT_OPS_FROM_MODEL="model.pte.out" -DEXECUTORCH_DTYPE_SELECTIVE_BUILD=ON<br></code> | <code><br> gen_selected_ops("" "" "" "${_model_path}" "ON") <br></code> |
11293

113-
```
114-
cmake -D… -DEXECUTORCH_SELECT_OPS_FROM_MODEL="model.pte.out"
115-
```
116-
117-
To select from either an operator name list, a schema yaml, or directly from an exported model's pte from kernel library. To further optimize the binary size for dtype selection, we can run:
118-
119-
```
120-
cmake -D… -DEXECUTORCH_SELECT_OPS_FROM_MODEL="model.pte.out" -DEXECUTORCH_DTYPE_SELECTIVE_BUILD=ON
121-
```

0 commit comments

Comments
 (0)