Jump to content

User:Thataintfalco21/sandbox

From Wikipedia, the free encyclopedia


GPU virtualization[edit]

From Wikipedia, the free encyclopedia Jump to navigationJump to search GPU virtualization refers to technologies that allow the use of a GPU to accelerate graphics or GPGPU applications running on a virtual machine. GPU virtualization is used in various applications such as desktop virtualization, cloud gaming and computational science (eg. hydrodynamics simulations).

GPU virtualization implementations generally involve one or more of the following techniques: device emulation, API remoting, fixed pass-through and mediated pass-through. Each technique presents different trade-offs regarding virtual machine to GPU consolidation ratio, graphics acceleration, rendering fidelity and feature support, portability to different hardware, isolation between virtual machines, and support for suspending/resuming and live migration.

Contents[edit]

API remoting[edit][edit]

In API remoting or API forwarding, calls to graphical APIs from guest applications are forwarded to the host by remote procedure call, and the host then executes graphical commands from multiple guests using the host's GPU as a single user. It may be considered a form of paravirtualization when combined with device emulation. This technique allows sharing GPU resources between multiple guests and the host when the GPU does not support hardware-assisted virtualization. It is conceptually simple to implement, but it has several disadvantages:

  • In pure API remoting, there is little isolation between virtual machines when accessing graphical APIs; isolation can be improved using paravirtualization
  • Performance ranges from 86% to as low as 12% of native performance in applications that issue a large number of drawing calls per frame
  • A large number of API entry points must be forwarded, and partial implementation of entry points may decrease fidelity
  • Applications on guest machines may be limited to few available APIs

Hypervisors usually use shared memory between guest and host to maximize performance and minimize latency. Using a network interface instead (a common approach in distributed rendering), third-party software can add support for specific APIs (eg. rCUDA for CUDA) or add support for typical APIs (eg. VMGL for OpenGL) when it is not supported by the hypervisor's software package, although network delay and serialization overhead may outweigh the benefits.

Application support from API remoting virtualization technologies
Technology Direct3D OpenGL Vulkan OpenCL
VMware Virtual Shared Graphics Acceleration (vSGA) 11 4.1 Yes No
Parallels Desktop for Mac 3D acceleration 11 3.3 No No
Hyper-V RemoteFX vGPU 11 4.4 No 1.1
VirtualBox Guest Additions 3D driver 8/9 2.1 No No
QEMU/KVM with Virgil 3D No 4.3 Planned No
  1. ^ Wrapped to OpenGL using WineD3D.
  2. ^ Compatibility profile.
  3. ^ Experimental. Wrapped to OpenGL using WineD3D.
  4. ^ Experimental.

Fixed pass-through[edit][edit]

In fixed pass-through or GPU pass-through (a special case of PCI pass-through), a GPU is accessed directly by a single virtual machine exclusively and permanently. This technique achieves 96–100% of native performance and high fidelity, but the acceleration provided by the GPU cannot be shared between multiple virtual machines. As such, it has the lowest consolidation ratio and the highest cost, as each graphics-accelerated virtual machine requires an additional physical GPU.

The following software technologies implement fixed pass-through:

VirtualBox removed support for PCI pass-through in version 6.1.0.

QEMU/KVM[edit]

For certain GPU models, Nvidia and AMD video card drivers attempt to detect the GPU is being accessed by a virtual machine and disable some or all GPU features. NVIDIA has recently changed virtualization rules for consumer GPUs by disabling the check in GeForce Game Ready driver 465.xx and later.[2]

For NVIDIA, various architectures of desktop and laptop consumer GPUs can be passed through in various ways. For desktop graphics cards, passthrough can be done via the KVM using either the legacy or UEFI BIOS configuration via SeaBIOS and OVMF, respectively.

NVIDIA[edit]

Desktops[edit]

For desktops, most graphics cards can be passed through, although for graphics cards with the Pascal architecture or older, the VBIOS of the graphics card must be passed through in the virtual machine if the GPU is used to boot the host.[1]

Laptops[edit]

