12ab5979869aecdf3593de260a99ca91263bf5a1
* ggml : switch to F32 src1 in the CPU backend Change the default computation for GGML_TYPE_F16 to use F32 for src1 data in matrix multiplications: vec_dot_type(F16) is now F32 and the dot product goes through the new ggml_vec_dot_f16_f32 (x = F16 src0, y = F32 src1), so src1 is no longer quantized to F16 and worst-case inputs that only fit in the F32 FP range are handled correctly. - conv_2d/conv_3d: store im2col patches (the inner mul_mat src1) as F32 and pass separate src0/src1 types to the inner mul_mat; the previous F16 patches made the inner mul_mat widen src1 into the conv work buffer, corrupting the patches and crashing on large inputs - conv_transpose_1d/2d (F16 kernel): keep src1 in F32 in the work buffer and use ggml_vec_dot_f16_f32; update work buffer planning accordingly - supports_op: restore MUL_MAT support for F16 src1, which is now widened to F32 - ggml_vec_dot_f16_f32: add GGML_SIMD support by converting chunks of x to F32 and reusing the F32 SIMD dot - mul_mat/mul_mat_id: add TODOs for a more efficient F16 x F16 path that can be used if ggml_prec_get_src(dst, 1) allows converting src1 to F16 MUL_MAT f16 x f32 perf on M5 Ultra (GFLOPS): - m=2048, n=512, k=16 : 120.9 -> 101.7 - m=2048, n=512, k=64 : 150.5 -> 344.2 - m=4096, k=14336 GEMV: 63 -> 343-415 - m=4096, n=512, k=14336: 65.6 -> 770.2 Assisted-by: dsh:llama.cpp/ggml-org/GLM-5.3-Flash-GGUF (Mac Studio, M5 Ultra, 256GB) * cont : add some F16 x F32 vectorized paths * cont : enable the fused F16 x F32 dot on AVX without FMA The 256-bit fused path of ggml_vec_dot_f16_f32 required AVX2 and FMA, so CPUs with AVX and F16C only fell back to the chunked conversion and F16 decode was 4x slower than before. Enable it on __AVX__ && __F16C__ and accumulate with GGML_F32x8_FMA, which does mul + add without FMA. --------- Co-authored-by: Pascal <admin@serveurperso.com>
llama.cpp
LLM inference in C/C++
ggml / ops / maintainer PRs / dev stats / lib llama API / llama-server REST API
Quick start
A few options to get llama.cpp installed on your machine:
# curl
curl -LsSf https://llama.app/install.sh | sh
# powershell
irm https://llama.app/install.ps1 | iex
- 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
|
|
|
Description
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.
Supported backends
| Backend | Target devices |
|---|---|
| BLAS | All |
| BLIS | All |
| CANN | Huawei 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 |
Documentation
Tools
Development
- How to build
- Running on Docker
- Build on Android
- Multi-GPU usage
- Performance troubleshooting
- GGML tips & tricks
- XCFramework
- Completions
- Models
- Release process
Contributing
- 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
Acknowledgements
- 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
Languages
C++
54.9%
C
16.7%
Python
7%
Cuda
5.6%
TypeScript
3.9%
Other
11.7%