|
| 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 | +set -eu |
| 8 | + |
| 9 | +script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) |
| 10 | +et_root_dir=$(cd ${script_dir}/../../.. && pwd) |
| 11 | +et_root_dir=$(realpath ${et_root_dir}) |
| 12 | +setup_path_script=${et_root_dir}/examples/arm/ethos-u-scratch/setup_path.sh |
| 13 | +_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools." |
| 14 | + |
| 15 | +build_type="Release" |
| 16 | +build_with_etdump=false |
| 17 | +extra_build_flags="" |
| 18 | +output_folder="cmake-out-vkml" |
| 19 | + |
| 20 | +build_with_etdump_flags=" -DEXECUTORCH_ENABLE_EVENT_TRACER=OFF " |
| 21 | + |
| 22 | +help() { |
| 23 | + echo "Usage: $(basename $0) [options]" |
| 24 | + echo "Options:" |
| 25 | + echo " --build_type=<TYPE> Build with Release, Debug or RelWithDebInfo, default is ${build_type}" |
| 26 | + echo " --etdump Adds Devtools etdump support to track timing, etdump area will be base64 encoded in the log" |
| 27 | + echo " --extra_build_flags=<FLAGS> Extra flags to pass to cmake. Default: none " |
| 28 | + echo " --output=<FOLDER> Output folder Default: $(output_folder)" |
| 29 | + exit 0 |
| 30 | +} |
| 31 | + |
| 32 | +for arg in "$@"; do |
| 33 | + case $arg in |
| 34 | + -h|--help) help ;; |
| 35 | + --build_type=*) build_type="${arg#*=}";; |
| 36 | + --etdump) build_with_etdump=true ;; |
| 37 | + --extra_build_flags=*) extra_build_flags="${arg#*=}";; |
| 38 | + --output=*) output_folder="${arg#*=}";; |
| 39 | + --select_ops_list=*) select_ops_list="${arg#*=}";; |
| 40 | + *) |
| 41 | + ;; |
| 42 | + esac |
| 43 | +done |
| 44 | + |
| 45 | +# Source the tools |
| 46 | +# This should be prepared by the setup.sh |
| 47 | +[[ -f ${setup_path_script} ]] \ |
| 48 | + || { echo "Missing ${setup_path_script}. ${_setup_msg}"; exit 1; } |
| 49 | + |
| 50 | +source ${setup_path_script} |
| 51 | + |
| 52 | +mkdir -p "${output_folder}" |
| 53 | +output_folder=$(realpath ${output_folder}) |
| 54 | + |
| 55 | +echo "--------------------------------------------------------------------------------" |
| 56 | +echo "Build Arm VKML executor runner: '${output_folder}' with extra build flags: ${extra_build_flags}" |
| 57 | +echo "--------------------------------------------------------------------------------" |
| 58 | + |
| 59 | +cd ${et_root_dir}/examples/arm/executor_runner |
| 60 | + |
| 61 | +if [ "$build_with_etdump" = true ] ; then |
| 62 | + build_with_etdump_flags=" -DEXECUTORCH_ENABLE_EVENT_TRACER=ON " |
| 63 | +fi |
| 64 | + |
| 65 | +echo "Building with extra flags: ${build_with_etdump_flags} ${extra_build_flags}" |
| 66 | +cmake \ |
| 67 | + -DCMAKE_BUILD_TYPE=${build_type} \ |
| 68 | + -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ |
| 69 | + -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ |
| 70 | + -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \ |
| 71 | + -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ |
| 72 | + -DEXECUTORCH_BUILD_XNNPACK=OFF \ |
| 73 | + -DEXECUTORCH_BUILD_VULKAN=ON \ |
| 74 | + -DEXECUTORCH_BUILD_VGF=ON \ |
| 75 | + -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \ |
| 76 | + -DEXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT=ON \ |
| 77 | + -DEXECUTORCH_ENABLE_LOGGING=ON \ |
| 78 | + -DPYTHON_EXECUTABLE=$(which python3) \ |
| 79 | + ${extra_build_flags} \ |
| 80 | + -B ${output_folder} ${et_root_dir} |
| 81 | + |
| 82 | +echo "[${BASH_SOURCE[0]}] Configured CMAKE" |
| 83 | + |
| 84 | +cmake --build ${output_folder} -j$(nproc) |
| 85 | + |
| 86 | +echo "[${BASH_SOURCE[0]}] Built VKML runner: " |
| 87 | +find ${output_folder} -name "executor_runner" |
0 commit comments