feature: track InOrder allocation ownership

CmdList can be released before Event. In this case, GfxAllocation
destruction must be deferred.

Related-To: NEO-7966

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2023-09-25 10:10:46 +00:00
committed by Compute-Runtime-Automation
parent e16220dc9f
commit 202a33ffac
7 changed files with 79 additions and 21 deletions

View File

@@ -72,6 +72,23 @@ TEST(MemoryManagerTest, givenDefaultMemoryManagerWhenGraphicsAllocationContainsE
memoryManager.freeGraphicsMemory(graphicsAllocation);
}
TEST(MemoryManagerTest, givenMultipleOwnersWhenReleasingAllocationThenFreeOnlyWhenNoActiveOwners) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
OsAgnosticMemoryManager memoryManager(executionEnvironment);
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{0, MemoryConstants::pageSize});
graphicsAllocation->incNumOwners();
graphicsAllocation->incNumOwners();
EXPECT_EQ(3u, graphicsAllocation->fetchDecNumOwners());
graphicsAllocation->incNumOwners();
memoryManager.freeGraphicsMemory(graphicsAllocation);
EXPECT_EQ(2u, graphicsAllocation->fetchDecNumOwners());
memoryManager.freeGraphicsMemory(graphicsAllocation);
}
TEST(MemoryManagerTest, whenGettingPreferredAllocationMethodThenNotDefinedIsReturned) {
MockMemoryManager memoryManager;
for (auto i = 0; i < static_cast<int>(AllocationType::COUNT); i++) {