Repository navigation
AMEVA-Runtime v2.8.0: ggml-ameva as the LLM GPU Route
Release Notes - AMEVA-Runtime v2.8.0
Release Tag: v2.8.0
Distribution Channels: PyPI (ameva-runtime), NPM (@ameva/runtime), GitHub Releases (uno-km/ameva-runtime-releases)
Target Platform: Android ARM64 / Qualcomm Adreno, ARM Mali, Linux & Edge
License: Apache-2.0
Summary
The GPU route of the LLM engine runs on the project's own Vulkan backend, ggml-ameva, which the llama bundle now
carries. Up to 2.7.9 the route ran on the Vulkan backend of the bundled llama.cpp (ggml-vulkan, b8471), which returns
corrupt text with flash attention and, without it, stops with a descriptor-set assert on Mali and with
ErrorDeviceLost on Turnip (2.7.9 notes, Known issues 1).
With ggml-ameva the route gives the CPU's text for Qwen2.5-0.5B and Gemma-2-2B on the five test devices, and a KL
divergence against the CPU below the CPU's own distance between two of its kernel paths. Speed has two parts, and they
differ (tables 3 and 4):
- Prompt processing (hundreds of tokens at once): for a 0.5B model the GPU is 17 to 36 times the CPU on the Galaxy
S25 and 1.2 to 3.3 times on the other four devices; for a 1B model it is 6 to 15 times on the S25, 1.3 times on the
S20 and 0.6 to 0.8 times on the three Mali devices. - Token generation (one token at a time): faster than the CPU on the Galaxy S25, 0.85 to 1.15 times the CPU on the
S20 depending on its GPU clock, and 0.4 to 0.7 times the CPU on the three Mali devices.
The Galaxy S20 (Adreno 650) now takes the GPU route by default, as the Galaxy S25 and A35 do. Galaxy S21 and A53 keep
the CPU route.
Changes
1. llama bundle
llama-cli-vulkan-android-arm64.tar.gz is the 2.7.9 archive with every member unchanged, plus
| File | |
|---|---|
lib/libggml-ameva.so |
ggml backend plugin, device AMEVA0; RUNPATH $ORIGIN:$PREFIX/lib |
lib/libac_runtime.so.2 |
the AMEVA compute runtime the plugin needs |
lib/ggml-ameva.manifest.json |
source commit (ameva-compute c8aa8fd), toolchain, the ggml it was linked against, hashes, test results |
Pin d459daa9c55c6b06.... Built on Galaxy S25 (clang 21.1.8) against the bundle's ggml 0.9.8 with ameva-compute's
scripts/termux/build_runtime_backend.sh: 0 compiler warnings, AMEVA_QMM_CHECK=PASS (516/516), both batch KATs,
registration of AMEVA0 by the bundle's llama-completion without LD_LIBRARY_PATH. The bundle is assembled by
tools/packaging/add_ggml_ameva.py, which refuses a backend linked against another ggml, one whose recorded tests did
not pass, or one whose RUNPATH does not start with $ORIGIN. The other four bundles are those of 2.7.9.
2. LLM routes
- The Vulkan plan names the device (
--device AMEVA0), andameva-run exec/ameva_runtime.run()hand the plugin
of the started bundle to llama.cpp throughGGML_BACKEND_PATH. AGGML_BACKEND_PATHfrom the caller's environment
is not passed on. - One plan for every GPU family. The settings of ggml-vulkan (
GGML_VK_*,-fa 0) and its hazard names do not apply.
Flash attention stays at llama.cpp's default (on): ggml-ameva runsFLASH_ATTN_EXTon the GPU, and with-fa 0the
attention runs as separate operators, 1.2 to 14 times slower. - Adreno 600 series (Galaxy S20) takes the GPU route by default. With
AMEVA_LLM_GPU_BACKEND=upstreamits
adaptive route stays on the CPU, because ggml-vulkan stops on that device. - An explicit
-b autois the adaptive route. It used to fall through to the CPU route on the devices whose adaptive
route is the GPU. AMEVA_LLM_GPU_BACKEND=upstreamselects ggml-vulkan of the bundled llama.cpp with the plans of 2.7.9; any value
other thanamevaorupstreamis an error.- A bundle without the plugin stops the route with
AMEVA-LLAMA-E001; it is not run on another backend instead. ameva-run planandameva-run execprint the GPU backend of the plan.
3. ggml-ameva (ameva-compute)
- Loading weights (
bf85cfb): the plugin stores quantized weights in its own layout and converted them in the GPU
mapping, which several drivers map uncached; there the conversion ran at 6 to 9 MB/s. It now converts in a staging
copy. Load time on Galaxy A35: Qwen2.5-0.5B 11.5 -> 1.2 s, Llama-3.2-1B 81 -> 2.6 s, Gemma-2-2B 182 -> 8.1 s. - Token generation with integer dot products (
c8aa8fd): a new kernel family,ameva_mmvq, multiplies one
activation row quantized to int8 with packed integer dot products (VK_KHR_shader_integer_dot_product), as the
prompt path (ameva_mmq) already did. It is measured per device and weight shape together with the f32 layouts and
used for a shape only when more than 10 % faster. Galaxy S25, S20 and A35 offer the extension; A53 and S21 do not.
AMEVA_MMVQ=0turns it off. - More token-generation layouts (
c8aa8fd): 4, 2 and 1 lanes per weight row are measured too (13 -> 22 f32
layouts). The tune file has a new format; a file of an earlier build is measured again. build_ggml_ameva.shrewrites the plugin's RUNPATH to start with$ORIGIN(the Termux clang driver puts
$PREFIX/libfirst, and the plugin then bound alibac_runtime.so.2left there by an earlier installation).
4. Termux apt package llama-cpp
tools/fleet/divert_apt_llama.sh registers dpkg diversions for $PREFIX/bin/llama-cli, llama-server and
llama-completion: the apt package stays installed, dpkg writes its three executables to <name>.apt-llama-cpp, and
a reinstall or upgrade of the package no longer replaces the runtime's links (docs/RELEASE_AND_MIGRATION.md 3.6).
Verification
2026-10-04, llama-completion of the bundle, greedy (--temp 0 --top-k 1), -c 2048 -t 4, all layers on the GPU,
models Q4_K_M, ggml-ameva of ameva-compute c8aa8fd (plugin 50f3bcd5...) unless stated. Speeds on these phones move
with the GPU clock (thermal cap on Adreno, governor on Exynos), with the CPU set Android grants and with whatever else
runs on the phone; the conditions are given with the numbers. The files are in
docs/handover/evidence/20261004-ggml-ameva/ and 20261004-ggml-ameva-mmvq/.
1. Text against the CPU's (greedy, 32 tokens after "The three primary colors are", the parity tool of table 2)
| S25 Adreno 830 | S20 Adreno 650 (Turnip) | A35 Mali-G68 r38 | A53 Mali-G68 r32 | S21 Mali-G78 | |
|---|---|---|---|---|---|
| Qwen2.5-0.5B | identical | identical | identical | identical | identical |
| Llama-3.2-1B | first 10 tokens | first 10 tokens | first 10 tokens | first 10 tokens | first 10 tokens |
| Gemma-2-2B | identical | identical | identical (backend 0bcbebd, 24 tokens) |
identical | identical |
Llama-3.2-1B: every GPU path continues the same way after 10 tokens ("These colors are combined in different ways...",
the CPU: "These colors are used to create..."), ggml-vulkan of the bundle on the Galaxy S25 included. The KL divergence
(table 2) is within the CPU's own noise, so this is a near-tie in the greedy choice, not a wrong result.
2. KL divergence against the CPU (ameva-compute tests/ameva_llm_parity.cpp: wikitext-2 test, 2 chunks of 256
tokens, second half scored, one token per call; gate kld_mean <= 0.01; "CPU noise" is the CPU's one-token-per-call
path against its batch path)
| kld_mean | CPU noise | S25 | S20 | A35 | A53 | S21 |
|---|---|---|---|---|---|---|
| Qwen2.5-0.5B | 3.36e-3 | 2.56e-3 | 3.12e-3 | 2.96e-3 | 2.57e-3 | 2.57e-3 |
| Llama-3.2-1B | 3.06e-3 | 2.71e-3 | 2.86e-3 | 2.90e-3 | 2.40e-3 | 2.40e-3 |
| Gemma-2-2B (1 chunk) | 7.68e-3 | 6.06e-3 | 6.36e-3 | not measured | 5.85e-3 | 5.85e-3 |
every product through ameva_mmvq (AMEVA_MMVQ=1) |
2.58e-3 / 2.79e-3 / 6.25e-3 | 2.68e-3 / 2.86e-3 / 6.33e-3 | not available | not available |
All 14 runs of the default policy and the 6 forced runs: AMEVA_LLM_PARITY=PASS. The devices differ where they chose
integer-dot layouts (S25 for 4 of 14 weight shapes, A35 for nearly all); A53 and S21 have only f32 layouts. Galaxy
A35, Gemma-2-2B: not measured. The run holds the 1.6 GB model twice on a phone with 5.4 GB, and the phone's Termux
session ended during the first attempt while other work was running on it; the forced runs on the S25 and the S20
cover the same arithmetic for that model. Measured with the build of the c8aa8fd source before a comment-only edit
(plugin 2ba74bd2...).
3. Prompt processing, tokens per second (the first 1500 bytes of wikitext-2 test, about 370 tokens, -b 512; two
runs alternating with the CPU; CPU / ggml-ameva)
| S25 (832 MHz) | S20 | A35 | A53 | S21 | |
|---|---|---|---|---|---|
| Qwen2.5-0.5B | 30-58 / 1010-1081 | 60 / 181-197 (441-587 MHz) | 109-110 / 190 | 55 / 67 | 115-119 / 227 |
| Llama-3.2-1B | 31-55 / 357-473 | 74-76 / 95 (587 MHz) | 103-112 / 83 | 47-48 / 27 | 114-117 / 90-96 |
- Galaxy S25: two sessions with this backend; other work was running on the phone in both (load average 15 to 19),
which lowers the CPU figures. With backend0bcbebdearlier the same day: 49 / 1057-1075 and 48-52 / 460-464. - Galaxy S20, Llama-3.2-1B at a clock cap of 441 MHz: 47-48 / 72.
- With the integer-dot prompt kernel off (
AMEVA_MMQ=0, the f32 tile kernel; backend0bcbebd): S25 412 / 173, S20
133 / 52, A35 95 / 40 t/s (Qwen / Llama). A53 and S21 have no integer dot products, so they run the f32 kernel. - ggml-vulkan of the bundle with
-fa 0on the same prompt: Galaxy S25 61-65 t/s, Galaxy A35 31 t/s for Qwen and an
abort for Llama, aborts on S20 (one run of Llama: 39 t/s), A53 and S21.
4. Token generation, tokens per second (64 tokens after "The three primary colors are"; a warm-up run first;
three rounds alternating with the CPU; CPU / ggml-ameva)
| S25 (832 MHz) | S20 | A35 | A53 | S21 | |
|---|---|---|---|---|---|
| Qwen2.5-0.5B | 16-49 / 36-77 | 25-27 / 23.6-24.4 (441 MHz) | 35-37 / 21.5-21.6 | 22-24 / 14.5 | 46-47 / 22.8-23.1 |
| Llama-3.2-1B | 8-27 / 25-48 | 21-22 / 18.3-18.4 (587 MHz) | 18-19 / 12.3-12.5 | 14 / 6.9-7.0 | 22 / 9.4-12.9 |
- Galaxy S25: the same two sessions under other load. In the rounds without it the same source gave 72-75 (Qwen) and
47-48 (Llama) against 33-49 and 19-27 on the CPU. - Galaxy S20: Qwen at 587 MHz, the same source, 32.6-32.9 against 28-31 on the CPU; Llama at 441 MHz 13.6 against 19.
- Against the backend without
ameva_mmvqand the added layouts (0bcbebd, alternating rounds in one session): Galaxy
A35 12.3-12.7 -> 19.0 (Qwen) and 6.9-7.4 -> 11.9 (Llama); Galaxy S20 25.7-26.0 -> 32.6-32.9 and 13.5 -> 18.8; Galaxy
A53 13.7 -> 14.4 and 6.3 -> 7.0; Galaxy S21 and S25 within the spread of their measurements. - ggml-vulkan of the bundle with
-fa 0: Galaxy S25 25 / 23 t/s, Galaxy A35 6.6-7.1 t/s for Qwen; aborts elsewhere.
Where the generation time goes (Qwen2.5-0.5B, AMEVA_PROFILE=2, backend 0bcbebd): on the Mali devices 76 to 84 % of
the GPU time is the one-row MUL_MATs, 20 to 25 % of it the output projection alone; the CPU records a token's commands
in 2 to 9 ms.
5. Load time with ggml-ameva (llama.cpp "load time", backend 0bcbebd): S25 1.4 / 6.3 / 16.0 s, S20 1.0 / 2.2 /
4.5 s, A35 1.2 / 2.6 / 8.1 s, A53 1.2 / 2.9 / 8.7 s, S21 1.0 / 2.3 / 4.6 s (Qwen / Llama / Gemma). The CPU loads the
same models in 0.6 to 7.8 s.
6. Installation and ameva-run exec (scratch trees with their own HOME / PREFIX, this bundle from a file://
release base; Qwen2.5-0.5B, "What are the three primary colors? Answer in one sentence."; generation t/s)
| S25 | S20 | A35 | A53 | S21 | |
|---|---|---|---|---|---|
Fresh install: 5 bundles, $PREFIX/lib empty, 7 linked commands, plugin in the llama release |
PASS | PASS | PASS | PASS | PASS |
Upgrade of a tree installed by the published 2.7.9: llama bundle [UPGRADE], four reused |
PASS | PASS | PASS | PASS | PASS |
AMEVA0 registered by the linked llama-completion without LD_LIBRARY_PATH |
PASS | PASS | PASS | PASS | PASS |
| Default route: route, text, t/s (first run / second run) | GPU, expected, 18 / 75 | GPU, expected, 10 / 25 | GPU, expected, 12 / 23 | CPU, expected, 23 / 24 | CPU, expected, 50 / 50 |
-b vulkan (ggml-ameva): text, t/s |
expected, 72 | expected, 26 | expected, 23 | expected, 11 | expected, 18 |
-b cpu: text, t/s |
expected, 43 | expected, 27 | expected, 39 | expected, 23 | expected, 37 |
AMEVA_LLM_GPU_BACKEND=upstream -b vulkan |
expected, 23 | stops (DeviceLost) | expected, 7.1 | stops (assert) | stops (assert) |
The first GPU run in a new HOME includes the layout measurement and pipeline compilation (Known issues 1). Galaxy
S20 ran at a clock cap of 441 MHz. On the Galaxy S20 and S21 a first attempt at these steps was interrupted: the
phones' Termux sessions ended while another job was running on them (on the S20 a video generation holding 4.7 GB,
whose log stops at the same second). Run alone, the steps passed on both.
7. Conformance. ggml test-backend-ops (llama.cpp b8471) for AMEVA0 on the Galaxy S25: 1949/1949 passed with
the default settings and 1692/1692 with AMEVA_REPACK_ALL=1 (repacked weights in every buffer); MUL_MAT 187/187 also
with AMEVA_REPACK_ALL=1 AMEVA_MMVQ=1.
Unit tests: 225 passed, 17 skipped on the build host; no write to the host's own AMEVA store
(tools/dev/home_write_audit.py).
Known issues
- First run. On a device's first use of a model, ggml-ameva measures the GEMV layouts of each weight shape and
compiles its pipelines; both are kept in$HOME/.cache/ameva/(ggml-ameva-qmv-tune.txt,ggml-ameva-pipelines.bin).
Galaxy S25: the firstameva-run execafter installation generated 18 t/s, the second 75 t/s (Qwen2.5-0.5B).
AMEVA_QMV_TUNE=0skips the measurement and uses the default layout. - On the Mali devices token generation on the GPU is slower than on the CPU (0.4 to 0.7 times), and so is prompt
processing of the 1B model (0.6 to 0.8 times). Galaxy A53 and S21 have no integer dot products in their Vulkan
drivers, so neitherameva_mmqnorameva_mmvqruns there, and their adaptive route stays the CPU. On the Galaxy
S20, whose adaptive route is now the GPU, token generation ranges from 0.85 to 1.15 times the CPU with the GPU clock. - Only
ameva-run execandameva_runtime.run()use the plugin.llama-server,llama-clistarted directly, and
termux-llamacpp (which callsLlamaCppAdapterand startsllama-cliitself) still run ggml-vulkan unless
GGML_BACKEND_PATHand--device AMEVA0are given. Setting onlyGGML_BACKEND_PATHmakes a second GPU device
visible, over which llama.cpp then splits the layers. - Quantized KV cache (
-ctk/-ctv): q8_0 gives the CPU's q8_0 text and no speed difference; with q4_0 the text
of Qwen2.5-0.5B degrades on the GPU and on the CPU alike. It saves memory, not time. - The installer does not register the dpkg diversions of Changes 4 itself; on a device with the apt package
llama-cppthey are set withtools/fleet/divert_apt_llama.sh. termux-* packages still use$PREFIX/lib.