Skip to content

About

LLM inference in C/C++

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

12,053 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llama.cpp-sm_61

This is Dimonyga/llama.cpp-sm_61, a fork of ggml-org/llama.cpp focused on NVIDIA Pascal sm_61 GPUs and Vulkan on older AMD Radeon cards, especially GCN/Vega. It follows upstream and carries targeted performance changes plus selected server, audio and GGML features. Some optimizations are adapted from ik_llama.cpp.

What this fork adds

  • Pascal / sm_61: DP4A matrix-vector and matrix-matrix tuning, including IQ4_XS; four-row MMVQ dispatch; a GQA-aware single-token Flash Attention path for Q4_0 K/V caches; and changes to GDN and tiled attention for supported shapes. These paths target GPUs such as the GTX 1080 Ti and use architecture and layout checks to select compatible kernels.
  • Older Radeon / Vulkan: GCN Q4_0 KV-cache dequantization with transpose, tiled transpose-concat for GDN, and IQ4_XS matrix-vector shader changes. Subgroup RMS normalization and smaller workgroups, initially backported here, are now also part of the merged upstream code. Build options can omit cooperative-matrix shaders on devices that do not support them.
  • CPU inference: tiled Flash Attention for Q4_0 and Q8_0 caches, including mixed K/V types, and split-SwiGLU graph fusion in the Qwen3.5 and Qwen3-Next paths.
  • Audio API: Gemma 4 transcription and translation prompts, /v1/audio/translations with target_language, text/JSON/subtitle response formats, an FFmpeg decoding fallback, and /v1/audio/speech as an alias of /tts. Qwen3-TTS VoiceDesign accepts voice descriptions through instruct or instructions. See the server documentation and TTS documentation.
  • Server statistics: --moe-routing-log records expert-selection counts; --tensor-stats collects activation statistics from served traffic as a GGUF importance matrix for quantization. Both are opt-in and add synchronization overhead.
  • GGML extensions for stable-diffusion.cpp integration: FP8 conversion paths, INT8 matrix operations with ConvRot preprocessing, RoPE application, and CUDA SageAttention/SOL attention operators. Support depends on the backend and GPU; SageAttention and SOL attention require newer NVIDIA architectures and are separate from the Pascal optimizations.

Optimizations apply to specific devices, quantization types and tensor layouts. Performance depends on the model, workload, driver and build configuration. The presence of a kernel is not a claim that every supported GPU or model has been benchmarked.

Build this fork

Clone this repository and build from source to include its changes. The upstream installers, binaries, container images and release badges in the inherited documentation below refer to upstream builds.

git clone https://github.com/Dimonyga/llama.cpp-sm_61.git
cd llama.cpp-sm_61

For NVIDIA Pascal sm_61, use a CUDA toolkit that supports compiling for compute capability 6.1:

cmake -S . -B build-cuda -DCMAKE_BUILD_TYPE=Release \
    -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=61 \
    -DGGML_VULKAN=OFF -DGGML_METAL=OFF -DLLAMA_BUILD_TESTS=ON
cmake --build build-cuda --parallel

For older Radeon cards using Vulkan:

cmake -S . -B build-vulkan -DCMAKE_BUILD_TYPE=Release \
    -DGGML_VULKAN=ON -DGGML_CUDA=OFF -DGGML_METAL=OFF \
    -DGGML_VULKAN_NO_COOPMAT=ON -DGGML_VULKAN_NO_COOPMAT2=ON \
    -DLLAMA_BUILD_TESTS=ON
cmake --build build-vulkan --parallel

The two NO_COOPMAT options omit cooperative-matrix shaders for a build targeting devices without those features. Leave them off for builds that should also use cooperative matrices on newer GPUs. See docs/build.md for dependencies and platform-specific setup.

Source archive for a build host

Create llama.cpp-YYYYMMDDHHmm.tar.gz in the repository root, or pass an output directory:

python3 scripts/package_sources.py
python3 scripts/package_sources.py /path/to/output

The script needs Python 3 and Git on the packaging machine. It includes current working-tree files from the native source directories, including local edits and new non-ignored source files, all GGML backends, bundled dependencies, licenses, tools and chat templates. It excludes Web UI sources and assets, examples, tests and benchmark suites, documentation directories, CI files, model weights, Git history and Git-ignored build outputs. Native tools such as llama-bench remain included. Three small UI build files remain to generate the server's empty asset table. An existing archive with the same name is not overwritten.

Extract on the build host and load the included source-build.cmake initial cache. It disables both UI building and prebuilt UI downloads, examples and tests, and preserves the source revision in the build information. Add the backend flags needed for the host, for example Pascal CUDA:

tar -xzf llama.cpp-YYYYMMDDHHmm.tar.gz
cmake -S llama.cpp -B build -C llama.cpp/source-build.cmake \
    -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=61 \
    -DGGML_VULKAN=OFF -DGGML_METAL=OFF
cmake --build build --parallel

The original upstream README follows.


llama

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

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

About

LLM inference in C/C++

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages