From 6c1f4b0643687dc9099ed81086d8ccdda8e0c557 Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Fri, 11 Jun 2021 11:30:14 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Docker=20env=20for=20Arm=C2=AE=20Ethos?= =?UTF-8?q?=E2=84=A2-U55=20Port?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added Arm® Corstone™-300 Reference System for testing * Added Arm® Ethos™-U driver stack * Added installation of Arm® Vela. Co-authored-by: Manupa Karunaratne Change-Id: Ie3cc43943c876d95618a39887aa666da20bcb1e4 --- docker/Dockerfile.ci_cpu | 10 ++ .../ubuntu_install_ethosu_driver_stack.sh | 93 +++++++++++++++++++ docker/install/ubuntu_install_vela.sh | 24 +++++ 3 files changed, 127 insertions(+) create mode 100755 docker/install/ubuntu_install_ethosu_driver_stack.sh create mode 100644 docker/install/ubuntu_install_vela.sh diff --git a/docker/Dockerfile.ci_cpu b/docker/Dockerfile.ci_cpu index 65afa6931d9c..65996e13db35 100644 --- a/docker/Dockerfile.ci_cpu +++ b/docker/Dockerfile.ci_cpu @@ -109,3 +109,13 @@ RUN bash /install/ubuntu_install_androidsdk.sh ENV ANDROID_HOME=/opt/android-sdk-linux/ ENV ANDROID_NDK_HOME=/opt/android-sdk-linux/ndk/21.3.6528147/ +# Arm(R) Ethos(TM)-U NPU driver +COPY install/ubuntu_install_ethosu_driver_stack.sh /install/ubuntu_install_ethosu_driver_stack.sh +RUN bash /install/ubuntu_install_ethosu_driver_stack.sh + +# Install Vela compiler +COPY install/ubuntu_install_vela.sh /install/ubuntu_install_vela.sh +RUN bash /install/ubuntu_install_vela.sh + +# Update PATH +ENV PATH /opt/arm/bin:/opt/arm/cmake/bin:/opt/arm/gcc-arm-none-eabi/bin:$PATH diff --git a/docker/install/ubuntu_install_ethosu_driver_stack.sh b/docker/install/ubuntu_install_ethosu_driver_stack.sh new file mode 100755 index 000000000000..7996a25a1eab --- /dev/null +++ b/docker/install/ubuntu_install_ethosu_driver_stack.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e +set -u +set -o pipefail + +fvp_dir="/opt/arm/FVP_Corstone_SSE-300_Ethos-U55" +cmake_dir="/opt/arm/cmake" +ethosu_dir="/opt/arm/ethosu" + +mkdir -p /opt/arm + +tmpdir=$(mktemp -d) + +cleanup() +{ + rm -rf "$tmpdir" +} + +trap cleanup 0 + +# Ubuntu 18.04 dependencies +apt-get update + +apt-get install -y \ + bsdmainutils \ + build-essential \ + cpp \ + git \ + linux-headers-generic \ + make \ + python-dev \ + python3 \ + ssh \ + wget \ + xxd + +# Download the FVP +mkdir -p "$fvp_dir" +cd "$tmpdir" +curl -sL https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/Corstone-300/MPS3/FVP_Corstone_SSE-300_Ethos-U55_11.14_24.tgz | tar -xz +./FVP_Corstone_SSE-300_Ethos-U55.sh --i-agree-to-the-contained-eula --no-interactive -d "$fvp_dir" +rm -rf FVP_Corstone_SSE-300_Ethos-U55.sh license_terms + +# Setup cmake 3.19.5 +mkdir -p "${cmake_dir}" +cd "$tmpdir" +curl -sL -o cmake-3.19.5-Linux-x86_64.sh https://github.com/Kitware/CMake/releases/download/v3.19.5/cmake-3.19.5-Linux-x86_64.sh +chmod +x cmake-3.19.5-Linux-x86_64.sh +./cmake-3.19.5-Linux-x86_64.sh --prefix="${cmake_dir}" --skip-license +rm cmake-3.19.5-Linux-x86_64.sh +export PATH="${cmake_dir}/bin:${PATH}" + +# Install the GCC toolchain +mkdir -p /opt/arm/gcc-arm-none-eabi/ +gcc_arm_url='https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2?revision=ca0cbf9c-9de2-491c-ac48-898b5bbc0443&la=en&hash=68760A8AE66026BCF99F05AC017A6A50C6FD832A' +curl --retry 64 -sSL ${gcc_arm_url} | tar -C /opt/arm/gcc-arm-none-eabi --strip-components=1 -jx +export PATH="/opt/arm/gcc-arm-none-eabi/bin:${PATH}" + +# Clone Arm(R) Ethos(TM)-U NPU driver stack +cd / +mkdir "${ethosu_dir}" +cd "${ethosu_dir}" +git clone "https://review.mlplatform.org/ml/ethos-u/ethos-u-core-driver" core_driver +cd core_driver +git checkout tags/21.05 + +cd "${ethosu_dir}" +git clone "https://review.mlplatform.org/ml/ethos-u/ethos-u-core-platform" core_platform +cd core_platform +git checkout tags/21.05 + +# Clone CMSIS +cd "${ethosu_dir}" +git clone "https://github.com/ARM-software/CMSIS_5.git" cmsis +cd cmsis +git checkout -f tags/5.7.0 \ No newline at end of file diff --git a/docker/install/ubuntu_install_vela.sh b/docker/install/ubuntu_install_vela.sh new file mode 100644 index 000000000000..a78fdd145431 --- /dev/null +++ b/docker/install/ubuntu_install_vela.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e +set -u +set -o pipefail + +pip3 install -U setuptools +pip3 install ethos-u-vela==2.1.1 From 771e933c4f3648a9ce67b896346c0a2c0bd86ab0 Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Thu, 22 Jul 2021 10:54:13 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Docker=20env=20for=20Arm=C2=AE=20Ethos?= =?UTF-8?q?=E2=84=A2-U55=20Port?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Removes /opt/arm/cmake/bin from the path * Parameterizes Arm® Ethos™-U55 driver stack version number Change-Id: I2162b40f82241fd013643cbfa8847b60d7f4f5a1 --- docker/Dockerfile.ci_cpu | 2 +- docker/install/ubuntu_install_ethosu_driver_stack.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.ci_cpu b/docker/Dockerfile.ci_cpu index 65996e13db35..1b276ffd70dd 100644 --- a/docker/Dockerfile.ci_cpu +++ b/docker/Dockerfile.ci_cpu @@ -118,4 +118,4 @@ COPY install/ubuntu_install_vela.sh /install/ubuntu_install_vela.sh RUN bash /install/ubuntu_install_vela.sh # Update PATH -ENV PATH /opt/arm/bin:/opt/arm/cmake/bin:/opt/arm/gcc-arm-none-eabi/bin:$PATH +ENV PATH /opt/arm/bin:/opt/arm/gcc-arm-none-eabi/bin:$PATH diff --git a/docker/install/ubuntu_install_ethosu_driver_stack.sh b/docker/install/ubuntu_install_ethosu_driver_stack.sh index 7996a25a1eab..0e96c5e0ee2f 100755 --- a/docker/install/ubuntu_install_ethosu_driver_stack.sh +++ b/docker/install/ubuntu_install_ethosu_driver_stack.sh @@ -23,6 +23,7 @@ set -o pipefail fvp_dir="/opt/arm/FVP_Corstone_SSE-300_Ethos-U55" cmake_dir="/opt/arm/cmake" ethosu_dir="/opt/arm/ethosu" +ethosu_driver_ver="21.05" mkdir -p /opt/arm @@ -79,15 +80,15 @@ mkdir "${ethosu_dir}" cd "${ethosu_dir}" git clone "https://review.mlplatform.org/ml/ethos-u/ethos-u-core-driver" core_driver cd core_driver -git checkout tags/21.05 +git checkout tags/${ethosu_driver_ver} cd "${ethosu_dir}" git clone "https://review.mlplatform.org/ml/ethos-u/ethos-u-core-platform" core_platform cd core_platform -git checkout tags/21.05 +git checkout tags/${ethosu_driver_ver} # Clone CMSIS cd "${ethosu_dir}" git clone "https://github.com/ARM-software/CMSIS_5.git" cmsis cd cmsis -git checkout -f tags/5.7.0 \ No newline at end of file +git checkout -f tags/5.7.0 From f820b1e27147468e22f6b4a6f26c92e61cde71cc Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Thu, 22 Jul 2021 10:54:13 +0100 Subject: [PATCH 3/4] =?UTF-8?q?Docker=20env=20for=20Arm=C2=AE=20Ethos?= =?UTF-8?q?=E2=84=A2-U55=20Port?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds ethosu as an extra to /python/gen_requirements.py Change-Id: I2162b40f82241fd013643cbfa8847b60d7f4f5a1 --- docker/Dockerfile.ci_cpu | 2 +- docker/install/ubuntu_install_ethosu_driver_stack.sh | 4 ++-- python/gen_requirements.py | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.ci_cpu b/docker/Dockerfile.ci_cpu index 1b276ffd70dd..11b6078a0675 100644 --- a/docker/Dockerfile.ci_cpu +++ b/docker/Dockerfile.ci_cpu @@ -118,4 +118,4 @@ COPY install/ubuntu_install_vela.sh /install/ubuntu_install_vela.sh RUN bash /install/ubuntu_install_vela.sh # Update PATH -ENV PATH /opt/arm/bin:/opt/arm/gcc-arm-none-eabi/bin:$PATH +ENV PATH /opt/arm/gcc-arm-none-eabi/bin:$PATH diff --git a/docker/install/ubuntu_install_ethosu_driver_stack.sh b/docker/install/ubuntu_install_ethosu_driver_stack.sh index 0e96c5e0ee2f..35b2b4c74b7b 100755 --- a/docker/install/ubuntu_install_ethosu_driver_stack.sh +++ b/docker/install/ubuntu_install_ethosu_driver_stack.sh @@ -24,6 +24,7 @@ fvp_dir="/opt/arm/FVP_Corstone_SSE-300_Ethos-U55" cmake_dir="/opt/arm/cmake" ethosu_dir="/opt/arm/ethosu" ethosu_driver_ver="21.05" +cmsis_ver="5.7.0" mkdir -p /opt/arm @@ -75,7 +76,6 @@ curl --retry 64 -sSL ${gcc_arm_url} | tar -C /opt/arm/gcc-arm-none-eabi --strip- export PATH="/opt/arm/gcc-arm-none-eabi/bin:${PATH}" # Clone Arm(R) Ethos(TM)-U NPU driver stack -cd / mkdir "${ethosu_dir}" cd "${ethosu_dir}" git clone "https://review.mlplatform.org/ml/ethos-u/ethos-u-core-driver" core_driver @@ -91,4 +91,4 @@ git checkout tags/${ethosu_driver_ver} cd "${ethosu_dir}" git clone "https://github.com/ARM-software/CMSIS_5.git" cmsis cd cmsis -git checkout -f tags/5.7.0 +git checkout -f tags/${cmsis_ver} diff --git a/python/gen_requirements.py b/python/gen_requirements.py index b3a199ee1390..dac435146469 100755 --- a/python/gen_requirements.py +++ b/python/gen_requirements.py @@ -75,6 +75,16 @@ ], ), ), + # Provide support for Arm(R) Ethos(TM)-U NPU. + ( + "ethosu", + ( + "Requirements for using Arm(R) Ethos(TM)-U NPU", + [ + "ethos-u-vela", + ], + ), + ), # Relay frontends. ( "importer-caffe2", @@ -205,6 +215,7 @@ "docutils", "<0.17", ), # Work around https://github.com/readthedocs/sphinx_rtd_theme/issues/1115 + ("ethos-u-vela", "==2.1.1"), ("future", None), ("image", None), ("matplotlib", None), From bdd08371da0dbe024286f8c8080b83cda19a3a9d Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Thu, 29 Jul 2021 18:39:08 +0100 Subject: [PATCH 4/4] =?UTF-8?q?Docker=20env=20for=20Arm=C2=AE=20Ethos?= =?UTF-8?q?=E2=84=A2-U55=20Port?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added comment explaining why Vela version needs to be pinned to 2.1.1 Change-Id: I1ade280faa5274cca78899f4dae9e596b16fb5df --- docker/install/ubuntu_install_vela.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/install/ubuntu_install_vela.sh b/docker/install/ubuntu_install_vela.sh index a78fdd145431..e75a99d9d563 100644 --- a/docker/install/ubuntu_install_vela.sh +++ b/docker/install/ubuntu_install_vela.sh @@ -21,4 +21,7 @@ set -u set -o pipefail pip3 install -U setuptools +# In a refactor between v2.1.1 and v3.0.0, find_block_configs was removed from Vela. +# Since this is still required for the TVM port, it will be reinstated in Vela in a future release. +# Until then, it needs to be pinned to v2.1.1. pip3 install ethos-u-vela==2.1.1