Add support for hoisting bounded alloc ops (#16171) #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2022 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 | |
# A few notes: | |
# | |
# Variables: | |
# GitHub actions don't have variables or even support normal yaml anchors (they | |
# are specially disabled because...reasons?): | |
# See https://github.com/github-community/community/discussions/4501 | |
# https://github.community/t/support-for-yaml-anchors/16128/92 | |
# https://github.com/actions/runner/issues/1182 | |
# Neither does it have any contexts that are available everywhere. The | |
# top-level `env` field is available in many places, but not all. We already | |
# have a "setup" job that every other job depends on, so we leverage that | |
# for variables that every other job can use, since that *is* available in all | |
# sub-fields of the job. | |
# See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability | |
# and https://github.com/community/community/discussions/27370 | |
# | |
# Runner label ordering: | |
# - self-hosted always has to be listed first in a runs-on block: | |
# https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
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 | |
env: | |
# This needs to be in env instead of the outputs of setup because it contains | |
# the run attempt and we want that to be the current attempt, not whatever | |
# attempt the setup step last ran in. | |
GCS_DIR: gs://iree-github-actions-${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }}-artifacts/${{ github.run_id }}/${{ github.run_attempt }} | |
# Jobs are organized into groups and topologically sorted by dependencies | |
jobs: | |
setup: | |
uses: ./.github/workflows/setup.yml | |
################################### Basic #################################### | |
# Jobs that build all of IREE "normally" | |
############################################################################## | |
build_all: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_all') | |
uses: ./.github/workflows/build_all.yml | |
with: | |
runner-group: ${{ needs.setup.outputs.runner-group }} | |
runner-env: ${{ needs.setup.outputs.runner-env }} | |
write-caches: ${{ needs.setup.outputs.write-caches }} | |
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/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
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:942d01a396f81bff06c5ef4643ba3c9f4500a09010cd30d9ed9be691ddaf1353" \ | |
gcr.io/iree-oss/base-arm64@sha256:942d01a396f81bff06c5ef4643ba3c9f4500a09010cd30d9ed9be691ddaf1353 \ | |
./build_tools/cmake/build_all.sh \ | |
"${BUILD_DIR}" | |
- name: "Testing IREE" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env IREE_CUDA_DISABLE=1 \ | |
--env IREE_VULKAN_DISABLE=1 \ | |
gcr.io/iree-oss/base-arm64@sha256:942d01a396f81bff06c5ef4643ba3c9f4500a09010cd30d9ed9be691ddaf1353 \ | |
./build_tools/cmake/ctest_all.sh \ | |
"${BUILD_DIR}" | |
build_test_all_windows: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_all_windows') | |
runs-on: windows-2022-64core | |
defaults: | |
run: | |
shell: bash | |
env: | |
BUILD_DIR: build-windows | |
IREE_VULKAN_DISABLE: 1 | |
steps: | |
# actions/checkout is for some reason unusably slow on the large managed | |
# Windows GitHub runners so we roll our own. See | |
# https://github.com/actions/checkout/issues/1186 | |
# TODO(gcmn): Factor this out into something reusable across jobs. Can't | |
# be a script because we haven't done the checkout yet :-) | |
- name: "Checking out repository" | |
env: | |
REMOTE_URL: ${{ github.server_url }}/${{ github.repository }} | |
run: | | |
mkdir -p ${GITHUB_WORKSPACE} | |
cd ${GITHUB_WORKSPACE} | |
git init | |
git fetch --depth 1 "${REMOTE_URL}" "${GITHUB_SHA}" | |
git checkout "${GITHUB_SHA}" | |
git submodule update --init --jobs 8 --depth 1 | |
- 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/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0 | |
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/msvc-dev-cmd@7315a94840631165970262a99c72cfb48a65d25d # v1.12.0 | |
# 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-64core | |
run: | | |
./build_tools/cmake/build_all.sh "${BUILD_DIR}" | |
- name: "Testing IREE" | |
run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" | |
build_test_all_macos_arm64: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_all_macos_arm64') | |
runs-on: | |
- ${{ github.repository == 'openxla/iree' && 'self-hosted' || 'macos-11' }} # must come first | |
- runner-group=postsubmit | |
- os-family=macOS | |
env: | |
BUILD_DIR: build-macos | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- 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-xl | |
env: | |
BUILD_DIR: build-macos | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- 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/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0 | |
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-12-xl | |
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') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Building with Bazel" | |
env: | |
IREE_WRITE_REMOTE_BAZEL_CACHE: ${{ needs.setup.outputs.write-caches }} | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env "IREE_WRITE_REMOTE_BAZEL_CACHE=${IREE_WRITE_REMOTE_BAZEL_CACHE}" \ | |
gcr.io/iree-oss/base-bleeding-edge@sha256:14200dacca3a0f3a66f8aa87c6f64729b83a2eeb403b689c24204074ad157418 \ | |
./build_tools/bazel/build_test_all.sh | |
test_all: | |
needs: [setup, build_all] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_all') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
env: | |
BUILD_DIR: ${{ needs.build_all.outputs.build-dir }} | |
BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }} | |
BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Downloading build dir archive" | |
run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" | |
- name: "Extracting build dir archive" | |
run: tar -xf "${BUILD_DIR_ARCHIVE}" | |
- name: "Testing all" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env IREE_CUDA_DISABLE=1 \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/ctest_all.sh \ | |
"${BUILD_DIR}" | |
test_gpu: | |
needs: [setup, build_all] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_gpu') | |
env: | |
BUILD_DIR: ${{ needs.build_all.outputs.build-dir }} | |
BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }} | |
BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- gpu | |
- os-family=Linux | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: Querying GPU information | |
run: | | |
./build_tools/scripts/check_cuda.sh | |
./build_tools/scripts/check_vulkan.sh | |
- name: "Downloading build dir archive" | |
run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" | |
- name: "Extracting build dir archive" | |
run: tar -xf "${BUILD_DIR_ARCHIVE}" | |
- name: "Testing all" | |
env: | |
IREE_NVIDIA_SM80_TESTS_DISABLE: 1 | |
IREE_MULTI_DEVICE_TESTS_DISABLE: 1 | |
IREE_CTEST_LABEL_REGEX: ^requires-gpu|^driver=vulkan$|^driver=cuda$ | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env IREE_NVIDIA_SM80_TESTS_DISABLE \ | |
--env IREE_MULTI_DEVICE_TESTS_DISABLE \ | |
--env IREE_CTEST_LABEL_REGEX \ | |
--env IREE_VULKAN_DISABLE=0 \ | |
--env IREE_VULKAN_F16_DISABLE=0 \ | |
--env IREE_CUDA_DISABLE=0 \ | |
--env IREE_NVIDIA_GPU_TESTS_DISABLE=0 \ | |
--env CTEST_PARALLEL_LEVEL=2 \ | |
--env NVIDIA_DRIVER_CAPABILITIES=all \ | |
--gpus all \ | |
gcr.io/iree-oss/nvidia@sha256:892fefbdf90c93b407303adadfa87f22c0f1e84b7e819e69643c78fc5927c2ba \ | |
bash -euo pipefail -c \ | |
"./build_tools/scripts/check_cuda.sh | |
./build_tools/scripts/check_vulkan.sh | |
./build_tools/cmake/ctest_all.sh ${BUILD_DIR}" | |
test_a100: | |
needs: [setup, build_all] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_a100') | |
env: | |
BUILD_DIR: ${{ needs.build_all.outputs.build-dir }} | |
BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }} | |
BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- a100 | |
- os-family=Linux | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: Querying GPU information | |
run: | | |
./build_tools/scripts/check_cuda.sh | |
./build_tools/scripts/check_vulkan.sh | |
- name: "Downloading build dir archive" | |
run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" | |
- name: "Extracting build dir archive" | |
run: tar -xf "${BUILD_DIR_ARCHIVE}" | |
- name: "Testing all" | |
env: | |
IREE_NVIDIA_SM80_TESTS_DISABLE: 0 | |
IREE_MULTI_DEVICE_TESTS_DISABLE: 1 | |
IREE_CTEST_LABEL_REGEX: ^requires-gpu-sm80|^requires-gpu|^driver=vulkan$|^driver=cuda$ | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env IREE_NVIDIA_SM80_TESTS_DISABLE \ | |
--env IREE_MULTI_DEVICE_TESTS_DISABLE \ | |
--env IREE_CTEST_LABEL_REGEX \ | |
--env IREE_VULKAN_DISABLE=0 \ | |
--env IREE_VULKAN_F16_DISABLE=0 \ | |
--env IREE_CUDA_DISABLE=0 \ | |
--env IREE_NVIDIA_GPU_TESTS_DISABLE=0 \ | |
--env CTEST_PARALLEL_LEVEL=4 \ | |
--env NVIDIA_DRIVER_CAPABILITIES=all \ | |
--gpus all \ | |
gcr.io/iree-oss/nvidia@sha256:892fefbdf90c93b407303adadfa87f22c0f1e84b7e819e69643c78fc5927c2ba \ | |
bash -euo pipefail -c \ | |
"./build_tools/scripts/check_cuda.sh | |
./build_tools/scripts/check_vulkan.sh | |
./build_tools/cmake/ctest_all.sh ${BUILD_DIR}" | |
################################## Subsets ################################### | |
# Jobs that build some subset of IREE | |
############################################################################## | |
build_test_runtime: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_runtime') | |
runs-on: ubuntu-20.04-64core | |
env: | |
BUILD_DIR: build-runtime | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- name: "Checking out runtime submodules" | |
run: ./build_tools/scripts/git/update_runtime_submodules.sh | |
- name: "Building runtime" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env "BUILD_PRESET=test" \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/build_runtime.sh \ | |
"${BUILD_DIR}" | |
- name: "Testing runtime" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env IREE_VULKAN_DISABLE=1 \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/ctest_all.sh \ | |
"${BUILD_DIR}" | |
build_test_runtime_arm64: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_runtime_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-runtime-arm64 | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- name: "Checking out runtime submodules" | |
run: ./build_tools/scripts/git/update_runtime_submodules.sh | |
- name: "Building runtime" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env "BUILD_PRESET=test" \ | |
gcr.io/iree-oss/base-arm64@sha256:942d01a396f81bff06c5ef4643ba3c9f4500a09010cd30d9ed9be691ddaf1353 \ | |
./build_tools/cmake/build_runtime.sh \ | |
"${BUILD_DIR}" | |
- name: "Testing runtime" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env IREE_VULKAN_DISABLE=1 \ | |
gcr.io/iree-oss/base-arm64@sha256:942d01a396f81bff06c5ef4643ba3c9f4500a09010cd30d9ed9be691ddaf1353 \ | |
./build_tools/cmake/ctest_all.sh \ | |
"${BUILD_DIR}" | |
build_test_runtime_windows: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_test_runtime_windows') | |
runs-on: windows-2022-64core | |
defaults: | |
run: | |
shell: bash | |
env: | |
BUILD_DIR: build-runtime-windows | |
IREE_VULKAN_DISABLE: 1 | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- name: "Checking out runtime submodules" | |
run: ./build_tools/scripts/git/update_runtime_submodules.sh | |
- name: "Configuring MSVC" | |
uses: ilammy/msvc-dev-cmd@7315a94840631165970262a99c72cfb48a65d25d # v1.12.0 | |
- name: "Installing Python requirements" | |
run: pip install -r ./runtime/bindings/python/iree/runtime/build_requirements.txt | |
- name: "Building runtime" | |
env: | |
BUILD_PRESET: "test" | |
run: ./build_tools/cmake/build_runtime.sh "${BUILD_DIR}" | |
- name: "Testing runtime" | |
run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" | |
################################# Tensorflow ################################# | |
# Jobs that test the IREE-Tensorflow integrations | |
############################################################################## | |
test_tf_integrations: | |
needs: [setup, build_all] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_tf_integrations') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
env: | |
BUILD_DIR: ${{ needs.build_all.outputs.build-dir }} | |
BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }} | |
BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Downloading build dir archive" | |
run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" | |
- name: "Extracting build dir archive" | |
run: tar -xf "${BUILD_DIR_ARCHIVE}" | |
- name: "Running TF integrations tests" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env IREE_VMVX_DISABLE=0 \ | |
gcr.io/iree-oss/frontends@sha256:8e40a290cfd4c982645054b157691510a7aae5a0d5b53088ac491709a4d83f60 \ | |
build_tools/cmake/run_tf_tests.sh \ | |
"${BUILD_DIR}" | |
test_tf_integrations_gpu: | |
needs: [setup, build_all] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_tf_integrations_gpu') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- gpu | |
- os-family=Linux | |
env: | |
BUILD_DIR: ${{ needs.build_all.outputs.build-dir }} | |
BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }} | |
BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Downloading build dir archive" | |
run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" | |
- name: "Extracting build dir archive" | |
run: tar -xf "${BUILD_DIR_ARCHIVE}" | |
- name: "Running TF integrations tests" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env IREE_VULKAN_DISABLE=0 \ | |
--env IREE_LLVM_CPU_DISABLE=1 \ | |
--env IREE_NVIDIA_GPU_TESTS_DISABLE=0 \ | |
--gpus all \ | |
--env NVIDIA_DRIVER_CAPABILITIES=all \ | |
gcr.io/iree-oss/frontends-nvidia@sha256:693afd91711e50e52a669eee074ad9007bf36745f4b1d1f5c3a19b82bd2d7c3a \ | |
bash -euo pipefail -c \ | |
"./build_tools/scripts/check_cuda.sh | |
./build_tools/scripts/check_vulkan.sh | |
build_tools/cmake/run_tf_tests.sh ${BUILD_DIR}" | |
############################### Configurations ############################### | |
# Jobs that build IREE in some non-default configuration | |
############################################################################## | |
python_release_packages: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'python_release_packages') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
steps: | |
- name: Prefetch Docker | |
run: | | |
docker pull ghcr.io/nod-ai/manylinux_x86_64:main & | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Setting up Python" | |
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0 | |
with: | |
python-version: "3.9" | |
- name: Wait for docker pull | |
run: | | |
wait | |
- name: Build runtime wheels (Linux) | |
shell: bash | |
env: | |
packages: "iree-runtime" | |
output_dir: "${{ github.workspace }}/bindist" | |
# Note when upgrading: Build just one Python version synced to our | |
# minimum. | |
override_python_versions: cp39-cp39 | |
run: | | |
output_dir="$PWD" ./build_tools/python_deploy/build_linux_packages.sh | |
- name: Validate runtime wheel (Linux) | |
shell: bash | |
run: | | |
pip install --upgrade pip | |
pip install --no-index -f $PWD -v iree-runtime | |
echo "Testing default runtime:" | |
python -m iree.runtime._package_test | |
echo "Testing tracy runtime:" | |
# GH runners don't expose the TSC but we want to make sure the basic packaging | |
# works, so override the check with TRACY_NO_INVARIANT_CHECK=1 (per instructions | |
# if this is left off). | |
TRACY_NO_INVARIANT_CHECK=1 IREE_PY_RUNTIME=tracy \ | |
python -m iree.runtime._package_test | |
# Note that it is just a trade-off decision to have this serialized | |
# as a separate step vs parallelized as a separate job. The runtime | |
# build is fast, pays the clone/docker overhead and provides early | |
# signal (since it runs in just a couple of minutes). | |
- name: Build compiler wheels (Linux) | |
shell: bash | |
env: | |
packages: "iree-compiler" | |
# Note when upgrading: Build just one Python version synced to our | |
# minimum. | |
override_python_versions: cp39-cp39 | |
run: | | |
output_dir="$PWD" ./build_tools/python_deploy/build_linux_packages.sh | |
- name: Validate compiler wheel (Linux) | |
shell: bash | |
run: | | |
pip install --upgrade pip | |
# Pre-fetch optional deps that iree-compiler needs (but we constrain that | |
# to not consult a package index). | |
pip install onnx>=1.15.0 | |
pip install --no-index -f $PWD -v iree-compiler[onnx] | |
echo "Testing default compiler:" | |
python -m iree.compiler._package_test | |
asan: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'asan') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Building and testing with AddressSanitizer" | |
env: | |
IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }} | |
run: | | |
# Note that this uses the latest version of the clang compiler, etc. | |
# This gives us access to the latest features and validates that IREE | |
# builds using the latest versions. | |
./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=base-bleeding-edge@sha256:14200dacca3a0f3a66f8aa87c6f64729b83a2eeb403b689c24204074ad157418" \ | |
gcr.io/iree-oss/base-bleeding-edge@sha256:14200dacca3a0f3a66f8aa87c6f64729b83a2eeb403b689c24204074ad157418 \ | |
./build_tools/cmake/build_and_test_asan.sh | |
tsan: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'tsan') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Building and testing with ThreadSanitizer" | |
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@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75" \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/build_and_test_tsan.sh | |
small_runtime: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'small_runtime') | |
runs-on: ubuntu-20.04-64core | |
env: | |
BUILD_DIR: build-runtime | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- name: "Checking out runtime submodules" | |
run: ./build_tools/scripts/git/update_runtime_submodules.sh | |
- name: "Building size-optimized runtime" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/build_runtime_small.sh \ | |
"${BUILD_DIR}" | |
- name: "Testing runtime" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env IREE_VULKAN_DISABLE=1 \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/ctest_all.sh \ | |
"${BUILD_DIR}" | |
gcc: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'gcc') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
env: | |
BUILD_DIR: build-gcc | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Building IREE with gcc" | |
env: | |
IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }} | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env CC=/usr/bin/gcc-9 \ | |
--env CXX=/usr/bin/g++-9 \ | |
--env CMAKE_BUILD_TYPE=Release \ | |
--env "IREE_TARGET_BACKEND_WEBGPU=OFF" \ | |
--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@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75" \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/build_all.sh \ | |
"${BUILD_DIR}" | |
tracing: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'tracing') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
env: | |
BUILD_DIR: build-tracing | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Building IREE with tracing enabled" | |
env: | |
IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }} | |
run: | | |
# TODO(#11394): Enable Web GPU | |
./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@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75" \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/build_tracing.sh \ | |
"${BUILD_DIR}" | |
debug: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'debug') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
env: | |
BUILD_DIR: build-debug | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Building IREE in Debug configuration" | |
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 "CMAKE_BUILD_TYPE=Debug" \ | |
--env "CCACHE_NAMESPACE=gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75" \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/build_all.sh \ | |
"${BUILD_DIR}" | |
byo_llvm: | |
needs: setup | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'byo_llvm') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
submodules: true | |
- name: "Building and testing with bring-your-own-LLVM" | |
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@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75" \ | |
gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75 \ | |
./build_tools/cmake/build_and_test_byo_llvm.sh | |
############################### Configurations ############################### | |
# Jobs that build and run IREE e2e tests/benchmarks # | |
############################################################################## | |
build_benchmark_tools: | |
needs: [setup, build_all] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_benchmark_tools') | |
uses: ./.github/workflows/build_benchmark_tools.yml | |
with: | |
runner-group: ${{ needs.setup.outputs.runner-group }} | |
runner-env: ${{ needs.setup.outputs.runner-env }} | |
build-dir: ${{ needs.build_all.outputs.build-dir }} | |
build-dir-archive: ${{ needs.build_all.outputs.build-dir-archive }} | |
build-dir-gcs-artifact: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
build_e2e_test_artifacts: | |
needs: [setup, build_all] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_e2e_test_artifacts') | |
uses: ./.github/workflows/build_e2e_test_artifacts.yml | |
with: | |
runner-group: ${{ needs.setup.outputs.runner-group }} | |
runner-env: ${{ needs.setup.outputs.runner-env }} | |
build-dir: ${{ needs.build_all.outputs.build-dir }} | |
build-dir-archive: ${{ needs.build_all.outputs.build-dir-archive }} | |
build-dir-gcs-artifact: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
benchmark-presets: ${{ needs.setup.outputs.benchmark-presets }} | |
shard-count: "c2-standard-60=2,default=1" | |
compilation_benchmarks: | |
needs: [setup, build_e2e_test_artifacts] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'compilation_benchmarks') && needs.setup.outputs.benchmark-presets != '' | |
uses: ./.github/workflows/benchmark_compilation.yml | |
with: | |
runner-group: ${{ needs.setup.outputs.runner-group }} | |
runner-env: ${{ needs.setup.outputs.runner-env }} | |
e2e-test-artifacts-dir: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-dir }} | |
e2e-test-artifacts-gcs-artifact-dir: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-gcs-artifact-dir }} | |
e2e-test-artifacts-build-log: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-build-log }} | |
e2e-test-artifacts-build-log-gcs-artifact: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-build-log-gcs-artifact }} | |
execution_benchmarks: | |
needs: [setup, build_benchmark_tools, build_e2e_test_artifacts] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'execution_benchmarks') && needs.setup.outputs.benchmark-presets != '' | |
uses: ./.github/workflows/benchmark_execution.yml | |
with: | |
# env.GCS_DIR is also duplicated in this workflow. See the note there on | |
# why this is. | |
runner-group: ${{ needs.setup.outputs.runner-group }} | |
runner-env: ${{ needs.setup.outputs.runner-env }} | |
e2e-test-artifacts-dir: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-dir }} | |
e2e-test-artifacts-gcs-artifact-dir: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-gcs-artifact-dir }} | |
benchmark-tools-gcs-artifact-dir: ${{ needs.build_benchmark_tools.outputs.benchmark-tools-gcs-artifact-dir }} | |
process_benchmark_results: | |
needs: [setup, compilation_benchmarks, execution_benchmarks] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'process_benchmark_results') && needs.setup.outputs.benchmark-presets != '' | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
env: | |
COMPILE_STATS_RESULTS: ${{ needs.compilation_benchmarks.outputs.compile-stats-results }} | |
COMPILE_STATS_RESULTS_GCS_ARTIFACT: ${{ needs.compilation_benchmarks.outputs.compile-stats-results-gcs-artifact }} | |
# Empty if no execution benchmark runs. | |
EXECUTION_BENCHMARK_RESULTS_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-dir }} | |
# Empty if no execution benchmark runs. | |
EXECUTION_BENCHMARK_RESULTS_GCS_ARTIFACT_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-gcs-artifact-dir }} | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
# We need the full history (and main branch) to generate the report. | |
fetch-depth: 0 | |
- name: Downloading compilation benchmark results | |
run: | | |
gcloud storage cp \ | |
"${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" \ | |
"${COMPILE_STATS_RESULTS}" | |
- name: Downloading execution benchmark results | |
id: download-execution-results | |
# Skip the download if there is no execution benchmark results (e.g. no | |
# benchmark matches the preset/filter). In such case, no benchmark job | |
# is run in benchmark_execution.yml and the output variables are empty. | |
if: env.EXECUTION_BENCHMARK_RESULTS_GCS_ARTIFACT_DIR != '' | |
run: | | |
gcloud storage cp -r \ | |
"${EXECUTION_BENCHMARK_RESULTS_GCS_ARTIFACT_DIR}/benchmark-results-*.json" \ | |
"${EXECUTION_BENCHMARK_RESULTS_DIR}" | |
echo "execution-benchmark-results-pattern=${EXECUTION_BENCHMARK_RESULTS_DIR}/benchmark-results-*.json" >> "${GITHUB_OUTPUT}" | |
- name: Generating comment | |
if: fromJson(needs.setup.outputs.is-pr) | |
id: generate-comment | |
env: | |
# Wildcard pattern to match all execution benchmark results. Empty if | |
# execution_benchmarks is skipped, which results in no match. | |
EXECUTION_BENCHMARK_RESULTS_PATTERN: ${{ steps.download-execution-results.outputs.execution-benchmark-results-pattern }} | |
IREE_BUILD_URL: https://github.com/openxla/iree/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
BENCHMARK_COMMENT_ARTIFACT: benchmark-comment.json | |
run: | | |
build_tools/github_actions/docker_run.sh \ | |
gcr.io/iree-oss/benchmark-report@sha256:7498c6f32f63f13faf085463cc38656d4297519c824e63e1c99c8c258147f6ff \ | |
./build_tools/benchmarks/generate_benchmark_comment.py \ | |
--verbose \ | |
--pr_number="${PR_NUMBER}" \ | |
--pr_committish="${GITHUB_SHA}" \ | |
--pr_base_branch="origin/${GITHUB_BASE_REF}" \ | |
--comment_type="benchmark-summary" \ | |
--build_url="${IREE_BUILD_URL}" \ | |
--benchmark_files="${EXECUTION_BENCHMARK_RESULTS_PATTERN}" \ | |
--compile_stats_files="${COMPILE_STATS_RESULTS}" \ | |
--output="${BENCHMARK_COMMENT_ARTIFACT}" | |
echo "benchmark-comment-artifact=${BENCHMARK_COMMENT_ARTIFACT}" >> "${GITHUB_OUTPUT}" | |
- name: Uploading comment artifact | |
# Due to security reasons, instead of posting the comment to PR, we only | |
# upload the comment data in presubmit workflow and trigger the posting | |
# workflow on the main branch. See post_benchmark_comment.yaml | |
if: fromJson(needs.setup.outputs.is-pr) | |
env: | |
BENCHMARK_COMMENT_ARTIFACT: ${{ steps.generate-comment.outputs.benchmark-comment-artifact }} | |
BENCHMARK_COMMENT_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.generate-comment.outputs.benchmark-comment-artifact }} | |
run: | | |
gcloud storage cp \ | |
"${BENCHMARK_COMMENT_ARTIFACT}" \ | |
"${BENCHMARK_COMMENT_GCS_ARTIFACT}" | |
- name: Uploading results to dashboard | |
if: github.ref_name == 'main' | |
env: | |
EXECUTION_BENCHMARK_RESULTS_PATTERN: ${{ steps.download-execution-results.outputs.execution-benchmark-results-pattern }} | |
IREE_DASHBOARD_API_TOKEN: ${{ secrets.IREE_DASHBOARD_API_TOKEN }} | |
run: | | |
build_tools/github_actions/docker_run.sh \ | |
--env "IREE_DASHBOARD_API_TOKEN=${IREE_DASHBOARD_API_TOKEN}" \ | |
gcr.io/iree-oss/benchmark-report@sha256:7498c6f32f63f13faf085463cc38656d4297519c824e63e1c99c8c258147f6ff \ | |
./build_tools/benchmarks/upload_benchmarks_to_dashboard.py \ | |
--verbose \ | |
--benchmark_files="${EXECUTION_BENCHMARK_RESULTS_PATTERN}" \ | |
--compile_stats_files="${COMPILE_STATS_RESULTS}" | |
############################## Crosscompilation ############################## | |
# Jobs that cross-compile IREE for other platforms | |
############################################################################## | |
cross_compile_and_test: | |
needs: [setup, build_all] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'cross_compile_and_test') | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- cpu | |
- os-family=Linux | |
strategy: | |
matrix: | |
target: | |
- platform: linux | |
arch: riscv_64 | |
abi: lp64d | |
docker_image: "gcr.io/iree-oss/riscv@sha256:c630a314daf57b6920cb0ebae8aee2be1adab8e5180749f8460af7fb3ae83b66" | |
build_script: "./build_tools/cmake/build_riscv.sh" | |
test_script: "./build_tools/cmake/test_riscv.sh" | |
- platform: linux | |
arch: riscv_32 | |
abi: ilp32d | |
docker_image: "gcr.io/iree-oss/riscv@sha256:c630a314daf57b6920cb0ebae8aee2be1adab8e5180749f8460af7fb3ae83b66" | |
build_script: "./build_tools/cmake/build_riscv.sh" | |
test_script: "./build_tools/cmake/test_riscv.sh" | |
- platform: generic | |
arch: riscv_32 | |
abi: ilp32 | |
docker_image: "gcr.io/iree-oss/riscv@sha256:c630a314daf57b6920cb0ebae8aee2be1adab8e5180749f8460af7fb3ae83b66" | |
build_script: "./build_tools/cmake/build_riscv.sh" | |
test_script: "./tests/riscv32/smoke.sh" | |
- platform: emscripten | |
arch: wasm32 | |
abi: wasm32 | |
docker_image: "gcr.io/iree-oss/emscripten@sha256:fe9bcd0851243c7b04d577d9e8a663860720484ec932bb53d4c56aec7f7b6d64" | |
build_script: "./build_tools/cmake/build_runtime_emscripten.sh" | |
# No test script | |
env: | |
PLATFORM: ${{ matrix.target.platform }} | |
ARCH: ${{ matrix.target.arch }} | |
ABI: ${{ matrix.target.abi }} | |
DOCKER_IMAGE: ${{ matrix.target.docker_image }} | |
BUILD_SCRIPT: ${{ matrix.target.build_script }} | |
TEST_SCRIPT: ${{ matrix.target.test_script }} | |
HOST_BUILD_DIR: ${{ needs.build_all.outputs.build-dir }} | |
HOST_BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }} | |
HOST_BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
TARGET_BUILD_DIR: build-${{ matrix.target.platform }}-${{ matrix.target.arch }} | |
IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }} | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- name: "Checking out runtime submodules" | |
run: ./build_tools/scripts/git/update_runtime_submodules.sh | |
- name: "Downloading build dir archive" | |
run: gcloud storage cp "${HOST_BUILD_DIR_GCS_ARTIFACT}" "${HOST_BUILD_DIR_ARCHIVE}" | |
- name: "Extracting build dir archive" | |
run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" | |
- name: "Build cross-compiling target" | |
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=${DOCKER_IMAGE}" \ | |
--env "IREE_TARGET_PLATFORM=${PLATFORM}" \ | |
--env "IREE_TARGET_ARCH=${ARCH}" \ | |
--env "IREE_TARGET_ABI=${ABI}" \ | |
--env "IREE_TARGET_BUILD_DIR=${TARGET_BUILD_DIR}" \ | |
--env "BUILD_PRESET=test" \ | |
--env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ | |
"${DOCKER_IMAGE}" \ | |
"${BUILD_SCRIPT}" | |
- name: "Test cross-compiling target" | |
if: matrix.target.test_script | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env "IREE_TARGET_PLATFORM=${PLATFORM}" \ | |
--env "IREE_TARGET_ARCH=${ARCH}" \ | |
--env "IREE_TARGET_BUILD_DIR=${TARGET_BUILD_DIR}" \ | |
--env "BUILD_PRESET=test" \ | |
"${DOCKER_IMAGE}" \ | |
"${TEST_SCRIPT}" | |
# Android cross-compilation and test is separated from cross_compile_and_test | |
# because some tests need to run on physical devices instead of emulators. And | |
# we need a fine-control on which tests only run on postsubmit as some devices | |
# are not scalable (while we want to test with Android emulator on ARM VMs on | |
# presubmit), which requires dynamic matrix generation (because "if" condition | |
# can't access matrix variable to skip certain matrix jobs for presubmit). | |
build_and_test_android: | |
needs: [setup, build_all] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_and_test_android') | |
uses: ./.github/workflows/build_and_test_android.yml | |
with: | |
runner-group: ${{ needs.setup.outputs.runner-group }} | |
runner-env: ${{ needs.setup.outputs.runner-env }} | |
write-caches: ${{ needs.setup.outputs.write-caches }} | |
is-pr: ${{ fromJson(needs.setup.outputs.is-pr) }} | |
build-dir: ${{ needs.build_all.outputs.build-dir }} | |
build-dir-archive: ${{ needs.build_all.outputs.build-dir-archive }} | |
build-dir-gcs-artifact: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
test_benchmark_suites: | |
needs: [setup, build_all, build_e2e_test_artifacts] | |
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_benchmark_suites') | |
strategy: | |
matrix: | |
target: | |
- platform: linux | |
arch: riscv_64 | |
docker_image: "gcr.io/iree-oss/riscv@sha256:c630a314daf57b6920cb0ebae8aee2be1adab8e5180749f8460af7fb3ae83b66" | |
run_scripts: "./build_tools/cmake/build_riscv.sh && ./build_tools/cmake/test_riscv.sh" | |
- platform: linux | |
arch: riscv_32 | |
docker_image: "gcr.io/iree-oss/riscv@sha256:c630a314daf57b6920cb0ebae8aee2be1adab8e5180749f8460af7fb3ae83b66" | |
run_scripts: "./build_tools/cmake/build_riscv.sh && ./build_tools/cmake/test_riscv.sh" | |
- platform: linux | |
arch: x86_64 | |
docker_image: "gcr.io/iree-oss/base@sha256:61e9aae211007dbad95e1f429e9e5121fd5968c204791038424979c21146cf75" | |
run_scripts: "./build_tools/cmake/test_benchmark_suites_on_linux.sh" | |
# Requires Intel CascadeLake CPU. | |
host_machine: c2s601t | |
runs-on: | |
- self-hosted # must come first | |
- runner-group=${{ needs.setup.outputs.runner-group }} | |
- environment=${{ needs.setup.outputs.runner-env }} | |
- ${{ matrix.target.host_machine || 'cpu' }} # Default to generic x86_64 VM. | |
env: | |
PLATFORM: ${{ matrix.target.platform }} | |
ARCH: ${{ matrix.target.arch }} | |
DOCKER_IMAGE: ${{ matrix.target.docker_image }} | |
RUN_SCRIPTS: ${{ matrix.target.run_scripts }} | |
HOST_BUILD_DIR: ${{ needs.build_all.outputs.build-dir }} | |
HOST_BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }} | |
HOST_BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} | |
TARGET_BUILD_DIR: build-${{ matrix.target.platform }}-${{ matrix.target.arch }} | |
E2E_TEST_ARTIFACTS_DIR: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-dir }} | |
E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-gcs-artifact-dir }} | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- name: "Checking out runtime submodules" | |
run: ./build_tools/scripts/git/update_runtime_submodules.sh | |
- name: "Downloading build dir archive" | |
run: gcloud storage cp "${HOST_BUILD_DIR_GCS_ARTIFACT}" "${HOST_BUILD_DIR_ARCHIVE}" | |
- name: "Extracting build dir archive" | |
run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" | |
# TODO(#11136): Only download the needed artifacts instead of everything. | |
- name: "Downloading e2e test artifacts" | |
run: | | |
mkdir -p ${E2E_TEST_ARTIFACTS_DIR} | |
gcloud storage cp -r "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}/*" "${E2E_TEST_ARTIFACTS_DIR}" | |
- name: "Build iree-run-module and test benchmark suite modules" | |
run: | | |
./build_tools/github_actions/docker_run.sh \ | |
--env "IREE_TARGET_PLATFORM=${PLATFORM}" \ | |
--env "IREE_TARGET_ARCH=${ARCH}" \ | |
--env "IREE_TARGET_BUILD_DIR=${TARGET_BUILD_DIR}" \ | |
--env "BUILD_PRESET=benchmark-suite-test" \ | |
--env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ | |
--env "E2E_TEST_ARTIFACTS_DIR=${E2E_TEST_ARTIFACTS_DIR}" \ | |
"${DOCKER_IMAGE}" \ | |
bash -euo pipefail -c \ | |
"${RUN_SCRIPTS}" | |
############################################################################## | |
# Depends on all the other jobs to provide a single anchor that indicates the | |
# final status. Status reporting will become more sophisticated in the future | |
# and we can hopefully avoid the need to explicitly list every single job... | |
summary: | |
# Even if you have an explicit if condition, you still need to override | |
# GitHub's default behavior of not running if any dependencies failed. | |
if: always() | |
runs-on: ubuntu-20.04 | |
needs: | |
- setup | |
# Basic | |
- build_all | |
- test_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_gpu | |
- test_a100 | |
# Subsets | |
- build_test_runtime | |
- build_test_runtime_arm64 | |
- build_test_runtime_windows | |
# Tensorflow | |
- test_tf_integrations | |
- test_tf_integrations_gpu | |
# Configurations | |
- python_release_packages | |
- asan | |
- tsan | |
- small_runtime | |
- gcc | |
- tracing | |
- debug | |
- byo_llvm | |
# Crosscompilation | |
- cross_compile_and_test | |
- build_and_test_android | |
# Artifacts for e2e testing and benchmarking | |
- build_benchmark_tools | |
- build_e2e_test_artifacts | |
# Test modules from benchmark pipeline | |
- test_benchmark_suites | |
# Benchmark pipeline | |
- compilation_benchmarks | |
- execution_benchmarks | |
- process_benchmark_results | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
- name: Getting failed jobs | |
id: failed_jobs | |
run: | | |
echo '${{ toJson(needs) }}' | |
FAILED_JOBS="$(echo '${{ toJson(needs) }}' \ | |
| jq --raw-output \ | |
'map_values(select(.result!="success" and .result!="skipped")) | keys | join(",")' \ | |
)" | |
echo "failed-jobs=${FAILED_JOBS}" >> $GITHUB_OUTPUT | |
if [[ "${FAILED_JOBS}" != "" ]]; then | |
echo "The following jobs failed: ${FAILED_JOBS}" | |
exit 1 | |
fi | |
- name: Show useful artifact links | |
if: always() | |
env: | |
# If the job of an artifact is skipped or failed, we show "NOT_PRESENT". | |
BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact || 'NOT_PRESENT' }} | |
E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-gcs-artifact-dir || 'NOT_PRESENT' }} | |
BENCHMARK_TOOLS_GCS_ARTIFACT_DIR: ${{ needs.build_benchmark_tools.outputs.benchmark-tools-gcs-artifact-dir || 'NOT_PRESENT' }} | |
EXECUTION_BENCHMARK_RESULTS_GCS_ARTIFACT_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-gcs-artifact-dir || 'NOT_PRESENT' }} | |
COMPILATION_BENCHMARK_RESULTS_GCS_ARTIFACT: ${{ needs.compilation_benchmarks.outputs.compile-stats-results-gcs-artifact || 'NOT_PRESENT' }} | |
run: | | |
envsubst < ./.github/workflows/ARTIFACT_SUMMARY_TEMPLATE.md >> "${GITHUB_STEP_SUMMARY}" | |
- name: Posting to Discord | |
uses: sarisia/actions-status-discord@61114b793b460ee85fe38ad3fccc78c7ead38d55 # v1.11.1 | |
if: failure() && github.ref_name == 'main' | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
description: "The following jobs failed: ${{ steps.failed_jobs.outputs.failed-jobs }}" | |
url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}" |