SWDEV-305163 - Do not limit hipHostMalloc upto max GPU memory available

Change-Id: Iea934088bcbef6cbd5c3f9f97767042fcaf71062


[ROCm/clr commit: 1da4bb21b9]
This commit is contained in:
Satyanvesh Dittakavi
2021-10-19 18:25:22 +00:00
parent ecde1f5b96
commit 933df7235b
+10 -4
View File
@@ -274,7 +274,7 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags)
return hipErrorOutOfMemory;
}
if (amdContext->devices()[0]->info().maxMemAllocSize_ < sizeBytes) {
if (!useHostDevice && (amdContext->devices()[0]->info().maxMemAllocSize_ < sizeBytes)) {
return hipErrorOutOfMemory;
}
@@ -282,9 +282,15 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags)
useHostDevice ? curDevContext->svmDevices()[0] : nullptr);
if (*ptr == nullptr) {
size_t free = 0, total =0;
hipMemGetInfo(&free, &total);
LogPrintfError("Allocation failed : Device memory : required :%zu | free :%zu | total :%zu \n", sizeBytes, free, total);
if (!useHostDevice) {
size_t free = 0, total =0;
hipError_t err = hipMemGetInfo(&free, &total);
if (err == hipSuccess) {
LogPrintfError("Allocation failed : Device memory : required :%zu | free :%zu | total :%zu \n", sizeBytes, free, total);
}
} else {
LogPrintfError("Allocation failed : Pinned Memory, size :%zu \n", sizeBytes);
}
return hipErrorOutOfMemory;
}
size_t offset = 0; //this is ignored