Allow aligning allocations VA to 2MBt pu

Currently under a debug flag

Related-To: NEO-5750
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2021-04-16 16:20:51 +00:00
committed by Compute-Runtime-Automation
parent 6bb76c82e3
commit 2d1ef04100
4 changed files with 136 additions and 2 deletions

View File

@@ -225,6 +225,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideSlmSize, -1, "Force different slm size t
DECLARE_DEBUG_VARIABLE(int32_t, UseCyclesPerSecondTimer, 0, "0: default behavior, 0: disabled: Report L0 timer in nanosecond units, 1: enabled: Report L0 timer in cycles per second")
DECLARE_DEBUG_VARIABLE(int32_t, WaitLoopCount, -1, "-1: use default, >=0: number of iterations in wait loop")
DECLARE_DEBUG_VARIABLE(int32_t, GTPinAllocateBufferInSharedMemory, -1, "Force GTPin to allocate buffer in shared memory")
DECLARE_DEBUG_VARIABLE(int32_t, AlignLocalMemoryVaTo2MB, -1, "VA for local mem allocs greater than 2MB, will be aligned to 2MB on Linux -1: default, 0: disabled, 1: enabled")
/*DRIVER TOGGLES*/
DECLARE_DEBUG_VARIABLE(int32_t, ForceOCLVersion, 0, "Force specific OpenCL API version")

View File

@@ -144,10 +144,16 @@ uint64_t getGpuAddress(HeapAssigner &heapAssigner, const HardwareInfo &hwInfo, G
sizeAllocated = 0;
break;
default:
const bool prefer2MBAlignment = DebugManager.flags.AlignLocalMemoryVaTo2MB.get() != 0 && sizeAllocated >= 2 * MemoryConstants::megaByte;
const bool prefer57bitAddressing = gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0 && !resource48Bit;
auto heapIndex = HeapIndex::HEAP_STANDARD64KB;
if ((gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0) && !resource48Bit) {
if (prefer2MBAlignment) {
heapIndex = HeapIndex::HEAP_STANDARD2MB;
} else if (prefer57bitAddressing) {
heapIndex = HeapIndex::HEAP_EXTENDED;
}
gpuAddress = GmmHelper::canonize(gfxPartition->heapAllocate(heapIndex, sizeAllocated));
break;
}