Memory management

Memory management#

Memory management is an important part of the HIP runtime API, when creating high-performance applications. Both allocating and copying memory can result in bottlenecks, which can significantly impact performance.

The programming model is based on a system with a host and a device, each having its own distinct memory. Kernels operate on Device memory, while host functions operate on Host memory.

The runtime offers functions for allocating, freeing, and copying device memory, along with transferring data between host and device memory.

Here are the various memory management techniques:

Memory allocation#

The API calls and the resulting allocations are listed here:

Memory coherence control#

API

Data location

Allocation

System allocated

Host

Pageable

hipMallocManaged()

Host

Managed

hipHostMalloc()

Host

Pinned

hipMalloc()

Device

Pinned