Enable 64kb pages when its allowed by platform

Change-Id: I10f02bd83beabeff929e16c7293324b81bfed054
This commit is contained in:
Dunajski, Bartosz
2018-07-11 09:45:20 +02:00
parent 7735fb5767
commit 85d7081beb
8 changed files with 37 additions and 8 deletions

View File

@@ -25,8 +25,10 @@
#include "runtime/event/event.h"
#include "runtime/mem_obj/image.h"
#include "runtime/utilities/tag_allocator.h"
#include "runtime/os_interface/os_interface.h"
#include "unit_tests/helpers/debug_manager_state_restore.h"
#include "unit_tests/helpers/memory_management.h"
#include "unit_tests/helpers/variable_backup.h"
#include "unit_tests/utilities/containers_tests_helpers.h"
#include "unit_tests/fixtures/memory_allocator_fixture.h"
#include "unit_tests/fixtures/memory_manager_fixture.h"
@@ -863,6 +865,26 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesDisabledWhenAllocat
memoryManager.freeGraphicsMemory(svmAllocation);
}
TEST(OsAgnosticMemoryManager, givenDeviceWith64kbPagesEnabledWhenCreatingMemoryManagerThenAllowFor64kbAllocations) {
VariableBackup<bool> os64kbPagesEnabled(&OSInterface::osEnabled64kbPages, true);
HardwareInfo localHwInfo = *platformDevices[0];
localHwInfo.capabilityTable.ftr64KBpages = true;
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(&localHwInfo));
EXPECT_TRUE(device->getEnabled64kbPages());
EXPECT_TRUE(device->getMemoryManager()->peek64kbPagesEnabled());
}
TEST(OsAgnosticMemoryManager, givenDeviceWith64kbPagesDisbledWhenCreatingMemoryManagerThenDisallowFor64kbAllocations) {
HardwareInfo localHwInfo = *platformDevices[0];
localHwInfo.capabilityTable.ftr64KBpages = false;
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(&localHwInfo));
EXPECT_FALSE(device->getEnabled64kbPages());
EXPECT_FALSE(device->getMemoryManager()->peek64kbPagesEnabled());
}
TEST(OsAgnosticMemoryManager, givenMemoryManagerWith64KBPagesEnabledWhenAllocateGraphicsMemoryForSVMIsCalledThen64KBGraphicsAllocationIsReturned) {
OsAgnosticMemoryManager memoryManager(true);
auto size = 4096u;