Skip to content

Commit

Permalink
github: workflows: Enable aarch64 CI (#2142)
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza Butt <[email protected]>
  • Loading branch information
theComputeKid authored Oct 3, 2024
1 parent 0306ffd commit 16780c2
Show file tree
Hide file tree
Showing 6 changed files with 402 additions and 44 deletions.
51 changes: 51 additions & 0 deletions .github/automation/build_aarch64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#! /bin/bash

# *******************************************************************************
# Copyright 2024 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed 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.
# *******************************************************************************

# Build oneDNN for aarch64.

set -o errexit -o pipefail -o noclobber

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

# Defines MP, CC, CXX and OS.
source ${SCRIPT_DIR}/common_aarch64.sh

export ACL_ROOT_DIR=${ACL_ROOT_DIR:-"${PWD}/ComputeLibrary"}

CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-"Release"}
ONEDNN_TEST_SET=SMOKE

# ACL is not built with OMP on macOS.
if [[ "$OS" == "Darwin" ]]; then
ONEDNN_THREADING=SEQ
fi

set -x
cmake \
-Bbuild -S. \
-DDNNL_AARCH64_USE_ACL=ON \
-DONEDNN_BUILD_GRAPH=0 \
-DDNNL_CPU_RUNTIME=$ONEDNN_THREADING \
-DONEDNN_WERROR=OFF \
-DDNNL_BUILD_FOR_CI=ON \
-DONEDNN_TEST_SET=$ONEDNN_TEST_SET \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE

cmake --build build $MP
set +x
98 changes: 55 additions & 43 deletions .github/automation/build_acl.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash

# *******************************************************************************
# Copyright 2020-2023 Arm Limited and affiliates.
# Copyright 2020-2024 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,45 +17,57 @@
# limitations under the License.
# *******************************************************************************

# Compute Library build defaults
ACL_VERSION="v23.11"
ACL_DIR="${PWD}/ComputeLibrary"
ACL_ARCH="armv8a"
ACL_MULTI_ISA_SUPPORT=0

while [[ $# -gt 0 ]]; do
case $1 in
--version)
ACL_VERSION="v$2"
shift
;;
--arch)
ACL_ARCH="$2"
shift
;;
--multi_isa)
ACL_MULTI_ISA_SUPPORT=1
;;
--root-dir)
ACL_DIR="$2"
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
shift
done

readonly ACL_REPO="https://github.com/ARM-software/ComputeLibrary.git"
MAKE_NP="-j$(grep -c processor /proc/cpuinfo)"

git clone --branch $ACL_VERSION --depth 1 $ACL_REPO $ACL_DIR
cd $ACL_DIR

scons --silent $MAKE_NP Werror=0 debug=0 neon=1 opencl=0 embed_kernels=0 \
os=linux arch=$ACL_ARCH build=native multi_isa=$ACL_MULTI_ISA_SUPPORT \
fixed_format_kernels=1

exit $?
# Build ACL from github.

set -o errexit -o pipefail -o noclobber

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

# Defines MP, CC, CXX and OS.
source ${SCRIPT_DIR}/common_aarch64.sh

ACL_CONFIG=${ACL_CONFIG:-"Release"}
ACL_ROOT_DIR=${ACL_ROOT_DIR:-"${PWD}/ComputeLibrary"}
ACL_VERSION=${ACL_VERSION:-v24.09}
ACL_ARCH=${ACL_ARCH:-"armv8.2-a"}
ACL_REPO="https://github.com/ARM-software/ComputeLibrary.git"

if [[ "$OS" == "Linux" ]]; then
ACL_MULTI_ISA_SUPPORT=1
if [[ "$ACL_THREADING" == "OMP" ]]; then
ACL_OPENMP=1
elif [[ "$ACL_THREADING" == "SEQ" ]]; then
ACL_OPENMP=0
fi
ACL_OS="linux"
elif [[ "$OS" == "Darwin" ]]; then
ACL_MULTI_ISA_SUPPORT=0
ACL_OPENMP=0
ACL_OS="macos"
else
echo "Unknown OS: $OS"
exit 1
fi

if [[ "$ACL_CONFIG" == "Release" ]]; then
ACL_DEBUG=0
elif [[ "$ACL_CONFIG" == "Debug" ]]; then
ACL_DEBUG=1
else
echo "Unknown build config: $ACL_CONFIG"
exit 1
fi

echo "Compiler version:"
$CC --version

