Managed Memory

Managed Memory#

HIPFORT API Reference: Managed Memory
Managed Memory

Allocates memory that will be automatically managed by HIP.

Allocates memory that will be automatically managed by HIP.

----------------------------------------------------------------------------------------------—

This section describes the managed memory management functions of HIP runtime API.

Note
The managed memory management APIs are implemented on Linux, under developement on Windows.

This API is used for managed memory, allows data be shared and accessible to both CPU and GPU using a single pointer.

The API returns the allocation pointer, managed by HMM, can be used further to execute kernels on device and fetch data between the host and device as needed.

If HMM is not supported, the function behaves the same as hipMallocHost .

Note
It is recommend to do the capability check before call this API.
Parameters
[out]ptr- pointer to allocated device memory
[in]sizeBytes- requested allocation size in bytes, it should be granularity of 4KB
[in]flags- must be either hipMemAttachGlobal or hipMemAttachHost (defaults to hipMemAttachGlobal)
Returns
hipSuccess, hipErrorMemoryAllocation, hipErrorNotSupported, hipErrorInvalidValue