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

@@ -42,6 +42,7 @@
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/page_fault_manager/cpu_page_fault_manager.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/utilities/logger_neo_only.h"
namespace NEO {
@@ -653,11 +654,12 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
case AllocationType::svmGpu:
case AllocationType::image:
if (false == allocationData.flags.uncacheable && useLocalPreferredForCacheableBuffers) {
if (!allocationData.flags.preferCompressed) {
if ((usmDeviceAllocationMode == LocalMemAllocationMode::hwDefault) && !allocationData.flags.preferCompressed) {
allocationData.storageInfo.localOnlyRequired = false;
}
allocationData.storageInfo.systemMemoryPlacement = false;
}
break;
default:
break;
}
@@ -1250,4 +1252,12 @@ void MemoryManager::removeCustomHeapAllocatorConfig(AllocationType allocationTyp
customHeapAllocators.erase({allocationType, isFrontWindowPool});
}
bool MemoryManager::getLocalOnlyRequired(AllocationType allocationType, const ProductHelper &productHelper, const ReleaseHelper *releaseHelper, bool preferCompressed) const {
const bool enabledForRelease{!releaseHelper || releaseHelper->isLocalOnlyAllowed()};
if (allocationType == AllocationType::buffer || allocationType == AllocationType::svmGpu) {
return productHelper.getStorageInfoLocalOnlyFlag(usmDeviceAllocationMode, enabledForRelease);
}
return (preferCompressed ? enabledForRelease : false);
}
} // namespace NEO