Skip to content

Commit d702ab2

Browse files
Ryo-not-riotheComputeKid
authored andcommittedJan 23, 2025··
ci: Build acl cache sequentially
1 parent be8edb8 commit d702ab2

File tree

5 files changed

+211
-70
lines changed

5 files changed

+211
-70
lines changed
 

‎.github/automation/build_acl.sh

+34-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /bin/bash
22

33
# *******************************************************************************
4-
# Copyright 2020-2024 Arm Limited and affiliates.
4+
# Copyright 2020-2025 Arm Limited and affiliates.
55
# SPDX-License-Identifier: Apache-2.0
66
#
77
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,7 +26,7 @@ SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
2626
# Defines MP, CC, CXX and OS.
2727
source ${SCRIPT_DIR}/common_aarch64.sh
2828

29-
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-"Release"}
29+
ACL_BUILD_TYPE=${ACL_BUILD_TYPE:-"Release"}
3030
ACL_ROOT_DIR=${ACL_ROOT_DIR:-"${PWD}/ComputeLibrary"}
3131
ACL_REPO="https://github.com/ARM-software/ComputeLibrary.git"
3232

@@ -36,24 +36,44 @@ elif [[ "$ACL_THREADING" == "SEQ" ]]; then
3636
ACL_OPENMP=0
3737
fi
3838

39+
if [[ "$OS" == "Linux" ]]; then
40+
ACL_MULTI_ISA_SUPPORT=1
41+
if [[ "$ACL_THREADING" == "OMP" ]]; then
42+
ACL_OPENMP=1
43+
elif [[ "$ACL_THREADING" == "SEQ" ]]; then
44+
ACL_OPENMP=0
45+
fi
46+
ACL_OS="linux"
47+
elif [[ "$OS" == "Darwin" ]]; then
48+
ACL_MULTI_ISA_SUPPORT=0
49+
ACL_OPENMP=0
50+
ACL_OS="macos"
51+
else
52+
echo "Unknown OS: $OS"
53+
exit 1
54+
fi
55+
56+
if [[ "$ACL_BUILD_TYPE" == "Release" ]]; then
57+
ACL_DEBUG=0
58+
elif [[ "$ACL_BUILD_TYPE" == "Debug" ]]; then
59+
ACL_DEBUG=1
60+
else
61+
echo "Unknown build config: $ACL_BUILD_TYPE"
62+
exit 1
63+
fi
64+
3965
if [[ "$ACL_ACTION" == "clone" ]]; then
4066
set -x
4167
git clone --branch $ACL_VERSION --depth 1 $ACL_REPO $ACL_ROOT_DIR
4268
set +x
43-
elif [[ "$ACL_ACTION" == "configure" ]]; then
44-
set -x
45-
cmake \
46-
-S$ACL_ROOT_DIR -B$ACL_ROOT_DIR/build \
47-
-DARM_COMPUTE_OPENMP=$ACL_OPENMP \
48-
-DARM_COMPUTE_CPPTHREADS=0 \
49-
-DARM_COMPUTE_WERROR=0 \
50-
-DARM_COMPUTE_BUILD_EXAMPLES=1 \
51-
-DARM_COMPUTE_BUILD_TESTING=1 \
52-
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE
53-
set +x
5469
elif [[ "$ACL_ACTION" == "build" ]]; then
5570
set -x
56-
cmake --build $ACL_ROOT_DIR/build
71+
cd $ACL_ROOT_DIR
72+
set -x
73+
scons $MP Werror=0 debug=$ACL_DEBUG neon=1 opencl=0 embed_kernels=0 \
74+
os=$ACL_OS arch=armv8.2-a build=native multi_isa=$ACL_MULTI_ISA_SUPPORT \
75+
fixed_format_kernels=1 cppthreads=0 openmp=$ACL_OPENMP examples=0 \
76+
validation_tests=0
5777
set +x
5878
else
5979
echo "Unknown action: $ACL_ACTION"

