Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docker/Dockerfile.ci_cpu
Original file line number Diff line number Diff line change
Expand Up @@ -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/gcc-arm-none-eabi/bin:$PATH
94 changes: 94 additions & 0 deletions docker/install/ubuntu_install_ethosu_driver_stack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/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"
ethosu_driver_ver="21.05"
cmsis_ver="5.7.0"

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
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/${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/${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/${cmsis_ver}
27 changes: 27 additions & 0 deletions docker/install/ubuntu_install_vela.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/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
# In a refactor between v2.1.1 and v3.0.0, find_block_configs <appropriate function name> 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add this dependency to python/gen_requirements.py as an ethosu extra?

also, our policy for python deps here has generally been to not specify a version (this way as containers are rebuilt, we add in the work needed to maintain compatibility with the latest version). is there a functional reason why we must have 2.1.1 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added Vela as an ethosu extra to python/gen_requirements.py now.

Vela 2.1.1 is the version that is currently supported and we know we have some issues with later versions which need fixes that are being worked on. But until that happens, we really do need this pinned at 2.1.1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok great. is there any further context you can provide publicly (or link to a tracking bug) describing issues with the 3.0.0 release or tracking the effort to be compatible with latest ethos-u-vela? i'd like to place a pointer in the code (in comment) so that interested readers can follow-up if desired

Copy link
Contributor Author

@grant-arm grant-arm Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Andrew, unfortunately we don't have a publicly available bug for tracking this issue.
I have however added a comment to ubuntu_install_vela.sh explaining what the issue is and why we currently need Vela pinned to 2.1.1. I hope that helps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @grant-arm!

11 changes: 11 additions & 0 deletions python/gen_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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),
Expand Down