Hyper-V GPU partitioning for Windows guests

Setting up the host

Make sure to turn off the virtual machine before proceeding.

  1. Get a list of partitionable GPUs (optional):
    • Windows 10: Get-VMPartitionableGpu
    • Windows 11: Get-VMHostPartitionableGpu
  2. Remove any existing partitioned GPU (optional): Remove-VMGpuPartitionAdapter -VMName "VM name"
  3. Prepare VM:
$vm = "VM name"
Set-VM -GuestControlledCacheTypes $true -VMName $vm
Set-VM -LowMemoryMappedIoSpace 1Gb -VMName $vm
Set-VM -HighMemoryMappedIoSpace 32Gb -VMName $vm
Add-VMGpuPartitionAdapter -VMName $vm
  1. Add the GPU:
    • Remove the -InstancePath argument for automatic GPU selection
Add-VMGpuPartitionAdapter -VMName $vm -InstancePath "Path from step 1"

Preparing the guest

  1. Create the following directory path inside the guest:
C:\Windows\System32\HostDriverStore\FileRepository
  1. Copy driver files from the host driver store at C:\Windows\System32\DriverStore\FileRepository
    • For AMD: Driver folder starts with u0387352.inf
    • For NVIDIA: Driver folder starts with nvlt.inf
  2. Reboot the guest machine and confirm that the GPU is enabled in device manager inside the guest.
  3. To go beyond the default 1080p resolution in guest, issue the following command:
Set-VMVideo -VMName $vm -HorizontalResolution 2560 -VerticalResolution 1600 -ResolutionType Maximum


Posted

in

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *