Skip to content

Commit a78a07e

Browse files
shoumikhinfacebook-github-bot
authored andcommitted
Build pybinding as part of iOS CI.
Summary: . Reviewed By: mergennachin Differential Revision: D54268579 fbshipit-source-id: 4defbcc25f80e97db563532aafbdfe5e03e553f0
1 parent 6bfc6c7 commit a78a07e

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

build/test_ios.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ set -e
1515

1616
OUTPUT="${1:-executorch}"
1717
EXIT_STATUS=0
18+
BUCK2_RELEASE_DATE="2024-02-15"
19+
BUCK2_ARCHIVE="buck2-aarch64-apple-darwin.zst"
20+
BUCK2=".venv/bin/buck2"
1821
APP_PATH="examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo"
1922
MODEL_NAME="mv3"
2023
SIMULATOR_NAME="executorch"
@@ -63,8 +66,9 @@ say "Installing Requirements"
6366

6467
pip install --upgrade cmake pip setuptools wheel zstd
6568

66-
curl -LO "https://github.com/facebook/buck2/releases/download/2023-07-18/buck2-aarch64-apple-darwin.zst"
67-
zstd -cdq buck2-aarch64-apple-darwin.zst > .venv/bin/buck2 && chmod +x .venv/bin/buck2
69+
curl -LO "https://github.com/facebook/buck2/releases/download/$BUCK2_RELEASE_DATE/$BUCK2_ARCHIVE"
70+
zstd -cdq "$BUCK2_ARCHIVE" > "$BUCK2" && chmod +x "$BUCK2"
71+
rm "$BUCK2_ARCHIVE"
6872

6973
./install_requirements.sh
7074
export PATH="$(realpath third-party/flatbuffers/cmake-out):$PATH"
@@ -80,14 +84,14 @@ say "Installing MPS Backend Requirements"
8084

8185
say "Installing Python Bindings"
8286

83-
EXECUTORCH_BUILD_PYBIND=ON CMAKE_ARGS="-DPYBIND_LINK_COREML=ON -DPYBIND_LINK_MPS=ON -DPYBIND_LINK_XNNPACK=ON -DBUCK2=$(pwd)/.venv/bin/buck2" pip install . --no-build-isolation
87+
EXECUTORCH_BUILD_PYBIND=ON CMAKE_ARGS="-DPYBIND_LINK_COREML=ON -DPYBIND_LINK_MPS=ON -DPYBIND_LINK_XNNPACK=ON -DBUCK2=$(pwd)/$BUCK2" pip install . --no-build-isolation
8488

8589
say "Exporting Models"
8690

87-
python3 -m examples.portable.scripts.export --model_name="$$MODEL_NAME"
88-
python3 -m examples.apple.coreml.scripts.export_and_delegate --model_name="$$MODEL_NAME"
89-
python3 -m examples.apple.mps.scripts.mps_example --model_name="$$MODEL_NAME"
90-
python3 -m examples.xnnpack.aot_compiler --model_name="$$MODEL_NAME" --delegate
91+
python3 -m examples.portable.scripts.export --model_name="$MODEL_NAME"
92+
python3 -m examples.apple.coreml.scripts.export_and_delegate --model_name="$MODEL_NAME"
93+
python3 -m examples.apple.mps.scripts.mps_example --model_name="$MODEL_NAME"
94+
python3 -m examples.xnnpack.aot_compiler --model_name="$MODEL_NAME" --delegate
9195

9296
mkdir -p "$APP_PATH/Resources/Models/MobileNet/"
9397
mv $MODEL_NAME*.pte "$APP_PATH/Resources/Models/MobileNet/"
@@ -99,7 +103,7 @@ curl https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt \
99103

100104
say "Building Frameworks"
101105

102-
./build/build_apple_frameworks.sh --buck2="$(realpath .venv/bin/buck2)" --Release --coreml --mps --xnnpack
106+
./build/build_apple_frameworks.sh --buck2="$(realpath $BUCK2)" --Release --coreml --mps --xnnpack
103107
mv cmake-out "$APP_PATH/Frameworks"
104108

105109
say "Creating Simulator"

build/test_ios_ci.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ say "Installing MPS Backend Requirements"
3939

4040
./backends/apple/mps/install_requirements.sh
4141

42+
say "Installing Python Bindings"
43+
44+
EXECUTORCH_BUILD_PYBIND=ON CMAKE_ARGS="-DPYBIND_LINK_COREML=ON -DPYBIND_LINK_MPS=ON -DPYBIND_LINK_XNNPACK=ON -DBUCK2=$(which buck2)" pip install . --no-build-isolation
45+
4246
say "Exporting Models"
4347

4448
python3 -m examples.portable.scripts.export --model_name="$MODEL_NAME" --segment_alignment=0x4000
@@ -61,7 +65,7 @@ mv cmake-out "$APP_PATH/Frameworks"
6165

6266
say "Creating Simulator"
6367

64-
xcrun simctl create "$SIMULATOR_NAME" "iPhone 14"
68+
xcrun simctl create "$SIMULATOR_NAME" "iPhone 15"
6569

6670
say "Running Tests"
6771

0 commit comments

Comments
 (0)