MUL_MAT_ID uses the coopmat2 s tile (BN = 64) for small batch sizes, but the last N-block previously always ran at full width even when the tail fit in 32 rows.
The existing smaller-matrix policy cannot be enabled directly because it would also enable BN/4 = 16, which fails MUL_MAT_ID correctness tests. In the MUL_MAT_ID path, BN/2 is now always available, while enable_smaller_matrices continues to control the additional BN/4 path:
tail <= 32 -> 32
tail > 32 -> 64
The existing l tile behavior, MMID selector, Q, AWork, dispatch count, and p.N path are unchanged. B = 1..8 uses the vec path and is unaffected.
This work was submitted as PR #28923 - vulkan : use BN/2 tail for MMID coopmat2 s tile and has been merged upstream.
| Date | Pull request | Work branch | Merged into | Status | Merge commit |
|---|---|---|---|---|---|
| 2026-09-16 | #28923 | vulkan/mmid-bn64-tail32 (9bb7487) |
ggml-org/llama.cpp:master |
Merged | d4365d9 |
The merged branch changes three lines in mul_mm_cm2.comp, without introducing a new variable:
-const uint BNover2 = enable_smaller_matrices ? (BN / 2) : BN;
+const uint BNover2 = BN / 2;
-const uint BNover4 = enable_smaller_matrices ? (BN / 4) : BN;
+const uint BNover4 = enable_smaller_matrices ? (BN / 4) : (BN / 2);
- if (enable_smaller_matrices && ic * BN + BNover2 >= _ne1) {
+ if (ic * BN + BNover2 >= _ne1) {BN/2 is therefore always available, while BN/4 remains gated by enable_smaller_matrices:
BN/2: always available
BN/4: only when enable_smaller_matrices is true
| Path | Before | After |
|---|---|---|
MMID l, BN=128, flag=1 |
/4=32, /2=64 |
unchanged |
MMID s, BN=64, flag=0 |
full 64 | tail can use /2=32 |
MMID m, BN=64, flag=0 |
full 64 | tail can use /2=32 (selector-unreachable) |
Regular MUL_MAT / p.N |
original | unchanged |
Vec path, B<=8 |
vec | unchanged |
MMID selector / Q / AWork / dispatch count |
original | unchanged |
The C++ candidates, BN/4 branch condition, and p.N path are unchanged. This work builds on the smaller-matrix path introduced in #12312 and its existing MMID use in #15546.
test-backend-ops test -o MUL_MAT_ID
921/921 tests passed
Performance was tested on an RTX 5070 Ti 16 GB with locked clocks and fully resident models:
llama-bench -m <model> -ngl 99 -p 512 -b 9,12,16,20,24,28,32,40,48,56,64 -n 0 -r 20| Model | Quant | Test | Avg PP gain |
|---|---|---|---|
| DeepSeek-V2-Lite | Q5_K_M | PP512 | +4.30% |
| Qwen3-16B-A3B | Q6_K | PP512 | +3.89% |
| Moonlight-16B-A3B | Q6_K | PP512 | +4.79% |
- I have read and agree with the contributing guidelines
- AI usage disclosure: Yes, for issue analysis and writing code.
LLM inference in C/C++
ggml / ops / maintainer PRs / dev stats / lib llama API / llama-server REST API
A few options to get llama.cpp installed on your machine:
- Visit https://llama.app and follow the instructions
- Run with Docker - see our Docker documentation
- Download pre-built binaries from the releases page
- Build from source by cloning this repository - check out our build guide
Once installed:
# Download and run a model directly from Hugging Face
llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF
# Launch OpenAI-compatible API server
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF
VLM session with llama cli
|
Built-in web UI against llama serve
|
The main goal of llama.cpp is to enable LLM (and VLM) inference with minimal setup and state-of-the-art performance on
a wide range of hardware - locally and in the cloud.
- Plain C/C++ implementation without any dependencies
- Apple silicon is a first-class citizen - optimized via ARM NEON, Accelerate and Metal frameworks
- AVX, AVX2, AVX512 and AMX support for x86 architectures
- RVV, ZVFH, ZFH, ZICBOP and ZIHINTPAUSE support for RISC-V architectures
- 1.5-bit, 2-bit, 3-bit, 4-bit, 5-bit, 6-bit, and 8-bit integer quantization for faster inference and reduced memory use
- Custom CUDA kernels for running LLMs on NVIDIA GPUs (support for AMD GPUs via HIP and Moore Threads GPUs via MUSA)
- Vulkan and SYCL backend support
- CPU+GPU hybrid inference to partially accelerate models larger than the total VRAM capacity
The llama.cpp project is build on top of the ggml library.
| Backend | Target devices |
|---|---|
| BLAS | All |
| BLIS | All |
| CANN | Ascend NPU |
| CUDA | Nvidia GPU |
| HIP | AMD GPU |
| Hexagon | Snapdragon |
| IBM zDNN | IBM Z & LinuxONE |
| MUSA | Moore Threads GPU |
| Metal | Apple Silicon |
| OpenCL | Adreno GPU |
| OpenVINO [In Progress] | Intel CPUs, GPUs, and NPUs |
| RPC | All |
| SYCL | Intel GPU |
| VirtGPU | VirtGPU APIR |
| Vulkan | GPU |
| WebGPU | All |
| ZenDNN | AMD CPU |
- How to build
- Running on Docker
- Build on Android
- Multi-GPU usage
- Performance troubleshooting
- GGML tips & tricks
- XCFramework
- Completions
- Models
- Release process
- Contributors can open PRs
- Collaborators will be invited based on contributions
- Maintainers can push to branches in the
llama.cpprepo and merge PRs into themasterbranch - Any help with managing issues, PRs and projects is very appreciated!
- Read the CONTRIBUTING.md for more information
- yhirose/cpp-httplib - Single-header HTTP server, used by
llama-server- MIT license - nothings/stb - Single-header image format decoder, used by multimodal subsystem - Public domain
- nlohmann/json - Single-header JSON library, used by various tools/examples - MIT License
- mackron/miniaudio - Single-header audio format decoder, used by multimodal subsystem - Public domain
- sheredom/subprocess.h - Single-header process launching solution for C and C++ - Public domain

