Everyday use on a virtual machine feels sluggish, including animations, window dragging, and scrolling. A reason for this is the emulated display adapter, which, instead of using your integrated or dedicated GPU, uses the CPU to render the graphics. To fix this, the VM needs access to a real GPU, which by design is controlled by one operating system and one driver. As a result, if the whole GPU is handed to a VM, the host loses access, and everything falls apart.
There are multiple ways to fix this GPU sharing problem, but the simplest option is GPU partitioning (GPU-P). This allows the host and the VM to use the same graphics processor at the same time.
What’s GPU partitioning?
Splitting one GPU between your host and your VMs
GPU partitioning is exactly what it sounds like. It allows one GPU to serve a host as well as one or more Hyper-V VMs at the same time. Instead of capturing the entire card, the host’s driver keeps the GPU tied to the host while allowing a VM to borrow memory from it for hardware acceleration.
When an app on the VM requires graphics processing, the GPU commands go over Hyper-V’s VMBus to the host, where they are picked up by the kernel driver and submitted to the hardware. Windows’ GPU scheduler also plays a role here, ensuring proper allocation of video memory by giving each partition turns on the GPU engine.
You can set up GPU partitioning manually by preparing the VM, then adding a GPU partition through PowerShell with the Add-VMGpuPartitionAdapter -VMName $vm command, and then copying the driver files into the VM.
However, for this guide, we will use Easy-GPU-PV, which automates the entire process in a couple of scripts. There is a catch, though. Easy-GPU-PV does not work with Nvidia GPUs on a laptop. So, you either need a laptop with an Intel CPU and integrated GPU, or a desktop with a dedicated Nvidia or AMD GPU.
If you are on a laptop with an Nvidia GPU, check out App Sandbox, also from the creator of Easy-GPU-PV. It works without a virtual machine and runs on Windows 11 Home as well.
Sharing your GPU with a Hyper-V virtual machine
Setting up Easy-GPU-PV from start to finish
Before we start with the setup, make sure your PC meets these requirements:
- Windows 10 20H1 or later, or Windows 11 Pro, Enterprise, or Education. You can enable Hyper-V on Windows 11 Home with a bit of tweaking, so that should also work.
- Make sure your host and VM are running the same version of Windows. For example, if the host is running Windows 11 26H2, use 26H2 for your VM as well. Mismatches can cause blue screens.
- Enable virtualization in BIOS/UEFI. Go to Task Manager > Performance > CPU to see if Virtualization is set to Enabled. If not, enable it in your BIOS settings.
-
Enable Hyper-V using the following PowerShell command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All - Make sure you have the latest graphics drivers installed for your Nvidia, Intel, or AMD GPU. Download them directly from the manufacturer’s site instead of relying on Device Manager or Windows Update.
- You will need a Windows 11 ISO. Head to the Microsoft download page, scroll to Download Windows 11 Disk Image (ISO) for x64 devices, click the dropdown, choose Windows 11, click Download Now, pick your language, and confirm. Do not use the Media Creation Tool for this, as the script fails with ISOs made that way.
-
Allow PowerShell scripts. Open PowerShell as administrator and type the following command:
Set-ExecutionPolicy Unrestricted - You can change it back to RemoteSigned when you are done.
Download Easy-GPU-PV
Download Easy-GPU-PV from its GitHub repo and extract the files to a folder. Within the folder, right-click and select Open in Terminal, then type the following command to unblock the files:
Get-ChildItem -Recurse | Unblock-File
Next, open PowerShell ISE as administrator. Type PowerShell ISE in Windows search, right-click, and choose Run as administrator. In ISE, open PreChecks.ps1 and click the green Play button. It should list your GPU. If it does not, it will tell you what is wrong and needs fixing. Copy the GPU name from the list exactly as shown.
Configure and create the VM
Create the folder for the virtual disk if it does not already exist. By default, it is saved in C:UsersPublicDocumentsHyper-VVirtual Hard Disks.
Open CopyFilesToVM.ps1 in ISE and edit the params block at the top:
|
|
Name of the VM, e.g. |
|
|
Full path to your Windows ISO |
|
|
Leave as |
|
|
Disk size; minimum |
|
|
RAM for the VM, e.g. |
|
|
e.g. |
|
|
Leave as |
|
|
The folder you created above; it must already exist |
|
|
|
|
|
Share of the GPU for the VM, e.g. |
|
|
No special characters, and must be different from |
|
|
Cannot be blank |
|
|
|
Save and run CopyFilesToVM.ps1. It creates the VM, installs Windows unattended, partitions the GPU, and copies the driver files. It takes about 5 to 10 minutes.
Make the GPU usable
Once the VM is up, install a GPU-accelerated streaming app inside it, such as Parsec, or use Sunshine in the VM with Moonlight on your host. Connect to the VM through it. If you want resolutions and refresh rates beyond the defaults, install a virtual display driver in the VM. The project’s Issues tab on GitHub has recommendations.
Keep the Hyper-V Video adapter disabled in the VM and do not use RDP or Enhanced Session mode. They cause black screens in the streaming app and cap you at 30 FPS. A streaming app with a virtual display gives you up to 4K at 60 FPS.
To verify it works, check the VM’s Device Manager. Your GPU should appear with no yellow warning. On the host, the GPU may now show a Microsoft driver instead of the Nvidia, AMD, or Intel one. That is normal as long as there is no yellow triangle.
When you update your host GPU driver
After a host GPU driver update, reboot the host, then open PowerShell as admin, navigate to the Easy-GPU-PV folder, and run:
.Update-VMGpuPartitionDriver.ps1 -VMName "GPUP" -GPUName "Your GPU name"
On Windows 10, use -GPUName "AUTO" . Skip this step and the VM’s GPU will stop working.
Other ways to share your GPU with a VM
Alternatives when GPU partitioning doesn’t fit
The GPU partitioning method comes with a few caveats. It only works with Gen 2 VMs with dynamic memory and checkpoints disabled. You also have to copy the drivers every time the host receives a GPU update. If that is a dealbreaker, you have other ways to share your GPU with a VM, though none as easy as GPU partitioning.
First, you can do full PCIe pass through for the best performance, but it does not offer sharing. The VM gets the entire card, which means the host loses access to it. This is only viable if you have multiple GPUs.
VMware Workstation and VirtualBox also offer 3D acceleration that can translate the guest’s graphics calls to the host GPU. It works for basic acceleration and lighter workloads, but offers limited DirectX support and close to zero real gaming performance.
GPU partitioning is the easiest way to speed up a VM
Among the ways I have tried, GPU partitioning is the easiest of the lot and offers the best performance for day-to-day use. If you are working with both a dedicated and an integrated GPU, giving 100% of the iGPU to the VM can yield noticeably better results than splitting it 50/50. In my testing, a 50/50 split on an integrated GPU made the VM feel sluggish, but allocating the full iGPU while using the dedicated card on the host made things significantly smoother.
Another thing worth enabling is Guest Services in the VM’s Hyper-V settings. It does not affect GPU performance, but it enables clipboard and file sharing between the host and the VM, which is convenient when you are moving between the two.