GPUVM(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… GPUVM πŸ’…

okay so this is the Kernel API Manual entry for GPUVM, and bestie, it's giving memory-management main character energy ✨


🌸 GPUVM 🌸

So. GPUVM is the MMU functionality that lives on the GPU. Think of it as the GPU's very own address-translation situation πŸ’–

It's similar to the legacy GART on older asics, however β€” and this is the glow-up β€” instead of there being a single global GART table for the entire GPU, there can be multiple GPUVM page tables active at any given time. Multiple. Simultaneously. Iconic.

GPUVM page tables can contain a mix of VRAM pages and system pages (both memory and MMIO), and system pages can be mapped as:

  • snooped (cached system pages)
  • unsnooped (uncached system pages)

πŸ”₯ the whole VMID situation πŸ”₯

Each active GPUVM has an ID associated with it, and there's a page table linked with each VMID. When executing a command buffer, the kernel tells the engine what VMID to use for that command buffer. VMIDs are allocated dynamically as commands are submitted 🫢

The userspace drivers maintain their own address space, and the kernel sets up their page tables accordingly when they submit their command buffers and a VMID is assigned. No cap.

⚠️ The hardware supports up to 16 active GPUVMs at any given time. That's the limit, bestie. Sixteen. Don't come crying to me at seventeen πŸ’€

πŸ¦‹ page table anatomy πŸ¦‹

Each GPUVM is represented by a 1-2 or 1-5 level page table, depending on the ASIC family. (Yes, the exact numbers matter, write them down πŸ“)

GPUVM also supports RWX attributes on each page, plus other features such as encryption and caching attributes. Fancy πŸ’…


πŸ‘‘ VMID 0 is special πŸ‘‘

Okay this is the part you cannot skip.

VMID 0 is the GPUVM used for the kernel driver. In addition to an aperture managed by a page table, VMID 0 also has several other apertures:

  • there's an aperture for direct access to VRAM
  • there's a legacy AGP aperture which just forwards accesses directly to the matching system physical addresses (or IOVAs when an IOMMU is present)

These apertures provide direct access to these memories without incurring the overhead of a page table β€” literally the shortcut route, no middleman ✨

VMID 0 is used by the kernel driver for tasks like memory management.


🌈 who actually uses this 🌈

GPU clients (i.e., engines on the GPU) use GPUVM VMIDs to access memory.

For user applications, each application can have their own unique GPUVM address space. The application manages the address space, and the kernel driver manages the GPUVM page tables for each process.

πŸ’€ And if a GPU client accesses an invalid page? It generates a GPU page fault β€” similar to accessing an invalid page on a CPU. Same energy, different hardware. You've been warned.

✨ SEE ALSO ✨

Kernel file ./drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c struct:


and that's the whole thing, bestie πŸŽ€ you ate that. go forth and translate addresses responsibly πŸ’–

mwah πŸ’‹ β€” this one comes to you from ./drivers/gpu/drm/amd/amdgpu, dated October 2026, filed under GPUVM(9). bookmark it, screenshot it, tattoo it idk πŸ¦‹

πŸ“¦ where this page comes from