Skip to content

Commit 7b16758

Browse files
committed
Update on "Remove ExecuTorch copy of Vectorized"
All uses are outside ExecuTorch core, so we can just use ATen Vectorized. Differential Revision: [D66396016](https://our.internmc.facebook.com/intern/diff/D66396016/) [ghstack-poisoned]
2 parents 139998f + 3c2c8b4 commit 7b16758

File tree

2,099 files changed

+91969
-162327
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,099 files changed

+91969
-162327
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

Lines changed: 9 additions & 3 deletions
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
@@ -36,3 +39,6 @@
3639

3740
[buck2]
3841
restarter=true
42+
43+
[oss]
44+
folly_cxx_tests = False

.ci/docker/build.sh

Lines changed: 5 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
@@ -44,6 +48,7 @@ case "${IMAGE_NAME}" in
4448
executorch-ubuntu-22.04-mediatek-sdk)
4549
MEDIATEK_SDK=yes
4650
CLANG_VERSION=12
51+
ANDROID_NDK_VERSION=r27b
4752
;;
4853
executorch-ubuntu-22.04-clang12-android)
4954
LINTRUNNER=""

.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+
59d5cf083b4f860dea76fe8936076177f9367f10

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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 13 additions & 2 deletions
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

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/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/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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
1414
PYTHON_EXECUTABLE=python3
1515
fi
1616
which "${PYTHON_EXECUTABLE}"
17-
CMAKE_PREFIX_PATH="$(python3 -c 'import torch as _; print(_.__path__[0])')"
1817

