SWDEV-470372 - Un-deprecate hipHostAlloc, comply with cuda and introduce hipHostAlloc flags

Change-Id: Ic7cdb10ebd3f736fe87c643bce90a28a1190f7c8


[ROCm/hip commit: e73376be0b]
This commit is contained in:
Ioannis Assiouras
2024-08-12 20:55:55 +01:00
szülő d0e10ef592
commit 8649197dc9
3 fájl változott, egészen pontosan 34 új sor hozzáadva és 8 régi sor törölve
@@ -45,7 +45,6 @@ Memory management
* ``hipMallocHost`` (replaced with ``hipHostMalloc``)
* ``hipMemAllocHost`` (replaced with ``hipHostMalloc``)
* ``hipFreeHost`` (replaced with ``hipHostFree``)
* ``hipMemcpyToArray``
* ``hipMemcpyFromArray``
@@ -701,21 +701,25 @@ enum hipLimit_t {
* non-coherent host memory visible to the host. The flag is a no-op on CUDA platforms.*/
#define hipEventReleaseToSystem 0x80000000
//Flags that can be used with hipHostMalloc.
//Flags that can be used with hipHostMalloc/hipHostAlloc.
/** Default pinned memory allocation on the host.*/
#define hipHostMallocDefault 0x0
#define hipHostAllocDefault 0x0
/** Memory is considered allocated by all contexts.*/
#define hipHostMallocPortable 0x1
#define hipHostAllocPortable 0x1
/** Map the allocation into the address space for the current device. The device pointer
* can be obtained with #hipHostGetDevicePointer.*/
#define hipHostMallocMapped 0x2
#define hipHostAllocMapped 0x2
/** Allocates the memory as write-combined. On some system configurations, write-combined allocation
* may be transferred faster across the PCI Express bus, however, could have low read efficiency by
* most CPUs. It's a good option for data tranfer from host to device via mapped pinned memory.*/
#define hipHostMallocWriteCombined 0x4
#define hipHostAllocWriteCombined 0x4
/**
* Host memory allocation will follow numa policy set by user.
@@ -3787,10 +3791,16 @@ hipError_t hipMemPoolImportPointer(
*
* @param[out] ptr Pointer to the allocated host pinned memory
* @param[in] size Requested memory size in bytes
* @param[in] flags Type of host memory allocation
* @param[in] flags Type of host memory allocation see below
*
* If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
*
* Flags:
* - #hipHostAllocDefault Default pinned memory allocation on the host.
* - #hipHostAllocPortable Memory is considered allocated by all contexts.
* - #hipHostAllocMapped Map the allocation into the address space for the current device.
* - #hipHostAllocWriteCombined Allocates the memory as write-combined.
*
* @return #hipSuccess, #hipErrorOutOfMemory, #hipErrorInvalidValue
*/
hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags);
@@ -3920,7 +3930,7 @@ hipError_t hipMemAllocPitch(hipDeviceptr_t* dptr, size_t* pitch, size_t widthInB
*/
hipError_t hipFree(void* ptr);
/**
* @brief Free memory allocated by the hcc hip host memory allocation API [Deprecated]
* @brief Frees page-locked memory
*
* @ingroup MemoryD
*
@@ -3929,9 +3939,7 @@ hipError_t hipFree(void* ptr);
* #hipErrorInvalidValue (if pointer is invalid, including device pointers allocated
* with hipMalloc)
*
* @warning This API is deprecated, use hipHostFree() instead
*/
DEPRECATED("use hipHostFree instead")
hipError_t hipFreeHost(void* ptr);
/**
* @brief Free memory allocated by the hcc hip host memory allocation API
@@ -9364,6 +9372,23 @@ static inline hipError_t hipHostMalloc(T** ptr, size_t size,
unsigned int flags = hipHostMallocDefault) {
return hipHostMalloc((void**)ptr, size, flags);
}
/**
* @brief: C++ wrapper for hipHostAlloc
* @ingroup Memory
* Provide an override to automatically typecast the pointer type from void**, and also provide a
* default for the flags.
*
* __HIP_DISABLE_CPP_FUNCTIONS__ macro can be defined to suppress these
* wrappers. It is useful for applications which need to obtain decltypes of
* HIP runtime APIs.
*
* @see hipHostAlloc
*/
template <class T>
static inline hipError_t hipHostAlloc(T** ptr, size_t size,
unsigned int flags = hipHostAllocDefault) {
return hipHostAlloc((void**)ptr, size, flags);
}
/**
* @brief: C++ wrapper for hipMallocManaged
*
+4 -2
Fájl megtekintése
@@ -104,8 +104,10 @@ syn keyword hipFunctionName hipEventRecord
syn keyword hipFunctionName hipEventSynchronize
syn keyword hipFunctionName hipFree
syn keyword hipFunctionName hipFreeArray
syn keyword hipFunctionName hipHostMalloc
syn keyword hipFunctionName hipHostFree
syn keyword hipFunctionName hipHostMalloc
syn keyword hipFunctionName hipHostAlloc
syn keyword hipFunctionName hipHostFree
syn keyword hipFunctionName hipFreeHost
syn keyword hipFunctionName hipHostGetDevicePointer
syn keyword hipFunctionName hipHostGetFlags
syn keyword hipFunctionName hipHostRegister