From 45ee7aeed50c97e9b78984939d7952f7d1534cac Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 12:33:14 -0800 Subject: [PATCH 01/23] Add `IREE_USE_LOCAL_CCACHE` mode to setup_ccache.sh. Also use `$(which ccache)` to make sure that the latest install of ccache is used. --- build_tools/cmake/build_all.sh | 2 +- build_tools/cmake/build_and_test_asan.sh | 2 +- build_tools/cmake/build_and_test_tsan.sh | 2 +- build_tools/cmake/build_android.sh | 2 +- build_tools/cmake/build_host_tools.sh | 2 +- build_tools/cmake/build_runtime.sh | 2 +- build_tools/cmake/build_runtime_emscripten.sh | 2 +- build_tools/cmake/build_runtime_small.sh | 2 +- build_tools/cmake/build_tracing.sh | 2 +- build_tools/cmake/setup_ccache.sh | 29 +++++++++++++++++-- 10 files changed, 35 insertions(+), 12 deletions(-) diff --git a/build_tools/cmake/build_all.sh b/build_tools/cmake/build_all.sh index aa438abce19c..689a63b3159f 100755 --- a/build_tools/cmake/build_all.sh +++ b/build_tools/cmake/build_all.sh @@ -73,6 +73,6 @@ echo "Building sample deps" echo "------------------" "$CMAKE_BIN" --build "${BUILD_DIR}" --target iree-sample-deps -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_and_test_asan.sh b/build_tools/cmake/build_and_test_asan.sh index 6e3cebd44e61..c2be666796e9 100755 --- a/build_tools/cmake/build_and_test_asan.sh +++ b/build_tools/cmake/build_and_test_asan.sh @@ -64,7 +64,7 @@ echo "Building microbenchmark suites" echo "------------------" "${CMAKE_BIN?}" --build "${BUILD_DIR?}" --target iree-microbenchmark-suites -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_and_test_tsan.sh b/build_tools/cmake/build_and_test_tsan.sh index fadef80f238e..cb96cbe4b8ee 100755 --- a/build_tools/cmake/build_and_test_tsan.sh +++ b/build_tools/cmake/build_and_test_tsan.sh @@ -72,7 +72,7 @@ echo "Building sample deps" echo "------------------" "$CMAKE_BIN" --build "${BUILD_DIR?}" --target iree-sample-deps -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_android.sh b/build_tools/cmake/build_android.sh index cb4d271bd621..98a40a045d29 100755 --- a/build_tools/cmake/build_android.sh +++ b/build_tools/cmake/build_android.sh @@ -94,6 +94,6 @@ echo "Building sample deps for device" echo "------------------" "${CMAKE_BIN}" --build "${BUILD_DIR}" --target iree-sample-deps -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_host_tools.sh b/build_tools/cmake/build_host_tools.sh index a6e4973d64f2..5956cc36d291 100755 --- a/build_tools/cmake/build_host_tools.sh +++ b/build_tools/cmake/build_host_tools.sh @@ -51,6 +51,6 @@ declare -a CMAKE_ARGS=( "${CMAKE_BIN}" "${CMAKE_ARGS[@]}" "${CMAKE_BIN}" --build "${BUILD_DIR}" --target install -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_runtime.sh b/build_tools/cmake/build_runtime.sh index 68c08be8bf64..7b7c91aecfc7 100755 --- a/build_tools/cmake/build_runtime.sh +++ b/build_tools/cmake/build_runtime.sh @@ -76,6 +76,6 @@ case "${BUILD_PRESET}" in ;; esac -if (( IREE_READ_REMOTE_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_runtime_emscripten.sh b/build_tools/cmake/build_runtime_emscripten.sh index 5aa1770a136c..1a6da539750a 100755 --- a/build_tools/cmake/build_runtime_emscripten.sh +++ b/build_tools/cmake/build_runtime_emscripten.sh @@ -54,6 +54,6 @@ echo "Building sample deps" echo "------------------" "${CMAKE_BIN?}" --build . --target iree-sample-deps -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_runtime_small.sh b/build_tools/cmake/build_runtime_small.sh index 7bf4163311d9..292a0726b020 100755 --- a/build_tools/cmake/build_runtime_small.sh +++ b/build_tools/cmake/build_runtime_small.sh @@ -25,6 +25,6 @@ source build_tools/cmake/setup_ccache.sh -DIREE_BUILD_COMPILER=OFF "${CMAKE_BIN?}" --build "${BUILD_DIR}" -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_tracing.sh b/build_tools/cmake/build_tracing.sh index 3610bef2e01c..e38a142f7466 100755 --- a/build_tools/cmake/build_tracing.sh +++ b/build_tools/cmake/build_tracing.sh @@ -29,6 +29,6 @@ source build_tools/cmake/setup_ccache.sh -DIREE_BUILD_COMPILER=OFF "${CMAKE_BIN?}" --build "${BUILD_DIR}" -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/setup_ccache.sh b/build_tools/cmake/setup_ccache.sh index dd5a23463bb8..de1fc956e6f3 100644 --- a/build_tools/cmake/setup_ccache.sh +++ b/build_tools/cmake/setup_ccache.sh @@ -4,22 +4,45 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# This file must be *sourced* not executed. +# ccache (https://ccache.dev/) setup, with read/write + local/remote options. +# +# Defaults to only reading from the shared remote cache (hosted on GCS) used by +# our Linux CI. The postsubmit CI writes to the cache, for presubmit CI and +# local builds to read from. +# +# Local caches can also be used to interface with external remote caches +# (like https://github.com/actions/cache) by +# 1. downloading the cache directory +# 2. sourcing this file with IREE_USE_LOCAL_CCACHE=1 IREE_READ_REMOTE_CCACHE=0 +# 3. building with CMake +# 4. uploading the cache directory (optionally) +# +# Note: this file must be *sourced* not executed. set -euo pipefail +# Configuration environment variables. IREE_READ_REMOTE_CCACHE="${IREE_READ_REMOTE_CCACHE:-1}" IREE_WRITE_REMOTE_CCACHE="${IREE_WRITE_REMOTE_CCACHE:-0}" +IREE_USE_LOCAL_CCACHE="${IREE_USE_LOCAL_CCACHE:-0}" + if (( ${IREE_WRITE_REMOTE_CCACHE} == 1 && ${IREE_READ_REMOTE_CCACHE} != 1 )); then echo "Can't have 'IREE_WRITE_REMOTE_CCACHE' (${IREE_WRITE_REMOTE_CCACHE})" \ " set without 'IREE_READ_REMOTE_CCACHE' (${IREE_READ_REMOTE_CCACHE})" fi +if (( ${IREE_USE_LOCAL_CCACHE} == 1 && ${IREE_READ_REMOTE_CCACHE} == 1)); then + echo "Can't have 'IREE_USE_LOCAL_CCACHE' (${IREE_USE_LOCAL_CCACHE})" \ + " set with 'IREE_READ_REMOTE_CCACHE' (${IREE_READ_REMOTE_CCACHE})" +fi + +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then + export CMAKE_C_COMPILER_LAUNCHER=$(which ccache) + export CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) +fi if (( IREE_READ_REMOTE_CCACHE == 1 )); then export CCACHE_REMOTE_STORAGE="http://storage.googleapis.com/iree-sccache/ccache" export CCACHE_REMOTE_ONLY=1 - export CMAKE_C_COMPILER_LAUNCHER=ccache - export CMAKE_CXX_COMPILER_LAUNCHER=ccache if (( IREE_WRITE_REMOTE_CCACHE == 1 )); then set +x # Don't leak the token (even though it's short-lived) export CCACHE_REMOTE_STORAGE="${CCACHE_REMOTE_STORAGE}|bearer-token=${IREE_CCACHE_GCP_TOKEN}" From 0a626236209bcafa8bd71a41a3badde5e1b22848 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 13:25:45 -0800 Subject: [PATCH 02/23] Use actions/cache in build_test_runtime_windows job. Using two caches: one for git submodules and one for ccache. The caches are always read/restored, and they are only written/saved when `needs.setup.outputs.write-caches` is true (postsubmit workflows). --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b8f2d7070d1..2edcfd01f2c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -331,18 +331,51 @@ jobs: steps: - name: "Checking out repository" uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + # Restore caches. + - name: "Fetching cache (git submodules)" + uses: actions/cache/restore@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 + with: + path: .git/modules + key: gitmodules_runtime_windows_${{ github.sha }} + restore-keys: gitmodules_runtime_windows + - name: "Fetching cache (CMake/ccache)" + uses: actions/cache/restore@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 + with: + path: ${{ github.workspace }}/.ccache + key: ccache_runtime_windows_${{ github.sha }} + restore-keys: ccache_runtime_windows + # Fetch deps. - 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: "Installing requirements" + run: | + pip install -r ./runtime/bindings/python/iree/runtime/build_requirements.txt + choco install ccache --yes + # Finally: build and run tests. - name: "Building runtime" env: BUILD_PRESET: "test" + IREE_USE_LOCAL_CCACHE: 1 + IREE_READ_REMOTE_CCACHE: 0 + CCACHE_DIR: ${{ github.workspace }}/.ccache run: ./build_tools/cmake/build_runtime.sh "${BUILD_DIR}" - name: "Testing runtime" run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" + # Write caches (if configured to) after all other steps are finished. + - name: "Saving cache (git submodules)" + if: needs.setup.outputs.write-caches == 'true' + uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 + with: + path: .git/modules + key: gitmodules_runtime_windows_${{ github.sha }} + - name: "Saving cache (CMake/ccache)" + if: needs.setup.outputs.write-caches == 'true' + uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 + with: + path: ${{ github.workspace }}/.ccache + key: ccache_runtime_windows_${{ github.sha }} ################################# Tensorflow ################################# # Jobs that build the IREE-Tensorflow integrations From dd3b08a2fc67a8d3cb019b0c00ca2f81728d0758 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 14:37:18 -0800 Subject: [PATCH 03/23] Use actions/cache in build_test_all_windows job. --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2edcfd01f2c7..1c08eeba1104 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,11 +171,20 @@ jobs: steps: - name: "Checking out repository" uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + # Restore caches. + - name: "Fetching cache (git submodules)" + uses: actions/cache/restore@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 + with: + path: .git/modules + key: gitmodules_all_windows_${{ github.sha }} + restore-keys: gitmodules_all_windows + - name: "Fetching cache (CMake/ccache)" + uses: actions/cache/restore@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: - submodules: false - # Update submodules directly using our preferred options. Fetching git - # history and source files for large dependencies is particularly slow on - # Windows, so we'd rather not rely on the 'checkout' action for this. + path: ${{ github.workspace }}/.ccache + key: ccache_all_windows_${{ github.sha }} + restore-keys: ccache_all_windows + # Fetch deps. - name: "Updating git submodules" run: git submodule update --init --jobs 8 --depth 1 - name: "Setting up Python" @@ -187,12 +196,32 @@ jobs: 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_USE_LOCAL_CCACHE: 1 + IREE_READ_REMOTE_CCACHE: 0 + CCACHE_DIR: ${{ github.workspace }}/.ccache run: ./build_tools/cmake/build_all.sh "${BUILD_DIR}" - name: "Testing IREE" run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" + # Write caches (if configured to) after all other steps are finished. + - name: "Saving cache (git submodules)" + if: needs.setup.outputs.write-caches == 'true' + uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 + with: + path: .git/modules + key: gitmodules_all_windows_${{ github.sha }} + - name: "Saving cache (CMake/ccache)" + if: needs.setup.outputs.write-caches == 'true' + uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 + with: + path: ${{ github.workspace }}/.ccache + key: ccache_all_windows_${{ github.sha }} build_test_all_bazel: needs: setup From 2c23f78a477e04f8e55993426bbafe45c91cfb02 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 14:39:14 -0800 Subject: [PATCH 04/23] Remove other steps and short-circuit checks for testing. --- .github/workflows/ci.yml | 1125 +------------------------------------- 1 file changed, 5 insertions(+), 1120 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c08eeba1104..941d8995c560 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,78 +89,9 @@ jobs: ./build_tools/github_actions/configure_ci.py - - ################################### Basic #################################### - # Jobs that build all of IREE "normally" - ############################################################################## - build_all: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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: full-build-dir - outputs: - # Pass through the build directory as output so it's available to - # dependent jobs. - build-dir: ${{ env.BUILD_DIR }} - build-dir-archive: ${{ steps.archive.outputs.build-dir-archive }} - build-dir-gcs-artifact: ${{ steps.upload.outputs.build-dir-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/build_all.sh \ - "${BUILD_DIR}" - # The archive step below doesn't include these files. Remove them first to - # save disk space. - # TODO(#10739): This step can be removed once we enlarge the disk sapce. - - name: "Removing unused files" - run: | - find "${BUILD_DIR}" -type f -name "*.a" -o -type f -name "*.o" \ - -print \ - -delete - # Things get more complicated here than when we're just building the - # runtime. The build directory is way bigger. We're also using on our own - # runners on GCE. So uploading to GitHub actions artifact storage hosted - # on Azure is dirt slow. We drop static libraries and object files, which - # aren't needed for testing. Then we do some minimal compression locally - # *in parallel* and upload to GCS. This can be further optimized. - # Especially decompression is still pretty slow. See #9881. - - name: "Creating build dir archive" - id: archive - env: - BUILD_DIR_ARCHIVE: ${{ env.BUILD_DIR }}.tar.zst - run: | - tar -I 'zstd -T0' \ - -cf ${BUILD_DIR_ARCHIVE} ${BUILD_DIR} - echo "build-dir-archive=${BUILD_DIR_ARCHIVE}" >> "${GITHUB_OUTPUT}" - - name: "Uploading build dir archive" - id: upload - env: - BUILD_DIR_ARCHIVE: ${{ steps.archive.outputs.build-dir-archive }} - BUILD_DIR_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.build-dir-archive }} - run: | - gcloud storage cp "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR_GCS_ARTIFACT}" - echo "build-dir-gcs-artifact=${BUILD_DIR_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" - build_test_all_windows: needs: setup - if: needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' + if: needs.setup.outputs.should-run == 'true' runs-on: managed-windows-cpu defaults: run: @@ -211,142 +142,18 @@ jobs: run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" # Write caches (if configured to) after all other steps are finished. - name: "Saving cache (git submodules)" - if: needs.setup.outputs.write-caches == 'true' + if: true || needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: .git/modules key: gitmodules_all_windows_${{ github.sha }} - name: "Saving cache (CMake/ccache)" - if: needs.setup.outputs.write-caches == 'true' + if: true || needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: ${{ github.workspace }}/.ccache key: ccache_all_windows_${{ github.sha }} - build_test_all_bazel: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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/swiftshader-bleeding-edge@sha256:8be446ba48a571b37c861574391c10715130d28cd5cadc86e5ec8080c0c6d4fa \ - ./build_tools/bazel/build_core.sh - - test_all: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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/swiftshader@sha256:126f96acd2071d364ff09d1e726a543ded8689619dfd80ca63ce716b31a5c1d4 \ - ./build_tools/cmake/ctest_all.sh \ - "${BUILD_DIR}" - - test_gpu: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 with GPU" - run: | - ./build_tools/github_actions/docker_run.sh \ - --env IREE_VULKAN_F16_DISABLE=0 \ - --env IREE_CUDA_DISABLE=0 \ - --env CTEST_PARALLEL_LEVEL=2 \ - --gpus all \ - --env NVIDIA_DRIVER_CAPABILITIES=all \ - gcr.io/iree-oss/nvidia@sha256:1294591d06d2b5eb03a7214fac040a1ccab890ea62e466843553f7fb7aacdc1d \ - 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: needs.setup.outputs.should-run == 'true' - runs-on: ubuntu-20.04-64core - env: - BUILD_DIR: build-runtime - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - - name: "Checking out runtime submodules" - run: ./build_tools/scripts/git/update_runtime_submodules.sh - - name: "Building runtime" - # Note ccache is read-only here since this job runs on a GitHub-hosted runner - # and GitHub runners don't have write access to GCS - run: | - ./build_tools/github_actions/docker_run.sh \ - --env "BUILD_PRESET=test" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/ctest_all.sh \ - "${BUILD_DIR}" - build_test_runtime_windows: needs: setup if: needs.setup.outputs.should-run == 'true' @@ -394,903 +201,18 @@ jobs: run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" # Write caches (if configured to) after all other steps are finished. - name: "Saving cache (git submodules)" - if: needs.setup.outputs.write-caches == 'true' + if: true || needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: .git/modules key: gitmodules_runtime_windows_${{ github.sha }} - name: "Saving cache (CMake/ccache)" - if: needs.setup.outputs.write-caches == 'true' + if: true || needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: ${{ github.workspace }}/.ccache key: ccache_runtime_windows_${{ github.sha }} - ################################# Tensorflow ################################# - # Jobs that build the IREE-Tensorflow integrations - ############################################################################## - build_tf_integrations: - needs: setup - if: needs.setup.outputs.should-run == 'true' - runs-on: - - self-hosted # must come first - - runner-group=${{ needs.setup.outputs.runner-group }} - - environment=${{ needs.setup.outputs.runner-env }} - - cpu - - os-family=Linux - outputs: - binaries-dir: ${{ steps.build.outputs.binaries-dir }} - binaries-archive: ${{ steps.archive.outputs.binaries-archive }} - binaries-gcs-artifact: ${{ steps.upload.outputs.binaries-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - submodules: true - - name: "Building TF binaries" - id: build - env: - IREE_TF_BINARIES_OUTPUT_DIR: iree-tf-binaries - 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}" \ - --env "IREE_TF_BINARIES_OUTPUT_DIR=${IREE_TF_BINARIES_OUTPUT_DIR}" \ - gcr.io/iree-oss/frontends-swiftshader@sha256:414071144e8b742ec61eccf69a657e13424513b7574153820367de355e494e0a \ - build_tools/cmake/build_tf_binaries.sh - echo "binaries-dir=${IREE_TF_BINARIES_OUTPUT_DIR}" >> "${GITHUB_OUTPUT}" - - name: "Creating archive of binaries" - id: archive - env: - BINARIES_ARCHIVE: tf-binaries.tar - BINARIES_DIR: ${{ steps.build.outputs.binaries-dir }} - run: | - tar -cf "${BINARIES_ARCHIVE}" "${BINARIES_DIR}" - echo "binaries-archive=${BINARIES_ARCHIVE}" >> "${GITHUB_OUTPUT}" - - name: "Uploading binaries archive" - id: upload - env: - BINARIES_ARCHIVE: ${{ steps.archive.outputs.binaries-archive }} - BINARIES_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.binaries-archive }} - run: | - gcloud storage cp "${BINARIES_ARCHIVE}" "${BINARIES_GCS_ARTIFACT}" - echo "binaries-gcs-artifact=${BINARIES_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" - - test_tf_integrations: - needs: [setup, build_all, build_tf_integrations] - if: needs.setup.outputs.should-run == 'true' - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - submodules: true - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xvf "${TF_BINARIES_ARCHIVE}" - - name: "Symlinking TF binaries" - run: | - ./integrations/tensorflow/symlink_binaries.sh "${TF_BINARIES_DIR}" - - 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 \ - gcr.io/iree-oss/frontends-swiftshader@sha256:414071144e8b742ec61eccf69a657e13424513b7574153820367de355e494e0a \ - build_tools/cmake/run_tf_tests.sh \ - "${BUILD_DIR}" - - test_tf_integrations_gpu: - needs: [setup, build_all, build_tf_integrations] - if: needs.setup.outputs.should-run == 'true' - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - submodules: true - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xvf "${TF_BINARIES_ARCHIVE}" - - name: "Symlinking TF binaries" - run: | - ./integrations/tensorflow/symlink_binaries.sh "${TF_BINARIES_DIR}" - - 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_LLVM_CPU_DISABLE=1 \ - --gpus all \ - --env NVIDIA_DRIVER_CAPABILITIES=all \ - gcr.io/iree-oss/frontends-nvidia@sha256:130572b670f8d7e29ca934cb8775ac81346d532dde7dfd51c402b52f23ea73fc \ - 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}" - - ######################## Community Model Coverage ############################ - # Jobs that test IREE behavior on a set of models. - ############################################################################## - test_shark_model_suite: - needs: [setup, build_all, build_tf_integrations] - # Disabled while failing. See https://github.com/iree-org/iree/issues/10653 - if: false && needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - submodules: true - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xf "${TF_BINARIES_ARCHIVE}" - - name: "Symlinking TF binaries" - run: | - ./integrations/tensorflow/symlink_binaries.sh "$(realpath "${TF_BINARIES_DIR}")" - - 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: "Downloading SHARK" - id: download_shark - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - repository: nod-ai/SHARK - path: ${{ github.workspace }}/SHARK - - name: "Testing Shark Model Suite" - run: | - cd "${GITHUB_WORKSPACE}/SHARK" - NO_BACKEND=1 ./setup_venv.sh - source shark.venv/bin/activate - export TFPYBASE="${GITHUB_WORKSPACE}/integrations/tensorflow/python_projects" - export PYTHONPATH="${PYTHONPATH}:${BUILD_DIR}/compiler/bindings/python:${BUILD_DIR}/runtime/bindings/python" - export PYTHONPATH="${PYTHONPATH}:$TFPYBASE/iree_tf:$TFPYBASE/iree_tflite" - export SHARK_SKIP_TESTS="--ignore=shark/tests/test_shark_importer.py \ - --ignore=benchmarks/tests/test_hf_benchmark.py \ - --ignore=benchmarks/tests/test_benchmark.py" - export MODEL_LIST="bert_base_cased or mobilebert_uncased or MiniLM_L12_H384_uncased or module_resnet50 or mobilenet_v3 or squeezenet1_0 or vit_base_patch16_224" - pytest tank/test_models.py -k "cpu and ($MODEL_LIST)" $SHARK_SKIP_TESTS - pytest tank/test_models.py -k "vulkan and ($MODEL_LIST)" $SHARK_SKIP_TESTS - pytest tank/test_models.py -k "cuda and ($MODEL_LIST)" $SHARK_SKIP_TESTS - - # TODO(#11263): Drop this job once the IREE_BUILD_BENCHMARKS is removed. - test_build_benchmark_suites: - needs: [setup, build_all, build_tf_integrations] - if: needs.setup.outputs.should-run == 'true' - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - BUILD_BENCHMARKS_DIR: build-benchmarks - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - - name: "Checking out runtime submodules" - run: ./build_tools/scripts/git/update_runtime_submodules.sh - - name: "Downloading build dir archive" - run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" - - name: "Extracting install from build dir archive" - run: tar -xf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install" - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xf "${TF_BINARIES_ARCHIVE}" - - name: "Building benchmarks" - id: build - run: | - build_tools/github_actions/docker_run.sh \ - --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \ - --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ - --env "IREE_BUILD_BENCHMARKS_DIR=${BUILD_BENCHMARKS_DIR}" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - build_tools/cmake/build_benchmarks.sh - - ############################### Configurations ############################### - # Jobs that build IREE in some non-default configuration - ############################################################################## - asan: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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=swiftshader-bleeding-edge@sha256:c22afc61198e14a98e06e5261149de74c629acd2bc61b82e57ec90e5461b69be" \ - gcr.io/iree-oss/swiftshader-bleeding-edge@sha256:8be446ba48a571b37c861574391c10715130d28cd5cadc86e5ec8080c0c6d4fa \ - ./build_tools/cmake/build_and_test_asan.sh - - tsan: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/build_and_test_tsan.sh - - small_runtime: - needs: setup - if: needs.setup.outputs.should-run == 'true' - runs-on: ubuntu-20.04-64core - env: - BUILD_DIR: build-runtime - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - - name: "Checking out runtime submodules" - run: ./build_tools/scripts/git/update_runtime_submodules.sh - - name: "Building size-optimized runtime" - # Note ccache is read-only here since this job runs on a GitHub-hosted runner - # and GitHub runners don't have write access to GCS - run: | - ./build_tools/github_actions/docker_run.sh \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/ctest_all.sh \ - "${BUILD_DIR}" - - gcc: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 "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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/build_all.sh \ - "${BUILD_DIR}" - - tracing: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/build_tracing.sh \ - "${BUILD_DIR}" - - ############################### Configurations ############################### - # Jobs that build and run IREE e2e tests/benchmarks # - ############################################################################## - - build_benchmark_tools: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' - runs-on: - - self-hosted # must come first - - runner-group=${{ needs.setup.outputs.runner-group }} - - environment=${{ needs.setup.outputs.runner-env }} - - cpu - - os-family=Linux - outputs: - # We can't collect all outputs from the matrix jobs due to Github's - # limitation (https://github.com/orgs/community/discussions/17245). - # Therefore, the output is the GCS directory that stores all benchmark - # tools archives. The following jobs need to construct the archive names - # by themselves and combine with path of GCS directory here to fetch the - # archives. - benchmark-tools-gcs-artifact-dir: ${{ steps.upload.outputs.benchmark-tools-gcs-artifact-dir }} - strategy: - matrix: - target: - - platform: "linux" - arch: "x86_64" - docker_image: "gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" - # Builds tools on the host and assumes the builder is Linux x86_64. - build_script: "./build_tools/cmake/build_runtime.sh" - - platform: "linux" - arch: "riscv_64" - docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - build_script: "./build_tools/cmake/build_riscv.sh" - env: - PLATFORM: ${{ matrix.target.platform }} - ARCH: ${{ matrix.target.arch }} - DOCKER_IMAGE: ${{ matrix.target.docker_image }} - BUILD_SCRIPT: ${{ matrix.target.build_script }} - BUILD_TOOLS_DIR: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmark-tools-dir - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - - name: "Checking out runtime submodules" - run: ./build_tools/scripts/git/update_runtime_submodules.sh - - name: "Downloading build dir archive" - run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" - - name: "Extracting host binaries" - run: tar -xf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install" - - name: "Compiling the benchmark tools" - id: build - run: | - ./build_tools/github_actions/docker_run.sh \ - --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ - --env "IREE_TARGET_ARCH=${ARCH}" \ - --env "BUILD_PRESET=benchmark" \ - --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ - "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build" - - name: "Compiling the benchmark tools with tracing" - id: build-with-tracing - run: | - ./build_tools/github_actions/docker_run.sh \ - --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ - --env "IREE_TARGET_ARCH=${ARCH}" \ - --env "BUILD_PRESET=benchmark-with-tracing" \ - --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ - "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build-traced" - - name: "Creating the benchmark tools archive" - id: archive - env: - BENCHMARK_TOOLS_ARCHIVE: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmark-tools.tar - run: | - tar -cf "${BENCHMARK_TOOLS_ARCHIVE}" \ - "${BUILD_TOOLS_DIR}"/*/tools/iree-benchmark-module \ - "${BUILD_TOOLS_DIR}"/*/tools/build_config.txt - echo "benchmark-tools-archive=${BENCHMARK_TOOLS_ARCHIVE}" >> "${GITHUB_OUTPUT}" - - name: "Uploading the benchmark tools archive" - id: upload - env: - BENCHMARK_TOOLS_ARCHIVE: ${{ steps.archive.outputs.benchmark-tools-archive }} - BENCHMARK_TOOLS_GCS_ARTIFACT_DIR: ${{ env.GCS_DIR }}/benchmark-tools - run: | - gcloud storage cp "${BENCHMARK_TOOLS_ARCHIVE}" "${BENCHMARK_TOOLS_GCS_ARTIFACT_DIR}/" - echo "benchmark-tools-gcs-artifact-dir=${BENCHMARK_TOOLS_GCS_ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}" - - build_e2e_test_artifacts: - needs: [setup, build_all, build_tf_integrations] - if: needs.setup.outputs.should-run == 'true' - 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: - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - outputs: - e2e-test-artifacts-dir: ${{ steps.build.outputs.e2e-test-artifacts-dir }} - e2e-test-artifacts-gcs-artifact-dir: ${{ steps.upload.outputs.e2e-test-artifacts-gcs-artifact-dir }} - e2e-test-artifacts-build-log: ${{ steps.build.outputs.e2e-test-artifacts-build-log }} - e2e-test-artifacts-build-log-gcs-artifact: ${{ steps.upload.outputs.e2e-test-artifacts-build-log-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 install from build dir archive" - run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xf "${TF_BINARIES_ARCHIVE}" - - name: "Building e2e test artifacts" - id: build - env: - BUILD_E2E_TEST_ARTIFACTS_DIR: build-e2e-test-artifacts - run: | - build_tools/github_actions/docker_run.sh \ - --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \ - --env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - build_tools/cmake/build_e2e_test_artifacts.sh \ - "${BUILD_E2E_TEST_ARTIFACTS_DIR}" - echo "e2e-test-artifacts-dir=${BUILD_E2E_TEST_ARTIFACTS_DIR}/e2e_test_artifacts" >> "${GITHUB_OUTPUT}" - echo "e2e-test-artifacts-build-log=${BUILD_E2E_TEST_ARTIFACTS_DIR}/.ninja_log" >> "${GITHUB_OUTPUT}" - - name: "Uploading e2e test artifacts" - id: upload - env: - E2E_TEST_ARTIFACTS_DIR: ${{ steps.build.outputs.e2e-test-artifacts-dir }} - E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR: ${{ env.GCS_DIR }}/e2e-test-artifacts - E2E_TEST_ARTIFACTS_BUILD_LOG: ${{ steps.build.outputs.e2e-test-artifacts-build-log }} - E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT: ${{ env.GCS_DIR }}/e2e-test-artifacts/ninja_log - run: | - # Uploads all IREE artifacts and MLIR files (including the imported - # MLIR files and MLIR source models). - # Not archiving the directory to allow fetching each file as needed - # separately. - find "${E2E_TEST_ARTIFACTS_DIR}" -maxdepth 1 \ - -name "iree_*" -o -name "model_*.mlir" | \ - gcloud storage cp --read-paths-from-stdin -r \ - "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" - gcloud storage cp "${E2E_TEST_ARTIFACTS_BUILD_LOG}" \ - "${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" - echo "e2e-test-artifacts-gcs-artifact-dir=${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}" - echo "e2e-test-artifacts-build-log-gcs-artifact=${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" - - compilation_benchmarks: - needs: [setup, build_e2e_test_artifacts] - if: needs.setup.outputs.should-run == 'true' - 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: - 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 }} - outputs: - compile-stats-results: ${{ steps.collect.outputs.compile-stats-results }} - compile-stats-results-gcs-artifact: ${{ steps.upload.outputs.compile-stats-results-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 - - name: "Exporting configs" - id: "export" - env: - COMPILATION_CONFIG: "compilation-config.json" - run: | - ./build_tools/benchmarks/export_benchmark_config.py \ - compilation \ - --output="${COMPILATION_CONFIG}" - echo "compilation-config=${COMPILATION_CONFIG}" >> "${GITHUB_OUTPUT}" - - name: "Downloading assets" - id: "download-assets" - env: - COMPILATION_CONFIG: ${{ steps.export.outputs.compilation-config }} - run: | - gcloud storage cp \ - "${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" \ - "${E2E_TEST_ARTIFACTS_BUILD_LOG}" - mkdir -p "${E2E_TEST_ARTIFACTS_DIR}" - jq -r \ - --arg GCS_ARTIFACT_DIR "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" \ - '.module_dir_paths | map("\($GCS_ARTIFACT_DIR)/\(.)") | join("\n")' \ - "${COMPILATION_CONFIG}" | \ - gcloud storage cp -r --read-paths-from-stdin \ - "${E2E_TEST_ARTIFACTS_DIR}" - - name: "Collecting compilation statistics" - id: collect - env: - COMPILATION_CONFIG: ${{ steps.export.outputs.compilation-config }} - GENERATION_CONFIG: generation-config.json - COMPILE_STATS_RESULTS: benchmark-results/compile-stats-results.json - run: | - jq '.generation_configs' "${COMPILATION_CONFIG}" > "${GENERATION_CONFIG}" - mkdir -p benchmark-results - ./build_tools/benchmarks/collect_compilation_statistics.py alpha \ - --e2e_test_artifacts_dir="${E2E_TEST_ARTIFACTS_DIR}" \ - --build_log="${E2E_TEST_ARTIFACTS_BUILD_LOG}" \ - --generation_config="${GENERATION_CONFIG}" \ - --output="${COMPILE_STATS_RESULTS}" - echo "compile-stats-results=${COMPILE_STATS_RESULTS}" >> "${GITHUB_OUTPUT}" - - name: "Uploading benchmark results" - id: upload - env: - COMPILE_STATS_RESULTS: ${{ steps.collect.outputs.compile-stats-results }} - COMPILE_STATS_RESULTS_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.collect.outputs.compile-stats-results }} - run: | - gcloud storage cp \ - "${COMPILE_STATS_RESULTS}" \ - "${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" - echo "compile-stats-results-gcs-artifact=${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" - - execution_benchmarks: - needs: [setup, build_benchmark_tools, build_e2e_test_artifacts] - if: needs.setup.outputs.should-run == 'true' && 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 }} - benchmark-presets: ${{ needs.setup.outputs.benchmark-presets }} - - process_benchmark_results: - needs: [setup, compilation_benchmarks, execution_benchmarks] - # execution_benchmarks is the optional dependency and skipped in presubmit - # if no benchmark is specified to run. - if: | - always() && - needs.setup.outputs.should-run == 'true' && - needs.compilation_benchmarks.result == 'success' && - contains(fromJSON('["success", "skipped"]'), needs.execution_benchmarks.result) - 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 }} - EXECUTION_BENCHMARK_RESULTS_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-dir }} - EXECUTION_BENCHMARK_RESULTS_GCS_ARTIFACT_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-gcs-artifact-dir }} - steps: - - name: "Checking out repository" - uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 - 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 - if: needs.execution_benchmarks.result == 'success' - 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: needs.setup.outputs.ci-stage == 'presubmit' - 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/iree-org/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: needs.setup.outputs.ci-stage == 'presubmit' - 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 - # TODO(#11076): Temporarily disabled until we migrate the database. - if: false && needs.setup.outputs.ci-stage == 'postsubmit' - 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/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 - ############################################################################## - - # emscripten is not in the test matrix because it is set as - # postsubmission-only. - cross_compile_and_test: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' - 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: android - arch: armv8.2-a - abi: arm64-v8a - docker_image: "gcr.io/iree-oss/android@sha256:b0b607d95af8da6a6ce430f22d9d7c621702df13ce2b5d264b79d0ac7e60d670" - build_script: "./build_tools/cmake/build_android.sh" - # No test_script - - platform: linux - arch: riscv_64 - abi: lp64d - docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - build_script: "./build_tools/cmake/build_riscv.sh" - test_script: "./tests/riscv32/smoke.sh" - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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}" - - emscripten: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' - 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: - 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 }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 install from build dir archive" - run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" - - name: "Building the runtime for the web using Emscripten" - run: | - build_tools/github_actions/docker_run.sh \ - --env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ - gcr.io/iree-oss/emscripten@sha256:fdb2bf6b0701a6de80f4f708ea86b001279c8acd904c34ef4d05ee3802711e45 \ - build_tools/cmake/build_runtime_emscripten.sh - - test_benchmark_suites: - needs: [setup, build_all, build_e2e_test_artifacts] - if: needs.setup.outputs.should-run == 'true' - 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 - docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - 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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" - run_scripts: "./build_tools/cmake/test_benchmark_suites_on_linux.sh" - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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: "Download benchmark expected output" - env: - EXPECTED_OUTPUT_GSC_ARTIFACT: gs://iree-model-artifacts/deeplab_v3_fp32_input_0_expected_output.npy - EXPECTED_OUTPUT_FILE: deeplab_v3_fp32_input_0_expected_output.npy - run: | - gcloud storage cp "${EXPECTED_OUTPUT_GSC_ARTIFACT}" "${E2E_TEST_ARTIFACTS_DIR}/${EXPECTED_OUTPUT_FILE}" - - 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}" ############################################################################## @@ -1306,47 +228,10 @@ jobs: - setup # Basic - - build_all - build_test_all_windows - - build_test_all_bazel - - test_all - - test_gpu # Subsets - - build_test_runtime - build_test_runtime_windows - - # Tensorflow - - build_tf_integrations - - test_tf_integrations - - test_tf_integrations_gpu - - # Model Coverage - - test_build_benchmark_suites - - test_shark_model_suite - - # Configurations - - asan - - tsan - - small_runtime - - gcc - - tracing - - # Crosscompilation - - cross_compile_and_test - - emscripten - - # 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: Getting failed jobs id: failed_jobs From cb4490c4cf82ead529eaf297d9b650841f8815d7 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 15:20:53 -0800 Subject: [PATCH 05/23] Empty commit to test cache. From 2007858238c9e6146192922dc7f6fad33894f208 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 15:55:17 -0800 Subject: [PATCH 06/23] Try `CCACHE_COMPRESSLEVEL: 5`. --- .github/workflows/ci.yml | 1 + build_tools/cmake/build_all.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 941d8995c560..57fa8e42a374 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,6 +137,7 @@ jobs: IREE_USE_LOCAL_CCACHE: 1 IREE_READ_REMOTE_CCACHE: 0 CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_COMPRESSLEVEL: 5 run: ./build_tools/cmake/build_all.sh "${BUILD_DIR}" - name: "Testing IREE" run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" diff --git a/build_tools/cmake/build_all.sh b/build_tools/cmake/build_all.sh index 689a63b3159f..cdd894bb3308 100755 --- a/build_tools/cmake/build_all.sh +++ b/build_tools/cmake/build_all.sh @@ -75,4 +75,5 @@ echo "------------------" if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats + ccache --show-compression # DO NOT SUBMIT fi From 23aeb6aba51f9cd499540d8ef6c98ad3307cdcd1 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 16:15:05 -0800 Subject: [PATCH 07/23] Revert "Try `CCACHE_COMPRESSLEVEL: 5`." This reverts commit 2007858238c9e6146192922dc7f6fad33894f208. --- .github/workflows/ci.yml | 1 - build_tools/cmake/build_all.sh | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57fa8e42a374..941d8995c560 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,7 +137,6 @@ jobs: IREE_USE_LOCAL_CCACHE: 1 IREE_READ_REMOTE_CCACHE: 0 CCACHE_DIR: ${{ github.workspace }}/.ccache - CCACHE_COMPRESSLEVEL: 5 run: ./build_tools/cmake/build_all.sh "${BUILD_DIR}" - name: "Testing IREE" run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" diff --git a/build_tools/cmake/build_all.sh b/build_tools/cmake/build_all.sh index cdd894bb3308..689a63b3159f 100755 --- a/build_tools/cmake/build_all.sh +++ b/build_tools/cmake/build_all.sh @@ -75,5 +75,4 @@ echo "------------------" if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then ccache --show-stats - ccache --show-compression # DO NOT SUBMIT fi From 56d46206dba05be1f33ddcbdc5bf14282291b8ee Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 16:15:43 -0800 Subject: [PATCH 08/23] Zero stats in setup_ccache.sh. --- build_tools/cmake/setup_ccache.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_tools/cmake/setup_ccache.sh b/build_tools/cmake/setup_ccache.sh index de1fc956e6f3..95a2822dc6d8 100644 --- a/build_tools/cmake/setup_ccache.sh +++ b/build_tools/cmake/setup_ccache.sh @@ -38,6 +38,7 @@ fi if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then export CMAKE_C_COMPILER_LAUNCHER=$(which ccache) export CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) + $(which ccache) --zero-stats fi if (( IREE_READ_REMOTE_CCACHE == 1 )); then From f2113188fdb403a23c5ec7c61f0754b44626b7c4 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 16:15:58 -0800 Subject: [PATCH 09/23] Revert "Remove other steps and short-circuit checks for testing." This reverts commit 2c23f78a477e04f8e55993426bbafe45c91cfb02. --- .github/workflows/ci.yml | 1125 +++++++++++++++++++++++++++++++++++++- 1 file changed, 1120 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 941d8995c560..1c08eeba1104 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,9 +89,78 @@ jobs: ./build_tools/github_actions/configure_ci.py - build_test_all_windows: + + ################################### Basic #################################### + # Jobs that build all of IREE "normally" + ############################################################################## + build_all: needs: setup if: needs.setup.outputs.should-run == 'true' + 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: full-build-dir + outputs: + # Pass through the build directory as output so it's available to + # dependent jobs. + build-dir: ${{ env.BUILD_DIR }} + build-dir-archive: ${{ steps.archive.outputs.build-dir-archive }} + build-dir-gcs-artifact: ${{ steps.upload.outputs.build-dir-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/build_all.sh \ + "${BUILD_DIR}" + # The archive step below doesn't include these files. Remove them first to + # save disk space. + # TODO(#10739): This step can be removed once we enlarge the disk sapce. + - name: "Removing unused files" + run: | + find "${BUILD_DIR}" -type f -name "*.a" -o -type f -name "*.o" \ + -print \ + -delete + # Things get more complicated here than when we're just building the + # runtime. The build directory is way bigger. We're also using on our own + # runners on GCE. So uploading to GitHub actions artifact storage hosted + # on Azure is dirt slow. We drop static libraries and object files, which + # aren't needed for testing. Then we do some minimal compression locally + # *in parallel* and upload to GCS. This can be further optimized. + # Especially decompression is still pretty slow. See #9881. + - name: "Creating build dir archive" + id: archive + env: + BUILD_DIR_ARCHIVE: ${{ env.BUILD_DIR }}.tar.zst + run: | + tar -I 'zstd -T0' \ + -cf ${BUILD_DIR_ARCHIVE} ${BUILD_DIR} + echo "build-dir-archive=${BUILD_DIR_ARCHIVE}" >> "${GITHUB_OUTPUT}" + - name: "Uploading build dir archive" + id: upload + env: + BUILD_DIR_ARCHIVE: ${{ steps.archive.outputs.build-dir-archive }} + BUILD_DIR_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.build-dir-archive }} + run: | + gcloud storage cp "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR_GCS_ARTIFACT}" + echo "build-dir-gcs-artifact=${BUILD_DIR_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" + + build_test_all_windows: + needs: setup + if: needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' runs-on: managed-windows-cpu defaults: run: @@ -142,18 +211,142 @@ jobs: run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" # Write caches (if configured to) after all other steps are finished. - name: "Saving cache (git submodules)" - if: true || needs.setup.outputs.write-caches == 'true' + if: needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: .git/modules key: gitmodules_all_windows_${{ github.sha }} - name: "Saving cache (CMake/ccache)" - if: true || needs.setup.outputs.write-caches == 'true' + if: needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: ${{ github.workspace }}/.ccache key: ccache_all_windows_${{ github.sha }} + build_test_all_bazel: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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/swiftshader-bleeding-edge@sha256:8be446ba48a571b37c861574391c10715130d28cd5cadc86e5ec8080c0c6d4fa \ + ./build_tools/bazel/build_core.sh + + test_all: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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/swiftshader@sha256:126f96acd2071d364ff09d1e726a543ded8689619dfd80ca63ce716b31a5c1d4 \ + ./build_tools/cmake/ctest_all.sh \ + "${BUILD_DIR}" + + test_gpu: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 with GPU" + run: | + ./build_tools/github_actions/docker_run.sh \ + --env IREE_VULKAN_F16_DISABLE=0 \ + --env IREE_CUDA_DISABLE=0 \ + --env CTEST_PARALLEL_LEVEL=2 \ + --gpus all \ + --env NVIDIA_DRIVER_CAPABILITIES=all \ + gcr.io/iree-oss/nvidia@sha256:1294591d06d2b5eb03a7214fac040a1ccab890ea62e466843553f7fb7aacdc1d \ + 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: needs.setup.outputs.should-run == 'true' + runs-on: ubuntu-20.04-64core + env: + BUILD_DIR: build-runtime + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + - name: "Checking out runtime submodules" + run: ./build_tools/scripts/git/update_runtime_submodules.sh + - name: "Building runtime" + # Note ccache is read-only here since this job runs on a GitHub-hosted runner + # and GitHub runners don't have write access to GCS + run: | + ./build_tools/github_actions/docker_run.sh \ + --env "BUILD_PRESET=test" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/ctest_all.sh \ + "${BUILD_DIR}" + build_test_runtime_windows: needs: setup if: needs.setup.outputs.should-run == 'true' @@ -201,18 +394,903 @@ jobs: run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" # Write caches (if configured to) after all other steps are finished. - name: "Saving cache (git submodules)" - if: true || needs.setup.outputs.write-caches == 'true' + if: needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: .git/modules key: gitmodules_runtime_windows_${{ github.sha }} - name: "Saving cache (CMake/ccache)" - if: true || needs.setup.outputs.write-caches == 'true' + if: needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: ${{ github.workspace }}/.ccache key: ccache_runtime_windows_${{ github.sha }} + ################################# Tensorflow ################################# + # Jobs that build the IREE-Tensorflow integrations + ############################################################################## + build_tf_integrations: + needs: setup + if: needs.setup.outputs.should-run == 'true' + runs-on: + - self-hosted # must come first + - runner-group=${{ needs.setup.outputs.runner-group }} + - environment=${{ needs.setup.outputs.runner-env }} + - cpu + - os-family=Linux + outputs: + binaries-dir: ${{ steps.build.outputs.binaries-dir }} + binaries-archive: ${{ steps.archive.outputs.binaries-archive }} + binaries-gcs-artifact: ${{ steps.upload.outputs.binaries-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + submodules: true + - name: "Building TF binaries" + id: build + env: + IREE_TF_BINARIES_OUTPUT_DIR: iree-tf-binaries + 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}" \ + --env "IREE_TF_BINARIES_OUTPUT_DIR=${IREE_TF_BINARIES_OUTPUT_DIR}" \ + gcr.io/iree-oss/frontends-swiftshader@sha256:414071144e8b742ec61eccf69a657e13424513b7574153820367de355e494e0a \ + build_tools/cmake/build_tf_binaries.sh + echo "binaries-dir=${IREE_TF_BINARIES_OUTPUT_DIR}" >> "${GITHUB_OUTPUT}" + - name: "Creating archive of binaries" + id: archive + env: + BINARIES_ARCHIVE: tf-binaries.tar + BINARIES_DIR: ${{ steps.build.outputs.binaries-dir }} + run: | + tar -cf "${BINARIES_ARCHIVE}" "${BINARIES_DIR}" + echo "binaries-archive=${BINARIES_ARCHIVE}" >> "${GITHUB_OUTPUT}" + - name: "Uploading binaries archive" + id: upload + env: + BINARIES_ARCHIVE: ${{ steps.archive.outputs.binaries-archive }} + BINARIES_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.binaries-archive }} + run: | + gcloud storage cp "${BINARIES_ARCHIVE}" "${BINARIES_GCS_ARTIFACT}" + echo "binaries-gcs-artifact=${BINARIES_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" + + test_tf_integrations: + needs: [setup, build_all, build_tf_integrations] + if: needs.setup.outputs.should-run == 'true' + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + submodules: true + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xvf "${TF_BINARIES_ARCHIVE}" + - name: "Symlinking TF binaries" + run: | + ./integrations/tensorflow/symlink_binaries.sh "${TF_BINARIES_DIR}" + - 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 \ + gcr.io/iree-oss/frontends-swiftshader@sha256:414071144e8b742ec61eccf69a657e13424513b7574153820367de355e494e0a \ + build_tools/cmake/run_tf_tests.sh \ + "${BUILD_DIR}" + + test_tf_integrations_gpu: + needs: [setup, build_all, build_tf_integrations] + if: needs.setup.outputs.should-run == 'true' + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + submodules: true + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xvf "${TF_BINARIES_ARCHIVE}" + - name: "Symlinking TF binaries" + run: | + ./integrations/tensorflow/symlink_binaries.sh "${TF_BINARIES_DIR}" + - 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_LLVM_CPU_DISABLE=1 \ + --gpus all \ + --env NVIDIA_DRIVER_CAPABILITIES=all \ + gcr.io/iree-oss/frontends-nvidia@sha256:130572b670f8d7e29ca934cb8775ac81346d532dde7dfd51c402b52f23ea73fc \ + 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}" + + ######################## Community Model Coverage ############################ + # Jobs that test IREE behavior on a set of models. + ############################################################################## + test_shark_model_suite: + needs: [setup, build_all, build_tf_integrations] + # Disabled while failing. See https://github.com/iree-org/iree/issues/10653 + if: false && needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + submodules: true + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xf "${TF_BINARIES_ARCHIVE}" + - name: "Symlinking TF binaries" + run: | + ./integrations/tensorflow/symlink_binaries.sh "$(realpath "${TF_BINARIES_DIR}")" + - 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: "Downloading SHARK" + id: download_shark + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + repository: nod-ai/SHARK + path: ${{ github.workspace }}/SHARK + - name: "Testing Shark Model Suite" + run: | + cd "${GITHUB_WORKSPACE}/SHARK" + NO_BACKEND=1 ./setup_venv.sh + source shark.venv/bin/activate + export TFPYBASE="${GITHUB_WORKSPACE}/integrations/tensorflow/python_projects" + export PYTHONPATH="${PYTHONPATH}:${BUILD_DIR}/compiler/bindings/python:${BUILD_DIR}/runtime/bindings/python" + export PYTHONPATH="${PYTHONPATH}:$TFPYBASE/iree_tf:$TFPYBASE/iree_tflite" + export SHARK_SKIP_TESTS="--ignore=shark/tests/test_shark_importer.py \ + --ignore=benchmarks/tests/test_hf_benchmark.py \ + --ignore=benchmarks/tests/test_benchmark.py" + export MODEL_LIST="bert_base_cased or mobilebert_uncased or MiniLM_L12_H384_uncased or module_resnet50 or mobilenet_v3 or squeezenet1_0 or vit_base_patch16_224" + pytest tank/test_models.py -k "cpu and ($MODEL_LIST)" $SHARK_SKIP_TESTS + pytest tank/test_models.py -k "vulkan and ($MODEL_LIST)" $SHARK_SKIP_TESTS + pytest tank/test_models.py -k "cuda and ($MODEL_LIST)" $SHARK_SKIP_TESTS + + # TODO(#11263): Drop this job once the IREE_BUILD_BENCHMARKS is removed. + test_build_benchmark_suites: + needs: [setup, build_all, build_tf_integrations] + if: needs.setup.outputs.should-run == 'true' + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + BUILD_BENCHMARKS_DIR: build-benchmarks + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + - name: "Checking out runtime submodules" + run: ./build_tools/scripts/git/update_runtime_submodules.sh + - name: "Downloading build dir archive" + run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" + - name: "Extracting install from build dir archive" + run: tar -xf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install" + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xf "${TF_BINARIES_ARCHIVE}" + - name: "Building benchmarks" + id: build + run: | + build_tools/github_actions/docker_run.sh \ + --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \ + --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ + --env "IREE_BUILD_BENCHMARKS_DIR=${BUILD_BENCHMARKS_DIR}" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + build_tools/cmake/build_benchmarks.sh + + ############################### Configurations ############################### + # Jobs that build IREE in some non-default configuration + ############################################################################## + asan: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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=swiftshader-bleeding-edge@sha256:c22afc61198e14a98e06e5261149de74c629acd2bc61b82e57ec90e5461b69be" \ + gcr.io/iree-oss/swiftshader-bleeding-edge@sha256:8be446ba48a571b37c861574391c10715130d28cd5cadc86e5ec8080c0c6d4fa \ + ./build_tools/cmake/build_and_test_asan.sh + + tsan: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/build_and_test_tsan.sh + + small_runtime: + needs: setup + if: needs.setup.outputs.should-run == 'true' + runs-on: ubuntu-20.04-64core + env: + BUILD_DIR: build-runtime + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + - name: "Checking out runtime submodules" + run: ./build_tools/scripts/git/update_runtime_submodules.sh + - name: "Building size-optimized runtime" + # Note ccache is read-only here since this job runs on a GitHub-hosted runner + # and GitHub runners don't have write access to GCS + run: | + ./build_tools/github_actions/docker_run.sh \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/ctest_all.sh \ + "${BUILD_DIR}" + + gcc: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 "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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/build_all.sh \ + "${BUILD_DIR}" + + tracing: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/build_tracing.sh \ + "${BUILD_DIR}" + + ############################### Configurations ############################### + # Jobs that build and run IREE e2e tests/benchmarks # + ############################################################################## + + build_benchmark_tools: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' + runs-on: + - self-hosted # must come first + - runner-group=${{ needs.setup.outputs.runner-group }} + - environment=${{ needs.setup.outputs.runner-env }} + - cpu + - os-family=Linux + outputs: + # We can't collect all outputs from the matrix jobs due to Github's + # limitation (https://github.com/orgs/community/discussions/17245). + # Therefore, the output is the GCS directory that stores all benchmark + # tools archives. The following jobs need to construct the archive names + # by themselves and combine with path of GCS directory here to fetch the + # archives. + benchmark-tools-gcs-artifact-dir: ${{ steps.upload.outputs.benchmark-tools-gcs-artifact-dir }} + strategy: + matrix: + target: + - platform: "linux" + arch: "x86_64" + docker_image: "gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" + # Builds tools on the host and assumes the builder is Linux x86_64. + build_script: "./build_tools/cmake/build_runtime.sh" + - platform: "linux" + arch: "riscv_64" + docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + build_script: "./build_tools/cmake/build_riscv.sh" + env: + PLATFORM: ${{ matrix.target.platform }} + ARCH: ${{ matrix.target.arch }} + DOCKER_IMAGE: ${{ matrix.target.docker_image }} + BUILD_SCRIPT: ${{ matrix.target.build_script }} + BUILD_TOOLS_DIR: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmark-tools-dir + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + - name: "Checking out runtime submodules" + run: ./build_tools/scripts/git/update_runtime_submodules.sh + - name: "Downloading build dir archive" + run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" + - name: "Extracting host binaries" + run: tar -xf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install" + - name: "Compiling the benchmark tools" + id: build + run: | + ./build_tools/github_actions/docker_run.sh \ + --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ + --env "IREE_TARGET_ARCH=${ARCH}" \ + --env "BUILD_PRESET=benchmark" \ + --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ + "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build" + - name: "Compiling the benchmark tools with tracing" + id: build-with-tracing + run: | + ./build_tools/github_actions/docker_run.sh \ + --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ + --env "IREE_TARGET_ARCH=${ARCH}" \ + --env "BUILD_PRESET=benchmark-with-tracing" \ + --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ + "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build-traced" + - name: "Creating the benchmark tools archive" + id: archive + env: + BENCHMARK_TOOLS_ARCHIVE: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmark-tools.tar + run: | + tar -cf "${BENCHMARK_TOOLS_ARCHIVE}" \ + "${BUILD_TOOLS_DIR}"/*/tools/iree-benchmark-module \ + "${BUILD_TOOLS_DIR}"/*/tools/build_config.txt + echo "benchmark-tools-archive=${BENCHMARK_TOOLS_ARCHIVE}" >> "${GITHUB_OUTPUT}" + - name: "Uploading the benchmark tools archive" + id: upload + env: + BENCHMARK_TOOLS_ARCHIVE: ${{ steps.archive.outputs.benchmark-tools-archive }} + BENCHMARK_TOOLS_GCS_ARTIFACT_DIR: ${{ env.GCS_DIR }}/benchmark-tools + run: | + gcloud storage cp "${BENCHMARK_TOOLS_ARCHIVE}" "${BENCHMARK_TOOLS_GCS_ARTIFACT_DIR}/" + echo "benchmark-tools-gcs-artifact-dir=${BENCHMARK_TOOLS_GCS_ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}" + + build_e2e_test_artifacts: + needs: [setup, build_all, build_tf_integrations] + if: needs.setup.outputs.should-run == 'true' + 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: + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + outputs: + e2e-test-artifacts-dir: ${{ steps.build.outputs.e2e-test-artifacts-dir }} + e2e-test-artifacts-gcs-artifact-dir: ${{ steps.upload.outputs.e2e-test-artifacts-gcs-artifact-dir }} + e2e-test-artifacts-build-log: ${{ steps.build.outputs.e2e-test-artifacts-build-log }} + e2e-test-artifacts-build-log-gcs-artifact: ${{ steps.upload.outputs.e2e-test-artifacts-build-log-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 install from build dir archive" + run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xf "${TF_BINARIES_ARCHIVE}" + - name: "Building e2e test artifacts" + id: build + env: + BUILD_E2E_TEST_ARTIFACTS_DIR: build-e2e-test-artifacts + run: | + build_tools/github_actions/docker_run.sh \ + --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \ + --env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + build_tools/cmake/build_e2e_test_artifacts.sh \ + "${BUILD_E2E_TEST_ARTIFACTS_DIR}" + echo "e2e-test-artifacts-dir=${BUILD_E2E_TEST_ARTIFACTS_DIR}/e2e_test_artifacts" >> "${GITHUB_OUTPUT}" + echo "e2e-test-artifacts-build-log=${BUILD_E2E_TEST_ARTIFACTS_DIR}/.ninja_log" >> "${GITHUB_OUTPUT}" + - name: "Uploading e2e test artifacts" + id: upload + env: + E2E_TEST_ARTIFACTS_DIR: ${{ steps.build.outputs.e2e-test-artifacts-dir }} + E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR: ${{ env.GCS_DIR }}/e2e-test-artifacts + E2E_TEST_ARTIFACTS_BUILD_LOG: ${{ steps.build.outputs.e2e-test-artifacts-build-log }} + E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT: ${{ env.GCS_DIR }}/e2e-test-artifacts/ninja_log + run: | + # Uploads all IREE artifacts and MLIR files (including the imported + # MLIR files and MLIR source models). + # Not archiving the directory to allow fetching each file as needed + # separately. + find "${E2E_TEST_ARTIFACTS_DIR}" -maxdepth 1 \ + -name "iree_*" -o -name "model_*.mlir" | \ + gcloud storage cp --read-paths-from-stdin -r \ + "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" + gcloud storage cp "${E2E_TEST_ARTIFACTS_BUILD_LOG}" \ + "${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" + echo "e2e-test-artifacts-gcs-artifact-dir=${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}" + echo "e2e-test-artifacts-build-log-gcs-artifact=${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" + + compilation_benchmarks: + needs: [setup, build_e2e_test_artifacts] + if: needs.setup.outputs.should-run == 'true' + 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: + 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 }} + outputs: + compile-stats-results: ${{ steps.collect.outputs.compile-stats-results }} + compile-stats-results-gcs-artifact: ${{ steps.upload.outputs.compile-stats-results-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 + - name: "Exporting configs" + id: "export" + env: + COMPILATION_CONFIG: "compilation-config.json" + run: | + ./build_tools/benchmarks/export_benchmark_config.py \ + compilation \ + --output="${COMPILATION_CONFIG}" + echo "compilation-config=${COMPILATION_CONFIG}" >> "${GITHUB_OUTPUT}" + - name: "Downloading assets" + id: "download-assets" + env: + COMPILATION_CONFIG: ${{ steps.export.outputs.compilation-config }} + run: | + gcloud storage cp \ + "${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" \ + "${E2E_TEST_ARTIFACTS_BUILD_LOG}" + mkdir -p "${E2E_TEST_ARTIFACTS_DIR}" + jq -r \ + --arg GCS_ARTIFACT_DIR "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" \ + '.module_dir_paths | map("\($GCS_ARTIFACT_DIR)/\(.)") | join("\n")' \ + "${COMPILATION_CONFIG}" | \ + gcloud storage cp -r --read-paths-from-stdin \ + "${E2E_TEST_ARTIFACTS_DIR}" + - name: "Collecting compilation statistics" + id: collect + env: + COMPILATION_CONFIG: ${{ steps.export.outputs.compilation-config }} + GENERATION_CONFIG: generation-config.json + COMPILE_STATS_RESULTS: benchmark-results/compile-stats-results.json + run: | + jq '.generation_configs' "${COMPILATION_CONFIG}" > "${GENERATION_CONFIG}" + mkdir -p benchmark-results + ./build_tools/benchmarks/collect_compilation_statistics.py alpha \ + --e2e_test_artifacts_dir="${E2E_TEST_ARTIFACTS_DIR}" \ + --build_log="${E2E_TEST_ARTIFACTS_BUILD_LOG}" \ + --generation_config="${GENERATION_CONFIG}" \ + --output="${COMPILE_STATS_RESULTS}" + echo "compile-stats-results=${COMPILE_STATS_RESULTS}" >> "${GITHUB_OUTPUT}" + - name: "Uploading benchmark results" + id: upload + env: + COMPILE_STATS_RESULTS: ${{ steps.collect.outputs.compile-stats-results }} + COMPILE_STATS_RESULTS_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.collect.outputs.compile-stats-results }} + run: | + gcloud storage cp \ + "${COMPILE_STATS_RESULTS}" \ + "${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" + echo "compile-stats-results-gcs-artifact=${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" + + execution_benchmarks: + needs: [setup, build_benchmark_tools, build_e2e_test_artifacts] + if: needs.setup.outputs.should-run == 'true' && 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 }} + benchmark-presets: ${{ needs.setup.outputs.benchmark-presets }} + + process_benchmark_results: + needs: [setup, compilation_benchmarks, execution_benchmarks] + # execution_benchmarks is the optional dependency and skipped in presubmit + # if no benchmark is specified to run. + if: | + always() && + needs.setup.outputs.should-run == 'true' && + needs.compilation_benchmarks.result == 'success' && + contains(fromJSON('["success", "skipped"]'), needs.execution_benchmarks.result) + 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 }} + EXECUTION_BENCHMARK_RESULTS_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-dir }} + EXECUTION_BENCHMARK_RESULTS_GCS_ARTIFACT_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-gcs-artifact-dir }} + steps: + - name: "Checking out repository" + uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 + 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 + if: needs.execution_benchmarks.result == 'success' + 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: needs.setup.outputs.ci-stage == 'presubmit' + 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/iree-org/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: needs.setup.outputs.ci-stage == 'presubmit' + 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 + # TODO(#11076): Temporarily disabled until we migrate the database. + if: false && needs.setup.outputs.ci-stage == 'postsubmit' + 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/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 + ############################################################################## + + # emscripten is not in the test matrix because it is set as + # postsubmission-only. + cross_compile_and_test: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' + 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: android + arch: armv8.2-a + abi: arm64-v8a + docker_image: "gcr.io/iree-oss/android@sha256:b0b607d95af8da6a6ce430f22d9d7c621702df13ce2b5d264b79d0ac7e60d670" + build_script: "./build_tools/cmake/build_android.sh" + # No test_script + - platform: linux + arch: riscv_64 + abi: lp64d + docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + build_script: "./build_tools/cmake/build_riscv.sh" + test_script: "./tests/riscv32/smoke.sh" + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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}" + + emscripten: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' + 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: + 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 }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 install from build dir archive" + run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" + - name: "Building the runtime for the web using Emscripten" + run: | + build_tools/github_actions/docker_run.sh \ + --env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ + gcr.io/iree-oss/emscripten@sha256:fdb2bf6b0701a6de80f4f708ea86b001279c8acd904c34ef4d05ee3802711e45 \ + build_tools/cmake/build_runtime_emscripten.sh + + test_benchmark_suites: + needs: [setup, build_all, build_e2e_test_artifacts] + if: needs.setup.outputs.should-run == 'true' + 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 + docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + 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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" + run_scripts: "./build_tools/cmake/test_benchmark_suites_on_linux.sh" + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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: "Download benchmark expected output" + env: + EXPECTED_OUTPUT_GSC_ARTIFACT: gs://iree-model-artifacts/deeplab_v3_fp32_input_0_expected_output.npy + EXPECTED_OUTPUT_FILE: deeplab_v3_fp32_input_0_expected_output.npy + run: | + gcloud storage cp "${EXPECTED_OUTPUT_GSC_ARTIFACT}" "${E2E_TEST_ARTIFACTS_DIR}/${EXPECTED_OUTPUT_FILE}" + - 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}" ############################################################################## @@ -228,10 +1306,47 @@ jobs: - setup # Basic + - build_all - build_test_all_windows + - build_test_all_bazel + - test_all + - test_gpu # Subsets + - build_test_runtime - build_test_runtime_windows + + # Tensorflow + - build_tf_integrations + - test_tf_integrations + - test_tf_integrations_gpu + + # Model Coverage + - test_build_benchmark_suites + - test_shark_model_suite + + # Configurations + - asan + - tsan + - small_runtime + - gcc + - tracing + + # Crosscompilation + - cross_compile_and_test + - emscripten + + # 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: Getting failed jobs id: failed_jobs From ee7f12d40456b6e54044f569a71200af09c65267 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Thu, 19 Jan 2023 16:16:13 -0800 Subject: [PATCH 10/23] Revert "Use actions/cache in build_test_runtime_windows job." This reverts commit 0a626236209bcafa8bd71a41a3badde5e1b22848. --- .github/workflows/ci.yml | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c08eeba1104..9d0a763f4418 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -360,51 +360,18 @@ jobs: steps: - name: "Checking out repository" uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - # Restore caches. - - name: "Fetching cache (git submodules)" - uses: actions/cache/restore@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 - with: - path: .git/modules - key: gitmodules_runtime_windows_${{ github.sha }} - restore-keys: gitmodules_runtime_windows - - name: "Fetching cache (CMake/ccache)" - uses: actions/cache/restore@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 - with: - path: ${{ github.workspace }}/.ccache - key: ccache_runtime_windows_${{ github.sha }} - restore-keys: ccache_runtime_windows - # Fetch deps. - 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 requirements" - run: | - pip install -r ./runtime/bindings/python/iree/runtime/build_requirements.txt - choco install ccache --yes - # Finally: build and run tests. + - name: "Installing Python requirements" + run: pip install -r ./runtime/bindings/python/iree/runtime/build_requirements.txt - name: "Building runtime" env: BUILD_PRESET: "test" - IREE_USE_LOCAL_CCACHE: 1 - IREE_READ_REMOTE_CCACHE: 0 - CCACHE_DIR: ${{ github.workspace }}/.ccache run: ./build_tools/cmake/build_runtime.sh "${BUILD_DIR}" - name: "Testing runtime" run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" - # Write caches (if configured to) after all other steps are finished. - - name: "Saving cache (git submodules)" - if: needs.setup.outputs.write-caches == 'true' - uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 - with: - path: .git/modules - key: gitmodules_runtime_windows_${{ github.sha }} - - name: "Saving cache (CMake/ccache)" - if: needs.setup.outputs.write-caches == 'true' - uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 - with: - path: ${{ github.workspace }}/.ccache - key: ccache_runtime_windows_${{ github.sha }} ################################# Tensorflow ################################# # Jobs that build the IREE-Tensorflow integrations From 317a7bcb49bed9d9f8bf4e7b0161c53213de8931 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 09:03:44 -0800 Subject: [PATCH 11/23] Add IREE_USE_CCACHE environment variable to simplify checks. --- build_tools/cmake/build_all.sh | 2 +- build_tools/cmake/build_and_test_asan.sh | 2 +- build_tools/cmake/build_and_test_tsan.sh | 2 +- build_tools/cmake/build_android.sh | 2 +- build_tools/cmake/build_host_tools.sh | 2 +- build_tools/cmake/build_runtime.sh | 2 +- build_tools/cmake/build_runtime_emscripten.sh | 2 +- build_tools/cmake/build_runtime_small.sh | 2 +- build_tools/cmake/build_tracing.sh | 2 +- build_tools/cmake/setup_ccache.sh | 3 +++ 10 files changed, 12 insertions(+), 9 deletions(-) diff --git a/build_tools/cmake/build_all.sh b/build_tools/cmake/build_all.sh index 689a63b3159f..1b1173abb8f3 100755 --- a/build_tools/cmake/build_all.sh +++ b/build_tools/cmake/build_all.sh @@ -73,6 +73,6 @@ echo "Building sample deps" echo "------------------" "$CMAKE_BIN" --build "${BUILD_DIR}" --target iree-sample-deps -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_USE_CCACHE == 1 )); ccache --show-stats fi diff --git a/build_tools/cmake/build_and_test_asan.sh b/build_tools/cmake/build_and_test_asan.sh index c2be666796e9..a5821e22fa08 100755 --- a/build_tools/cmake/build_and_test_asan.sh +++ b/build_tools/cmake/build_and_test_asan.sh @@ -64,7 +64,7 @@ echo "Building microbenchmark suites" echo "------------------" "${CMAKE_BIN?}" --build "${BUILD_DIR?}" --target iree-microbenchmark-suites -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_USE_CCACHE == 1 )); ccache --show-stats fi diff --git a/build_tools/cmake/build_and_test_tsan.sh b/build_tools/cmake/build_and_test_tsan.sh index cb96cbe4b8ee..03fa4fde5123 100755 --- a/build_tools/cmake/build_and_test_tsan.sh +++ b/build_tools/cmake/build_and_test_tsan.sh @@ -72,7 +72,7 @@ echo "Building sample deps" echo "------------------" "$CMAKE_BIN" --build "${BUILD_DIR?}" --target iree-sample-deps -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_USE_CCACHE == 1 )); ccache --show-stats fi diff --git a/build_tools/cmake/build_android.sh b/build_tools/cmake/build_android.sh index 98a40a045d29..0f23337a643e 100755 --- a/build_tools/cmake/build_android.sh +++ b/build_tools/cmake/build_android.sh @@ -94,6 +94,6 @@ echo "Building sample deps for device" echo "------------------" "${CMAKE_BIN}" --build "${BUILD_DIR}" --target iree-sample-deps -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_USE_CCACHE == 1 )); ccache --show-stats fi diff --git a/build_tools/cmake/build_host_tools.sh b/build_tools/cmake/build_host_tools.sh index 5956cc36d291..16b85c032df9 100755 --- a/build_tools/cmake/build_host_tools.sh +++ b/build_tools/cmake/build_host_tools.sh @@ -51,6 +51,6 @@ declare -a CMAKE_ARGS=( "${CMAKE_BIN}" "${CMAKE_ARGS[@]}" "${CMAKE_BIN}" --build "${BUILD_DIR}" --target install -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_USE_CCACHE == 1 )); ccache --show-stats fi diff --git a/build_tools/cmake/build_runtime.sh b/build_tools/cmake/build_runtime.sh index 7b7c91aecfc7..b7b19f1e3918 100755 --- a/build_tools/cmake/build_runtime.sh +++ b/build_tools/cmake/build_runtime.sh @@ -76,6 +76,6 @@ case "${BUILD_PRESET}" in ;; esac -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_USE_CCACHE == 1 )); ccache --show-stats fi diff --git a/build_tools/cmake/build_runtime_emscripten.sh b/build_tools/cmake/build_runtime_emscripten.sh index 1a6da539750a..99e4a06f3f98 100755 --- a/build_tools/cmake/build_runtime_emscripten.sh +++ b/build_tools/cmake/build_runtime_emscripten.sh @@ -54,6 +54,6 @@ echo "Building sample deps" echo "------------------" "${CMAKE_BIN?}" --build . --target iree-sample-deps -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_USE_CCACHE == 1 )); ccache --show-stats fi diff --git a/build_tools/cmake/build_runtime_small.sh b/build_tools/cmake/build_runtime_small.sh index 292a0726b020..6e4510bc987d 100755 --- a/build_tools/cmake/build_runtime_small.sh +++ b/build_tools/cmake/build_runtime_small.sh @@ -25,6 +25,6 @@ source build_tools/cmake/setup_ccache.sh -DIREE_BUILD_COMPILER=OFF "${CMAKE_BIN?}" --build "${BUILD_DIR}" -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_USE_CCACHE == 1 )); ccache --show-stats fi diff --git a/build_tools/cmake/build_tracing.sh b/build_tools/cmake/build_tracing.sh index e38a142f7466..2600eb1e0037 100755 --- a/build_tools/cmake/build_tracing.sh +++ b/build_tools/cmake/build_tracing.sh @@ -29,6 +29,6 @@ source build_tools/cmake/setup_ccache.sh -DIREE_BUILD_COMPILER=OFF "${CMAKE_BIN?}" --build "${BUILD_DIR}" -- -k 0 -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_USE_CCACHE == 1 )); ccache --show-stats fi diff --git a/build_tools/cmake/setup_ccache.sh b/build_tools/cmake/setup_ccache.sh index 95a2822dc6d8..419728f20aa5 100644 --- a/build_tools/cmake/setup_ccache.sh +++ b/build_tools/cmake/setup_ccache.sh @@ -36,9 +36,12 @@ if (( ${IREE_USE_LOCAL_CCACHE} == 1 && ${IREE_READ_REMOTE_CCACHE} == 1)); then fi if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then + export IREE_USE_CCACHE=1 export CMAKE_C_COMPILER_LAUNCHER=$(which ccache) export CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) $(which ccache) --zero-stats +else + export IREE_USE_CCACHE=0 fi if (( IREE_READ_REMOTE_CCACHE == 1 )); then From 53520200498b65a028a7ec7ee3bd227094ce6ed9 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 09:23:50 -0800 Subject: [PATCH 12/23] Add local read/write variables, adjust comments. --- .github/workflows/ci.yml | 9 ++++++--- build_tools/cmake/setup_ccache.sh | 24 ++++++++++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d0a763f4418..f404ee881979 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,7 +171,7 @@ jobs: steps: - name: "Checking out repository" uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - # Restore caches. + # Restore caches unconditionally. Cache misses are okay. - name: "Fetching cache (git submodules)" uses: actions/cache/restore@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: @@ -184,7 +184,8 @@ jobs: path: ${{ github.workspace }}/.ccache key: ccache_all_windows_${{ github.sha }} restore-keys: ccache_all_windows - # Fetch deps. + # Fetch dependencies. + # TODO(scotttodd): Move these into a Docker image. - name: "Updating git submodules" run: git submodule update --init --jobs 8 --depth 1 - name: "Setting up Python" @@ -203,8 +204,10 @@ jobs: # Finally: build and run tests. - name: "Building IREE" env: - IREE_USE_LOCAL_CCACHE: 1 IREE_READ_REMOTE_CCACHE: 0 + IREE_WRITE_REMOTE_CCACHE: 0 + IREE_READ_LOCAL_CCACHE: 1 + IREE_WRITE_LOCAL_CCACHE: ${{ needs.setup.outputs.write-caches }} CCACHE_DIR: ${{ github.workspace }}/.ccache run: ./build_tools/cmake/build_all.sh "${BUILD_DIR}" - name: "Testing IREE" diff --git a/build_tools/cmake/setup_ccache.sh b/build_tools/cmake/setup_ccache.sh index 419728f20aa5..1af9ef053e7e 100644 --- a/build_tools/cmake/setup_ccache.sh +++ b/build_tools/cmake/setup_ccache.sh @@ -13,9 +13,9 @@ # Local caches can also be used to interface with external remote caches # (like https://github.com/actions/cache) by # 1. downloading the cache directory -# 2. sourcing this file with IREE_USE_LOCAL_CCACHE=1 IREE_READ_REMOTE_CCACHE=0 +# 2. sourcing with IREE_READ_LOCAL_CCACHE=1 IREE_WRITE_LOCAL_CCACHE=[0,1] # 3. building with CMake -# 4. uploading the cache directory (optionally) +# 4. uploading the cache directory (if writing) # # Note: this file must be *sourced* not executed. @@ -24,18 +24,19 @@ set -euo pipefail # Configuration environment variables. IREE_READ_REMOTE_CCACHE="${IREE_READ_REMOTE_CCACHE:-1}" IREE_WRITE_REMOTE_CCACHE="${IREE_WRITE_REMOTE_CCACHE:-0}" -IREE_USE_LOCAL_CCACHE="${IREE_USE_LOCAL_CCACHE:-0}" +IREE_READ_LOCAL_CCACHE="${IREE_READ_LOCAL_CCACHE:-0}" +IREE_WRITE_LOCAL_CCACHE="${IREE_WRITE_LOCAL_CCACHE:-0}" if (( ${IREE_WRITE_REMOTE_CCACHE} == 1 && ${IREE_READ_REMOTE_CCACHE} != 1 )); then echo "Can't have 'IREE_WRITE_REMOTE_CCACHE' (${IREE_WRITE_REMOTE_CCACHE})" \ " set without 'IREE_READ_REMOTE_CCACHE' (${IREE_READ_REMOTE_CCACHE})" fi -if (( ${IREE_USE_LOCAL_CCACHE} == 1 && ${IREE_READ_REMOTE_CCACHE} == 1)); then - echo "Can't have 'IREE_USE_LOCAL_CCACHE' (${IREE_USE_LOCAL_CCACHE})" \ - " set with 'IREE_READ_REMOTE_CCACHE' (${IREE_READ_REMOTE_CCACHE})" +if (( ${IREE_WRITE_LOCAL_CCACHE} == 1 && ${IREE_READ_LOCAL_CCACHE} != 1 )); then + echo "Can't have 'IREE_WRITE_LOCAL_CCACHE' (${IREE_WRITE_LOCAL_CCACHE})" \ + " set without 'IREE_READ_LOCAL_CCACHE' (${IREE_READ_LOCAL_CCACHE})" fi -if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_USE_LOCAL_CCACHE == 1 )); then +if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_READ_LOCAL_CCACHE == 1 )); then export IREE_USE_CCACHE=1 export CMAKE_C_COMPILER_LAUNCHER=$(which ccache) export CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) @@ -44,9 +45,16 @@ else export IREE_USE_CCACHE=0 fi +if (( IREE_READ_LOCAL_CCACHE == 1 && IREE_WRITE_LOCAL_CCACHE == 0 )); then + export CCACHE_READONLY=1 +fi + +if (( IREE_READ_REMOTE_CCACHE == 1 && IREE_READ_LOCAL_CCACHE == 0 )); then + export CCACHE_REMOTE_ONLY=1 +fi + if (( IREE_READ_REMOTE_CCACHE == 1 )); then export CCACHE_REMOTE_STORAGE="http://storage.googleapis.com/iree-sccache/ccache" - export CCACHE_REMOTE_ONLY=1 if (( IREE_WRITE_REMOTE_CCACHE == 1 )); then set +x # Don't leak the token (even though it's short-lived) export CCACHE_REMOTE_STORAGE="${CCACHE_REMOTE_STORAGE}|bearer-token=${IREE_CCACHE_GCP_TOKEN}" From d475871c0ca336ec245610d4b19e214d331ba44f Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 09:25:27 -0800 Subject: [PATCH 13/23] Test build_test_all_windows on presubmit (no cache writes). --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f404ee881979..989b2c1d79e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,7 +160,7 @@ jobs: build_test_all_windows: needs: setup - if: needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' + if: needs.setup.outputs.should-run == 'true' runs-on: managed-windows-cpu defaults: run: From e47e81aad86ecf0965013317a36b19748a19986e Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 11:22:15 -0800 Subject: [PATCH 14/23] fixup! Add IREE_USE_CCACHE environment variable to simplify checks. --- build_tools/cmake/build_all.sh | 2 +- build_tools/cmake/build_and_test_asan.sh | 2 +- build_tools/cmake/build_and_test_tsan.sh | 2 +- build_tools/cmake/build_android.sh | 2 +- build_tools/cmake/build_host_tools.sh | 2 +- build_tools/cmake/build_runtime.sh | 2 +- build_tools/cmake/build_runtime_emscripten.sh | 2 +- build_tools/cmake/build_runtime_small.sh | 2 +- build_tools/cmake/build_tracing.sh | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build_tools/cmake/build_all.sh b/build_tools/cmake/build_all.sh index 1b1173abb8f3..391d22a46ef3 100755 --- a/build_tools/cmake/build_all.sh +++ b/build_tools/cmake/build_all.sh @@ -73,6 +73,6 @@ echo "Building sample deps" echo "------------------" "$CMAKE_BIN" --build "${BUILD_DIR}" --target iree-sample-deps -- -k 0 -if (( IREE_USE_CCACHE == 1 )); +if (( IREE_USE_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_and_test_asan.sh b/build_tools/cmake/build_and_test_asan.sh index a5821e22fa08..b5e21f233bad 100755 --- a/build_tools/cmake/build_and_test_asan.sh +++ b/build_tools/cmake/build_and_test_asan.sh @@ -64,7 +64,7 @@ echo "Building microbenchmark suites" echo "------------------" "${CMAKE_BIN?}" --build "${BUILD_DIR?}" --target iree-microbenchmark-suites -- -k 0 -if (( IREE_USE_CCACHE == 1 )); +if (( IREE_USE_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_and_test_tsan.sh b/build_tools/cmake/build_and_test_tsan.sh index 03fa4fde5123..d3205f4aa1fb 100755 --- a/build_tools/cmake/build_and_test_tsan.sh +++ b/build_tools/cmake/build_and_test_tsan.sh @@ -72,7 +72,7 @@ echo "Building sample deps" echo "------------------" "$CMAKE_BIN" --build "${BUILD_DIR?}" --target iree-sample-deps -- -k 0 -if (( IREE_USE_CCACHE == 1 )); +if (( IREE_USE_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_android.sh b/build_tools/cmake/build_android.sh index 0f23337a643e..c44438625110 100755 --- a/build_tools/cmake/build_android.sh +++ b/build_tools/cmake/build_android.sh @@ -94,6 +94,6 @@ echo "Building sample deps for device" echo "------------------" "${CMAKE_BIN}" --build "${BUILD_DIR}" --target iree-sample-deps -- -k 0 -if (( IREE_USE_CCACHE == 1 )); +if (( IREE_USE_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_host_tools.sh b/build_tools/cmake/build_host_tools.sh index 16b85c032df9..6929b0f892a0 100755 --- a/build_tools/cmake/build_host_tools.sh +++ b/build_tools/cmake/build_host_tools.sh @@ -51,6 +51,6 @@ declare -a CMAKE_ARGS=( "${CMAKE_BIN}" "${CMAKE_ARGS[@]}" "${CMAKE_BIN}" --build "${BUILD_DIR}" --target install -- -k 0 -if (( IREE_USE_CCACHE == 1 )); +if (( IREE_USE_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_runtime.sh b/build_tools/cmake/build_runtime.sh index b7b19f1e3918..13f2223aa10f 100755 --- a/build_tools/cmake/build_runtime.sh +++ b/build_tools/cmake/build_runtime.sh @@ -76,6 +76,6 @@ case "${BUILD_PRESET}" in ;; esac -if (( IREE_USE_CCACHE == 1 )); +if (( IREE_USE_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_runtime_emscripten.sh b/build_tools/cmake/build_runtime_emscripten.sh index 99e4a06f3f98..0598e23613ec 100755 --- a/build_tools/cmake/build_runtime_emscripten.sh +++ b/build_tools/cmake/build_runtime_emscripten.sh @@ -54,6 +54,6 @@ echo "Building sample deps" echo "------------------" "${CMAKE_BIN?}" --build . --target iree-sample-deps -- -k 0 -if (( IREE_USE_CCACHE == 1 )); +if (( IREE_USE_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_runtime_small.sh b/build_tools/cmake/build_runtime_small.sh index 6e4510bc987d..c78ec3d799d7 100755 --- a/build_tools/cmake/build_runtime_small.sh +++ b/build_tools/cmake/build_runtime_small.sh @@ -25,6 +25,6 @@ source build_tools/cmake/setup_ccache.sh -DIREE_BUILD_COMPILER=OFF "${CMAKE_BIN?}" --build "${BUILD_DIR}" -- -k 0 -if (( IREE_USE_CCACHE == 1 )); +if (( IREE_USE_CCACHE == 1 )); then ccache --show-stats fi diff --git a/build_tools/cmake/build_tracing.sh b/build_tools/cmake/build_tracing.sh index 2600eb1e0037..2d39092d89a6 100755 --- a/build_tools/cmake/build_tracing.sh +++ b/build_tools/cmake/build_tracing.sh @@ -29,6 +29,6 @@ source build_tools/cmake/setup_ccache.sh -DIREE_BUILD_COMPILER=OFF "${CMAKE_BIN?}" --build "${BUILD_DIR}" -- -k 0 -if (( IREE_USE_CCACHE == 1 )); +if (( IREE_USE_CCACHE == 1 )); then ccache --show-stats fi From f1626afa091b27ada6cd9a55ff5d5f7ae8e94019 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 11:51:26 -0800 Subject: [PATCH 15/23] Disable other jobs, flip conditions for testing. --- .github/workflows/ci.yml | 1153 +------------------------------------- 1 file changed, 4 insertions(+), 1149 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 989b2c1d79e2..4ab1bb75638f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,75 +89,6 @@ jobs: ./build_tools/github_actions/configure_ci.py - - ################################### Basic #################################### - # Jobs that build all of IREE "normally" - ############################################################################## - build_all: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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: full-build-dir - outputs: - # Pass through the build directory as output so it's available to - # dependent jobs. - build-dir: ${{ env.BUILD_DIR }} - build-dir-archive: ${{ steps.archive.outputs.build-dir-archive }} - build-dir-gcs-artifact: ${{ steps.upload.outputs.build-dir-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/build_all.sh \ - "${BUILD_DIR}" - # The archive step below doesn't include these files. Remove them first to - # save disk space. - # TODO(#10739): This step can be removed once we enlarge the disk sapce. - - name: "Removing unused files" - run: | - find "${BUILD_DIR}" -type f -name "*.a" -o -type f -name "*.o" \ - -print \ - -delete - # Things get more complicated here than when we're just building the - # runtime. The build directory is way bigger. We're also using on our own - # runners on GCE. So uploading to GitHub actions artifact storage hosted - # on Azure is dirt slow. We drop static libraries and object files, which - # aren't needed for testing. Then we do some minimal compression locally - # *in parallel* and upload to GCS. This can be further optimized. - # Especially decompression is still pretty slow. See #9881. - - name: "Creating build dir archive" - id: archive - env: - BUILD_DIR_ARCHIVE: ${{ env.BUILD_DIR }}.tar.zst - run: | - tar -I 'zstd -T0' \ - -cf ${BUILD_DIR_ARCHIVE} ${BUILD_DIR} - echo "build-dir-archive=${BUILD_DIR_ARCHIVE}" >> "${GITHUB_OUTPUT}" - - name: "Uploading build dir archive" - id: upload - env: - BUILD_DIR_ARCHIVE: ${{ steps.archive.outputs.build-dir-archive }} - BUILD_DIR_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.build-dir-archive }} - run: | - gcloud storage cp "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR_GCS_ARTIFACT}" - echo "build-dir-gcs-artifact=${BUILD_DIR_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" - build_test_all_windows: needs: setup if: needs.setup.outputs.should-run == 'true' @@ -207,1061 +138,26 @@ jobs: IREE_READ_REMOTE_CCACHE: 0 IREE_WRITE_REMOTE_CCACHE: 0 IREE_READ_LOCAL_CCACHE: 1 - IREE_WRITE_LOCAL_CCACHE: ${{ needs.setup.outputs.write-caches }} + IREE_WRITE_LOCAL_CCACHE: 1 + # IREE_WRITE_LOCAL_CCACHE: ${{ needs.setup.outputs.write-caches }} CCACHE_DIR: ${{ github.workspace }}/.ccache run: ./build_tools/cmake/build_all.sh "${BUILD_DIR}" - name: "Testing IREE" run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" # Write caches (if configured to) after all other steps are finished. - name: "Saving cache (git submodules)" - if: needs.setup.outputs.write-caches == 'true' + if: true || needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: .git/modules key: gitmodules_all_windows_${{ github.sha }} - name: "Saving cache (CMake/ccache)" - if: needs.setup.outputs.write-caches == 'true' + if: true || needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: ${{ github.workspace }}/.ccache key: ccache_all_windows_${{ github.sha }} - build_test_all_bazel: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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/swiftshader-bleeding-edge@sha256:8be446ba48a571b37c861574391c10715130d28cd5cadc86e5ec8080c0c6d4fa \ - ./build_tools/bazel/build_core.sh - - test_all: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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/swiftshader@sha256:126f96acd2071d364ff09d1e726a543ded8689619dfd80ca63ce716b31a5c1d4 \ - ./build_tools/cmake/ctest_all.sh \ - "${BUILD_DIR}" - - test_gpu: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 with GPU" - run: | - ./build_tools/github_actions/docker_run.sh \ - --env IREE_VULKAN_F16_DISABLE=0 \ - --env IREE_CUDA_DISABLE=0 \ - --env CTEST_PARALLEL_LEVEL=2 \ - --gpus all \ - --env NVIDIA_DRIVER_CAPABILITIES=all \ - gcr.io/iree-oss/nvidia@sha256:1294591d06d2b5eb03a7214fac040a1ccab890ea62e466843553f7fb7aacdc1d \ - 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: needs.setup.outputs.should-run == 'true' - runs-on: ubuntu-20.04-64core - env: - BUILD_DIR: build-runtime - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - - name: "Checking out runtime submodules" - run: ./build_tools/scripts/git/update_runtime_submodules.sh - - name: "Building runtime" - # Note ccache is read-only here since this job runs on a GitHub-hosted runner - # and GitHub runners don't have write access to GCS - run: | - ./build_tools/github_actions/docker_run.sh \ - --env "BUILD_PRESET=test" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/ctest_all.sh \ - "${BUILD_DIR}" - - build_test_runtime_windows: - needs: setup - if: needs.setup.outputs.should-run == 'true' - runs-on: managed-windows-cpu - defaults: - run: - shell: bash - env: - BUILD_DIR: build-runtime-windows - IREE_VULKAN_DISABLE: 1 - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 build the IREE-Tensorflow integrations - ############################################################################## - build_tf_integrations: - needs: setup - if: needs.setup.outputs.should-run == 'true' - runs-on: - - self-hosted # must come first - - runner-group=${{ needs.setup.outputs.runner-group }} - - environment=${{ needs.setup.outputs.runner-env }} - - cpu - - os-family=Linux - outputs: - binaries-dir: ${{ steps.build.outputs.binaries-dir }} - binaries-archive: ${{ steps.archive.outputs.binaries-archive }} - binaries-gcs-artifact: ${{ steps.upload.outputs.binaries-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - submodules: true - - name: "Building TF binaries" - id: build - env: - IREE_TF_BINARIES_OUTPUT_DIR: iree-tf-binaries - 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}" \ - --env "IREE_TF_BINARIES_OUTPUT_DIR=${IREE_TF_BINARIES_OUTPUT_DIR}" \ - gcr.io/iree-oss/frontends-swiftshader@sha256:414071144e8b742ec61eccf69a657e13424513b7574153820367de355e494e0a \ - build_tools/cmake/build_tf_binaries.sh - echo "binaries-dir=${IREE_TF_BINARIES_OUTPUT_DIR}" >> "${GITHUB_OUTPUT}" - - name: "Creating archive of binaries" - id: archive - env: - BINARIES_ARCHIVE: tf-binaries.tar - BINARIES_DIR: ${{ steps.build.outputs.binaries-dir }} - run: | - tar -cf "${BINARIES_ARCHIVE}" "${BINARIES_DIR}" - echo "binaries-archive=${BINARIES_ARCHIVE}" >> "${GITHUB_OUTPUT}" - - name: "Uploading binaries archive" - id: upload - env: - BINARIES_ARCHIVE: ${{ steps.archive.outputs.binaries-archive }} - BINARIES_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.binaries-archive }} - run: | - gcloud storage cp "${BINARIES_ARCHIVE}" "${BINARIES_GCS_ARTIFACT}" - echo "binaries-gcs-artifact=${BINARIES_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" - - test_tf_integrations: - needs: [setup, build_all, build_tf_integrations] - if: needs.setup.outputs.should-run == 'true' - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - submodules: true - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xvf "${TF_BINARIES_ARCHIVE}" - - name: "Symlinking TF binaries" - run: | - ./integrations/tensorflow/symlink_binaries.sh "${TF_BINARIES_DIR}" - - 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 \ - gcr.io/iree-oss/frontends-swiftshader@sha256:414071144e8b742ec61eccf69a657e13424513b7574153820367de355e494e0a \ - build_tools/cmake/run_tf_tests.sh \ - "${BUILD_DIR}" - - test_tf_integrations_gpu: - needs: [setup, build_all, build_tf_integrations] - if: needs.setup.outputs.should-run == 'true' - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - submodules: true - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xvf "${TF_BINARIES_ARCHIVE}" - - name: "Symlinking TF binaries" - run: | - ./integrations/tensorflow/symlink_binaries.sh "${TF_BINARIES_DIR}" - - 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_LLVM_CPU_DISABLE=1 \ - --gpus all \ - --env NVIDIA_DRIVER_CAPABILITIES=all \ - gcr.io/iree-oss/frontends-nvidia@sha256:130572b670f8d7e29ca934cb8775ac81346d532dde7dfd51c402b52f23ea73fc \ - 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}" - - ######################## Community Model Coverage ############################ - # Jobs that test IREE behavior on a set of models. - ############################################################################## - test_shark_model_suite: - needs: [setup, build_all, build_tf_integrations] - # Disabled while failing. See https://github.com/iree-org/iree/issues/10653 - if: false && needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - submodules: true - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xf "${TF_BINARIES_ARCHIVE}" - - name: "Symlinking TF binaries" - run: | - ./integrations/tensorflow/symlink_binaries.sh "$(realpath "${TF_BINARIES_DIR}")" - - 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: "Downloading SHARK" - id: download_shark - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - with: - repository: nod-ai/SHARK - path: ${{ github.workspace }}/SHARK - - name: "Testing Shark Model Suite" - run: | - cd "${GITHUB_WORKSPACE}/SHARK" - NO_BACKEND=1 ./setup_venv.sh - source shark.venv/bin/activate - export TFPYBASE="${GITHUB_WORKSPACE}/integrations/tensorflow/python_projects" - export PYTHONPATH="${PYTHONPATH}:${BUILD_DIR}/compiler/bindings/python:${BUILD_DIR}/runtime/bindings/python" - export PYTHONPATH="${PYTHONPATH}:$TFPYBASE/iree_tf:$TFPYBASE/iree_tflite" - export SHARK_SKIP_TESTS="--ignore=shark/tests/test_shark_importer.py \ - --ignore=benchmarks/tests/test_hf_benchmark.py \ - --ignore=benchmarks/tests/test_benchmark.py" - export MODEL_LIST="bert_base_cased or mobilebert_uncased or MiniLM_L12_H384_uncased or module_resnet50 or mobilenet_v3 or squeezenet1_0 or vit_base_patch16_224" - pytest tank/test_models.py -k "cpu and ($MODEL_LIST)" $SHARK_SKIP_TESTS - pytest tank/test_models.py -k "vulkan and ($MODEL_LIST)" $SHARK_SKIP_TESTS - pytest tank/test_models.py -k "cuda and ($MODEL_LIST)" $SHARK_SKIP_TESTS - - # TODO(#11263): Drop this job once the IREE_BUILD_BENCHMARKS is removed. - test_build_benchmark_suites: - needs: [setup, build_all, build_tf_integrations] - if: needs.setup.outputs.should-run == 'true' - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - BUILD_BENCHMARKS_DIR: build-benchmarks - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - - name: "Checking out runtime submodules" - run: ./build_tools/scripts/git/update_runtime_submodules.sh - - name: "Downloading build dir archive" - run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" - - name: "Extracting install from build dir archive" - run: tar -xf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install" - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xf "${TF_BINARIES_ARCHIVE}" - - name: "Building benchmarks" - id: build - run: | - build_tools/github_actions/docker_run.sh \ - --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \ - --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ - --env "IREE_BUILD_BENCHMARKS_DIR=${BUILD_BENCHMARKS_DIR}" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - build_tools/cmake/build_benchmarks.sh - - ############################### Configurations ############################### - # Jobs that build IREE in some non-default configuration - ############################################################################## - asan: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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=swiftshader-bleeding-edge@sha256:c22afc61198e14a98e06e5261149de74c629acd2bc61b82e57ec90e5461b69be" \ - gcr.io/iree-oss/swiftshader-bleeding-edge@sha256:8be446ba48a571b37c861574391c10715130d28cd5cadc86e5ec8080c0c6d4fa \ - ./build_tools/cmake/build_and_test_asan.sh - - tsan: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/build_and_test_tsan.sh - - small_runtime: - needs: setup - if: needs.setup.outputs.should-run == 'true' - runs-on: ubuntu-20.04-64core - env: - BUILD_DIR: build-runtime - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - - name: "Checking out runtime submodules" - run: ./build_tools/scripts/git/update_runtime_submodules.sh - - name: "Building size-optimized runtime" - # Note ccache is read-only here since this job runs on a GitHub-hosted runner - # and GitHub runners don't have write access to GCS - run: | - ./build_tools/github_actions/docker_run.sh \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/ctest_all.sh \ - "${BUILD_DIR}" - - gcc: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 "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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/build_all.sh \ - "${BUILD_DIR}" - - tracing: - needs: setup - if: needs.setup.outputs.should-run == 'true' - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - ./build_tools/cmake/build_tracing.sh \ - "${BUILD_DIR}" - - ############################### Configurations ############################### - # Jobs that build and run IREE e2e tests/benchmarks # - ############################################################################## - - build_benchmark_tools: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' - runs-on: - - self-hosted # must come first - - runner-group=${{ needs.setup.outputs.runner-group }} - - environment=${{ needs.setup.outputs.runner-env }} - - cpu - - os-family=Linux - outputs: - # We can't collect all outputs from the matrix jobs due to Github's - # limitation (https://github.com/orgs/community/discussions/17245). - # Therefore, the output is the GCS directory that stores all benchmark - # tools archives. The following jobs need to construct the archive names - # by themselves and combine with path of GCS directory here to fetch the - # archives. - benchmark-tools-gcs-artifact-dir: ${{ steps.upload.outputs.benchmark-tools-gcs-artifact-dir }} - strategy: - matrix: - target: - - platform: "linux" - arch: "x86_64" - docker_image: "gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" - # Builds tools on the host and assumes the builder is Linux x86_64. - build_script: "./build_tools/cmake/build_runtime.sh" - - platform: "linux" - arch: "riscv_64" - docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - build_script: "./build_tools/cmake/build_riscv.sh" - env: - PLATFORM: ${{ matrix.target.platform }} - ARCH: ${{ matrix.target.arch }} - DOCKER_IMAGE: ${{ matrix.target.docker_image }} - BUILD_SCRIPT: ${{ matrix.target.build_script }} - BUILD_TOOLS_DIR: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmark-tools-dir - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - - name: "Checking out runtime submodules" - run: ./build_tools/scripts/git/update_runtime_submodules.sh - - name: "Downloading build dir archive" - run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" - - name: "Extracting host binaries" - run: tar -xf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install" - - name: "Compiling the benchmark tools" - id: build - run: | - ./build_tools/github_actions/docker_run.sh \ - --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ - --env "IREE_TARGET_ARCH=${ARCH}" \ - --env "BUILD_PRESET=benchmark" \ - --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ - "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build" - - name: "Compiling the benchmark tools with tracing" - id: build-with-tracing - run: | - ./build_tools/github_actions/docker_run.sh \ - --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ - --env "IREE_TARGET_ARCH=${ARCH}" \ - --env "BUILD_PRESET=benchmark-with-tracing" \ - --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ - "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build-traced" - - name: "Creating the benchmark tools archive" - id: archive - env: - BENCHMARK_TOOLS_ARCHIVE: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmark-tools.tar - run: | - tar -cf "${BENCHMARK_TOOLS_ARCHIVE}" \ - "${BUILD_TOOLS_DIR}"/*/tools/iree-benchmark-module \ - "${BUILD_TOOLS_DIR}"/*/tools/build_config.txt - echo "benchmark-tools-archive=${BENCHMARK_TOOLS_ARCHIVE}" >> "${GITHUB_OUTPUT}" - - name: "Uploading the benchmark tools archive" - id: upload - env: - BENCHMARK_TOOLS_ARCHIVE: ${{ steps.archive.outputs.benchmark-tools-archive }} - BENCHMARK_TOOLS_GCS_ARTIFACT_DIR: ${{ env.GCS_DIR }}/benchmark-tools - run: | - gcloud storage cp "${BENCHMARK_TOOLS_ARCHIVE}" "${BENCHMARK_TOOLS_GCS_ARTIFACT_DIR}/" - echo "benchmark-tools-gcs-artifact-dir=${BENCHMARK_TOOLS_GCS_ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}" - - build_e2e_test_artifacts: - needs: [setup, build_all, build_tf_integrations] - if: needs.setup.outputs.should-run == 'true' - 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: - 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 }} - TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} - TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} - TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} - outputs: - e2e-test-artifacts-dir: ${{ steps.build.outputs.e2e-test-artifacts-dir }} - e2e-test-artifacts-gcs-artifact-dir: ${{ steps.upload.outputs.e2e-test-artifacts-gcs-artifact-dir }} - e2e-test-artifacts-build-log: ${{ steps.build.outputs.e2e-test-artifacts-build-log }} - e2e-test-artifacts-build-log-gcs-artifact: ${{ steps.upload.outputs.e2e-test-artifacts-build-log-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 install from build dir archive" - run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" - - name: "Downloading TF binaries archive" - run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" - - name: "Extracting TF binaries archive" - run: tar -xf "${TF_BINARIES_ARCHIVE}" - - name: "Building e2e test artifacts" - id: build - env: - BUILD_E2E_TEST_ARTIFACTS_DIR: build-e2e-test-artifacts - run: | - build_tools/github_actions/docker_run.sh \ - --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \ - --env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ - gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ - build_tools/cmake/build_e2e_test_artifacts.sh \ - "${BUILD_E2E_TEST_ARTIFACTS_DIR}" - echo "e2e-test-artifacts-dir=${BUILD_E2E_TEST_ARTIFACTS_DIR}/e2e_test_artifacts" >> "${GITHUB_OUTPUT}" - echo "e2e-test-artifacts-build-log=${BUILD_E2E_TEST_ARTIFACTS_DIR}/.ninja_log" >> "${GITHUB_OUTPUT}" - - name: "Uploading e2e test artifacts" - id: upload - env: - E2E_TEST_ARTIFACTS_DIR: ${{ steps.build.outputs.e2e-test-artifacts-dir }} - E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR: ${{ env.GCS_DIR }}/e2e-test-artifacts - E2E_TEST_ARTIFACTS_BUILD_LOG: ${{ steps.build.outputs.e2e-test-artifacts-build-log }} - E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT: ${{ env.GCS_DIR }}/e2e-test-artifacts/ninja_log - run: | - # Uploads all IREE artifacts and MLIR files (including the imported - # MLIR files and MLIR source models). - # Not archiving the directory to allow fetching each file as needed - # separately. - find "${E2E_TEST_ARTIFACTS_DIR}" -maxdepth 1 \ - -name "iree_*" -o -name "model_*.mlir" | \ - gcloud storage cp --read-paths-from-stdin -r \ - "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" - gcloud storage cp "${E2E_TEST_ARTIFACTS_BUILD_LOG}" \ - "${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" - echo "e2e-test-artifacts-gcs-artifact-dir=${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}" - echo "e2e-test-artifacts-build-log-gcs-artifact=${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" - - compilation_benchmarks: - needs: [setup, build_e2e_test_artifacts] - if: needs.setup.outputs.should-run == 'true' - 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: - 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 }} - outputs: - compile-stats-results: ${{ steps.collect.outputs.compile-stats-results }} - compile-stats-results-gcs-artifact: ${{ steps.upload.outputs.compile-stats-results-gcs-artifact }} - steps: - - name: "Checking out repository" - uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 - - name: "Exporting configs" - id: "export" - env: - COMPILATION_CONFIG: "compilation-config.json" - run: | - ./build_tools/benchmarks/export_benchmark_config.py \ - compilation \ - --output="${COMPILATION_CONFIG}" - echo "compilation-config=${COMPILATION_CONFIG}" >> "${GITHUB_OUTPUT}" - - name: "Downloading assets" - id: "download-assets" - env: - COMPILATION_CONFIG: ${{ steps.export.outputs.compilation-config }} - run: | - gcloud storage cp \ - "${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" \ - "${E2E_TEST_ARTIFACTS_BUILD_LOG}" - mkdir -p "${E2E_TEST_ARTIFACTS_DIR}" - jq -r \ - --arg GCS_ARTIFACT_DIR "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" \ - '.module_dir_paths | map("\($GCS_ARTIFACT_DIR)/\(.)") | join("\n")' \ - "${COMPILATION_CONFIG}" | \ - gcloud storage cp -r --read-paths-from-stdin \ - "${E2E_TEST_ARTIFACTS_DIR}" - - name: "Collecting compilation statistics" - id: collect - env: - COMPILATION_CONFIG: ${{ steps.export.outputs.compilation-config }} - GENERATION_CONFIG: generation-config.json - COMPILE_STATS_RESULTS: benchmark-results/compile-stats-results.json - run: | - jq '.generation_configs' "${COMPILATION_CONFIG}" > "${GENERATION_CONFIG}" - mkdir -p benchmark-results - ./build_tools/benchmarks/collect_compilation_statistics.py alpha \ - --e2e_test_artifacts_dir="${E2E_TEST_ARTIFACTS_DIR}" \ - --build_log="${E2E_TEST_ARTIFACTS_BUILD_LOG}" \ - --generation_config="${GENERATION_CONFIG}" \ - --output="${COMPILE_STATS_RESULTS}" - echo "compile-stats-results=${COMPILE_STATS_RESULTS}" >> "${GITHUB_OUTPUT}" - - name: "Uploading benchmark results" - id: upload - env: - COMPILE_STATS_RESULTS: ${{ steps.collect.outputs.compile-stats-results }} - COMPILE_STATS_RESULTS_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.collect.outputs.compile-stats-results }} - run: | - gcloud storage cp \ - "${COMPILE_STATS_RESULTS}" \ - "${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" - echo "compile-stats-results-gcs-artifact=${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" - - execution_benchmarks: - needs: [setup, build_benchmark_tools, build_e2e_test_artifacts] - if: needs.setup.outputs.should-run == 'true' && 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 }} - benchmark-presets: ${{ needs.setup.outputs.benchmark-presets }} - - process_benchmark_results: - needs: [setup, compilation_benchmarks, execution_benchmarks] - # execution_benchmarks is the optional dependency and skipped in presubmit - # if no benchmark is specified to run. - if: | - always() && - needs.setup.outputs.should-run == 'true' && - needs.compilation_benchmarks.result == 'success' && - contains(fromJSON('["success", "skipped"]'), needs.execution_benchmarks.result) - 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 }} - EXECUTION_BENCHMARK_RESULTS_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-dir }} - EXECUTION_BENCHMARK_RESULTS_GCS_ARTIFACT_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-gcs-artifact-dir }} - steps: - - name: "Checking out repository" - uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 - 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 - if: needs.execution_benchmarks.result == 'success' - 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: needs.setup.outputs.ci-stage == 'presubmit' - 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/iree-org/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: needs.setup.outputs.ci-stage == 'presubmit' - 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 - # TODO(#11076): Temporarily disabled until we migrate the database. - if: false && needs.setup.outputs.ci-stage == 'postsubmit' - 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/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 - ############################################################################## - - # emscripten is not in the test matrix because it is set as - # postsubmission-only. - cross_compile_and_test: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' - 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: android - arch: armv8.2-a - abi: arm64-v8a - docker_image: "gcr.io/iree-oss/android@sha256:b0b607d95af8da6a6ce430f22d9d7c621702df13ce2b5d264b79d0ac7e60d670" - build_script: "./build_tools/cmake/build_android.sh" - # No test_script - - platform: linux - arch: riscv_64 - abi: lp64d - docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - build_script: "./build_tools/cmake/build_riscv.sh" - test_script: "./tests/riscv32/smoke.sh" - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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}" - - emscripten: - needs: [setup, build_all] - if: needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' - 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: - 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 }} - steps: - - name: "Checking out repository" - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 install from build dir archive" - run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" - - name: "Building the runtime for the web using Emscripten" - run: | - build_tools/github_actions/docker_run.sh \ - --env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ - gcr.io/iree-oss/emscripten@sha256:fdb2bf6b0701a6de80f4f708ea86b001279c8acd904c34ef4d05ee3802711e45 \ - build_tools/cmake/build_runtime_emscripten.sh - - test_benchmark_suites: - needs: [setup, build_all, build_e2e_test_artifacts] - if: needs.setup.outputs.should-run == 'true' - 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 - docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" - 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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" - run_scripts: "./build_tools/cmake/test_benchmark_suites_on_linux.sh" - 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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: "Download benchmark expected output" - env: - EXPECTED_OUTPUT_GSC_ARTIFACT: gs://iree-model-artifacts/deeplab_v3_fp32_input_0_expected_output.npy - EXPECTED_OUTPUT_FILE: deeplab_v3_fp32_input_0_expected_output.npy - run: | - gcloud storage cp "${EXPECTED_OUTPUT_GSC_ARTIFACT}" "${E2E_TEST_ARTIFACTS_DIR}/${EXPECTED_OUTPUT_FILE}" - - 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 @@ -1275,48 +171,7 @@ jobs: needs: - setup - # Basic - - build_all - build_test_all_windows - - build_test_all_bazel - - test_all - - test_gpu - - # Subsets - - build_test_runtime - - build_test_runtime_windows - - # Tensorflow - - build_tf_integrations - - test_tf_integrations - - test_tf_integrations_gpu - - # Model Coverage - - test_build_benchmark_suites - - test_shark_model_suite - - # Configurations - - asan - - tsan - - small_runtime - - gcc - - tracing - - # Crosscompilation - - cross_compile_and_test - - emscripten - - # 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: Getting failed jobs id: failed_jobs From 95a93cfc1dfda8a89b8e76a2af3233c6cc12a465 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 12:20:50 -0800 Subject: [PATCH 16/23] Empty commit to re-run CI with cache. From fa83e55398f326e2d5295ecb3823607ca30c1e79 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 13:27:58 -0800 Subject: [PATCH 17/23] Set CCACHE_MAXSIZE to 3G. --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ab1bb75638f..e483247fa1cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,6 +141,9 @@ jobs: IREE_WRITE_LOCAL_CCACHE: 1 # IREE_WRITE_LOCAL_CCACHE: ${{ needs.setup.outputs.write-caches }} CCACHE_DIR: ${{ github.workspace }}/.ccache + # A full build is around 2.5GB, but uploads/downloads are slow and + # we have a limit of 10GB per repository + CCACHE_MAXSIZE: 3G run: ./build_tools/cmake/build_all.sh "${BUILD_DIR}" - name: "Testing IREE" run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" From 31c524c9e8c65367832961d4672d43e2605be5b8 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 16:00:19 -0800 Subject: [PATCH 18/23] Revert "Disable other jobs, flip conditions for testing." This reverts commit f1626afa091b27ada6cd9a55ff5d5f7ae8e94019. --- .github/workflows/ci.yml | 1153 +++++++++++++++++++++++++++++++++++++- 1 file changed, 1149 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e483247fa1cb..7b139552f4b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,6 +89,75 @@ jobs: ./build_tools/github_actions/configure_ci.py + + ################################### Basic #################################### + # Jobs that build all of IREE "normally" + ############################################################################## + build_all: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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: full-build-dir + outputs: + # Pass through the build directory as output so it's available to + # dependent jobs. + build-dir: ${{ env.BUILD_DIR }} + build-dir-archive: ${{ steps.archive.outputs.build-dir-archive }} + build-dir-gcs-artifact: ${{ steps.upload.outputs.build-dir-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/build_all.sh \ + "${BUILD_DIR}" + # The archive step below doesn't include these files. Remove them first to + # save disk space. + # TODO(#10739): This step can be removed once we enlarge the disk sapce. + - name: "Removing unused files" + run: | + find "${BUILD_DIR}" -type f -name "*.a" -o -type f -name "*.o" \ + -print \ + -delete + # Things get more complicated here than when we're just building the + # runtime. The build directory is way bigger. We're also using on our own + # runners on GCE. So uploading to GitHub actions artifact storage hosted + # on Azure is dirt slow. We drop static libraries and object files, which + # aren't needed for testing. Then we do some minimal compression locally + # *in parallel* and upload to GCS. This can be further optimized. + # Especially decompression is still pretty slow. See #9881. + - name: "Creating build dir archive" + id: archive + env: + BUILD_DIR_ARCHIVE: ${{ env.BUILD_DIR }}.tar.zst + run: | + tar -I 'zstd -T0' \ + -cf ${BUILD_DIR_ARCHIVE} ${BUILD_DIR} + echo "build-dir-archive=${BUILD_DIR_ARCHIVE}" >> "${GITHUB_OUTPUT}" + - name: "Uploading build dir archive" + id: upload + env: + BUILD_DIR_ARCHIVE: ${{ steps.archive.outputs.build-dir-archive }} + BUILD_DIR_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.build-dir-archive }} + run: | + gcloud storage cp "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR_GCS_ARTIFACT}" + echo "build-dir-gcs-artifact=${BUILD_DIR_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" + build_test_all_windows: needs: setup if: needs.setup.outputs.should-run == 'true' @@ -138,8 +207,7 @@ jobs: IREE_READ_REMOTE_CCACHE: 0 IREE_WRITE_REMOTE_CCACHE: 0 IREE_READ_LOCAL_CCACHE: 1 - IREE_WRITE_LOCAL_CCACHE: 1 - # IREE_WRITE_LOCAL_CCACHE: ${{ needs.setup.outputs.write-caches }} + IREE_WRITE_LOCAL_CCACHE: ${{ needs.setup.outputs.write-caches }} CCACHE_DIR: ${{ github.workspace }}/.ccache # A full build is around 2.5GB, but uploads/downloads are slow and # we have a limit of 10GB per repository @@ -149,18 +217,1054 @@ jobs: run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" # Write caches (if configured to) after all other steps are finished. - name: "Saving cache (git submodules)" - if: true || needs.setup.outputs.write-caches == 'true' + if: needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: .git/modules key: gitmodules_all_windows_${{ github.sha }} - name: "Saving cache (CMake/ccache)" - if: true || needs.setup.outputs.write-caches == 'true' + if: needs.setup.outputs.write-caches == 'true' uses: actions/cache/save@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: path: ${{ github.workspace }}/.ccache key: ccache_all_windows_${{ github.sha }} + build_test_all_bazel: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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/swiftshader-bleeding-edge@sha256:8be446ba48a571b37c861574391c10715130d28cd5cadc86e5ec8080c0c6d4fa \ + ./build_tools/bazel/build_core.sh + + test_all: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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/swiftshader@sha256:126f96acd2071d364ff09d1e726a543ded8689619dfd80ca63ce716b31a5c1d4 \ + ./build_tools/cmake/ctest_all.sh \ + "${BUILD_DIR}" + + test_gpu: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 with GPU" + run: | + ./build_tools/github_actions/docker_run.sh \ + --env IREE_VULKAN_F16_DISABLE=0 \ + --env IREE_CUDA_DISABLE=0 \ + --env CTEST_PARALLEL_LEVEL=2 \ + --gpus all \ + --env NVIDIA_DRIVER_CAPABILITIES=all \ + gcr.io/iree-oss/nvidia@sha256:1294591d06d2b5eb03a7214fac040a1ccab890ea62e466843553f7fb7aacdc1d \ + 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: needs.setup.outputs.should-run == 'true' + runs-on: ubuntu-20.04-64core + env: + BUILD_DIR: build-runtime + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + - name: "Checking out runtime submodules" + run: ./build_tools/scripts/git/update_runtime_submodules.sh + - name: "Building runtime" + # Note ccache is read-only here since this job runs on a GitHub-hosted runner + # and GitHub runners don't have write access to GCS + run: | + ./build_tools/github_actions/docker_run.sh \ + --env "BUILD_PRESET=test" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/ctest_all.sh \ + "${BUILD_DIR}" + + build_test_runtime_windows: + needs: setup + if: needs.setup.outputs.should-run == 'true' + runs-on: managed-windows-cpu + defaults: + run: + shell: bash + env: + BUILD_DIR: build-runtime-windows + IREE_VULKAN_DISABLE: 1 + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 build the IREE-Tensorflow integrations + ############################################################################## + build_tf_integrations: + needs: setup + if: needs.setup.outputs.should-run == 'true' + runs-on: + - self-hosted # must come first + - runner-group=${{ needs.setup.outputs.runner-group }} + - environment=${{ needs.setup.outputs.runner-env }} + - cpu + - os-family=Linux + outputs: + binaries-dir: ${{ steps.build.outputs.binaries-dir }} + binaries-archive: ${{ steps.archive.outputs.binaries-archive }} + binaries-gcs-artifact: ${{ steps.upload.outputs.binaries-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + submodules: true + - name: "Building TF binaries" + id: build + env: + IREE_TF_BINARIES_OUTPUT_DIR: iree-tf-binaries + 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}" \ + --env "IREE_TF_BINARIES_OUTPUT_DIR=${IREE_TF_BINARIES_OUTPUT_DIR}" \ + gcr.io/iree-oss/frontends-swiftshader@sha256:414071144e8b742ec61eccf69a657e13424513b7574153820367de355e494e0a \ + build_tools/cmake/build_tf_binaries.sh + echo "binaries-dir=${IREE_TF_BINARIES_OUTPUT_DIR}" >> "${GITHUB_OUTPUT}" + - name: "Creating archive of binaries" + id: archive + env: + BINARIES_ARCHIVE: tf-binaries.tar + BINARIES_DIR: ${{ steps.build.outputs.binaries-dir }} + run: | + tar -cf "${BINARIES_ARCHIVE}" "${BINARIES_DIR}" + echo "binaries-archive=${BINARIES_ARCHIVE}" >> "${GITHUB_OUTPUT}" + - name: "Uploading binaries archive" + id: upload + env: + BINARIES_ARCHIVE: ${{ steps.archive.outputs.binaries-archive }} + BINARIES_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.binaries-archive }} + run: | + gcloud storage cp "${BINARIES_ARCHIVE}" "${BINARIES_GCS_ARTIFACT}" + echo "binaries-gcs-artifact=${BINARIES_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" + + test_tf_integrations: + needs: [setup, build_all, build_tf_integrations] + if: needs.setup.outputs.should-run == 'true' + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + submodules: true + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xvf "${TF_BINARIES_ARCHIVE}" + - name: "Symlinking TF binaries" + run: | + ./integrations/tensorflow/symlink_binaries.sh "${TF_BINARIES_DIR}" + - 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 \ + gcr.io/iree-oss/frontends-swiftshader@sha256:414071144e8b742ec61eccf69a657e13424513b7574153820367de355e494e0a \ + build_tools/cmake/run_tf_tests.sh \ + "${BUILD_DIR}" + + test_tf_integrations_gpu: + needs: [setup, build_all, build_tf_integrations] + if: needs.setup.outputs.should-run == 'true' + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + submodules: true + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xvf "${TF_BINARIES_ARCHIVE}" + - name: "Symlinking TF binaries" + run: | + ./integrations/tensorflow/symlink_binaries.sh "${TF_BINARIES_DIR}" + - 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_LLVM_CPU_DISABLE=1 \ + --gpus all \ + --env NVIDIA_DRIVER_CAPABILITIES=all \ + gcr.io/iree-oss/frontends-nvidia@sha256:130572b670f8d7e29ca934cb8775ac81346d532dde7dfd51c402b52f23ea73fc \ + 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}" + + ######################## Community Model Coverage ############################ + # Jobs that test IREE behavior on a set of models. + ############################################################################## + test_shark_model_suite: + needs: [setup, build_all, build_tf_integrations] + # Disabled while failing. See https://github.com/iree-org/iree/issues/10653 + if: false && needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + submodules: true + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xf "${TF_BINARIES_ARCHIVE}" + - name: "Symlinking TF binaries" + run: | + ./integrations/tensorflow/symlink_binaries.sh "$(realpath "${TF_BINARIES_DIR}")" + - 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: "Downloading SHARK" + id: download_shark + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + with: + repository: nod-ai/SHARK + path: ${{ github.workspace }}/SHARK + - name: "Testing Shark Model Suite" + run: | + cd "${GITHUB_WORKSPACE}/SHARK" + NO_BACKEND=1 ./setup_venv.sh + source shark.venv/bin/activate + export TFPYBASE="${GITHUB_WORKSPACE}/integrations/tensorflow/python_projects" + export PYTHONPATH="${PYTHONPATH}:${BUILD_DIR}/compiler/bindings/python:${BUILD_DIR}/runtime/bindings/python" + export PYTHONPATH="${PYTHONPATH}:$TFPYBASE/iree_tf:$TFPYBASE/iree_tflite" + export SHARK_SKIP_TESTS="--ignore=shark/tests/test_shark_importer.py \ + --ignore=benchmarks/tests/test_hf_benchmark.py \ + --ignore=benchmarks/tests/test_benchmark.py" + export MODEL_LIST="bert_base_cased or mobilebert_uncased or MiniLM_L12_H384_uncased or module_resnet50 or mobilenet_v3 or squeezenet1_0 or vit_base_patch16_224" + pytest tank/test_models.py -k "cpu and ($MODEL_LIST)" $SHARK_SKIP_TESTS + pytest tank/test_models.py -k "vulkan and ($MODEL_LIST)" $SHARK_SKIP_TESTS + pytest tank/test_models.py -k "cuda and ($MODEL_LIST)" $SHARK_SKIP_TESTS + + # TODO(#11263): Drop this job once the IREE_BUILD_BENCHMARKS is removed. + test_build_benchmark_suites: + needs: [setup, build_all, build_tf_integrations] + if: needs.setup.outputs.should-run == 'true' + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + BUILD_BENCHMARKS_DIR: build-benchmarks + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + - name: "Checking out runtime submodules" + run: ./build_tools/scripts/git/update_runtime_submodules.sh + - name: "Downloading build dir archive" + run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" + - name: "Extracting install from build dir archive" + run: tar -xf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install" + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xf "${TF_BINARIES_ARCHIVE}" + - name: "Building benchmarks" + id: build + run: | + build_tools/github_actions/docker_run.sh \ + --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \ + --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ + --env "IREE_BUILD_BENCHMARKS_DIR=${BUILD_BENCHMARKS_DIR}" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + build_tools/cmake/build_benchmarks.sh + + ############################### Configurations ############################### + # Jobs that build IREE in some non-default configuration + ############################################################################## + asan: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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=swiftshader-bleeding-edge@sha256:c22afc61198e14a98e06e5261149de74c629acd2bc61b82e57ec90e5461b69be" \ + gcr.io/iree-oss/swiftshader-bleeding-edge@sha256:8be446ba48a571b37c861574391c10715130d28cd5cadc86e5ec8080c0c6d4fa \ + ./build_tools/cmake/build_and_test_asan.sh + + tsan: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/build_and_test_tsan.sh + + small_runtime: + needs: setup + if: needs.setup.outputs.should-run == 'true' + runs-on: ubuntu-20.04-64core + env: + BUILD_DIR: build-runtime + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + - name: "Checking out runtime submodules" + run: ./build_tools/scripts/git/update_runtime_submodules.sh + - name: "Building size-optimized runtime" + # Note ccache is read-only here since this job runs on a GitHub-hosted runner + # and GitHub runners don't have write access to GCS + run: | + ./build_tools/github_actions/docker_run.sh \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/ctest_all.sh \ + "${BUILD_DIR}" + + gcc: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 "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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/build_all.sh \ + "${BUILD_DIR}" + + tracing: + needs: setup + if: needs.setup.outputs.should-run == 'true' + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + ./build_tools/cmake/build_tracing.sh \ + "${BUILD_DIR}" + + ############################### Configurations ############################### + # Jobs that build and run IREE e2e tests/benchmarks # + ############################################################################## + + build_benchmark_tools: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' + runs-on: + - self-hosted # must come first + - runner-group=${{ needs.setup.outputs.runner-group }} + - environment=${{ needs.setup.outputs.runner-env }} + - cpu + - os-family=Linux + outputs: + # We can't collect all outputs from the matrix jobs due to Github's + # limitation (https://github.com/orgs/community/discussions/17245). + # Therefore, the output is the GCS directory that stores all benchmark + # tools archives. The following jobs need to construct the archive names + # by themselves and combine with path of GCS directory here to fetch the + # archives. + benchmark-tools-gcs-artifact-dir: ${{ steps.upload.outputs.benchmark-tools-gcs-artifact-dir }} + strategy: + matrix: + target: + - platform: "linux" + arch: "x86_64" + docker_image: "gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" + # Builds tools on the host and assumes the builder is Linux x86_64. + build_script: "./build_tools/cmake/build_runtime.sh" + - platform: "linux" + arch: "riscv_64" + docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + build_script: "./build_tools/cmake/build_riscv.sh" + env: + PLATFORM: ${{ matrix.target.platform }} + ARCH: ${{ matrix.target.arch }} + DOCKER_IMAGE: ${{ matrix.target.docker_image }} + BUILD_SCRIPT: ${{ matrix.target.build_script }} + BUILD_TOOLS_DIR: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmark-tools-dir + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 + - name: "Checking out runtime submodules" + run: ./build_tools/scripts/git/update_runtime_submodules.sh + - name: "Downloading build dir archive" + run: gcloud storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" + - name: "Extracting host binaries" + run: tar -xf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install" + - name: "Compiling the benchmark tools" + id: build + run: | + ./build_tools/github_actions/docker_run.sh \ + --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ + --env "IREE_TARGET_ARCH=${ARCH}" \ + --env "BUILD_PRESET=benchmark" \ + --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ + "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build" + - name: "Compiling the benchmark tools with tracing" + id: build-with-tracing + run: | + ./build_tools/github_actions/docker_run.sh \ + --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ + --env "IREE_TARGET_ARCH=${ARCH}" \ + --env "BUILD_PRESET=benchmark-with-tracing" \ + --env "IREE_HOST_BIN_DIR=${BUILD_DIR}/install/bin" \ + "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build-traced" + - name: "Creating the benchmark tools archive" + id: archive + env: + BENCHMARK_TOOLS_ARCHIVE: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmark-tools.tar + run: | + tar -cf "${BENCHMARK_TOOLS_ARCHIVE}" \ + "${BUILD_TOOLS_DIR}"/*/tools/iree-benchmark-module \ + "${BUILD_TOOLS_DIR}"/*/tools/build_config.txt + echo "benchmark-tools-archive=${BENCHMARK_TOOLS_ARCHIVE}" >> "${GITHUB_OUTPUT}" + - name: "Uploading the benchmark tools archive" + id: upload + env: + BENCHMARK_TOOLS_ARCHIVE: ${{ steps.archive.outputs.benchmark-tools-archive }} + BENCHMARK_TOOLS_GCS_ARTIFACT_DIR: ${{ env.GCS_DIR }}/benchmark-tools + run: | + gcloud storage cp "${BENCHMARK_TOOLS_ARCHIVE}" "${BENCHMARK_TOOLS_GCS_ARTIFACT_DIR}/" + echo "benchmark-tools-gcs-artifact-dir=${BENCHMARK_TOOLS_GCS_ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}" + + build_e2e_test_artifacts: + needs: [setup, build_all, build_tf_integrations] + if: needs.setup.outputs.should-run == 'true' + 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: + 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 }} + TF_BINARIES_DIR: ${{ needs.build_tf_integrations.outputs.binaries-dir }} + TF_BINARIES_ARCHIVE: ${{ needs.build_tf_integrations.outputs.binaries-archive }} + TF_BINARIES_GCS_ARTIFACT: ${{ needs.build_tf_integrations.outputs.binaries-gcs-artifact }} + outputs: + e2e-test-artifacts-dir: ${{ steps.build.outputs.e2e-test-artifacts-dir }} + e2e-test-artifacts-gcs-artifact-dir: ${{ steps.upload.outputs.e2e-test-artifacts-gcs-artifact-dir }} + e2e-test-artifacts-build-log: ${{ steps.build.outputs.e2e-test-artifacts-build-log }} + e2e-test-artifacts-build-log-gcs-artifact: ${{ steps.upload.outputs.e2e-test-artifacts-build-log-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 install from build dir archive" + run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" + - name: "Downloading TF binaries archive" + run: gcloud storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" + - name: "Extracting TF binaries archive" + run: tar -xf "${TF_BINARIES_ARCHIVE}" + - name: "Building e2e test artifacts" + id: build + env: + BUILD_E2E_TEST_ARTIFACTS_DIR: build-e2e-test-artifacts + run: | + build_tools/github_actions/docker_run.sh \ + --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \ + --env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ + gcr.io/iree-oss/base@sha256:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e \ + build_tools/cmake/build_e2e_test_artifacts.sh \ + "${BUILD_E2E_TEST_ARTIFACTS_DIR}" + echo "e2e-test-artifacts-dir=${BUILD_E2E_TEST_ARTIFACTS_DIR}/e2e_test_artifacts" >> "${GITHUB_OUTPUT}" + echo "e2e-test-artifacts-build-log=${BUILD_E2E_TEST_ARTIFACTS_DIR}/.ninja_log" >> "${GITHUB_OUTPUT}" + - name: "Uploading e2e test artifacts" + id: upload + env: + E2E_TEST_ARTIFACTS_DIR: ${{ steps.build.outputs.e2e-test-artifacts-dir }} + E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR: ${{ env.GCS_DIR }}/e2e-test-artifacts + E2E_TEST_ARTIFACTS_BUILD_LOG: ${{ steps.build.outputs.e2e-test-artifacts-build-log }} + E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT: ${{ env.GCS_DIR }}/e2e-test-artifacts/ninja_log + run: | + # Uploads all IREE artifacts and MLIR files (including the imported + # MLIR files and MLIR source models). + # Not archiving the directory to allow fetching each file as needed + # separately. + find "${E2E_TEST_ARTIFACTS_DIR}" -maxdepth 1 \ + -name "iree_*" -o -name "model_*.mlir" | \ + gcloud storage cp --read-paths-from-stdin -r \ + "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" + gcloud storage cp "${E2E_TEST_ARTIFACTS_BUILD_LOG}" \ + "${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" + echo "e2e-test-artifacts-gcs-artifact-dir=${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}" + echo "e2e-test-artifacts-build-log-gcs-artifact=${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" + + compilation_benchmarks: + needs: [setup, build_e2e_test_artifacts] + if: needs.setup.outputs.should-run == 'true' + 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: + 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 }} + outputs: + compile-stats-results: ${{ steps.collect.outputs.compile-stats-results }} + compile-stats-results-gcs-artifact: ${{ steps.upload.outputs.compile-stats-results-gcs-artifact }} + steps: + - name: "Checking out repository" + uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 + - name: "Exporting configs" + id: "export" + env: + COMPILATION_CONFIG: "compilation-config.json" + run: | + ./build_tools/benchmarks/export_benchmark_config.py \ + compilation \ + --output="${COMPILATION_CONFIG}" + echo "compilation-config=${COMPILATION_CONFIG}" >> "${GITHUB_OUTPUT}" + - name: "Downloading assets" + id: "download-assets" + env: + COMPILATION_CONFIG: ${{ steps.export.outputs.compilation-config }} + run: | + gcloud storage cp \ + "${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" \ + "${E2E_TEST_ARTIFACTS_BUILD_LOG}" + mkdir -p "${E2E_TEST_ARTIFACTS_DIR}" + jq -r \ + --arg GCS_ARTIFACT_DIR "${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" \ + '.module_dir_paths | map("\($GCS_ARTIFACT_DIR)/\(.)") | join("\n")' \ + "${COMPILATION_CONFIG}" | \ + gcloud storage cp -r --read-paths-from-stdin \ + "${E2E_TEST_ARTIFACTS_DIR}" + - name: "Collecting compilation statistics" + id: collect + env: + COMPILATION_CONFIG: ${{ steps.export.outputs.compilation-config }} + GENERATION_CONFIG: generation-config.json + COMPILE_STATS_RESULTS: benchmark-results/compile-stats-results.json + run: | + jq '.generation_configs' "${COMPILATION_CONFIG}" > "${GENERATION_CONFIG}" + mkdir -p benchmark-results + ./build_tools/benchmarks/collect_compilation_statistics.py alpha \ + --e2e_test_artifacts_dir="${E2E_TEST_ARTIFACTS_DIR}" \ + --build_log="${E2E_TEST_ARTIFACTS_BUILD_LOG}" \ + --generation_config="${GENERATION_CONFIG}" \ + --output="${COMPILE_STATS_RESULTS}" + echo "compile-stats-results=${COMPILE_STATS_RESULTS}" >> "${GITHUB_OUTPUT}" + - name: "Uploading benchmark results" + id: upload + env: + COMPILE_STATS_RESULTS: ${{ steps.collect.outputs.compile-stats-results }} + COMPILE_STATS_RESULTS_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.collect.outputs.compile-stats-results }} + run: | + gcloud storage cp \ + "${COMPILE_STATS_RESULTS}" \ + "${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" + echo "compile-stats-results-gcs-artifact=${COMPILE_STATS_RESULTS_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" + + execution_benchmarks: + needs: [setup, build_benchmark_tools, build_e2e_test_artifacts] + if: needs.setup.outputs.should-run == 'true' && 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 }} + benchmark-presets: ${{ needs.setup.outputs.benchmark-presets }} + + process_benchmark_results: + needs: [setup, compilation_benchmarks, execution_benchmarks] + # execution_benchmarks is the optional dependency and skipped in presubmit + # if no benchmark is specified to run. + if: | + always() && + needs.setup.outputs.should-run == 'true' && + needs.compilation_benchmarks.result == 'success' && + contains(fromJSON('["success", "skipped"]'), needs.execution_benchmarks.result) + 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 }} + EXECUTION_BENCHMARK_RESULTS_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-dir }} + EXECUTION_BENCHMARK_RESULTS_GCS_ARTIFACT_DIR: ${{ needs.execution_benchmarks.outputs.benchmark-results-gcs-artifact-dir }} + steps: + - name: "Checking out repository" + uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 + 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 + if: needs.execution_benchmarks.result == 'success' + 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: needs.setup.outputs.ci-stage == 'presubmit' + 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/iree-org/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: needs.setup.outputs.ci-stage == 'presubmit' + 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 + # TODO(#11076): Temporarily disabled until we migrate the database. + if: false && needs.setup.outputs.ci-stage == 'postsubmit' + 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/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 + ############################################################################## + + # emscripten is not in the test matrix because it is set as + # postsubmission-only. + cross_compile_and_test: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' + 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: android + arch: armv8.2-a + abi: arm64-v8a + docker_image: "gcr.io/iree-oss/android@sha256:b0b607d95af8da6a6ce430f22d9d7c621702df13ce2b5d264b79d0ac7e60d670" + build_script: "./build_tools/cmake/build_android.sh" + # No test_script + - platform: linux + arch: riscv_64 + abi: lp64d + docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + build_script: "./build_tools/cmake/build_riscv.sh" + test_script: "./tests/riscv32/smoke.sh" + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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}" + + emscripten: + needs: [setup, build_all] + if: needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' + 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: + 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 }} + steps: + - name: "Checking out repository" + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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 install from build dir archive" + run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install" + - name: "Building the runtime for the web using Emscripten" + run: | + build_tools/github_actions/docker_run.sh \ + --env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \ + gcr.io/iree-oss/emscripten@sha256:fdb2bf6b0701a6de80f4f708ea86b001279c8acd904c34ef4d05ee3802711e45 \ + build_tools/cmake/build_runtime_emscripten.sh + + test_benchmark_suites: + needs: [setup, build_all, build_e2e_test_artifacts] + if: needs.setup.outputs.should-run == 'true' + 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 + docker_image: "gcr.io/iree-oss/riscv@sha256:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + 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:a7e7b03236324f92e7c96925add02cf0b37eca5b68af54f64049fc689f770915" + 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:f26a5aa5f8d3705c6b80c71d04fafb360861f1907bdd1b1f5f19480b6192664e" + run_scripts: "./build_tools/cmake/test_benchmark_suites_on_linux.sh" + 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@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.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: "Download benchmark expected output" + env: + EXPECTED_OUTPUT_GSC_ARTIFACT: gs://iree-model-artifacts/deeplab_v3_fp32_input_0_expected_output.npy + EXPECTED_OUTPUT_FILE: deeplab_v3_fp32_input_0_expected_output.npy + run: | + gcloud storage cp "${EXPECTED_OUTPUT_GSC_ARTIFACT}" "${E2E_TEST_ARTIFACTS_DIR}/${EXPECTED_OUTPUT_FILE}" + - 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 @@ -174,7 +1278,48 @@ jobs: needs: - setup + # Basic + - build_all - build_test_all_windows + - build_test_all_bazel + - test_all + - test_gpu + + # Subsets + - build_test_runtime + - build_test_runtime_windows + + # Tensorflow + - build_tf_integrations + - test_tf_integrations + - test_tf_integrations_gpu + + # Model Coverage + - test_build_benchmark_suites + - test_shark_model_suite + + # Configurations + - asan + - tsan + - small_runtime + - gcc + - tracing + + # Crosscompilation + - cross_compile_and_test + - emscripten + + # 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: Getting failed jobs id: failed_jobs From e5012e39f43c7e7968dd7507301292aee4180c36 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 16:01:27 -0800 Subject: [PATCH 19/23] Tweak Docker comment. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b139552f4b2..e8681fe87521 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -185,7 +185,7 @@ jobs: key: ccache_all_windows_${{ github.sha }} restore-keys: ccache_all_windows # Fetch dependencies. - # TODO(scotttodd): Move these into a Docker image. + # TODO(scotttodd): Move some of these into a Docker image / add to PATH. - name: "Updating git submodules" run: git submodule update --init --jobs 8 --depth 1 - name: "Setting up Python" From 0c85793f19507c0fcf6c72ffc63c3b81490b9892 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 16:07:27 -0800 Subject: [PATCH 20/23] Always write to local cache. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8681fe87521..fa810f2fe803 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -207,7 +207,7 @@ jobs: IREE_READ_REMOTE_CCACHE: 0 IREE_WRITE_REMOTE_CCACHE: 0 IREE_READ_LOCAL_CCACHE: 1 - IREE_WRITE_LOCAL_CCACHE: ${{ needs.setup.outputs.write-caches }} + IREE_WRITE_LOCAL_CCACHE: 1 CCACHE_DIR: ${{ github.workspace }}/.ccache # A full build is around 2.5GB, but uploads/downloads are slow and # we have a limit of 10GB per repository From 597c956235ec27a203c08de4b2b05352cb81e6f7 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 16:24:21 -0800 Subject: [PATCH 21/23] Expand on cache comment. --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa810f2fe803..7f5309c2e675 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,7 +171,11 @@ jobs: steps: - name: "Checking out repository" uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 - # Restore caches unconditionally. Cache misses are okay. + # Attempt to restore from caches unconditionally. + # Note: these will first try to grab a cache entry for this exact commit + # then they will fall back to the latest for any commit. + # We're pretty limited on repository cache space (10GB) relative to cache + # entry size (~2.5GB), so this usage is pretty optimistic. - name: "Fetching cache (git submodules)" uses: actions/cache/restore@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 with: From 201f014bcec11aec4e8c69909c137c28e3c428b9 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Fri, 20 Jan 2023 16:24:32 -0800 Subject: [PATCH 22/23] Add DO NOT SUBMIT for running on postsubmit only. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f5309c2e675..e1c17f205111 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,6 +160,7 @@ jobs: build_test_all_windows: needs: setup + # DO NOT SUBMIT - keep running on postsubmit only if: needs.setup.outputs.should-run == 'true' runs-on: managed-windows-cpu defaults: From 150ee28ed54705ffb24182f33cd3bbb91355efa8 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Mon, 23 Jan 2023 10:06:03 -0800 Subject: [PATCH 23/23] Cleanup before merge - disable presubmit, check before writing. --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1c17f205111..442257aee758 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,8 +160,7 @@ jobs: build_test_all_windows: needs: setup - # DO NOT SUBMIT - keep running on postsubmit only - if: needs.setup.outputs.should-run == 'true' + if: needs.setup.outputs.should-run == 'true' && needs.setup.outputs.ci-stage == 'postsubmit' runs-on: managed-windows-cpu defaults: run: @@ -212,7 +211,7 @@ jobs: IREE_READ_REMOTE_CCACHE: 0 IREE_WRITE_REMOTE_CCACHE: 0 IREE_READ_LOCAL_CCACHE: 1 - IREE_WRITE_LOCAL_CCACHE: 1 + IREE_WRITE_LOCAL_CCACHE: ${{ needs.setup.outputs.write-caches }} CCACHE_DIR: ${{ github.workspace }}/.ccache # A full build is around 2.5GB, but uploads/downloads are slow and # we have a limit of 10GB per repository