The above link gives you the programming coding to enable GPU Pass Through in VM using Windows Server OS.
Windows OS Hub / Virtualization / Hyper-V / How to Assign (Passthrough) a Physical GPU to a Hyper-V Virtual Machine
How to Assign (Passthrough) a Physical GPU to a Hyper-V Virtual Machine
The RemoteFX vGPU feature can be used in previous versions of Hyper-V (starting with Windows 7/Windows Server 2008 R2) to passthrough a host discrete GPU graphics card to a virtual machine. However, starting with Windows 10 1809 and Windows Server 2019, support for RemoteFX has been removed. Instead, the new Discrete Device Assignment (DDA) feature is proposed.
Discrete Device Assignment allows physical host PCI/PCIe devices (including GPU and NVMe) to be passed through from the host to the Hyper-V virtual machine. Basic requirements for using DDA in Hyper-V:
- Available for Hyper-V Gen 2 virtual machines only;
- The VM must have dynamic memory and checkpoints disabled;
- The physical graphics card must support GPU Partitioning;
- If WSL (Windows Subsystem for Linux) is enabled on the host, a code 43 video error might occur in the VM when passing through the graphics card using GPU-P;
- Although SR-IOV (Single Root Input/Output Virtualization) is not listed in the DDA requirements, GPU passthrough to a VM will not work correctly if it’s not supported.
Discrete Device Assignment is only available on Windows Server with the Hyper-V role. In the desktop Windows 10 and 11, you can use GPU partitioning to share the video card with the virtual machine. This article describes how to assign a physical GPU to a virtual machine on Hyper-V.
I apologize if you already are aware of the above information since you didn't give any exact details on the issue you are having.
Anyways, Good Luck.
I am not familiar with GPU Pass Through but have a general idea of the concept. Thus I let others more knowledgeable to assist you.
By the way are you using a 3rd party VM software like VMware to generate your VM?