46 comments

[ 2.1 ms ] story [ 53.8 ms ] thread
Amazing project! But man, that README is just a textbook example of LLM word salad. It's wild how these tools are so incredibly capable at many things, but their writing sticks out like a sore thumb
it's not just literary authorship, it's pretty easy to spot LLM driven programming paradigms too, especially if you look at the test suites of a given package.
When the lines in the ASCII charts don't even line up my immediate assumption is that the author didn't even bother to glance at it.
Claude is much worse for having a distinctive style you can spot from a mile away. I’ve found GPT-6 to not suffer from this or it’s insanely verbose markdown salad.
I see everyone saying this but I've been using 6-astra lately and afaict it's not much better
Can this be used with a Windows guest?
How is this different than gVisor's nvproxy? https://gvisor.dev/docs/user_guide/gpu/#compatibility

Edit: nvproxy is mentioned as the "direct inspiration" in the readme without mention of how this is different or why it doesn't use nvproxy as a backend.

We borrowed a lot of the architectural design from nvproxy, then built it to support graphical workloads. Plus it is reusable in such a way you can hot plug it into any microVM, cloud-hypervisor, maybe even Firecracker
(comment deleted)
What are the isolation implications?
The authors seem to acknowledge it's not so good, but I haven't done my homework so pinch of salt and all that both ways. Use in protected environments only would probably be a good precaution.
Why not use normal GPU passthrough? I don't see how you can use this to share a GPU between multiple VMs, so what is the benefit of using this software over normal GPU passthrough with vfio-pci drivers?
With normal passthrough, your host loses access to the gpu, no? So you need to have two gpus, one for the host and one for the guest. Correct me, if I am wrong, but this should make the host fully operational on a single gpu and still let vm guests have headless access to the host gpu.
Is it really that simple to split an Nvidia GPU between multiple users like that? I thought that you have to have specific drivers which support that.
GeForce GPUs don’t support MIG. Only workstation and data center cards do that.
Hrm, something of a lack of discussion about what level of access the card has to the host in the absence of IOMMU-restricted passthrough.
Smells like KVM/VM escape to host.
There are roughly 3 ways to give a KVM guest a GPU.

1) VFIO passthrough: host binds entire GPU to guest as PCI device, which only allows one VM to use the GPU, thus you sacrifice your host display too (unless you fallback to integrated graphics on cpu etc). Strongest isolation because host kernel module driver not involved.

2) virtio-gpu: guest sees paravirtual GPU and loads virgl/venus mesa driver which serializes graphics API calls and replays them on the host driver. This allows multiple VMs to use the GPU, but performance overhead can be significant, and guests can’t practically leverage lower level primitives eg NVENC without paying price of CPU readback.

3) virtio-nvgpu (this repo): guest loads standard NVIDIA user mode driver (closed source), a fake /dev/nvidia* kernel module copies ioctl bytes + handle onto queue for host kernel mode driver to execute. This also allows multiple VMs to use a GPU, but is near native speed due to low overhead. Unfortunately the tradeoff is this project has the weakest isolation, eg every guest ioctl is forwarded to the host by default, the VMM holds read/write FDs, no seccomp/caps/allowlist. With respect to There is basically no GPU related security measures here, the exposure is the same as running multiple processes using the GPU with no VM. Only caveat is these guests can’t drive a physical display, so there is some restriction of surface area but it feels incidental rather than intentional in this case.

Anyways this is a tough problem OP, I don’t want to discourage you.

Without hardware/driver support for isolation (MIG) on consumer grade NVIDIA GPUs, it won’t be possible to solve this properly for a long time.

Also a factor is that NVIDIA has no open Mesa driver to support a native context approach (guest owns GPU command buffers, host maps them) like we have for AMD/Intel.

What is the state of virtio-gpu these days? I have a system76 "pang14" (Ryzen 7 7840U laptop), is that a valid option for me to have a VM with 3d acceleration? I'm fine with having some overhead if it is better than the current software GPU.
If you don't need Mac or Windows guests then the existing virtio-gpu works in my experience.
This is not a completely novel approach. This has been a thing in virtio-gpu for a while, it's called "DRM native context".
Putting Security aside, do you know how this might complicate bot detections that use GPU or canvas indicators?
(comment deleted)
I'm more interested how this would effect providing VM graphics with migrations between hosts.

The dream would be put the user OS in a VM in a lab, and then be able to suspend and resume seamlessly if you need to push it to a new workstation, with locally accelerated graphics available.

A week or so ago when I stumbled on this he at least seemed to be clear about the potential security implications, which gave me pause. But it doesn't seem any worse than just running software on your main OS which is what most people do. Sure, it's DoA for a hypervisor in a data center but that isn't the only use case out there.

What kinds of things can a guest running undesirably applications (viruses, malware, LLM escaping a sandbox, etc) get up to with shared GPU access?

> Sure, it's DoA for a hypervisor in a data center but that isn't the only use case out there.

Indeed. For me, I find the ecosystem around AI/LLMs works better on Linux than Windows, but Windows is my main OS since I'm a gamer. Being able to run GPU-accelerated AI in a VM is huge for me.

In my case though, I just use WSL which does an amazing job.

> What kinds of things can a guest running undesirably applications (viruses, malware, LLM escaping a sandbox, etc) get up to with shared GPU access?

The most obvious answer is a DoS. If my malicious VM is sharing a GPU and has full access to it, I could simply tell the GPU not to run a victim VM's workload, or manipulate it in some way. I might not be able to pivot to having a shell on their VM, but I could at least read/write their data in VRAM. If it contained secret data (custom model, or secret data being processed by AI), I could easily steal it.

4th solution: nvidia vgpu

If I remember correctly, the idea is that you have a physical GPU and you split its memory (with, eventually, time-budget) to create multiple virtual GPUs, which can then be associated with a KVM guest and use by it

(not available legally on consumer-grade GPU)

I don't believe it's illegal to run your own firmware. It's just not supported by the manufacturer.
vGPU support on consumer cards is more or less just drivers, you can patch it back in and there exist a few git repos to help do so.

I do think at the very least the domain specific workarounds are neat too some, even if not solving every problem. Such as ffmpeg-over-ip, pytorch with remote gpu usage, etc.

isn't there vgpu too? (that thing that needs a license?)
I recently did a similar thing with cgroups2 and lxc

Its an proxmox host with local lxc drm passtrough for monitor + udev perhiperals, then cgroup the nvidia cuda api to other stream lxcs. this way i can play on my local node and friends can play on my pc remotely without anyone hogging the gpu fully.

Here is the writeup(AI gen): https://git.sahkoinsinoorikilta.fi/joona/hyper-converged-gam...

Poorly implemented roll your own overbroad backlisting thinks I'm 'suspicious'.
I'm a guy with vague knowledge on KVM - having only tinkered with it and briefly had a GPU pass-through setup 2 years ago.

I suggest putting the 'multiple guests at near-native speed' use-case in the opening paragraphs of the README.

will this finally allow for a gpu-accelerated windows VM on a linux host, without nvidia vGPU licenses?
Excited to try this, I've wanted for so long to have a properly performant gaming VM without having to do all the VFIO nonsense, thanks very much.