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.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ggml-org/ggml/llms.txt
Use this file to discover all available pages before exploring further.
Requirements
- Vulkan 1.2 capable GPU and driver
- Vulkan SDK (for building from source)
- Linux, Windows, or Android
Build
| Option | Default | Description |
|---|---|---|
GGML_VULKAN=ON | OFF | Enable the Vulkan backend |
GGML_VULKAN_DEBUG=ON | OFF | Enable Vulkan validation layers and debug output |
GGML_VULKAN_MEMORY_DEBUG=ON | OFF | Print memory allocation details |
GGML_VULKAN_SHADER_DEBUG_INFO=ON | OFF | Include shader debug information |
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:Using Vulkan with the scheduler
Combine the Vulkan backend with a CPU fallback:API summary
| Function | Description |
|---|---|
ggml_backend_vk_init(dev_num) | Create a Vulkan backend for the given device index |
ggml_backend_is_vk(backend) | Check whether a backend is the Vulkan backend |
ggml_backend_vk_get_device_count() | Number of available Vulkan devices |
ggml_backend_vk_get_device_description(dev, buf, size) | Human-readable device name |
ggml_backend_vk_get_device_memory(dev, free, total) | Available and total device memory |
ggml_backend_vk_buffer_type(dev_num) | Device-local buffer type |
ggml_backend_vk_host_buffer_type() | Pinned host memory buffer type |
ggml_backend_vk_reg() | Return the Vulkan backend registry entry |
