Skip to content

Commit e40ebcf

Browse files
remove buck2 from Kernel Library Selective Build (#4224) (#4249)
Summary: Pull Request resolved: #4224 For alpha+, we need to remove all buck2 commands and buck2 dependencies from static doc and github readmes. This diff gets rid of the buck2 from kernel lb selective build tutorial Reviewed By: kirklandsign Differential Revision: D59649793 fbshipit-source-id: 8c6c854d633cc36fbe34605e5a34977c519028aa (cherry picked from commit 9aafd0f) Co-authored-by: Songhao Jia <[email protected]>
1 parent 1965dd0 commit e40ebcf

File tree

1 file changed

+3
-55
lines changed

1 file changed

+3
-55
lines changed

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

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Kernel Library Selective Build
22

3-
_Selective build_ is a build mode on ExecuTorch that uses model metadata to guide ExecuTorch build. This build mode contains build tool APIs available on both CMake and buck2. ExecuTorch users can use selective build APIs to build an ExecuTorch runtime binary with minimal binary size by only including operators required by models.
3+
_Selective build_ is a build mode on ExecuTorch that uses model metadata to guide ExecuTorch build. This build mode contains build tool APIs available on CMake. ExecuTorch users can use selective build APIs to build an ExecuTorch runtime binary with minimal binary size by only including operators required by models.
44

55
This document aims to help ExecuTorch users better use selective build, by listing out available APIs, providing an overview of high level architecture and showcasing examples.
66

@@ -36,17 +36,11 @@ The basic flow looks like this:
3636

3737
## APIs
3838

39-
We expose build macros for CMake and Buck2, to allow users specifying op info.
40-
41-
On CMake:
39+
We expose build macros for CMake, to allow users specifying op info:
4240

4341
[gen_selected_ops](https://github.com/pytorch/executorch/blob/main/build/Codegen.cmake#L12)
4442

45-
On Buck2:
46-
47-
[et_operator_library](https://github.com/pytorch/executorch/blob/main/shim/xplat/executorch/codegen/codegen.bzl#L44C21-L44C21)
48-
49-
Both of these build macros take the following inputs:
43+
Build macros take the following inputs:
5044

5145

5246
### Select all ops
@@ -66,52 +60,6 @@ This API lets users pass in a list of operator names. Note that this API can be
6660

6761
## Example Walkthrough
6862

69-
70-
### Buck2 example
71-
72-
Let’s take a look at the following build:
73-
74-
```
75-
# Select a list of operators: defined in `ops`
76-
et_operator_library(
77-
name = "select_ops_in_list",
78-
ops = [
79-
"aten::add.out",
80-
"aten::mm.out",
81-
],
82-
)
83-
```
84-
This target generates the yaml file containing op info for these two ops.
85-
86-
In addition to that, if we want to select all ops from a kernel library, we can do:
87-
88-
```
89-
# Select all ops from a yaml file
90-
et_operator_library(
91-
name = "select_ops_from_yaml",
92-
ops_schema_yaml_target = "//executorch/examples/portable/custom_ops:custom_ops.yaml",
93-
)
94-
```
95-
Then in the kernel registration library we can do:
96-
```
97-
executorch_generated_lib(
98-
name = "select_ops_lib",
99-
custom_ops_yaml_target = "//executorch/examples/portable/custom_ops:custom_ops.yaml",
100-
functions_yaml_target = "//executorch/kernels/portable:functions.yaml",
101-
deps = [
102-
"//executorch/examples/portable/custom_ops:custom_ops_1", # kernel library
103-
"//executorch/examples/portable/custom_ops:custom_ops_2", # kernel library
104-
"//executorch/kernels/portable:operators", # kernel library
105-
":select_ops_from_yaml",
106-
":select_ops_in_list",
107-
],
108-
)
109-
```
110-
Notice we are allowlisting both add.out, mm.out from the list, and the ones from the schema yaml (`custom_ops.yaml`).
111-
112-
113-
### CMake example
114-
11563
In CMakeLists.txt we have the following logic:
11664
```cmake
11765
set(_kernel_lib)

0 commit comments

Comments
 (0)