AI Hardware6 min read

Unified Memory vs Discrete VRAM: Bus Width, PCIe Cliffs, and Partial Offload Math

Why discrete GPU VRAM hits 1,792 GB/s while unified memory trades bandwidth for capacity, and how partial CPU offload triggers a harmonic-mean speed collapse.

Discrete VRAM delivers 900 to 1,792 GB/s across narrow 16 to 32 GB pools, whereas unified memory trades lower peak bus speed (170 to 1,200 GB/s) for 64 to 512 GB shared capacity without crossing a 16 GB/s PCIe link. Splitting just 12% of a dense model onto CPU RAM cuts GPU decode speed by 58%.

Key takeaways

  • Fit the whole model and KV cache into fast GPU VRAM via slightly tighter quantization rather than spilling layers over PCIe.
  • For large Mixture-of-Experts models that exceed VRAM, split tensors by expert type rather than contiguous layers.
  • Use --no-mmap in llama.cpp when diagnosing sudden 2 tok/min slowdowns caused by OS disk paging.
  • Remember that unified memory still enforces OS GPU allocation ceilings on Windows, Linux, and macOS.

Quick facts

  • PCIe 4.0 x16 moves roughly 16 GB/s each way, 50x to 110x slower than GDDR6X/GDDR7 VRAM.
  • Offloading 4 out of 32 dense layers (12%) to a 5 tok/s CPU drops a 60 tok/s GPU to 25 tok/s (-58%).
  • CUDA unified memory spilling past VRAM in llama.cpp PR #8035 collapsed prefill from 773 to 45 tok/s and decode to 0.31 tok/s under thrashing.
  • Strix Halo allows 96 GB BIOS VGM on Windows or up to ~120 GB GTT mapping on Linux via amd-ttm.
  • macOS caps Metal GPU wired memory at roughly 67% to 75% by default unless raised with sysctl iogpu.wired_limit_mb.

Every hardware buying debate in local AI eventually narrows down to a single architectural trade-off: do you want a small pool of ultra-fast discrete VRAM connected over PCIe, or a massive pool of slower unified memory wired straight to both CPU and GPU? Once you look at the PCB traces and the arithmetic of a single layer spill, that choice stops feeling philosophical and turns completely mechanical.

Macro photograph of an NVIDIA AD102 silicon GPU die surrounded by surrounding GDDR6X memory packages on a GeForce RTX 4090 board
Macro photograph of an NVIDIA AD102 silicon GPU die surrounded by surrounding GDDR6X memory packages on a GeForce RTX 4090 board

Photo: AD102-301-A1 GPU die and GDDR6X memory packages by Fritzchens Fritz, CC0 1.0 Public Domain, resized via Wikimedia Commons.

Two Completely Different Physical Memory Layouts

A discrete GPU card like an RTX 4090 or RTX 5090 puts soldered GDDR6X or GDDR7 chips inches away from the silicon die across 384-bit or 512-bit PCB traces. That physical proximity pushes 1,008 to 1,792 GB/s of bandwidth straight into the GPU's L2 cache. The penalty is rigid capacity: consumer cards stall at 16, 24, or 32 GB, and upgrading that pool later is physically impossible without swapping the card.

Architectural diagram comparing discrete GPU PCIe workstation buses against zero-copy unified memory SoCs
Architectural diagram comparing discrete GPU PCIe workstation buses against zero-copy unified memory SoCs

Original diagram by Ajay Kumar Chaturvedi comparing PCIe 4.0 x16 discrete GPUs against unified memory SoCs and OS allocation ceilings.

When weights exceed that card's VRAM, your workstation falls back across the PCIe slot toward dual-channel DDR5 system RAM. As Addaly's memory architecture benchmarks highlight, dual-channel DDR5-5600 gives only ~55 GB/s usable bandwidth out of an 89.6 GB/s theoretical spec, and the PCIe 4.0 x16 bus between them peaks near 16 GB/s each way (half that on PCIe 3.0 or laptop x8 lanes). Streaming weights back and forth over PCIe turns a 1,000+ GB/s GPU into a 16 GB/s bottleneck.

Unified memory SoCs (Apple Silicon M-series, AMD Ryzen AI Max+ 395, and NVIDIA GB10) eliminate the PCIe bridge altogether. Both the CPU and GPU read the same physical LPDDR5 or LPDDR5X packages via wide 256-bit to 1,024-bit on-package traces. There is no GPU-to-CPU copy step, and single boxes scale to 128 GB, 256 GB, or 512 GB. The trade-off is that LPDDR5X pins deliver 170 to 273 GB/s on 256-bit PCs and 614 to 1,200 GB/s only when Apple welds ultra-wide 512-bit or 1,024-bit Max and Ultra dies.

The Harmonic-Mean Cliff of Partial Offload

The temptation on a 16 GB or 24 GB GPU is to load "almost all" of a 32-layer model onto the card and let the CPU handle the leftover 4 layers. Because transformer layers execute sequentially, token latency follows a harmonic mean where the slowest segment dominates total time.

