Skip to the content.

virtio-gpu: Vulkan on the host GPU for Linux guests

A new graphics controller, VirtioGpu. As a 2D display it replaces the VGA-style device. With 3D Acceleration ticked (Settings → Display, or VBoxManage modifyvm <vm> --accelerate-3d on), a Linux guest with the Mesa Venus driver sees the host’s graphics card as a Vulkan device, so it can run Vulkan programs and GPU compute such as llama.cpp.

Results

Measured on an RTX 5070 host. The guest is Fedora 44 with 4 virtual CPUs; the CPU column runs the same model on those 4 virtual CPUs. Models are Qwen2.5 in 4-bit form, run with llama-bench.

  Guest CPU Host GPU through virtio-gpu
0.5B, prompt / generation (tokens per second) 483 / 108 5,218 / 74
3B, prompt / generation 97 / 23.5 4,200–7,100 / 67–81
7B, prompt / generation not measured 3,696 / 60
Loading a 2 GB model   7 s

Desktop graphics: use VMSVGA

For ordinary OpenGL desktop work VMSVGA is much faster, and a windowed Vulkan program is slower through virtio-gpu than on the CPU renderer:

glmark2, off-screen Score
VMSVGA (host GPU through DX11) about 15,100
OpenGL on virtio-gpu (Zink, on the Intel GPU) about 1,700
CPU renderer (llvmpipe) about 1,440

Windowed vkmark scored 213–277 through virtio-gpu and 933 on the CPU renderer, because a windowed frame has to be copied to the guest compositor. Off-screen Vulkan is fast (vkcube about 800 frames per second). So: virtio-gpu for compute and off-screen Vulkan, VMSVGA for the desktop.

How it works

Bugs found while building it

Tested

Parallel Vulkan processes that create and destroy contexts and mappings in every order (including exiting with everything mapped), kill -9 at random, unbinding the guest driver under load, pausing the VM and resetting it. After every phase the device was empty again and the VM was still running; on a fresh guest the guest log had no virtio-gpu errors.

Limits