mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 05:24:02 +08:00
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:
committed by
Compute-Runtime-Automation
parent
3b571d140c
commit
7918b44a94
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user