char-fork/llama.cpp

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

Ludovic Henryci: Bump ggml-org/ccache-action to v1.2.24 (#28083)234a6ebaa

char/aliceai-t5-moe
4.1 KiB149 linesraw
1name: CI (android)
2
3on:
4  workflow_dispatch:
5  push:
6    branches:
7      - master
8    paths:
9      - '.github/workflows/build-android.yml'
10      - '**/CMakeLists.txt'
11      - '**/.cmake'
12      - '**/*.h'
13      - '**/*.hpp'
14      - '**/*.c'
15      - '**/*.cpp'
16
17  pull_request:
18    types: [opened, synchronize, reopened]
19    paths:
20      - '.github/workflows/build-android.yml'
21      - 'examples/llama.android/**'
22
23concurrency:
24  group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
25  cancel-in-progress: true
26
27env:
28  GGML_NLOOP: 3
29  GGML_N_THREADS: 1
30  LLAMA_ARG_LOG_COLORS: 1
31  LLAMA_ARG_LOG_PREFIX: 1
32  LLAMA_ARG_LOG_TIMESTAMPS: 1
33
34jobs:
35  default:
36    runs-on: ubuntu-latest
37
38    steps:
39      - name: Clone
40        uses: actions/checkout@v6
41        with:
42          fetch-depth: 0
43          lfs: false
44
45      - name: Set up JDK
46        uses: actions/setup-java@v5
47        with:
48          java-version: 17
49          distribution: zulu
50
51      - name: Setup Android SDK
52        uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1
53        with:
54          log-accepted-android-sdk-licenses: false
55
56      - name: Build
57        run: |
58          cd examples/llama.android
59          ./gradlew build --no-daemon
60
61  ndk:
62    runs-on: ubuntu-latest
63    container:
64      image: 'ghcr.io/snapdragon-toolchain/arm64-android:v0.3'
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: Dependencies
77        run: |
78          apt-get update
79          apt-get install -y build-essential
80
81      - name: Build
82        id: ndk_build
83        run: |
84          cmake -D ANDROID_ABI=arm64-v8a -D ANDROID_PLATFORM=android-31 -D CMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -D GGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8.5-a+fp16+i8mm -G Ninja -D LLAMA_OPENSSL=OFF -D GGML_OPENMP=OFF -B build
85          cmake --build build
86          cmake --install build --prefix pkg-adb/llama.cpp
87
88      - name: Upload Android Build Artifact
89        if: ${{ always() && steps.ndk_build.outcome == 'success' }}
90        uses: actions/upload-artifact@v6
91        with:
92          name: llama-cpp-android-arm64-cpu
93          path: pkg-adb/llama.cpp
94
95  arm64:
96    runs-on: ubuntu-latest
97
98    env:
99      NDK_VERSION: "29.0.14206865"
100
101    steps:
102      - name: Clone
103        id: checkout
104        uses: actions/checkout@v6
105
106      # note : disabled to spare some cache space (https://github.com/ggml-org/llama.cpp/pull/23789)
107      #        for some reason, the ccache does not improve the build time in this case
108      # example:
109      #   cache off: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78160400831
110      #   cache on:  https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78224189394
111      #
112      #- name: ccache
113      #  uses: ggml-org/ccache-action@v1.2.24
114      #  with:
115      #    key: android-ubuntu-arm64
116      #    evict-old-files: 1d
117      #    save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
118
119      - name: Set up JDK
120        uses: actions/setup-java@v5
121        with:
122          java-version: 17
123          distribution: temurin
124
125      - name: Setup Android SDK
126        uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1
127        with:
128          log-accepted-android-sdk-licenses: false
129
130      - name: Install NDK
131        run: |
132          sdkmanager "ndk;${{ env.NDK_VERSION }}"
133          echo "ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${{ env.NDK_VERSION }}" >> $GITHUB_ENV
134
135      - name: Build
136        id: cmake_build
137        run: |
138          cmake -B build \
139            -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
140            -DANDROID_ABI=arm64-v8a \
141            -DANDROID_PLATFORM=android-28 \
142            -DLLAMA_FATAL_WARNINGS=ON \
143            -DGGML_BACKEND_DL=ON \
144            -DGGML_NATIVE=OFF \
145            -DGGML_CPU_ALL_VARIANTS=ON \
146            -DGGML_OPENMP=OFF \
147            -DLLAMA_BUILD_BORINGSSL=ON \
148            -DGGML_RPC=ON
149          time cmake --build build --config Release -j $(nproc)