Add back deprecated hipHostAlloc, hipMallocHost, hipFreeHost

Change-Id: Ib8494078c852b07e1958c3acc21fa1866542122c


[ROCm/clr commit: b59659f0c7]
Этот коммит содержится в:
Maneesh Gupta
2016-10-09 16:30:46 +05:30
родитель c57d6b263e
Коммит 4cef1070b2
3 изменённых файлов: 66 добавлений и 0 удалений
+36
Просмотреть файл
@@ -781,6 +781,18 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void* ptr)
*/
hipError_t hipMalloc(void** ptr, size_t size) ;
/**
* @brief Allocate pinned host memory [Deprecated]
*
* @param[out] ptr Pointer to the allocated host pinned memory
* @param[in] size Requested memory size
*
* @return #hipSuccess, #hipErrorMemoryAllocation
*
* @deprecated use hipHostMalloc() instead
*/
hipError_t hipMallocHost(void** ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead"))) ;
/**
* @brief Allocate device accessible page locked host memory
*
@@ -794,6 +806,19 @@ hipError_t hipMalloc(void** ptr, size_t size) ;
*/
hipError_t hipHostMalloc(void** ptr, size_t size, unsigned int flags) ;
/**
* @brief Allocate device accessible page locked host memory [Deprecated]
*
* @param[out] ptr Pointer to the allocated host pinned memory
* @param[in] size Requested memory size
* @param[in] flags Type of host memory allocation
*
* @return #hipSuccess, #hipErrorMemoryAllocation
*
* @deprecated use hipHostMalloc() instead
*/
hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags) __attribute__((deprecated("use hipHostMalloc instead"))) ;
/**
* @brief Get Device pointer from Host Pointer allocated through hipHostMalloc
*
@@ -892,6 +917,17 @@ hipError_t hipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t height
*/
hipError_t hipFree(void* ptr);
/**
* @brief Free memory allocated by the hcc hip host memory allocation API. [Deprecated]
*
* @param[in] ptr Pointer to memory to be freed
* @return #hipSuccess,
* #hipErrorInvalidValue (if pointer is invalid, including device pointers allocated with hipMalloc)
* @deprecated use hipHostFree() instead
*/
hipError_t hipFreeHost(void* ptr) __attribute__((deprecated("use hipHostFree instead")));
/**
* @brief Free memory allocated by the hcc hip host memory allocation API
* This API performs an implicit hipDeviceSynchronize() call.
+15
Просмотреть файл
@@ -185,6 +185,16 @@ inline static hipError_t hipFree(void* ptr) {
return hipCUDAErrorTohipError(cudaFree(ptr));
}
inline static hipError_t hipMallocHost(void** ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead")));
inline static hipError_t hipMallocHost(void** ptr, size_t size) {
return hipCUDAErrorTohipError(cudaMallocHost(ptr, size));
}
inline static hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags) __attribute__((deprecated("use hipHostMalloc instead")));
inline static hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags){
return hipCUDAErrorTohipError(cudaHostAlloc(ptr, size, flags));
}
inline static hipError_t hipHostMalloc(void** ptr, size_t size, unsigned int flags){
return hipCUDAErrorTohipError(cudaHostAlloc(ptr, size, flags));
}
@@ -205,6 +215,11 @@ inline static hipError_t hipHostUnregister(void* ptr){
return hipCUDAErrorTohipError(cudaHostUnregister(ptr));
}
inline static hipError_t hipFreeHost(void* ptr) __attribute__((deprecated("use hipHostFree instead")));
inline static hipError_t hipFreeHost(void* ptr) {
return hipCUDAErrorTohipError(cudaFreeHost(ptr));
}
inline static hipError_t hipHostFree(void* ptr) {
return hipCUDAErrorTohipError(cudaFreeHost(ptr));
}
+15
Просмотреть файл
@@ -174,6 +174,16 @@ hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags)
return ihipLogStatus(hip_status);
}
hipError_t hipMallocHost(void** ptr, size_t sizeBytes)
{
return hipHostMalloc(ptr, sizeBytes, 0);
}
hipError_t hipHostAlloc(void** ptr, size_t sizeBytes, unsigned int flags)
{
return hipHostMalloc(ptr, sizeBytes, flags);
};
// width in bytes
hipError_t hipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t height)
{
@@ -930,6 +940,11 @@ hipError_t hipHostFree(void* ptr)
return ihipLogStatus(hipStatus);
};
hipError_t hipFreeHost(void* ptr)
{
return hipHostFree(ptr);
}
hipError_t hipFreeArray(hipArray* array)
{
HIP_INIT_API(array);