fix: add missing AlignLocalMemoryVaTo2MB flag support

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2024-08-01 11:49:25 +00:00 committed by Compute-Runtime-Automation
parent 7ca0210ef2
commit 5ccfd6f2be
3 changed files with 23 additions and 8 deletions

View File

@ -844,10 +844,14 @@ size_t ModuleImp::computeKernelIsaAllocationAlignedSizeWithPadding(size_t isaSiz
NEO::GraphicsAllocation *ModuleImp::allocateKernelsIsaMemory(size_t size) {
auto allocType = (this->type == ModuleType::builtin ? NEO::AllocationType::kernelIsaInternal : NEO::AllocationType::kernelIsa);
auto neoDevice = this->device->getNEODevice();
return neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({neoDevice->getRootDeviceIndex(),
size,
allocType,
neoDevice->getDeviceBitfield()});
NEO::AllocationProperties properties{neoDevice->getRootDeviceIndex(), size, allocType, neoDevice->getDeviceBitfield()};
if (NEO::debugManager.flags.AlignLocalMemoryVaTo2MB.get() == 1) {
properties.alignment = MemoryConstants::pageSize2M;
}
return neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
}
void ModuleImp::createDebugZebin() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2023 Intel Corporation
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -21,6 +21,10 @@ GraphicsAllocation *HeapHelper::getHeapAllocation(uint32_t heapType, size_t heap
allocationType = AllocationType::internalHeap;
}
if (NEO::debugManager.flags.AlignLocalMemoryVaTo2MB.get() == 1) {
alignment = MemoryConstants::pageSize2M;
}
auto allocation = this->storageForReuse->obtainReusableAllocation(heapSize, allocationType);
if (allocation) {
return allocation.release();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -7,6 +7,7 @@
#include "shared/source/program/kernel_info.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/device/device.h"
#include "shared/source/device_binary_format/zebin/zebin_elf.h"
#include "shared/source/helpers/kernel_helpers.h"
@ -59,6 +60,12 @@ bool KernelInfo::createKernelAllocation(const Device &device, bool internalIsa)
auto kernelIsaSize = heapInfo.kernelHeapSize;
const auto allocType = internalIsa ? AllocationType::kernelIsaInternal : AllocationType::kernelIsa;
AllocationProperties properties = {device.getRootDeviceIndex(), kernelIsaSize, allocType, device.getDeviceBitfield()};
if (debugManager.flags.AlignLocalMemoryVaTo2MB.get() == 1) {
properties.alignment = MemoryConstants::pageSize2M;
}
if (device.getMemoryManager()->isKernelBinaryReuseEnabled()) {
auto lock = device.getMemoryManager()->lockKernelAllocationMap();
auto kernelName = this->kernelDescriptor.kernelMetadata.kernelName;
@ -74,11 +81,11 @@ bool KernelInfo::createKernelAllocation(const Device &device, bool internalIsa)
device, kernelAllocation, 0, heapInfo.pKernelHeap,
static_cast<size_t>(kernelIsaSize));
} else {
kernelAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), kernelIsaSize, allocType, device.getDeviceBitfield()});
kernelAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
storedAllocations.insert(std::make_pair(kernelName, MemoryManager::KernelAllocationInfo(kernelAllocation, 1u)));
}
} else {
kernelAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), kernelIsaSize, allocType, device.getDeviceBitfield()});
kernelAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
}
if (!kernelAllocation) {