jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright © 2017 Arm Ltd. All rights reserved. |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
| 7 | CMD=$( basename $0 ) |
| 8 | |
Francis Murtagh | 842e0db | 2020-01-09 14:24:11 +0000 | [diff] [blame] | 9 | # For pinning to a ref use this: |
Teresa Charlin | 624b5a3 | 2022-02-22 10:44:38 +0000 | [diff] [blame] | 10 | #DEFAULT_CLFRAMEWORKREVISION="branches/arm_compute_22_02" # Release 22.02 |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 11 | # |
| 12 | # For pinning to a revision use this: |
Teresa Charlin | fd12afb | 2022-03-04 16:29:21 +0000 | [diff] [blame] | 13 | DEFAULT_CLFRAMEWORKREVISION="4cbcb840caca1346de5f2271b67e4ede17b72734" #Removing SVE / SVE2 guards from decoupled kernels |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 14 | |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 15 | usage() { |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 16 | 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 Flynn | 774f6f1 | 2019-04-11 13:10:46 +0100 | [diff] [blame] | 19 | exit 0 |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 20 | } |
| 21 | |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 22 | PrintDefaultClframeworkSha() { |
| 23 | echo $DEFAULT_CLFRAMEWORKREVISION |
Jim Flynn | 774f6f1 | 2019-04-11 13:10:46 +0100 | [diff] [blame] | 24 | exit 0; |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 25 | } |
| 26 | |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 27 | function 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 |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 37 | while getopts "s:phg:" opt; do |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 38 | case "$opt" in |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 39 | s) CLFRAMEWORK_SHA="$OPTARG";; |
| 40 | p) PrintDefaultClframeworkSha;; |
| 41 | g) DUMMY="$OPTARG";; # continue to accept -g for backward compatibility |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 42 | h|\?) usage;; |
| 43 | esac |
| 44 | done |
| 45 | shift $((OPTIND - 1)) |
| 46 | |
| 47 | # |
| 48 | # This script is designed to be called from anywhere |
| 49 | # so it will resolve where to checkout out the clframework |
| 50 | # relative to its own location in armnn/scripts |
| 51 | # |
| 52 | SRC="${BASH_SOURCE[0]}" |
| 53 | # resolve $SRC until it is no longer a symlink |
| 54 | while [ -h "$SRC" ]; do |
| 55 | DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )" |
| 56 | SRC="$(readlink "$SRC")" |
| 57 | # if $SRC was a relative symlink, we need to resolve it |
| 58 | # relative to the path where the symlink file originally was |
| 59 | [[ $SRC != /* ]] && SRC="$DIR/$SRC" |
| 60 | done |
| 61 | DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )" |
| 62 | pushd ${DIR} > /dev/null |
| 63 | cd ../.. |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 64 | |
| 65 | if [ ! -d clframework ]; then |
Matthew Bentham | 6e2f606 | 2019-01-23 15:23:13 +0000 | [diff] [blame] | 66 | git clone https://review.mlplatform.org/ml/ComputeLibrary clframework |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 67 | AssertZeroExitCode "Cloning CL Framework failed" |
| 68 | fi |
| 69 | pushd clframework > /dev/null |
| 70 | |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 71 | CLFRAMEWORKREVISION=$DEFAULT_CLFRAMEWORKREVISION |
| 72 | if [ ! -z "$CLFRAMEWORK_SHA" ]; then |
| 73 | CLFRAMEWORKREVISION=$CLFRAMEWORK_SHA |
| 74 | fi |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 75 | |
Matteo Martincigh | c1001c6 | 2019-05-23 16:03:55 +0100 | [diff] [blame] | 76 | git fetch && git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout ${CLFRAMEWORKREVISION} |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 77 | AssertZeroExitCode "Fetching and checking out ${CLFRAMEWORKREVISION} failed" |
Colm Donelan | 5ed3bc5 | 2021-08-19 11:26:04 +0100 | [diff] [blame] | 78 | # If the target ACL revision includes a branch we also need to do a pull. |
| 79 | # This generally occurs with a release branch. |
| 80 | if [[ "${CLFRAMEWORKREVISION}" == *"branches"* ]]; then |
| 81 | git pull |
| 82 | AssertZeroExitCode "ACL reference includes a branch but git pull failed." |
| 83 | fi |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 84 | |
| 85 | # Set commit hook so we can submit reviews to gerrit |
Matthew Bentham | 6e2f606 | 2019-01-23 15:23:13 +0000 | [diff] [blame] | 86 | (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 Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 87 | AssertZeroExitCode "Setting commit hooks failed" |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 88 | |
| 89 | popd > /dev/null # out of clframework |
| 90 | popd > /dev/null # back to wherever we were when called |
Jim Flynn | 82fbe7c | 2019-04-02 15:19:08 +0100 | [diff] [blame] | 91 | # Make sure the SHA of the revision that was checked out is the last line |
| 92 | # of output from the script... just in case we ever need it. |
| 93 | echo $CLFRAMEWORKREVISION |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 94 | exit 0 |