1918
install_executorch_and_backend_lib() {
2019
echo "Installing executorch and xnnpack backend"
@@ -28,7 +27,6 @@ install_executorch_and_backend_lib() {
2827
-DANDROID_ABI="${ANDROID_ABI}" \
2928
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
3029
-DCMAKE_BUILD_TYPE=Release \
31-
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
3230
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
3331
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
3432
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
@@ -44,6 +42,10 @@ install_executorch_and_backend_lib() {
4442

4543
build_llama_runner() {
4644
echo "Building llama runner for Android..."
45+
pushd extension/llm/tokenizers
46+
echo "Updating tokenizers submodule"
47+
git submodule update --init
48+
popd
4749
ANDROID_ABI=arm64-v8a
4850
cmake -DBUCK2="${BUCK2}" \
4951
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake \
@@ -54,11 +56,9 @@ build_llama_runner() {
5456
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
5557
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
5658
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
57-
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
5859
-Bcmake-android-out/examples/models/llama examples/models/llama
5960

6061
cmake --build cmake-android-out/examples/models/llama -j4 --config Release
6162
}
62-
install_flatc_from_source
6363
install_executorch_and_backend_lib
6464
build_llama_runner

.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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"samsung_galaxy_s22": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/e59f866a-30aa-4aa1-87b7-4510e5820dfa",
2424
"samsung_galaxy_s24": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/98f8788c-2e25-4a3c-8bb2-0d1e8897c0db",
2525
"google_pixel_8_pro": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/d65096ab-900b-4521-be8b-a3619b69236a",
26+
"google_pixel_3_private_rooted": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/98d23ca8-ea9e-4fb7-b725-d402017b198d",
27+
"apple_iphone_15_private": "arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/55929353-2f28-4ee5-bdff-d1a95f58cb28",
2628
}
2729

2830
# Predefined benchmark configurations
@@ -263,7 +265,8 @@ def is_valid_huggingface_model_id(model_name: str) -> bool:
263265
def get_benchmark_configs() -> Dict[str, Dict]: # noqa: C901
264266
"""
265267
Gather benchmark configurations for a given set of models on the target operating system and devices.
266-
268+
CHANGE IF this function's return changed:
269+
extract_model_info() in executorch/.github/scripts/extract_benchmark_results.py IF YOU CHANGE THE RESULT OF THIS FUNCTION.
267270
Args:
268271
None
269272

.ci/scripts/gather_test_models.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
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
1114
from typing import Any
1215

1316
from examples.models import MODEL_NAME_TO_MODEL
14-
from examples.xnnpack import MODEL_NAME_TO_OPTIONS
17+
from examples.xnnpack import MODEL_NAME_TO_OPTIONS, QuantType
1518

1619
DEFAULT_RUNNERS = {
1720
"linux": "linux.2xlarge",
@@ -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

@@ -104,8 +108,12 @@ def model_should_run_on_target_os(model: str, target_os: str) -> bool:
104108
For example, a big model can be disabled in macos due to the limited macos resources.
105109
"""
106110
if target_os == "macos":
111+
# Disabled in macos due to limited resources, and should stay that way even if
112+
# we otherwise re-enable.
107113
return model not in ["llava"]
108-
return True
114+
# Disabled globally because we have test-llava-runner-linux that does a more
115+
# comprehensive E2E test of llava.
116+
return model not in ["llava"]
109117

110118

111119
def export_models_for_ci() -> dict[str, dict]:
@@ -146,7 +154,7 @@ def export_models_for_ci() -> dict[str, dict]:
146154
if backend == "xnnpack":
147155
if name not in MODEL_NAME_TO_OPTIONS:
148156
continue
149-
if MODEL_NAME_TO_OPTIONS[name].quantization:
157+
if MODEL_NAME_TO_OPTIONS[name].quantization != QuantType.NONE:
150158
backend += "-quantization"
151159

152160
if MODEL_NAME_TO_OPTIONS[name].delegation:

.ci/scripts/setup-linux.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,17 @@ set -exu
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13-
BUILD_TOOL=$1
14-
if [[ -z "${BUILD_TOOL:-}" ]]; then
15-
echo "Missing build tool (require buck2 or cmake), exiting..."
16-
exit 1
17-
else
18-
echo "Setup Linux for ${BUILD_TOOL} ..."
19-
fi
13+
read -r BUILD_TOOL BUILD_MODE EDITABLE < <(parse_args "$@")
2014

2115
# As Linux job is running inside a Docker container, all of its dependencies
2216
# have already been installed, so we use PyTorch build from source here instead
2317
# of nightly. This allows CI to test against latest commits from PyTorch
24-
install_executorch "use-pt-pinned-commit"
25-
build_executorch_runner "${BUILD_TOOL}"
18+
if [[ "${EDITABLE:-false}" == "true" ]]; then
19+
install_executorch --use-pt-pinned-commit --editable
20+
else
21+
install_executorch --use-pt-pinned-commit
22+
fi
23+
build_executorch_runner "${BUILD_TOOL}" "${BUILD_MODE}"
2624

2725
if [[ "${GITHUB_BASE_REF:-}" == *main* || "${GITHUB_BASE_REF:-}" == *gh* ]]; then
2826
do_not_use_nightly_on_ci

.ci/scripts/setup-macos.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@ set -exu
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13-
BUILD_TOOL=$1
14-
if [[ -z "${BUILD_TOOL:-}" ]]; then
15-
echo "Missing build tool (require buck2 or cmake), exiting..."
16-
exit 1
17-
else
18-
echo "Setup MacOS for ${BUILD_TOOL} ..."
19-
fi
13+
read -r BUILD_TOOL BUILD_MODE EDITABLE < <(parse_args "$@")
2014

2115
install_buck() {
2216
if ! command -v zstd &> /dev/null; then
@@ -135,8 +129,12 @@ print_cmake_info
135129
install_pytorch_and_domains
136130
# We build PyTorch from source here instead of using nightly. This allows CI to test against
137131
# the pinned commit from PyTorch
138-
install_executorch "use-pt-pinned-commit"
139-
build_executorch_runner "${BUILD_TOOL}"
132+
if [[ "$EDITABLE" == "true" ]]; then
133+
install_executorch --use-pt-pinned-commit --editable
134+
else
135+
install_executorch --use-pt-pinned-commit
136+
fi
137+
build_executorch_runner "${BUILD_TOOL}" "${BUILD_MODE}"
140138

141139
if [[ "${GITHUB_BASE_REF:-}" == *main* || "${GITHUB_BASE_REF:-}" == *gh* ]]; then
142140
do_not_use_nightly_on_ci

0 commit comments

Comments
 (0)