Skip to content

Commit 590cbce

Browse files
Gasoonjiafacebook-github-bot
authored andcommitted
add buck2 installation into setup.md
Summary: bring buck2 installation back, and scrub any "-DBUCK2=buck2" in our docs, to unblock users from using buck2 Reviewed By: guangy10 Differential Revision: D56540769 fbshipit-source-id: 363e592c17dd2747a693e59d8d6b6d20f43c8451
1 parent b2c794a commit 590cbce

File tree

10 files changed

+42
-14
lines changed

10 files changed

+42
-14
lines changed

.ci/scripts/test.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ build_cmake_executor_runner() {
3737
(rm -rf ${CMAKE_OUTPUT_DIR} \
3838
&& mkdir ${CMAKE_OUTPUT_DIR} \
3939
&& cd ${CMAKE_OUTPUT_DIR} \
40-
&& retry cmake -DBUCK2=buck2 -DCMAKE_BUILD_TYPE=Release \
40+
&& retry cmake -DCMAKE_BUILD_TYPE=Release \
4141
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
4242

4343
cmake --build ${CMAKE_OUTPUT_DIR} -j4
@@ -84,8 +84,7 @@ build_cmake_xnn_executor_runner() {
8484
(rm -rf ${CMAKE_OUTPUT_DIR} \
8585
&& mkdir ${CMAKE_OUTPUT_DIR} \
8686
&& cd ${CMAKE_OUTPUT_DIR} \
87-
&& retry cmake -DBUCK2=buck2 \
88-
-DCMAKE_BUILD_TYPE=Release \
87+
&& retry cmake -DCMAKE_BUILD_TYPE=Release \
8988
-DEXECUTORCH_BUILD_XNNPACK=ON \
9089
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
9190
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)

.ci/scripts/test_quantized_aot_lib.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ build_cmake_quantized_aot_lib() {
2121
(rm -rf ${CMAKE_OUTPUT_DIR} \
2222
&& mkdir ${CMAKE_OUTPUT_DIR} \
2323
&& cd ${CMAKE_OUTPUT_DIR} \
24-
&& retry cmake -DBUCK2=buck2 \
25-
-DCMAKE_BUILD_TYPE=Release \
24+
&& retry cmake -DCMAKE_BUILD_TYPE=Release \
2625
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
2726
-DEXECUTORCH_BUILD_QUANTIZED_OPS_AOT=ON \
2827
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)

.ci/scripts/utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ build_executorch_runner_cmake() {
9999
pushd "${CMAKE_OUTPUT_DIR}" || return
100100
# This command uses buck2 to gather source files and buck2 could crash flakily
101101
# on MacOS
102-
retry cmake -DBUCK2=buck2 -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" -DCMAKE_BUILD_TYPE=Release ..
102+
retry cmake -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" -DCMAKE_BUILD_TYPE=Release ..
103103
popd || return
104104

105105
if [ "$(uname)" == "Darwin" ]; then

backends/qualcomm/setup.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ mkdir build_android
9393
cd build_android
9494
# build executorch & qnn_executorch_backend
9595
cmake .. \
96-
-DBUCK2=buck2 \
9796
-DCMAKE_INSTALL_PREFIX=$PWD \
9897
-DEXECUTORCH_BUILD_QNN=ON \
9998
-DQNN_SDK_ROOT=$QNN_SDK_ROOT \

docs/source/build-run-xtensa.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ In order to run the CMake build, you need the path to the following:
150150
cd executorch
151151
rm -rf cmake-out
152152
# prebuild and install executorch library
153-
cmake -DBUCK2=buck2 \
154-
-DCMAKE_TOOLCHAIN_FILE=<path_to_executorch>/examples/cadence/cadence.cmake \
153+
cmake -DCMAKE_TOOLCHAIN_FILE=<path_to_executorch>/examples/cadence/cadence.cmake \
155154
-DCMAKE_INSTALL_PREFIX=cmake-out \
156155
-DCMAKE_BUILD_TYPE=Debug \
157156
-DPYTHON_EXECUTABLE=python3 \

docs/source/getting-started-setup.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,39 @@ Output 0: tensor(sizes=[1], [2.])
184184

185185
To learn how to build a similar program, visit the [ExecuTorch in C++ Tutorial](running-a-model-cpp-tutorial.md).
186186

187+
### [Optional] Setting Up Buck2
188+
**Buck2** is an open-source build system that some of our examples currently utilize for building and running.
189+
190+
However, please note that the installation of `Buck2` is optional for using ExecuTorch and we are in the process of transitioning away from `Buck2` and migrating all relevant sections to `cmake`. This section will be removed once we finish the migration.
191+
192+
To set up `Buck2`, You will need the following prerequisits for this section:
193+
* The `zstd` command line tool — install by running
194+
```bash
195+
pip3 install zstd
196+
```
197+
* Version `${executorch_version:buck2}` of the `buck2` commandline tool — you can download a
198+
prebuilt archive for your system from [the Buck2
199+
repo](https://github.com/facebook/buck2/releases/tag/2024-02-15). Note that
200+
the version is important, and newer or older versions may not work with the
201+
version of the buck2 prelude used by the ExecuTorch repo.
202+
203+
Configure Buck2 by decompressing with the following command (filename depends
204+
on your system):
205+
206+
```bash
207+
# For example, buck2-x86_64-unknown-linux-musl.zst or buck2-aarch64-apple-darwin.zst
208+
zstd -cdq buck2-DOWNLOADED_FILENAME.zst > /tmp/buck2 && chmod +x /tmp/buck2
209+
```
210+
211+
You may want to copy the `buck2` binary into your `$PATH` so you can run it
212+
as `buck2`.
213+
214+
After the installation, you can run the `add.pte` program by following `buck2` command:
215+
216+
```bash
217+
/tmp/buck2 run //examples/portable/executor_runner:executor_runner -- --model_path add.pte
218+
```
219+
187220
## Next Steps
188221

189222
Congratulations! You have successfully exported, built, and run your first

docs/source/runtime-build-and-cross-compilation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ cd executorch
6060
#
6161
# NOTE: If your `buck2` binary is not on the PATH, you can change this line to
6262
# say something like `-DBUCK2=/tmp/buck2` to point directly to the tool.
63-
(rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake -DBUCK2=buck2 ..)
63+
(rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake ..)
6464
```
6565

6666
Once this is done, you don't need to do it again until you pull from the upstream repo again, or if you modify any CMake-related files.

docs/source/tutorial-xnnpack-delegate-lowering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Now you should be able to find the executable built at `./cmake-out/backends/xnn
171171

172172

173173
## Running the XNNPACK Model with Buck
174-
Alternatively, you can use `buck2` to run the `.pte` file with XNNPACK delegate instructions in it on your host platform. You can follow the instructions here to install [buck2](getting-started-setup.md#building-a-runtime). You can now run it with the prebuilt `xnn_executor_runner` provided in the examples. This will run the model on some sample inputs.
174+
Alternatively, you can use `buck2` to run the `.pte` file with XNNPACK delegate instructions in it on your host platform. You can follow the instructions here to install [buck2](getting-started-setup.md#Build-&-Run). You can now run it with the prebuilt `xnn_executor_runner` provided in the examples. This will run the model on some sample inputs.
175175

176176
```bash
177177
buck2 run examples/xnnpack:xnn_executor_runner -- --model_path ./mv2_xnnpack_fp32.pte

examples/portable/scripts/test_demo_backend_delegation.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ build_cmake_executor_runner() {
2222
(rm -rf ${CMAKE_OUTPUT_DIR} \
2323
&& mkdir ${CMAKE_OUTPUT_DIR} \
2424
&& cd ${CMAKE_OUTPUT_DIR} \
25-
&& retry cmake -DBUCK2=buck2 \
26-
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
25+
&& retry cmake -DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
2726

2827
cmake --build ${CMAKE_OUTPUT_DIR} -j4
2928
}

examples/sdk/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Running the program will generate an `ETDump` file (`.etdp`) at the location spe
5656

5757
```bash
5858
cd executorch
59-
rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake -DBUCK2=buck2 -DEXECUTORCH_BUILD_SDK=1 -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=1 ..
59+
rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake -DEXECUTORCH_BUILD_SDK=1 -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=1 ..
6060
cd ..
6161
cmake --build cmake-out -j8 -t sdk_example_runner
6262
./cmake-out/examples/sdk/sdk_example_runner --bundled_program_path mv2_bundled.bpte --etdump_path mv2_etdump.etdp

0 commit comments

Comments
 (0)