Skip to content

Commit 63fee01

Browse files
committed
Break out building quantized_ops_aot lib from run.sh
Signed-off-by: Erik Lundell <[email protected]> Change-Id: I258c3485ea826b34b97b604dbcb68034608a9114
1 parent 2a4256b commit 63fee01

File tree

3 files changed

+38
-37
lines changed

3 files changed

+38
-37
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2025 Arm Limited and/or its affiliates.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# Needs to be run from exeuctorch root.
8+
# Optional parameter: 1: build_type= "Release" | "Debug" | "RelWithDebInfo"
9+
10+
build_type="Release"
11+
12+
build_type=${1:-$build_type}
13+
14+
SITE_PACKAGES="$(python3 -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
15+
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
16+
17+
echo "--------------------------------------------------------------------------------"
18+
echo "Build .so library to register quant ops with AoT flow ${build_type} into '$(echo $(pwd))/cmake-out-aot-lib'"
19+
echo "--------------------------------------------------------------------------------"
20+
21+
# Since we only want to build the quantized_aot lib in the specified folder,
22+
# we want exactly the configuration set below and deleting the cache is OK.
23+
rm -f cmake-out-aot-lib/CMakeCache.txt
24+
25+
cmake \
26+
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
27+
-DCMAKE_BUILD_TYPE=${build_type} \
28+
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
29+
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT=ON \
30+
-Bcmake-out-aot-lib \
31+
.
32+
33+
cmake --build cmake-out-aot-lib --parallel -- quantized_ops_aot_lib

backends/arm/test/setup_testing.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright 2024 Arm Limited and/or its affiliates.
2+
# Copyright 2024-2025 Arm Limited and/or its affiliates.
33
# All rights reserved.
44
#
55
# This source code is licensed under the BSD-style license found in the
@@ -52,6 +52,8 @@ function build_semihosting_executorch_runner() {
5252
find ${build_test_dir} -name "arm_executor_runner"
5353
}
5454

55+
cd $et_root_dir && backends/arm/scripts/build_quantized_ops_aot_lib.sh
56+
5557
# Use most optimal system_configs for testing
5658
build_semihosting_executorch_runner corstone-300 Ethos_U55_High_End_Embedded
5759

examples/arm/run.sh

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) Meta Platforms, Inc. and affiliates.
33
# All rights reserved.
44
#
5-
# Copyright 2023-2024 Arm Limited and/or its affiliates.
5+
# Copyright 2023-2025 Arm Limited and/or its affiliates.
66
#
77
# This source code is licensed under the BSD-style license found in the
88
# LICENSE file in the root directory of this source tree.
@@ -256,40 +256,6 @@ function build_executorch() {
256256
find . -name "*.a" -exec ls -al {} \;
257257
}
258258
259-
# Build .so library to register quant ops with AoT flow
260-
function build_quantization_aot_lib()
261-
{
262-
SITE_PACKAGES="$(python3 -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
263-
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
264-
265-
cd $et_root_dir
266-
mkdir -p cmake-out-aot-lib
267-
268-
echo "--------------------------------------------------------------------------------"
269-
echo "Build .so library to register quant ops with AoT flow ${build_type} into '${et_root_dir}' - 'cmake-out-aot-lib'"
270-
echo "--------------------------------------------------------------------------------"
271-
272-
build_with_etdump_flags=""
273-
if [ "$build_with_etdump" = true ] ; then
274-
build_with_etdump_flags="-DEXECUTORCH_BUILD_DEVTOOLS=ON \
275-
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON "
276-
fi
277-
278-
cmake \
279-
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
280-
-DCMAKE_BUILD_TYPE=${build_type} \
281-
-DEXECUTORCH_BUILD_XNNPACK=OFF \
282-
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
283-
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT=ON \
284-
${build_with_etdump_flags} \
285-
-DPYTHON_EXECUTABLE=$(which python3) \
286-
${extra_build_flags} \
287-
-Bcmake-out-aot-lib \
288-
"${et_root_dir}"
289-
290-
cmake --build cmake-out-aot-lib --parallel -- quantized_ops_aot_lib
291-
}
292-
293259
# build Arm Baremetal executor_runner
294260
function build_executorch_runner() {
295261
echo "[${FUNCNAME[0]}] Generating ExecuTorch libraries"
@@ -397,7 +363,7 @@ hash arm-none-eabi-gcc \
397363
398364
# build executorch libraries
399365
build_executorch
400-
build_quantization_aot_lib
366+
cd $et_root_dir && backends/arm/scripts/build_quantized_ops_aot_lib.sh $build_type
401367
402368
if [[ -z "$model_name" ]]; then
403369
# the test models run, and whether to delegate

0 commit comments

Comments
 (0)