SWDEV-524188 - Check for VRam and system RAM properly (#122)
Currently, we check if there's enough system RAM even if we don't allocate on host device. This is incorrect logic.
We should not check for this size on windows because PAL checks for memory allocation. See SWDEV-467263.
Co-authored-by: Jimbo Xie <jiabaxie@amd.com>
[ROCm/clr commit: 0d6e554d92]
Цей коміт міститься в:
зафіксовано
GitHub
джерело
07c7d3e860
коміт
88841d1dee
@@ -344,11 +344,11 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags)
|
||||
const auto& dev_info = amdContext->devices()[0]->info();
|
||||
hip::getCurrentDevice()->SetActiveStatus();
|
||||
|
||||
if (dev_info.maxPhysicalMemAllocSize_ < sizeBytes) {
|
||||
return hipErrorOutOfMemory;
|
||||
}
|
||||
// PAL allocates from system memory if needed
|
||||
if (IS_LINUX && !useHostDevice && (dev_info.maxMemAllocSize_ < sizeBytes)) {
|
||||
size_t max_device_size = IS_LINUX ? dev_info.maxMemAllocSize_ :
|
||||
(dev_info.maxMemAllocSize_ + dev_info.maxPhysicalMemAllocSize_);
|
||||
|
||||
if ((useHostDevice && dev_info.maxPhysicalMemAllocSize_ < sizeBytes) ||
|
||||
(!useHostDevice && max_device_size < sizeBytes)) {
|
||||
return hipErrorOutOfMemory;
|
||||
}
|
||||
|
||||
|
||||
Посилання в новій задачі
Заблокувати користувача