Implement SIMD latest opcodes and update LLVM to 13.0 (#758)

Implement the latest SIMD opcodes and update LLVM 13.0,
update the llvm build scripts, update the sample workloads‘ build scripts,
and build customized wasi-sdk to build some workloads.
Also refine the CI rules.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-09-17 19:12:57 +08:00
committed by GitHub
parent 7e60a5db8d
commit 7be0d385a6
82 changed files with 5266 additions and 4698 deletions

View File

@ -1 +0,0 @@
build_scripts

View File

@ -1,93 +0,0 @@
FROM ubuntu:18.04 as builder
RUN apt update \
&& apt install -y lsb-release software-properties-common build-essential \
wget curl git tree zip unzip
ARG WASI_SDK_VER=12
ARG WABT_VER=1.0.23
ARG CMAKE_VER=3.16.2
ARG BINARYEN_VER=version_101
#
# install wasi-sdk
ARG WASI_SDK_FILE="wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz"
COPY ${WASI_SDK_FILE} /opt
RUN cd /opt \
&& tar zxf ${WASI_SDK_FILE} \
&& rm ${WASI_SDK_FILE} \
&& ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk
#
# install wabt
ARG WABT_FILE="wabt-${WABT_VER}-ubuntu.tar.gz"
COPY ${WABT_FILE} /opt
RUN cd /opt \
&& tar zxf ${WABT_FILE} \
&& rm ${WABT_FILE} \
&& ln -sf /opt/wabt-${WABT_VER} /opt/wabt
#
# install cmake
ARG CMAKE_FILE="cmake-${CMAKE_VER}-Linux-x86_64.sh"
COPY ${CMAKE_FILE} /tmp
RUN cd /tmp \
&& chmod a+x ${CMAKE_FILE} \
&& mkdir /opt/cmake \
&& ./${CMAKE_FILE} --prefix=/opt/cmake --skip-license \
&& ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake
#
# install emsdk
RUN cd /opt \
&& git clone https://github.com/emscripten-core/emsdk.git \
&& cd emsdk \
&& git pull \
&& ./emsdk install 2.0.12 \
&& ./emsdk activate 2.0.12 \
&& echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
#
# install binaryen
ARG BINARYEN_FILE="binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz"
COPY ${BINARYEN_FILE} /opt
RUN cd /opt \
&& tar zxf ${BINARYEN_FILE} \
&& rm ${BINARYEN_FILE} \
&& ln -sf /opt/binaryen-${BINARYEN_VER} /opt/binaryen
#
# install bazelisk
ARG BAZEL_FILE="bazelisk-linux-amd64"
COPY ${BAZEL_FILE} /opt/bazelisk/bin/bazelisk
RUN cd /opt/bazelisk/bin/ \
&& chmod a+x bazelisk \
&& ln -sf /opt/bazelisk/bin/bazelisk /usr/local/bin/bazel
RUN apt update \
&& apt install -y python2.7-minimal
#
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*
VOLUME /data
#
#
RUN touch /build.sh \
&& echo "\
#!/bin/bash \n\
if [[ -d /data/project/build ]]; then \n\
rm -r /data/project/build \n\
fi \n\
mkdir /data/project/build \n\
cd /data/project/build \n\
source /opt/emsdk/emsdk_env.sh \n\
cmake .. \n\
make \n\
cd - > /dev/null" > /build.sh \
&& chmod a+x /build.sh

View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
readonly SCRIPT_PATH=$(dirname "$(realpath "$0")")
readonly ROOT=$(realpath "${SCRIPT_PATH}"/../../../)
readonly CURRENT_PATH=$(pwd)
readonly CURRENT_RELATIVE_ROOT=$(realpath --relative-base ${ROOT} ${CURRENT_PATH})
readonly VARIANT=$(lsb_release -c | awk '{print $2}')
docker build \
--build-arg VARIANT=${VARIANT} \
--memory 4G --cpu-quota 50000 \
-t wamr_dev_${VARIANT}:0.1 -f "${ROOT}"/ci/Dockerfile "${ROOT}"/ci &&
docker run --rm -it \
--memory 4G \
--cpus ".5" \
--name workload_build_env \
--mount type=bind,source="${ROOT}",target=/workspace \
wamr_dev_${VARIANT}:0.1 \
/bin/bash -c "\
pwd \
&& pushd ${CURRENT_RELATIVE_ROOT} \
&& rm -rf build \
&& mkdir build \
&& pushd build \
&& cmake .. \
&& cmake --build . --config Release \
&& popd \
&& popd \
&& echo 'Go and find out results under ${CURRENT_RELATIVE_ROOT}/build' "

View File

@ -1,53 +0,0 @@
#!/usr/bin/env bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
readonly BUILD_CONTENT="/tmp/build_content"
if [[ ! -d ${BUILD_CONTENT} ]]; then
mkdir ${BUILD_CONTENT}
fi
readonly WASI_SDK_VER=12
readonly WABT_VER=1.0.23
readonly CMAKE_VER=3.16.2
readonly BINARYEN_VER=version_101
readonly BAZELISK_VER=1.7.5
cd ${BUILD_CONTENT} || exit
if [[ ! -f wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz ]]; then
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
fi
if [[ ! -f wabt-${WABT_VER}-ubuntu.tar.gz ]]; then
wget https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz
fi
if [[ ! -f cmake-${CMAKE_VER}-Linux-x86_64.sh ]]; then
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh
fi
if [[ ! -f binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz ]]; then
wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VER}/binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz
fi
if [[ ! -f bazelisk-linux-amd64 ]]; then
wget https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64
fi
cd - > /dev/null || exit
DOCKERFILE_PATH=$(dirname "$(realpath "$0")")
docker build \
--build-arg WASI_SDK_VER=${WASI_SDK_VER} \
--build-arg WABT_VER=${WABT_VER} \
--build-arg CMAKE_VER=${CMAKE_VER} \
--build-arg BINARYEN_VER=${BINARYEN_VER} \
-t wamr_workload_env:0.1 -f "${DOCKERFILE_PATH}"/Dockerfile ${BUILD_CONTENT} \
&& docker run --rm \
--name workload_w_clang \
--mount type=bind,source="$(pwd)",target=/data/project \
-w /data/project \
wamr_workload_env:0.1 \
/bin/bash -c /build.sh