Improve address alignment logic.
Resolves: NEO-7543 Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
parent
31acfd8dbb
commit
a104636b31
|
@ -1374,7 +1374,7 @@ uint64_t getGpuAddress(const AlignmentSelector &alignmentSelector, HeapAssigner
|
|||
default:
|
||||
AlignmentSelector::CandidateAlignment alignment = alignmentSelector.selectAlignment(sizeAllocated);
|
||||
if (gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0 && !resource48Bit) {
|
||||
auto alignSize = true;
|
||||
auto alignSize = sizeAllocated >= 8 * MemoryConstants::gigaByte && Math::isPow2(sizeAllocated);
|
||||
if (DebugManager.flags.UseHighAlignmentForHeapExtended.get() != -1) {
|
||||
alignSize = !!DebugManager.flags.UseHighAlignmentForHeapExtended.get();
|
||||
}
|
||||
|
|
|
@ -5123,12 +5123,12 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenOversize
|
|||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenHeapExtendedWhenAllocationsAreMadeTheyAreAlignedToPreviousPowerOfTwo) {
|
||||
TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenAllocationsThatAreAlignedToPowerOf2InSizeAndAreGreaterThen8GBThenTheyAreAlignedToPreviousPowerOfTwoForGpuVirtualAddress) {
|
||||
if (!memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(HeapIndex::HEAP_EXTENDED)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto size = 16 * MemoryConstants::megaByte;
|
||||
auto size = 8 * MemoryConstants::gigaByte;
|
||||
|
||||
auto status = MemoryManager::AllocationStatus::Error;
|
||||
AllocationData allocData;
|
||||
|
@ -5142,14 +5142,14 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenHeapExte
|
|||
EXPECT_EQ(allocData.size, static_cast<DrmAllocation *>(allocation)->getBO()->peekSize());
|
||||
EXPECT_TRUE(allocation->getGpuAddress() % size == 0u);
|
||||
|
||||
size = 33 * MemoryConstants::megaByte;
|
||||
size = 8 * MemoryConstants::gigaByte + MemoryConstants::pageSize64k;
|
||||
allocData.size = size;
|
||||
auto allocation2 = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
EXPECT_EQ(allocData.size, allocation2->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(allocData.size, static_cast<DrmAllocation *>(allocation2)->getBO()->peekSize());
|
||||
EXPECT_TRUE(allocation2->getGpuAddress() % Math::prevPowerOfTwo(size) == 0u);
|
||||
EXPECT_TRUE(allocation2->getGpuAddress() % MemoryConstants::pageSize2Mb == 0u);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
memoryManager->freeGraphicsMemory(allocation2);
|
||||
|
|
Loading…
Reference in New Issue