Skip to content

Commit

Permalink
2024-03-27 nightly release (853fb5b)
Browse files Browse the repository at this point in the history
  • Loading branch information
pytorchbot committed Mar 27, 2024
1 parent 90080f6 commit ba976e5
Show file tree
Hide file tree
Showing 507 changed files with 20,450 additions and 4,629 deletions.
7 changes: 7 additions & 0 deletions .ci/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ case "${IMAGE_NAME}" in
ARM_SDK=yes
CLANG_VERSION=12
;;
executorch-ubuntu-22.04-clang12-android)
LINTRUNNER=""
CLANG_VERSION=12
# From https://developer.android.com/ndk/downloads
ANDROID_NDK_VERSION=r26c
;;
*)
echo "Invalid image name ${IMAGE_NAME}"
exit 1
Expand Down Expand Up @@ -66,6 +72,7 @@ docker build \
--build-arg "LINTRUNNER=${LINTRUNNER:-}" \
--build-arg "BUILD_DOCS=${BUILD_DOCS}" \
--build-arg "ARM_SDK=${ARM_SDK:-}" \
--build-arg "ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-}" \
-f "${OS}"/Dockerfile \
"$@" \
.
2 changes: 1 addition & 1 deletion .ci/docker/ci_commit_pins/pytorch.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6ca9ae4f8693639c395544327f7e362441a58c79
a52b4e22571507abc35c2d47de138497190d2e0a
70 changes: 70 additions & 0 deletions .ci/docker/common/install_android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set -ex

# Double check if the NDK version is set
[ -n "${ANDROID_NDK_VERSION}" ]

install_prerequiresites() {
apt-get update

# NB: Need OpenJDK 17 at the minimum
apt-get install -y --no-install-recommends \
openjdk-17-jdk \
ca-certificates-java \
ant

# Cleanup package manager
apt-get autoclean && apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
}

