Skip to content

Commit

Permalink
Move "platforms" CI jobs into their own workflow files. (iree-org#17979)
Browse files Browse the repository at this point in the history
This moves workflow jobs that build the full project (including the
compiler) from `ci.yml` to their own workflow files:

- `build_test_all_arm64` -->
`.github/workflows/ci_linux_arm64_clang.yml`
- `build_test_all_windows` -->
`.github/workflows/ci_windows_x86_msvc.yml`
- `build_test_all_macos_arm64` --> none
- `build_test_all_macos_x86_64` -->
`.github/workflows/ci_macos_x86_clang.yml`

With one workflow file per platform, these are the tradeoffs compared to
a single workflow file:

Pros:
+ Easy to tune which triggers affect each workflow
* See
https://github.com/Tencent/ncnn/blob/master/.github/workflows/windows-clang.yml
for some inspiration. Each workflow can independently define `paths:` to
trigger on. We have support for that via
[`build_tools/github_actions/configure_ci.py`](https://github.com/iree-org/iree/blob/main/build_tools/github_actions/configure_ci.py),
but this also allows for adjusting schedule triggers too.
+ Easy to fork a workflow for a new platform, less merge conflicts in a
single large file
+ Easy to cancel a single job without affecting others from the same
file
+ Easy to disable/enable a workflow in isolation from the UI if there
are runner issues
+ Low impact radius if/when a single platform has runner issues

Cons:
- If running on PRs, checks are spread out a lot
- Hard to mark multiple/all jobs as required checks (if we care)
- More code duplication between files (reusable workflows can help
here... maybe, could also lean on CMake presets and build scripts)

Practically at this point in time, these workflows _were_ running on all
commits pushed to the `main` branch but they were disabled for being too
slow or requiring runners that went offline. Now the workflows will run
on a nightly schedule and they can be disabled individually from the
GitHub UI as needed. TBD how we'll make these workflows available for
opt-in on presubmit. We could add the `pull_request` trigger back,
trigger if some labels are added, etc.

skip-ci: adding new workflows, existing ones are unaffected
  • Loading branch information
ScottTodd authored Jul 22, 2024
1 parent 108e050 commit 7463cb4
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 248 deletions.
185 changes: 0 additions & 185 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,185 +65,6 @@ jobs:
write-caches: ${{ needs.setup.outputs.write-caches }}
run-tests: true

# Disabled since we don't have any runners for arm64.
# As of July 2024, GitHub has "large" arm64 runners available in beta at cost.
# If these get included in the free/standard tier or if a project member
# sponsors their use then we could re-enable this job.
# build_test_all_arm64:
# needs: setup
# if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_all_arm64')
# runs-on:
# - self-hosted # must come first
# - runner-group=${{ needs.setup.outputs.runner-group }}
# - environment=${{ needs.setup.outputs.runner-env }}
# - arm64
# - os-family=Linux
# env:
# BUILD_DIR: build-arm64
# steps:
# - name: "Checking out repository"
# uses: actions/[email protected]
# with:
# submodules: true
# - name: "Building IREE"
# env:
# IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }}
# run: |
# ./build_tools/github_actions/docker_run.sh \
# --env "IREE_CCACHE_GCP_TOKEN=$(gcloud auth application-default print-access-token)" \
# --env "IREE_WRITE_REMOTE_CCACHE=${IREE_WRITE_REMOTE_CCACHE}" \
# --env "CCACHE_NAMESPACE=gcr.io/iree-oss/base-arm64@sha256:9daa1cdbbf12da8527319ece76a64d06219e04ecb99a4cff6e6364235ddf6c59" \
# --env "IREE_BUILD_SETUP_PYTHON_VENV=${BUILD_DIR}/.venv" \
# gcr.io/iree-oss/base-arm64@sha256:9daa1cdbbf12da8527319ece76a64d06219e04ecb99a4cff6e6364235ddf6c59 \
# ./build_tools/cmake/build_all.sh \
# "${BUILD_DIR}"
# - name: "Testing IREE"
# run: |
# ./build_tools/github_actions/docker_run.sh \
# --env "IREE_ARM_SME_QEMU_AARCH64_BIN=/usr/bin/qemu-aarch64" \
# gcr.io/iree-oss/base-arm64@sha256:9daa1cdbbf12da8527319ece76a64d06219e04ecb99a4cff6e6364235ddf6c59 \
# ./build_tools/cmake/ctest_all.sh \
# "${BUILD_DIR}"

# Disabled since
# * windows-2022 is too slow
# * windows-2022-64core is too expensive (and takes ~8 minutes just to checkout the repo)
# * we don't have self-hosted Windows runners with enough cores yet
# build_test_all_windows:
# needs: setup
# if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_all_windows')
# # TODO(saienduri): switch to self-hosted
# runs-on: windows-2022
# defaults:
# run:
# shell: bash
# env:
# BUILD_DIR: build-windows
# steps:
# - name: "Checking out repository"
# uses: actions/[email protected]
# with:
# submodules: true
# - id: "gcp-auth"
# name: "Authenticating to Google Cloud"
# if: needs.setup.outputs.write-caches == 1
# uses: "google-github-actions/auth@v1"
# with:
# token_format: "access_token"
# credentials_json: "${{ secrets.IREE_OSS_GITHUB_RUNNER_BASIC_TRUST_SERVICE_ACCOUNT_KEY }}"
# create_credentials_file: false
# - name: "Setting up Python"
# uses: actions/[email protected]
# with:
# python-version: "3.10" # Needs pybind >= 2.10.1 for Python >= 3.11
# - name: "Installing Python packages"
# run: |
# python3 -m venv .venv
# .venv/Scripts/activate.bat
# python3 -m pip install -r runtime/bindings/python/iree/runtime/build_requirements.txt
# - name: "Installing requirements"
# run: choco install ccache --yes
# - name: "Configuring MSVC"
# uses: ilammy/[email protected]
# # Finally: build and run tests.
# - name: "Building IREE"
# env:
# IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }}
# IREE_CCACHE_GCP_TOKEN: ${{ steps.gcp-auth.outputs.access_token }}
# CCACHE_NAMESPACE: github-windows-2022
# run: ./build_tools/cmake/build_all.sh "${BUILD_DIR}"
# - name: "Testing IREE"
# run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}"

# Disabled while runner is offline.
# build_test_all_macos_arm64:
# needs: setup
# if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_all_macos_arm64')
# runs-on:
# - ${{ github.repository == 'iree-org/iree' && 'self-hosted' || 'macos-12' }} # must come first
# - runner-group=postsubmit
# - os-family=macOS
# env:
# BUILD_DIR: build-macos
# steps:
# - name: "Checking out repository"
# uses: actions/[email protected]
# - name: "Updating git submodules"
# run: git submodule update --init --jobs 8 --depth 1
# - name: "Installing Python packages"
# run: |
# python3 -m venv .venv
# source .venv/bin/activate
# python3 -m pip install -r runtime/bindings/python/iree/runtime/build_requirements.txt
# - name: "Building IREE"
# env:
# IREE_READ_REMOTE_CCACHE: 0
# IREE_WRITE_REMOTE_CCACHE: 0
# IREE_READ_LOCAL_CCACHE: 1
# IREE_WRITE_LOCAL_CCACHE: ${{ needs.setup.outputs.write-caches }}
# # We'll remove the GITHUB_WORKSPACE directory after the job.
# # Persist the cache by storing in the parent directory.
# CCACHE_DIR: ${{ github.workspace }}/../.ccache
# CCACHE_MAXSIZE: 30G
# run: |
# source .venv/bin/activate
# bash ./build_tools/cmake/build_all.sh "${BUILD_DIR}"
# - name: "Testing IREE"
# run: |
# source .venv/bin/activate
# IREE_METAL_DISABLE=0 bash ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}"

build_test_all_macos_x86_64:
needs: setup
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_all_macos_x86_64')
runs-on: macos-13
env:
BUILD_DIR: build-macos
defaults:
run:
shell: bash
steps:
- name: "Checking out repository"
uses: actions/[email protected]
- id: "gcp-auth"
name: "Authenticating to Google Cloud"
if: needs.setup.outputs.write-caches == 1
uses: "google-github-actions/auth@v1"
with:
token_format: "access_token"
credentials_json: "${{ secrets.IREE_OSS_GITHUB_RUNNER_BASIC_TRUST_SERVICE_ACCOUNT_KEY }}"
create_credentials_file: false
- name: "Updating git submodules"
run: git submodule update --init --jobs 8 --depth 1
# There are multiple versions of Xcode and SDKs installed on the macOS runner.
# Select the latest Xcode app to enable using Metal offline toolchain.
- name: "Update Xcode command line tools path"
run: |
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
xcrun metal --version
xcrun metallib --version
- name: "Setting up Python"
uses: actions/[email protected]
with:
python-version: "3.10"
cache: "pip"
- name: "Installing Python packages"
run: pip install -r runtime/bindings/python/iree/runtime/build_requirements.txt
- name: "Installing requirements"
# We need coreutils for `realpath` used in scripts.
# We need bash because the default one on macOS is fairly old and lacks
# features we use in scripts.
run: brew install ninja ccache coreutils bash
# Finally: build and run tests.
- name: "Building IREE"
env:
IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }}
IREE_CCACHE_GCP_TOKEN: ${{ steps.gcp-auth.outputs.access_token }}
CCACHE_NAMESPACE: github-macos-13
run: bash ./build_tools/cmake/build_all.sh "${BUILD_DIR}"
- name: "Testing IREE"
run: bash ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}"

