SWDEV-356554 - updated hipDeviceGetDefaultMemPool

updated the error check/messages

Change-Id: I518d497a82a14862d5168cc423aeaa20075336b8
This commit is contained in:
pghafari
2022-09-19 07:36:40 -04:00
committed by Payam Ghafari
parent f1d8a02122
commit 42b5a6d5af
+4 -1
View File
@@ -28,9 +28,12 @@ extern hipError_t ihipFree(void* ptr);
// ================================================================================================
hipError_t hipDeviceGetDefaultMemPool(hipMemPool_t* mem_pool, int device) {
HIP_INIT_API(hipDeviceGetDefaultMemPool, mem_pool, device);
if ((mem_pool == nullptr) || (device >= g_devices.size())) {
if (mem_pool == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
if (device < 0 || device >= g_devices.size()) {
HIP_RETURN(hipErrorInvalidDevice);
}
*mem_pool = reinterpret_cast<hipMemPool_t>(g_devices[device]->GetDefaultMemoryPool());
HIP_RETURN(hipSuccess);
}