kernel-anvil: 2x AMD Decode Speedup
💡First AMD kernel auto-tuner doubles llama.cpp speed on RDNA3—NVIDIA tools no more
⚡ 30-Second TL;DR
What Changed
Profiles unique GEMV shapes from GGUF and auto-tunes nwarps/rows_per_block
Why It Matters
This is the first AMD-specific kernel optimizer, unlocking untapped performance in llama.cpp on RDNA3 hardware. It democratizes high-speed local inference for AMD users, previously NVIDIA-focused.
What To Do Next
pip install kernel-anvil and run 'kernel-anvil gguf-optimize your-model.gguf' on RDNA3 GPU.
Key Points
- •Profiles unique GEMV shapes from GGUF and auto-tunes nwarps/rows_per_block
- •2.25x speedup on Qwen3.5-27B Q4_K_M (12 to 27 tok/s) on 7900 XTX
- •Profiling takes <1s with 193 tests; works on RDNA3 GPUs
- •Small ~50-line patch to llama.cpp's mmvq.cu for runtime config loading
🧠 Deep Insight
AI-generated analysis for this event — not the original article.
🔑 Enhanced Key Takeaways
- •Kernel-anvil leverages the ROCm HIP backend to bypass static kernel compilation limitations, allowing for dynamic tuning of occupancy parameters that are typically hardcoded in llama.cpp's upstream build.
- •The tool specifically addresses the 'wavefront occupancy' bottleneck on RDNA3 architectures, where default llama.cpp configurations often fail to saturate the GPU's compute units during memory-bound decode operations.
- •Integration requires a runtime hook that intercepts the GEMV (General Matrix-Vector multiplication) dispatch, enabling the injection of custom block/warp dimensions derived from the initial profiling phase.
🛠️ Technical Deep Dive
- •Targets the mmvq (Matrix-Matrix Vector Quantized) kernel in llama.cpp, which is the primary bottleneck for prompt processing and token generation on AMD hardware.
- •Profiling mechanism: Executes a micro-benchmark suite (193 iterations) that iterates through permutations of 'nwarps' (number of warps per block) and 'rows_per_block' to find the optimal occupancy for the specific GPU's memory bandwidth.
- •Implementation: Uses a JSON-based configuration file generated during the profiling step, which the patched llama.cpp reads at runtime to override default kernel launch parameters.
- •Architecture focus: Specifically optimizes for the 32-wide wavefront size characteristic of AMD RDNA3, which differs significantly from NVIDIA's 32-thread warp architecture, often causing suboptimal performance when using generic CUDA-ported kernels.
🔮 Future ImplicationsAI analysis grounded in cited sources
Weekly AI Recap
Read this week's curated digest of top AI events →
👉Related Updates
AI-curated news aggregator. All content rights belong to original publishers.
Original source: Reddit r/LocalLLaMA ↗
This is a summary, not the original. Read the source, or get the weekly briefing.
Weekly AI briefing
One email a week. Unsubscribe anytime.

