Skip to content

Commit

Permalink
Merge branch 'main' into main_backup
Browse files Browse the repository at this point in the history
  • Loading branch information
dijopaul authored Sep 19, 2024
2 parents fe4290f + 8ef6c79 commit f160ded
Show file tree
Hide file tree
Showing 2,107 changed files with 552,318 additions and 27,661 deletions.
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 @@
b556d31586845fb1e296a975d2b85d9d325205c9
aec9b2ab77389967ef39bb9c10662fd0fe3e185a
1 change: 1 addition & 0 deletions .ci/docker/ci_commit_pins/torchao.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0916b5b29b092afcbf2b898caae49abe80662bac
4 changes: 4 additions & 0 deletions .ci/docker/common/install_linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
# NB: Install all linter dependencies, the caching of lintrunner init could be
# done after Executorch becomes public
pip_install -r requirements-lintrunner.txt

# Install google-java-format
curl -L --retry 3 https://github.com/google/google-java-format/releases/download/v1.23.0/google-java-format_linux-x86-64 > /opt/google-java-format
chmod +x /opt/google-java-format
49 changes: 49 additions & 0 deletions .ci/scripts/build-qnn-sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/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 -eux
set -o xtrace

build_qnn_backend() {
echo "Start building qnn backend."
export ANDROID_NDK_ROOT=/opt/ndk
export QNN_SDK_ROOT=/tmp/qnn/2.25.0.240728
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"

bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release
}

set_up_aot() {
cd $EXECUTORCH_ROOT
if [ ! -d "cmake-out" ]; then
mkdir cmake-out
fi
pushd cmake-out
cmake .. \
-DCMAKE_INSTALL_PREFIX=$PWD \
-DEXECUTORCH_BUILD_QNN=ON \
-DQNN_SDK_ROOT=${QNN_SDK_ROOT} \
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
-DPYTHON_EXECUTABLE=python3 \
-DEXECUTORCH_SEPARATE_FLATCC_HOST_PROJECT=OFF
cmake --build $PWD --target "PyQnnManagerAdaptor" "PyQnnWrapperAdaptor" -j$(nproc)
# install Python APIs to correct import path
# The filename might vary depending on your Python and host version.
cp -f backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so $EXECUTORCH_ROOT/backends/qualcomm/python
cp -f backends/qualcomm/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so $EXECUTORCH_ROOT/backends/qualcomm/python
popd

# Workaround for fbs files in exir/_serialize
cp schema/program.fbs exir/_serialize/program.fbs
cp schema/scalar_type.fbs exir/_serialize/scalar_type.fbs
}

build_qnn_backend
set_up_aot
3 changes: 2 additions & 1 deletion .ci/scripts/build_llama_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ install_executorch_and_backend_lib() {
-DANDROID_PLATFORM=android-23 \
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
-DCMAKE_BUILD_TYPE=Release \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
-DEXECUTORCH_BUILD_XNNPACK=ON \
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
Expand Down
9 changes: 8 additions & 1 deletion .ci/scripts/gather_test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# This one causes timeout on smaller runner, the root cause is unclear (T161064121)
"dl3": "linux.12xlarge",
"emformer_join": "linux.12xlarge",
"emformer_predict": "linux.12xlarge",
}
}

Expand All @@ -35,9 +36,11 @@
# Just some examples on how custom timeout can be set
"linux": {
"mobilebert": 90,
"emformer_predict": 360,
},
"macos": {
"mobilebert": 90,
"emformer_predict": 360,
},
}

Expand Down Expand Up @@ -84,7 +87,11 @@ def model_should_run_on_event(model: str, event: str) -> bool:
"""
if event == "pull_request":
return model in ["mv3", "vit"]
return True
elif event == "push":
# 'emformer_predict' is running super slow. Only run it periodically
return model not in ["emformer_predict"]
else:
return True


def model_should_run_on_target_os(model: str, target_os: str) -> bool:
Expand Down
33 changes: 33 additions & 0 deletions .ci/scripts/setup-ios.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

# This script follows the instructions from GitHub to install an Apple certificate
# https://docs.github.com/en/actions/use-cases-and-examples/deploying/installing-an-apple-certificate-on-macos-runners-for-xcode-development

CERTIFICATE_PATH="${RUNNER_TEMP}"/build_certificate.p12
PP_PATH="${RUNNER_TEMP}"/build_pp.mobileprovision
KEYCHAIN_PATH="${RUNNER_TEMP}"/app-signing.keychain-db

# Import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH

# Create a temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

# Import certificate to the keychain
security import $CERTIFICATE_PATH -P "" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH

# Apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
1 change: 0 additions & 1 deletion .ci/scripts/setup-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ fi

# As Linux job is running inside a Docker container, all of its dependencies
# have already been installed
install_flatc_from_source
install_executorch
build_executorch_runner "${BUILD_TOOL}"
2 changes: 0 additions & 2 deletions .ci/scripts/setup-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,5 @@ if [[ -z "${GITHUB_RUNNER:-}" ]]; then
fi

print_cmake_info
install_pytorch_and_domains
install_flatc_from_source
install_executorch
build_executorch_runner "${BUILD_TOOL}"
51 changes: 51 additions & 0 deletions .ci/scripts/setup-qnn-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/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

verify_pkg_installed() {
echo $(dpkg-query -W --showformat='${Status}\n' $1|grep "install ok installed")
}

install_qnn() {
echo "Start installing qnn."
QNN_INSTALLATION_DIR=/tmp/qnn
mkdir -p "${QNN_INSTALLATION_DIR}"

curl -Lo /tmp/v2.25.0.24.07.28.zip "https://softwarecenter.qualcomm.com/api/download/software/qualcomm_neural_processing_sdk/v2.25.0.240728.zip"
echo "Finishing downloading qnn sdk."
unzip -qo /tmp/v2.25.0.24.07.28.zip -d /tmp
echo "Finishing unzip qnn sdk."


# Print the content for manual verification
ls -lah "/tmp/qairt"
mv "/tmp/qairt"/* "${QNN_INSTALLATION_DIR}"
echo "Finishing installing qnn '${QNN_INSTALLATION_DIR}' ."

ls -lah "${QNN_INSTALLATION_DIR}"
}

setup_libc++() {
sudo apt-get update
pkgs_to_check=('libc++-dev')
j=0
while [ $j -lt ${#pkgs_to_check[*]} ]; do
install_status=$(verify_pkg_installed ${pkgs_to_check[$j]})
if [ "$install_status" == "" ]; then
sudo apt-get install -y ${pkgs_to_check[$j]}
if [[ $? -ne 0 ]]; then
echo "ERROR: Failed to install required packages for libc++"
exit 1
fi
fi
j=$(( $j +1));
done
}

setup_libc++
install_qnn
157 changes: 0 additions & 157 deletions .ci/scripts/test.sh

This file was deleted.

Loading

0 comments on commit f160ded

Please sign in to comment.