This fork adds Adaptive KV Streaming and RDNA 4 (gfx1201) / ROCm optimizations to llama.cpp. It allows consumer GPUs with 16 GB VRAM (such as the AMD Radeon RX 9070 XT) to execute models like Qwen3.8-27B (IQ4_XS model weights, Q8_0 K / Q4_0 V cache) across their full 262,144-token context window without running out of memory, delivering 80+ t/s decode generation and 1,400+ t/s prefill throughput.
mmvq with 4 rows per block tuned for RDNA 4 wave dispatch.mmvq, and fused gated delta net (GDN) recurrent kernels.mmvq.This work builds on concepts from RaymondHuang210129/llama.cpp-adaptive-kv-streaming and stew675/llama-cpp-rdna-boosts, re-implemented specifically for RDNA 4 hardware targets in ROCm/HIP.
The configurations and benchmarks in this repository use Qwen3.8-27B (ASCII-condensed IQ4_XS, 12.63 GiB): bsaleh03/Qwen3.8-27B-ASCII-Condensed. Another option would be troed/Qwen3.8-27B-ASCII-Condensed.
gfx1201, RDNA 4) or compatible ROCm GPU with >= 16 GB VRAM.nix run .#serve-openai -- -m /path/to/Qwen3.8-27B-ASCII-Condensed-UD-IQ4_XS.gguf
Follow official documentation to install AMD ROCm for your distribution.
# Build
cmake -B build-rocm -G Ninja \
-DCMAKE_C_COMPILER=hipcc \
-DCMAKE_CXX_COMPILER=hipcc \
-DGGML_HIP=ON \
-DAMDGPU_TARGETS=gfx1201 \
-DGGML_HIP_NO_VMM=ON \
-DGGML_CUDA_FA_QUANTS="q4_0-q4_0,q8_0-q8_0,f16-f16,bf16-bf16,q8_0-q4_0" \
-DGGML_BACKEND_DL=OFF
cmake --build build-rocm --config Release -j$(nproc)
# Launch server
export ROCR_VISIBLE_DEVICES=0
export GPU_MAX_HW_QUEUES=2
export DEBUG_HIP_FORCE_ASYNC_QUEUE=1
export DEBUG_HIP_FORCE_GRAPH_QUEUES=1
./build-rocm/bin/llama-server \
-m /path/to/Qwen3.8-27B-ASCII-Condensed-UD-IQ4_XS.gguf \
--host 127.0.0.1 --port 8080 \
-c 262144 -np 1 -dev ROCm0 -fa on -fit off \
-ctk q8_0 -ctv q4_0 -ctkd q8_0 -ctvd q4_0 \
--kv-stream \
--kv-resident-mib 450 \
--kv-resident-mib-decode 2100 \
--spec-type draft-mtp,ngram-mod \
--spec-ngram-mod-n-max 16 \
--spec-ngram-mod-n-min 12 \
--spec-ngram-mod-n-match 24 \
--spec-draft-sampling probabilistic \
-b 2048 -ub 512
gfx1201), PCIe 5.0 x16, ROCm 7.2.3.bd063a49a (feature/adaptive-kv-stream-rocm).23f7aabc1 (upstream/master), compiled with identical ROCm flags.sqlite3.c) scaled to context ladder depths (1k, 4k, 16k, 64k, 128k, 256k), prompting a standard helper function implementation (sqlite3_custom_column_hash)./completion JSON timings.
| Context Depth | Stock llama.cpp | Stock + MTP | This Fork | This Fork + MTP |
|---|---|---|---|---|
| 1,024 tokens | 33.87 t/s | 65.83 t/s | 36.53 t/s (+7.8%) | 71.83 t/s (+9.1%) |
| 4,096 tokens | 33.46 t/s | 66.00 t/s | 36.22 t/s (+8.2%) | 86.51 t/s (+31.1%) |
| 16,384 tokens | 30.27 t/s | 59.58 t/s | 35.54 t/s (+17.4%) | 81.11 t/s (+36.1%) |
| 65,536 tokens | 21.33 t/s | 37.87 t/s | 32.13 t/s (+50.6%) | 72.89 t/s (+92.5%) |
| 131,072 tokens | OOM | OOM | 26.96 t/s | 78.60 t/s |
| 262,144 tokens | OOM | OOM | 9.50 t/s | 31.08 t/s (+227.2%) |
| Context Depth | Stock llama.cpp | This Fork |
|---|---|---|
| 1,024 tokens | 1,287.9 t/s | 1,368.4 t/s |
| 4,096 tokens | 1,464.2 t/s | 1,517.0 t/s |
| 16,384 tokens | 1,402.5 t/s | 1,443.7 t/s |
| 65,536 tokens | 1,096.1 t/s | 1,120.3 t/s |
| 131,072 tokens | OOM | 863.0 t/s |
| 262,144 tokens | OOM | 585.8 t/s |
I have been using this setup for multi-turn agentic coding sessions. Here are the aggregated results from these sessions:

