From deb38625ca20ae4767f4522ca98e22a9b299dcae Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Sat, 19 Mar 2016 23:25:11 -0500 Subject: [PATCH] Implement hipHostFree on HCC path --- include/hcc_detail/hip_runtime_api.h | 9 +++++++++ src/hip_hcc.cpp | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/hcc_detail/hip_runtime_api.h b/include/hcc_detail/hip_runtime_api.h index d1d447256f..00e28788b7 100644 --- a/include/hcc_detail/hip_runtime_api.h +++ b/include/hcc_detail/hip_runtime_api.h @@ -740,6 +740,15 @@ hipError_t hipFree(void* ptr); hipError_t hipFreeHost(void* ptr) __attribute__((deprecated("use hipHostFree instead"))) ; +/** + * @brief Free memory allocated by the hcc hip host memory allocation API + * + * @param[in] ptr Pointer to memory to be freed + * @return #hipSuccess, #hipErrorMemoryFree + */ +hipError_t hipHostFree(void* ptr); + + /** * @brief Copy data from src to dst. diff --git a/src/hip_hcc.cpp b/src/hip_hcc.cpp index b69daf3684..07cc22f4f9 100644 --- a/src/hip_hcc.cpp +++ b/src/hip_hcc.cpp @@ -2607,7 +2607,7 @@ hipError_t hipFree(void* ptr) } -hipError_t hipFreeHost(void* ptr) +hipError_t hipHostFree(void* ptr) { // TODO - ensure this pointer was created by hipMallocHost and not hipMalloc std::call_once(hip_initialized, ihipInit); @@ -2621,6 +2621,13 @@ hipError_t hipFreeHost(void* ptr) }; +// TODO - deprecated function. +hipError_t hipFreeHost(void* ptr) +{ + hipHostFree(ptr); +} + + /** * @warning HCC returns 0 in *canAccessPeer ; Need to update this function when RT supports P2P