mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Flush tag only if needed in deferred deleter
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
dad49bd2ee
commit
fffcf2612e
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user