henrique-simoes/llama.cpp

llama.cpp fork: DFlash2 speculative decoding with --split-mode tensor on multi-GPU (port of upstream PR #27858), measured on 2x RTX 5060 Ti with Qwen3.8-27B

C++

0

9,598 commits

updated Oct 12, 2026

See the code

See what people are saying

SourceMessageScoreDate

The space is moving quick. 2x 4060 Tensor Parallel main weights. RPC offload the drafters to amd strix. Got +2-3GB Vram for context at no perf cost. (r/LocalLLaMA)

Mixing Nvidia+AMD hardware via RPC usually meant split-mode layer only. I managed to keep **split-mode tensor** working, and patch my llama-rpc to send the drafters over to my strix. That let me go from 150k -> 195k context, at the same tensor parallel speed.. nice. My agents helped with a TON of…

13

Oct 15, 2026

README

llama.cpp fork: DFlash2 speculative decoding with --split-mode tensor (multi-GPU)

What this fork is. ggml-org/llama.cpp at build b11552 plus a small patch set that lets the DFlash2 draft model run while the target model is split across GPUs in tensor mode (-sm tensor). Upstream aborts at load with this combination. The fix is a hand port of upstream pull request #27858 by @art-den to a newer tree; the design and nearly all of the code are theirs. This is a working branch for one machine, not an official llama.cpp release and not proposed upstream.

Who it is for: anyone running a large model on two or more NVIDIA GPUs with llama-server, who wants both the tensor split (all cards work on every layer) and the DFlash2 block drafter at the same time.

Measured result (Qwen3.8-27B UD-Q4_K_XL, 2 × RTX 5060 Ti 16 GB, 262,144-token context, 8-bit KV cache, decode in tokens per second, code task / prose task):

Context depthUpstream-style layer split + DFlash2Tensor split + MTPThis branch: tensor split + DFlash2
4K70.5 / 40.962.7 / 45.084.2 / 53.9
32K66.1 / 38.156.2 / 44.783.8 / 50.6
128K37.4 / 26.240.9 / 29.361.4 / 35.2
230K24.6 / 16.530.8 / 23.641.9 / 31.1

Output check: the target model's log-probabilities match the layer-split server within the preset limit (mean KL 0.0013) and are bit-identical to tensor split + MTP on the probes.

What differs from upstream llama.cpp

ChangeWhyUpstream reference
DFlash2 candidate selector runs on the CPU when the output matrix is split across GPUsmakes --spec-type draft-dflash work with -sm tensorPR #27858 (open), ported here
Recurrent state of a new sequence is cleared with a fill instead of a multiply by zeroNaN × 0 is NaN; one bad state otherwise poisons every later requestissue #29830
A request may lower the draft depth with speculative.n_maxper-request draft depth for measurementsfield exists upstream but is disabled
Docker build uses -j6local build setting—

How to use it

docker build -f .devops/cuda.Dockerfile --target server -t llamacpp-dflash2-tensor .

GGML_CUDA_ALLREDUCE=internal llama-server -m <target>.gguf -ngl 99 -sm tensor -fit off -c 262144 \
  -fa on -ctk q8_0 -ctv q8_0 --spec-type draft-dflash -md <dflash2-draft>.gguf -ngld 99 --spec-draft-n-max 7

Do not pin the drafter to one GPU (-devd): it must inherit the tensor split, otherwise the server aborts at load. Full details, method, all numbers, tests and limits: MULTIVAC.md.

Branches: mv/dflash-tp (this one, default) holds everything above; mv/base, mv/fill, mv/reqdraft are its steps; master follows upstream. The original llama.cpp README follows unchanged.


llama.cpp

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

BackendTarget devices
BLASAll
BLISAll
CANNAscend NPU
CUDANvidia GPU
HIPAMD GPU
HexagonSnapdragon
IBM zDNNIBM Z & LinuxONE
MUSAMoore Threads GPU
MetalApple Silicon
OpenCLAdreno GPU
OpenVINO [In Progress]Intel CPUs, GPUs, and NPUs
RPCAll
SYCLIntel GPU
VirtGPUVirtGPU APIR
VulkanGPU
WebGPUAll
ZenDNNAMD 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
cuda
dflash2
llama-cpp
llm-inference
multi-gpu
qwen
speculative-decoding
tensor-parallelism

henrique-simoes/llama.cpp

llama.cpp fork: DFlash2 speculative decoding with --split-mode tensor on multi-GPU (port of upstream PR #27858), measured on 2x RTX 5060 Ti with Qwen3.8-27B

C++

0

9,598 commits

updated Oct 12, 2026

See the code

See what people are saying

SourceMessageScoreDate

The space is moving quick. 2x 4060 Tensor Parallel main weights. RPC offload the drafters to amd strix. Got +2-3GB Vram for context at no perf cost. (r/LocalLLaMA)

Mixing Nvidia+AMD hardware via RPC usually meant split-mode layer only. I managed to keep **split-mode tensor** working, and patch my llama-rpc to send the drafters over to my strix. That let me go from 150k -> 195k context, at the same tensor parallel speed.. nice. My agents helped with a TON of…

13

Oct 15, 2026

README

llama.cpp fork: DFlash2 speculative decoding with --split-mode tensor (multi-GPU)

What this fork is. ggml-org/llama.cpp at build b11552 plus a small patch set that lets the DFlash2 draft model run while the target model is split across GPUs in tensor mode (-sm tensor). Upstream aborts at load with this combination. The fix is a hand port of upstream pull request #27858 by @art-den to a newer tree; the design and nearly all of the code are theirs. This is a working branch for one machine, not an official llama.cpp release and not proposed upstream.

Who it is for: anyone running a large model on two or more NVIDIA GPUs with llama-server, who wants both the tensor split (all cards work on every layer) and the DFlash2 block drafter at the same time.

Measured result (Qwen3.8-27B UD-Q4_K_XL, 2 × RTX 5060 Ti 16 GB, 262,144-token context, 8-bit KV cache, decode in tokens per second, code task / prose task):

Context depthUpstream-style layer split + DFlash2Tensor split + MTPThis branch: tensor split + DFlash2
4K70.5 / 40.962.7 / 45.084.2 / 53.9
32K66.1 / 38.156.2 / 44.783.8 / 50.6
128K37.4 / 26.240.9 / 29.361.4 / 35.2
230K24.6 / 16.530.8 / 23.641.9 / 31.1

Output check: the target model's log-probabilities match the layer-split server within the preset limit (mean KL 0.0013) and are bit-identical to tensor split + MTP on the probes.

What differs from upstream llama.cpp

ChangeWhyUpstream reference
DFlash2 candidate selector runs on the CPU when the output matrix is split across GPUsmakes --spec-type draft-dflash work with -sm tensorPR #27858 (open), ported here
Recurrent state of a new sequence is cleared with a fill instead of a multiply by zeroNaN × 0 is NaN; one bad state otherwise poisons every later requestissue #29830
A request may lower the draft depth with speculative.n_maxper-request draft depth for measurementsfield exists upstream but is disabled
Docker build uses -j6local build setting—

How to use it

docker build -f .devops/cuda.Dockerfile --target server -t llamacpp-dflash2-tensor .

GGML_CUDA_ALLREDUCE=internal llama-server -m <target>.gguf -ngl 99 -sm tensor -fit off -c 262144 \
  -fa on -ctk q8_0 -ctv q8_0 --spec-type draft-dflash -md <dflash2-draft>.gguf -ngld 99 --spec-draft-n-max 7

Do not pin the drafter to one GPU (-devd): it must inherit the tensor split, otherwise the server aborts at load. Full details, method, all numbers, tests and limits: MULTIVAC.md.

Branches: mv/dflash-tp (this one, default) holds everything above; mv/base, mv/fill, mv/reqdraft are its steps; master follows upstream. The original llama.cpp README follows unchanged.


llama.cpp

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

BackendTarget devices
BLASAll
BLISAll
CANNAscend NPU
CUDANvidia GPU
HIPAMD GPU
HexagonSnapdragon
IBM zDNNIBM Z & LinuxONE
MUSAMoore Threads GPU
MetalApple Silicon
OpenCLAdreno GPU
OpenVINO [In Progress]Intel CPUs, GPUs, and NPUs
RPCAll
SYCLIntel GPU
VirtGPUVirtGPU APIR
VulkanGPU
WebGPUAll
ZenDNNAMD 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
cuda
dflash2
llama-cpp
llm-inference
multi-gpu
qwen
speculative-decoding
tensor-parallelism