| # Copyright 2023 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 | |
| # | |
| # Workflow for running IREE Dispatch Profiler | |
| # (https://github.com/openxla/iree/tree/main/experimental/dispatch_profiler). | |
| # | |
| # IREE Dispatch Profiler validates functional correctness and performs profiling | |
| # on matmul, conv, and other ops on IREE CUDA and other back-ends. | |
| # | |
| # It uploads results to this a publicly accessible GCS bucket: | |
| # https://storage.googleapis.com/dispatch-profiler-artifacts | |
| name: dispatch_profiler | |
| on: | |
| schedule: | |
| # Run daily at 2:00 PM (14:00) every weekday (Monday to Friday) | |
| - cron: "0 14 * * 1-5" | |
| workflow_dispatch: | |
| concurrency: | |
| # A PR number if a pull request and otherwise the commit hash. This cancels | |
| # queued and in-progress runs for the same PR (presubmit) or commit | |
| # (postsubmit). The workflow name is prepended to avoid conflicts between | |
| # different workflows. | |
| group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| setup: | |
| uses: ./.github/workflows/setup.yml | |
| build_all: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_all') | |
| uses: ./.github/workflows/build_all.yml | |
| with: | |
| runner-group: ${{ needs.setup.outputs.runner-group }} | |
| runner-env: ${{ needs.setup.outputs.runner-env }} | |
| write-caches: ${{ needs.setup.outputs.write-caches }} | |
| profile_cuda: | |
| needs: [setup, build_all] | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'profile_cuda') | |
| runs-on: | |
| - self-hosted # must come first | |
| - runner-group=${{ needs.setup.outputs.runner-group }} | |
| - environment=${{ needs.setup.outputs.runner-env }} | |
| - machine-type=a2-highgpu-1g | |
| env: | |
| RESULTS_DIR: dispatch-profiler-results-cuda | |
| GCS_UPLOAD_PARENT_DIR: "gs://dispatch-profiler-artifacts/cuda" | |
| GCS_UPLOAD_DIR_NAME: ${{ needs.setup.outputs.artifact-upload-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 }} | |
| IREE_SHA: ${{ github.sha }} | |
| steps: | |
| - name: "Checking out repository" | |
| uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | |
| - 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 -vxf "${BUILD_DIR_ARCHIVE}" "${BUILD_DIR}/install" | |
| - name: "Running IREE Dispatch Profiler on CUDA" | |
| run: | | |
| mkdir "${RESULTS_DIR}" | |
| ./build_tools/github_actions/docker_run.sh \ | |
| --gpus all \ | |
| gcr.io/iree-oss/nvidia-bleeding-edge@sha256:522491c028ec3b4070f23910c70c8162fd9612e11d9cf062a13444df7e88ab70 \ | |
| ./experimental/dispatch_profiler/profile_all.sh "${BUILD_DIR}/install/bin" \ | |
| "${RESULTS_DIR}" | |
| - name: "Uploading results" | |
| run: | | |
| GCS_ARTIFACT_DIR="$(date +'%Y-%m-%d').sha_${IREE_SHA}.timestamp_$(date +'%s')" | |
| gcloud storage cp "${RESULTS_DIR}/**" "${GCS_UPLOAD_PARENT_DIR}/${GCS_ARTIFACT_DIR}/" |