Skip to content

Commit 1a08008

Browse files
authored
Merge branch 'main' into integrating-vision-kernels
2 parents 00d6867 + 45846c8 commit 1a08008

File tree

321 files changed

+9979
-2853
lines changed

Some content is hidden

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

321 files changed

+9979
-2853
lines changed

.ci/docker/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ case "${IMAGE_NAME}" in
4343
ARM_SDK=yes
4444
CLANG_VERSION=12
4545
;;
46+
executorch-ubuntu-22.04-zephyr-sdk)
47+
ZEPHYR_SDK=yes
48+
GCC_VERSION=11
49+
;;
4650
executorch-ubuntu-22.04-qnn-sdk)
4751
QNN_SDK=yes
4852
CLANG_VERSION=12
@@ -87,6 +91,7 @@ docker build \
8791
--build-arg "LINTRUNNER=${LINTRUNNER:-}" \
8892
--build-arg "BUILD_DOCS=${BUILD_DOCS}" \
8993
--build-arg "ARM_SDK=${ARM_SDK:-}" \
94+
--build-arg "ZEPHYR_SDK=${ZEPHYR_SDK:-}" \
9095
--build-arg "QNN_SDK=${QNN_SDK:-}" \
9196
--build-arg "MEDIATEK_SDK=${MEDIATEK_SDK:-}" \
9297
--build-arg "ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-}" \
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ab43fe4bdf5ccd82897f0e982c451a0127bd175e
1+
6fc0ad22f0a07b6f38d138861c56a765d5a9bb02
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
#!/bin/bash
3+
# Copyright (c) Meta Platforms, Inc. and affiliates.
4+
# All rights reserved.
5+
#
6+
# This source code is licensed under the BSD-style license found in the
7+
# LICENSE file in the root directory of this source tree.
8+
9+
set -ex
10+
11+
# Double check if the NDK version is set
12+
[ -n "${ZEPHYR_SDK}" ]
13+
14+
install_prerequiresites() {
15+
rm /var/lib/dpkg/info/libc-bin.*
16+
apt-get clean
17+
apt-get -y update
18+
apt-get install -y libc-bin
19+
apt-get -y update
20+
apt-get clean
21+
apt-get install --no-install-recommends -y dos2unix
22+
apt-get install --no-install-recommends -y ca-certificates
23+
apt-get install -y --reinstall libc-bin
24+
apt-get install --no-install-recommends -y file
25+
apt-get install --no-install-recommends -y locales
26+
apt-get install --no-install-recommends -y git
27+
apt-get install --no-install-recommends -y build-essential
28+
apt-get install --no-install-recommends -y cmake
29+
apt-get install --no-install-recommends -y ninja-build gperf
30+
apt-get install --no-install-recommends -y device-tree-compiler
31+
apt-get install --no-install-recommends -y wget
32+
apt-get install --no-install-recommends -y curl
33+
apt-get install --no-install-recommends -y xz-utils
34+
apt-get install --no-install-recommends -y dos2unix
35+
apt-get install --no-install-recommends -y vim
36+
apt-get install --no-install-recommends -y nano
37+
apt-get install --no-install-recommends -y mc
38+
apt-get install --no-install-recommends -y openssh-server
39+
apt-get install -y gdb
40+
41+
# Zephyr SDK relies on python 3.12
42+
apt install software-properties-common -y
43+
add-apt-repository ppa:deadsnakes/ppa -y
44+
apt update
45+
apt install -y python3.12 python3.12-dev python3.12-venv python3-pip
46+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
47+
48+
# Upgrade cmake ot 3.24
49+
apt update
50+
apt install cmake
51+
apt install software-properties-common lsb-release
52+
apt update
53+
test -f /usr/share/doc/kitware-archive-keyring/copyright || \
54+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
55+
"deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/kitware.list > /dev/null
56+
apt update
57+
apt install cmake
58+
59+
# Install additional required software for Zephyr
60+
apt install --no-install-recommends -y ccache \
61+
dfu-util \
62+
python3-setuptools \
63+
python3-tk \
64+
python3-wheel \
65+
make \
66+
gcc \
67+
libsdl2-dev \
68+
libmagic1 \
69+
xterm \
70+
telnet \
71+
net-tools
72+
apt install --no-install-recommends -y gcc-multilib g++-multilib
73+
apt-get clean -y
74+
apt-get autoremove --purge -y
75+
rm -rf /var/lib/apt/lists/*
76+
wget https://apt.kitware.com/kitware-archive.sh && \
77+
chmod +x kitware-archive.sh && \
78+
./kitware-archive.sh && \
79+
rm -f kitware-archive.sh
80+
useradd -d /home/zephyruser -m -s /bin/bash zephyruser
81+
}
82+
83+
install_sdk() {
84+
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.0/zephyr-sdk-0.16.0_linux-x86_64.tar.xz && \
85+
tar -xf zephyr-sdk-0.16.0_linux-x86_64.tar.xz && \
86+
rm -f zephyr-sdk-0.16.0_linux-x86_64.tar.xz && \
87+
cd zephyr-sdk-0.16.0/ && \
88+
./setup.sh -c -t arm-zephyr-eabi
89+
}
90+
91+
install_prerequiresites
92+
install_sdk

.ci/docker/ubuntu/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ RUN rm install_android.sh
8484

8585
ARG ARM_SDK
8686

87+
ARG ZEPHYR_SDK
88+
COPY ./common/install_zephyr.sh install_zephyr.sh
89+
RUN if [ -n "${ZEPHYR_SDK}" ]; then bash ./install_zephyr.sh; fi
90+
RUN rm install_zephyr.sh
91+
8792
ARG QNN_SDK
8893

8994
ARG MEDIATEK_SDK

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ set_up_aot() {
3333
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
3434
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
3535
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
36+
-DEXECUTORCH_BUILD_EXTENSION_EXTENSION_LLM=ON \
37+
-DEXECUTORCH_BUILD_EXTENSION_EXTENSION_LLM_RUNNER=ON \
3638
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
3739
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
3840
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \

.ci/scripts/build_llama_android.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ install_executorch_and_backend_lib() {
1919
echo "Installing executorch and xnnpack backend"
2020
clean_executorch_install_folders
2121
mkdir cmake-android-out
22-
ANDROID_NDK=/opt/ndk
22+
ANDROID_NDK=${ANDROID_NDK:-/opt/ndk}
2323
BUCK2=buck2
2424
ANDROID_ABI=arm64-v8a
2525
cmake --preset llm \

.ci/scripts/setup-qnn-deps.sh

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,7 @@
77

88
set -ex
99

10-
verify_pkg_installed() {
11-
echo $(dpkg-query -W --showformat='${Status}\n' $1|grep "install ok installed")
12-
}
10+
source "$(dirname "${BASH_SOURCE[0]}")/../../backends/qualcomm/scripts/install_qnn_sdk.sh"
1311

14-
install_qnn() {
15-
echo "Start installing qnn."
16-
QNN_INSTALLATION_DIR=/tmp/qnn
17-
mkdir -p "${QNN_INSTALLATION_DIR}"
18-
19-
curl -Lo /tmp/v2.28.0.24.10.29.zip "https://softwarecenter.qualcomm.com/api/download/software/qualcomm_neural_processing_sdk/v2.28.0.241029.zip"
20-
echo "Finishing downloading qnn sdk."
21-
unzip -qo /tmp/v2.28.0.24.10.29.zip -d /tmp
22-
echo "Finishing unzip qnn sdk."
23-
24-
25-
# Print the content for manual verification
26-
ls -lah "/tmp/qairt"
27-
mv "/tmp/qairt"/* "${QNN_INSTALLATION_DIR}"
28-
echo "Finishing installing qnn '${QNN_INSTALLATION_DIR}' ."
29-
30-
ls -lah "${QNN_INSTALLATION_DIR}"
31-
}
32-
33-
setup_libc++() {
34-
clang_version=$1
35-
sudo apt-get update
36-
pkgs_to_check=("libc++-${clang_version}-dev")
37-
j=0
38-
while [ $j -lt ${#pkgs_to_check[*]} ]; do
39-
install_status=$(verify_pkg_installed ${pkgs_to_check[$j]})
40-
if [ "$install_status" == "" ]; then
41-
sudo apt-get install -y ${pkgs_to_check[$j]}
42-
if [[ $? -ne 0 ]]; then
43-
echo "ERROR: Failed to install required packages for libc++"
44-
exit 1
45-
fi
46-
fi
47-
j=$(( $j +1));
48-
done
49-
}
50-
51-
# This needs to match with the clang version from the Docker image
52-
setup_libc++ 12
12+
setup_libcpp 12
5313
install_qnn

.ci/scripts/test_ane_static_llama.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ pushd $EXECUTORCH_ROOT/examples/apple/coreml/llama
2828
# Download stories llama110m artifacts
2929
download_stories_model_artifacts
3030

31-
python export.py -n model.pte -p params.json -c stories110M.pt --seq_length 32 --max_seq_length 64 --dtype fp16 --coreml-quantize c4w
31+
python export.py -n model.pte -p params.json -c stories110M.pt --seq_length 32 --max_seq_length 64 --dtype fp16 --coreml-quantize c4w --embedding-quantize 4,32
3232

3333
popd

.ci/scripts/test_llama.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ cmake_install_executorch_libraries() {
150150
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
151151
rm -rf cmake-out
152152
retry cmake --preset llm \
153+
-DBUILD_TESTING=OFF \
153154
-DCMAKE_INSTALL_PREFIX=cmake-out \
154155
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
155156
-DEXECUTORCH_BUILD_QNN="$QNN" \

.ci/scripts/test_llama_torchao_lowbit.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ cmake -DPYTHON_EXECUTABLE=python \
2929
-DEXECUTORCH_ENABLE_LOGGING=1 \
3030
-DCMAKE_BUILD_TYPE=Release \
3131
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
32+
-DEXECUTORCH_BUILD_EXTENSION_LLM=ON \
33+
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON \
3234
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
3335
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
3436
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \

0 commit comments

Comments
 (0)