Take Addaly's plain-text derivation for a 32-layer dense model where the GPU achieves 60 tok/s on its own and CPU RAM yields 5 tok/s:

TEXT
GPU share (28 of 32 layers):  (28 / 32) x (1 / 60 s) = 0.0146 s
CPU share ( 4 of 32 layers):  ( 4 / 32) x (1 /  5 s) = 0.0250 s
Total time per token:         0.0146 + 0.0250       = 0.0396 s
Resulting speed:              1 / 0.0396            = 25.3 tok/s (-58%)

Putting just 12.5% of the model on system RAM wipes out 58% of your GPU speed. Moving to 40 layers with 38 on GPU and 2 on CPU still drags the average straight down. That is why a smaller quantization (such as Q4_K_S or IQ4_XS) that fits 100% inside VRAM consistently outperforms a cleaner Q5_K_M or Q6_K file that spills two layers onto DDR5.

Why CUDA Unified Memory Thrashing Isn't Free Either

In llama.cpp PR #8035, contributors exposed GGML_CUDA_ENABLE_UNIFIED_MEMORY=1 so CUDA drivers automatically page overflow allocations across PCIe instead of throwing out-of-memory errors. When a model barely overhangs VRAM by one layer, that escape hatch prevents crashes, but benchmark maintainer Johannes Gaessler's RTX 4090 measurements on Llama 70B Q2_K (23.71 GiB) exposed the cliff immediately:

  • At 76 GPU layers (ngl 76), prefill ran at 773.13 tok/s and decode hit 22.75 tok/s.
  • At 77 to 78 layers under unified memory paging, prefill collapsed roughly 17x to 45.55 tok/s.
  • Pushing to 79 layers triggered continuous page thrashing across PCIe, crashing decode to 0.31 tok/s.

CUDA unified memory is a safety valve for borderline fits, not a replacement for physical VRAM.

The Exception: Tensor-Type Split for MoE Models

Sparse Mixture-of-Experts models rewrite this rule on discrete GPU rigs. Rather than slicing contiguous layers with -ngl, splitting by tensor type keeps dense attention layers, embeddings, and KV cache resident in fast GDDR VRAM while pinning large routed expert tensors onto DDR5 system RAM. Because a token only activates a small subset of experts per layer, DDR5 bandwidth reads only ~3 to 6 GB of expert slices per step instead of 40+ GB, keeping hybrid setups usable when dense spills would become unbearable.

Memory Mapping Traps and OS Guardrails

Two software traps catch builders on both sides of the architecture fence.

The mmap Disk-Paging Trap

By default, llama.cpp uses OS mmap so models launch almost instantaneously and multiple worker processes can share read-only memory pages. The trap appears when total file size plus KV cache quietly exceeds physical RAM: the process starts without an OOM error, then runs at 1 to 3 tokens per minute because the operating system continuously evicts and re-reads weight pages from your NVMe drive. Whenever a model loads cleanly and stalls at unreadable speed, re-run with --no-mmap to force real physical allocation and expose the true memory failure immediately.

Unified Memory Allocation Limits by OS

Buying a 128 GB unified memory box does not automatically hand 128 GB to your GPU kernels. Every OS enforces its own guardrail:

  1. Windows on AMD Strix Halo: Windows reserves half of RAM for shared graphics by default; AMD Variable Graphics Memory in Adrenalin lets you carve up to 96 GB as dedicated VRAM in firmware on a 128 GB machine (up to ~112 GB combined graphics-addressable).
  2. Linux on AMD RDNA 3.5 (`gfx1151`): AMD's ROCm optimization guide recommends keeping BIOS carved-out VRAM small (0.5 GB) and raising dynamic Translation Table Manager (TTM) GTT mappings instead. Using amd-ttm --set 100 or kernel arguments like ttm.pages_limit=30720000 amdgpu.gttsize=120000 unlocks up to ~120 GB of shared GPU memory while letting the OS reclaim pages when idle.
  3. macOS on Apple Silicon: Metal caps wired GPU memory (recommendedMaxWorkingSetSize) around 67% to 75% of physical RAM. On a 128 GB Mac Studio, roughly 85 to 96 GB is available by default before touching sudo sysctl iogpu.wired_limit_mb=... (which resets on reboot and steals headroom from macOS page caches).

Which Architecture Should You Buy?

I would skip unified memory completely if your daily models fit under 20 to 26 GB (7B to 32B quantized) and you care about sub-second prompt reads or multi-user serving, because a single RTX 4090 or RTX 5090 outperforms every desktop unified bus on raw tok/s and compute. Conversely, I would skip multi-GPU PCIe builds for solo desktop inference on 70B+ dense or 120B+ MoE models unless you actually need CUDA training compatibility, because a single high-memory unified Mac Studio or Strix Halo box avoids PCIe cliffs, runs quieter, and eliminates partial-offload tuning.

Sources