install_ndk() {
NDK_INSTALLATION_DIR=/opt/ndk
mkdir -p "${NDK_INSTALLATION_DIR}"

pushd /tmp
# The NDK installation is cached on ossci-android S3 bucket
curl -Os --retry 3 "https://ossci-android.s3.amazonaws.com/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
unzip -qo "android-ndk-${ANDROID_NDK_VERSION}-linux.zip"

# Print the content for manual verification
ls -lah "android-ndk-${ANDROID_NDK_VERSION}"
mv "android-ndk-${ANDROID_NDK_VERSION}"/* "${NDK_INSTALLATION_DIR}"

popd
}

install_cmdtools() {
CMDTOOLS_FILENAME=commandlinetools-linux-11076708_latest.zip

pushd /tmp
# The file is cached on ossci-android S3 bucket
curl -Os --retry 3 "https://ossci-android.s3.us-west-1.amazonaws.com/${CMDTOOLS_FILENAME}"
unzip -qo "${CMDTOOLS_FILENAME}" -d /opt

ls -lah /opt/cmdline-tools/bin
popd
}

install_sdk() {
SDK_INSTALLATION_DIR=/opt/android/sdk
mkdir -p "${SDK_INSTALLATION_DIR}"

# These are the tools needed to build Android apps
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "platforms;android-34"
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "build-tools;33.0.1"
# And some more tools for future emulator tests
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "platform-tools"
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "tools"
}

install_prerequiresites
install_ndk
install_cmdtools
install_sdk
6 changes: 6 additions & 0 deletions .ci/docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ COPY ./requirements-lintrunner.txt requirements-lintrunner.txt
RUN if [ -n "${LINTRUNNER}" ]; then bash ./install_linter.sh; fi
RUN rm install_linter.sh utils.sh requirements-lintrunner.txt

ARG ANDROID_NDK_VERSION
# Install lintrunner if needed
COPY ./common/install_android.sh install_android.sh
RUN if [ -n "${ANDROID_NDK_VERSION}" ]; then bash ./install_android.sh; fi
RUN rm install_android.sh

ARG ARM_SDK
COPY --chown=ci-user:ci-user ./arm /opt/arm
# Set up ARM SDK if needed
Expand Down
6 changes: 3 additions & 3 deletions .ci/scripts/setup-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ install_buck() {
brew install zstd
fi

if ! command -v wget &> /dev/null; then
brew install wget
if ! command -v curl &> /dev/null; then
brew install curl
fi

pushd .ci/docker
Expand All @@ -37,7 +37,7 @@ install_buck() {
# --version doesn't say anything w.r.t its release version, i.e. 2024-02-15.
# See D53878006 for more details.
BUCK2=buck2-aarch64-apple-darwin.zst
wget -q "https://ossci-macos.s3.amazonaws.com/${BUCK2}"
curl -s "https://ossci-macos.s3.amazonaws.com/${BUCK2}" -o "${BUCK2}"

zstd -d "${BUCK2}" -o buck2

Expand Down
2 changes: 2 additions & 0 deletions .ci/scripts/test_llama.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ cmake_install_executorch_libraries() {
-DCMAKE_BUILD_TYPE=Release \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_OPTIMIZED=ON \
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
-Bcmake-out .
cmake --build cmake-out -j9 --target install --config Release
Expand All @@ -58,6 +59,7 @@ cmake_build_llama_runner() {
retry cmake -DBUCK2="$BUCK" \
-DCMAKE_INSTALL_PREFIX=cmake-out \
-DCMAKE_BUILD_TYPE=Release \
-DEXECUTORCH_BUILD_OPTIMIZED=ON \
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
-Bcmake-out/${dir} \
${dir}
Expand Down
33 changes: 33 additions & 0 deletions .ci/scripts/test_quantized_aot_lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set -exu

# shellcheck source=/dev/null
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"

which "${PYTHON_EXECUTABLE}"
# Just set this variable here, it's cheap even if we use buck2
CMAKE_OUTPUT_DIR=cmake-out

build_cmake_quantized_aot_lib() {
echo "Building quantized aot lib"
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
(rm -rf ${CMAKE_OUTPUT_DIR} \
&& mkdir ${CMAKE_OUTPUT_DIR} \
&& cd ${CMAKE_OUTPUT_DIR} \
&& retry cmake -DBUCK2=buck2 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DEXECUTORCH_BUILD_QUANTIZED=ON \
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)

cmake --build ${CMAKE_OUTPUT_DIR} -j4
}

build_cmake_quantized_aot_lib
2 changes: 1 addition & 1 deletion .cmakelintrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
filter=+whitespace/extra,-whitespace/indent
filter=-convention/filename,-linelength,-package/consistency,-readability/logic,+readability/mixedcase,-readability/wonkycase,-syntax,-whitespace/eol,+whitespace/extra,-whitespace/indent,-whitespace/mismatch,-whitespace/newline,-whitespace/tabs
47 changes: 47 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build ExecuTorch Android demo apps

on:
push:
branches:
- main
- release/*
pull_request:
paths:
- .ci/docker/**
- .github/workflows/android.yml
- install_requirements.sh
- examples/demo-apps/**
- extension/module/**
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
cancel-in-progress: true

jobs:
test-demo-android:
name: test-demo-android
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
include:
- build-tool: buck2
with:
# NB: The example model dl3 requires lots of memory (T161064121)
runner: linux.12xlarge
docker-image: executorch-ubuntu-22.04-clang12-android
submodules: 'true'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 90
script: |
set -eux
# The generic Linux job chooses to use base env, not the one setup by the image
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
BUILD_TOOL=${{ matrix.build-tool }}
# Setup MacOS dependencies as there is no Docker support on MacOS atm
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
# Build Android demo app
bash build/test_android_ci.sh
21 changes: 15 additions & 6 deletions .github/workflows/apple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ jobs:
pushd "${WORKSPACE}/pytorch/executorch"
BUILD_TOOL=cmake
VERSION="0.1.0"
OUTPUT="executorch-${VERSION}"
FRAMEWORKS=(
"executorch"
"coreml_backend"
"mps_backend"
"optimized_backend"
"portable_backend"
"quantized_backend"
"xnnpack_backend"
)
.ci/scripts/setup-conda.sh
Expand All @@ -83,11 +91,12 @@ jobs:
# Build iOS Frameworks
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
build/build_apple_frameworks.sh --output="${OUTPUT}" --coreml --mps --portable --xnnpack
build/build_apple_frameworks.sh --coreml --mps --optimized --portable --quantized --xnnpack
# Bundle iOS Frameworks
cp LICENSE "${OUTPUT}"
zip -r "${RUNNER_TEMP}/artifacts/${OUTPUT}.zip" "${OUTPUT}"
for FRAMEWORK in "${FRAMEWORKS[@]}"; do (
cd cmake-out && zip -r "${RUNNER_TEMP}/artifacts/${FRAMEWORK}-${VERSION}.zip" "${FRAMEWORK}.xcframework"
) done
popd
Expand Down Expand Up @@ -115,8 +124,8 @@ jobs:
# NB: The name here needs to match the upload-artifact name from build-frameworks-ios job
name: executorch-frameworks-ios
path: ${{ runner.temp }}/frameworks-ios/
- name: Only push to S3 from main branch
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- name: Only push to S3 when running the workflow manually from main branch
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
shell: bash
run: |
set -eux
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/cherry-pick.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Create a cherry pick from a PR

on:
repository_dispatch:
types: [try-cherry-pick]

jobs:
cherry-pick:
name: cherry-pick-pr-${{ github.event.client_payload.pr_num }}
runs-on: ubuntu-latest
environment: cherry-pick-bot
env:
GH_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- name: Checkout repo
id: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
token: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }}

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: pip

# Not the direct dependencies but the script uses trymerge
- run: pip install pyyaml==6.0 rockset==1.0.3

- name: Setup committer id
run: |
git config --global user.name "PyTorch Bot"
git config --global user.email "pytorchbot@users.noreply.github.com"
- name: Cherry pick the PR
shell: bash
env:
PR_NUM: ${{ github.event.client_payload.pr_num }}
BRANCH: ${{ github.event.client_payload.branch }}
CLASSIFICATION: ${{ github.event.client_payload.classification }}
FIXES: ${{ github.event.client_payload.fixes || '' }}
ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }}
run: |
set -ex
python ./third-party/pytorch/.github/scripts/cherry_pick.py \
--onto-branch "${BRANCH}" \
--classification "${CLASSIFICATION}" \
--fixes "${FIXES}" \
--github-actor "${ACTOR}" \
"${PR_NUM}"
concurrency:
group: cherry-pick-pr-${{ github.event.client_payload.pr_num }}
cancel-in-progress: true
1 change: 1 addition & 0 deletions .github/workflows/docker-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- docker-image-name: executorch-ubuntu-22.04-clang12
- docker-image-name: executorch-ubuntu-22.04-linter
- docker-image-name: executorch-ubuntu-22.04-arm-sdk
- docker-image-name: executorch-ubuntu-22.04-clang12-android
env:
DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/executorch/${{ matrix.docker-image-name }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
dtype: [fp16, fp32]
dtype: [fp32]
build-tool: [buck2, cmake]
fail-fast: false
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ buck-out/
cmake-out/
cmake-android-out/
cmake-ios-out/
ethos-u-scratch/
executorch.egg-info
__pycache__/
build/lib/
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
url = https://github.com/Maratyszcza/FXdiv.git
[submodule "backends/xnnpack/third-party/XNNPACK"]
path = backends/xnnpack/third-party/XNNPACK
url = https://github.com/google/XNNPACK.git
url = https://github.com/digantdesai/XNNPACK.git
[submodule "backends/arm/third-party/serialization_lib"]
path = backends/arm/third-party/serialization_lib
url = https://review.mlplatform.org/tosa/serialization_lib
Expand Down
Empty file.
Empty file added .swift/executorch/dummy.swift
Empty file.
Empty file added .swift/mps_backend/dummy.swift
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Loading

0 comments on commit ba976e5

Please sign in to comment.