llama.cpp for xenon
The llama.cpp libraries xenon runs local models on: the ones the Android app ships, for android-arm64, in two versions, b12675 (current) and b12283 (kept for older xenon builds), and the ones xenon's desktops download on first use, b12675 only.
| File | For | sha256 |
|---|---|---|
llama-b12675-bin-android-arm64-snapdragon.tar.gz |
Snapdragon phones | 0ce9b8befcd5ca306a19b6cf55734639cc5a08c03a45a1e500b8aceb4c4afa62 |
llama-b12675-bin-android-arm64-generic.tar.gz |
every other phone | c7e1fbc7a02b1bf3ac44a308468df0b59f278b2b842a762741ce1e17881641eb |
llama-b12283-bin-android-arm64-snapdragon.tar.gz |
Snapdragon phones | 549c29421848105ec30dff0ac3c50d3b6f109e65a495f3a71684dd06a78ef427 |
llama-b12283-bin-android-arm64-generic.tar.gz |
every other phone | fc85995ef9405b95b060ea99229f4847dbb1803889cb66fddd150dffa1c1f8e7 |
llama-b12675-bin-macos-arm64.tar.gz |
Macs with Apple silicon | 6153539774c6447395cda33b610762cb633fea7bb7bac93f2e3b71f717f0719b |
llama-b12675-bin-linux-x64.tar.gz |
Linux PCs | d8e4afa5f5228add5eda77cff3b8d0aea5a0d7b255020b1f2b4fcf3e52540b34 |
llama-b12675-bin-windows-x64.tar.gz |
Windows PCs | fb07272e5e592a2525d59545e1104e7a8265a9c2e506253ccabd21ce7a2df394 |
The Snapdragon builds have the Hexagon NPU backend (HTP v73 to v85), the CPU
backend, RPC and OpenCL (xenon never uses OpenCL on a phone), in
llama-<version>/lib/*.so. The generic builds have CPU backends only, in
llama-<version>/*.so. The Mac build has Metal, BLAS (Accelerate) and the CPU
backend; the Linux and Windows builds have Vulkan and every CPU variant
llama.cpp's release has, loaded at run time, as its Vulkan releases do. All are
in llama-<version>/, and each tarball has llama.cpp's LICENSE.
How they are built
b12675 from llama.cpp commit c212d25ad34ff1fdf775793cda07e009560cf66b, b12283
from commit f3b407ca1bfeeecebf9e9ef19fcd6eed565bd70a. The Snapdragon builds use
the toolchain image llama.cpp's release uses
(ghcr.io/snapdragon-toolchain/arm64-android, Hexagon SDK 6.7.0.0, NDK r29)
with the release's arm64-android-snapdragon-release preset and GGML_RPC=ON.
The generic builds use the NDK with the same flags as llama.cpp's Android
release. The Mac build is made on a Mac with the macOS release's flags
(Metal library embedded, macOS 13.3 and up, no -mcpu=native). The Linux build
is made in Ubuntu 22.04 with LunarG's Vulkan SDK, as the release's Vulkan build
is, so it needs glibc 2.34 or newer. The Windows build is cross-compiled with
llvm-mingw (mstorsjo/llvm-mingw:20261104), with its C++ runtime linked in
and without OpenMP, so it needs nothing but Windows and, for Vulkan, a GPU
driver. The tools, server and common library are left out. All are built by
android/build-llama.sh in xenon.
Patches
llama-b12675.patch, on top of b12675, in every build:
- ggml-cpu: F16 weights multiply F16 copies of their inputs again, undoing the CPU part of upstream PR 31854: its F32 path encodes a screenshot in 21.5 s on a Galaxy A33's CPU, this in 8 s.
- ggml-hexagon: reading a view of a weight on the NPU reads its source, so vision embeddings come out right (upstream issue 31104, still open). Snapdragon build only.
- ggml-alloc: a failed reserve is allocated again instead of running on missing buffers.
llama.patch, on top of b12283, in both builds:
- ggml-hexagon: reading a view of a weight on the NPU reads its source (upstream PR 31104, not merged yet). Snapdragon build only.
- ggml-alloc: a failed reserve is allocated again instead of running on missing buffers.
- simd-gemm: NEON gets the wide GEMM tile (upstream from b12330).
- ggml-cpu: F16 weights are multiplied in F16 again, undoing the CPU part of upstream PR 31854, which made the image encoder about 2.7 times slower on phone CPUs.
Licences
llama.cpp and ggml are MIT licensed (LICENSE in the tarball). The patches
are under the same licence.