char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
8b4b3558f
char/aliceai-t5-moe
1name : CI (apple) 2 3on : 4workflow_dispatch : # allows manual triggering 5push : 6branches : 7- master 8paths : [ 9'.github/workflows/build-apple.yml' , 10'**/CMakeLists.txt' , 11'**/.cmake' , 12'**/*.h' , 13'**/*.hpp' , 14'**/*.c' , 15'**/*.cpp' , 16'**/*.swift' , 17'**/*.m' , 18'**/*.metal' 19] 20 21pull_request : 22types : [ opened , synchronize , reopened ] 23paths : [ 24'.github/workflows/build-apple.yml' , 25'ggml/src/ggml-metal/**' , 26'ggml/src/ggml-rpc/**' 27] 28 29concurrency : 30group : ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} 31cancel-in-progress : true 32 33env : 34GGML_NLOOP : 3 35GGML_N_THREADS : 1 36LLAMA_ARG_LOG_COLORS : 1 37LLAMA_ARG_LOG_PREFIX : 1 38LLAMA_ARG_LOG_TIMESTAMPS : 1 39 40jobs : 41macos-latest-arm64 : 42runs-on : macos-latest 43 44steps : 45- name : Clone 46id : checkout 47uses : actions/checkout@v6 48 49- name : ccache 50uses : ggml-org/ccache-action@v1.2.24 51with : 52key : apple-arm64 53save : false 54 55- name : ccache-buckets-restore 56uses : ./.github/actions/ccache-buckets 57env : 58HF_TOKEN : ${{ secrets.HF_TOKEN_CI }} 59with : 60key : apple-arm64 61folder : llama.cpp 62hf_bucket : ggml-org/cache 63 64- name : Build 65id : cmake_build 66run : | 67sysctl -a 68cmake -B build \ 69-DCMAKE_BUILD_RPATH="@loader_path" \ 70-DLLAMA_FATAL_WARNINGS=ON \ 71-DLLAMA_BUILD_BORINGSSL=ON \ 72-DGGML_METAL_EMBED_LIBRARY=OFF \ 73-DGGML_METAL_SHADER_DEBUG=ON \ 74-DGGML_RPC=ON \ 75-DCMAKE_OSX_DEPLOYMENT_TARGET=13.3 76time cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) 77 78- name : ccache-buckets-save 79if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} 80uses : ./.github/actions/ccache-buckets 81env : 82HF_TOKEN : ${{ secrets.HF_TOKEN_CACHE_OUTPUT }} 83with : 84key : apple-arm64 85folder : llama.cpp 86evict-old-files : 1d 87hf_bucket : ggml-org/cache 88save : true 89 90- name : Check for leaks 91run : | 92cmd=(./build/bin/test-thread-safety -hf ggml-org/gemma-3-270m-qat-GGUF -ngl 99 -p "$(printf 'hello %.0s' {1..128})" -n 16 -c 512 -ub 32 -np 2 -t 2 -lv 1) 93leaks -atExit -- "${cmd[@]}" 94# Graphics devices are leaked by Metal in Apple code sometimes, so we ignore those leaks 95OBJC_DEBUG_MISSING_POOLS=YES "${cmd[@]}" 2>&1 | awk '{ print } index($0, "autoreleased with no pool in place") && !/class [a-zA-Z0-9]+Device autoreleased/ { found = 1 } END { exit found }' 96 97- name : Test 98id : cmake_test 99run : | 100cd build 101ctest -L main -E "test-llama-archs" --verbose --timeout 900 102 103macos-latest-x64 : 104runs-on : macos-15-intel 105 106steps : 107- name : Clone 108id : checkout 109uses : actions/checkout@v6 110 111- name : ccache 112uses : ggml-org/ccache-action@v1.2.24 113with : 114key : apple-x64 115save : false 116 117- name : ccache-buckets-restore 118uses : ./.github/actions/ccache-buckets 119env : 120HF_TOKEN : ${{ secrets.HF_TOKEN_CI }} 121with : 122key : apple-x64 123folder : llama.cpp 124hf_bucket : ggml-org/cache 125 126- name : Build 127id : cmake_build 128run : | 129sysctl -a 130# Metal is disabled due to intermittent failures with Github runners not having a GPU: 131# https://github.com/ggml-org/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313 132cmake -B build \ 133-DCMAKE_BUILD_RPATH="@loader_path" \ 134-DLLAMA_FATAL_WARNINGS=ON \ 135-DLLAMA_BUILD_BORINGSSL=ON \ 136-DGGML_METAL=OFF \ 137-DGGML_RPC=ON \ 138-DCMAKE_OSX_DEPLOYMENT_TARGET=13.3 139time cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) 140 141- name : ccache-buckets-save 142if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} 143uses : ./.github/actions/ccache-buckets 144env : 145HF_TOKEN : ${{ secrets.HF_TOKEN_CACHE_OUTPUT }} 146with : 147key : apple-x64 148folder : llama.cpp 149evict-old-files : 1d 150hf_bucket : ggml-org/cache 151save : true 152 153- name : Test 154id : cmake_test 155run : | 156cd build 157ctest -L main --verbose --timeout 900 158 159macos-latest-ios-xcode : 160runs-on : macos-latest 161 162steps : 163- name : Checkout code 164uses : actions/checkout@v6 165 166- name : Setup Xcode 167uses : ggml-org/setup-xcode@v1 168with : 169xcode-version : latest-stable 170 171- name : Build 172id : cmake_build 173run : | 174sysctl -a 175cmake -B build -G Xcode \ 176-DGGML_METAL_EMBED_LIBRARY=ON \ 177-DLLAMA_OPENSSL=OFF \ 178-DLLAMA_BUILD_APP=OFF \ 179-DLLAMA_BUILD_EXAMPLES=OFF \ 180-DLLAMA_BUILD_TOOLS=OFF \ 181-DLLAMA_BUILD_TESTS=OFF \ 182-DLLAMA_BUILD_SERVER=OFF \ 183-DCMAKE_SYSTEM_NAME=iOS \ 184-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \ 185-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml 186cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO 187 188- name : xcodebuild for swift package 189id : xcodebuild 190run : | 191./build-xcframework.sh 192 193- name : Upload xcframework artifact 194uses : actions/upload-artifact@v6 195with : 196name : llama-xcframework 197path : build-apple/llama.xcframework/ 198retention-days : 1 199 200- name : Build Xcode project 201run : | 202xcodebuild -downloadPlatform iOS 203xcodebuild -project examples/llama.swiftui/llama.swiftui.xcodeproj -scheme llama.swiftui -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' FRAMEWORK_FOLDER_PATH=./build-ios build 204 205macos-latest-tvos : 206runs-on : macos-latest 207 208steps : 209- name : Clone 210id : checkout 211uses : actions/checkout@v6 212 213- name : Build 214id : cmake_build 215run : | 216sysctl -a 217cmake -B build -G Xcode \ 218-DGGML_METAL_EMBED_LIBRARY=ON \ 219-DLLAMA_BUILD_COMMON=OFF \ 220-DLLAMA_BUILD_APP=OFF \ 221-DLLAMA_BUILD_EXAMPLES=OFF \ 222-DLLAMA_BUILD_TOOLS=OFF \ 223-DLLAMA_BUILD_TESTS=OFF \ 224-DLLAMA_BUILD_SERVER=OFF \ 225-DCMAKE_SYSTEM_NAME=tvOS \ 226-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \ 227-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml 228cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO 229 230macos-latest-visionos : 231runs-on : macos-latest 232 233steps : 234- name : Clone 235id : checkout 236uses : actions/checkout@v6 237 238- name : Build 239id : cmake_build 240run : | 241sysctl -a 242cmake -B build -G Xcode \ 243-DGGML_METAL_EMBED_LIBRARY=ON \ 244-DLLAMA_BUILD_COMMON=OFF \ 245-DLLAMA_BUILD_APP=OFF \ 246-DLLAMA_BUILD_EXAMPLES=OFF \ 247-DLLAMA_BUILD_TOOLS=OFF \ 248-DLLAMA_BUILD_TESTS=OFF \ 249-DLLAMA_BUILD_SERVER=OFF \ 250-DCMAKE_SYSTEM_NAME=visionOS \ 251-DCMAKE_OSX_DEPLOYMENT_TARGET=1.0 \ 252-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml 253cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO 254 255macos-latest-swift : 256runs-on : macos-latest 257needs : macos-latest-ios-xcode 258 259strategy : 260matrix : 261destination : [ 'generic/platform=macOS' , 'generic/platform=iOS' , 'generic/platform=tvOS' ] 262 263steps : 264- name : Clone 265id : checkout 266uses : actions/checkout@v6 267 268- name : Download xcframework artifact 269uses : actions/download-artifact@v7 270with : 271name : llama-xcframework 272path : build-apple/llama.xcframework/ 273 274- name : Build llama.cpp with CMake 275id : cmake_build 276run : | 277 sysctl -a 278 cmake -B build -G Xcode \ 279 -DGGML_METAL_EMBED_LIBRARY=ON \ 280 -DLLAMA_OPENSSL=OFF \ 281 -DLLAMA_BUILD_APP=OFF \ 282 -DLLAMA_BUILD_EXAMPLES=OFF \ 283 -DLLAMA_BUILD_TOOLS=OFF \ 284 -DLLAMA_BUILD_TESTS=OFF \ 285 -DLLAMA_BUILD_SERVER=OFF \ 286 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" 287 cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)