diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index 31326ba766..791ee384ed 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -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; }