Running FiveM in a Hyper-V VM with full GPU performance for testing ("GPU Partitioning")

Hello there!

This little guide aim to let you setup an Hyper-V Windows 10 VM with GPU Partioning to run FiveM.
No documentation is provided anywhere by Microsoft and an Hyper-V dev’s gist about that got taken down.
Do note that this guide is intended to be used with an Nvidia GPU, and haven’t been tested with an AMD GPU yet.

  1. Create an Hyper-V VM (no, for real?! :o) and name it fivem
  2. Open a Powershell prompt as an admin
  3. Run this snippet while the VM being turned-off :
$vm = "fivem"

Add-VMGpuPartitionAdapter -VMName $vm
Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionVRAM 80000000 -MaxPartitionVRAM 100000000 -OptimalPartitionVRAM 100000000 -MinPartitionEncode 80000000 -MaxPartitionEncode 100000000 -OptimalPartitionEncode 100000000 -MinPartitionDecode 80000000 -MaxPartitionDecode 100000000 -OptimalPartitionDecode 100000000 -MinPartitionCompute 80000000 -MaxPartitionCompute 100000000 -OptimalPartitionCompute 100000000

Set-VM -GuestControlledCacheTypes $true -VMName $vm
Set-VM -LowMemoryMappedIoSpace 1Gb -VMName $vm
Set-VM –HighMemoryMappedIoSpace 32GB –VMName $vm
  1. Then, on your host machine, browse to C:\Windows\System32\DriverStore\FileRepository\
  2. Transfer the nv_dispi.inf_amd64_<UNIQUEID> folder to C:\Windows\System32\HostDriverStore\FileRepository\ on your VM (if folders doesn’t exist, create them.)
  3. Then transfer the C:\Windows\System32\nvapi64.dll file from your host to C:\Windows\System32\ on your VM
  4. Restart the VM
  5. Disable enhanced session and checkpoints in Hyper-V
  6. And voilà! You can now use FiveM with great FPS inside an Hyper-V VM ! :slight_smile:

Big thanks to @deterministic_bubble for his patience to figure this out.

HINT: You can expose a file share on your host PC to share the GTA V game install to the VM!

14 Likes

So, by other words, we can run FiveM client beside actual server all at the one machine inside Windows Server edition and therefore reduce lags usually connected to arbitrator clients running on slow machine with terrible ping?

(Just a newbie trying to comprehend what he just read)

No, that is not related nor does it really make sense to do so. A OneSync server won’t have any arbitrator at all, and a non-OneSync server only uses the arbitrator for establishing initial connectivity (during the HS_JOINING phases in console logs), everything else is done in a distributed fashion.

This guide is rather meant as an alternative to the “cl2” launch mode.

1 Like

Thanks for the tips, it works fine :slight_smile:

How did you deal with the mouse issue ? Mine is erratic in game (not in menus)
Looks like the cursor try to recenter each frame at the middle

I did not succeed to capture the input exclusively in Hyper-V :confused:

1 Like

It didn’t work for me, what version of NVIDIA drivers you use?

Hi, please define “don’t work” a bit much so we can figure out why it isn’t working properly for you. :slight_smile:

Windows Server 2019, Latest NVIDIA Studio Drivers 451.77, VM just did not start (Not enough resources).

Did the VM wasn’t starting since you created it in Hyper-V? Or only after following the guide?
Also “Not enough resources” is kinda self-explanatory :stuck_out_tongue: Maybe your VM is missing RAM :man_shrugging:

Only after following guide, DDA (PCIE passthrough) working, but NVIDIA blocks it on drivers level (need to patch) and Hyper-V host is lose display adapter. So, GPU-P is more like for me, but it did not work.