Virtual memory management#
-
hipError_t hipMemAddressFree(void *devPtr, size_t size)#
Frees an address range reservation made via hipMemAddressReserve.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
devPtr – [in] - starting address of the range.
size – [in] - size of the range.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemAddressReserve(void **ptr, size_t size, size_t alignment, void *addr, unsigned long long flags)#
Reserves an address range.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
ptr – [out] - starting address of the reserved range.
size – [in] - size of the reservation.
alignment – [in] - alignment of the address.
addr – [in] - requested starting address of the range.
flags – [in] - currently unused, must be zero.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemCreate(hipMemGenericAllocationHandle_t *handle, size_t size, const hipMemAllocationProp *prop, unsigned long long flags)#
Creates a memory allocation described by the properties and size.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
handle – [out] - value of the returned handle.
size – [in] - size of the allocation.
prop – [in] - properties of the allocation.
flags – [in] - currently unused, must be zero.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
Exports an allocation to a requested shareable handle type.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
shareableHandle – [out] - value of the returned handle.
handle – [in] - handle to share.
handleType – [in] - type of the shareable handle.
flags – [in] - currently unused, must be zero.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemGetAccess(unsigned long long *flags, const hipMemLocation *location, void *ptr)#
Get the access flags set for the given location and ptr.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
flags – [out] - flags for this location.
location – [in] - target location.
ptr – [in] - address to check the access flags.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemGetAllocationGranularity(size_t *granularity, const hipMemAllocationProp *prop, hipMemAllocationGranularity_flags option)#
Calculates either the minimal or recommended granularity.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
granularity – [out] - returned granularity.
prop – [in] - location properties.
option – [in] - determines which granularity to return.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemGetAllocationPropertiesFromHandle(hipMemAllocationProp *prop, hipMemGenericAllocationHandle_t handle)#
Retrieve the property structure of the given handle.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
prop – [out] - properties of the given handle.
handle – [in] - handle to perform the query on.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
Imports an allocation from a requested shareable handle type.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
handle – [out] - returned value.
osHandle – [in] - shareable handle representing the memory allocation.
shHandleType – [in] - handle type.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemMap(void *ptr, size_t size, size_t offset, hipMemGenericAllocationHandle_t handle, unsigned long long flags)#
Maps an allocation handle to a reserved virtual address range.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
ptr – [in] - address where the memory will be mapped.
size – [in] - size of the mapping.
offset – [in] - offset into the memory, currently must be zero.
handle – [in] - memory allocation to be mapped.
flags – [in] - currently unused, must be zero.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemMapArrayAsync(hipArrayMapInfo *mapInfoList, unsigned int count, hipStream_t stream)#
Maps or unmaps subregions of sparse HIP arrays and sparse HIP mipmapped arrays.
Warning
This API is under development. Currently it is not supported on AMD GPUs and returns hipErrorNotSupported.
- Parameters:
mapInfoList – [in] - list of hipArrayMapInfo.
count – [in] - number of hipArrayMapInfo in mapInfoList.
stream – [in] - stream identifier for the stream to use for map or unmap operations.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemRelease(hipMemGenericAllocationHandle_t handle)#
Release a memory handle representing a memory allocation which was previously allocated through hipMemCreate.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
handle – [in] - handle of the memory allocation.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemRetainAllocationHandle(hipMemGenericAllocationHandle_t *handle, void *addr)#
Returns the allocation handle of the backing memory allocation given the address.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
handle – [out] - handle representing addr.
addr – [in] - address to look up.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemSetAccess(void *ptr, size_t size, const hipMemAccessDesc *desc, size_t count)#
Set the access flags for each location specified in desc for the given virtual address range.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
ptr – [in] - starting address of the virtual address range.
size – [in] - size of the range.
desc – [in] - array of hipMemAccessDesc.
count – [in] - number of hipMemAccessDesc in desc.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported
-
hipError_t hipMemUnmap(void *ptr, size_t size)#
Unmap memory allocation of a given address range.
Note
This API is implemented on Linux and is under development on Microsoft Windows.
Warning
This API is marked as Beta. While this feature is complete, it can change and might have outstanding issues.
- Parameters:
ptr – [in] - starting address of the range to unmap.
size – [in] - size of the virtual address range.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorNotSupported