Skip to content

Commit 28a220a

Browse files
committed
Update on "Update pytorch nightly pin to 03/13"
## Context Updating PyTorch nightly pin to 03/13 to capture dynamic shape support in ATen Vulkan (pytorch/pytorch#121598). Previous upate was to 03/12 (#2370) so this should not be a risky change. Also, according to PyTorch nightly HUD (https://hud.pytorch.org/hud/pytorch/pytorch/nightly) this 03/13 nightly is all green while 03/12 nightly had some failures. Differential Revision: [D54870270](https://our.internmc.facebook.com/intern/diff/D54870270) [ghstack-poisoned]
2 parents 779fd60 + 72288a5 commit 28a220a

File tree

337 files changed

+12705
-2916
lines changed

Some content is hidden

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

337 files changed

+12705
-2916
lines changed

.ci/docker/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ case "${IMAGE_NAME}" in
3737
ARM_SDK=yes
3838
CLANG_VERSION=12
3939
;;
40+
executorch-ubuntu-22.04-clang12-android)
41+
LINTRUNNER=""
42+
CLANG_VERSION=12
43+
# From https://developer.android.com/ndk/downloads
44+
ANDROID_NDK_VERSION=r26c
45+
;;
4046
*)
4147
echo "Invalid image name ${IMAGE_NAME}"
4248
exit 1
@@ -66,6 +72,7 @@ docker build \
6672
--build-arg "LINTRUNNER=${LINTRUNNER:-}" \
6773
--build-arg "BUILD_DOCS=${BUILD_DOCS}" \
6874
--build-arg "ARM_SDK=${ARM_SDK:-}" \
75+
--build-arg "ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-}" \
6976
-f "${OS}"/Dockerfile \
7077
"$@" \
7178
.

.ci/docker/ci_commit_pins/pytorch.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5b90074540577267c29f5f784be123ee54f6491d
1+
6b5259e50704aede43c87fed33f64224f9047087

