fix: do not align to 64kb when requested alignment is bigger

Related-To: NEO-14082
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2025-07-11 12:26:55 +00:00
committed by Compute-Runtime-Automation
parent 4b9010b87d
commit 33749b8b5a
2 changed files with 32 additions and 1 deletions

View File

@@ -385,6 +385,37 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryWithoutAllow64kbP
memoryManager.freeGraphicsMemory(allocation);
}
TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryWithAllow64kbPagesFlagsIsAllocatedThen64kbAllocationIsReturned) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MockMemoryManager memoryManager(true, false, executionEnvironment);
AllocationData allocData;
AllocationProperties properties(mockRootDeviceIndex, 10, AllocationType::buffer, mockDeviceBitfield);
memoryManager.getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
allocData.flags.allow64kbPages = true;
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
EXPECT_TRUE(memoryManager.allocation64kbPageCreated);
memoryManager.freeGraphicsMemory(allocation);
}
TEST(MemoryManagerTest, givenEnabled64kbPagesWhenAlignmentIsBiggerThan64kbThenNon64kbAllocationIsReturned) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MockMemoryManager memoryManager(true, false, executionEnvironment);
AllocationData allocData;
AllocationProperties properties(mockRootDeviceIndex, 10, AllocationType::buffer, mockDeviceBitfield);
memoryManager.getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
allocData.flags.allow64kbPages = true;
allocData.alignment = 2 * MemoryConstants::pageSize64k;
auto allocation = memoryManager.allocateGraphicsMemory(allocData);
EXPECT_FALSE(memoryManager.allocation64kbPageCreated);
memoryManager.freeGraphicsMemory(allocation);
}
TEST(MemoryManagerTest, givenDisabled64kbPagesWhenGraphicsMemoryMustBeHostMemoryAndIsAllocatedWithNullptrForBufferThenNon64kbAllocationIsReturned) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MockMemoryManager memoryManager(false, false, executionEnvironment);