fix: support alignments in host and shared UnifiedMemoryAllocation

Related-To: LOCI-4334

Signed-off-by: Lu, Wenbin <wenbin.lu@intel.com>
This commit is contained in:
Lu, Wenbin
2023-06-16 17:55:01 +00:00
committed by Compute-Runtime-Automation
parent b9837ef068
commit 4de792cee0
7 changed files with 157 additions and 13 deletions

View File

@@ -619,7 +619,7 @@ GraphicsAllocation *DrmMemoryManager::allocateMemoryByKMD(const AllocationData &
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), allocationData.hostPtr,
allocationData.size, 0u, CacheSettingsHelper::getGmmUsageType(allocationData.type, allocationData.flags.uncacheable, productHelper), false, systemMemoryStorageInfo, true);
size_t bufferSize = allocationData.size;
uint64_t gpuRange = acquireGpuRange(bufferSize, allocationData.rootDeviceIndex, HeapIndex::HEAP_STANDARD64KB);
uint64_t gpuRange = acquireGpuRangeWithCustomAlignment(bufferSize, allocationData.rootDeviceIndex, HeapIndex::HEAP_STANDARD64KB, allocationData.alignment);
GemCreate create{};
create.size = bufferSize;
@@ -1602,6 +1602,9 @@ AllocationStatus getGpuAddress(const AlignmentSelector &alignmentSelector, HeapA
alignment.heap = HeapIndex::HEAP_EXTENDED;
}
if (alignment.alignment < allocationData.alignment) {
alignment.alignment = allocationData.alignment;
}
gpuAddress = gmmHelper->canonize(gfxPartition->heapAllocateWithCustomAlignment(alignment.heap, sizeAllocated, alignment.alignment));
break;
}