Add alternative residency model on Linux

Related-To: NEO-4732

Change-Id: I79e165d2b647af200ca314e1183ecf05903de644
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2020-07-02 11:49:46 +02:00
parent 519e75e3d6
commit ff0add74e3
50 changed files with 521 additions and 272 deletions

View File

@@ -13,7 +13,7 @@
TEST_F(AubMemoryOperationsHandlerTests, givenNullPtrAsAubManagerWhenMakeResidentCalledThenFalseReturned) {
getMemoryOperationsHandler()->setAubManager(nullptr);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->makeResident(ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
auto result = memoryOperationsInterface->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
EXPECT_EQ(result, MemoryOperationsStatus::DEVICE_UNINITIALIZED);
}
@@ -21,7 +21,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledThe
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->makeResident(ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
auto result = memoryOperationsInterface->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
EXPECT_EQ(result, MemoryOperationsStatus::SUCCESS);
EXPECT_TRUE(aubManager.writeMemoryCalled);
}
@@ -30,36 +30,36 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAllocationWhenMakeResidentCalledThe
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
memoryOperationsInterface->makeResident(ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
memoryOperationsInterface->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
EXPECT_EQ(aubManager.hintToWriteMemory, AubMemDump::DataTypeHintValues::TraceNotype);
}
TEST_F(AubMemoryOperationsHandlerTests, givenNonResidentAllocationWhenIsResidentCalledThenFalseReturned) {
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->isResident(allocation);
auto result = memoryOperationsInterface->isResident(nullptr, allocation);
EXPECT_EQ(result, MemoryOperationsStatus::MEMORY_NOT_FOUND);
}
TEST_F(AubMemoryOperationsHandlerTests, givenResidentAllocationWhenIsResidentCalledThenTrueReturned) {
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
memoryOperationsInterface->makeResident(ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
auto result = memoryOperationsInterface->isResident(allocation);
memoryOperationsInterface->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
auto result = memoryOperationsInterface->isResident(nullptr, allocation);
EXPECT_EQ(result, MemoryOperationsStatus::SUCCESS);
}
TEST_F(AubMemoryOperationsHandlerTests, givenNonResidentAllocationWhenEvictCalledThenFalseReturned) {
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
auto result = memoryOperationsInterface->evict(allocation);
auto result = memoryOperationsInterface->evict(nullptr, allocation);
EXPECT_EQ(result, MemoryOperationsStatus::MEMORY_NOT_FOUND);
}
TEST_F(AubMemoryOperationsHandlerTests, givenResidentAllocationWhenEvictCalledThenTrueReturned) {
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);
auto memoryOperationsInterface = getMemoryOperationsHandler();
memoryOperationsInterface->makeResident(ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
auto result = memoryOperationsInterface->evict(allocation);
memoryOperationsInterface->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocPtr, 1));
auto result = memoryOperationsInterface->evict(nullptr, allocation);
EXPECT_EQ(result, MemoryOperationsStatus::SUCCESS);
}