| # Copyright 2022 The IREE Authors |
| # |
| # Licensed under the Apache License v2.0 with LLVM Exceptions. |
| # See https://llvm.org/LICENSE.txt for license information. |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| |
| name: CI |
| |
| # A few notes: |
| # |
| # Variables: |
| # GitHub actions don't have variables or even support normal yaml anchors (they |
| # are specially disabled because...reasons?): |
| # See https://github.com/github-community/community/discussions/4501 |
| # https://github.community/t/support-for-yaml-anchors/16128/92 |
| # https://github.com/actions/runner/issues/1182 |
| # Neither does it have any contexts that are available everywhere. The |
| # top-level `env` field is available in many places, but not all. We already |
| # have a "should-run" job that every other job depends on, so we leverage that |
| # for variables that every other job can use, since that *is* available in all |
| # sub-fields of the job. |
| # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability |
| # and https://github.com/community/community/discussions/27370 |
| # |
| # Runner label ordering: |
| # - self-hosted always has to be listed first in a runs-on block: |
| # https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow |
| # |
| # Pseudo-ternary hack: |
| # - We have to do a weird hack to get a pseudo-ternary operator. See |
| # https://github.com/actions/runner/issues/409, hence patterns like: |
| # `github.event_name == 'pull_request' && 'presubmit' || 'postsubmit'` |
| # to mean `'presubmit' if github.event_name == 'pull_request' else 'postsubmit'` |
| # Note that this only works if the true branch value is truthy. If it is falsey |
| # then we would always get the false branch condition (`p && false` is always |
| # false). |
| |
| on: |
| workflow_dispatch: |
| pull_request: |
| push: |
| branches: |
| - main |
| |
| concurrency: |
| # A PR number if a pull request and otherwise the commit hash. This cancels |
| # queued and in-progress runs for the same PR (presubmit) or commit |
| # (postsubmit). |
| group: ${{ github.event.number || github.sha }} |
| cancel-in-progress: true |
| |
| env: |
| # This is mostly here so we can compute it once and use it in outputs below. |
| # See note above regarding lack of proper variables. Also see note about |
| # pseudo-ternary hack. |
| _CI_STAGE: ${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }} |
| |
| # Jobs are organized into groups and topologically sorted by dependencies |
| jobs: |
| setup: |
| runs-on: ubuntu-20.04 |
| env: |
| # The commit being checked out is the merge commit for the PR. Its first |
| # parent will be the tip of main. |
| BASE_REF: HEAD^ |
| PR_DESCRIPTION: ${{ github.event.pull_request.body }} |
| outputs: |
| should-run: ${{ steps.should-run.outputs.should-run }} |
| # Variables for dependent jobs. See comment at top. |
| runner-env: prod |
| gcs-dir: gs://iree-github-actions-${{ env._CI_STAGE }}-artifacts/${{ github.run_id }}/${{ github.run_attempt }} |
| runner-group: ${{ env._CI_STAGE }} |
| # Note that we can't flip the condition here because 0 is falsey. See |
| # comment at top. |
| write-caches: ${{ github.event_name != 'pull_request' && 1 || 0 }} |
| steps: |
| - name: "Checking out repository" |
| uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| # We need the parent commit to do a diff |
| fetch-depth: 2 |
| - name: "Computing whether CI should run" |
| id: should-run |
| run: | |
| # Just informative logging. There should only be two commits in the |
| # history here, but limiting the depth helps when copying from a local |
| # repo instead of using checkout, e.g. with |
| # https://github.com/nektos/act where there will be more. |
| git log --oneline --graph --max-count=3 |
| |
| ret=0 |
| ./build_tools/github_actions/should_ci_run.py || ret=$? |
| if (( ret==0 )); then |
| echo "::set-output name=should-run::true" |
| exit 0 |
| elif (( ret==2 )); then |
| echo "::set-output name=should-run::false" |
| exit 0 |
| fi |
| exit "${ret}" |
| |
| |
| ################################### 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Building IREE" |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| gcr.io/iree-oss/base@sha256:5d43683c6b50aebe1fca6c85f2012f3b0fa153bf4dd268e8767b619b1891423a \ |
| ./build_tools/cmake/build_all.sh \ |
| "${BUILD_DIR}" |
| # 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 --exclude '*.a' --exclude '*.o' \ |
| -I 'zstd -T0' \ |
| -cf ${BUILD_DIR_ARCHIVE} ${BUILD_DIR} |
| echo "::set-output name=build-dir-archive::${BUILD_DIR_ARCHIVE}" |
| - name: "Uploading build dir archive" |
| id: upload |
| env: |
| BUILD_DIR_ARCHIVE: ${{ steps.archive.outputs.build-dir-archive }} |
| BUILD_DIR_GCS_ARTIFACT: ${{ needs.setup.outputs.gcs-dir }}/${{ steps.archive.outputs.build-dir-archive }} |
| run: | |
| gcloud alpha storage cp "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR_GCS_ARTIFACT}" |
| echo "::set-output name=build-dir-gcs-artifact::${BUILD_DIR_GCS_ARTIFACT}" |
| |
| 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Building with Bazel" |
| env: |
| IREE_BAZEL_WRITE_REMOTE_CACHE: ${{ needs.setup.outputs.write-caches }} |
| # This doesn't really need everything in the frontends image, but we |
| # want the cache to be shared with the integrations build (no point |
| # building LLVM twice) and the cache key is the docker container it's |
| # run in (to ensure correct cache hits). |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| --env "IREE_BAZEL_WRITE_REMOTE_CACHE=${IREE_BAZEL_WRITE_REMOTE_CACHE}" \ |
| gcr.io/iree-oss/frontends-swiftshader@sha256:41e516b8c1b432e3c02896c4bf4b7f06df6a67371aa167b88767b8d4d2018ea6 \ |
| ./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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Downloading build dir archive" |
| run: gcloud alpha 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:5027d56cdfee743d956bffd035668f7784166a486c48c74b42e5882cb0c289bf \ |
| ./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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| 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 alpha 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:7c2f56db65e656c15e6c96b5812a8275dd53c82bf41221192f9ba8a451aad870 \ |
| 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_runtime: |
| needs: setup |
| if: needs.setup.outputs.should-run == 'true' |
| runs-on: ubuntu-20.04 |
| env: |
| BUILD_DIR: build-runtime |
| outputs: |
| # Pass through the build directory as output so it's available to |
| # dependent jobs. |
| build-dir: ${{ env.BUILD_DIR }} |
| steps: |
| - name: "Checking out repository" |
| uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Building runtime" |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| gcr.io/iree-oss/base@sha256:5d43683c6b50aebe1fca6c85f2012f3b0fa153bf4dd268e8767b619b1891423a \ |
| ./build_tools/cmake/build_runtime.sh \ |
| "${BUILD_DIR}" |
| # Using a tar archive is necessary to preserve file permissions. See |
| # https://github.com/actions/upload-artifact#maintaining-file-permissions-and-case-sensitive-files |
| # The upload action already does its own gzip compression, so no need to |
| # do our own. |
| - name: "Create build dir archive" |
| run: tar -cf ${BUILD_DIR}.tar ${BUILD_DIR} |
| - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 |
| with: |
| name: "${{ env.BUILD_DIR }}.tar" |
| path: "${{ env.BUILD_DIR }}.tar" |
| |
| test_runtime: |
| needs: [setup, build_runtime] |
| if: needs.setup.outputs.should-run == 'true' |
| runs-on: ubuntu-20.04 |
| env: |
| BUILD_DIR: ${{ needs.build_runtime.outputs.build-dir }} |
| steps: |
| - name: "Checking out repository" |
| uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Downloading runtime build dir archive" |
| uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0 |
| with: |
| name: "${{ env.BUILD_DIR }}.tar" |
| - name: "Extracting runtime build dir archive" |
| run: tar -xf ${BUILD_DIR}.tar |
| - name: "Testing runtime" |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| --env IREE_VULKAN_DISABLE=1 \ |
| gcr.io/iree-oss/base@sha256:5d43683c6b50aebe1fca6c85f2012f3b0fa153bf4dd268e8767b619b1891423a \ |
| ./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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Building TF binaries" |
| id: build |
| env: |
| IREE_TF_BINARIES_OUTPUT_DIR: iree-tf-binaries |
| IREE_BAZEL_WRITE_REMOTE_CACHE: ${{ needs.setup.outputs.write-caches }} |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| --env "IREE_BAZEL_WRITE_REMOTE_CACHE=${IREE_BAZEL_WRITE_REMOTE_CACHE}" \ |
| --env "IREE_TF_BINARIES_OUTPUT_DIR=${IREE_TF_BINARIES_OUTPUT_DIR}" \ |
| gcr.io/iree-oss/frontends-swiftshader@sha256:3090418a8d8a64c356d35eff285af32570a72f41127aa123209c1562f57abb01 \ |
| build_tools/cmake/build_tf_binaries.sh |
| echo "::set-output name=binaries-dir::${IREE_TF_BINARIES_OUTPUT_DIR}" |
| - 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 "::set-output name=binaries-archive::${BINARIES_ARCHIVE}" |
| - name: "Uploading binaries archive" |
| id: upload |
| env: |
| BINARIES_ARCHIVE: ${{ steps.archive.outputs.binaries-archive }} |
| BINARIES_GCS_ARTIFACT: ${{ needs.setup.outputs.gcs-dir }}/${{ steps.archive.outputs.binaries-archive }} |
| run: | |
| gcloud alpha storage cp "${BINARIES_ARCHIVE}" "${BINARIES_GCS_ARTIFACT}" |
| echo "::set-output name=binaries-gcs-artifact::${BINARIES_GCS_ARTIFACT}" |
| |
| 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Downloading TF binaries archive" |
| run: gcloud alpha 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 alpha 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:3090418a8d8a64c356d35eff285af32570a72f41127aa123209c1562f57abb01 \ |
| 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Downloading TF binaries archive" |
| run: gcloud alpha 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 alpha 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:e934ed09e9e60c28ebe11a02f37a993dd975db40118d410c4279d0fa2d4e6b9a \ |
| bash -euo pipefail -c \ |
| "./build_tools/scripts/check_cuda.sh |
| ./build_tools/scripts/check_vulkan.sh |
| build_tools/cmake/run_tf_tests.sh ${BUILD_DIR}" |
| |
| ############################### Configurations ############################### |
| # Jobs that build IREE in some non-default configuration |
| ############################################################################## |
| 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Building and testing with AddressSanitizer" |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| gcr.io/iree-oss/swiftshader@sha256:5027d56cdfee743d956bffd035668f7784166a486c48c74b42e5882cb0c289bf \ |
| ./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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Building and testing with ThreadSanitizer" |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| gcr.io/iree-oss/base@sha256:5d43683c6b50aebe1fca6c85f2012f3b0fa153bf4dd268e8767b619b1891423a \ |
| ./build_tools/cmake/build_and_test_tsan.sh |
| |
| build_benchmarks: |
| needs: [setup, build_all, build_tf_integrations] |
| if: needs.setup.outputs.should-run == 'true' |
| runs-on: |
| # Hacks, and order matters. See the comment at the top of the file. |
| - self-hosted |
| - 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Downloading build dir archive" |
| run: gcloud alpha 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 alpha storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" |
| - name: "Extracting TF binaries archive" |
| run: tar -xf "${TF_BINARIES_ARCHIVE}" |
| - name: "Building benchmarks" |
| run: | |
| build_tools/github_actions/docker_run.sh \ |
| --env "IREE_TF_BINARIES_DIR=${TF_BINARIES_DIR}" \ |
| --env "IREE_HOST_BINARY_ROOT=${BUILD_DIR}/install" \ |
| gcr.io/iree-oss/base@sha256:5d43683c6b50aebe1fca6c85f2012f3b0fa153bf4dd268e8767b619b1891423a \ |
| build_tools/cmake/build_benchmarks.sh |
| |
| ############################## Crosscompilation ############################## |
| # Jobs that cross-compile IREE for other platforms |
| ############################################################################## |
| android_arm64: |
| needs: [setup, build_all] |
| if: needs.setup.outputs.should-run == 'true' |
| runs-on: |
| # Hacks, and order matters. See the comment at the top of the file. |
| - self-hosted |
| - runner-group=${{ needs.setup.outputs.runner-group }} |
| - environment=${{ needs.setup.outputs.runner-env }} |
| - cpu |
| - os-family=Linux |
| env: |
| ANDROID_ABI: "arm64-v8a" |
| 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Downloading build dir archive" |
| run: gcloud alpha 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: "Building for Android" |
| run: | |
| build_tools/github_actions/docker_run.sh \ |
| --env "ANDROID_ABI=${ANDROID_ABI}" \ |
| --env "IREE_HOST_BINARY_ROOT=${BUILD_DIR}/install" \ |
| gcr.io/iree-oss/android@sha256:9bc723fc707a18bd0c1be9c12e01ea5bb7c7d77f607427879e10ffcffd7d2bb5 \ |
| build_tools/cmake/build_android.sh |
| |
| riscv32: |
| 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_RISCV_DIR: "build-riscv32-baremetal" |
| BUILD_ARCH: "rv32-baremetal" |
| 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Downloading build dir archive" |
| run: gcloud alpha 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: "Cross-compiling and testing riscv32" |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| --env "RISCV_ARCH=${BUILD_ARCH}" \ |
| --env "BUILD_RISCV_DIR=${BUILD_RISCV_DIR}" \ |
| --env "BUILD_PRESET=test" \ |
| --env "IREE_HOST_BINARY_ROOT=${BUILD_DIR}/install" \ |
| gcr.io/iree-oss/riscv@sha256:720bc0215d8462ea14352edc22710a6ce4c0c1daff581d179dd173885f1d8a35 \ |
| bash -euo pipefail -c \ |
| "./build_tools/cmake/build_riscv.sh && tests/riscv32/smoke.sh" |
| |
| riscv64: |
| 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_RISCV_DIR: "build-riscv64" |
| BUILD_ARCH: "rv64" |
| 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Downloading build dir archive" |
| run: gcloud alpha storage cp "${BUILD_DIR_GCS_ARTIFACT}" "${BUILD_DIR_ARCHIVE}" |
| - name: "Extracting build dir archive" |
| run: tar -xf "${BUILD_DIR_ARCHIVE}" |
| - name: "Downloading TF binaries archive" |
| run: gcloud alpha storage cp "${TF_BINARIES_GCS_ARTIFACT}" "${TF_BINARIES_ARCHIVE}" |
| - name: "Extracting TF binaries archive" |
| run: tar -xf "${TF_BINARIES_ARCHIVE}" |
| - name: "Cross-compiling and testing riscv64" |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| --env "RISCV_ARCH=${BUILD_ARCH}" \ |
| --env "BUILD_RISCV_DIR=${BUILD_RISCV_DIR}" \ |
| --env "BUILD_PRESET=test" \ |
| --env "IREE_HOST_BINARY_ROOT=${BUILD_DIR}/install" \ |
| --env "IREE_IMPORT_TFLITE_BIN=${TF_BINARIES_DIR}/iree-import-tflite" \ |
| --env "LLVM_BIN_DIR=${BUILD_DIR}/third_party/llvm-project/llvm/bin" \ |
| gcr.io/iree-oss/riscv@sha256:720bc0215d8462ea14352edc22710a6ce4c0c1daff581d179dd173885f1d8a35 \ |
| bash -euo pipefail -c \ |
| "./build_tools/cmake/build_riscv.sh && ./build_tools/cmake/test_riscv64.sh" |
| |
| 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 |
| strategy: |
| matrix: |
| target: |
| - platform: "riscv" |
| architecture: "rv64" |
| docker_image: "gcr.io/iree-oss/riscv@sha256:720bc0215d8462ea14352edc22710a6ce4c0c1daff581d179dd173885f1d8a35" |
| outputs: |
| benchmark-tools-gcs-artifacts: ${{ toJSON(steps.upload.outputs) }} |
| env: |
| PLATFORM: ${{ matrix.target.platform }} |
| ARCHITECTURE: ${{ matrix.target.architecture }} |
| DOCKER_IMAGE: ${{ matrix.target.docker_image }} |
| BUILD_TOOLS_DIR: ${{ matrix.target.platform }}-${{ matrix.target.architecture }}-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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Downloading build dir archive" |
| run: gcloud alpha 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 "${PLATFORM^^}_ARCH=${ARCHITECTURE}" \ |
| --env "BUILD_${PLATFORM^^}_DIR=${BUILD_TOOLS_DIR}/build" \ |
| --env "BUILD_PRESET=benchmark" \ |
| --env "IREE_HOST_BINARY_ROOT=${BUILD_DIR}/install" \ |
| "${DOCKER_IMAGE}" \ |
| bash -euo pipefail -c "./build_tools/cmake/build_${PLATFORM}.sh" |
| - name: "Compiling the benchmark tools with tracing" |
| id: build-with-tracing |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| --env "${PLATFORM^^}_ARCH=${ARCHITECTURE}" \ |
| --env "BUILD_${PLATFORM^^}_DIR=${BUILD_TOOLS_DIR}/build-traced" \ |
| --env "BUILD_PRESET=benchmark-with-tracing" \ |
| --env "IREE_HOST_BINARY_ROOT=${BUILD_DIR}/install" \ |
| "${DOCKER_IMAGE}" \ |
| bash -euo pipefail -c "./build_tools/cmake/build_${PLATFORM}.sh" |
| - name: "Creating the benchmark tools archive" |
| id: archive |
| env: |
| BENCHMARK_TOOLS_ARCHIVE: ${{ matrix.target.platform }}-${{ matrix.target.architecture }}-benchmarks-tools.tar |
| run: | |
| tar -cf ${BENCHMARK_TOOLS_ARCHIVE} \ |
| ${BUILD_TOOLS_DIR}/*/tools/iree-benchmark-module |
| echo "::set-output name=benchmark-tools-archive::${BENCHMARK_TOOLS_ARCHIVE}" |
| - name: "Uploading the benchmark tools archive" |
| id: upload |
| env: |
| BENCHMARK_TOOLS_ARCHIVE: ${{ steps.archive.outputs.benchmark-tools-archive }} |
| BENCHMARK_TOOLS_GCS_ARTIFACT: ${{ needs.setup.outputs.gcs-dir }}/${{ steps.archive.outputs.benchmark-tools-archive }} |
| run: | |
| gcloud alpha storage cp "${BENCHMARK_TOOLS_ARCHIVE}" "${BENCHMARK_TOOLS_GCS_ARTIFACT}" |
| echo "::set-output name=${PLATFORM}-${ARCHITECTURE}-benchmark-tools-gcs-artifact::${BENCHMARK_TOOLS_GCS_ARTIFACT}" |
| |
| ############################################################################## |
| |
| # Depends on all the other jobs to provide a single anchor that indicates the |
| # final status. Status reporting will become more sophisticated in the future. |
| summary: |
| # Even if you have an explicit if condition, you still need to override |
| # GitHub's default behavior of not running if any dependencies failed. |
| if: always() |
| runs-on: ubuntu-20.04 |
| needs: |
| # Basic |
| - build_all |
| - build_test_all_bazel |
| - test_all |
| - test_gpu |
| |
| # Subsets |
| - build_runtime |
| - test_runtime |
| |
| # Tensorflow |
| - test_tf_integrations |
| - test_tf_integrations_gpu |
| |
| # Configurations |
| - asan |
| - tsan |
| - build_benchmarks |
| |
| # Crosscompilation |
| - android_arm64 |
| - riscv32 |
| - riscv64 |
| |
| # Benchmark tools |
| - build_benchmark_tools |
| steps: |
| - name: Getting combined job status |
| run: | |
| echo '${{ toJson(needs.*.result) }}' \ |
| | jq --exit-status 'all(.=="success" or .=="skipped")' > /dev/null |