Update ACL pin to 16cf3c2318978580006633ea4d5eccdd8ba1194a
[platform/upstream/armnn.git] / scripts / get_compute_library.sh
index d7c2f77..45b7c0b 100755 (executable)
@@ -6,9 +6,22 @@
 
 CMD=$( basename $0 )
 
+# For pinning to a ref use this:
+#DEFAULT_CLFRAMEWORKREVISION="branches/arm_compute_20_08" # Release 20.08
+#
+# For pinning to a revision use this:
+DEFAULT_CLFRAMEWORKREVISION="16cf3c2318978580006633ea4d5eccdd8ba1194a" #COMPMID-3764: Failures on fp16 for L2NormalizationLayer when zero inputs.
+
 usage() {
-  echo "Usage: $CMD -g <GITHUB_USERNAME>"
-  exit 1
+    echo "Usage: $CMD (Use the default clframework SHA)"
+    echo "Usage: $CMD -s <CLFRAMEWORK_SHA>"
+    echo "Usage: $CMD -p (Print current default clframework SHA)"
+  exit 0
+}
+
+PrintDefaultClframeworkSha() {
+  echo $DEFAULT_CLFRAMEWORKREVISION
+  exit 0;
 }
 
 function AssertZeroExitCode {
@@ -21,9 +34,11 @@ function AssertZeroExitCode {
 }
 
 # process the options given
-while getopts "g:h" opt; do
+while getopts "s:phg:" opt; do
   case "$opt" in
-    g) GITHUB_USERNAME="$OPTARG";;
+    s) CLFRAMEWORK_SHA="$OPTARG";;
+    p) PrintDefaultClframeworkSha;;
+    g) DUMMY="$OPTARG";; # continue to accept -g for backward compatibility
     h|\?) usage;;
   esac
 done
@@ -46,36 +61,28 @@ done
 DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
 pushd ${DIR} > /dev/null
 cd ../..
-if [ -z "$USERNAME" ]; then
-    USERNAME=$USER
-fi
-if [ -z "$GITHUB_USERNAME" ]; then
-    GITHUB_USERNAME=$USERNAME
-    echo "setting GITHUB_USERNAME: ${GITHUB_USERNAME} use -g command line option to change"
-fi
 
 if [ ! -d clframework ]; then
-echo "+++ Cloning clframework"
   git clone https://review.mlplatform.org/ml/ComputeLibrary clframework
   AssertZeroExitCode "Cloning CL Framework failed"
 fi
 pushd clframework > /dev/null
 
-# Use the latest pinned version of the CL framework
-
-# For pinnning to a ref use this:
-# CLFRAMEWORKREVISION="branches/arm_compute_18_11" # Release 18.11
-# git fetch  https://review.mlplatform.org/ml/ComputeLibrary $CLFRAMEWORKREVISION && git checkout FETCH_HEAD
+CLFRAMEWORKREVISION=$DEFAULT_CLFRAMEWORKREVISION
+if [ ! -z "$CLFRAMEWORK_SHA" ]; then
+    CLFRAMEWORKREVISION=$CLFRAMEWORK_SHA
+fi
 
-# For pinning to a revision use this:
-CLFRAMEWORKREVISION="e8c0c4397a508169282e5859410d5d6cdc87edbe" # Master towards 19.02
-git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout ${CLFRAMEWORKREVISION}
-AssertZeroExitCode
+git fetch && git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout ${CLFRAMEWORKREVISION}
+AssertZeroExitCode "Fetching and checking out ${CLFRAMEWORKREVISION} failed"
 
 # Set commit hook so we can submit reviews to gerrit
 (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)
-AssertZeroExitCode
+AssertZeroExitCode "Setting commit hooks failed"
 
 popd > /dev/null # out of clframework
 popd > /dev/null # back to wherever we were when called
+# Make sure the SHA of the revision that was checked out is the last line
+# of output from the script... just in case we ever need it.
+echo $CLFRAMEWORKREVISION
 exit 0