.ci/docker/common/install_android.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
# Double check if the NDK version is set
11+
[ -n "${ANDROID_NDK_VERSION}" ]
12+
13+
install_prerequiresites() {
14+
apt-get update
15+
16+
# NB: Need OpenJDK 17 at the minimum
17+
apt-get install -y --no-install-recommends \
18+
openjdk-17-jdk \
19+
ca-certificates-java \
20+
ant
21+
22+
# Cleanup package manager
23+
apt-get autoclean && apt-get clean
24+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
25+
}
26+
27+
install_ndk() {
28+
NDK_INSTALLATION_DIR=/opt/ndk
29+
mkdir -p "${NDK_INSTALLATION_DIR}"
30+
31+
pushd /tmp
32+
# The NDK installation is cached on ossci-android S3 bucket
33+
curl -Os --retry 3 "https://ossci-android.s3.amazonaws.com/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
34+
unzip -qo "android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
35+
36+
# Print the content for manual verification
37+
ls -lah "android-ndk-${ANDROID_NDK_VERSION}"
38+
mv "android-ndk-${ANDROID_NDK_VERSION}"/* "${NDK_INSTALLATION_DIR}"
39+
40+
popd
41+
}
42+
43+
install_cmdtools() {
44+
CMDTOOLS_FILENAME=commandlinetools-linux-11076708_latest.zip
45+
46+
pushd /tmp
47+
# The file is cached on ossci-android S3 bucket
48+
curl -Os --retry 3 "https://ossci-android.s3.us-west-1.amazonaws.com/${CMDTOOLS_FILENAME}"
49+
unzip -qo "${CMDTOOLS_FILENAME}" -d /opt
50+
51+
ls -lah /opt/cmdline-tools/bin
52+
popd
53+
}
54+
55+
install_sdk() {
56+
SDK_INSTALLATION_DIR=/opt/android/sdk
57+
mkdir -p "${SDK_INSTALLATION_DIR}"
58+
59+
# These are the tools needed to build Android apps
60+
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "platforms;android-34"
61+
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "build-tools;33.0.1"
62+
# And some more tools for future emulator tests
63+
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "platform-tools"
64+
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "tools"
65+
}
66+
67+
install_prerequiresites
68+
install_ndk
69+
install_cmdtools
70+
install_sdk

.ci/docker/ubuntu/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ COPY ./requirements-lintrunner.txt requirements-lintrunner.txt
7171
RUN if [ -n "${LINTRUNNER}" ]; then bash ./install_linter.sh; fi
7272
RUN rm install_linter.sh utils.sh requirements-lintrunner.txt
7373

74+
ARG ANDROID_NDK_VERSION
75+
# Install lintrunner if needed
76+
COPY ./common/install_android.sh install_android.sh
77+
RUN if [ -n "${ANDROID_NDK_VERSION}" ]; then bash ./install_android.sh; fi
78+
RUN rm install_android.sh
79+
7480
ARG ARM_SDK
7581
COPY --chown=ci-user:ci-user ./arm /opt/arm
7682
# Set up ARM SDK if needed

.ci/scripts/utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ install_executorch() {
1919
which pip
2020
# Install executorch, this assumes that Executorch is checked out in the
2121
# current directory
22-
pip install . --no-build-isolation
22+
pip install . --no-build-isolation -v
2323
# Just print out the list of packages for debugging
2424
pip list
2525
}

.github/workflows/_unittest.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ jobs:
3333
conda activate "${CONDA_ENV}"
3434
3535
BUILD_TOOL=${{ matrix.build-tool }}
36+
3637
# Setup MacOS dependencies as there is no Docker support on MacOS atm
37-
PYTHON_EXECUTABLE=python EXECUTORCH_BUILD_PYBIND=ON bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
38+
PYTHON_EXECUTABLE=python \
39+
EXECUTORCH_BUILD_PYBIND=ON \
40+
.ci/scripts/setup-linux.sh "${BUILD_TOOL}"
3841
3942
# Run pytest with coverage
4043
pytest -n auto --cov=./ --cov-report=xml
@@ -59,8 +62,13 @@ jobs:
5962
BUILD_TOOL=${{ matrix.build-tool }}
6063
6164
bash .ci/scripts/setup-conda.sh
65+
6266
# Setup MacOS dependencies as there is no Docker support on MacOS atm
63-
PYTHON_EXECUTABLE=python ${CONDA_RUN} EXECUTORCH_BUILD_PYBIND=ON bash .ci/scripts/setup-macos.sh "${BUILD_TOOL}"
67+
PYTHON_EXECUTABLE=python \
68+
EXECUTORCH_BUILD_PYBIND=ON \
69+
CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON" \
70+
${CONDA_RUN} --no-capture-output \
71+
.ci/scripts/setup-macos.sh "${BUILD_TOOL}"
6472
6573
# Run pytest with coverage
6674
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml

.github/workflows/android.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build ExecuTorch Android demo apps
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release/*
8+
pull_request:
9+
paths:
10+
- .ci/docker/**
11+
- .github/workflows/android.yml
12+
- install_requirements.sh
13+
- examples/demo-apps/**
14+
- extension/module/**
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
test-demo-android:
23+
name: test-demo-android
24+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
25+
strategy:
26+
matrix:
27+
include:
28+
- build-tool: buck2
29+
with:
30+
# NB: The example model dl3 requires lots of memory (T161064121)
31+
runner: linux.12xlarge
32+
docker-image: executorch-ubuntu-22.04-clang12-android
33+
submodules: 'true'
34+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
35+
timeout: 90
36+
script: |
37+
set -eux
38+
39+
# The generic Linux job chooses to use base env, not the one setup by the image
40+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
41+
conda activate "${CONDA_ENV}"
42+
43+
BUILD_TOOL=${{ matrix.build-tool }}
44+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
45+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
46+
# Build Android demo app
47+
bash build/test_android_ci.sh

.github/workflows/apple.yml

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
pull_request:
99
paths:
1010
- .ci/docker/**
11-
- .github/workflows/app-build.yml
11+
- .github/workflows/apple.yml
1212
- install_requirements.sh
1313
- backends/apple/**
1414
- build/build_apple_frameworks.sh
@@ -58,14 +58,20 @@ jobs:
5858
python-version: '3.11'
5959
submodules: 'true'
6060
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
61-
upload-artifact: executorch.zip
61+
upload-artifact: executorch-frameworks-ios
6262
timeout: 90
6363
script: |
6464
WORKSPACE=$(pwd)
6565
pushd "${WORKSPACE}/pytorch/executorch"
6666
BUILD_TOOL=cmake
6767
VERSION="0.1.0"
68-
OUTPUT="executorch-${VERSION}"
68+
FRAMEWORKS=(
69+
"executorch"
70+
"coreml_backend"
71+
"mps_backend"
72+
"portable_backend"
73+
"xnnpack_backend"
74+
)
6975
7076
.ci/scripts/setup-conda.sh
7177
@@ -83,10 +89,58 @@ jobs:
8389
8490
# Build iOS Frameworks
8591
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
86-
build/build_apple_frameworks.sh --output="${OUTPUT}" --coreml --mps --portable --xnnpack
92+
build/build_apple_frameworks.sh --coreml --mps --portable --xnnpack
8793
8894
# Bundle iOS Frameworks
89-
cp LICENSE "${OUTPUT}"
90-
zip -r "${RUNNER_TEMP}/artifacts/${OUTPUT}.zip" "${OUTPUT}"
95+
for FRAMEWORK in "${FRAMEWORKS[@]}"; do (
96+
cd cmake-out && zip -r "${RUNNER_TEMP}/artifacts/${FRAMEWORK}-${VERSION}.zip" "${FRAMEWORK}.xcframework"
97+
) done
9198
9299
popd
100+
101+
upload-frameworks-ios:
102+
runs-on: ubuntu-22.04
103+
needs: build-frameworks-ios
104+
timeout-minutes: 30
105+
permissions:
106+
id-token: write
107+
contents: read
108+
steps:
109+
- uses: actions/checkout@v3
110+
- uses: actions/setup-python@v4
111+
with:
112+
python-version: '3.11'
113+
cache: pip
114+
- name: configure aws credentials
115+
uses: aws-actions/[email protected]
116+
with:
117+
role-to-assume: arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-ios
118+
aws-region: us-east-1
119+
- name: Download the artifact
120+
uses: actions/download-artifact@v3
121+
with:
122+
# NB: The name here needs to match the upload-artifact name from build-frameworks-ios job
123+
name: executorch-frameworks-ios
124+
path: ${{ runner.temp }}/frameworks-ios/
125+
- name: Only push to S3 when running the workflow manually from main branch
126+
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
127+
shell: bash
128+
run: |
129+
set -eux
130+
echo "UPLOAD_ON_MAIN=1" >> "${GITHUB_ENV}"
131+
- name: Upload the artifact to ossci-ios S3 bucket
132+
shell: bash
133+
run: |
134+
set -eux
135+
136+
pip install awscli==1.32.18
137+
138+
AWS_CMD="aws s3 cp --dryrun"
139+
if [[ "${UPLOAD_ON_MAIN:-0}" == "1" ]]; then
140+
AWS_CMD="aws s3 cp"
141+
fi
142+
143+
for FILENAME in "${RUNNER_TEMP}"/frameworks-ios/*.zip; do
144+
[ -e "${FILENAME}" ] || continue
145+
${AWS_CMD} "${FILENAME}" s3://ossci-ios/executorch/ --acl public-read
146+
done

.github/workflows/docker-builds.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
- docker-image-name: executorch-ubuntu-22.04-clang12
3939
- docker-image-name: executorch-ubuntu-22.04-linter
4040
- docker-image-name: executorch-ubuntu-22.04-arm-sdk
41+
- docker-image-name: executorch-ubuntu-22.04-clang12-android
4142
env:
4243
DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/executorch/${{ matrix.docker-image-name }}
4344
steps:

.github/workflows/pull.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ jobs:
206206
207207
# build module for executorch.extension.pybindings.portable_lib
208208
BUILD_TOOL=${{ matrix.build-tool }}
209-
PYTHON_EXECUTABLE=python EXECUTORCH_BUILD_PYBIND=ON bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
209+
PYTHON_EXECUTABLE=python \
210+
EXECUTORCH_BUILD_PYBIND=ON \
211+
bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
210212
211213
# see if we can import the module successfully
212214
python -c "from executorch.extension.pybindings import portable_lib; print('success!')"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ buck-out/
33
cmake-out/
44
cmake-android-out/
55
cmake-ios-out/
6+
ethos-u-scratch/
67
executorch.egg-info
78
__pycache__/
89
build/lib/

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
url = https://github.com/Maratyszcza/FXdiv.git
3131
[submodule "backends/xnnpack/third-party/XNNPACK"]
3232
path = backends/xnnpack/third-party/XNNPACK
33-
url = https://github.com/google/XNNPACK.git
33+
url = https://github.com/digantdesai/XNNPACK.git
3434
[submodule "backends/arm/third-party/serialization_lib"]
3535
path = backends/arm/third-party/serialization_lib
3636
url = https://review.mlplatform.org/tosa/serialization_lib

0 commit comments

Comments
 (0)