Inferensys

Glossary

Unified Virtual Memory (UVM)

Unified Virtual Memory (UVM) is a memory management architecture that creates a single, contiguous virtual address space shared between a CPU and GPU, allowing both processors to access the same memory pointers.
Architect reviewing LLM integration architecture on laptop, system diagrams visible, modern technical office setup.
GPU MEMORY OPTIMIZATION

What is Unified Virtual Memory (UVM)?

Unified Virtual Memory (UVM) is a memory management architecture that creates a single, contiguous virtual address space shared between a CPU and GPU, allowing both processors to access the same memory pointers and simplifying data sharing.

Unified Virtual Memory (UVM) is a hardware and software architecture that presents a single, coherent virtual address space to both the CPU and GPU, eliminating the need for explicit data copies between separate host and device memory spaces. This is achieved through a shared page table and a hardware Memory Management Unit (MMU) on the GPU, which handles address translation and triggers page faults for non-resident data. The system transparently manages data placement and movement between CPU system memory and GPU device memory based on access patterns, a process known as demand paging or page migration.

For developers, UVM simplifies programming by enabling pointer-based data structures to be shared directly between CPU and GPU code, reducing boilerplate copy operations. From a systems perspective, it enables efficient memory overcommit, allowing applications to allocate more memory than physically exists on the GPU by using system RAM or even storage as a backing store. Key implementations include NVIDIA's CUDA UVM and AMD's Heterogeneous System Architecture (HSA). The primary trade-off is the potential latency of page faults when data must be migrated on-demand versus the bandwidth of pre-planned, explicit copies.

GPU MEMORY OPTIMIZATION

Key Features of Unified Virtual Memory

Unified Virtual Memory (UVM) is a memory management architecture that creates a single, contiguous virtual address space shared between a CPU and GPU. This simplifies programming and enables efficient data sharing. Below are its core technical features.

01

Single Virtual Address Space

UVM's foundational feature is the creation of a unified, 64-bit virtual address space accessible by both the CPU and GPU. This eliminates the need for developers to manage separate pointers for host and device memory. Key implications include:

  • Pointer Consistency: A pointer has the same value and meaning on both processors.
  • Simplified APIs: Reduces or removes explicit cudaMemcpy operations for data movement.
  • Dynamic Data Structures: Enables the use of complex, pointer-based data structures (like linked lists or trees) that can be traversed by either processor without manual translation.
02

On-Demand Page Migration

UVM enables demand paging and automatic page migration. Memory pages are moved between CPU system RAM and GPU device memory transparently based on access patterns.

  • Page Fault Driven: When a GPU kernel accesses a page residing in host memory, a GPU page fault occurs. The UVM driver then migrates that page to GPU memory.
  • Migration Heuristics: Pages can also be proactively migrated or replicated based on usage to optimize performance.
  • Memory Oversubscription: This mechanism allows workloads to allocate more memory than the physical GPU VRAM capacity, using system RAM as a backing store.
03

Memory Coherency Protocol

