Added return error code hipErrorInvalidValue in hipMemGetInfo
Change-Id: If01b012136b655ff8eb4878eb703dfe3e6a36530
This commit is contained in:
@@ -1112,7 +1112,7 @@ hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t st
|
||||
* Return snapshot of free memory, and total allocatable memory on the device.
|
||||
*
|
||||
* Returns in *free a snapshot of the current free memory.
|
||||
* @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue (if free != NULL due to bugs)
|
||||
* @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue
|
||||
* @warning On HCC, the free memory only accounts for memory allocated by this process and may be optimistic.
|
||||
**/
|
||||
hipError_t hipMemGetInfo (size_t * free, size_t * total) ;
|
||||
|
||||
@@ -864,6 +864,9 @@ hipError_t hipMemGetInfo (size_t *free, size_t *total)
|
||||
if (total) {
|
||||
*total = device->_props.totalGlobalMem;
|
||||
}
|
||||
else {
|
||||
e = hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
if (free) {
|
||||
// TODO - replace with kernel-level for reporting free memory:
|
||||
@@ -872,6 +875,9 @@ hipError_t hipMemGetInfo (size_t *free, size_t *total)
|
||||
|
||||
*free = device->_props.totalGlobalMem - deviceMemSize;
|
||||
}
|
||||
else {
|
||||
e = hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
} else {
|
||||
e = hipErrorInvalidDevice;
|
||||
|
||||
Reference in New Issue
Block a user