SWDEV-467263 - Allow hipMalloc to use sys memory

PAL supports allocating from system memory once device memory is used up
or allocation is larger than the device memory.

Change-Id: Iccd3377e95a6cc6d23e45d4738a17af8b9ee32d7
This commit is contained in:
pghafari
2024-09-25 19:47:00 -04:00
کامیت شده توسط Payam Ghafari
والد 07bcc283f9
کامیت b07178618c
+5 -2
مشاهده پرونده
@@ -314,8 +314,11 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags)
const auto& dev_info = amdContext->devices()[0]->info();
hip::getCurrentDevice()->SetActiveStatus();
if ((!useHostDevice && (dev_info.maxMemAllocSize_ < sizeBytes)) ||
(useHostDevice && (dev_info.maxPhysicalMemAllocSize_ < sizeBytes))) {
if (dev_info.maxPhysicalMemAllocSize_ < sizeBytes) {
return hipErrorOutOfMemory;
}
// PAL allocates from system memory if needed
if (IS_LINUX && !useHostDevice && (dev_info.maxMemAllocSize_ < sizeBytes)) {
return hipErrorOutOfMemory;
}