build_test_all_bazel:
needs: setup
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_all_bazel')
Expand Down Expand Up @@ -984,12 +805,6 @@ jobs:
- build_all
- build_test_all_bazel

# Platforms
# - build_test_all_arm64
# - build_test_all_windows
# - build_test_all_macos_arm64
- build_test_all_macos_x86_64

# Accelerators
- test_nvidia_gpu
# - test_nvidia_a100
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/ci_linux_arm64_clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2024 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: CI - Linux arm64 clang

on:
schedule:
# Weekday mornings at 09:15 UTC = 01:15 PST (UTC - 8).
- cron: "15 9 * * 1-5"
workflow_dispatch:

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
setup:
uses: ./.github/workflows/setup.yml

# TODO: Switch to GitHub-hosted arm64 runners when available?
# TODO: Switch runs-on labels to use different (non-GCP) self-hosted runners?
linux_arm64_clang:
needs: setup
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_all_arm64')
runs-on:
- self-hosted # must come first
- runner-group=${{ needs.setup.outputs.runner-group }}
- environment=${{ needs.setup.outputs.runner-env }}
- arm64
- os-family=Linux
env:
BUILD_DIR: build-arm64
steps:
- name: "Checking out repository"
uses: actions/[email protected]
with:
submodules: true
- name: "Building IREE"
env:
IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }}
run: |
./build_tools/github_actions/docker_run.sh \
--env "IREE_CCACHE_GCP_TOKEN=$(gcloud auth application-default print-access-token)" \
--env "IREE_WRITE_REMOTE_CCACHE=${IREE_WRITE_REMOTE_CCACHE}" \
--env "CCACHE_NAMESPACE=gcr.io/iree-oss/base-arm64@sha256:9daa1cdbbf12da8527319ece76a64d06219e04ecb99a4cff6e6364235ddf6c59" \
--env "IREE_BUILD_SETUP_PYTHON_VENV=${BUILD_DIR}/.venv" \
gcr.io/iree-oss/base-arm64@sha256:9daa1cdbbf12da8527319ece76a64d06219e04ecb99a4cff6e6364235ddf6c59 \
./build_tools/cmake/build_all.sh \
"${BUILD_DIR}"
- name: "Testing IREE"
run: |
./build_tools/github_actions/docker_run.sh \
--env "IREE_ARM_SME_QEMU_AARCH64_BIN=/usr/bin/qemu-aarch64" \
gcr.io/iree-oss/base-arm64@sha256:9daa1cdbbf12da8527319ece76a64d06219e04ecb99a4cff6e6364235ddf6c59 \
./build_tools/cmake/ctest_all.sh \
"${BUILD_DIR}"
58 changes: 58 additions & 0 deletions .github/workflows/ci_macos_x86_clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2024 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: CI - macOS x86 clang

