|
| 1 | +name: CI (snapdragon) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + paths: |
| 9 | + - '.github/workflows/build-and-test-snapdragon.yml' |
| 10 | + - 'ggml/include/ggml-hexagon.h' |
| 11 | + - 'ggml/src/ggml-hexagon/**' |
| 12 | + - 'docs/backend/snapdragon/**' |
| 13 | + - 'scripts/snapdragon/**' |
| 14 | + - 'CMakePresets.json' |
| 15 | + |
| 16 | + pull_request: |
| 17 | + types: [opened, synchronize, reopened] |
| 18 | + paths: |
| 19 | + - '.github/workflows/build-and-test-snapdragon.yml' |
| 20 | + - 'ggml/include/ggml-hexagon.h' |
| 21 | + - 'ggml/src/ggml-hexagon/**' |
| 22 | + - 'docs/backend/snapdragon/**' |
| 23 | + - 'scripts/snapdragon/**' |
| 24 | + - 'CMakePresets.json' |
| 25 | + |
| 26 | +concurrency: |
| 27 | + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} |
| 28 | + cancel-in-progress: true |
| 29 | + |
| 30 | +jobs: |
| 31 | + android-ndk-snapdragon: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + container: |
| 34 | + image: 'ghcr.io/snapdragon-toolchain/arm64-android:v0.3' |
| 35 | + defaults: |
| 36 | + run: |
| 37 | + shell: bash |
| 38 | + |
| 39 | + steps: |
| 40 | + - name: Clone |
| 41 | + uses: actions/checkout@v6 |
| 42 | + with: |
| 43 | + fetch-depth: 0 |
| 44 | + lfs: false |
| 45 | + |
| 46 | + - name: Build Llama.CPP for Snapdragon Android |
| 47 | + id: build_llama_cpp_snapdragon_android |
| 48 | + run: | |
| 49 | + cp docs/backend/snapdragon/CMakeUserPresets.json . |
| 50 | + cmake --preset arm64-android-snapdragon-release -B build |
| 51 | + cmake --build build |
| 52 | + cmake --install build --prefix pkg-snapdragon/llama.cpp |
| 53 | +
|
| 54 | + - name: Upload Llama.CPP Snapdragon Android Build Artifact |
| 55 | + if: ${{ always() && steps.build_llama_cpp_snapdragon_android.outcome == 'success' }} |
| 56 | + uses: actions/upload-artifact@v6 |
| 57 | + with: |
| 58 | + name: llama-cpp-android-arm64-snapdragon |
| 59 | + path: pkg-snapdragon/llama.cpp |
| 60 | + |
| 61 | + test-snapdragon-qdc: |
| 62 | + name: Test on QDC Android Device (${{ matrix.device }}) |
| 63 | + needs: [android-ndk-snapdragon] |
| 64 | + runs-on: ubuntu-slim |
| 65 | + strategy: |
| 66 | + fail-fast: false |
| 67 | + matrix: |
| 68 | + device: [SM8750, SM8650, SM8850] |
| 69 | + |
| 70 | + steps: |
| 71 | + - name: Checkout |
| 72 | + uses: actions/checkout@v6 |
| 73 | + |
| 74 | + - name: Download build artifact |
| 75 | + uses: actions/download-artifact@v7 |
| 76 | + with: |
| 77 | + name: llama-cpp-android-arm64-snapdragon |
| 78 | + path: pkg-snapdragon/llama.cpp |
| 79 | + |
| 80 | + - name: Set up Python |
| 81 | + uses: actions/setup-python@v5 |
| 82 | + with: |
| 83 | + python-version: '3.x' |
| 84 | + cache: pip |
| 85 | + |
| 86 | + - name: Install system dependencies |
| 87 | + run: | |
| 88 | + sudo apt-get update |
| 89 | + sudo apt-get install -y curl unzip |
| 90 | +
|
| 91 | + - name: Install QDC SDK wheel |
| 92 | + run: | |
| 93 | + curl -fSL -o qdc_sdk.zip https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Device_Cloud_SDK/All/0.2.3/qualcomm_device_cloud_sdk-0.2.3.zip |
| 94 | + unzip qdc_sdk.zip -d qdc_sdk |
| 95 | + pip install qdc_sdk/qualcomm_device_cloud_sdk-0.2.3-py3-none-any.whl |
| 96 | +
|
| 97 | + - name: Check QDC API key |
| 98 | + id: check_secret |
| 99 | + env: |
| 100 | + QDC_API_KEY: ${{ secrets.QDC_API_KEY }} |
| 101 | + run: echo "has-qdc-key=${{ env.QDC_API_KEY != '' }}" >> "$GITHUB_OUTPUT" |
| 102 | + |
| 103 | + - name: Run QDC tests (${{ matrix.device }}) |
| 104 | + if: steps.check_secret.outputs.has-qdc-key == 'true' |
| 105 | + run: | |
| 106 | + python scripts/snapdragon/qdc/run_qdc_jobs.py \ |
| 107 | + --test all \ |
| 108 | + --pkg-dir pkg-snapdragon/llama.cpp \ |
| 109 | + --model-url "https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-Q4_0.gguf" \ |
| 110 | + --device ${{ matrix.device }} |
| 111 | + env: |
| 112 | + QDC_API_KEY: ${{ secrets.QDC_API_KEY }} |
| 113 | + |
| 114 | + - name: Cleanup |
| 115 | + if: always() |
| 116 | + run: rm -rf pkg-snapdragon qdc_sdk qdc_sdk.zip |
0 commit comments