Skip to content

Commit ca96ac7

Browse files
committed
Update
[ghstack-poisoned]
2 parents 4a00cac + 678f180 commit ca96ac7

File tree

2,441 files changed

+129889
-173322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,441 files changed

+129889
-173322
lines changed

.buckconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
[buck2]
4141
restarter=true
42+
file_watcher=notify
4243

4344
[oss]
4445
folly_cxx_tests = False

.ci/docker/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ case "${IMAGE_NAME}" in
4848
executorch-ubuntu-22.04-mediatek-sdk)
4949
MEDIATEK_SDK=yes
5050
CLANG_VERSION=12
51+
ANDROID_NDK_VERSION=r27b
5152
;;
5253
executorch-ubuntu-22.04-clang12-android)
5354
LINTRUNNER=""

.ci/docker/ci_commit_pins/buck2.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-12-16
1+
2025-05-06

.ci/docker/ci_commit_pins/pytorch.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
08434df1f2f88c9770e59246caa2ff9c6f613270
1+
01f1cc44cbbfdf6307aa01b803a4ee22f9ade946

.ci/docker/common/install_android.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ install_sdk() {
7070
# These are the tools needed to build Android apps
7171
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "platforms;android-34"
7272
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "build-tools;33.0.1"
73+
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "build-tools;35.0.0"
7374
# And some more tools for future emulator tests
7475
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "platform-tools"
7576
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "tools"

.ci/docker/conda-env-ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake=3.22.1
1+
cmake=3.26.4
22
ninja=1.10.2
33
libuv
44
llvm-openmp

.ci/docker/requirements-ci.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ parameterized==0.9.0
1717

1818
# Doc build requirements, same as https://github.com/pytorch/pytorch/blob/main/.ci/docker/requirements-docs.txt
1919
sphinx==5.3.0
20+
sphinx-reredirects==0.1.4
2021
sphinx-gallery==0.14.0
2122
breathe==4.34.0
2223
exhale==0.2.3

.ci/scripts/build-qnn-sdk.sh

100644100755
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@ set -o xtrace
1111

1212
build_qnn_backend() {
1313
echo "Start building qnn backend."
14-
export ANDROID_NDK_ROOT=/opt/ndk
15-
export QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029
14+
export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT:-/opt/ndk}
15+
export QNN_SDK_ROOT=${QNN_SDK_ROOT:-/tmp/qnn/2.28.0.241029}
1616
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
1717

18-
# Workaround to avoid issues around missing flatccrt library (depending on the
19-
# number of jobs used), see issue #7300:
20-
# Build twice (second time with `--no_clean`) to make sure libflatccrt.a is
21-
# available.
22-
# TODO: Remove this workaround once the underlying issue is fixed.
23-
bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release || \
24-
bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release --no_clean
18+
parallelism=$(( $(nproc) - 1 ))
19+
bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number ${parallelism} --release
2520
}
2621

