Flush tag only if needed in deferred deleter

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-04-07 14:42:23 +00:00
committed by Compute-Runtime-Automation
parent dad49bd2ee
commit fffcf2612e
2 changed files with 25 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -100,6 +100,26 @@ HWTEST_F(DeferrableAllocationDeletionTest, givenAllocationUsedByTwoOsContextsWhe
asyncDeleter->allowExit = true;
*hwTag = 1u;
}
HWTEST_F(DeferrableAllocationDeletionTest, givenDeferrableAllocationDeletionWhenFlushedTaskIsGreaterThanAllocationTaskCountThenDoNotProgrammTagUpdate) {
auto &nonDefaultCommandStreamReceiver = static_cast<UltCommandStreamReceiver<FamilyType> &>(*device->commandStreamReceivers[1]);
auto nonDefaultOsContextId = nonDefaultCommandStreamReceiver.getOsContext().getContextId();
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
*hwTag = 0u;
*nonDefaultCommandStreamReceiver.getTagAddress() = 1u;
nonDefaultCommandStreamReceiver.setLatestFlushedTaskCount(4u);
allocation->updateTaskCount(1u, nonDefaultOsContextId);
allocation->updateTaskCount(1u, defaultOsContextId);
auto used = nonDefaultCommandStreamReceiver.getCS(0u).getUsed();
asyncDeleter->deferDeletion(new DeferrableAllocationDeletion(*memoryManager, *allocation));
while (allocation->isUsedByOsContext(nonDefaultOsContextId) && !device->getUltCommandStreamReceiver<FamilyType>().flushBatchedSubmissionsCalled) // wait for second context completion signal
std::this_thread::yield();
EXPECT_FALSE(nonDefaultCommandStreamReceiver.flushBatchedSubmissionsCalled);
EXPECT_EQ(used, nonDefaultCommandStreamReceiver.getCS(0u).getUsed());
asyncDeleter->allowExit = true;
*hwTag = 1u;
}
TEST_F(DeferrableAllocationDeletionTest, givenNotUsedAllocationWhenApplyDeletionThenDontWait) {
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
EXPECT_FALSE(allocation->isUsed());