‎.github/automation/ci-aarch64.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"acl": "v24.11.1",
4+
"gcc": "13",
5+
"clang": "17"
6+
}
7+
}

‎.github/workflows/aarch64-acl.yml

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# *******************************************************************************
2+
# Copyright 2025 Arm Limited and affiliates.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# *******************************************************************************
17+
18+
name: "Build ACL cache"
19+
20+
#* To avoid duplicate jobs running when both push and PR is satisfied, we use this:
21+
#* https://github.com/orgs/community/discussions/26940#discussioncomment-5686753
22+
on:
23+
workflow_call:
24+
workflow_dispatch:
25+
26+
# Declare default permissions as read only.
27+
permissions: read-all
28+
29+
jobs:
30+
# Cache is built sequentially to avoid cache-hit race conditions
31+
build-cache:
32+
strategy:
33+
max-parallel: 1
34+
matrix:
35+
config: [
36+
{ name: MacOS, label: macos-14, threading: SEQ, toolset: clang, build: Release },
37+
{ name: c6g, label: ah-ubuntu_22_04-c6g_2x-50, threading: OMP, toolset: clang, build: Debug },
38+
{ name: c6g, label: ah-ubuntu_22_04-c6g_2x-50, threading: OMP, toolset: gcc, build: Release }
39+
]
40+
41+
name: ${{ matrix.config.name }}, ${{ matrix.config.toolset }}, ${{ matrix.config.threading }}, ${{ matrix.config.build }}
42+
runs-on: ${{ matrix.config.label }}
43+
steps:
44+
- name: Checkout oneDNN
45+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
with:
47+
path: oneDNN
48+
49+
- name: Read version file
50+
id: get-versions
51+
run: |
52+
content=`cat ${{ github.workspace }}/oneDNN/.github/automation/ci-aarch64.json`
53+
content="${content//[$'\t\r\n$ ']}"
54+
echo "output=$content" >> $GITHUB_OUTPUT
55+
56+
- name: Clone ACL
57+
run: ${{ github.workspace }}/oneDNN/.github/automation/build_acl.sh
58+
env:
59+
ACL_ACTION: clone
60+
ACL_ROOT_DIR: ${{ github.workspace }}/ComputeLibrary
61+
ACL_VERSION: ${{ fromJson(steps.get-versions.outputs.output).dependencies.acl }}
62+
63+
- name: Get ACL commit hash for cache key
64+
id: get_acl_commit_hash
65+
run: (cd ${{ github.workspace }}/ComputeLibrary && echo "ACLCommitHash=$(git rev-parse --short HEAD)") >> $GITHUB_OUTPUT
66+
67+
- name: Get system name
68+
id: get_system_name
69+
run: (echo "SystemName=$(uname)") >> $GITHUB_OUTPUT
70+
71+
- name: Restore cached ACL
72+
id: cache-acl-restore
73+
uses: actions/cache/restore@v4
74+
with:
75+
key: ${{ steps.get_system_name.outputs.SystemName }}-acl-${{ matrix.config.toolset }}-${{ matrix.config.build }}-${{ steps.get_acl_commit_hash.outputs.ACLCommitHash }}
76+
path: ${{ github.workspace }}/ComputeLibrary/build
77+
78+
- name: Install Scons (MacOS)
79+
if: ${{ matrix.config.name == 'MacOS' && (steps.cache-acl-restore.outputs.cache-hit != 'true') }}
80+
run: brew install scons
81+
82+
- name: Install scons (Linux)
83+
if: ${{ matrix.config.name != 'MacOS' && (steps.cache-acl-restore.outputs.cache-hit != 'true') }}
84+
run: |
85+
sudo apt update -y
86+
sudo apt install -y scons
87+
88+
- if: ${{ startsWith(matrix.config.label,'ah-ubuntu') && (matrix.config.threading == 'OMP') && (steps.cache-acl-restore.outputs.cache-hit != 'true') }}
89+
name: Install openmp
90+
run: |
91+
sudo apt install -y libomp-dev
92+
93+
- if: ${{ startsWith(matrix.config.label,'ah-ubuntu') && (matrix.config.toolset == 'gcc') && (steps.cache-acl-restore.outputs.cache-hit != 'true') }}
94+
name: Install gcc
95+
run: |
96+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
97+
sudo apt update -y
98+
sudo apt install -y g++-${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}
99+
100+
- if: ${{ startsWith(matrix.config.label,'ah-ubuntu') && (matrix.config.toolset == 'clang') && (steps.cache-acl-restore.outputs.cache-hit != 'true') }}
101+
name: Install clang
102+
uses: KyleMayes/install-llvm-action@e0a8dc9cb8a22e8a7696e8a91a4e9581bec13181
103+
with:
104+
version: ${{ fromJson(steps.get-versions.outputs.output).dependencies.clang }}
105+
106+
- name: Build ACL
107+
if: ${{ steps.cache-acl-restore.outputs.cache-hit != 'true' }}
108+
run: ${{ github.workspace }}/oneDNN/.github/automation/build_acl.sh
109+
env:
110+
ACL_ACTION: build
111+
ACL_ROOT_DIR: ${{ github.workspace }}/ComputeLibrary
112+
ACL_THREADING: ${{ matrix.config.threading }}
113+
BUILD_TOOLSET: ${{ matrix.config.toolset }}
114+
ACL_BUILD_TYPE: ${{ matrix.config.build }}
115+
GCC_VERSION: ${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}
116+
117+
- name: Save ACL in cache
118+
id: cache-acl_build-save
119+
if: ${{ steps.cache-acl-restore.outputs.cache-hit != 'true' }}
120+
uses: actions/cache/save@v4
121+
with:
122+
key: ${{ steps.get_system_name.outputs.SystemName }}-acl-${{ matrix.config.toolset }}-${{ matrix.config.build }}-${{ steps.get_acl_commit_hash.outputs.ACLCommitHash }}
123+
path: ${{ github.workspace }}/ComputeLibrary/build

