diff --git a/hipamd/include/hip_runtime_api.h b/hipamd/include/hip_runtime_api.h index ca49ab5d13..2f26ffd046 100644 --- a/hipamd/include/hip_runtime_api.h +++ b/hipamd/include/hip_runtime_api.h @@ -159,6 +159,8 @@ typedef enum hipError_t { ,hipErrorPeerAccessAlreadyEnabled ///< Peer access was already enabled from the current device. ,hipErrorRuntimeMemory ///< HSA runtime memory call returned error. Typically not seen in production systems. ,hipErrorRuntimeOther ///< HSA runtime call other than memory returned error. Typically not seen in production systems. + ,hipErrorHostMemoryAlreadyRegistered ///< Produced when trying to lock a page-locked memory. + ,hipErrorHostMemoryNotRegistered ///< Produced when trying to unlock a non-page-locked memory. ,hipErrorTbd ///< Marker that more error codes are needed. } hipError_t; diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index 77d0634bb2..f99ca4eade 100644 --- a/hipamd/src/hip_memory.cpp +++ b/hipamd/src/hip_memory.cpp @@ -240,7 +240,7 @@ hipError_t hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags) hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0); am_status_t am_status = hc::am_memtracker_getinfo(&amPointerInfo, hostPtr); - if(status == AM_SUCCESS){ + if(am_status == AM_SUCCESS){ hip_status = hipErrorHostMemoryAlreadyRegistered; }else{ auto device = ihipGetTlsDefaultDevice(); @@ -266,8 +266,8 @@ hipError_t hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags) } return ihipLogStatus(hip_status); } -} +//--- hipError_t hipHostUnregister(void *hostPtr) { HIP_INIT_API(hostPtr); @@ -278,7 +278,7 @@ hipError_t hipHostUnregister(void *hostPtr) }else{ am_status_t am_status = hc::am_memory_host_unlock(device->_acc, hostPtr); if(am_status != AM_SUCCESS){ - hip_status = hipErrorInvalidValue; + hip_status = hipErrorHostMemoryNotRegistered; } } return ihipLogStatus(hip_status); diff --git a/hipamd/tests/src/CMakeLists.txt b/hipamd/tests/src/CMakeLists.txt index cec6cf52e3..68099ae083 100644 --- a/hipamd/tests/src/CMakeLists.txt +++ b/hipamd/tests/src/CMakeLists.txt @@ -167,7 +167,7 @@ make_hip_executable (hipHostAlloc hipHostAlloc.cpp) make_hip_executable (hipStreamL5 hipStreamL5.cpp) make_hip_executable (hipHostGetFlags hipHostGetFlags.cpp) #TODO - re-enable. This requires working hipHostRegister call, waiting on HCC feature. -#make_hip_executable (hipHostRegister hipHostRegister.cpp) +make_hip_executable (hipHostRegister hipHostRegister.cpp) make_hip_executable (hipRandomMemcpyAsync hipRandomMemcpyAsync.cpp) make_hip_executable (hipMemoryAllocate hipMemoryAllocate.cpp) make_hip_executable (hipFuncSetDeviceFlags hipFuncSetDeviceFlags.cpp)