2722
set_up_aot() {
@@ -33,13 +28,13 @@ set_up_aot() {
3328
cmake .. \
3429
-DCMAKE_INSTALL_PREFIX=$PWD \
3530
-DEXECUTORCH_BUILD_QNN=ON \
31+
-DANDROID_NATIVE_API_LEVEL=30 \
3632
-DQNN_SDK_ROOT=${QNN_SDK_ROOT} \
3733
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
3834
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
3935
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
4036
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
41-
-DPYTHON_EXECUTABLE=python3 \
42-
-DEXECUTORCH_SEPARATE_FLATCC_HOST_PROJECT=OFF
37+
-DPYTHON_EXECUTABLE=python3
4338
cmake --build $PWD --target "PyQnnManagerAdaptor" "PyQnnWrapperAdaptor" -j$(nproc)
4439
# install Python APIs to correct import path
4540
# The filename might vary depending on your Python and host version.

.ci/scripts/build_android_instrumentation.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

.ci/scripts/build_llama_android.sh

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,12 @@ install_executorch_and_backend_lib() {
2222
ANDROID_NDK=/opt/ndk
2323
BUCK2=buck2
2424
ANDROID_ABI=arm64-v8a
25-
cmake -DBUCK2="${BUCK2}" \
25+
cmake --preset llm \
26+
-DBUCK2="${BUCK2}" \
2627
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
2728
-DANDROID_ABI="${ANDROID_ABI}" \
2829
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
2930
-DCMAKE_BUILD_TYPE=Release \
30-
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
31-
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
32-
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
33-
-DEXECUTORCH_BUILD_XNNPACK=ON \
34-
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
35-
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
36-
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
3731
-DXNNPACK_ENABLE_ARM_BF16=OFF \
3832
-Bcmake-android-out .
3933

@@ -51,11 +45,7 @@ build_llama_runner() {
5145
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake \
5246
-DANDROID_ABI="${ANDROID_ABI}" \
5347
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
54-
-DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=python \
55-
-DEXECUTORCH_BUILD_XNNPACK=ON \
56-
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
57-
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
58-
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
48+
-DCMAKE_BUILD_TYPE=Release \
5949
-Bcmake-android-out/examples/models/llama examples/models/llama
6050

6151
cmake --build cmake-android-out/examples/models/llama -j4 --config Release

.ci/scripts/check_c10_sync.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -eux
9+
ls pytorch/.git || git clone https://github.com/pytorch/pytorch.git
10+
pytorch_pin="$(< .ci/docker/ci_commit_pins/pytorch.txt)"
11+
pushd pytorch
12+
git checkout "$pytorch_pin"
13+
popd
14+
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/c10 pytorch/c10

.ci/scripts/compare_dirs.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -eux
9+
10+
# Check if dir1's files are also found in dir2 with the same
11+
# contents. Exempt files named BUCK, CMakeLists.txt, TARGETS, or
12+
# targets.bzl.
13+
14+
if [ $# -ne 2 ]; then
15+
echo "Usage: $0 dir1 dir2" >&2
16+
exit 1
17+
fi
18+
dir1="$1"
19+
dir2="$2"
20+
21+
if [ ! -d "$dir1" ] || [ ! -d "$dir2" ]; then
22+
echo "Error: Both directories must exist" >&2
23+
exit 1
24+
fi
25+
26+
exit_status=0
27+
while IFS= read -r -d '' file; do
28+
base=$(basename "$file")
29+
case "$base" in
30+
"BUCK"|"CMakeLists.txt"|"TARGETS"|"targets.bzl")
31+
continue
32+
;;
33+
esac
34+
# Construct the corresponding path in the second directory
35+
file2="$dir2/${file#$dir1/}"
36+
# Check if the corresponding file exists in the second directory
37+
if [ ! -f "$file2" ]; then
38+
echo "Error: File '$file' found in '$dir1' but not found in '$dir2'" >&2
39+
exit 1
40+
fi
41+
# Compare the contents of the two files using diff
42+
set +ex
43+
differences=$(diff -u -p "$file" "$file2")
44+
set -e # leave x off
45+
# If there are any differences, print an error message and exit with failure status
46+
if [ -n "$differences" ]; then
47+
echo "Error: Mismatch detected in file '$file':" >&2
48+
echo "$differences" >&2
49+
exit_status=1
50+
fi
51+
set -x
52+
done < <(find "$dir1" -type f -print0)
53+
54+
exit $exit_status

.ci/scripts/gather_benchmark_configs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
"apple_iphone_15": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/3b5acd2e-92e2-4778-b651-7726bafe129d",
2222
"apple_iphone_15+ios_18": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/12c8b15c-8d03-4e07-950d-0a627e7595b4",
2323
"samsung_galaxy_s22": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/e59f866a-30aa-4aa1-87b7-4510e5820dfa",
24+
"samsung_galaxy_s22_private": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/ea6b049d-1508-4233-9a56-5d9eacbe1078",
2425
"samsung_galaxy_s24": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/98f8788c-2e25-4a3c-8bb2-0d1e8897c0db",
2526
"google_pixel_8_pro": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/d65096ab-900b-4521-be8b-a3619b69236a",
27+
"google_pixel_3_private_rooted": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/98d23ca8-ea9e-4fb7-b725-d402017b198d",
28+
"apple_iphone_15_private": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/55929353-2f28-4ee5-bdff-d1a95f58cb28",
2629
}
2730

2831
# Predefined benchmark configurations

.ci/scripts/gather_test_models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from typing import Any
1515

1616
from examples.models import MODEL_NAME_TO_MODEL
17-
from examples.xnnpack import MODEL_NAME_TO_OPTIONS
17+
from examples.xnnpack import MODEL_NAME_TO_OPTIONS, QuantType
1818

1919
DEFAULT_RUNNERS = {
2020
"linux": "linux.2xlarge",
@@ -33,7 +33,7 @@
3333
"dl3": "linux.4xlarge.memory",
3434
"emformer_join": "linux.4xlarge.memory",
3535
"emformer_predict": "linux.4xlarge.memory",
36-
"phi-4-mini": "linux.4xlarge.memory",
36+
"phi_4_mini": "linux.4xlarge.memory",
3737
}
3838
}
3939

@@ -154,7 +154,7 @@ def export_models_for_ci() -> dict[str, dict]:
154154
if backend == "xnnpack":
155155
if name not in MODEL_NAME_TO_OPTIONS:
156156
continue
157-
if MODEL_NAME_TO_OPTIONS[name].quantization:
157+
if MODEL_NAME_TO_OPTIONS[name].quantization != QuantType.NONE:
158158
backend += "-quantization"
159159

160160
if MODEL_NAME_TO_OPTIONS[name].delegation:

.ci/scripts/setup-openvino.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -ex
9+
10+
# shellcheck source=/dev/null
11+
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
12+
13+
git clone https://github.com/openvinotoolkit/openvino.git
14+
cd openvino && git checkout releases/2025/1
15+
git submodule update --init --recursive
16+
sudo ./install_build_dependencies.sh
17+
mkdir build && cd build
18+
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON
19+
make -j$(nproc)
20+
21+
cd ..
22+
cmake --install build --prefix dist
23+
24+
source dist/setupvars.sh
25+
cd ../backends/openvino
26+
pip install -r requirements.txt
27+
cd scripts
28+
./openvino_build.sh --enable_python

build/test_ios_ci.sh renamed to .ci/scripts/test_ios_ci.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
set -e
99

10-
APP_PATH="examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo"
10+
APP_PATH="executorch-examples/mv3/apple/ExecuTorchDemo/ExecuTorchDemo"
1111
MODEL_NAME="mv3"
1212
SIMULATOR_NAME="executorch"
1313

@@ -34,6 +34,10 @@ say() {
3434
echo -e "\033[1m\n\t** $1 **\n\033[0m"
3535
}
3636

37+
say "Cloning the Demo App"
38+
39+
git clone --depth 1 https://github.com/pytorch-labs/executorch-examples.git
40+
3741
say "Installing CoreML Backend Requirements"
3842

3943
./backends/apple/coreml/scripts/install_requirements.sh

.ci/scripts/test_llama.sh

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -152,21 +152,11 @@ which "${PYTHON_EXECUTABLE}"
152152
cmake_install_executorch_libraries() {
153153
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
154154
rm -rf cmake-out
155-
retry cmake \
155+
retry cmake --preset llm \
156156
-DCMAKE_INSTALL_PREFIX=cmake-out \
157157
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
158-
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
159-
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
160-
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
161-
-DEXECUTORCH_BUILD_KERNELS_CUSTOM="$CUSTOM" \
162-
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
163-
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
164-
-DEXECUTORCH_BUILD_XNNPACK="$XNNPACK" \
165-
-DEXECUTORCH_BUILD_MPS="$MPS" \
166-
-DEXECUTORCH_BUILD_COREML="$COREML" \
167158
-DEXECUTORCH_BUILD_QNN="$QNN" \
168159
-DQNN_SDK_ROOT="$QNN_SDK_ROOT" \
169-
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
170160
-Bcmake-out .
171161
cmake --build cmake-out -j9 --target install --config "$CMAKE_BUILD_TYPE"
172162
}
@@ -181,10 +171,6 @@ cmake_build_llama_runner() {
181171
retry cmake \
182172
-DCMAKE_INSTALL_PREFIX=cmake-out \
183173
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
184-
-DEXECUTORCH_BUILD_KERNELS_CUSTOM="$CUSTOM" \
185-
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
186-
-DEXECUTORCH_BUILD_XNNPACK="$XNNPACK" \
187-
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
188174
-Bcmake-out/${dir} \
189175
${dir}
190176
cmake --build cmake-out/${dir} -j9 --config "$CMAKE_BUILD_TYPE"
@@ -269,7 +255,7 @@ $PYTHON_EXECUTABLE -m examples.models.llama.export_llama ${EXPORT_ARGS}
269255

270256
# Create tokenizer.bin.
271257
echo "Creating tokenizer.bin"
272-
$PYTHON_EXECUTABLE -m extension.llm.tokenizer.tokenizer -t tokenizer.model -o tokenizer.bin
258+
$PYTHON_EXECUTABLE -m pytorch_tokenizers.tools.llama2c.convert -t tokenizer.model -o tokenizer.bin
273259

274260

275261
RUNTIME_ARGS="--model_path=${EXPORTED_MODEL_NAME} --tokenizer_path=tokenizer.bin --prompt=Once --temperature=0 --seq_len=10 --warmup=1"

0 commit comments

Comments
 (0)