Files
compute-runtime/shared/source/helpers/heap_assigner.cpp
Maciej Plewka a779e44b52 Support for dsh and ssh on external heap in L0
Related-To: NEO-4724

Change-Id: I85c2effea8a99bebaf9e3db33129641f37dcabe5
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
2020-08-30 06:56:52 +02:00

38 lines
1.4 KiB
C++

/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/heap_assigner.h"
#include "shared/source/helpers/heap_assigner_config.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/memory_manager/memory_manager.h"
namespace NEO {
HeapAssigner::HeapAssigner() {
apiAllowExternalHeapForSshAndDsh = HeapAssignerConfig::getConfiguration();
}
bool HeapAssigner::useInternal32BitHeap(GraphicsAllocation::AllocationType allocType) {
return allocType == GraphicsAllocation::AllocationType::KERNEL_ISA ||
allocType == GraphicsAllocation::AllocationType::INTERNAL_HEAP;
}
bool HeapAssigner::use32BitHeap(GraphicsAllocation::AllocationType allocType) {
return useExternal32BitHeap(allocType) || useInternal32BitHeap(allocType);
}
HeapIndex HeapAssigner::get32BitHeapIndex(GraphicsAllocation::AllocationType allocType, bool useLocalMem, const HardwareInfo &hwInfo) {
if (useInternal32BitHeap(allocType)) {
return MemoryManager::selectInternalHeap(useLocalMem);
}
return MemoryManager::selectExternalHeap(useLocalMem);
}
bool HeapAssigner::useExternal32BitHeap(GraphicsAllocation::AllocationType allocType) {
if (apiAllowExternalHeapForSshAndDsh) {
return allocType == GraphicsAllocation::AllocationType::LINEAR_STREAM;
}
return false;
}
} // namespace NEO