UVM maintains cache coherency between the CPU and GPU caches for the shared address space. This ensures both processors see a consistent view of data.

  • Granular Coherency: Coherency is typically managed at the granularity of a memory page.
  • Protocol Overhead: The coherency protocol (like NVIDIA's HMM) introduces management overhead but is essential for correctness in concurrent access scenarios.
  • Access Permissions: Pages have permissions (e.g., CPU-read/write, GPU-read/write) that are managed by the UVM driver to enforce coherency rules.
04

Zero-Copy Memory Access

A direct benefit of UVM is enabling efficient zero-copy transfers. The GPU can access data directly from host-pinned memory without a preliminary copy to device memory.

  • Reduced Latency: Eliminates the explicit copy latency for data only accessed once or infrequently.
  • Host Memory as Cache: System RAM effectively acts as a slower, larger cache tier for the GPU.
  • Use Case: Ideal for applications with sparse, unpredictable access patterns or where data is generated/consumed by the CPU in real-time.
05

System-Wide Memory Oversubscription

UVM allows the total allocated memory of active GPU processes to exceed the physical GPU memory (VRAM) capacity. This is known as memory overcommit or oversubscription.

  • Backing Store: Non-resident pages spill over to system memory (DRAM) and, under extreme pressure, to storage (SSD) via the OS swap.
  • Performance Impact: Access to migrated pages incurs higher latency. Performance depends heavily on locality and the speed of the PCIe bus or NVLink.
  • Enables Larger Models: Allows running models whose working set size is larger than a single GPU's VRAM, albeit with potential performance degradation.
06

Peer-to-Peer Access Over NVLink/PCIe

In multi-GPU systems, UVM extends the unified address space across multiple GPUs, facilitating direct peer-to-peer (P2P) access.

  • Direct GPU-to-GPU Access: GPUs can directly read/write to each other's memory using load/store instructions, bypassing the host CPU.
  • NVLink Optimization: When GPUs are connected via NVLink, P2P accesses achieve much higher bandwidth and lower latency than over PCIe.
  • Simplified Multi-GPU Programming: Developers can program multiple GPUs as if they share a large, pooled memory resource, simplifying data partitioning and communication.
ARCHITECTURAL COMPARISON

UVM vs. Traditional Discrete Memory

A technical comparison of memory management paradigms for CPU-GPU systems, highlighting the operational differences that impact developer workflow, performance, and system design.

Feature / MechanismUnified Virtual Memory (UVM)Traditional Discrete Memory

Virtual Address Space

Single, contiguous virtual address space shared by CPU and GPU.

Separate, distinct virtual address spaces for CPU (host) and GPU (device).

Data Pointer Validity

A single pointer (e.g., *ptr) is valid for access from both the CPU and GPU.

Separate host (h_ptr) and device (d_ptr) pointers are required; they are not interchangeable.

Data Movement Primitive

Transparent, on-demand migration via page faults. No explicit copy commands are required for basic access.

Explicit, programmer-managed transfers using cudaMemcpy or similar APIs (e.g., cudaMemcpyHostToDevice).

Memory Allocation API

Unified allocation (e.g., cudaMallocManaged) creates memory accessible from any processor.

Separate allocations: malloc/new (host) and cudaMalloc (device).

Synchronization Requirement

Requires explicit synchronization (e.g., cudaDeviceSynchronize) before the CPU accesses GPU-modified data to ensure coherence.

Implicitly synchronized by the completion of cudaMemcpy operations and kernel launches; memory domains are distinct.

Performance Model

Predictable, high-bandwidth access to local memory (GPU HBM); accesses to migrated pages incur latency penalties (page fault handling).

Predictable, high-bandwidth for explicit copies; zero latency for local accesses post-copy. Overhead is upfront and explicit.

Programming Complexity

Lower initial complexity; simplifies code by eliminating many explicit copies and dual pointers.

Higher initial complexity; programmer must meticulously manage data placement and movement.

Optimal Use Case

Irregular access patterns, workloads with data-dependent parallelism, and rapid prototyping.

Regular, predictable data access patterns where bulk transfers can be amortized, and maximum deterministic performance is required.

System Memory Utilization

Can lead to oversubscription; allows allocation of more data than fits in GPU physical memory, using system RAM/SSD as a backing store.

Discrete; GPU workload data size is strictly limited by physical GPU memory (VRAM) capacity.

Hardware/Platform Requirement

Requires GPU architecture and driver support for page faulting and address translation (e.g., NVIDIA Pascal+ with CUDA 8+).

Universally supported on all CUDA/GPU-enabled platforms; no specific architectural requirements.

IMPLEMENTATION ECOSYSTEM

Frameworks and Platforms Using UVM

Unified Virtual Memory (UVM) is a foundational technology implemented across major compute platforms and frameworks to simplify memory management and enable efficient data sharing between CPUs and accelerators.

UNIFIED VIRTUAL MEMORY

Frequently Asked Questions

Unified Virtual Memory (UVM) is a foundational memory architecture for modern heterogeneous computing. These questions address its core mechanisms, benefits, and practical implementation details for systems engineers and ML Ops professionals.

Unified Virtual Memory (UVM) is a memory management architecture that creates a single, contiguous virtual address space shared between a CPU and a GPU, allowing both processors to access the same memory pointers and simplifying data sharing. It works by extending the CPU's virtual memory system to include GPU-accessible memory, managed by a combination of hardware and software components. The GPU's Memory Management Unit (MMU) handles address translation, while a driver-level page fault handler manages the migration of memory pages between the CPU's system memory and the GPU's device memory on-demand. This creates the illusion of a unified pool of memory, where data movement is handled transparently based on access patterns, rather than requiring explicit programmer-managed copies via APIs like cudaMemcpy.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.