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 a 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 @nta 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!

39 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)

4 Likes

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.

4 Likes

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:

5 Likes

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

4 Likes

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

1 Like

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

1 Like

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:

3 Likes

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.

2 Likes

I try it in amd GPU. it can run.
But when i instaill android emulator like nox player or bluestack, it can’t not install.
the nox player install crash, and the bluestack run until 99% and crash.
How to fix this problem?

2 Likes

I’m suspecting something along the lines of nested virtualization being disabled or unsupported for this scenario. Ideally one could just run Anbox in WSL2-enhanced Linux, but that might be a few ways off…

2 Likes

Hey!
I create New VM with clean drive, it strarts with windows setup, I cancel it and shut VM down. Then I apply the script from above but my VM refuses to start with the error 32788 returned by Hyper-V. After Remove-VMGpuPartitionAdapter -VMName $vm the VM starts normally
What do I do wrong? How to workaround?
I use Windows server 2019 GeForce GTX1060 for the host and GeForce GTX1080 Im trying to give to my guest VM. Btw I managed to passthu this 1080 via DDA and patched Nvidia driver with KVM patcher, but Im not satisfied with the perfomance.

1 Like

I can’t follow the tutorial steps because I never had contact with programming and I don’t even have the programs to help me with the tutorial

Hyper-V is in every Windows 10 Pro or so, you don’t need anything else to do it. Same for Powershell. :stuck_out_tongue:

Could this - in theory - be used to have two instances of FiveM on the same machine?
Two separate clients on different gta 5 accounts of course…
I want to experiment with client -> server and vice versa with multiple clients however I’m not sure of another way all by myself.

Absolutely, this is one out of many purpose for such a setup. :slight_smile:
That’s what I use to be able to test things with two clients.

why can u not use laptop or crome

2 Likes

Because geeks like us, like it the hard way :slight_smile:

1 Like

Way easier to test things on two clients using the same mouse/keyboard rather than jumping from one computer to another :stuck_out_tongue:

1 Like

but i don’t have a pc