Developer Tools

llama.cpp b9622 boosts Vulkan with non-contiguous ops and fastdiv

Faster unary/GLU operations on GPU with better stride handling and expm1 precision.

Deep Dive

llama.cpp's latest release, b9622, brings significant optimizations to its Vulkan GPU backend. The update overhauls how unary and GLU (gated linear unit) operations handle non-contiguous memory layouts—a common scenario when running large language models on GPU. Instead of assuming contiguous tensors, the new code passes all stride information and uses fast division (fastdiv) for index calculations, which reduces computational overhead and improves throughput. Additionally, the team added the expm1 activation function (exp(x)-1) after conducting a careful precision analysis, ensuring numerical stability across hardware. These changes required refactoring the unary operation code into a single file and packing fastdiv constants to work around compiler quirks.

The release was extensively validated across a wide range of platforms: macOS Apple Silicon (both with and without KleidiAI), Intel x64, iOS, Linux on x64, arm64, s390x, Ubuntu with Vulkan and ROCm 7.2, OpenVINO, SYCL, Android arm64, Windows x64/arm64 with CUDA 12/13 and Vulkan, and even openEuler variants. This broad testing guarantees that the performance gains are reliable whether you're running local models on a gaming PC, a MacBook, or a server-grade AMD GPU. For developers self-hosting models like Llama, Mistral, or Gemma, b9622 means faster inference and lower latency for operations involving GLU activations (common in modern transformers) without breaking compatibility across diverse hardware setups.

Key Points
  • Vulkan backend now supports non-contiguous unary and GLU operations, using fastdiv for efficient index calculation.
  • Added expm1 function with rigorous precision analysis to avoid numerical instability.
  • Tested on 15+ configurations including macOS, Linux, Windows, Android, and openEuler across CPU and GPU backends.

Why It Matters

Faster local LLM inference on GPUs via improved Vulkan handling of non-contiguous tensors—key for performant self-hosted AI.

📬 Get the top 10 AI stories daily