|
| 1 | +name: GPU |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [labeled] |
| 6 | + workflow_run: |
| 7 | + workflows: [CI] |
| 8 | + types: [completed] |
| 9 | + branches: [canon] |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + issues: write |
| 14 | + |
| 15 | +env: |
| 16 | + LLVM_VERSION: "20" |
| 17 | + |
| 18 | +jobs: |
| 19 | + gpu-test: |
| 20 | + if: >- |
| 21 | + (github.event_name == 'pull_request' && github.event.label.name == 'gpu-test' && |
| 22 | + github.actor == github.repository_owner && github.triggering_actor == github.repository_owner && |
| 23 | + github.event.pull_request.head.repo.full_name == github.repository) || |
| 24 | + (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'push' && |
| 25 | + github.event.workflow_run.conclusion == 'success') |
| 26 | + concurrency: |
| 27 | + group: gpu-ci |
| 28 | + cancel-in-progress: false |
| 29 | + runs-on: ubuntu-24.04 |
| 30 | + timeout-minutes: 45 |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }} |
| 36 | + |
| 37 | + - name: Install LLVM ${{ env.LLVM_VERSION }} and MLIR |
| 38 | + run: | |
| 39 | + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc |
| 40 | + sudo add-apt-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${LLVM_VERSION} main" |
| 41 | + sudo apt-get update |
| 42 | + sudo apt-get install -y \ |
| 43 | + clang-${LLVM_VERSION} \ |
| 44 | + llvm-${LLVM_VERSION}-dev \ |
| 45 | + libmlir-${LLVM_VERSION}-dev \ |
| 46 | + mlir-${LLVM_VERSION}-tools |
| 47 | +
|
| 48 | + - uses: astral-sh/setup-uv@v4 |
| 49 | + |
| 50 | + - name: Install Python dependencies |
| 51 | + run: uv sync |
| 52 | + |
| 53 | + - name: Configure |
| 54 | + run: | |
| 55 | + cmake -B build \ |
| 56 | + -DCMAKE_BUILD_TYPE=Release \ |
| 57 | + -DCMAKE_C_COMPILER=clang-${LLVM_VERSION} \ |
| 58 | + -DCMAKE_CXX_COMPILER=clang++-${LLVM_VERSION} \ |
| 59 | + -DMLIR_DIR=/usr/lib/llvm-${LLVM_VERSION}/lib/cmake/mlir \ |
| 60 | + -DLLVM_DIR=/usr/lib/llvm-${LLVM_VERSION}/lib/cmake/llvm |
| 61 | +
|
| 62 | + - name: Build |
| 63 | + run: cmake --build build |
| 64 | + |
| 65 | + - name: Run GPU tests on Vast.ai |
| 66 | + env: |
| 67 | + VASTAI_API_KEY: ${{ secrets.VASTAI_API_KEY }} |
| 68 | + run: | |
| 69 | + if [ -z "$VASTAI_API_KEY" ]; then |
| 70 | + echo "VASTAI_API_KEY repository secret is not configured" >&2 |
| 71 | + exit 1 |
| 72 | + fi |
| 73 | + uv run pytest -v -m gpu |
| 74 | +
|
| 75 | + - name: Remove GPU test trigger label |
| 76 | + if: always() && github.event_name == 'pull_request' |
| 77 | + env: |
| 78 | + GH_TOKEN: ${{ github.token }} |
| 79 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 80 | + run: | |
| 81 | + gh api --method DELETE \ |
| 82 | + "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels/gpu-test" |
0 commit comments