SWDEV-309286 - Add check to limit host malloc upto system memory size
Change-Id: I4a0f55d6f7faa323b16d9b8fb12e876900da1bbc
Этот коммит содержится в:
@@ -274,11 +274,14 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags)
|
||||
return hipErrorOutOfMemory;
|
||||
}
|
||||
|
||||
if (!useHostDevice && (amdContext->devices()[0]->info().maxMemAllocSize_ < sizeBytes)) {
|
||||
const auto& dev_info = amdContext->devices()[0]->info();
|
||||
|
||||
if ((!useHostDevice && (dev_info.maxMemAllocSize_ < sizeBytes)) ||
|
||||
(useHostDevice && (dev_info.maxPhysicalMemAllocSize_ < sizeBytes))) {
|
||||
return hipErrorOutOfMemory;
|
||||
}
|
||||
|
||||
*ptr = amd::SvmBuffer::malloc(*amdContext, flags, sizeBytes, amdContext->devices()[0]->info().memBaseAddrAlign_,
|
||||
*ptr = amd::SvmBuffer::malloc(*amdContext, flags, sizeBytes, dev_info.memBaseAddrAlign_,
|
||||
useHostDevice ? curDevContext->svmDevices()[0] : nullptr);
|
||||
|
||||
if (*ptr == nullptr) {
|
||||
|
||||
Ссылка в новой задаче
Block a user