performance: Align host mem to 2MB when range is not limited

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>

Related-To: NEO-10217
This commit is contained in:
Maciej Plewka
2024-01-30 13:13:08 +00:00
committed by Compute-Runtime-Automation
parent 278ced35dc
commit 564e0f0319
4 changed files with 47 additions and 5 deletions

View File

@@ -517,12 +517,17 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(con
auto realAllocationSize = alignedSize;
auto offsetInPage = ptrDiff(allocationData.hostPtr, alignedPtr);
auto rootDeviceIndex = allocationData.rootDeviceIndex;
uint64_t gpuVirtualAddress = 0;
if (this->isLimitedRange(allocationData.rootDeviceIndex)) {
gpuVirtualAddress = acquireGpuRange(alignedSize, rootDeviceIndex, HeapIndex::heapStandard);
} else {
alignedSize = alignUp(alignedSize, MemoryConstants::pageSize2M);
gpuVirtualAddress = acquireGpuRangeWithCustomAlignment(alignedSize, rootDeviceIndex, HeapIndex::heapStandard, MemoryConstants::pageSize2M);
}
auto gpuVirtualAddress = acquireGpuRange(alignedSize, rootDeviceIndex, HeapIndex::heapStandard);
if (!gpuVirtualAddress) {
return nullptr;
}
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(allocUserptr(reinterpret_cast<uintptr_t>(alignedPtr), realAllocationSize, rootDeviceIndex));
if (!bo) {
releaseGpuRange(reinterpret_cast<void *>(gpuVirtualAddress), alignedSize, rootDeviceIndex);