Skip to content

Commit 50199df

Browse files
Merge branch 'main' into platform-config
2 parents dac4306 + 9663990 commit 50199df

File tree

2,898 files changed

+177667
-188814
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,898 files changed

+177667
-188814
lines changed
File renamed without changes.
File renamed without changes.

.Package.swift/backend_mps_debug/dummy.swift

Whitespace-only changes.

.Package.swift/backend_xnnpack/dummy.swift

Whitespace-only changes.

.Package.swift/backend_xnnpack_debug/dummy.swift

Whitespace-only changes.

.Package.swift/executorch/dummy.swift

Whitespace-only changes.

.Package.swift/executorch_debug/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_custom/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_custom_debug/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_optimized/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_optimized_debug/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_portable/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_portable_debug/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_quantized/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_quantized_debug/dummy.swift

Whitespace-only changes.

.buckconfig

+12-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@
88
root = .
99
prelude = third-party/prelude
1010
shim = shim
11+
shim_et = shim_et
1112

1213
[repository_aliases]
14+
bazel_skylib = shim
1315
config = prelude
1416
ovr_config = prelude
15-
toolchains = shim
16-
fbcode = shim
17+
toolchains = shim_et
18+
fbcode = shim_et
1719
fbcode_macros = shim
18-
fbsource = shim
20+
fbsource = shim_et
1921
buck = shim
22+
gh_facebook_buck2_shims_meta = shim
2023

2124
[cxx]
2225
cxxflags = -g -std=c++17
@@ -33,3 +36,9 @@
3336
**/.git, \
3437
cmake-out, \
3538
pip-out
39+
40+
[buck2]
41+
restarter=true
42+
43+
[oss]
44+
folly_cxx_tests = False

.ci/docker/build.sh

+10
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
@@ -41,6 +45,11 @@ case "${IMAGE_NAME}" in
4145
QNN_SDK=yes
4246
CLANG_VERSION=12
4347
;;
48+
executorch-ubuntu-22.04-mediatek-sdk)
49+
MEDIATEK_SDK=yes
50+
CLANG_VERSION=12
51+
ANDROID_NDK_VERSION=r27b
52+
;;
4453
executorch-ubuntu-22.04-clang12-android)
4554
LINTRUNNER=""
4655
CLANG_VERSION=12
@@ -77,6 +86,7 @@ docker build \
7786
--build-arg "BUILD_DOCS=${BUILD_DOCS}" \
7887
--build-arg "ARM_SDK=${ARM_SDK:-}" \
7988
--build-arg "QNN_SDK=${QNN_SDK:-}" \
89+
--build-arg "MEDIATEK_SDK=${MEDIATEK_SDK:-}" \
8090
--build-arg "ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-}" \
8191
-f "${OS}"/Dockerfile \
8292
"$@" \

.ci/docker/ci_commit_pins/buck2.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-05-15
1+
2024-12-16

.ci/docker/ci_commit_pins/pytorch.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19eff28ff3f19b50da46f5a9ff5f4d4d213806fe
1+
59d5cf083b4f860dea76fe8936076177f9367f10

.ci/docker/common/install_android.sh

