I followed this tutorial to try and pass through GPUs to a Hyper-V virtual machine:


My system has two NVIDIA 1080 Ti GPUs in it; and for some reason only one of them is fully working. Both of them show up in device manager in the VM:

enter image description here

But in my application that utilizes the GPUs, only one shows up. Here is what I see in my Hyper-V virtual machine:

enter image description here

And here is what I see on the host:

enter image description here

As expected, when attempting to complete the GPU rendering in the VM, it only uses one of the two GPUs.

Is there any way to pass through both of them to the VM instead of only one?

  • Does your CPU and motherboard support IOMMU (Intel) or AMD-Vi (AMD) virtualization technology. This is crucial for proper GPU pass-through
    – Turdie
    Commented Dec 24, 2023 at 13:29
  • @Turdie, I'm not sure how to check if it does. It is an AMD Ryzen 7950X 16-core CPU. Commented Dec 24, 2023 at 15:53
  • You can do that with PowerShell Get-CimInstance -ClassName Win32_Processor | Select-Object Caption,VirtualizationFirmwareEnabled. Look for the "VirtualizationFirmwareEnabled" property. If it's set to "True," AMD-V is enabled. If it's "False," virtualization might be disabled in the BIOS or not supported by your processor.
    – Turdie
    Commented Dec 24, 2023 at 20:30
  • @Turdie, thanks, I checked and it is set to true, so yes, it is enabled. Commented Dec 24, 2023 at 23:24
  • I will answer with a PowerShell script to set everything correct for gpu pass through
    – Turdie
    Commented Dec 24, 2023 at 23:27

1 Answer 1

# Enable Hyper-V and related features
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

# Enable GPU DirectPath I/O (if supported by your hardware)
# Replace 'PCI\VEN_XXXX&DEV_XXXX' with your GPU's Vendor and Device IDs
$gpu1DeviceId = 'PCI\VEN_XXXX&DEV_XXXX'
$gpu2DeviceId = 'PCI\VEN_YYYY&DEV_YYYY'
Add-WindowsFeature Hyper-V-PowerShell

# Create a new VM
New-VM -Name "VMName" -MemoryStartupBytes 4GB -BootDevice VHD -NewVHDPath "C:\Path\To\VM\VMName.vhdx" -NewVHDSizeBytes 50GB

# Add both GPUs to the VM
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(XXXX)#XXX(XXXX)"
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(YYYY)#YYY(YYYY)"

# Configure VM for GPU passthrough
Set-VM -VMName "VMName" -AutomaticStopAction TurnOff -AutomaticStartAction StartIfRunning
Set-VMFirmware -VMName "VMName" -EnableSecureBoot Off

# Start the VM
Start-VM -VMName "VMName"

# Install GPU drivers within the VM

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .