fix: Adjust standard heaps when on 57 bit address space

Resolves: GSD-10871

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2025-04-09 11:28:57 +00:00
committed by Compute-Runtime-Automation
parent b31c3bb3ca
commit 1b5519a880
2 changed files with 37 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -296,6 +296,14 @@ bool GfxPartition::init(uint64_t gpuAddressSpace, size_t cpuAddressRangeSizeToRe
gfxBase = alignUp(gfxBase, maxStandardHeapGranularity);
uint64_t maxStandardHeapSize = alignDown((gfxTop - gfxBase) / numStandardHeaps, maxStandardHeapGranularity);
uint64_t maxStandard64HeapSize = maxStandardHeapSize;
uint64_t maxStandard2MBHeapSize = maxStandardHeapSize;
if (gpuAddressSpace == maxNBitValue(57)) {
maxStandardHeapSize *= 2;
maxStandard64HeapSize /= 2;
maxStandard2MBHeapSize /= 2;
}
auto gfxStandardSize = maxStandardHeapSize;
heapInit(HeapIndex::heapStandard, gfxBase, gfxStandardSize);
@@ -304,14 +312,14 @@ bool GfxPartition::init(uint64_t gpuAddressSpace, size_t cpuAddressRangeSizeToRe
gfxBase += maxStandardHeapSize;
// Split HEAP_STANDARD64K among root devices
auto gfxStandard64KBSize = alignDown(maxStandardHeapSize / numRootDevices, GfxPartition::heapGranularity);
auto gfxStandard64KBSize = alignDown(maxStandard64HeapSize / numRootDevices, GfxPartition::heapGranularity);
heapInitWithAllocationAlignment(HeapIndex::heapStandard64KB, gfxBase + rootDeviceIndex * gfxStandard64KBSize, gfxStandard64KBSize, MemoryConstants::pageSize64k);
DEBUG_BREAK_IF(!isAligned<GfxPartition::heapGranularity>(getHeapBase(HeapIndex::heapStandard64KB)));
gfxBase += maxStandardHeapSize;
gfxBase += maxStandard64HeapSize;
// Split HEAP_STANDARD2MB among root devices
auto gfxStandard2MBSize = alignDown(maxStandardHeapSize / numRootDevices, GfxPartition::heapGranularity2MB);
auto gfxStandard2MBSize = alignDown(maxStandard2MBHeapSize / numRootDevices, GfxPartition::heapGranularity2MB);
heapInitWithAllocationAlignment(HeapIndex::heapStandard2MB, gfxBase + rootDeviceIndex * gfxStandard2MBSize, gfxStandard2MBSize, 2 * MemoryConstants::megaByte);
DEBUG_BREAK_IF(!isAligned<GfxPartition::heapGranularity2MB>(getHeapBase(HeapIndex::heapStandard2MB)));