Skip to content

Commit 1489d4f

Browse files
authored
Arm backend: Streamline MLSDK deps and standardise setup logging (#15189)
* ensure download_ai_mlsdk_manifest only refreshes when URL/tag change (avoids needless MLSDK downloads) and uses consistent cleanup * centralise log_step usage, trim noisy logs, and add get_parallel_jobs so repo sync/build steps pick the right concurrency everywhere * centralise log_step and parallelism across other setup scripts also. Change-Id: I4edad30c7ced94afda0a217e3f7bf291e9e5e2f8 cc @freddan80 @per @zingo @oscarandersson8218 @digantdesai Signed-off-by: Ryan O'Shea <[email protected]>
1 parent 6a0833f commit 1489d4f

File tree

9 files changed

+254
-117
lines changed

9 files changed

+254
-117
lines changed

backends/arm/scripts/build_executor_runner.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ et_root_dir=$(realpath ${et_root_dir})
1212
toolchain=arm-none-eabi-gcc
1313
setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh
1414
_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools."
15+
source "${script_dir}/utils.sh"
1516

1617
pte_file=""
1718
target="ethos-u55-128"
@@ -185,7 +186,9 @@ cmake \
185186

186187
echo "[${BASH_SOURCE[0]}] Configured CMAKE"
187188

188-
cmake --build ${output_folder} -j$(nproc) -- arm_executor_runner
189+
parallel_jobs="$(get_parallel_jobs)"
190+
191+
cmake --build ${output_folder} -j"${parallel_jobs}" -- arm_executor_runner
189192

190193
echo "[${BASH_SOURCE[0]}] Generated ${toolchain} elf file:"
191194
find ${output_folder} -name "arm_executor_runner"

backends/arm/scripts/build_executor_runner_vkml.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ et_root_dir=$(cd ${script_dir}/../../.. && pwd)
1111
et_root_dir=$(realpath ${et_root_dir})
1212
setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh
1313
_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools."
14+
source "${script_dir}/utils.sh"
1415

1516
build_type="Release"
1617
build_with_etdump=false
1718
extra_build_flags=""
1819
output_folder="cmake-out-vkml"
1920

20-
build_with_etdump_flags=" -DEXECUTORCH_ENABLE_EVENT_TRACER=OFF "
21-
21+
build_with_etdump_flag="-DEXECUTORCH_ENABLE_EVENT_TRACER=OFF"
2222
help() {
2323
echo "Usage: $(basename $0) [options]"
2424
echo "Options:"
@@ -50,7 +50,7 @@ done
5050
source ${setup_path_script}
5151

5252
mkdir -p "${output_folder}"
53-
output_folder=$(realpath ${output_folder})
53+
output_folder=$(realpath "${output_folder}")
5454

5555
echo "--------------------------------------------------------------------------------"
5656
echo "Build Arm VKML executor runner: '${output_folder}' with extra build flags: ${extra_build_flags}"
@@ -59,11 +59,13 @@ echo "--------------------------------------------------------------------------
5959
cd ${et_root_dir}/examples/arm/executor_runner
6060

6161
if [ "$build_with_etdump" = true ] ; then
62-
build_with_etdump_flags=" -DEXECUTORCH_ENABLE_EVENT_TRACER=ON "
62+
build_with_etdump_flag="-DEXECUTORCH_ENABLE_EVENT_TRACER=ON"
6363
fi
6464

65-
echo "Building with extra flags: ${build_with_etdump_flags} ${extra_build_flags}"
65+
echo "Building with extra flags: ${build_with_etdump_flag} ${extra_build_flags}"
6666
cmake \
67+
-S "${et_root_dir}" \
68+
-B "${output_folder}" \
6769
-Wall \
6870
-Werror \
6971
-DCMAKE_BUILD_TYPE=${build_type} \
@@ -78,13 +80,15 @@ cmake \
7880
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
7981
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT=ON \
8082
-DEXECUTORCH_ENABLE_LOGGING=ON \
81-
-DPYTHON_EXECUTABLE=$(which python3) \
82-
${extra_build_flags} \
83-
-B ${output_folder} ${et_root_dir}
83+
-DPYTHON_EXECUTABLE="$(which python3)" \
84+
${build_with_etdump_flag} \
85+
${extra_build_flags}
8486

8587
echo "[${BASH_SOURCE[0]}] Configured CMAKE"
8688

87-
cmake --build ${output_folder} -j$(nproc)
89+
parallel_jobs="$(get_parallel_jobs)"
90+
91+
cmake --build "${output_folder}" --parallel "${parallel_jobs}"
8892

8993
echo "[${BASH_SOURCE[0]}] Built VKML runner: "
9094
find ${output_folder} -name "executor_runner"

backends/arm/scripts/build_executorch.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ toolchain=arm-none-eabi-gcc
1717
setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh
1818
_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools."
1919

20+
source "${script_dir}/utils.sh"
21+
2022
et_build_root="${et_root_dir}/arm_test"
2123
build_type="Release"
2224
build_devtools=OFF
@@ -81,7 +83,9 @@ cmake -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} \
8183
-DEXECUTORCH_BUILD_ARM_ETDUMP=$build_with_etdump \
8284
--preset arm-baremetal -B${et_build_dir}
8385

84-
cmake --build ${et_build_dir} -j$(nproc) --target install --config ${build_type} --
86+
parallel_jobs="$(get_parallel_jobs)"
87+
88+
cmake --build ${et_build_dir} -j"${parallel_jobs}" --target install --config ${build_type} --
8589

8690
set +x
8791

backends/arm/scripts/fvp_utils.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ if [[ $? -ne 0 ]]; then
2323
exit 1
2424
fi
2525

26+
script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
27+
source "${script_dir}/utils.sh"
28+
2629
if [[ "${ARCH}" == "x86_64" ]]; then
2730
# FVPs
2831
corstone300_url="https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/Corstone-300/FVP_Corstone_SSE-300_11.22_20_Linux64.tgz?rev=018659bd574f4e7b95fa647e7836ccf4&hash=22A79103C6FA5FFA7AFF3BE0447F3FF9"
@@ -42,7 +45,8 @@ elif [[ "${ARCH}" == "aarch64" ]] || [[ "${ARCH}" == "arm64" ]]; then
4245
corstone320_model_dir="Linux64_armv8l_GCC-9.3"
4346
corstone320_md5_checksum="3889f1d80a6d9861ea4aa6f1c88dd0ae"
4447
else
45-
echo "[main] Error: only x86-64 & aarch64/arm64 architecture is supported for now!"; exit 1;
48+
log_step "fvp" "Error: only x86-64 & aarch64/arm64 architecture is supported for now!"
49+
exit 1
4650
fi
4751

4852
function install_fvp() {
@@ -52,7 +56,7 @@ function install_fvp() {
5256
for fvp in "${fvps[@]}"; do
5357
cd "${root_dir}"
5458
if [[ ! -e "FVP_${fvp}.tgz" ]]; then
55-
echo "[${FUNCNAME[0]}] Downloading FVP ${fvp}..."
59+
log_step "fvp" "Downloading FVP ${fvp}"
5660
url_variable=${fvp}_url
5761
fvp_url=${!url_variable}
5862
curl --output "FVP_${fvp}.tgz" "${fvp_url}"
@@ -61,7 +65,7 @@ function install_fvp() {
6165
verify_md5 ${fvp_md5_checksum} FVP_${fvp}.tgz || exit 1
6266
fi
6367

64-
echo "[${FUNCNAME[0]}] Installing FVP ${fvp}..."
68+
log_step "fvp" "Installing FVP ${fvp}"
6569
rm -rf FVP-${fvp}
6670
mkdir -p FVP-${fvp}
6771
cd FVP-${fvp}
@@ -76,7 +80,7 @@ function install_fvp() {
7680
./FVP_Corstone_SSE-320.sh --i-agree-to-the-contained-eula --force --destination ./ --quiet --no-interactive
7781
;;
7882
*)
79-
echo "[${FUNCNAME[0]}] Error: Unknown FVP model ${fvp}. Exiting."
83+
log_step "fvp" "Error: Unknown FVP model ${fvp}. Exiting."
8084
exit 1
8185
;;
8286
esac
@@ -89,12 +93,12 @@ function check_fvp_eula () {
8993

9094
if [[ "${eula_acceptance}" -eq 0 ]]; then
9195
if [[ ${eula_acceptance_by_variable} != "True" ]]; then
92-
echo "Must pass argument '--i-agree-to-the-contained-eula' to agree to EULA associated with downloading the FVP."
93-
echo "Alternativly set environment variable ARM_FVP_INSTALL_I_AGREE_TO_THE_CONTAINED_EULA=True."
94-
echo "Exiting!"
96+
log_step "fvp" "Must pass '--i-agree-to-the-contained-eula' to download the FVP"
97+
log_step "fvp" "Alternatively set ARM_FVP_INSTALL_I_AGREE_TO_THE_CONTAINED_EULA=True"
98+
log_step "fvp" "Exiting due to missing EULA acceptance"
9599
exit 1
96100
else
97-
echo "Arm EULA for FVP agreed to with ARM_FVP_INSTALL_I_AGREE_TO_THE_CONTAINED_EULA=True environment variable"
101+
log_step "fvp" "Arm EULA accepted via ARM_FVP_INSTALL_I_AGREE_TO_THE_CONTAINED_EULA=True"
98102
fi
99103
fi
100104
}
@@ -103,12 +107,10 @@ function setup_fvp() {
103107
if [[ "${OS}" != "Linux" ]]; then
104108
# Check if FVP is callable
105109
if command -v FVP_Corstone_SSE-300_Ethos-U55 &> /dev/null; then
106-
echo "[${FUNCNAME[0]}] Info: FVP for MacOS seem to be installed. Continuing..."
110+
log_step "fvp" "Detected pre-installed MacOS FVP binaries; continuing"
107111
return 0 # If true exit gracefully and proceed with setup
108112
else
109-
echo "[${FUNCNAME[0]}] Warning: FVP only supported with Linux OS, skipping FVP setup..."
110-
echo "[${FUNCNAME[0]}] Warning: For MacOS, using https://github.com/Arm-Examples/FVPs-on-Mac is recommended."
111-
echo "[${FUNCNAME[0]}] Warning: Follow the instructions and make sure the path is set correctly."
113+
log_step "fvp" "Warning: FVP setup only supported on Linux; Mac users should install via https://github.com/Arm-Examples/FVPs-on-Mac and ensure binaries are on PATH"
112114
return 1 # Throw error. User need to install FVP according to ^^^
113115
fi
114116
fi

0 commit comments

Comments
 (0)