aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikhil Raj <nikhil.raj@arm.com>2023-04-26 16:22:10 +0100
committerNikhil Raj Arm <nikhil.raj@arm.com>2023-05-02 10:44:01 +0000
commit542c848730b9d96c3131cba25b3494022011e58f (patch)
treebdd9b5c294d348dfc919553a932e6e9504e89d89
parent86b0357c2b64cc902864fffc5fa4406cf5af1b6f (diff)
downloadarmnn-542c848730b9d96c3131cba25b3494022011e58f.tar.gz
IVGCVSW-7536 Update Build Tool for Opaque Delegate
Signed-off-by: Nikhil Raj <nikhil.raj@arm.com> Change-Id: Iaf3f1b5e4e41d0d946a21504c6d44e47d83273e0
-rw-r--r--build-tool/README.md62
-rwxr-xr-xbuild-tool/scripts/build-armnn.sh62
-rwxr-xr-xbuild-tool/scripts/setup-armnn.sh51
-rwxr-xr-xbuild-tool/scripts/validation.sh2
4 files changed, 99 insertions, 78 deletions
diff --git a/build-tool/README.md b/build-tool/README.md
index 34c8998569..55c2455c13 100644
--- a/build-tool/README.md
+++ b/build-tool/README.md
@@ -134,22 +134,23 @@ For ease of use (but longer initial docker build), use ```--all``` to have all A
Repeated docker builds with the same ```SETUP_ARGS``` will skip the setup process (using [caching](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache) of previous Docker build steps).
The ```SETUP_ARGS``` string should start and end with **double quotes** ```"```.
-| SETUP_ARGS | Description |
-|-------------------|:---------------------------------------------------------------------------------|
-| --tflite-delegate | **flag:** setup dependencies for the Arm NN TF Lite Delegate |
-| --tflite-parser | **flag:** setup dependencies for the Arm NN TF Lite Parser |
-| --onnx-parser | **flag:** setup dependencies for the Arm NN ONNX parser |
-| --all | **flag:** setup dependencies for all Arm NN components listed above |
-| --target-arch= | **mandatory option:** specify a target architecture ```aarch64, x86_64``` |
+| SETUP_ARGS | Description |
+|----------------------------|:--------------------------------------------------------------------------|
+| --tflite-classic-delegate | **flag:** setup dependencies for the existing Arm NN TF Lite Delegate |
+| --tflite-opaque-delegate | **flag:** setup dependencies for the new Arm NN Opaque Delegate |
+| --tflite-parser | **flag:** setup dependencies for the Arm NN TF Lite Parser |
+| --onnx-parser | **flag:** setup dependencies for the Arm NN ONNX parser |
+| --all | **flag:** setup dependencies for all Arm NN components listed above |
+| --target-arch= | **mandatory option:** specify a target architecture ```aarch64, x86_64``` |
-**At least one component** (e.g. ```--tflite-delegate```) must be provided **or** else provide ```--all``` to setup dependencies for all components.
+**At least one component** (e.g. ```--tflite-classic-delegate```) must be provided **or** else provide ```--all``` to setup dependencies for all components.
**Examples:**<br>
Setup for aarch64 with all Arm NN dependencies:<br>
```SETUP_ARGS="--target-arch=aarch64 --all"```
-Setup for aarch64 with TF Lite Delegate and TF Lite Parser dependencies only:<br>
-```SETUP_ARGS="--target-arch=aarch64 --tflite-delegate --tflite-parser"```
+Setup for aarch64 with the existing TF Lite Delegate and TF Lite Parser dependencies only:<br>
+```SETUP_ARGS="--target-arch=aarch64 --tflite-classic-delegate --tflite-parser"```
<br>
@@ -157,22 +158,23 @@ Setup for aarch64 with TF Lite Delegate and TF Lite Parser dependencies only:<br
The following arguments are given to ```build-armnn.sh``` and define which components of Arm NN to include in the build.
The ```BUILD_ARGS``` string should start and end with **double quotes** ```"```.
-| BUILD_ARGS | Description |
-|---------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| --tflite-delegate | **flag:** build the Arm NN TF Lite Delegate component |
-| --tflite-parser | **flag:** build the Arm NN TF Lite Parser component |
-| --onnx-parser | **flag:** build the Arm NN ONNX parser component |
-| --all | **flag:** build all Arm NN components listed above |
-| --target-arch= | **mandatory option:** specify a target architecture ```aarch64, x86_64``` |
-| --neon-backend | **flag:** build Arm NN with the NEON backend (CPU acceleration from ACL) |
-| --cl-backend | **flag:** build Arm NN with the OpenCL backend (GPU acceleration from ACL) |
-| --ref-backend | **flag:** build Arm NN with the reference backend<br/>**Should be used for verification purposes only.<br/>Does not provide any performance acceleration.** |
-| --debug | **flag:** build Arm NN (and ACL) with debug turned on (optional: defaults to off) |
-| --armnn-cmake-args= | **option:** provide additional comma-separated CMake arguments string for building Arm NN (optional)<br/>String should start and end with **single quotes** ```'```<br/>Please refer to **armnn/cmake/GlobalConfig.cmake** |
-| --acl-scons-params= | **option**: provide additional comma-separated scons parameters string for building ACL (optional)<br/>String should start and end with **single quotes** ```'```<br/>ACL provide [documentation](https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml#S1_1_build_options) for their build options |
-
-
-**At least one component** (i.e. ```--tflite-delegate```, ```--tflite-parser```, ```--onnx-parser```) must be provided or else provide ```--all``` to build all Arm NN components.<br>
+| BUILD_ARGS | Description |
+|---------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| --tflite-classic-delegate | **flag:** build the existing Arm NN TF Lite Delegate component |
+| --tflite-opaque-delegate | **flag:** build the new Arm NN Opaque Delegate |
+| --tflite-parser | **flag:** build the Arm NN TF Lite Parser component |
+| --onnx-parser | **flag:** build the Arm NN ONNX parser component |
+| --all | **flag:** build all Arm NN components listed above |
+| --target-arch= | **mandatory option:** specify a target architecture ```aarch64, x86_64``` |
+| --neon-backend | **flag:** build Arm NN with the NEON backend (CPU acceleration from ACL) |
+| --cl-backend | **flag:** build Arm NN with the OpenCL backend (GPU acceleration from ACL) |
+| --ref-backend | **flag:** build Arm NN with the reference backend<br/>**Should be used for verification purposes only.<br/>Does not provide any performance acceleration.** |
+| --debug | **flag:** build Arm NN (and ACL) with debug turned on (optional: defaults to off) |
+| --armnn-cmake-args= | **option:** provide additional comma-separated CMake arguments string for building Arm NN (optional)<br/>String should start and end with **single quotes** ```'```<br/>Please refer to **armnn/cmake/GlobalConfig.cmake** |
+| --acl-scons-params= | **option**: provide additional comma-separated scons parameters string for building ACL (optional)<br/>String should start and end with **single quotes** ```'```<br/>ACL provide [documentation](https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml#S1_1_build_options) for their build options |
+
+
+**At least one component** (i.e. ```--tflite-classic-delegate```, ```--tflite-opaque-delegate```, ```--tflite-parser```, ```--onnx-parser```) must be provided or else provide ```--all``` to build all Arm NN components.<br>
**A component given in ```BUILD_ARGS``` must also have been given in ```SETUP_ARGS``` previously**, or else Arm NN will fail to build.<br>
**At least one backend** (i.e. ```--neon-backend```, ```--cl-backend```, ```--ref-backend```) must be chosen.<br>
@@ -180,8 +182,8 @@ The ```BUILD_ARGS``` string should start and end with **double quotes** ```"```.
Build for aarch64 with all Arm NN components, NEON enabled and OpenCL enabled:<br>
```BUILD_ARGS="--target-arch=aarch64 --all --neon-backend --cl-backend"```
-Build for aarch64 with TF Lite Delegate, OpenCL enabled and additional ACL scons params:<br>
-```BUILD_ARGS="--target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1,benchmark_examples=1'"```
+Build for aarch64 with the existing Arm NN TF Lite Delegate, OpenCL enabled and additional ACL scons params:<br>
+```BUILD_ARGS="--target-arch=aarch64 --tflite-classic-delegate --cl-backend --acl-scons-params='compress_kernels=1,benchmark_examples=1'"```
Setup for aarch64 with all Arm NN dependencies, OpenCL enabled and additional Arm NN cmake args:<br>
```BUILD_ARGS="--target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1,-DBUILD_UNIT_TESTS=0'"```
@@ -189,12 +191,12 @@ Setup for aarch64 with all Arm NN dependencies, OpenCL enabled and additional Ar
**Example _valid_ combination of SETUP_ARGS and BUILD_ARGS:**<br>
```
SETUP_ARGS="--target-arch=aarch64 --all"
-BUILD_ARGS="--target-arch=aarch64 --tflite-delegate --neon-backend --cl-backend"
+BUILD_ARGS="--target-arch=aarch64 --tflite-classic-delegate --neon-backend --cl-backend"
```
**Example _invalid_ combination of SETUP_ARGS and BUILD_ARGS:**<br>
```
-SETUP_ARGS="--target-arch=aarch64 --tflite-delegate"
+SETUP_ARGS="--target-arch=aarch64 --tflite-classic-delegate"
BUILD_ARGS="--target-arch=aarch64 --all --neon-backend --cl-backend"
```
diff --git a/build-tool/scripts/build-armnn.sh b/build-tool/scripts/build-armnn.sh
index 61cd36967a..6b5b57d784 100755
--- a/build-tool/scripts/build-armnn.sh
+++ b/build-tool/scripts/build-armnn.sh
@@ -96,7 +96,8 @@ build_armnn()
eval "$compile_flags" \
cmake -DCMAKE_BUILD_TYPE="$build_type" \
- -DBUILD_CLASSIC_DELEGATE="$flag_tflite_delegate" \
+ -DBUILD_CLASSIC_DELEGATE="$flag_tflite_classic_delegate" \
+ -DBUILD_OPAQUE_DELEGATE="$flag_tflite_opaque_delegate" \
-DBUILD_TF_LITE_PARSER="$flag_tflite_parser" \
-DBUILD_DELEGATE_JNI_INTERFACE="$flag_jni" \
-DBUILD_ONNX_PARSER="$flag_onnx_parser" \
@@ -194,8 +195,10 @@ usage()
cat <<EOF
build-armnn.sh - Build Arm NN and ACL
build-armnn.sh [OPTION]...
- --tflite-delegate
- build the Arm NN TF Lite Delegate component
+ --tflite-classic-delegate
+ build the existing Arm NN TF Lite Delegate component
+ --tflite-opaque-delegate
+ build the new Arm NN opaque delegate component
--tflite-parser
build the Arm NN TF Lite Parser component
--onnx-parser
@@ -225,7 +228,7 @@ build-armnn.sh [OPTION]...
-x
enable shell tracing in this script
-At least one component (i.e. --tflite-delegate, --tflite-parser, --onnx-parser) must be provided or else provide --all to build all Arm NN components.
+At least one component (i.e. --tflite-classic-delegate, --tflite-opaque-delegate, --tflite-parser, --onnx-parser) must be provided or else provide --all to build all Arm NN components.
At least one backend (i.e. --neon-backend, --cl-backend, --ref-backend) must be chosen.
This script must be executed from the same root directory in which setup-armnn.sh was executed from.
@@ -239,7 +242,7 @@ Examples:
Build for aarch64 with all Arm NN components, NEON enabled and OpenCL enabled:
<PATH_TO>/build-armnn.sh --target-arch=aarch64 --all --neon-backend --cl-backend
Build for aarch64 with TF Lite Delegate, OpenCL enabled and additional ACL scons params:
- <PATH_TO>/build-armnn.sh --target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1,benchmark_examples=1'
+ <PATH_TO>/build-armnn.sh --target-arch=aarch64 --tflite-classic-delegate --cl-backend --acl-scons-params='compress_kernels=1,benchmark_examples=1'
Setup for aarch64 with all Arm NN dependencies, OpenCL enabled and additional Arm NN cmake args:
<PATH_TO>/build-armnn.sh --target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1,-DBUILD_UNIT_TESTS=0'
EOF
@@ -249,7 +252,8 @@ EOF
target_arch=""
# Default flag values
-flag_tflite_delegate=0
+flag_tflite_classic_delegate=0
+flag_tflite_opaque_delegate=0
flag_tflite_parser=0
flag_onnx_parser=0
flag_neon_backend=0
@@ -274,7 +278,7 @@ if [ $# -eq 0 ]; then
exit 1
fi
-args=$(getopt -ohx -l tflite-delegate,tflite-parser,onnx-parser,all,target-arch:,neon-backend,cl-backend,ref-backend,clean,debug,armnn-cmake-args:,acl-scons-params:,num-threads:,help -n "$name" -- "$@")
+args=$(getopt -ohx -l tflite-classic-delegate,tflite-opaque-delegate,tflite-parser,onnx-parser,all,target-arch:,neon-backend,cl-backend,ref-backend,clean,debug,armnn-cmake-args:,acl-scons-params:,num-threads:,help -n "$name" -- "$@")
eval set -- "$args"
while [ $# -gt 0 ]; do
if [ -n "${opt_prev:-}" ]; then
@@ -295,16 +299,21 @@ while [ $# -gt 0 ]; do
flag_tflite_parser=1
;;
- --tflite-delegate)
+ --tflite-classic-delegate)
flag_tflite_delegate=1
;;
+ --tflite-opaque-delegate)
+ flag_tflite_opaque_delegate=1
+ ;;
+
--onnx-parser)
flag_onnx_parser=1
;;
--all)
- flag_tflite_delegate=1
+ flag_tflite_classic_delegate=1
+ flag_tflite_opaque_delegate=1
flag_tflite_parser=1
flag_onnx_parser=1
;;
@@ -441,23 +450,24 @@ ARMNN_BUILD_TARGET="$ARMNN_BUILD_ROOT"/"$ARMNN_BUILD_DIR_NAME"
ACL_BUILD_TARGET="$BUILD_DIR"/acl/"$TARGET_ARCH"_build"$DEBUG_POSTFIX"
echo -e "\nINFO: Displaying configuration information before execution of $name"
-echo " target-arch: $TARGET_ARCH"
-echo " host-arch: $HOST_ARCH"
-echo " tflite-delegate: $flag_tflite_delegate"
-echo " tflite-parser: $flag_tflite_parser"
-echo " onnx-parser: $flag_onnx_parser"
-echo " neon-backend: $flag_neon_backend"
-echo " cl-backend: $flag_cl_backend"
-echo " ref-backend: $flag_ref_backend"
-echo " clean: $flag_clean"
-echo " debug: $flag_debug"
-echo "armnn-cmake-args: $armnn_cmake_args"
-echo "acl-scons-params: $acl_scons_params"
-echo " num-threads: $NUM_THREADS"
-echo " root directory: $ROOT_DIR"
-echo "source directory: $SOURCE_DIR"
-echo " build directory: $BUILD_DIR"
-echo " armnn build dir: $ARMNN_BUILD_TARGET"
+echo " target-arch: $TARGET_ARCH"
+echo " host-arch: $HOST_ARCH"
+echo "tflite-classic-delegate: $flag_tflite_classic_delegate"
+echo "tflite-opaque-delegate : $flag_tflite_opaque_delegate"
+echo " tflite-parser: $flag_tflite_parser"
+echo " onnx-parser: $flag_onnx_parser"
+echo " neon-backend: $flag_neon_backend"
+echo " cl-backend: $flag_cl_backend"
+echo " ref-backend: $flag_ref_backend"
+echo " clean: $flag_clean"
+echo " debug: $flag_debug"
+echo " armnn-cmake-args: $armnn_cmake_args"
+echo " acl-scons-params: $acl_scons_params"
+echo " num-threads: $NUM_THREADS"
+echo " root directory: $ROOT_DIR"
+echo " source directory: $SOURCE_DIR"
+echo " build directory: $BUILD_DIR"
+echo " armnn build dir: $ARMNN_BUILD_TARGET"
echo -e "\nScript execution will begin in 10 seconds..."
sleep 10
diff --git a/build-tool/scripts/setup-armnn.sh b/build-tool/scripts/setup-armnn.sh
index 9a398d5a46..156bb2fb95 100755
--- a/build-tool/scripts/setup-armnn.sh
+++ b/build-tool/scripts/setup-armnn.sh
@@ -215,8 +215,10 @@ usage()
cat <<EOF
setup-armnn.sh - Download and build Arm NN dependencies in the current directory (ROOT_DIR)
setup-armnn.sh [OPTION]...
- --tflite-delegate
- setup dependencies for the Arm NN TF Lite Delegate
+ --tflite-classic-delegate
+ setup dependencies for the existing Arm NN TF Lite Delegate
+ --tflite-opaque-delegate
+ setup dependencies for the new Opaque Delegate
--tflite-parser
setup dependencies for the Arm NN TF Lite Parser
--onnx-parser
@@ -232,15 +234,15 @@ setup-armnn.sh [OPTION]...
-x
enable shell tracing in this script
-At least one dependency flag (e.g. --tflite-delegate) must be provided or else provide --all to setup all dependencies.
+At least one dependency flag (e.g. --tflite-classic-delegate) must be provided or else provide --all to setup all dependencies.
Directories called "source" and "build" will be generated in the current directory (ROOT_DIR) from which this script is called.
It's recommended to call this script in a directory outside of this Arm NN source repo, to avoid nested repositories.
Examples:
Setup for aarch64 with all Arm NN dependencies:
<PATH_TO>/setup-armnn.sh --target-arch=aarch64 --all
-Setup for aarch64 with TF Lite Delegate and TF Lite Parser dependencies only:
- <PATH_TO>/setup-armnn.sh --target-arch=aarch64 --tflite-delegate --tflite-parser
+Setup for aarch64 with the existing TF Lite Delegate and TF Lite Parser dependencies only:
+ <PATH_TO>/setup-armnn.sh --target-arch=aarch64 --tflite-classic-delegate --tflite-parser
EOF
}
@@ -248,7 +250,8 @@ EOF
target_arch=""
# Default flag values
-flag_tflite_delegate=0
+flag_tflite_classic_delegate=0
+flag_tflite_opaque_delegate=0
flag_tflite_parser=0
flag_onnx_parser=0
@@ -263,7 +266,7 @@ if [ $# -eq 0 ]; then
exit 1
fi
-args=$(getopt -ohx -l tflite-delegate,tflite-parser,onnx-parser,all,target-arch:,num-threads:,help -n "$name" -- "$@")
+args=$(getopt -ohx -l tflite-classic-delegate,tflite-opaque-delegate,tflite-parser,onnx-parser,all,target-arch:,num-threads:,help -n "$name" -- "$@")
eval set -- "$args"
while [ $# -gt 0 ]; do
if [ -n "${opt_prev:-}" ]; then
@@ -284,8 +287,12 @@ while [ $# -gt 0 ]; do
flag_tflite_parser=1
;;
- --tflite-delegate)
- flag_tflite_delegate=1
+ --tflite-classic-delegate)
+ flag_tflite_classic_delegate=1
+ ;;
+
+ --tflite-opaque-delegate)
+ flag_tflite_opaque_delegate=1
;;
--onnx-parser)
@@ -293,7 +300,8 @@ while [ $# -gt 0 ]; do
;;
--all)
- flag_tflite_delegate=1
+ flag_tflite_classic_delegate=1
+ flag_tflite_opaque_delegate=1
flag_tflite_parser=1
flag_onnx_parser=1
;;
@@ -328,15 +336,16 @@ done
source "$rel_path"/common.sh
echo -e "\nINFO: Displaying configuration information before execution of $name"
-echo " target-arch: $TARGET_ARCH"
-echo " host-arch: $HOST_ARCH"
-echo " tflite-delegate: $flag_tflite_delegate"
-echo " tflite-parser: $flag_tflite_parser"
-echo " onnx-parser: $flag_onnx_parser"
-echo " num-threads: $NUM_THREADS"
-echo " root directory: $ROOT_DIR"
-echo "source directory: $SOURCE_DIR"
-echo " build directory: $BUILD_DIR"
+echo " target-arch: $TARGET_ARCH"
+echo " host-arch: $HOST_ARCH"
+echo "tflite-classic-delegate: $flag_tflite_classic_delegate"
+echo "tflite-opaque-delegate : $flag_tflite_opaque_delegate"
+echo " tflite-parser: $flag_tflite_parser"
+echo " onnx-parser: $flag_onnx_parser"
+echo " num-threads: $NUM_THREADS"
+echo " root directory: $ROOT_DIR"
+echo " source directory: $SOURCE_DIR"
+echo " build directory: $BUILD_DIR"
if check_if_repository .; then
echo -e "\n***** WARNING: Running script inside a git repository. To avoid nested repos, call this script from outside of this repo. *****"
@@ -349,7 +358,7 @@ sleep 10
mkdir -p "$SOURCE_DIR"
mkdir -p "$BUILD_DIR"
-if [ "$flag_tflite_delegate" -eq 1 ] || [ "$flag_tflite_parser" -eq 1 ]; then
+if [ "$flag_tflite_classic_delegate" -eq 1 ] || [ "$flag_tflite_opaque_delegate" -eq 1 ] || [ "$flag_tflite_parser" -eq 1 ]; then
download_flatbuffers
# Host build
@@ -367,7 +376,7 @@ if [ "$flag_tflite_parser" -eq 1 ]; then
generate_tflite_schema
fi
-if [ "$flag_tflite_delegate" -eq 1 ]; then
+if [ "$flag_tflite_classic_delegate" -eq 1 ] || [ "$flag_tflite_opaque_delegate" -eq 1 ]; then
build_tflite
fi
diff --git a/build-tool/scripts/validation.sh b/build-tool/scripts/validation.sh
index 7928952577..12988b6ae8 100755
--- a/build-tool/scripts/validation.sh
+++ b/build-tool/scripts/validation.sh
@@ -34,7 +34,7 @@ fi
# Validation of chosen Arm NN dependencies
if [ "$flag_tflite_delegate" -eq 0 ] && [ "$flag_tflite_parser" -eq 0 ] && [ "$flag_onnx_parser" -eq 0 ]; then
- echo "$name: at least one of flags --tflite-delegate, --tflite-parser or --onnx-parser must be set (or --all)."
+ echo "$name: at least one of flags --tflite-classic-delegate, --tflite-opaque-delegate, --tflite-parser or --onnx-parser must be set (or --all)."
exit 1
fi