+1
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/common/install_base.sh

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ install_ubuntu() {
2626
libssl-dev \
2727
zip
2828

29+
# These libraries are needed by TorchVision
30+
apt-get install -y --no-install-recommends \
31+
libjpeg-dev \
32+
libpng-dev
33+
2934
# Cleanup package manager
3035
apt-get autoclean && apt-get clean
3136
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

.ci/docker/common/install_conda.sh

+13-2
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
@@ -31,8 +34,16 @@ install_miniconda() {
3134

3235
install_python() {
3336
pushd /opt/conda
34-
# Install the correct Python version
37+
# Install the selected Python version for CI jobs
3538
as_ci_user conda create -n "py_${PYTHON_VERSION}" -y --file /opt/conda/conda-env-ci.txt python="${PYTHON_VERSION}"
39+
40+
# From https://github.com/pytorch/pytorch/blob/main/.ci/docker/common/install_conda.sh
41+
if [[ $(uname -m) == "aarch64" ]]; then
42+
conda_install "openblas==0.3.29=*openmp*" -c conda-forge
43+
else
44+
conda_install mkl=2022.1.0 mkl-include=2022.1.0
45+
fi
46+
3647
popd
3748
}
3849

@@ -53,7 +64,7 @@ fix_conda_ubuntu_libstdcxx() {
5364
# PyTorch sev: https://github.com/pytorch/pytorch/issues/105248
5465
# Ref: https://github.com/pytorch/pytorch/blob/main/.ci/docker/common/install_conda.sh
5566
if grep -e "2[02].04." /etc/issue >/dev/null; then
56-
rm "/opt/conda/envs/py_${PYTHON_VERSION}/lib/libstdc++.so.6"
67+
rm /opt/conda/envs/py_${PYTHON_VERSION}/lib/libstdc++.so*
5768
fi
5869
}
5970

.ci/docker/common/install_java.sh

+12
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/common/install_pytorch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ install_pytorch_and_domains() {
2626

2727
chown -R ci-user .
2828

29-
export _GLIBCXX_USE_CXX11_ABI=0
29+
export _GLIBCXX_USE_CXX11_ABI=1
3030
# Then build and install PyTorch
3131
conda_run python setup.py bdist_wheel
3232
pip_install "$(echo dist/*.whl)"

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
cmake=3.22.1
1+
cmake=3.26.4
22
ninja=1.10.2
3+
libuv
4+
llvm-openmp
5+
pkg-config

.ci/docker/requirements-ci.txt

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
mpmath==1.3.0
2-
numpy==1.21.3; python_version == '3.10'
3-
numpy==1.23.2; python_version == '3.11'
4-
numpy; python_version >= '3.12'
2+
numpy>=2.0.0; python_version >= '3.10'
53
PyYAML==6.0.1
64
ruamel.yaml==0.17.32
75
sympy==1.12
86
timm==0.6.13
97
tomli==2.0.1
108
torchsr==1.0.4
11-
transformers==4.38.0
9+
transformers==4.47.1
1210
zstd==1.5.5.1
13-
pandas==2.0.3; python_version == '3.10'
14-
pandas; python_version >= '3.11'
11+
pandas>=2.2.2; python_version >= '3.10'
1512
pytest==7.2.0
1613
pytest-cov==4.1.0
1714
expecttest==0.1.6
@@ -20,11 +17,12 @@ parameterized==0.9.0
2017

2118
# Doc build requirements, same as https://github.com/pytorch/pytorch/blob/main/.ci/docker/requirements-docs.txt
2219
sphinx==5.3.0
20+
sphinx-reredirects==0.1.4
2321
sphinx-gallery==0.14.0
2422
breathe==4.34.0
2523
exhale==0.2.3
2624
docutils==0.16
27-
matplotlib==3.7.2
25+
matplotlib>=3.9.4
2826
# PyTorch Theme
2927
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
3028
myst-parser==0.18.1

.ci/docker/ubuntu/Dockerfile

+6-3
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
@@ -79,11 +83,10 @@ RUN if [ -n "${ANDROID_NDK_VERSION}" ]; then bash ./install_android.sh; fi
7983
RUN rm install_android.sh
8084

8185
ARG ARM_SDK
82-
COPY --chown=ci-user:ci-user ./arm /opt/arm
83-
# Set up ARM SDK if needed
84-
RUN if [ -n "${ARM_SDK}" ]; then git config --global user.email "[email protected]"; git config --global user.name "OSS CI"; bash /opt/arm/setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi
8586

8687
ARG QNN_SDK
8788

89+
ARG MEDIATEK_SDK
90+
8891
USER ci-user
8992
CMD ["bash"]

.ci/scripts/__init__.py

Whitespace-only changes.

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

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# Copyright 2025 Arm Limited and/or its affiliates.
34
# All rights reserved.
45
#
56
# This source code is licensed under the BSD-style license found in the
@@ -11,10 +12,16 @@ set -o xtrace
1112
build_qnn_backend() {
1213
echo "Start building qnn backend."
1314
export ANDROID_NDK_ROOT=/opt/ndk
14-
export QNN_SDK_ROOT=/tmp/qnn/2.25.0.240728
15+
export QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029
1516
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
1617

17-
bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release
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
1825
}
1926

2027
set_up_aot() {

.ci/scripts/build_llama_android.sh

+11-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ set -exu
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13+
if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
14+
PYTHON_EXECUTABLE=python3
15+
fi
16+
which "${PYTHON_EXECUTABLE}"
17+
1318
install_executorch_and_backend_lib() {
1419
echo "Installing executorch and xnnpack backend"
15-
rm -rf cmake-android-out && mkdir cmake-android-out
20+
clean_executorch_install_folders
21+
mkdir cmake-android-out
1622
ANDROID_NDK=/opt/ndk
1723
BUCK2=buck2
1824
ANDROID_ABI=arm64-v8a
@@ -36,6 +42,10 @@ install_executorch_and_backend_lib() {
3642

3743
build_llama_runner() {
3844
echo "Building llama runner for Android..."
45+
pushd extension/llm/tokenizers
46+
echo "Updating tokenizers submodule"
47+
git submodule update --init
48+
popd
3949
ANDROID_ABI=arm64-v8a
4050
cmake -DBUCK2="${BUCK2}" \
4151
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake \
@@ -50,6 +60,5 @@ build_llama_runner() {
5060

5161
cmake --build cmake-android-out/examples/models/llama -j4 --config Release
5262
}
53-
install_flatc_from_source
5463
install_executorch_and_backend_lib
5564
build_llama_runner

.ci/scripts/check_c10_sync.sh

+14
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

+54
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

0 commit comments

Comments
 (0)