Show HN: CUDA/graphics in QEMU-KVM VMs without passing the Nvidia card to them
github.comHi HN. I built this because I wanted a VM with a real GeForce GPU without losing the card on my desktop.
It allows you to run CUDA and graphics in VMs without VFIO/vGPU by forwarding the NVIDIA driver's own ioctl surface from the guest to the host.
That means stock libcuda and real Vulkan ICD run in the guest - no CUDA/Vulkan API remoting or translation. Display, LLM, CUDA, headless supported. Your desktop keeps using the same card, multiple VMs supported.
Happy to go into the details of the architecture.
This is super interesting and potentially extremely useful as well. What is the performance improvements against doing it via API remoting or translating?
It reaches parity because CUDA's hot path isn't forwarded at all. nvkvm forwards the ioctl control surface: context and channel setup, allocation, mapping and stops there. The guest maps the real device memory, so BAR writes from userspace go straight to hardware, and launching a kernel is a write to memory the guest already has in its VA space.