For laptops, the NVIDIA driver checks for the presence of a battery via ACPI, and without a battery, a error will be returned. To avoid this, an acpitable created from text converted into Base64 is required to spoof a battery and bypass the check.[1]

Pascal and earlier[edit]
An example of a VBIOS of an NVIDIA graphics card, particularly a laptop VBIOS (Lenovo Y720-15IKB, NVIDIA GTX 1060M)

For the laptop graphics cards that are Pascal and older, passthrough varies widely on the configuration of the graphics card. For laptops that do not have NVIDIA Optimus, such as the MXM variants, passthrough can be achieved through traditional methods. For laptops that have NVIDIA Optimus on as well as rendering through the CPU's integrated graphics framebuffer as opposed to its own, the passthrough is more complicated, requiring a remote rendering display or service, the use of Intel GVT-g, as well as integrating the VBIOS into the boot configuration due to the VBIOS being present in the laptop's system BIOS as opposed to the GPU itself. For laptops that have a GPU with NVIDIA Optimus and have a dedicated framebuffer, the configurations may vary. If NVIDIA Optimus can be switched off, then passthrough is possible through traditional means. However, if Optimus is the only configuration, then it is most likely that the VBIOS is present in the laptop's system BIOS, requiring the same steps as the laptop rendering only on the integrated graphics framebuffer, but a external monitor is also possible.[3]

Mediated pass-through[edit][edit]

In mediated device pass-through or full GPU virtualization, the GPU hardware provides contexts with virtual memory ranges for each guest through IOMMU and the hypervisor sends graphical commands from guests directly to the GPU. This technique is a form of hardware-assisted virtualization and achieves near-native performance and high fidelity. If the hardware exposes contexts as full logical devices, then guests can use any API. Otherwise, APIs and drivers must manage the additional complexity of GPU contexts. As a disadvantage, there may be little isolation between virtual machines when accessing GPU resources.

The following software and hardware technologies implement mediated pass-through:

  • VMware Virtual Shared Pass-Through Graphics Acceleration with Nvidia vGPU or AMD MxGPU
  • Citrix XenServer shared GPU with Nvidia vGPU, AMD MxGPU or Intel GVT-g
  • Xen and KVM with Intel GVT-g
  • Thincast Workstation - Virtual 3D feature (Direct X 12 & Vulkan 3D API)

While API remoting is generally available for current and older GPUs, mediated pass-through requires hardware support available only on specific devices.

Hardware support for mediated pass-through virtualization
Vendor Technology Dedicated graphics card families Integrated GPU families
Server Professional Consumer
Nvidia vGPU GRID, Tesla Quadro GeForce(Beta), Titan(Beta)
AMD MxGPU FirePro Server, Radeon Instinct Radeon Pro No No
Intel GVT-g Broadwell and newer

Device emulation[edit][edit]

GPU architectures are very complex and change quickly, and their internal details are often kept secret. It is generally not feasible to fully virtualize new generations of GPUs, only older and simpler generations. For example, PCem, a specialized emulator of the IBM PC architecture, can emulate a S3 ViRGE/DX graphics device, which supports Direct3D 3, and a 3dfx Voodoo2, which supports Glide, among others.

When using a VGA or an SVGA virtual display adapter, the guest may not have 3D graphics acceleration, providing only minimal functionality to allow access to the machine via a graphics terminal. The emulated device may expose only basic 2D graphics modes to guests. The virtual machine manager may also provide common API implementations using software rendering to enable 3D graphics applications on the guest, albeit at speeds that may be low as 3% of hardware-accelerated native performance. The following software technologies implement graphics APIs using software rendering:

See also[edit][edit]

Notes[edit][edit]

  1. ^ a b c "PCI passthrough via OVMF - ArchWiki". wiki.archlinux.org. Retrieved 2021-05-20.
  2. ^ "GeForce GPU Passthrough for Windows Virtual Machine (Beta)". NVIDIA Support. 2021-03-30.{{cite web}}: CS1 maint: url-status (link)
  3. ^ Tian, Lan (2020-06-25). "Intel and NVIDIA GPU Passthrough on a Optimus MUXless Laptop".{{cite web}}: CS1 maint: url-status (link)