on:
schedule:
# Weekday mornings at 09:15 UTC = 01:15 PST (UTC - 8).
- cron: "15 9 * * 1-5"
workflow_dispatch:

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
macos_x86_clang:
runs-on: macos-13
env:
BUILD_DIR: build-macos
defaults:
run:
shell: bash
steps:
- name: "Checking out repository"
uses: actions/[email protected]
- name: "Updating git submodules"
run: git submodule update --init --jobs 8 --depth 1
# There may be multiple versions of Xcode and SDKs installed.
# Select the latest Xcode app to enable using Metal offline toolchain.
- name: "Update Xcode command line tools path"
run: |
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
xcrun metal --version
xcrun metallib --version
- name: "Setting up Python"
uses: actions/[email protected]
with:
python-version: "3.10"
cache: "pip"
- name: "Installing Python packages"
run: pip install -r runtime/bindings/python/iree/runtime/build_requirements.txt
- name: "Installing requirements"
# We need coreutils for `realpath` used in scripts.
# We need bash because the default one on macOS is fairly old and lacks
# features we use in scripts.
run: brew install ninja ccache coreutils bash
- name: "Building IREE"
run: bash ./build_tools/cmake/build_all.sh "${BUILD_DIR}"
- name: "Testing IREE"
run: bash ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}"
52 changes: 52 additions & 0 deletions .github/workflows/ci_windows_x86_msvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2024 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: CI - Windows x86 MSVC

