Allow debug flag to apply allocation alignment for heaps

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2022-08-29 13:30:21 +00:00
committed by Compute-Runtime-Automation
parent 841e536bc2
commit 4809a2a9b3
4 changed files with 34 additions and 6 deletions

View File

@@ -68,7 +68,7 @@ class GfxPartition {
return getHeap(heapIndex).allocate(size);
}
uint64_t heapAllocateWithCustomAlignment(HeapIndex heapIndex, size_t &size, size_t alignment) {
MOCKABLE_VIRTUAL uint64_t heapAllocateWithCustomAlignment(HeapIndex heapIndex, size_t &size, size_t alignment) {
return getHeap(heapIndex).allocateWithCustomAlignment(size, alignment);
}

View File

@@ -1331,7 +1331,13 @@ uint64_t getGpuAddress(const AlignmentSelector &alignmentSelector, HeapAssigner
case AllocationType::INTERNAL_HEAP:
case AllocationType::DEBUG_MODULE_AREA: {
auto heap = heapAssigner.get32BitHeapIndex(allocType, true, hwInfo, useFrontWindow);
gpuAddress = gmmHelper.canonize(gfxPartition->heapAllocate(heap, sizeAllocated));
size_t alignment = 0;
if (DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.get() != -1) {
alignment = static_cast<size_t>(DebugManager.flags.ExperimentalEnableCustomLocalMemoryAlignment.get());
}
gpuAddress = gmmHelper.canonize(gfxPartition->heapAllocateWithCustomAlignment(heap, sizeAllocated, alignment));
} break;
case AllocationType::WRITE_COMBINED:
sizeAllocated = 0;
@@ -1744,12 +1750,12 @@ void createMemoryRegionsForSharedAllocation(const HardwareInfo &hwInfo, MemoryIn
auto memoryBanks = allocationData.storageInfo.memoryBanks;
if (allocationData.usmInitialPlacement == GraphicsAllocation::UsmInitialPlacement::CPU) {
//System memory region
// System memory region
auto regionClassAndInstance = memoryInfo.getMemoryRegionClassAndInstance(0u, hwInfo);
memRegions.push_back(regionClassAndInstance);
}
//All local memory regions
// All local memory regions
size_t currentBank = 0;
size_t i = 0;
@@ -1763,7 +1769,7 @@ void createMemoryRegionsForSharedAllocation(const HardwareInfo &hwInfo, MemoryIn
}
if (allocationData.usmInitialPlacement == GraphicsAllocation::UsmInitialPlacement::GPU) {
//System memory region
// System memory region
auto regionClassAndInstance = memoryInfo.getMemoryRegionClassAndInstance(0u, hwInfo);
memRegions.push_back(regionClassAndInstance);
}