fix: apply 2MB alignment to large local memory allocations

In this patch, we align up the allocation size to 2MB for all
allocations >= 2MB located in local memory.
2MB alignment support is defined by function:
`is2MBLocalMemAlignmentEnabled`

Related-To: NEO-12287

Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwoliński
2025-01-30 15:37:10 +00:00
committed by Compute-Runtime-Automation
parent 3b571d140c
commit 7918b44a94
7 changed files with 58 additions and 3 deletions

View File

@@ -2073,6 +2073,13 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A
} else {
sizeAligned = alignUp(allocationData.size, MemoryConstants::pageSize64k);
}
auto &productHelper = gmmHelper->getRootDeviceEnvironment().getHelper<ProductHelper>();
if (productHelper.is2MBLocalMemAlignmentEnabled() &&
allocationData.size >= MemoryConstants::pageSize2M) {
sizeAligned = alignUp(sizeAligned, MemoryConstants::pageSize2M);
}
if (debugManager.flags.ExperimentalAlignLocalMemorySizeTo2MB.get()) {
sizeAligned = alignUp(sizeAligned, MemoryConstants::pageSize2M);
}

View File

@@ -194,6 +194,7 @@ class ProductHelper {
virtual uint32_t getCommandBuffersPreallocatedPerCommandQueue() const = 0;
virtual uint32_t getInternalHeapsPreallocated() const = 0;
virtual bool overrideAllocationCacheable(const AllocationData &allocationData) const = 0;
virtual bool is2MBLocalMemAlignmentEnabled() const = 0;
virtual bool getFrontEndPropertyScratchSizeSupport() const = 0;
virtual bool getFrontEndPropertyPrivateScratchSizeSupport() const = 0;

View File

@@ -223,6 +223,11 @@ bool ProductHelperHw<gfxProduct>::overrideAllocationCacheable(const AllocationDa
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::is2MBLocalMemAlignmentEnabled() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const {
return false;

View File

@@ -136,6 +136,7 @@ class ProductHelperHw : public ProductHelper {
uint32_t getCommandBuffersPreallocatedPerCommandQueue() const override;
uint32_t getInternalHeapsPreallocated() const override;
bool overrideAllocationCacheable(const AllocationData &allocationData) const override;
bool is2MBLocalMemAlignmentEnabled() const override;
bool getFrontEndPropertyScratchSizeSupport() const override;
bool getFrontEndPropertyPrivateScratchSizeSupport() const override;