blob: 63209bf118ef209ecd6838944f9e11b094ea12ad [file] [log] [blame]
jimfly0134d6dd72018-11-15 15:46:11 +00001#!/bin/bash
2#
3# Copyright © 2017 Arm Ltd. All rights reserved.
4# SPDX-License-Identifier: MIT
5#
6
James Conroy04cd6032022-04-20 17:16:50 +01007CMD=$( basename "$0" )
jimfly0134d6dd72018-11-15 15:46:11 +00008
Francis Murtagh842e0db2020-01-09 14:24:11 +00009# For pinning to a ref use this:
Nikhil Raj30061c52022-08-29 09:37:57 +010010#DEFAULT_CLFRAMEWORKREVISION="branches/arm_compute_22_08" # Release 22.08
Jim Flynn82fbe7c2019-04-02 15:19:08 +010011#
12# For pinning to a revision use this:
Nikhil Raj30061c52022-08-29 09:37:57 +010013DEFAULT_CLFRAMEWORKREVISION="a331e48ad8a4856837cf0afdd44de69af43581af" #Fix add for tensors with non-matching strides
Jim Flynn82fbe7c2019-04-02 15:19:08 +010014
jimfly0134d6dd72018-11-15 15:46:11 +000015usage() {
Jim Flynn82fbe7c2019-04-02 15:19:08 +010016 echo "Usage: $CMD (Use the default clframework SHA)"
17 echo "Usage: $CMD -s <CLFRAMEWORK_SHA>"
18 echo "Usage: $CMD -p (Print current default clframework SHA)"
Jim Flynn774f6f12019-04-11 13:10:46 +010019 exit 0
jimfly0134d6dd72018-11-15 15:46:11 +000020}
21
Jim Flynn82fbe7c2019-04-02 15:19:08 +010022PrintDefaultClframeworkSha() {
23 echo $DEFAULT_CLFRAMEWORKREVISION
Jim Flynn774f6f12019-04-11 13:10:46 +010024 exit 0;
Jim Flynn82fbe7c2019-04-02 15:19:08 +010025}
26
jimfly0134d6dd72018-11-15 15:46:11 +000027function AssertZeroExitCode {
28 EXITCODE=$?
29 if [ $EXITCODE -ne 0 ]; then
30 echo "$1"
31 echo "+++ Command exited with code $EXITCODE. Please fix the above errors and re-run"
32 exit 1
33 fi
34}
35
36# process the options given
James Conroy04cd6032022-04-20 17:16:50 +010037while getopts "s:ph" opt; do
jimfly0134d6dd72018-11-15 15:46:11 +000038 case "$opt" in
Jim Flynn82fbe7c2019-04-02 15:19:08 +010039 s) CLFRAMEWORK_SHA="$OPTARG";;
40 p) PrintDefaultClframeworkSha;;
jimfly0134d6dd72018-11-15 15:46:11 +000041 h|\?) usage;;
42 esac
43done
44shift $((OPTIND - 1))
45
46#
47# This script is designed to be called from anywhere
48# so it will resolve where to checkout out the clframework
49# relative to its own location in armnn/scripts
50#
51SRC="${BASH_SOURCE[0]}"
52# resolve $SRC until it is no longer a symlink
53while [ -h "$SRC" ]; do
54 DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
55 SRC="$(readlink "$SRC")"
56 # if $SRC was a relative symlink, we need to resolve it
57 # relative to the path where the symlink file originally was
58 [[ $SRC != /* ]] && SRC="$DIR/$SRC"
59done
60DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
James Conroy04cd6032022-04-20 17:16:50 +010061pushd "${DIR}" > /dev/null
62# shellcheck disable=SC2164
jimfly0134d6dd72018-11-15 15:46:11 +000063cd ../..
jimfly0134d6dd72018-11-15 15:46:11 +000064
65if [ ! -d clframework ]; then
Matthew Bentham6e2f6062019-01-23 15:23:13 +000066 git clone https://review.mlplatform.org/ml/ComputeLibrary clframework
jimfly0134d6dd72018-11-15 15:46:11 +000067 AssertZeroExitCode "Cloning CL Framework failed"
68fi
69pushd clframework > /dev/null
70
Jim Flynn82fbe7c2019-04-02 15:19:08 +010071CLFRAMEWORKREVISION=$DEFAULT_CLFRAMEWORKREVISION
72if [ ! -z "$CLFRAMEWORK_SHA" ]; then
73 CLFRAMEWORKREVISION=$CLFRAMEWORK_SHA
74fi
jimfly0134d6dd72018-11-15 15:46:11 +000075
James Conroy04cd6032022-04-20 17:16:50 +010076git fetch && git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout "${CLFRAMEWORKREVISION}"
Jim Flynn82fbe7c2019-04-02 15:19:08 +010077AssertZeroExitCode "Fetching and checking out ${CLFRAMEWORKREVISION} failed"
Colm Donelan5ed3bc52021-08-19 11:26:04 +010078# If the target ACL revision includes a branch we also need to do a pull.
79# This generally occurs with a release branch.
80if [[ "${CLFRAMEWORKREVISION}" == *"branches"* ]]; then
81 git pull
82 AssertZeroExitCode "ACL reference includes a branch but git pull failed."
83fi
jimfly0134d6dd72018-11-15 15:46:11 +000084
85# Set commit hook so we can submit reviews to gerrit
James Conroy04cd6032022-04-20 17:16:50 +010086# shellcheck disable=SC2006
87(curl -Lo "$(git rev-parse --git-dir)"/hooks/commit-msg https://review.mlplatform.org/tools/hooks/commit-msg; chmod +x "$(git rev-parse --git-dir)"/hooks/commit-msg)
Jim Flynn82fbe7c2019-04-02 15:19:08 +010088AssertZeroExitCode "Setting commit hooks failed"
jimfly0134d6dd72018-11-15 15:46:11 +000089
90popd > /dev/null # out of clframework
91popd > /dev/null # back to wherever we were when called
Jim Flynn82fbe7c2019-04-02 15:19:08 +010092# Make sure the SHA of the revision that was checked out is the last line
93# of output from the script... just in case we ever need it.
James Conroy04cd6032022-04-20 17:16:50 +010094echo "$CLFRAMEWORKREVISION"
jimfly0134d6dd72018-11-15 15:46:11 +000095exit 0