|
| 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 |
0 commit comments