Revert "fixed memory free apis"

This reverts commit 96a1899df7.
This commit is contained in:
Aditya Atluri
2016-03-21 10:36:11 -05:00
parent caa80af31b
commit 287ba34aca
5 changed files with 7 additions and 81 deletions
+5 -22
View File
@@ -2603,24 +2603,15 @@ hipError_t hipFree(void* ptr)
// TODO - ensure this pointer was created by hipMalloc and not hipMallocHost
std::call_once(hip_initialized, ihipInit);
hipError_t hipStatus = hipErrorInvalidDevicePointer;
// Synchronize to ensure all work has finished.
ihipGetTlsDefaultDevice()->waitAllStreams(); // ignores non-blocking streams, this waits for all activity to finish.
if (ptr) {
hc::accelerator acc;
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, ptr);
if(status == AM_SUCCESS){
if(amPointerInfo._hostPointer == NULL){
hc::am_free(ptr);
hipStatus = hipSuccess;
}
}
hc::am_free(ptr);
}
return ihipLogStatus(hipStatus);
return ihipLogStatus(hipSuccess);
}
@@ -2629,20 +2620,12 @@ hipError_t hipHostFree(void* ptr)
// TODO - ensure this pointer was created by hipMallocHost and not hipMalloc
std::call_once(hip_initialized, ihipInit);
hipError_t hipStatus = hipErrorInvalidDevicePointer;
if (ptr) {
hc::accelerator acc;
hc::AmPointerInfo amPointerInfo(NULL, NULL, 0, acc, 0, 0);
am_status_t status = hc::am_memtracker_getinfo(&amPointerInfo, ptr);
if(status == AM_SUCCESS){
if(amPointerInfo._hostPointer == ptr){
hc::am_free(ptr);
hipStatus = hipSuccess;
}
}
tprintf (DB_MEM, " %s: %p\n", __func__, ptr);
hc::am_free(ptr);
}
return ihipLogStatus(hipStatus);
return ihipLogStatus(hipSuccess);
};