feature: add NEO_LOCAL_MEMORY_ALLOCATION_MODE

Allow the application to force storageInfo.localOnly and get the
out-of-memory returned if not possible.

This is a windows-only feature supported on discrete platforms.

Related-To: NEO-13428
Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
This commit is contained in:
Maciej Bielski
2025-04-01 18:09:02 +00:00
committed by Compute-Runtime-Automation
parent 0f19182214
commit 0f8ee57f98
31 changed files with 363 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,9 +29,11 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
return storageInfo;
}
const auto deviceCount = GfxCoreHelper::getSubDevicesCount(executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getHardwareInfo());
const auto *rootDeviceEnv{executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex].get()};
const auto deviceCount = GfxCoreHelper::getSubDevicesCount(rootDeviceEnv->getHardwareInfo());
const auto leastOccupiedBank = getLocalMemoryUsageBankSelector(properties.allocationType, properties.rootDeviceIndex)->getLeastOccupiedBank(properties.subDevicesBitfield);
const auto subDevicesMask = executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->deviceAffinityMask.getGenericSubDevicesMask().to_ulong();
const auto subDevicesMask = rootDeviceEnv->deviceAffinityMask.getGenericSubDevicesMask().to_ulong();
const DeviceBitfield allTilesValue(properties.subDevicesBitfield.count() == 1 ? maxNBitValue(deviceCount) & subDevicesMask : properties.subDevicesBitfield);
DeviceBitfield preferredTile;
@@ -50,7 +52,6 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
AppResourceHelper::copyResourceTagStr(storageInfo.resourceTag, properties.allocationType,
sizeof(storageInfo.resourceTag));
auto releaseHelper = executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getReleaseHelper();
switch (properties.allocationType) {
case AllocationType::constantSurface:
case AllocationType::kernelIsa:
@@ -128,9 +129,6 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
storageInfo.colouringPolicy = colouringPolicy;
storageInfo.colouringGranularity = granularity;
}
if (!releaseHelper || releaseHelper->isLocalOnlyAllowed()) {
storageInfo.localOnlyRequired = true;
}
if (properties.flags.shareable) {
storageInfo.isLockable = false;
@@ -140,9 +138,12 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
default:
break;
}
if (properties.flags.preferCompressed && (!releaseHelper || releaseHelper->isLocalOnlyAllowed())) {
storageInfo.localOnlyRequired = true;
}
storageInfo.localOnlyRequired = getLocalOnlyRequired(properties.allocationType,
rootDeviceEnv->getProductHelper(),
rootDeviceEnv->getReleaseHelper(),
properties.flags.preferCompressed);
if (debugManager.flags.ForceMultiTileAllocPlacement.get()) {
UNRECOVERABLE_IF(properties.allocationType == AllocationType::unknown);
if ((1llu << (static_cast<int64_t>(properties.allocationType) - 1)) & debugManager.flags.ForceMultiTileAllocPlacement.get()) {