Skip to content

Commit ff7dde9

Browse files
committed
Merge remote-tracking branch 'origin/upstream/main' into md-ceil-reviewed
2 parents 496a185 + b0c2c7c commit ff7dde9

File tree

450 files changed

+12713
-5152
lines changed

Some content is hidden

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

450 files changed

+12713
-5152
lines changed

.buckconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@
3939

4040
[buck2]
4141
restarter=true
42+
43+
[oss]
44+
folly_cxx_tests = False

.ci/docker/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ case "${IMAGE_NAME}" in
2929
LINTRUNNER=""
3030
CLANG_VERSION=12
3131
;;
32+
executorch-ubuntu-22.04-gcc11-aarch64)
33+
LINTRUNNER=""
34+
GCC_VERSION=11
35+
;;
3236
executorch-ubuntu-22.04-linter)
3337
LINTRUNNER=yes
3438
CLANG_VERSION=12

.ci/docker/ci_commit_pins/pytorch.txt

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

.ci/docker/common/install_conda.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1313
install_miniconda() {
1414
BASE_URL="https://repo.anaconda.com/miniconda"
1515
CONDA_FILE="Miniconda3-py${PYTHON_VERSION//./}_${MINICONDA_VERSION}-Linux-x86_64.sh"
16+
if [[ $(uname -m) == "aarch64" ]]; then
17+
CONDA_FILE="Miniconda3-py${PYTHON_VERSION//./}_${MINICONDA_VERSION}-Linux-aarch64.sh"
18+
fi
1619

1720
mkdir -p /opt/conda
1821
chown ci-user:ci-user /opt/conda
@@ -36,7 +39,7 @@ install_python() {
3639

3740
# From https://github.com/pytorch/pytorch/blob/main/.ci/docker/common/install_conda.sh
3841
if [[ $(uname -m) == "aarch64" ]]; then
39-
conda_install "openblas==0.3.28=*openmp*"
42+
conda_install "openblas==0.3.29=*openmp*" -c conda-forge
4043
else
4144
conda_install mkl=2022.1.0 mkl-include=2022.1.0
4245
fi

.ci/docker/common/install_java.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
apt-get update
11+
12+
apt-get install -y --no-install-recommends openjdk-17-jdk

.ci/docker/ubuntu/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ ARG BUCK2_VERSION
3030
COPY ./common/install_buck.sh install_buck.sh
3131
RUN bash ./install_buck.sh && rm install_buck.sh
3232

33+
# Install java
34+
COPY ./common/install_java.sh install_java.sh
35+
RUN bash ./install_java.sh && rm install_java.sh
36+
3337
# Setup user
3438
COPY ./common/install_user.sh install_user.sh
3539
RUN bash ./install_user.sh && rm install_user.sh

.ci/scripts/build_llama_android.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ install_executorch_and_backend_lib() {
4242

4343
build_llama_runner() {
4444
echo "Building llama runner for Android..."
45+
pushd extension/llm/tokenizers
46+
echo "Updating tokenizers submodule"
47+
git submodule update --init
48+
popd
4549
ANDROID_ABI=arm64-v8a
4650
cmake -DBUCK2="${BUCK2}" \
4751
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake \

.ci/scripts/gather_test_models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
77

8+
# WARNING: The CI runner logic should directly be in the corresponding yml files
9+
# This file will be deleted once the reference in periodic.yml is deleted.
10+
811
import itertools
912
import json
1013
import os
@@ -30,6 +33,7 @@
3033
"dl3": "linux.4xlarge.memory",
3134
"emformer_join": "linux.4xlarge.memory",
3235
"emformer_predict": "linux.4xlarge.memory",
36+
"phi-4-mini": "linux.4xlarge.memory",
3337
}
3438
}
3539

.ci/scripts/test_ane_static_llama.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Copyright (c) Qualcomm Innovation Center, Inc.
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 -exu
9+
10+
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
11+
12+
export EXECUTORCH_ROOT="$(dirname "${BASH_SOURCE[0]}")/../.."
13+
14+
if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
15+
PYTHON_EXECUTABLE=python3
16+
fi
17+
18+
which "${PYTHON_EXECUTABLE}"
19+
20+
# Update tokenizers submodule
21+
pushd $EXECUTORCH_ROOT/extension/llm/tokenizers
22+
echo "Update tokenizers submodule"
23+
git submodule update --init
24+
popd
25+
26+
pushd $EXECUTORCH_ROOT/examples/apple/coreml/llama
27+
28+
# Download stories llama110m artifacts
29+
download_stories_model_artifacts
30+
31+
python export.py -n model.pte -p params.json -c stories110M.pt --seq_length 32 --max_seq_length 64 --dtype fp16 --coreml-quantize c4w
32+
33+
popd

.ci/scripts/test_llama.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ cmake_install_executorch_libraries() {
173173

174174
cmake_build_llama_runner() {
175175
echo "Building llama runner"
176+
pushd extension/llm/tokenizers
177+
echo "Updating tokenizers submodule"
178+
git submodule update --init
179+
popd
176180
dir="examples/models/llama"
177181
retry cmake \
178182
-DCMAKE_INSTALL_PREFIX=cmake-out \

.ci/scripts/test_model.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ test_model() {
100100
rm "./${MODEL_NAME}.pte"
101101
return # Skip running with portable executor runnner since portable doesn't support Qwen's biased linears.
102102
fi
103+
if [[ "${MODEL_NAME}" == "phi-4-mini" ]]; then
104+
# Install requirements for export_llama
105+
bash examples/models/llama/install_requirements.sh
106+
# Test export_llama script: python3 -m examples.models.llama.export_llama.
107+
"${PYTHON_EXECUTABLE}" -m examples.models.llama.export_llama --model "${MODEL_NAME}" -c examples/models/llama/params/demo_rand_params.pth -p examples/models/phi-4-mini/config.json
108+
run_portable_executor_runner
109+
rm "./${MODEL_NAME}.pte"
110+
return
111+
fi
103112

104113
# Export a basic .pte and run the model.
105114
"${PYTHON_EXECUTABLE}" -m examples.portable.scripts.export --model_name="${MODEL_NAME}" "${STRICT}"
@@ -164,6 +173,7 @@ test_model_with_qnn() {
164173
export LD_LIBRARY_PATH=$QNN_SDK_ROOT/lib/x86_64-linux-clang/
165174
export PYTHONPATH=$EXECUTORCH_ROOT/..
166175

176+
EXTRA_FLAGS=""
167177
if [[ "${MODEL_NAME}" == "dl3" ]]; then
168178
EXPORT_SCRIPT=deeplab_v3
169179
elif [[ "${MODEL_NAME}" == "mv3" ]]; then
@@ -176,6 +186,12 @@ test_model_with_qnn() {
176186
EXPORT_SCRIPT=inception_v3
177187
elif [[ "${MODEL_NAME}" == "vit" ]]; then
178188
EXPORT_SCRIPT=torchvision_vit
189+
elif [[ "${MODEL_NAME}" == "mb" ]]; then
190+
EXPORT_SCRIPT=mobilebert_fine_tune
191+
EXTRA_FLAGS="--num_epochs 1"
192+
pip install scikit-learn
193+
elif [[ "${MODEL_NAME}" == "w2l" ]]; then
194+
EXPORT_SCRIPT=wav2letter
179195
elif [[ "${MODEL_NAME}" == "edsr" ]]; then
180196
EXPORT_SCRIPT=edsr
181197
# Additional deps for edsr
@@ -189,7 +205,7 @@ test_model_with_qnn() {
189205
# TODO(guangyang): Make QNN chipset matches the target device
190206
QNN_CHIPSET=SM8450
191207

192-
"${PYTHON_EXECUTABLE}" -m examples.qualcomm.scripts.${EXPORT_SCRIPT} -b ${CMAKE_OUTPUT_DIR} -m ${QNN_CHIPSET} --compile_only
208+
"${PYTHON_EXECUTABLE}" -m examples.qualcomm.scripts.${EXPORT_SCRIPT} -b ${CMAKE_OUTPUT_DIR} -m ${QNN_CHIPSET} --compile_only $EXTRA_FLAGS
193209
EXPORTED_MODEL=$(find "./${EXPORT_SCRIPT}" -type f -name "${MODEL_NAME}*.pte" -print -quit)
194210
}
195211

.ci/scripts/unittest-buck2.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,22 @@ set -eux
88

99
# TODO: expand this to //...
1010
# TODO: can't query cadence & vulkan backends
11+
# TODO: can't query //kernels/prim_ops because of a cpp_unittest and
12+
# broken code in shim to read oss.folly_cxx_tests. Sending fix but it
13+
# needs to propagate and we need a submodule update.
1114
buck2 query "//backends/apple/... + //backends/example/... + \
1215
//backends/mediatek/... + //backends/test/... + //backends/transforms/... + \
13-
//backends/xnnpack/... + //configurations/... + //kernels/portable/cpu/... + \
14-
//runtime/... + //schema/... + //test/... + //util/..."
16+
//backends/xnnpack/... + //configurations/... + //kernels/aten/... + \
17+
//kernels/optimized/... + //kernels/portable/... + //kernels/quantized/... + \
18+
//kernels/test/... + //runtime/... + //schema/... + //test/... + //util/..."
1519

20+
UNBUILDABLE_OPTIMIZED_OPS_REGEX="gelu|fft_r2c|log_softmax"
21+
BUILDABLE_OPTIMIZED_OPS=$(buck2 query //kernels/optimized/cpu/... | grep -E -v $UNBUILDABLE_OPTIMIZED_OPS_REGEX)
22+
23+
BUILDABLE_KERNELS_PRIM_OPS_TARGETS=$(buck2 query //kernels/prim_ops/... | grep -v prim_ops_test_py)
1624
# TODO: expand the covered scope of Buck targets.
17-
buck2 build //runtime/core/portable_type/...
18-
buck2 test //runtime/core/portable_type/...
25+
# //runtime/kernel/... is failing because //third-party:torchgen_files's shell script can't find python on PATH.
26+
# //runtime/test/... requires Python torch, which we don't have in our OSS buck setup.
27+
buck2 test $BUILDABLE_OPTIMIZED_OPS //kernels/portable/... \
28+
$BUILDABLE_KERNELS_PRIM_OPS_TARGETS //runtime/backend/... //runtime/core/... \
29+
//runtime/executor: //runtime/kernel/... //runtime/platform/...

.ci/scripts/unittest-macos-buck2.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env 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+
set -eux
8+
9+
buck2 test //extension/apple:ExecuTorch

.ci/scripts/unittest-macos.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ if [[ "$BUILD_TOOL" == "cmake" ]]; then
3535
.ci/scripts/unittest-macos-cmake.sh
3636
elif [[ "$BUILD_TOOL" == "buck2" ]]; then
3737
.ci/scripts/unittest-buck2.sh
38+
.ci/scripts/unittest-macos-buck2.sh
3839
else
3940
echo "Unknown build tool $BUILD_TOOL"
4041
exit 1

0 commit comments

Comments
 (0)