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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
مرجع در شماره جدید
Block a user