‎.github/workflows/ci-aarch64.yml

+35-51
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# *******************************************************************************
2-
# Copyright 2024 Arm Limited and affiliates.
2+
# Copyright 2024-2025 Arm Limited and affiliates.
33
# SPDX-License-Identifier: Apache-2.0
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,29 +21,29 @@ name: "CI AArch64"
2121
#* https://github.com/orgs/community/discussions/26940#discussioncomment-5686753
2222
on:
2323
push:
24-
branches: [ main, 'rls-*' ]
24+
branches: [main, "rls-*"]
2525
paths:
26-
- '.github/**'
27-
- 'cmake/**'
28-
- 'examples/**'
29-
- 'include/**'
30-
- 'src/common/**'
31-
- 'src/cpu/*'
32-
- 'src/cpu/aarch64/**'
33-
- 'tests/**'
34-
- 'CMakeLists.txt'
26+
- ".github/**"
27+
- "cmake/**"
28+
- "examples/**"
29+
- "include/**"
30+
- "src/common/**"
31+
- "src/cpu/*"
32+
- "src/cpu/aarch64/**"
33+
- "tests/**"
34+
- "CMakeLists.txt"
3535
pull_request:
3636
types: [opened, synchronize, reopened]
3737
paths:
38-
- '.github/**'
39-
- 'cmake/**'
40-
- 'examples/**'
41-
- 'include/**'
42-
- 'src/common/**'
43-
- 'src/cpu/*'
44-
- 'src/cpu/aarch64/**'
45-
- 'tests/**'
46-
- 'CMakeLists.txt'
38+
- ".github/**"
39+
- "cmake/**"
40+
- "examples/**"
41+
- "include/**"
42+
- "src/common/**"
43+
- "src/cpu/*"
44+
- "src/cpu/aarch64/**"
45+
- "tests/**"
46+
- "CMakeLists.txt"
4747

