Skip to content

Commit 0a982ae

Browse files
authored
Merge branch 'main' into move_ethosu
2 parents bd55cf9 + f2f2a9d commit 0a982ae

File tree

383 files changed

+14197
-3377
lines changed

Some content is hidden

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

383 files changed

+14197
-3377
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a3942627f5ac048e06b4b1d703b0a6a53bf6da5b
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5616fa4a68718ead203314a3467f7dd9547153ae
1+
7cda4017ddda554752e89069ae205be5e8388f59

.ci/docker/common/install_conda.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1313
install_miniconda() {
1414
BASE_URL="https://repo.anaconda.com/miniconda"
1515
CONDA_FILE="Miniconda3-py${PYTHON_VERSION//./}_${MINICONDA_VERSION}-Linux-x86_64.sh"
16-
if [[ $(uname -m) == "aarch64" ]]; then
16+
if [[ $(uname -m) == "aarch64" ]]; then
1717
CONDA_FILE="Miniconda3-py${PYTHON_VERSION//./}_${MINICONDA_VERSION}-Linux-aarch64.sh"
1818
fi
1919

@@ -71,4 +71,8 @@ fix_conda_ubuntu_libstdcxx() {
7171
install_miniconda
7272
install_python
7373
install_pip_dependencies
74-
fix_conda_ubuntu_libstdcxx
74+
# Hack breaks the job on aarch64 but is still necessary everywhere
75+
# else.
76+
if [ "$(uname -m)" != "aarch64" ]; then
77+
fix_conda_ubuntu_libstdcxx
78+
fi

.ci/docker/conda-env-ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake=3.26.4
1+
cmake=3.31.2
22
ninja=1.10.2
33
libuv
44
llvm-openmp

.ci/scripts/check_c10_sync.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ pushd pytorch
1212
git checkout "$pytorch_pin"
1313
popd
1414
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/c10 pytorch/c10
15+
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/torch/headeronly pytorch/torch/headeronly

.ci/scripts/setup-arm-baremetal-tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# Setup arm example environment (including TOSA tools)
99
git config --global user.email "[email protected]"
1010
git config --global user.name "Github Executorch"
11-
bash examples/arm/setup.sh --i-agree-to-the-contained-eula
11+
bash examples/arm/setup.sh --i-agree-to-the-contained-eula ${@:-}

.ci/scripts/test_yolo12.sh

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
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+
# shellcheck source=/dev/null
10+
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
11+
12+
while [[ $# -gt 0 ]]; do
13+
case "$1" in
14+
-model)
15+
MODEL_NAME="$2" # stories110M
16+
shift 2
17+
;;
18+
-mode)
19+
MODE="$2" # portable or xnnpack+custom or xnnpack+custom+qe
20+
shift 2
21+
;;
22+
-pt2e_quantize)
23+
PT2E_QUANTIZE="$2"
24+
shift 2
25+
;;
26+
-upload)
27+
UPLOAD_DIR="$2"
28+
shift 2
29+
;;
30+
-video_path)
31+
VIDEO_PATH="$2" # portable or xnnpack+custom or xnnpack+custom+qe
32+
shift 2
33+
;;
34+
*)
35+
echo "Unknown option: $1"
36+
usage
37+
;;
38+
esac
39+
done
40+
41+
# Default mode to xnnpack+custom if not set
42+
MODE=${MODE:-"openvino"}
43+
44+
# Default UPLOAD_DIR to empty string if not set
45+
UPLOAD_DIR="${UPLOAD_DIR:-}"
46+
47+
# Default PT2E_QUANTIZE to empty string if not set
48+
PT2E_QUANTIZE="${PT2E_QUANTIZE:-}"
49+
50+
# Default CMake Build Type to release mode
51+
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
52+
53+
if [[ $# -lt 5 ]]; then # Assuming 4 mandatory args
54+
echo "Expecting atleast 5 positional arguments"
55+
echo "Usage: [...]"
56+
fi
57+
if [[ -z "${MODEL_NAME:-}" ]]; then
58+
echo "Missing model name, exiting..."
59+
exit 1
60+
fi
61+
62+
63+
if [[ -z "${MODE:-}" ]]; then
64+
echo "Missing mode, choose openvino or xnnpack, exiting..."
65+
exit 1
66+
fi
67+
68+
if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
69+
PYTHON_EXECUTABLE=python3
70+
fi
71+
72+
TARGET_LIBS=""
73+
74+
if [[ "${MODE}" =~ .*openvino.* ]]; then
75+
OPENVINO=ON
76+
TARGET_LIBS="$TARGET_LIBS openvino_backend "
77+
78+
git clone https://github.com/openvinotoolkit/openvino.git
79+
cd openvino && git b16b776ac119dafda51f69a80f1e6b7376d02c3b
80+
git submodule update --init --recursive
81+
sudo ./install_build_dependencies.sh
82+
mkdir build && cd build
83+
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON
84+
make -j$(nproc)
85+
86+
cd ..
87+
cmake --install build --prefix dist
88+
89+
source dist/setupvars.sh
90+
cd ../backends/openvino
91+
pip install -r requirements.txt
92+
cd ../../
93+
else
94+
OPENVINO=OFF
95+
fi
96+
97+
if [[ "${MODE}" =~ .*xnnpack.* ]]; then
98+
XNNPACK=ON
99+
TARGET_LIBS="$TARGET_LIBS xnnpack_backend "
100+
else
101+
XNNPACK=OFF
102+
fi
103+
104+
which "${PYTHON_EXECUTABLE}"
105+
106+
107+
DIR="examples/models/yolo12"
108+
$PYTHON_EXECUTABLE -m pip install -r ${DIR}/requirements.txt
109+
110+
cmake_install_executorch_libraries() {
111+
rm -rf cmake-out
112+
build_dir=cmake-out
113+
mkdir $build_dir
114+
115+
116+
retry cmake -DCMAKE_INSTALL_PREFIX="${build_dir}" \
117+
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
118+
-DEXECUTORCH_BUILD_OPENVINO="$OPENVINO" \
119+
-DEXECUTORCH_BUILD_XNNPACK="$XNNPACK" \
120+
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
121+
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
122+
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
123+
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
124+
-B"${build_dir}"
125+
126+
# Build the project
127+
cmake --build ${build_dir} --target install --config ${CMAKE_BUILD_TYPE} -j$(nproc)
128+
129+
export CMAKE_ARGS="
130+
-DEXECUTORCH_BUILD_OPENVINO="$OPENVINO" \
131+
-DEXECUTORCH_BUILD_XNNPACK="$XNNPACK" \
132+
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
133+
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
134+
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
135+
-DEXECUTORCH_ENABLE_LOGGING=ON \
136+
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
137+
-DEXECUTORCH_BUILD_PYBIND=ON"
138+
139+
echo $TARGET_LIBS
140+
export CMAKE_BUILD_ARGS="--target $TARGET_LIBS"
141+
pip install . --no-build-isolation
142+
}
143+
144+
cmake_build_demo() {
145+
echo "Building yolo12 runner"
146+
retry cmake \
147+
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
148+
-DUSE_OPENVINO_BACKEND="$OPENVINO" \
149+
-DUSE_XNNPACK_BACKEND="$XNNPACK" \
150+
-Bcmake-out/${DIR} \
151+
${DIR}
152+
cmake --build cmake-out/${DIR} -j9 --config "$CMAKE_BUILD_TYPE"
153+
154+
}
155+
156+
cleanup_files() {
157+
rm $EXPORTED_MODEL_NAME
158+
}
159+
160+
prepare_artifacts_upload() {
161+
if [ -n "${UPLOAD_DIR}" ]; then
162+
echo "Preparing for uploading generated artifacs"
163+
zip -j model.zip "${EXPORTED_MODEL_NAME}"
164+
mkdir -p "${UPLOAD_DIR}"
165+
mv model.zip "${UPLOAD_DIR}"
166+
mv result.txt "${UPLOAD_DIR}"
167+
168+
fi
169+
}
170+
171+
172+
# Export model.
173+
EXPORTED_MODEL_NAME="${MODEL_NAME}_fp32_${MODE}.pte"
174+
echo "Exporting ${EXPORTED_MODEL_NAME}"
175+
EXPORT_ARGS="--model_name=${MODEL_NAME} --backend=${MODE}"
176+
177+
# Add dynamically linked library location
178+
cmake_install_executorch_libraries
179+
180+
$PYTHON_EXECUTABLE -m examples.models.yolo12.export_and_validate ${EXPORT_ARGS}
181+
182+
183+
RUNTIME_ARGS="--model_path=${EXPORTED_MODEL_NAME} --input_path=${VIDEO_PATH}"
184+
# Check build tool.
185+
cmake_build_demo
186+
# Run yolo12 runner
187+
NOW=$(date +"%H:%M:%S")
188+
echo "Starting to run yolo12 runner at ${NOW}"
189+
# shellcheck source=/dev/null
190+
cmake-out/examples/models/yolo12/Yolo12DetectionDemo ${RUNTIME_ARGS} > result.txt
191+
NOW=$(date +"%H:%M:%S")
192+
echo "Finished at ${NOW}"
193+
194+
RESULT=$(cat result.txt)
195+
196+
prepare_artifacts_upload
197+
cleanup_files

.github/workflows/android-perf-private-device-experiment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ jobs:
5757
id-token: write
5858
contents: read
5959
with:
60-
models: ${{ inputs.models || github.event_name == 'schedule' && 'Qwen/Qwen3-0.6B,HuggingFaceTB/SmolLM2-135M,meta-llama/Llama-3.2-1B,allenai/OLMo-1B-hf' || 'Qwen/Qwen3-0.6B' }}
60+
models: ${{ inputs.models || github.event_name == 'schedule' && 'Qwen/Qwen3-0.6B,HuggingFaceTB/SmolLM2-135M,meta-llama/Llama-3.2-1B,allenai/OLMo-1B-hf,google/gemma-3-1b-it' || 'google/gemma-3-1b-it' }}
6161
devices: samsung_galaxy_s22_private
6262
benchmark_configs: ${{ inputs.benchmark_configs }}

.github/workflows/android-perf.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
# Separate default values from the workflow dispatch. To ensure defaults are accessible
7373
# during scheduled runs and to provide flexibility for different defaults between
7474
# on-demand and periodic benchmarking.
75-
CRON_DEFAULT_MODELS: ${{ github.event_name == 'schedule' && 'mv3,mv2,ic4,ic3,resnet50,edsr,mobilebert,w2l,meta-llama/Llama-3.2-1B,meta-llama/Llama-3.2-1B-Instruct-SpinQuant_INT4_EO8,meta-llama/Llama-3.2-1B-Instruct-QLORA_INT4_EO8,Qwen/Qwen3-0.6B,HuggingFaceTB/SmolLM2-135M,allenai/OLMo-1B-hf' || 'Qwen/Qwen3-0.6B' }}
75+
CRON_DEFAULT_MODELS: ${{ github.event_name == 'schedule' && 'mv3,mv2,ic4,ic3,resnet50,edsr,mobilebert,w2l,meta-llama/Llama-3.2-1B,meta-llama/Llama-3.2-1B-Instruct-SpinQuant_INT4_EO8,meta-llama/Llama-3.2-1B-Instruct-QLORA_INT4_EO8,Qwen/Qwen3-0.6B,HuggingFaceTB/SmolLM2-135M,allenai/OLMo-1B-hf,google/gemma-3-1b-it' || 'Qwen/Qwen3-0.6B' }}
7676
CRON_DEFAULT_DEVICES: samsung_galaxy_s22
7777
run: |
7878
set -eux
@@ -341,10 +341,11 @@ jobs:
341341
echo "tokenizer.json is downloaded to $DOWNLOADED_PATH"
342342
343343
# Install optimum-executorch
344+
OPTIMUM_ET_COMMIT=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
344345
git clone https://github.com/huggingface/optimum-executorch
345346
pushd optimum-executorch
346347
# There is no release yet, for CI stability, always test from the same commit on main
347-
git checkout 4c3b18f6cca68c5ccff809131d570062723d7188
348+
git checkout $OPTIMUM_ET_COMMIT
348349
python install_dev.py --skip_override_torch
349350
pip list
350351
@@ -353,21 +354,12 @@ jobs:
353354
"--task" "text-generation"
354355
"--recipe" "xnnpack"
355356
"--use_custom_sdpa"
357+
"--use_custom_kv_cache"
356358
"--qlinear"
357359
"--qembedding"
358360
"--output_dir" ".."
359361
)
360362
361-
# Add conditional arguments based on model
362-
case "${HF_MODEL_REPO}" in
363-
*"google/gemma-3-1b-it"*)
364-
echo "--use_custom_kv_cache can not be used for HybridCache"
365-
;;
366-
*)
367-
ARGS+=("--use_custom_kv_cache")
368-
;;
369-
esac
370-
371363
optimum-cli export executorch "${ARGS[@]}"
372364
popd
373365

.github/workflows/apple-perf-private-device-experiment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ jobs:
5757
id-token: write
5858
contents: read
5959
with:
60-
models: ${{ inputs.models || github.event_name == 'schedule' && 'Qwen/Qwen3-0.6B,HuggingFaceTB/SmolLM2-135M,meta-llama/Llama-3.2-1B,allenai/OLMo-1B-hf' || 'Qwen/Qwen3-0.6B' }}
60+
models: ${{ inputs.models || github.event_name == 'schedule' && 'Qwen/Qwen3-0.6B,HuggingFaceTB/SmolLM2-135M,meta-llama/Llama-3.2-1B,allenai/OLMo-1B-hf,google/gemma-3-1b-it' || 'google/gemma-3-1b-it' }}
6161
devices: apple_iphone_15_private
6262
benchmark_configs: ${{ inputs.benchmark_configs }}

0 commit comments

Comments
 (0)