improved error returns for hipHostRegister/UnRegister functions

This commit is contained in:
Aditya Atluri
2016-04-15 10:42:31 -05:00
parent 26ee986774
commit e8902a6e20
3 changed files with 6 additions and 4 deletions
+2
View File
@@ -159,6 +159,8 @@ typedef enum hipError_t {
,hipErrorPeerAccessAlreadyEnabled ///< Peer access was already enabled from the current device. ,hipErrorPeerAccessAlreadyEnabled ///< Peer access was already enabled from the current device.
,hipErrorRuntimeMemory ///< HSA runtime memory call returned error. Typically not seen in production systems. ,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. ,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. ,hipErrorTbd ///< Marker that more error codes are needed.
} hipError_t; } hipError_t;
+3 -3
View File
@@ -240,7 +240,7 @@ hipError_t hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags)
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0); hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
am_status_t am_status = hc::am_memtracker_getinfo(&amPointerInfo, hostPtr); am_status_t am_status = hc::am_memtracker_getinfo(&amPointerInfo, hostPtr);
if(status == AM_SUCCESS){ if(am_status == AM_SUCCESS){
hip_status = hipErrorHostMemoryAlreadyRegistered; hip_status = hipErrorHostMemoryAlreadyRegistered;
}else{ }else{
auto device = ihipGetTlsDefaultDevice(); auto device = ihipGetTlsDefaultDevice();
@@ -266,8 +266,8 @@ hipError_t hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags)
} }
return ihipLogStatus(hip_status); return ihipLogStatus(hip_status);
} }
}
//---
hipError_t hipHostUnregister(void *hostPtr) hipError_t hipHostUnregister(void *hostPtr)
{ {
HIP_INIT_API(hostPtr); HIP_INIT_API(hostPtr);
@@ -278,7 +278,7 @@ hipError_t hipHostUnregister(void *hostPtr)
}else{ }else{
am_status_t am_status = hc::am_memory_host_unlock(device->_acc, hostPtr); am_status_t am_status = hc::am_memory_host_unlock(device->_acc, hostPtr);
if(am_status != AM_SUCCESS){ if(am_status != AM_SUCCESS){
hip_status = hipErrorInvalidValue; hip_status = hipErrorHostMemoryNotRegistered;
} }
} }
return ihipLogStatus(hip_status); return ihipLogStatus(hip_status);
+1 -1
View File
@@ -167,7 +167,7 @@ make_hip_executable (hipHostAlloc hipHostAlloc.cpp)
make_hip_executable (hipStreamL5 hipStreamL5.cpp) make_hip_executable (hipStreamL5 hipStreamL5.cpp)
make_hip_executable (hipHostGetFlags hipHostGetFlags.cpp) make_hip_executable (hipHostGetFlags hipHostGetFlags.cpp)
#TODO - re-enable. This requires working hipHostRegister call, waiting on HCC feature. #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 (hipRandomMemcpyAsync hipRandomMemcpyAsync.cpp)
make_hip_executable (hipMemoryAllocate hipMemoryAllocate.cpp) make_hip_executable (hipMemoryAllocate hipMemoryAllocate.cpp)
make_hip_executable (hipFuncSetDeviceFlags hipFuncSetDeviceFlags.cpp) make_hip_executable (hipFuncSetDeviceFlags hipFuncSetDeviceFlags.cpp)