4848
#* Stop stale workflows when pull requests are updated: https://stackoverflow.com/a/70972844
4949
#* Does not apply to the main branch.
@@ -55,7 +55,11 @@ concurrency:
5555
permissions: read-all
5656

5757
jobs:
58+
build-acl-cache:
59+
uses: ./.github/workflows/aarch64-acl.yml
60+
5861
build-and-test:
62+
needs: build-acl-cache
5963
strategy:
6064
matrix:
6165
config: [
@@ -68,12 +72,18 @@ jobs:
6872
name: ${{ matrix.config.name }}, ${{ matrix.config.toolset }}, ${{ matrix.config.threading }}, ${{ matrix.config.build }}
6973
runs-on: ${{ matrix.config.label }}
7074
steps:
71-
7275
- name: Checkout oneDNN
7376
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7477
with:
7578
path: oneDNN
7679

80+
- name: Read version file
81+
id: get-versions
82+
run: |
83+
content=`cat ${{ github.workspace }}/oneDNN/.github/automation/ci-aarch64.json`
84+
content="${content//[$'\t\r\n$ ']}"
85+
echo "output=$content" >> $GITHUB_OUTPUT
86+
7787
- name: Get latest CMake and Ninja
7888
uses: lukka/get-cmake@acb35cf920333f4dc3fc4f424f1b30d5e7d561b4 # v3.31.4
7989
with:
@@ -90,20 +100,20 @@ jobs:
90100
run: |
91101
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
92102
sudo apt update -y
93-
sudo apt install -y g++-13
103+
sudo apt install -y g++-${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}
94104
95105
- if: ${{ (startsWith(matrix.config.label,'ah-ubuntu') && (matrix.config.toolset == 'clang')) }}
96106
name: Install clang
97107
uses: KyleMayes/install-llvm-action@e0a8dc9cb8a22e8a7696e8a91a4e9581bec13181
98108
with:
99-
version: "17"
109+
version: ${{ fromJson(steps.get-versions.outputs.output).dependencies.clang }}
100110

101111
- name: Clone ACL
102112
run: ${{ github.workspace }}/oneDNN/.github/automation/build_acl.sh
103113
env:
104114
ACL_ACTION: clone
105115
ACL_ROOT_DIR: ${{ github.workspace }}/ComputeLibrary
106-
ACL_VERSION: v24.11.1
116+
ACL_VERSION: ${{ fromJson(steps.get-versions.outputs.output).dependencies.acl }}
107117

108118
- name: Get ACL commit hash for cache key
109119
id: get_acl_commit_hash
@@ -120,32 +130,6 @@ jobs:
120130
key: ${{ steps.get_system_name.outputs.SystemName }}-acl-${{ matrix.config.toolset }}-${{ matrix.config.build }}-${{ steps.get_acl_commit_hash.outputs.ACLCommitHash }}
121131
path: ${{ github.workspace }}/ComputeLibrary/build
122132

123-
- name: Configure ACL
124-
if: ${{ steps.cache-acl-restore.outputs.cache-hit != 'true' }}
125-
run: ${{ github.workspace }}/oneDNN/.github/automation/build_acl.sh
126-
env:
127-
ACL_ACTION: configure
128-
ACL_ROOT_DIR: ${{ github.workspace }}/ComputeLibrary
129-
ACL_THREADING: ${{ matrix.config.threading }}
130-
BUILD_TOOLSET: ${{ matrix.config.toolset }}
131-
CMAKE_BUILD_TYPE: ${{ matrix.config.build }}
132-
CMAKE_GENERATOR: Ninja
133-
GCC_VERSION: 13
134-
135-
- name: Build ACL
136-
if: ${{ steps.cache-acl-restore.outputs.cache-hit != 'true' }}
137-
run: ${{ github.workspace }}/oneDNN/.github/automation/build_acl.sh
138-
env:
139-
ACL_ACTION: build
140-
141-
- name: Save ACL in cache
142-
if: ${{ steps.cache-acl-restore.outputs.cache-hit != 'true' }}
143-
id: cache-acl_build-save
144-
uses: actions/cache/save@v4
145-
with:
146-
key: ${{ steps.cache-acl-restore.outputs.cache-primary-key }}
147-
path: ${{ github.workspace }}/ComputeLibrary/build
148-
149133
- name: Configure oneDNN
150134
run: ${{ github.workspace }}/oneDNN/.github/automation/build_aarch64.sh
151135
working-directory: ${{ github.workspace }}/oneDNN
@@ -154,7 +138,7 @@ jobs:
154138
BUILD_TOOLSET: ${{ matrix.config.toolset }}
155139
CMAKE_BUILD_TYPE: ${{ matrix.config.build }}
156140
CMAKE_GENERATOR: Ninja
157-
GCC_VERSION: 13
141+
GCC_VERSION: ${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}
158142
ONEDNN_ACTION: configure
159143
ONEDNN_TEST_SET: ${{ matrix.config.testset }}
160144
ONEDNN_THREADING: ${{ matrix.config.threading }}

‎.github/workflows/nightly-aarch64.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# *******************************************************************************
2-
# Copyright 2024 Arm Limited and affiliates.
2+
# Copyright 2024-2025 Arm Limited and affiliates.
33
# SPDX-License-Identifier: Apache-2.0
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -63,18 +63,25 @@ jobs:
6363
run: |
6464
sudo apt install -y libomp-dev
6565
66+
- name: Read version file
67+
id: get-versions
68+
run: |
69+
content=`cat ${{ github.workspace }}/oneDNN/.github/automation/ci-aarch64.json`
70+
content="${content//[$'\t\r\n$ ']}"
71+
echo "output=$content" >> $GITHUB_OUTPUT
72+
6673
- name: Install gcc
6774
run: |
6875
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
6976
sudo apt update -y
70-
sudo apt install -y g++-13
77+
sudo apt install -y g++-${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}
7178
7279
- name: Clone ACL
7380
run: ${{ github.workspace }}/oneDNN/.github/automation/build_acl.sh
7481
env:
7582
ACL_ACTION: clone
7683
ACL_ROOT_DIR: ${{ github.workspace }}/ComputeLibrary
77-
ACL_VERSION: v24.11.1
84+
ACL_VERSION: ${{ fromJson(steps.get-versions.outputs.output).dependencies.acl }}
7885

7986
- name: Configure ACL
8087
run: ${{ github.workspace }}/oneDNN/.github/automation/build_acl.sh
@@ -85,7 +92,7 @@ jobs:
8592
BUILD_TOOLSET: ${{ matrix.config.toolset }}
8693
CMAKE_BUILD_TYPE: ${{ matrix.config.build }}
8794
CMAKE_GENERATOR: Ninja
88-
GCC_VERSION: 13
95+
GCC_VERSION: ${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}
8996

9097
- name: Build ACL
9198
run: ${{ github.workspace }}/oneDNN/.github/automation/build_acl.sh
@@ -100,7 +107,7 @@ jobs:
100107
BUILD_TOOLSET: ${{ matrix.config.toolset }}
101108
CMAKE_BUILD_TYPE: ${{ matrix.config.build }}
102109
CMAKE_GENERATOR: Ninja
103-
GCC_VERSION: 13
110+
GCC_VERSION: ${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}
104111
ONEDNN_ACTION: configure
105112
ONEDNN_TEST_SET: ${{ matrix.config.testset }}
106113
ONEDNN_THREADING: ${{ matrix.config.threading }}

0 commit comments

Comments
 (0)
Please sign in to comment.