Skip to content

Commit 24ee8a9

Browse files
authored
Merge branch 'main' into et_dump
2 parents 899820d + 479791d commit 24ee8a9

1,088 files changed

Lines changed: 41675 additions & 12896 deletions

File tree

Some content is hidden

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

.ci/docker/build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ MINICONDA_VERSION=23.10.0-1
2323
BUCK2_VERSION=$(cat ci_commit_pins/buck2.txt)
2424

2525
case "${IMAGE_NAME}" in
26-
executorch-ubuntu-22.04-gcc9)
26+
executorch-ubuntu-22.04-gcc11)
27+
LINTRUNNER=""
28+
GCC_VERSION=11
29+
;;
30+
executorch-ubuntu-22.04-gcc9-nopytorch)
2731
LINTRUNNER=""
2832
GCC_VERSION=9
33+
SKIP_PYTORCH=yes
2934
;;
3035
executorch-ubuntu-22.04-clang12)
3136
LINTRUNNER=""
@@ -95,6 +100,7 @@ docker build \
95100
--build-arg "QNN_SDK=${QNN_SDK:-}" \
96101
--build-arg "MEDIATEK_SDK=${MEDIATEK_SDK:-}" \
97102
--build-arg "ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-}" \
103+
--build-arg "SKIP_PYTORCH=${SKIP_PYTORCH:-}" \
98104
-f "${OS}"/Dockerfile \
99105
"$@" \
100106
.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d03e90c2cd9048e6d9a75285c0355f033cd016fc
1+
de4f3c4978b4d36cc0bb8f87c6877a4a040d7ae7
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b31bad1b8f1331bf43d47f46602cf6141db56844
1+
7a064ed3eafa43f17412d434b395240c727b3000

.ci/docker/common/install_pytorch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

1313
install_domains() {
1414
echo "Install torchvision and torchaudio"
15-
pip_install --no-use-pep517 --user "git+https://github.com/pytorch/audio.git@${TORCHAUDIO_VERSION}"
16-
pip_install --no-use-pep517 --user "git+https://github.com/pytorch/vision.git@${TORCHVISION_VERSION}"
15+
pip_install --no-build-isolation --user "git+https://github.com/pytorch/audio.git@${TORCHAUDIO_VERSION}"
16+
pip_install --no-build-isolation --user "git+https://github.com/pytorch/vision.git@${TORCHVISION_VERSION}"
1717
}
1818

