From 8832e9bce039a1994a4ce9bdc21567df71477f72 Mon Sep 17 00:00:00 2001 From: Per Held Date: Fri, 15 Aug 2025 14:28:40 +0200 Subject: [PATCH] Arm backend: Add requirements.txt for arm backend Add requirements.txt files to handle pip installs in a more python way of doing things. Tagged versions handled in one place instead of being spread out in shell scripts. Requirements-arm-tosa.txt contains what is needed for the tosa reference model which is shared between multiple backends. Requirements-arm-ethos-u.txt contains the vela compiler needed by the ethos-u backend. Requirements-arm-models-test.txt contains test models needed for baremetal tests. The install_models_for_test.sh was keept since that its used by gitlab ci. Change-Id: I3213e543d15c23b96ccd1f683a9d6c7b164d7e7b Signed-off-by: per.held@arm.com --- backends/arm/requirements-arm-ethos-u.txt | 6 ++++ backends/arm/requirements-arm-models-test.txt | 6 ++++ backends/arm/requirements-arm-tosa.txt | 9 +++++ .../arm/scripts/install_models_for_test.sh | 4 +-- .../arm/scripts/install_reference_model.sh | 34 ------------------- examples/arm/setup.sh | 15 +++----- 6 files changed, 27 insertions(+), 47 deletions(-) create mode 100644 backends/arm/requirements-arm-ethos-u.txt create mode 100644 backends/arm/requirements-arm-models-test.txt create mode 100644 backends/arm/requirements-arm-tosa.txt delete mode 100755 backends/arm/scripts/install_reference_model.sh diff --git a/backends/arm/requirements-arm-ethos-u.txt b/backends/arm/requirements-arm-ethos-u.txt new file mode 100644 index 00000000000..5fad9d2fe94 --- /dev/null +++ b/backends/arm/requirements-arm-ethos-u.txt @@ -0,0 +1,6 @@ +# Copyright 2025 Arm Limited and/or its affiliates. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +ethos-u-vela @ git+https://gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-vela@d37febc1715edf0d236c2ff555739a8a9aadcf9a diff --git a/backends/arm/requirements-arm-models-test.txt b/backends/arm/requirements-arm-models-test.txt new file mode 100644 index 00000000000..ac4e1d9bad7 --- /dev/null +++ b/backends/arm/requirements-arm-models-test.txt @@ -0,0 +1,6 @@ +# Copyright 2025 Arm Limited and/or its affiliates. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +diffusers[torch] == 0.33.1 diff --git a/backends/arm/requirements-arm-tosa.txt b/backends/arm/requirements-arm-tosa.txt new file mode 100644 index 00000000000..4b7a3ec0273 --- /dev/null +++ b/backends/arm/requirements-arm-tosa.txt @@ -0,0 +1,9 @@ +# Copyright 2025 Arm Limited and/or its affiliates. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +ml_dtypes == 0.5.1 +flatbuffers == 24.3.25 + +tosa-tools @ git+https://git.gitlab.arm.com/tosa/tosa-reference-model.git@v2025.07.0 diff --git a/backends/arm/scripts/install_models_for_test.sh b/backends/arm/scripts/install_models_for_test.sh index 9c8b034909e..001d733a014 100644 --- a/backends/arm/scripts/install_models_for_test.sh +++ b/backends/arm/scripts/install_models_for_test.sh @@ -5,6 +5,4 @@ # LICENSE file in the root directory of this source tree. set -e - -# Install diffusers for Stable Diffusion model test -pip install "diffusers[torch]==0.33.1" +pip install -r backends/arm/requirements-arm-models-test.txt diff --git a/backends/arm/scripts/install_reference_model.sh b/backends/arm/scripts/install_reference_model.sh deleted file mode 100755 index 2e77b061565..00000000000 --- a/backends/arm/scripts/install_reference_model.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2025 Arm Limited and/or its affiliates. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. - -set -euo pipefail - -# Installation script for TOSA reference model - -tosa_reference_model_url="https://git.gitlab.arm.com/tosa/tosa-reference-model.git" -tosa_reference_model_1_0_rev="8aa2896be5b0625a7cde57abb2308da0d426198d" #2025.07.0 - -script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) - -source ${script_dir}/utils.sh - - -function setup_tosa_reference_model() { - local work_dir="$1" - - if [[ -z "$work_dir" ]]; then - echo "Error: work_dir parameter is required." - return 1 - fi - - mkdir -p "$work_dir" - pushd "$work_dir" || exit 1 - - # Install the 1.0 branch from upstream - CMAKE_POLICY_VERSION_MINIMUM=3.5 BUILD_PYBIND=1 pip install "tosa-tools@git+${tosa_reference_model_url}@${tosa_reference_model_1_0_rev}" ml_dtypes==0.5.1 --no-dependencies flatbuffers -} - -setup_tosa_reference_model $1 diff --git a/examples/arm/setup.sh b/examples/arm/setup.sh index 050b0f93c46..1c1de66c88f 100755 --- a/examples/arm/setup.sh +++ b/examples/arm/setup.sh @@ -58,10 +58,6 @@ else echo "[main] Error: only x86-64 & aarch64/arm64 architecture is supported for now!"; exit 1; fi -# Vela -vela_repo_url="https://gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-vela" -vela_rev="d37febc1715edf0d236c2ff555739a8a9aadcf9a" - # MLSDK dependencies mlsdk_manifest_dir="ml-sdk-for-vulkan-manifest" @@ -329,8 +325,8 @@ function setup_toolchain() { tar xf "${toolchain_dir}.tar.xz" } -function setup_vela() { - pip install ethos-u-vela@git+${vela_repo_url}@${vela_rev} +function setup_ethos_u_tools() { + CMAKE_POLICY_VERSION_MINIMUM=3.5 BUILD_PYBIND=1 pip install --no-dependencies -r $et_dir/backends/arm/requirements-arm-ethos-u.txt } function prepend_env_in_setup_path() { @@ -465,12 +461,11 @@ if [[ $is_script_sourced -eq 0 ]]; then create_setup_path fi - # Setup the tosa_reference_model - $et_dir/backends/arm/scripts/install_reference_model.sh ${root_dir} + # Setup the tosa_reference_model and dependencies + CMAKE_POLICY_VERSION_MINIMUM=3.5 BUILD_PYBIND=1 pip install --no-dependencies -r $et_dir/backends/arm/requirements-arm-tosa.txt - # Setup vela and patch in codegen fixes if [[ "${enable_vela}" -eq 1 ]]; then - setup_vela + setup_ethos_u_tools fi echo "[main] Update path by running 'source ${setup_path_script}.sh'"