char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Max Krasnyanskysnapdragon: bump toolchain docker to v0.7 to fix ui build issues (#23680)4bead4e30

char/aliceai-t5-moe
4.7 KiB148 linesraw
1name: CI (snapdragon)
2
3on:
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
26concurrency:
27  group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
28  cancel-in-progress: true
29
30jobs:
31  android-ndk-snapdragon:
32    runs-on: ubuntu-latest
33    container:
34      image: 'ghcr.io/snapdragon-toolchain/arm64-android:v0.7'
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  linux-iot-snapdragon:
62    runs-on: ubuntu-latest
63    container:
64      image: 'ghcr.io/snapdragon-toolchain/arm64-linux:v0.7'
65    defaults:
66      run:
67        shell: bash
68
69    steps:
70      - name: Clone
71        uses: actions/checkout@v6
72        with:
73          fetch-depth: 0
74          lfs: false
75
76      - name: Build Llama.CPP for Snapdragon Linux IoT
77        id: build_llama_cpp_snapdragon_linux
78        run: |
79          cp docs/backend/snapdragon/CMakeUserPresets.json .
80          cmake --preset arm64-linux-snapdragon-release -B build-snapdragon -DGGML_OPENCL=ON
81          cmake --build build-snapdragon -j $(nproc)
82          cmake --install build-snapdragon --prefix pkg-snapdragon/llama.cpp
83
84      - name: Upload Llama.CPP Snapdragon Linux IoT Build Artifact
85        if: ${{ always() && steps.build_llama_cpp_snapdragon_linux.outcome == 'success' }}
86        uses: actions/upload-artifact@v6
87        with:
88          name: llama-cpp-linux-arm64-snapdragon
89          path: pkg-snapdragon/llama.cpp
90
91  test-snapdragon-qdc:
92    name: Test on QDC Device (${{ matrix.device }})
93    needs: [android-ndk-snapdragon, linux-iot-snapdragon]
94    runs-on: ubuntu-24.04-arm
95    timeout-minutes: 90
96    strategy:
97      fail-fast: false
98      matrix:
99        device: [SM8750, SM8850, QCS9075M]
100
101    steps:
102      - name: Checkout
103        uses: actions/checkout@v6
104
105      - name: Download build artifact
106        uses: actions/download-artifact@v7
107        with:
108          name: ${{ startsWith(matrix.device, 'QCS') && 'llama-cpp-linux-arm64-snapdragon' || 'llama-cpp-android-arm64-snapdragon' }}
109          path: pkg-snapdragon/llama.cpp
110
111      - name: Set up Python
112        uses: actions/setup-python@v6
113        with:
114          python-version: '3.x'
115          cache: pip
116
117      - name: Install system dependencies
118        run: |
119          sudo apt-get update
120          sudo apt-get install -y curl unzip
121
122      - name: Install QDC SDK wheel
123        run: |
124          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
125          unzip qdc_sdk.zip -d qdc_sdk
126          pip install qdc_sdk/qualcomm_device_cloud_sdk-0.2.3-py3-none-any.whl
127
128      - name: Check QDC API key
129        id: check_secret
130        env:
131          QDC_API_KEY: ${{ secrets.QDC_API_KEY }}
132        run: echo "has-qdc-key=${{ env.QDC_API_KEY != '' }}" >> "$GITHUB_OUTPUT"
133
134      - name: Run QDC tests (${{ matrix.device }})
135        if: steps.check_secret.outputs.has-qdc-key == 'true'
136        run: |
137          python scripts/snapdragon/qdc/run_qdc_jobs.py \
138              --test       all \
139              --pkg-dir    pkg-snapdragon/llama.cpp \
140              --model-url  "https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-Q4_0.gguf" \
141              --device     ${{ matrix.device }} \
142              ${{ startsWith(matrix.device, 'QCS') && '--retries 2 --retry-delay 300' || '' }}
143        env:
144          QDC_API_KEY: ${{ secrets.QDC_API_KEY }}
145
146      - name: Cleanup
147        if: always()
148        run: rm -rf pkg-snapdragon qdc_sdk qdc_sdk.zip