set -x
git clone --branch $ACL_VERSION --depth 1 $ACL_REPO $ACL_ROOT_DIR

cd $ACL_ROOT_DIR

scons $MP Werror=0 debug=$ACL_DEBUG neon=1 opencl=0 embed_kernels=0 \
os=$ACL_OS arch=$ACL_ARCH build=native multi_isa=$ACL_MULTI_ISA_SUPPORT \
fixed_format_kernels=1 cppthreads=0 openmp=$ACL_OPENMP examples=0 \
validation_tests=0
set +x
47 changes: 47 additions & 0 deletions .github/automation/common_aarch64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#! /bin/bash

# *******************************************************************************
# Copyright 2024 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed 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.
# *******************************************************************************

# Common variables for aarch64 ci. Exports:
# CC, CXX, OS, MP

set -o errexit -o pipefail -o noclobber

export OS=$(uname)

# Num threads on system.
if [[ "$OS" == "Darwin" ]]; then
export MP="-j$(sysctl -n hw.ncpu)"
elif [[ "$OS" == "Linux" ]]; then
export MP="-j$(nproc)"
fi

if [[ "$BUILD_TOOLSET" == "gcc" ]]; then
export CC=gcc-${GCC_VERSION}
export CXX=g++-${GCC_VERSION}
elif [[ "$BUILD_TOOLSET" == "clang" ]]; then
export CC=clang
export CXX=clang++
fi

# Print every exported variable.
echo "OS: $OS"
echo "Toolset: $BUILD_TOOLSET"
echo "CC: $CC"
echo "CXX: $CXX"
echo "MP: $MP"
96 changes: 96 additions & 0 deletions .github/automation/test_aarch64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#! /bin/bash

# *******************************************************************************
# Copyright 2024 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed 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.
# *******************************************************************************

# Test oneDNN for aarch64.

set -o errexit -o pipefail -o noclobber

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

# Defines MP, CC, CXX and OS.
source ${SCRIPT_DIR}/common_aarch64.sh

# Skip tests for certain config to preserve resources, while maintaining
# coverage. Skip:
# (SEQ,CLANG)
# (OMP,CLANG,DEBUG)
SKIP_TESTS=0
if [[ "$OS" == "Linux" ]]; then
if [[ "$ONEDNN_THREADING" == "SEQ" ]]; then
if [[ "$BUILD_TOOLSET" == "clang" ]]; then
SKIP_TESTS=1
fi
elif [[ "$ONEDNN_THREADING" == "OMP" ]]; then
if [[ "$BUILD_TOOLSET" == "clang" ]]; then
if [[ "$CMAKE_BUILD_TYPE" == "Debug" ]]; then
SKIP_TESTS=1
fi
fi
fi
fi

if [[ $SKIP_TESTS == 1 ]]; then
echo "Skipping tests for this configuration: $OS $ONEDNN_THREADING $BUILD_TOOLSET".
exit 0
fi

# We currently have some OS and config specific test failures.
if [[ "$OS" == "Linux" ]]; then
if [[ "$CMAKE_BUILD_TYPE" == "Debug" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_brgemm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|cpu-primitives-matmul-cpp"
SKIPPED_TEST_FAILURES+="|test_convolution_backward_weights_f32"
SKIPPED_TEST_FAILURES+="|test_matmul"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_conv_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_deconv_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_matmul_smoke_cpu"
elif [[ "$CMAKE_BUILD_TYPE" == "Release" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
fi
elif [[ "$OS" == "Darwin" ]]; then
if [[ "$CMAKE_BUILD_TYPE" == "Debug" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_brgemm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_brgemm_ci_cpu"
elif [[ "$CMAKE_BUILD_TYPE" == "Release" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_ci_cpu"
fi
fi

if [[ "$OS" == "Darwin" ]]; then
# Since macos does not build with OMP, we can use multiple ctest threads.
CTEST_MP=$MP
elif [[ "$OS" == "Linux" ]]; then
if [[ "$ONEDNN_THREADING" == "OMP" ]]; then
# OMP is already multi-threaded. Let's not oversubscribe.
CTEST_MP=-j2
elif [[ "$ONEDNN_THREADING" == "SEQ" ]]; then
CTEST_MP=$MP
fi
fi

set -x
ctest $CTEST_MP --no-tests=error --verbose --output-on-failure -E "$SKIPPED_TEST_FAILURES"
set +x
Loading

0 comments on commit 16780c2

Please sign in to comment.