Skip to content

Commit cd9a35d

Browse files
Align gfx partition with standard heaps to max heaps granularity
Related-To: NEO-5507 Signed-off-by: Milczarek, Slawomir <[email protected]>
1 parent b0f2c76 commit cd9a35d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

opencl/test/unit_test/memory_manager/gfx_partition_tests.inl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ void testGfxPartition(MockGfxPartition &gfxPartition, uint64_t gfxBase, uint64_t
8282

8383
constexpr uint32_t numStandardHeaps = static_cast<uint32_t>(HeapIndex::HEAP_STANDARD2MB) - static_cast<uint32_t>(HeapIndex::HEAP_STANDARD) + 1;
8484
constexpr uint64_t maxStandardHeapGranularity = std::max(GfxPartition::heapGranularity, GfxPartition::heapGranularity2MB);
85+
86+
gfxBase = alignUp(gfxBase, maxStandardHeapGranularity);
8587
uint64_t maxStandardHeapSize = alignDown((gfxTop - gfxBase) / numStandardHeaps, maxStandardHeapGranularity);
8688

8789
EXPECT_TRUE(gfxPartition.heapInitialized(HeapIndex::HEAP_STANDARD));
@@ -236,6 +238,7 @@ TEST(GfxPartitionTest, GivenFullRange47BitSvmHeap64KbSplitWhenTestingGfxPartitio
236238

237239
constexpr auto numStandardHeaps = static_cast<uint32_t>(HeapIndex::HEAP_STANDARD2MB) - static_cast<uint32_t>(HeapIndex::HEAP_STANDARD) + 1;
238240
constexpr auto maxStandardHeapGranularity = std::max(GfxPartition::heapGranularity, GfxPartition::heapGranularity2MB);
241+
gfxBase = alignUp(gfxBase, maxStandardHeapGranularity);
239242
auto maxStandardHeapSize = alignDown((gfxTop - gfxBase - 4 * sizeHeap32) / numStandardHeaps, maxStandardHeapGranularity);
240243
auto heapStandard64KBSize = alignDown(maxStandardHeapSize / numRootDevices, GfxPartition::heapGranularity);
241244

shared/source/memory_manager/gfx_partition.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ bool GfxPartition::init(uint64_t gpuAddressSpace, size_t cpuAddressRangeSizeToRe
191191

192192
constexpr uint32_t numStandardHeaps = static_cast<uint32_t>(HeapIndex::HEAP_STANDARD2MB) - static_cast<uint32_t>(HeapIndex::HEAP_STANDARD) + 1;
193193
constexpr uint64_t maxStandardHeapGranularity = std::max(GfxPartition::heapGranularity, GfxPartition::heapGranularity2MB);
194+
195+
gfxBase = alignUp(gfxBase, maxStandardHeapGranularity);
194196
uint64_t maxStandardHeapSize = alignDown((gfxTop - gfxBase) / numStandardHeaps, maxStandardHeapGranularity);
195197

196198
auto gfxStandardSize = maxStandardHeapSize;

0 commit comments

Comments
 (0)