|
| 1 | +# Copyright 2024 Advanced Micro Devices, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +# See https://llvm.org/LICENSE.txt for license information. |
| 5 | +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | + |
| 7 | +name: CI - fast from source shark-platform |
| 8 | + |
| 9 | +on: |
| 10 | + workflow_dispatch: |
| 11 | + pull_request: |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - main |
| 15 | + |
| 16 | +concurrency: |
| 17 | + # A PR number if a pull request and otherwise the commit hash. This cancels |
| 18 | + # queued and in-progress runs for the same PR (presubmit) or commit |
| 19 | + # (postsubmit). The workflow name is prepended to avoid conflicts between |
| 20 | + # different workflows. |
| 21 | + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + test_shortfin_llm_server: |
| 26 | + name: "Integration Tests - Shortfin LLM Server" |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + version: [3.11] |
| 30 | + fail-fast: false |
| 31 | + runs-on: nodai-amdgpu-mi250-x86-64 |
| 32 | + defaults: |
| 33 | + run: |
| 34 | + shell: bash |
| 35 | + env: |
| 36 | + PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" |
| 37 | + steps: |
| 38 | + - name: "Setting up Python" |
| 39 | + id: setup_python |
| 40 | + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 |
| 41 | + with: |
| 42 | + python-version: ${{matrix.version}} |
| 43 | + |
| 44 | + - name: "Checkout Code" |
| 45 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 46 | + |
| 47 | + - name: Cache Pip Packages |
| 48 | + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 |
| 49 | + id: cache-pip |
| 50 | + with: |
| 51 | + path: ${{ env.PIP_CACHE_DIR }} |
| 52 | + key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('*requirements.txt') }} |
| 53 | + |
| 54 | + - name: Install pip deps |
| 55 | + run: | |
| 56 | + python -m pip install --no-compile --upgrade pip |
| 57 | + # Note: We install in three steps in order to satisfy requirements |
| 58 | + # from non default locations first. Installing the PyTorch CPU |
| 59 | + # wheels saves multiple minutes and a lot of bandwidth on runner setup. |
| 60 | + pip install --no-compile -r pytorch-cpu-requirements.txt |
| 61 | + pip install --no-compile -r requirements.txt -e sharktank/ |
| 62 | +
|
| 63 | + # Install latest iree-tubrine. |
| 64 | + pip install --no-compile -f https://iree.dev/pip-release-links.html --src deps \ |
| 65 | + -e "git+https://github.com/iree-org/iree-turbine.git#egg=iree-turbine" |
| 66 | +
|
| 67 | + # Try with the latest IREE nightly releases, not what iree-turbine pins. |
| 68 | + # We could also pin to a known working or stable version. |
| 69 | + # This should eventually stabilize. Do the best we can for now. |
| 70 | + pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \ |
| 71 | + iree-base-compiler \ |
| 72 | + iree-base-runtime |
| 73 | +
|
| 74 | + - name: Clone IREE with matching version |
| 75 | + run: | |
| 76 | + # Get IREE version |
| 77 | + IREE_VERSION=$(pip show iree-base-compiler | grep Version: | cut -d' ' -f2) |
| 78 | + echo "Required IREE version: ${IREE_VERSION}" |
| 79 | +
|
| 80 | + EXPECTED_TAG="iree-${IREE_VERSION}" |
| 81 | +
|
| 82 | + # Clone or update IREE repository |
| 83 | + IREE_PATH="../iree" |
| 84 | + if [ -d "$IREE_PATH" ] && [ "$(cd $IREE_PATH && git describe --tags --exact-match 2>/dev/null)" = "$EXPECTED_TAG" ]; then |
| 85 | + echo "IREE repository already at correct version" |
| 86 | + else |
| 87 | + rm -rf "$IREE_PATH" |
| 88 | + git clone --depth 1 --branch "$EXPECTED_TAG" --recurse-submodules --shallow-submodules https://github.com/iree-org/iree.git "$IREE_PATH" |
| 89 | + fi |
| 90 | +
|
| 91 | +
|
| 92 | +
|
| 93 | + - name: Install CMake |
| 94 | + uses: ssrobins/install-cmake@v1 # this action installs cmake into the action workspace |
| 95 | + |
| 96 | + - name: Install shortfin via dev_me.py |
| 97 | + run: cd shortfin && python dev_me.py |
| 98 | + |
| 99 | + - name: Run LLM Integration Tests |
| 100 | + run: pytest -v build_tools/integration_tests/llm --log-cli-level=INFO |
0 commit comments