Introduced standard heap with 2MB alignment on Linux

Related-To: NEO-5507

Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
Slawomir Milczarek
2021-03-01 12:11:41 +00:00
committed by Compute-Runtime-Automation
parent c1cabb505a
commit 049166688c
7 changed files with 47 additions and 28 deletions

View File

@@ -184,14 +184,20 @@ bool GfxPartition::init(uint64_t gpuAddressSpace, size_t cpuAddressRangeSizeToRe
gfxBase += gfxHeap32Size;
}
uint64_t gfxStandardSize = alignDown((gfxTop - gfxBase) >> 1, heapGranularity);
uint32_t numStandardHeaps = static_cast<uint32_t>(HeapIndex::HEAP_STANDARD2MB) - static_cast<uint32_t>(HeapIndex::HEAP_STANDARD) + 1;
uint64_t gfxStandardSize = alignDown((gfxTop - gfxBase) / numStandardHeaps, heapGranularity);
heapInit(HeapIndex::HEAP_STANDARD, gfxBase, gfxStandardSize);
gfxBase += gfxStandardSize;
// Split HEAP_STANDARD64K among root devices
auto gfxStandard64KBSize = alignDown(gfxStandardSize / numRootDevices, GfxPartition::heapGranularity);
heapInitWithAllocationAlignment(HeapIndex::HEAP_STANDARD64KB, gfxBase + rootDeviceIndex * gfxStandard64KBSize, gfxStandard64KBSize, 2 * MemoryConstants::megaByte);
heapInitWithAllocationAlignment(HeapIndex::HEAP_STANDARD64KB, gfxBase + rootDeviceIndex * gfxStandard64KBSize, gfxStandard64KBSize, MemoryConstants::pageSize64k);
gfxBase += gfxStandardSize;
// Split HEAP_STANDARD2MB among root devices
auto gfxStandard2MBSize = alignDown(gfxStandardSize / numRootDevices, GfxPartition::heapGranularity);
heapInitWithAllocationAlignment(HeapIndex::HEAP_STANDARD2MB, gfxBase + rootDeviceIndex * gfxStandard2MBSize, gfxStandard2MBSize, 2 * MemoryConstants::megaByte);
return true;
}

View File

@@ -23,6 +23,7 @@ enum class HeapIndex : uint32_t {
HEAP_EXTERNAL = 3u,
HEAP_STANDARD,
HEAP_STANDARD64KB,
HEAP_STANDARD2MB,
HEAP_SVM,
HEAP_EXTENDED,
HEAP_EXTERNAL_FRONT_WINDOW,
@@ -83,7 +84,8 @@ class GfxPartition {
}
uint64_t getHeapMinimalAddress(HeapIndex heapIndex) {
if (heapIndex == HeapIndex::HEAP_EXTERNAL_DEVICE_FRONT_WINDOW ||
if (heapIndex == HeapIndex::HEAP_SVM ||
heapIndex == HeapIndex::HEAP_EXTERNAL_DEVICE_FRONT_WINDOW ||
heapIndex == HeapIndex::HEAP_EXTERNAL_FRONT_WINDOW ||
heapIndex == HeapIndex::HEAP_INTERNAL_DEVICE_FRONT_WINDOW ||
heapIndex == HeapIndex::HEAP_INTERNAL_FRONT_WINDOW) {
@@ -103,7 +105,7 @@ class GfxPartition {
bool isLimitedRange() { return getHeap(HeapIndex::HEAP_SVM).getSize() == 0ull; }
static const uint64_t heapGranularity = MemoryConstants::pageSize64k;
static const uint64_t heapGranularity = 2 * MemoryConstants::megaByte;
static constexpr size_t externalFrontWindowPoolSize = 16 * MemoryConstants::megaByte;
static constexpr size_t internalFrontWindowPoolSize = 1 * MemoryConstants::megaByte;