From 54ee2198a585420a8ccc90f8cd05e8bacf2c8633 Mon Sep 17 00:00:00 2001 From: Ean Garvey <87458719+monorimet@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:45:42 -0500 Subject: [PATCH] Cleaner SDXL CI --- .github/workflows/ci-sdxl.yaml | 129 +++++++++++++++++++++------------ 1 file changed, 82 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci-sdxl.yaml b/.github/workflows/ci-sdxl.yaml index 9046850f9..1a5a84dc7 100644 --- a/.github/workflows/ci-sdxl.yaml +++ b/.github/workflows/ci-sdxl.yaml @@ -1,14 +1,26 @@ -name: SDXL Tests +# Copyright 2024 Advanced Micro Devices, Inc. +# +# 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 - shortfin - SDXL on: workflow_dispatch: pull_request: paths: - - '.github/workflows/ci-sdxl.yaml' + - '.github/workflows/ci_linux_x64-libshortfin.yml' + - 'shortfin/**' + push: + branches: + - main + paths: + - '.github/workflows/ci_linux_x64-libshortfin.yml' - 'shortfin/**' - schedule: - # Weekdays at 5:00 AM UTC = 10:00 PM PST. - - cron: "0 5 * * 1-5" + +permissions: + contents: read concurrency: # A PR number if a pull request and otherwise the commit hash. This cancels @@ -18,52 +30,75 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.sha }} cancel-in-progress: true +env: + IREE_REPO_DIR: ${{ github.workspace }}/iree + LIBSHORTFIN_DIR: ${{ github.workspace }}/shortfin/ + jobs: - test_sd: - name: "SDXL Tests" - strategy: - matrix: - version: [3.12] - fail-fast: false - runs-on: llama-mi300x-1 - defaults: - run: - shell: bash - env: - PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" - SHORTFIN_DIR: ${{ github.workspace }}/shortfin/ - VENV_DIR: ${{ github.workspace }}/.venv - + build-and-test: + name: Build and test + runs-on: ubuntu-24.04 + steps: - - name: Get Current Date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: Install dependencies + run: | + sudo apt update + sudo apt install clang lld cmake ninja-build + + - name: Checkout repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + submodules: false + + - name: Checkout IREE repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + repository: iree-org/iree + path: ${{ env.IREE_REPO_DIR }} + submodules: false + ref: candidate-20241025.1058 - - name: "Setting up Python" - id: setup_python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 - with: - python-version: ${{matrix.version}} - cache: "pip" + - name: Initalize IREE submodules + working-directory: ${{ env.IREE_REPO_DIR }} + run : | + git submodule update --init --depth 1 -- third_party/benchmark + git submodule update --init --depth 1 -- third_party/cpuinfo/ + git submodule update --init --depth 1 -- third_party/flatcc + git submodule update --init --depth 1 -- third_party/googletest + git submodule update --init --depth 1 -- third_party/hip-build-deps/ - - name: "Checkout Code" - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + with: + python-version: "3.12" + cache: "pip" + - name: Install Python packages + # TODO: Switch to `pip install -r requirements.txt -e shortfin/`. + working-directory: ${{ env.LIBSHORTFIN_DIR }} + run: | + pip install -r requirements-tests.txt + pip install -r requirements-iree-compiler.txt + pip freeze - - name: Install pip deps - working-directory: ${{ env.SHORTFIN_DIR }} - run: | - pip install -r requirements-tests.txt - pip install -r requirements-iree-compiler.txt - pip install -r . - pip freeze - - - name: Cache Pip Packages - uses: actions/cache@v4 - id: cache-pip - with: - path: ${{ env.PIP_CACHE_DIR }} - key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('*requirements.txt') }} + - name: Build shortfin (full) + working-directory: ${{ env.LIBSHORTFIN_DIR }} + run: | + mkdir build + cmake -GNinja \ + -S. \ + -Bbuild \ + -DCMAKE_C_COMPILER=clang-18 \ + -DCMAKE_CXX_COMPILER=clang++-18 \ + -DCMAKE_LINKER_TYPE=LLD \ + -DSHORTFIN_BUNDLE_DEPS=ON \ + -DSHORTFIN_IREE_SOURCE_DIR="${{ env.IREE_REPO_DIR }}" \ + -DSHORTFIN_BUILD_PYTHON_BINDINGS=ON + cmake --build build --target all + pip install -v -e build/ + - name: Test shortfin (full) + working-directory: ${{ env.LIBSHORTFIN_DIR }} + run: | + ctest --timeout 30 --output-on-failure --test-dir build + pytest shortfin/tests/apps/sd/e2e_test.py -v -s --device=amdgpu - - name: Run SDXL test - run: pytest shortfin/tests/apps/sd/e2e_test.py -v -s --device=amdgpu