While the measurements above were taken at 300W TDP, operating with a 231W power limit (-24% power reduction relative to 304W default TDP) incurs only a 3.6% prefill latency and exhibits virtually identical decode throughput, providing significant power and thermal savings for real-world workloads.
(Original upstream llama.cpp documentation follows below)
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:
# 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
|
|
|
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.
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 |
llama.cpp repo and merge PRs into the master branchllama-server - MIT licenseThis fork adds Adaptive KV Streaming and RDNA 4 (gfx1201) / ROCm optimizations to llama.cpp. It allows consumer GPUs with 16 GB VRAM (such as the AMD Radeon RX 9070 XT) to execute models like Qwen3.8-27B (IQ4_XS model weights, Q8_0 K / Q4_0 V cache) across their full 262,144-token context window without running out of memory, delivering 80+ t/s decode generation and 1,400+ t/s prefill throughput.
mmvq with 4 rows per block tuned for RDNA 4 wave dispatch.mmvq, and fused gated delta net (GDN) recurrent kernels.mmvq.This work builds on concepts from RaymondHuang210129/llama.cpp-adaptive-kv-streaming and stew675/llama-cpp-rdna-boosts, re-implemented specifically for RDNA 4 hardware targets in ROCm/HIP.
The configurations and benchmarks in this repository use Qwen3.8-27B (ASCII-condensed IQ4_XS, 12.63 GiB): bsaleh03/Qwen3.8-27B-ASCII-Condensed. Another option would be troed/Qwen3.8-27B-ASCII-Condensed.
gfx1201, RDNA 4) or compatible ROCm GPU with >= 16 GB VRAM.nix run .#serve-openai -- -m /path/to/Qwen3.8-27B-ASCII-Condensed-UD-IQ4_XS.gguf
Follow official documentation to install AMD ROCm for your distribution.
# Build
cmake -B build-rocm -G Ninja \
-DCMAKE_C_COMPILER=hipcc \
-DCMAKE_CXX_COMPILER=hipcc \
-DGGML_HIP=ON \
-DAMDGPU_TARGETS=gfx1201 \
-DGGML_HIP_NO_VMM=ON \
-DGGML_CUDA_FA_QUANTS="q4_0-q4_0,q8_0-q8_0,f16-f16,bf16-bf16,q8_0-q4_0" \
-DGGML_BACKEND_DL=OFF
cmake --build build-rocm --config Release -j$(nproc)
# Launch server
export ROCR_VISIBLE_DEVICES=0
export GPU_MAX_HW_QUEUES=2
export DEBUG_HIP_FORCE_ASYNC_QUEUE=1
export DEBUG_HIP_FORCE_GRAPH_QUEUES=1
./build-rocm/bin/llama-server \
-m /path/to/Qwen3.8-27B-ASCII-Condensed-UD-IQ4_XS.gguf \
--host 127.0.0.1 --port 8080 \
-c 262144 -np 1 -dev ROCm0 -fa on -fit off \
-ctk q8_0 -ctv q4_0 -ctkd q8_0 -ctvd q4_0 \
--kv-stream \
--kv-resident-mib 450 \
--kv-resident-mib-decode 2100 \
--spec-type draft-mtp,ngram-mod \
--spec-ngram-mod-n-max 16 \
--spec-ngram-mod-n-min 12 \
--spec-ngram-mod-n-match 24 \
--spec-draft-sampling probabilistic \
-b 2048 -ub 512
gfx1201), PCIe 5.0 x16, ROCm 7.2.3.bd063a49a (feature/adaptive-kv-stream-rocm).23f7aabc1 (upstream/master), compiled with identical ROCm flags.sqlite3.c) scaled to context ladder depths (1k, 4k, 16k, 64k, 128k, 256k), prompting a standard helper function implementation (sqlite3_custom_column_hash)./completion JSON timings.
| Context Depth | Stock llama.cpp | Stock + MTP | This Fork | This Fork + MTP |
|---|---|---|---|---|
| 1,024 tokens | 33.87 t/s | 65.83 t/s | 36.53 t/s (+7.8%) | 71.83 t/s (+9.1%) |
| 4,096 tokens | 33.46 t/s | 66.00 t/s | 36.22 t/s (+8.2%) | 86.51 t/s (+31.1%) |
| 16,384 tokens | 30.27 t/s | 59.58 t/s | 35.54 t/s (+17.4%) | 81.11 t/s (+36.1%) |
| 65,536 tokens | 21.33 t/s | 37.87 t/s | 32.13 t/s (+50.6%) | 72.89 t/s (+92.5%) |
| 131,072 tokens | OOM | OOM | 26.96 t/s | 78.60 t/s |
| 262,144 tokens | OOM | OOM | 9.50 t/s | 31.08 t/s (+227.2%) |
| Context Depth | Stock llama.cpp | This Fork |
|---|---|---|
| 1,024 tokens | 1,287.9 t/s | 1,368.4 t/s |
| 4,096 tokens | 1,464.2 t/s | 1,517.0 t/s |
| 16,384 tokens | 1,402.5 t/s | 1,443.7 t/s |
| 65,536 tokens | 1,096.1 t/s | 1,120.3 t/s |
| 131,072 tokens | OOM | 863.0 t/s |
| 262,144 tokens | OOM | 585.8 t/s |
I have been using this setup for multi-turn agentic coding sessions. Here are the aggregated results from these sessions:

While the measurements above were taken at 300W TDP, operating with a 231W power limit (-24% power reduction relative to 304W default TDP) incurs only a 3.6% prefill latency and exhibits virtually identical decode throughput, providing significant power and thermal savings for real-world workloads.
(Original upstream llama.cpp documentation follows below)
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:
# 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
|
|
|
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.
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 |
llama.cpp repo and merge PRs into the master branchllama-server - MIT license