Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu: aarch64: support ci with TP #2158

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
72 changes: 65 additions & 7 deletions .github/automation/build_aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,92 @@
# *******************************************************************************

# Build oneDNN for aarch64.

set -o errexit -o pipefail -o noclobber

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

# Function to clone and install Eigen
install_eigen() {
local eigen_repo="https://gitlab.com/libeigen/eigen.git"
local eigen_commit="aa6964bf3a34fd607837dd8123bc42465185c4f8"

echo "Cloning Eigen repository..."
if ! git clone "$eigen_repo" --depth 1; then
echo "Error: Failed to clone Eigen repository."
return 1
fi

cd eigen

if ! git fetch --depth 1 origin "$eigen_commit" || ! git checkout "$eigen_commit"; then
echo "Error: Failed to fetch or checkout commit."
return 1
fi

cd ..

mkdir -p eigen-build && cd eigen-build

echo "EIGEN_INSTALL_PATH: ${EIGEN_INSTALL_PATH}"
echo "EIGEN_PATH: $EIGEN_PATH"
if ! cmake -DCMAKE_INSTALL_PREFIX="${EIGEN_INSTALL_PATH}" "$EIGEN_PATH"; then
echo "Error: CMake configuration failed."
return 1
fi

# Build and install Eigen
echo "Building and installing Eigen..."
if ! make -s -j install; then
echo "Error: Build or installation failed."
return 1
fi

echo "Eigen installed successfully!"
}

# 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_THREADING=${ONEDNN_THREADING:-"SEQ"}

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. \
CMAKE_OPTIONS="-Bbuild -S. \
-DDNNL_AARCH64_USE_ACL=ON \
-DONEDNN_BUILD_GRAPH=0 \
-DDNNL_CPU_RUNTIME=$ONEDNN_THREADING \
-DONEDNN_WERROR=ON \
-DDNNL_BUILD_FOR_CI=ON \
-DONEDNN_TEST_SET=$ONEDNN_TEST_SET \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE
-DONEDNN_TEST_SET=${ONEDNN_TEST_SET} \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
"

if [[ "$ONEDNN_THREADING" == 'TP' ]]; then
# install eigen
export EIGEN_INSTALL_PATH="$WORKSPACE/eigen-build"
export EIGEN_PATH="${WORKSPACE}/eigen"
install_eigen

CMAKE_OPTIONS="${CMAKE_OPTIONS} -DDNNL_CPU_RUNTIME=THREADPOOL \
-D_DNNL_TEST_THREADPOOL_IMPL=EIGEN -DEigen3_DIR=${EIGEN_INSTALL_PATH}/share/eigen3/cmake"
elif [[ "$ONEDNN_THREADING" == "OMP" || "$ONEDNN_THREADING" == "SEQ" ]]; then
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DDNNL_CPU_RUNTIME=${ONEDNN_THREADING}"
else
echo "Only OMP, TP, SEQ schedulers supported, $ONEDNN_THREADING requested"
exit 1
fi

echo "eigen tasks completed."
echo "compile oneDNN......"
set -x
cd $WORKSPACE
cmake ${CMAKE_OPTIONS}
cmake --build build $MP
set +x
2 changes: 1 addition & 1 deletion .github/automation/build_acl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [[ "$OS" == "Linux" ]]; then
ACL_MULTI_ISA_SUPPORT=1
if [[ "$ACL_THREADING" == "OMP" ]]; then
ACL_OPENMP=1
elif [[ "$ACL_THREADING" == "SEQ" ]]; then
elif [[ "$ACL_THREADING" == "SEQ" || "$ACL_THREADING" == "TP" ]]; then
ACL_OPENMP=0
fi
ACL_OS="linux"
Expand Down
29 changes: 14 additions & 15 deletions .github/workflows/ci-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
id: cache-acl-restore
uses: actions/cache/restore@v4
with:
key: ${{ steps.get_system_name.outputs.SystemName }}-acl-${{ matrix.toolset }}-${{ matrix.config }}-${{ steps.get_acl_commit_hash.outputs.ACLCommitHash }}
key: ${{ steps.get_system_name.outputs.SystemName }}-acl-${{ matrix.toolset }}-${{ matrix.config }}-SEQ-${{ steps.get_acl_commit_hash.outputs.ACLCommitHash }}
path: ${{ github.workspace }}/ComputeLibrary/build

