Uh oh!
There was an error while loading. Please reload this page.
Adding qemu vm driver support with GPU pass-through - #992
Conversation
Uh oh!
There was an error while loading. Please reload this page.
7a747ab to
98c8ecaCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| /// Target a specific GPU by PCI address (e.g. "0000:2d:00.0") or index (e.g. "0", "1"). | ||
| /// Only valid with --gpu. When omitted with --gpu, the first available GPU is assigned. | ||
| #[arg(long, requires = "gpu")] | ||
| gpu_device: Option<String>, |
There was a problem hiding this comment.
Just to clarify, this is not specific to the VM driver and could be mapped to requests in k8s, Docker, or Podman?
As a follow up question: Does it make sense to allow gpu_device to be specified multiple times to allow for multiple devices, or should validation (e.g. a comma-separated list) be delegated to the driver?
There was a problem hiding this comment.
Good question on both points. Yes, --gpu and --gpu-device are intentionally driver-agnostic — the proto defines them on CreateSandboxRequest and DriverSandboxSpec, so k8s/Docker/Podman drivers can map them to their native GPU request mechanisms. For multi-device: today the proto field is a single string, so multi-GPU per sandbox would need a proto change (repeated string gpu_devices) plus inventory updates. I propose to update this in a follow-up PR.
There was a problem hiding this comment.
I'm fine with a follow-up. Would an issue to discuss how users are expected to request GPUs be a good place to have a follow-up discussion? Some of the basic use cases that I can see are:
- A user wants a sandbox with any GPU. (count == 1)
- A user wants a sandbox with a specific number of GPUs. (count > 1).
- A user wants a sandbox with a SPECIFIC set of GPUs. (Specified by driver-specific IDs).
A more advanced use case that one could also start discussing is when a user wants a sandbox with access to one or more GPUs with specific properties. I would assume that this could also be reduced to a set of driver-specific IDs though, so maybe it is sufficient to demonstrate this transform.
| driver_version: openshell_core::VERSION.to_string(), | ||
| default_image: self.config.default_image.clone(), | ||
| supports_gpu: self.has_gpu_capacity().await.unwrap_or(false), | ||
| gpu_count: 0, |
There was a problem hiding this comment.
Question: is a raw int rich enough here? Should a driver expose the valid names of devices that are available, for example?
There was a problem hiding this comment.
Agreed, a raw int is limited. A richer repeated GpuDeviceInfo message (with BDF, device name, availability) on GetCapabilitiesResponse would let the CLI show available devices and validate --gpu-device client-side. I propose to address this, along with the previous one, in a follow-up PR.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| // there is a single OPENSHELL_ENDPOINT value in the env list. | ||
| let endpoint_override = if gpu_bdf.is_some() { | ||
| let subnet = match self | ||
| .subnet_allocator |
There was a problem hiding this comment.
The name subnet_allocator does not make it clear that this is required for GPU injection. If they're dependent on each other, maybe there's a better way to indicate this relationship.
There was a problem hiding this comment.
Good point — TAP subnet allocation is exclusively a GPU concern. I suggest a follow-up where I can move SubnetAllocator into GpuInventory (or a new GpuNetworking wrapper) so the dependency is structurally explicit rather than relying on naming alone. That'll also let us wrap both behind the existing Option<Arc<Mutex<...>>> gate and skip initialization when GPUs are disabled.
There was a problem hiding this comment.
TAP subnet allocation is exclusively a GPU concern
Not knowing enough about why this is required, a naive question I would have is whether this is always the case, or only the case for the current vm driver feature set? Is it realistic that a user would expect to be able to configure something like this in the future?
A follow up to make the dependency structurally explicit sounds good though.
Signed-off-by: Vincent Caux-Brisebois <vcauxbrisebo@nvidia.com>
b052bde to
76e54d8Compare…upervisor reliability issues discovered during GPU VM bring-up. Signed-off-by: Vincent Caux-Brisebois <vcauxbrisebo@nvidia.com>
76e54d8 to
38f069eCompare@vince-brisebois@elezar I want to try this out I have an x86_64 laptop with Windows (could be flashed with bare metal linux if needs be). I understand this is experimental, but is this worth a shot on (rough edges are fine)? DGX Spark |
ericcurtin
commented
May 6, 2026
Also I'll have to flash a machine to test this, a recommendation on OS this works best would be helpful: RHEL 10 |
Summary
Add QEMU backend support to the VM compute driver with VFIO GPU passthrough, enabling GPU-accelerated sandboxes on hosts without libkrun support. Includes a new openshell-vfio crate for safe GPU bind/unbind lifecycle, TAP networking with RAII cleanup, guest init GPU initialization, and automatic gateway registration in start.sh.
Related Issue
Changes
Testing
mise run pre-commitpassesChecklist