fix: reduce globalMemory by internalResourcesSize for iGPUs

internalResourcesSize is a constant 450 MB value.

Related-To: NEO-8989
Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwolinski 2023-10-19 18:50:13 +00:00 committed by Compute-Runtime-Automation
parent 77b3167e30
commit 55abd8dc9a
2 changed files with 14 additions and 1 deletions

View File

@ -422,7 +422,14 @@ TEST_F(DeviceGetCapsTest, Given32bitAddressingWhenDeviceIsCreatedThenGlobalMemSi
cl_ulong sharedMem = (cl_ulong)pMemManager->getSystemSharedMemory(0u);
cl_ulong maxAppAddrSpace = (cl_ulong)pMemManager->getMaxApplicationAddress() + 1ULL;
cl_ulong memSize = std::min(sharedMem, maxAppAddrSpace);
memSize = (cl_ulong)((double)memSize * memSizePercent);
size_t internalResourcesSize = 0u;
if (!pMemManager->isLocalMemorySupported(device->getRootDeviceIndex())) {
internalResourcesSize = 450 * MemoryConstants::megaByte;
}
memSize = (cl_ulong)((double)memSize * memSizePercent) - internalResourcesSize;
if (addressing32Bit) {
memSize = std::min(memSize, (uint64_t)(4 * GB * memSizePercent));
}

View File

@ -580,6 +580,12 @@ uint64_t Device::getGlobalMemorySize(uint32_t deviceBitfield) const {
double percentOfGlobalMemoryAvailable = getPercentOfGlobalMemoryAvailable();
globalMemorySize = static_cast<uint64_t>(static_cast<double>(globalMemorySize) * percentOfGlobalMemoryAvailable);
if (DebugManager.flags.ClDeviceGlobalMemSizeAvailablePercent.get() == -1 &&
!getMemoryManager()->isLocalMemorySupported(this->getRootDeviceIndex())) {
const uint64_t internalResourcesSize = 450 * MemoryConstants::megaByte;
globalMemorySize = std::max(static_cast<uint64_t>(0), globalMemorySize - internalResourcesSize);
}
return globalMemorySize;
}