on:
schedule:
# Weekday mornings at 09:15 UTC = 01:15 PST (UTC - 8).
- cron: "15 9 * * 1-5"
workflow_dispatch:

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
windows_x86_msvc:
runs-on: windows-2022
defaults:
run:
shell: bash
env:
BUILD_DIR: build-windows
steps:
- name: "Checking out repository"
uses: actions/[email protected]
with:
submodules: true
- name: "Setting up Python"
uses: actions/[email protected]
with:
python-version: "3.10" # Needs pybind >= 2.10.1 for Python >= 3.11
- name: "Installing Python packages"
run: |
python3 -m venv .venv
.venv/Scripts/activate.bat
python3 -m pip install -r runtime/bindings/python/iree/runtime/build_requirements.txt
- name: "Installing requirements"
run: choco install ccache --yes
- name: "Configuring MSVC"
uses: ilammy/[email protected]
- name: "Building IREE"
run: ./build_tools/cmake/build_all.sh "${BUILD_DIR}"
- name: "Testing IREE"
run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}"
1 change: 1 addition & 0 deletions build_tools/cmake/ctest_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ if [[ "${OSTYPE}" =~ ^msys ]]; then
"iree/tests/e2e/tensor_ops/check_vmvx_ukernel_local-task_unpack.mlir"
# TODO(#11070): Fix argument/result signature mismatch
"iree/tests/e2e/tosa_ops/check_vmvx_local-sync_microkernels_fully_connected.mlir"
"iree/tests/e2e/tosa_ops/check_vmvx_local-sync_microkernels_matmul.mlir"
)
elif [[ "${OSTYPE}" =~ ^darwin ]]; then
excluded_tests+=(
Expand Down
Loading

0 comments on commit 7463cb4

Please sign in to comment.