- name: Build ACL
Expand All @@ -87,6 +87,7 @@ jobs:
BUILD_TOOLSET: ${{ matrix.toolset }}
ACL_CONFIG: ${{ matrix.config }}
GCC_VERSION: 13
ACL_THREADING: SEQ

- name: Save ACL in cache
if: ${{ steps.cache-acl-restore.outputs.cache-hit != 'true' }}
Expand All @@ -104,28 +105,24 @@ jobs:
BUILD_TOOLSET: ${{ matrix.toolset }}
CMAKE_BUILD_TYPE: ${{ matrix.config }}
GCC_VERSION: 13

- if: matrix.toolset == 'clang'
name: Run oneDNN smoke tests
WORKSPACE: ${{ github.workspace }}/oneDNN

- name: Run oneDNN smoke tests
run: ${{ github.workspace }}/oneDNN/.github/automation/test_aarch64.sh
working-directory: ${{ github.workspace }}/oneDNN/build
env:
CMAKE_BUILD_TYPE: ${{ matrix.config }}
DYLD_LIBRARY_PATH: ${{ github.workspace }}/ComputeLibrary/build

# We only run the linux aarch64 runners if macos smoke tests pass.
# We only run the linux aarch64 runners if macOS smoke tests pass.
linux:
needs: macos
strategy:
matrix:
threading: [OMP]
toolset: [clang, gcc]
config: [Debug, Release]
host: [
{ name: c6g, label: ah-ubuntu_22_04-c6g_2x-50 },
{ name: c7g, label: ah-ubuntu_22_04-c7g_2x-50 }
]

threading: [OMP, TP]
host: [ { name: c6g, label: ah-ubuntu_22_04-c6g_2x-50 }, { name: c7g, label: ah-ubuntu_22_04-c7g_2x-50 }]
name: ${{ matrix.host.name }}, ${{ matrix.toolset }}, ${{ matrix.threading }}, ${{ matrix.config }}
runs-on: ${{ matrix.host.label }}
steps:
Expand Down Expand Up @@ -178,7 +175,7 @@ jobs:
id: cache-acl-restore
uses: actions/cache/restore@v4
with:
key: ${{ steps.get_system_name.outputs.SystemName }}-acl-${{ matrix.toolset }}-${{ matrix.config }}-${{ steps.get_acl_commit_hash.outputs.ACLCommitHash }}
key: ${{ steps.get_system_name.outputs.SystemName }}-acl-${{ matrix.toolset }}-${{ matrix.config }}-${{ matrix.threading }}-${{ steps.get_acl_commit_hash.outputs.ACLCommitHash }}
path: ${{ github.workspace }}/ComputeLibrary/build

- name: Build ACL
Expand Down Expand Up @@ -209,12 +206,14 @@ jobs:
CMAKE_BUILD_TYPE: ${{ matrix.config }}
GCC_VERSION: 13
ONEDNN_THREADING: ${{ matrix.threading }}
WORKSPACE: ${{ github.workspace }}/oneDNN

- name: Run oneDNN tests
- if: (matrix.threading == 'OMP') || (matrix.threading == 'TP' && matrix.toolset == 'clang' && matrix.config == 'Release')
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic should be inside the CI scripts instead of the YML file.

name: Run oneDNN tests
run: ${{ github.workspace }}/oneDNN/.github/automation/test_aarch64.sh
working-directory: ${{ github.workspace }}/oneDNN/build
env:
BUILD_TOOLSET: ${{ matrix.toolset }}
CMAKE_BUILD_TYPE: ${{ matrix.config }}
DYLD_LIBRARY_PATH: ${{ github.workspace }}/ComputeLibrary/build
ONEDNN_THREADING: ${{ matrix.threading }}
ONEDNN_THREADING: ${{ matrix.threading }}
Loading