1919
install_pytorch_and_domains() {

.ci/docker/requirements-ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mpmath==1.3.0
22
numpy>=2.0.0; python_version >= '3.10'
33
PyYAML==6.0.1
44
ruamel.yaml==0.18.15
5-
sympy==1.12
5+
sympy>=1.13.3
66
timm==0.6.13
77
tomli==2.0.1
88
torchsr==1.0.4

.ci/docker/ubuntu/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ ENV SCCACHE_S3_KEY_PREFIX executorch
6464
ENV SCCACHE_REGION us-east-1
6565

6666
ARG TORCH_VERSION
67+
ARG SKIP_PYTORCH
6768
COPY ./common/install_pytorch.sh install_pytorch.sh
6869
COPY ./common/utils.sh utils.sh
69-
RUN bash ./install_pytorch.sh && rm install_pytorch.sh utils.sh
70+
RUN if [ -z "${SKIP_PYTORCH}" ]; then bash ./install_pytorch.sh; fi && rm install_pytorch.sh utils.sh
7071

7172
ARG LINTRUNNER
7273
# Install lintrunner if needed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ set_up_aot() {
4242
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
4343
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
4444
-DPYTHON_EXECUTABLE=python3
45-
cmake --build $PWD --target "PyQnnManagerAdaptor" "PyQnnWrapperAdaptor" -j$(nproc)
45+
cmake --build $PWD --target "PyQnnManagerAdaptor" -j$(nproc)
4646
# install Python APIs to correct import path
4747
# The filename might vary depending on your Python and host version.
4848
cp -f backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so $EXECUTORCH_ROOT/backends/qualcomm/python
49-
cp -f backends/qualcomm/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so $EXECUTORCH_ROOT/backends/qualcomm/python
5049
popd
5150

5251
# Workaround for fbs files in exir/_serialize

.ci/scripts/setup-samsung-linux-deps.sh

Lines changed: 175 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,61 +8,199 @@
88

99
set -ex
1010

11+
API_KEY=$SAMSUNG_AI_LITECORE_KEY
12+
if [[ -z "${API_KEY}" ]]; then
13+
echo "ERROR: It didn't set up SAMSUNG_AI_LITECORE_KEY." >&2
14+
exit 1
15+
fi
16+
17+
OS_NAME="Ubuntu 22.04"
18+
LITECORE_BASE="https://soc-developer.semiconductor.samsung.com/api/v1/resource/ai-litecore/download"
19+
DEVICEFARM_BASE="https://soc-developer.semiconductor.samsung.com/api/v1/resource/remotelab/download"
20+
21+
parse_url() {
22+
local json="$1"
23+
if command -v jq >/dev/null 2>&1; then
24+
jq -r '.data // empty' <<<"$json"
25+
else
26+
sed -n 's/.*"data":[[:space:]]*"\([^"]*\)".*/\1/p' <<<"$json"
27+
fi
28+
}
1129

12-
download_ai_lite_core() {
13-
API_BASE="https://soc-developer.semiconductor.samsung.com/api/v1/resource/ai-litecore/download"
14-
API_KEY=$SAMSUNG_AI_LITECORE_KEY
15-
16-
VERSION="0.7"
17-
OS_NAME="Ubuntu 22.04"
18-
OUT_FILE="/tmp/exynos-ai-litecore-v${VERSION}.tar.gz"
19-
TARGET_PATH="/tmp/exynos_ai_lite_core"
20-
21-
mkdir -p ${TARGET_PATH}
22-
# Presigned issue URL
23-
JSON_RESP=$(curl -sS -G \
24-
--location --fail --retry 3 \
30+
download_and_extract() {
31+
local base_url="$1"
32+
local version="$2"
33+
local out_dir="$3"
34+
local out_file="$4"
35+
36+
local resp
37+
resp=$(curl -fsSL -G \
2538
-H "apikey: ${API_KEY}" \
26-
--data-urlencode "version=${VERSION}" \
39+
--data-urlencode "version=${version}" \
2740
--data-urlencode "os=${OS_NAME}" \
28-
"${API_BASE}")
41+
"${base_url}")
42+
43+
local download_url
44+
download_url=$(parse_url "$resp")
45+
if [[ -z "${download_url}" ]]; then
46+
echo "ERROR: It failed to download from ${base_url} ."
47+
echo "Response: $resp" >&2
48+
exit 1
49+
fi
50+
51+
curl -fsSL -L --retry 3 -o "${out_file}" "${download_url}"
52+
echo "Download completed: ${out_file}"
2953

30-
DOWNLOAD_URL=$(echo "$JSON_RESP" | sed -n 's/.*"data":[[:space:]]*"\([^"]*\)".*/\1/p')
54+
mkdir -p "${out_dir}"
55+
case "${out_file##*.}" in
56+
tar|tgz|gz)
57+
echo "Extracting TAR.GZ..."
58+
tar -C "${out_dir}" --strip-components=1 -xzvf "${out_file}"
59+
;;
3160

32-
if [[ -z "$DOWNLOAD_URL" ]]; then
33-
echo "Failed to extract download URL"
34-
echo "$JSON_RESP"
61+
zip)
62+
echo "Extracting ZIP..."
63+
unzip -q -d "${out_dir}" "${out_file}"
64+
;;
65+
66+
*)
3567
exit 1
68+
;;
69+
esac
70+
echo "Extracted to: ${out_dir}"
71+
}
72+
73+
download_ai_lite_core() {
74+
local litecore_version="${1:-1.0}"
75+
local litecore_out="/tmp/exynos-ai-litecore-v${litecore_version}.tar.gz"
76+
local litecore_dir="/tmp/exynos_ai_lite_core"
77+
78+
download_and_extract \
79+
"${LITECORE_BASE}" \
80+
"${litecore_version}" \
81+
"${litecore_dir}" \
82+
"${litecore_out}"
83+
84+
export EXYNOS_AI_LITECORE_ROOT="${litecore_dir}"
85+
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux"
86+
}
87+
88+
install_devicefarm_cli() {
89+
local cli_version="${1:-beta-1.0.8}"
90+
local cli_out="/tmp/devicefarm-cli-v${cli_version}.zip"
91+
local cli_dir="/tmp/devicefarm_cli"
92+
93+
download_and_extract \
94+
"${DEVICEFARM_BASE}" \
95+
"${cli_version}" \
96+
"${cli_dir}" \
97+
"${cli_out}"
98+
99+
export PATH="${PATH%:}:${cli_dir}"
100+
chmod +x "${cli_dir}/devicefarm-cli"
101+
}
102+
103+
reserve_if_needed() {
104+
if ! command -v devicefarm-cli >/dev/null 2>&1; then
105+
echo "[WARN] devicefarm-cli is not installed." >&2
106+
return 1
36107
fi
37108

38-
# Download LiteCore
39-
curl -sS -L --fail --retry 3 \
40-
--output "$OUT_FILE" \
41-
"$DOWNLOAD_URL"
109+
local raw_info info_lines
110+
raw_info="$(devicefarm-cli -I)"
111+
112+
info_lines="$(printf '%s\n' "$raw_info" | grep -v '^\\[INFO\\]')"
42113

43-
echo "Download done: $OUT_FILE"
114+
local found_count
44115

116+
found_count=$(printf '%s\n' "$info_lines" \
117+
| grep -Eo 'Found available reservations *: *[0-9]+' \
118+
| grep -Eo '[0-9]+')
119+
[[ -z "$found_count" ]] && found_count=0
45120

46-
tar -C "${TARGET_PATH}" --strip-components=1 -xzvf "${OUT_FILE}"
121+
echo "[INFO] Current Reserved Count: $found_count"
122+
123+
local THRESHOLD_SECONDS=12600
124+
local any_below_threshold=0
125+
126+
if (( found_count > 0 )); then
127+
local table_body
128+
table_body=$(printf '%s\n' "$info_lines" | sed -n '2,$p')
129+
130+
while IFS= read -r line; do
131+
if [[ "$line" =~ ^[0-9]+[[:space:]]+([0-9]{1,2}:[0-9]{2}:[0-9]{2}) ]]; then
132+
local time_str="${BASH_REMATCH[1]}"
133+
IFS=: read -r hh mm ss <<<"$time_str"
134+
(( seconds = 10#$hh * 3600 + 10#$mm * 60 + 10#$ss ))
135+
if (( seconds <= THRESHOLD_SECONDS )); then
136+
any_below_threshold=1
137+
break
138+
fi
139+
fi
140+
done <<<"$table_body"
141+
else
142+
any_below_threshold=1
143+
fi
47144

48-
export EXYNOS_AI_LITECORE_ROOT=${TARGET_PATH}
49-
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux
145+
if (( any_below_threshold )); then
146+
echo "[INFO] Reserving now."
147+
devicefarm-cli -R
148+
else
149+
echo "[INFO] Don't need to be reserved."
150+
fi
151+
152+
local info_after reservation_id max_seconds=0 max_id
153+
154+
info_after="$(devicefarm-cli -I)"
155+
156+
local body_after
157+
body_after=$(printf '%s\n' "$info_after" | grep -v '^\\[INFO\\]' | sed -n '2,$p')
158+
159+
while IFS= read -r line; do
160+
if [[ "$line" =~ ^[0-9]+[[:space:]]+([0-9]{1,2}:[0-9]{2}:[0-9]{2})[[:space:]].*([0-9a-f-]{36})$ ]]; then
161+
local time_str="${BASH_REMATCH[1]}"
162+
local id="${BASH_REMATCH[2]}"
163+
IFS=: read -r hh mm ss <<<"$time_str"
164+
(( seconds = 10#$hh * 3600 + 10#$mm * 60 + 10#$ss ))
165+
if (( seconds > max_seconds )); then
166+
max_seconds=$seconds
167+
max_id=$id
168+
fi
169+
fi
170+
done <<<"$body_after"
171+
172+
reservation_id=$max_id
173+
174+
if [[ -n "$reservation_id" ]]; then
175+
devicefarm-cli -C "$reservation_id"
176+
devicefarm-cli -E "ls /"
177+
else
178+
echo "[WARN] There is no available devices."
179+
fi
50180
}
51181

52182
install_enn_backend() {
53-
NDK_INSTALLATION_DIR=/opt/ndk
54-
rm -rf "${NDK_INSTALLATION_DIR}" && sudo mkdir -p "${NDK_INSTALLATION_DIR}"
55-
ANDROID_NDK_VERSION=r28c
183+
local ndk_dir="/opt/ndk"
184+
local ndk_version="r28c"
185+
186+
if [[ ! -d "${ndk_dir}" ]]; then
187+
sudo mkdir -p "${ndk_dir}"
188+
sudo chown "$(whoami)":"$(whoami)" "${ndk_dir}"
189+
fi
190+
191+
export ANDROID_NDK_ROOT="${ndk_dir}"
192+
echo "NDK will be installed/used at: ${ANDROID_NDK_ROOT}"
56193

57-
# build Exynos backend
58-
export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT:-/opt/ndk}
59194
bash backends/samsung/build.sh --build all
60-
# set env variable
61-
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
62-
export PYTHONPATH=${PYTHONPATH:-}:${EXECUTORCH_ROOT}/..
195+
196+
export EXECUTORCH_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
197+
export PYTHONPATH="${PYTHONPATH:-}:${EXECUTORCH_ROOT}/.."
63198
}
64199

65-
AI_LITE_CORE_VERSION=0.7.0
200+
litecore_ver="1.0"
201+
devicefarm_ver="beta-1.0.8"
66202

67-
download_ai_lite_core ${AI_LITE_CORE_VERSION}
203+
download_ai_lite_core ${litecore_ver}
204+
install_devicefarm_cli "${devicefarm_ver}"
68205
install_enn_backend
206+
reserve_if_needed

.ci/scripts/test_ane_static_llama.sh

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

31+
# Test static ANE llama model
32+
python export_static_llm_coreml.py --checkpoint stories110M.pt --params params.json --output model.pte
33+
34+
# The ANE cannot run in github CI
35+
# python run_static_llm.py --model model.pte --params params.json --tokenizer tokenizer.model --prompt "Once upon a time," --lookahead
36+
37+
# Test export of deprecated model
3138
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
3239

3340
popd

.ci/scripts/test_backend.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if [[ "$FLOW" == *arm* ]]; then
6464
else
6565
.ci/scripts/setup-arm-baremetal-tools.sh
6666
fi
67-
source examples/arm/ethos-u-scratch/setup_path.sh
67+
source examples/arm/arm-scratch/setup_path.sh
6868

6969
if [[ "$FLOW" == *ethos_u* ]]; then
7070
# Prepare a test runner binary that can run on the Corstone-3x0 FVPs

0 commit comments

Comments
 (0)