﻿# Mapped host memory: a GPU load can cross the host link

Mapped host memory trades explicit staging for direct-access traffic; compare access frequency, coalescing, ownership, and platform topology before using it.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/learn-mapped-host-memory-kernel-access/
Language: en

Mapped host memory lets a supported GPU access an eligible host allocation through a device-visible mapping. It can avoid an explicit staging copy in some workflows, but it changes the path used by kernel loads and stores. On a discrete GPU, repeated access can traverse the host-device interconnect rather than local video memory. Zero-copy describes an interface choice, not zero transport cost.

## A mapped pointer changes the load path

The kernel can issue memory operations against a device-accessible host mapping, but the physical data may remain in host memory. The effective path depends on whether the system is discrete or integrated and which memory capabilities it exposes. Check support before constructing the mapping. A source-level pointer does not disclose latency, bandwidth, cache behavior, or whether the access uses the same path as ordinary device-local allocation.

Primary reference: [CUDA Programming Guide: Unified Memory](https://docs.nvidia.com/cuda/cuda-programming-guide/04-special-topics/unified-memory.html).

## A single pass differs from repeated reuse

Consider a small input consumed once and a matrix reused through many operations. Direct host access can avoid staging overhead for the former, while repeated remote reads can make the latter expensive. Copying reusable data once into device-local storage may amortize its transport cost. Count uses of each byte across the full phase. Comparing only the absence of an explicit copy statement ignores traffic generated by the kernel itself.

Primary reference: [CUDA C++ Best Practices Guide](https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/).

## Coalescing matters across a slower boundary

Neighboring threads that access neighboring useful addresses can use the transport more efficiently than threads scattering tiny requests across distant locations. Mapped host access therefore does not remove ordinary memory-layout concerns. A sparse algorithm should be evaluated using its actual access pattern, not a sequential transfer benchmark. Packing active elements into a contiguous staging buffer can sometimes outperform direct scattered access despite introducing an explicit preprocessing step.

Primary reference: [CUDA Programming Guide: Writing SIMT Kernels](https://docs.nvidia.com/cuda/cuda-programming-guide/02-basics/writing-cuda-kernels.html).

## CPU and GPU still need ownership rules

The CPU must not overwrite an input while the GPU is reading it unless the application uses an explicitly supported concurrent protocol. Similarly, the CPU cannot assume a device-produced result is ready before the required completion boundary. Sharing an address does not establish ordering. A double-buffered producer-consumer design can make ownership clear: one buffer belongs to the producer while another belongs to an in-flight consumer, then roles change after completion.

## Compare complete preparation-to-result time

Measure mapped access against explicit staging with identical useful input, reuse count, and result synchronization. Include host preparation and allocation behavior where relevant, rather than timing only the arithmetic kernel. Record whether the system is integrated or discrete and which competing traffic is present. A favorable result for a short single-pass pipeline should not be generalized to a reusable model-weight tensor or another machine with a different memory topology.

Related reading: [A GPU inference benchmark you can trust](/journal/inference-benchmark-method/); [Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/).
