The Vulkan backend runs tensor operations on any GPU with a Vulkan 1.2+ driver. It covers NVIDIA, AMD, Intel, Qualcomm, and ARM Mali GPUs on Linux, Windows, and Android — making it the most portable GPU backend.
Requirements
- Vulkan 1.2 capable GPU and driver
- Vulkan SDK (for building from source)
- Linux, Windows, or Android
Build
Useful CMake options:
Install the Vulkan SDK from lunarg.com/vulkan-sdk on Linux and Windows. On Android, the Vulkan driver is provided by the device vendor.
Initialization
Device enumeration
Enumerate all available Vulkan devices before selecting one:
The maximum number of Vulkan devices is GGML_VK_MAX_DEVICES (16).
Buffer types
The Vulkan backend provides two buffer types:
Use the host buffer type for input tensors that change every forward pass. Pinned memory avoids redundant copies through the Vulkan transfer queue.
Using Vulkan with the scheduler
Combine the Vulkan backend with a CPU fallback:
The scheduler assigns each graph node to the backend that supports it. Operations not yet implemented in Vulkan fall back to the CPU automatically.
API summary