Added new API, hipMemPtrGetInfo

1. This API returns memory allocation size of pointer
2. Added test to check its functionality

Change-Id: I87976d817b5a6ca5530336c09e7cb0420601cb2c
Tá an tiomantas seo le fáil i:
Aditya Atluri tiomanta 2017-03-07 13:46:29 -06:00
1 tuismitheoir f86f3b3b33
tiomantas 1546732604
4 comhad athraithe
+77 -1

Níor tháinig aon chomhaid le do chuardach

+21
Féach ar an gComhad
@@ -1024,6 +1024,27 @@ hipError_t hipMemGetInfo (size_t *free, size_t *total)
return ihipLogStatus(e);
}
hipError_t hipMemPtrGetInfo(void *ptr, size_t *size)
{
HIP_INIT_API(ptr, size);
hipError_t e = hipSuccess;
if(ptr != nullptr && size != nullptr){
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){
*size = amPointerInfo._sizeBytes;
}else{
e = hipErrorInvalidValue;
}
}else{
e = hipErrorInvalidValue;
}
return ihipLogStatus(e);
}
hipError_t hipFree(void* ptr)
{
HIP_INIT_API(ptr);