Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 15 additions & 25 deletions backends/arm/scripts/mlsdk_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,17 @@
set -euo pipefail

mlsdk_manifest_url="https://github.com/arm/ai-ml-sdk-manifest.git"
mlsdk_manifest_tag="dev-snapshot-2025-09-12"

script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)

source ${script_dir}/utils.sh

usage() { echo "Usage: $0 [-u <mlsdk-manifest-url>]" 1>&2; exit 1; }

while getopts ":u:" opt; do
case "${opt}" in
u)
mlsdk_manifest_url=${OPTARG}
;;
*)
usage
;;
esac
done

function download_ai_mlsdk_manifest() {
local _dada_dir="$1"
local _manifest_dir="$1"

if [[ -z "${_dada_dir}" ]]; then
echo "Error: _dada_dir parameter missing?"
if [[ -z "${_manifest_dir}" ]]; then
echo "Error: _manifest_dir parameter missing?"
return 1
fi

Expand All @@ -38,20 +26,25 @@ function download_ai_mlsdk_manifest() {
return 1
fi

if [[ ! -d "${_dada_dir}" ]]; then
mkdir -p "$_dada_dir"
pushd "$_dada_dir" || exit 1
if [[ ! -d "${_manifest_dir}" ]]; then
mkdir -p "$_manifest_dir"
pushd "$_manifest_dir" || exit 1

curl https://storage.googleapis.com/git-repo-downloads/repo > repo
chmod u+x repo
./repo init --no-repo-verify --depth=1 --manifest-url ${mlsdk_manifest_url} -g model-converter,emulation-layer,vgf-library
./repo sync
./repo init \
--depth=1 \
--no-repo-verify \
--manifest-url ${mlsdk_manifest_url} \
--manifest-branch ${mlsdk_manifest_tag} \
-g model-converter,emulation-layer,vgf-library
./repo sync -j$(nproc)

popd
fi
}

function setup_model_converter() {
function setup_mlsdk() {
local work_dir="$1"
local manifest_dir="$2"
local enable_model_converter="$3"
Expand Down Expand Up @@ -147,6 +140,3 @@ function setup_path_emulation_layer() {
prepend_env_in_setup_path VK_INSTANCE_LAYERS VK_LAYER_ML_Graph_Emulation
prepend_env_in_setup_path VK_LAYER_PATH "${model_emulation_layer_path}/deploy/share/vulkan/explicit_layer.d"
}

#setup_model_converter() $1
# `"$manifest_dir"'
26 changes: 9 additions & 17 deletions examples/arm/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ enable_model_converter=0 # model-converter tool for VGF output
enable_vgf_lib=0 # vgf reader - runtime backend dependency
enable_emulation_layer=0 # Vulkan layer driver - emulates Vulkan ML extensions
enable_vulkan_sdk=0 # Download and export Vulkan SDK required by emulation layer
mlsdk_manifest_url="https://github.com/arm/ai-ml-sdk-manifest.git"

# Figure out if setup.sh was called or sourced and save it into "is_script_sourced"
(return 0 2>/dev/null) && is_script_sourced=1 || is_script_sourced=0
Expand Down Expand Up @@ -145,17 +144,6 @@ function check_options() {
enable_vulkan_sdk=1
shift
;;
--mlsdk-manifest-url)
# Ensure that there is a url provided.
if [[ -n "$2" && "${2:0:1}" != "-" ]]; then
mlsdk_manifest_url="$2"
shift 2
else
echo "Error: --mlsdk-manifest-url requires a URL argument."
print_usage "$@"
exit 1
fi
;;
--setup-test-dependency)
echo "Installing test dependency..."
source $et_dir/backends/arm/scripts/install_models_for_test.sh
Expand Down Expand Up @@ -251,8 +239,6 @@ if [[ $is_script_sourced -eq 0 ]]; then
echo "enable-emulation-layer=${enable_emulation_layer}"
echo "enable-vulkan-sdk=${enable_vulkan_sdk}"
echo "enable-vela=${enable_vela}"
echo "mlsdk-manifest-url=${mlsdk_manifest_url}"


# Setup toolchain
if [[ "${enable_baremetal_toolchain}" -eq 1 ]]; then
Expand All @@ -276,15 +262,21 @@ if [[ $is_script_sourced -eq 0 ]]; then
if [[ "${enable_model_converter}" -eq 1 || \
"${enable_vgf_lib}" -eq 1 || \
"${enable_emulation_layer}" -eq 1 ]]; then
source $et_dir/backends/arm/scripts/mlsdk_utils.sh -u "${mlsdk_manifest_url}"
setup_model_converter ${root_dir} ${mlsdk_manifest_dir} ${enable_model_converter} ${enable_vgf_lib} ${enable_emulation_layer}
source $et_dir/backends/arm/scripts/mlsdk_utils.sh
setup_mlsdk ${root_dir} \
${mlsdk_manifest_dir} \
${enable_model_converter} \
${enable_vgf_lib} \
${enable_emulation_layer}
fi

# Create the setup_path.sh used to create the PATH variable for shell
create_setup_path

# 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
CMAKE_POLICY_VERSION_MINIMUM=3.5 \
BUILD_PYBIND=1 \
pip install --no-dependencies -r $et_dir/backends/arm/requirements-arm-tosa.txt

if [[ "${enable_vela}" -eq 1 ]]; then
setup_ethos_u_tools
Expand Down
Loading