samwellwang

samwellwang

coder
twitter

GPU Passthrough Detailed Explanation

  1. Find device path: Device Manager - Graphics Card - Details - Location Path
  2. Disable device: Device Manager - Graphics Card - Right-click - Disable
  3. Offline device (admin PowerShell): Dismount-VmHostAssignableDevice -locationpath "device id obtained above" -force
  4. Check if offline successful: Graphics card is no longer visible in Device Manager
  5. Assign graphics card to virtual machine: Add-VMAssignableDevice -LocationPath "device id obtained above" -VMName virtual machine name
  6. Check if assignment successful: Get-VMAssignableDevice -VMName virtual machine name
  7. Merge cache writes: GPUs are faster compared to regular external devices, which allows us to enable CPU merging of GPU memory writes to improve performance. For example, for the Test virtual machine, run the following PowerShell command: Set-VM VMName -GuestControlledCacheTypes $true
  8. Install graphics card driver in the virtual machine to view the graphics card.

References:
Microsoft documentation on DDA
DDA trial process

Remove DDA: Remove-VMAssignableDevice -VMName VMName -LocationPath $locationPath -Force
Mount-VMHostAssignableDevice cmdlet

Use PowerShell or Device Manager to view all PCI devices and their addresses, record GPU ids and PCI addresses.
Use Get-VMHostAssignableDevice cmdlet to view the IOMMU group that these devices belong to.
Use Get-VM cmdlet to list the names and statuses of all virtual machines.
Use Get-VMAssignableDevice cmdlet to view which devices are assigned to virtual machines, search for PCI addresses or IOMMU group numbers to find the corresponding graphics card device.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.