ArticleslgStudy

science

GPU virtualization

GPU virtualization is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand GPU virtualization rather than just read about it. In short: 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 (e.g. hydrodynamics simulations).

Key takeaways

  • GPU virtualization belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect GPU virtualization to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of GPU virtualization from memory before moving on to harder problems.

Reference excerpt

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 (e.g. 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.

API remoting 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 (e.g. rCUDA for CUDA) or add support for typical APIs (e.g. VMGL for OpenGL) when it is not supported by the hypervisor's software package, although network delay and serialization overhead may outweigh the benefits.

Fixed pass-through 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:

VMware Virtual Dedicated Graphics Acceleration (vDGA) Parallels Workstation Extreme Hyper-V Discrete Device Assignment (DDA) Citrix XenServer GPU pass-through Xen and QEMU/KVM with Intel GVT-d VirtualBox removed support for PCI pass-through in version 6.1.0.

QEMU/KVM 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. 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

Desktops 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.

Laptops For laptops, the NVIDIA driver checks for the presence of a battery via ACPI, and without a battery, an 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.

Pascal and earlier 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 an external monitor is also possible.

Mediated pass-through 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.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with GPU virtualization

Start with the simplest possible case. Write down what GPU virtualization claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to GPU virtualization before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about GPU virtualization ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of GPU virtualization

In research
GPU virtualization appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses GPU virtualization in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
GPU virtualization is common in secondary-school and first-year university syllabi. It links to neighbouring topics Hardware virtualization, so understanding it makes those chapters shorter.
In everyday life
Look for GPU virtualization outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “GPU virtualization” →

How to study GPU virtualization in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what GPU virtualization means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain GPU virtualization out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is GPU virtualization in simple terms?

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 (e.g. hydrodynamics simulations).

Why does GPU virtualization matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study GPU virtualization?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on GPU virtualization.

Tags

  • Hardware virtualization

Keep exploring