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
Этот коммит содержится в:
pghafari authored and Payam Ghafari committed 2024-10-03 11:14:08 -04:00
1 родитель 07bcc283f9
Коммит b07178618c
1 file changed
+5 -2
+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;
}