Find a file
drluoto 5c53396b89
vulkan: raise the hoisted row-id limit for mul_mat_id from 256 to 512 experts (#28501)
* vulkan: raise the hoisted row-id limit for mul_mat_id to 512 experts

The expert-count shader (count_experts.comp) sizes its shared arrays
with BLOCK_SIZE, which is 256. Because of that, row-id hoisting is
switched off for any model with more than 256 experts, and every
mul_mat_id workgroup has to rescan the whole ids tensor on its own.
Qwen3.8-Flash-Next has 512 experts and was quietly running on that
slow path.

This change sizes the arrays with a separate MAX_EXPERTS constant (512),
clears them in a loop instead of one entry per thread, and raises the
matching limit on the host side.

On Strix Halo at batch 2048 the expert matmuls drop from 12.5 to 9.5 ms
(iq3_s) and from 14.0 to 7.5 ms (iq4_nl) per op, and prompt processing
gets about 19 % faster at 8k tokens. test-backend-ops MUL_MAT_ID passes
(891/891) with new 512-expert test cases.

Assisted-by: Claude Fable 5.1

* vulkan: raise the hoisted row-id limit for mul_mat_id to 1024 experts

Follow-up to review feedback: 1024 matches LLAMA_MAX_EXPERTS instead of
stopping at 512. The three shared arrays in count_experts.comp grow to
3 * 1024 * 4 = 12 KiB, which fits the 16 KiB that Vulkan guarantees for
maxComputeSharedMemorySize.

Adds mul_mat_id test cases at 1024 experts alongside the existing 512
ones. test-backend-ops MUL_MAT_ID passes on Vulkan (RADV, Strix Halo,
Radeon 8060S): 889/889.
2026-09-18 09:00:15 +02:00
.devops openvino : Update OpenVINO to 2026.4;fix clangd,MSVC warnings; (#29009) 2026-09-17 12:46:14 +02:00
.gemini contributing: tighten AI usage policy (#18388) 2025-12-29 16:01:32 +01:00
.github ci : add missing evict-old-files (#29041) 2026-09-17 19:05:40 +02:00
.pi/gg tests : add fusion baseline README and broaden fusion CI triggers (#28893) 2026-09-14 15:45:05 +03:00
app cmake : use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#28771) 2026-09-15 05:26:09 +02:00
benches benches : add Nemotron 3 Nano on DGX Spark (#20652) 2026-03-16 21:50:43 +02:00
ci OpenVINO: optimize stateful decode and GPU MoE inference (#28638) 2026-09-15 12:29:19 +03:00
cmake CI: Use LLVM's OpenMP over MSVC_DEBUG_non_redist on Windows (#26678) 2026-08-20 15:42:26 +02:00
common chat : add message delimiters to the DeepSeek V3.2/V4 parser (#29008) 2026-09-17 09:41:08 +02:00
conversion model : add support for HrmTextForCausalLM (DFM Mimir 1B) (#27625) 2026-09-16 15:18:45 +02:00
docs openvino : Update OpenVINO to 2026.4;fix clangd,MSVC warnings; (#29009) 2026-09-17 12:46:14 +02:00
examples cmake : use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#28771) 2026-09-15 05:26:09 +02:00
ggml vulkan: raise the hoisted row-id limit for mul_mat_id from 256 to 512 experts (#28501) 2026-09-18 09:00:15 +02:00
gguf-py model : add support for HrmTextForCausalLM (DFM Mimir 1B) (#27625) 2026-09-16 15:18:45 +02:00
grammars common : implement common_schema internal representation for JSON schemas (#28736) 2026-09-12 16:14:50 -05:00
include gguf : align the data section relative to the GGUF start, not the file (#28993) 2026-09-17 09:19:44 +02:00
licenses refactor : remove libcurl, use OpenSSL when available (#18828) 2026-01-14 18:02:47 +01:00
media media : add transparent icon svg and png [no ci] (#15891) 2025-09-10 14:51:28 +03:00
models [Model] Support for Spark2_5ForCausalLM implementation (#27868) 2026-09-06 17:43:58 +02:00
pocs libs : rename libcommon -> libllama-common (#21936) 2026-04-17 11:11:46 +03:00
requirements py : lower numpy to 2.2.6 (#28654) 2026-09-09 15:56:27 +02:00
scripts ci : add API/ABI check to make-release workflow [no ci] (#28947) 2026-09-17 09:55:16 +02:00
skills test: move tools/parser to tests (#27548) 2026-08-23 18:38:51 +02:00
src model : skip gate_up_exps if TENSOR_SKIP is set (#29014) 2026-09-17 13:53:54 +02:00
tests vulkan: raise the hoisted row-id limit for mul_mat_id from 256 to 512 experts (#28501) 2026-09-18 09:00:15 +02:00
tools rpc : skip ACCEL devices (#29020) 2026-09-17 18:36:53 +03:00
vendor vendor : update cpp-httplib to 0.56.0 (#28787) 2026-09-12 10:15:08 +03:00
.clang-format fix: apply clang-format to CUDA macros (#16017) 2025-09-16 08:59:19 +02:00
.clang-tidy clang-tidy : disable warning about performance enum size (#16127) 2025-09-22 19:57:46 +02:00
.dockerignore docker : prebuild web UI for s390x build [no release] (#24829) 2026-06-20 05:54:42 -05:00
.ecrc cmake : use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#28771) 2026-09-15 05:26:09 +02:00
.editorconfig ui: Restructure repo to use tools/ui folder and ui / UI / llama-ui / LLAMA_UI naming (#23064) 2026-05-16 02:02:40 +02:00
.flake8 llama : move end-user examples to tools directory (#13249) 2025-05-02 20:27:13 +02:00
.gitignore ui: PWA support (#23871) 2026-06-12 15:53:26 +02:00
.gitmodules ggml : remove kompute backend (#14501) 2025-07-03 07:48:32 +03:00
.pre-commit-config.yaml convert.py : add python logging instead of print() (#6511) 2024-05-03 22:36:41 +03:00
AGENTS.md arg: remove -no-cnv from cli [no ci] (#27542) 2026-08-22 15:53:56 +02:00
AUTHORS docs : update maintainer PRs link and regenerate AUTHORS (#28365) 2026-09-04 10:20:49 +03:00
build-xcframework.sh metal : add metallib build support for xcframework (#28163) 2026-09-02 07:45:56 +08:00
CLAUDE.md contributing: tighten AI usage policy (#18388) 2025-12-29 16:01:32 +01:00
CMakeLists.txt llama.cpp : bump version to 0.4.1 (#28900) 2026-09-14 17:01:05 +03:00
CMakePresets.json cmake : Add CMake presets for Linux and GCC (#14656) 2025-07-13 08:12:36 +03:00
CODEOWNERS docs: remove JG as CODEOWNER for test-llama-archs (#29003) 2026-09-17 08:14:58 +02:00
CONTRIBUTING.md docs: Rule of thumb for AI review time [no ci] (#28945) 2026-09-15 14:11:16 +02:00
convert_hf_to_gguf.py convert : add --fuse-qkv flag to fuse Q/K/V into QKV during HF-to-GGUF conversion (#22780) 2026-09-07 00:47:05 +08:00
convert_hf_to_gguf_update.py model : add support for HrmTextForCausalLM (DFM Mimir 1B) (#27625) 2026-09-16 15:18:45 +02:00
convert_llama_ggml_to_gguf.py ci : switch from pyright to ty (#20826) 2026-03-21 08:54:34 +01:00
convert_lora_to_gguf.py convert : fix lora base model arch retrieval (#24621) 2026-06-15 00:55:26 +02:00
flake.nix nix : update deprecated expressions (#28145) 2026-09-07 15:59:45 +02:00
LICENSE docs : Minor cleanups (#19252) 2026-02-02 08:38:55 +02:00
Makefile make : remove make in favor of CMake (#15449) 2025-08-20 13:31:16 +03:00
mypy.ini convert : partially revert PR #4818 (#5041) 2024-01-20 18:14:18 -05:00
pyproject.toml py : lower numpy to 2.2.6 (#28654) 2026-09-09 15:56:27 +02:00
pyrightconfig.json ci : switch from pyright to ty (#20826) 2026-03-21 08:54:34 +01:00
README.md docs : update maintainer PRs link and regenerate AUTHORS (#28365) 2026-09-04 10:20:49 +03:00
requirements.txt tool-call: fix Qwen 2.5 Coder support, add micro benchmarks, support trigger patterns for lazy grammars (#12034) 2025-03-05 13:05:13 +00:00
SECURITY.md security : clarify about AI-generated reports (#26579) 2026-08-05 13:27:06 +02:00
ty.toml py : lower numpy to 2.2.6 (#28654) 2026-09-09 15:56:27 +02:00

llama.cpp

llama

Quick start

A few options to get llama.cpp installed on your machine:

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` VLM session with llama cli Built-in web UI against `llama serve` running Qwen 3.6 Built-in web UI against llama serve

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 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

Contributing

  • Contributors can open PRs
  • Collaborators will be invited based on contributions
  • Maintainers can push to branches in the llama.cpp repo and merge PRs into the master branch
  • 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